This commit is contained in:
左哥 2025-06-18 21:42:12 +08:00
parent 8dff53cd2a
commit 2d962dc386
5 changed files with 75 additions and 34 deletions

View File

@ -45,7 +45,17 @@ Page({
newTime: formattedTime
})
},
async medicineRecord(e){
const {id, status} = e.currentTarget.dataset
if(status == 1){
await request('patient/medicine_record/'+id, 'put', {})
wx.showToast({
type: 'success',
title: '打卡成功',
})
this.getList()
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -22,8 +22,8 @@
</view>
</view>
<view class="box_1"></view>
<text lines="1" class="text_7" wx:if="{{item.status == 1}}">未打卡</text>
<view class="text-wrapper_3" wx:if="{{item.status == 2}}">
<text lines="1" class="text_7" wx:if="{{item.status == 2}}">未打卡</text>
<view class="text-wrapper_3" wx:if="{{item.status == 1}}" data-id="{{item.id}}" data-status="{{item.status}}" bind:tap="medicineRecord">
<text lines="1" class="text_14">打卡</text>
</view>
</view>

View File

@ -150,7 +150,9 @@ Page({
heightData: [],
weightData: [],
heightChart: null,
weightChart: null
weightChart: null,
carList: [],
carLength: 0
},
// Helper function to strip HTML tags and convert to plain text
@ -160,6 +162,12 @@ Page({
},
async getSfList(){
this.followPlans()
this.getArticleList()
this.getCarList()
},
async followPlans(){
const res = await request('patient/follow_plans', 'get', {
page: 1,
page_size: 10,
@ -179,7 +187,8 @@ Page({
daysUntilPlan: diffDays
}
})
},
async getArticleList(){
const res2 = await request('patient/articles', 'get', { title: '', page: 1, page_size: 2 });
// Convert rich text content to plain text
const plainTextContent = this.stripHtml(res2.list[0].content);
@ -195,6 +204,37 @@ Page({
})
},
async getCarList() {
const res3 = await request('patient/medicine_records', 'get', {
time_type: 1,
status: 0,
page: 1,
page_size: 10
})
const carList = res3.list.map(item => {
item.detail = JSON.parse(item.detail)
return item
})
setTimeout(() => {
this.setData({
carLength: res3.total,
carList: carList
})
})
},
async medicineRecord(e){
const {id, status} = e.currentTarget.dataset
if(status == 1){
await request('patient/medicine_record/'+id, 'put', {})
wx.showToast({
type: 'success',
title: '打卡成功',
})
this.getCarList()
}
},
async getChartData(){
const res = await request('patient/chat/0', 'get')
const heightData = []

View File

@ -334,8 +334,6 @@
color: rgba(34,34,34,1);
font-size: 32rpx;
font-family: Alibaba-PuHuiTi-M;
font-weight: normal;
text-align: right;
white-space: nowrap;
line-height: 32rpx;
margin-right: 86rpx;
@ -360,16 +358,25 @@
margin: 20rpx 0 18rpx 100rpx;
}
.text-wrapper_6 {
background-color: rgba(0,91,162,1.000000);
border-radius: 32rpx;
display: flex;
flex-direction: column;
margin: 22rpx 0 22rpx 24rpx;
padding: 12rpx 40rpx 12rpx 40rpx;
.text_23 {
color:rgba(0,91,162,1.000000);
}
}
.catArt{
background-color: rgba(0,91,162,1.000000);
.text_23 {
color: #fff;
}
}
.text_23 {
overflow-wrap: break-word;
color: rgba(255,255,255,1);
font-size: 28rpx;
font-family: Alibaba-PuHuiTi-M;
font-weight: normal;

View File

@ -29,42 +29,26 @@
更多
</view>
</view>
<!-- <view class="item-box"> -->
<!-- <view class="item-box-title">
<view class="item-box-title-left">
中午 12:00
</view>
<view class="item-box-title-right">
未完成
</view>
</view>
<view class="drug-name">
布洛芬
</view>
<view class="drug-usage">
1片 饭后复用
</view>
<t-button theme="primary" block>打卡</t-button> -->
<view wx:for="{{carList}}">
<view class="image-text_3">
<view class="box_6"></view>
<text lines="1" class="text-group_3">08:00</text>
<text lines="1" class="text-group_3">{{item.medicine_time}}</text>
</view>
<view class="box_9">
<view class="box_9" wx:for="{{item.detail}}" wx:for-item="item2">
<view class="image-text_5">
<view class="box_10"></view>
<view class="text-group_5">
<text lines="1" class="text_21">优思弗</text>
<text lines="1" class="text_22">1片饭后服用</text>
<text lines="1" class="text_21">{{item2.name}}</text>
<text lines="1" class="text_22">{{item2.frequency}}片,{{item2.time}}服用</text>
</view>
</view>
<view class="box_11"></view>
<view class="text-wrapper_6">
<text lines="1" class="text_23">打卡</text>
<view class="text-wrapper_6 {{item.status=='2'?'':'catArt'}}" data-id="{{item.id}}" data-status="{{item.status}}" bind:tap="medicineRecord">
<text lines="1" class="text_23">{{item.status=='2'?'已打卡':'打卡'}}</text>
</view>
</view>
<!-- </view> -->
</view>
</view>
<view class="item-content item-content-2" wx:if="{{sfListLength > 0}}">
<image class="item-content-1-bg" src="../../assets/images/home/img_2.png" mode="widthFix"></image>