This commit is contained in:
左哥 2025-07-17 23:31:50 +08:00
parent d7b0684e28
commit cc996a6dc2
16 changed files with 158 additions and 66 deletions

View File

@ -303,7 +303,7 @@ Page({
const policyData = await request('admin/policy_token', 'post') const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token) const res = JSON.parse(policyData.token)
const fileNameWithExt = file.path.split('/').pop(); // hello.png const fileNameWithExt = file.tempFilePath.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = { const formData = {
@ -322,7 +322,7 @@ Page({
wx.uploadFile({ wx.uploadFile({
url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/',
method: 'put', method: 'put',
filePath: file.path, filePath: file.tempFilePath,
name: 'file', //固定值为file name: 'file', //固定值为file
formData: formData, formData: formData,
success(res) { success(res) {
@ -344,9 +344,10 @@ Page({
}, },
handleUpload(e) { handleUpload(e) {
wx.chooseImage({ wx.chooseMedia({
count: 1, // 选择一个文件 count: 1, // 选择一个文件
type: 'all', // 支持所有类型的文件 mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' }); wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' });
console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息 console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息

View File

@ -94,7 +94,7 @@
.after{ .after{
position: absolute; position: absolute;
width: 0; width: 0;
height: calc(100% - 40rpx); height: calc(100% - 20rpx);
top: 34rpx; top: 34rpx;
left: 10rpx; left: 10rpx;
border-left: 2rpx dashed rgba(0,91,162,0.7); border-left: 2rpx dashed rgba(0,91,162,0.7);
@ -112,6 +112,8 @@
flex-direction: row; flex-direction: row;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 10rpx 0;
padding-bottom: 20rpx;
} }
.group_4 { .group_4 {
border-radius: 100%; border-radius: 100%;
@ -159,7 +161,6 @@
} }
.image-text_1 { .image-text_1 {
// display: flex; // display: flex;
padding-right: 134rpx;
} }
// .section_4 { // .section_4 {
// border-radius: 16rpx; // border-radius: 16rpx;
@ -209,16 +210,16 @@
.text_7 { .text_7 {
overflow-wrap: break-word; overflow-wrap: break-word;
color: rgba(0,91,162,1); color: rgba(0,91,162,1);
font-size: 28rpx; font-size: 26rpx;
font-family: Alibaba-PuHuiTi-M; font-family: Alibaba-PuHuiTi-M;
font-weight: normal; font-weight: normal;
text-align: right; text-align: right;
white-space: nowrap; white-space: nowrap;
line-height: 32rpx; line-height: 32rpx;
position: absolute; position: absolute;
right: 50rpx; right: 0rpx;
top: 50%; top: 4rpx;
transform: translateY(-50%); z-index: 1;
} }
.section_5 { .section_5 {
width: 112rpx; width: 112rpx;
@ -386,23 +387,27 @@
background-color: rgba(0,91,162,1.000000); background-color: rgba(0,91,162,1.000000);
border-radius: 32rpx; border-radius: 32rpx;
padding: 10rpx 32rpx 10rpx 32rpx; // padding: 8rpx 28rpx 8rpx 28rpx;
// width: 70rpx; height: 50rpx;
width: 100rpx;
text-align: center; text-align: center;
position: absolute; position: absolute;
right: 24rpx; right: 0rpx;
top: 50%; top: 0;
transform: translateY(-50%); // transform: translateY(-50%);
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
} }
.text_14 { .text_14 {
overflow-wrap: break-word;
color: rgba(255,255,255,1); color: rgba(255,255,255,1);
font-size: 28rpx; font-size: 26rpx;
font-family: Alibaba-PuHuiTi-M; font-family: Alibaba-PuHuiTi-M;
font-weight: normal; // font-weight: normal;
text-align: right; // text-align: right;
white-space: nowrap; // white-space: nowrap;
line-height: 32rpx; // line-height: 32rpx;
} }
.section_10 { .section_10 {
width: 112rpx; width: 112rpx;

View File

@ -12,6 +12,10 @@
<view class="{{item.status == 2 ? 'section_2 acitve' : 'section_2'}}"> <view class="{{item.status == 2 ? 'section_2 acitve' : 'section_2'}}">
<view class="group_4"></view> <view class="group_4"></view>
<text lines="1" class="text_4">{{item.medicine_time}}</text> <text lines="1" class="text_4">{{item.medicine_time}}</text>
<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>
<view class="section_3" wx:for="{{item.detail}}" wx:for-item="detail"> <view class="section_3" wx:for="{{item.detail}}" wx:for-item="detail">
<view class="block_1"> <view class="block_1">
@ -22,11 +26,8 @@
<view lines="1" class="text_6">{{detail.dose}} {{detail.time}}</view> <view lines="1" class="text_6">{{detail.dose}} {{detail.time}}</view>
</view> </view>
</view> </view>
<view class="box_1"></view> <!-- <view class="box_1"></view> -->
<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>
</view> </view>
</view> </view>

View File

@ -251,7 +251,7 @@ Page({
const policyData = await request('admin/policy_token', 'post') const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token) const res = JSON.parse(policyData.token)
const fileNameWithExt = file.path.split('/').pop(); // hello.png const fileNameWithExt = file.tempFilePath.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = { const formData = {
@ -270,7 +270,7 @@ Page({
wx.uploadFile({ wx.uploadFile({
url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/',
method: 'put', method: 'put',
filePath: file.path, filePath: file.tempFilePath,
name: 'file', //固定值为file name: 'file', //固定值为file
formData: formData, formData: formData,
success(res) { success(res) {
@ -297,9 +297,11 @@ Page({
wx.showToast({ title: '最多上传9张图片!', icon: 'none' }); wx.showToast({ title: '最多上传9张图片!', icon: 'none' });
return return
} }
wx.chooseImage({ wx.chooseMedia({
count: 1, // 选择一个文件 count: 1, // 选择一个文件
type: 'all', // 支持所有类型的文件 mediaType: ['image'],
sourceType: ['album', 'camera'],
// type: 'all', // 支持所有类型的文件
success: (res) => { success: (res) => {
wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' }); wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' });
console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息 console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息

View File

@ -282,7 +282,8 @@
flex-direction: row; flex-direction: row;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 32rpx 0rpx 18rpx 0; margin: 30rpx 0;
// margin-bottom: 32rpx;
} }
.box_6 { .box_6 {
border-radius: 100%; border-radius: 100%;
@ -365,13 +366,17 @@
border-radius: 32rpx; border-radius: 32rpx;
padding: 10rpx 32rpx 10rpx 32rpx; // padding: 10rpx 32rpx 10rpx 32rpx;
// width: 70rpx; height: 50rpx;
width: 100rpx;
text-align: center; text-align: center;
position: absolute; position: absolute;
right: 24rpx; right: 0rpx;
top: 50%; top: -10rpx;
transform: translateY(-50%); align-items: center;
// transform: translateY(-50%);
z-index: 1;
.text_23 { .text_23 {
color:rgba(0,91,162,1.000000); color:rgba(0,91,162,1.000000);
} }
@ -385,7 +390,7 @@
} }
.text_23 { .text_23 {
overflow-wrap: break-word; overflow-wrap: break-word;
font-size: 28rpx; font-size: 26rpx;
font-family: Alibaba-PuHuiTi-M; font-family: Alibaba-PuHuiTi-M;
font-weight: normal; font-weight: normal;
text-align: right; text-align: right;

View File

@ -39,6 +39,9 @@
<view class="image-text_3"> <view class="image-text_3">
<view class="box_6"></view> <view class="box_6"></view>
<text lines="1" class="text-group_3">{{item.medicine_time}}</text> <text lines="1" class="text-group_3">{{item.medicine_time}}</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 class="box_9" wx:for="{{item.detail}}" wx:for-item="item2"> <view class="box_9" wx:for="{{item.detail}}" wx:for-item="item2">
<view class="image-text_5"> <view class="image-text_5">
@ -48,10 +51,8 @@
<view lines="1" class="text_22">{{item2.frequency}}片,{{item2.time}}服用</view> <view lines="1" class="text_22">{{item2.frequency}}片,{{item2.time}}服用</view>
</view> </view>
</view> </view>
<view class="box_11"></view> <!-- <view class="box_11"></view> -->
<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> </view>

View File

@ -147,7 +147,7 @@
.after{ .after{
position: absolute; position: absolute;
width: 0; width: 0;
height: calc(100% - 40rpx); height: calc(100% - 20rpx);
top: 34rpx; top: 34rpx;
left: 10rpx; left: 10rpx;
border-left: 2rpx dashed rgba(0,91,162,0.7); border-left: 2rpx dashed rgba(0,91,162,0.7);
@ -165,6 +165,8 @@
flex-direction: row; flex-direction: row;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 10rpx 0;
margin-bottom: 20rpx;
} }
.group_4 { .group_4 {
border-radius: 100%; border-radius: 100%;
@ -212,7 +214,6 @@
} }
.image-text_1 { .image-text_1 {
display: flex; display: flex;
padding-right: 160rpx;
} }
.section_4 { .section_4 {
border-radius: 16rpx; border-radius: 16rpx;
@ -262,19 +263,20 @@
.text_7 { .text_7 {
overflow-wrap: break-word; overflow-wrap: break-word;
color: #909399; color: #909399;
font-size: 28rpx; font-size: 26rpx;
font-family: Alibaba-PuHuiTi-M; font-family: Alibaba-PuHuiTi-M;
font-weight: normal; font-weight: normal;
text-align: right; text-align: right;
white-space: nowrap; white-space: nowrap;
line-height: 32rpx; line-height: 32rpx;
position: absolute; position: absolute;
right: 24rpx; right: 0rpx;
top: 50%; top: 4rpx;
transform: translateY(-50%); z-index: 1;
.active{
color: rgba(0,91,162,1); }
} .active{
color: rgba(0,91,162,1);
} }
.section_5 { .section_5 {
width: 112rpx; width: 112rpx;

View File

@ -40,19 +40,20 @@
<view class="{{day.status == 2 ? 'section_2 acitve' : 'section_2'}}"> <view class="{{day.status == 2 ? 'section_2 acitve' : 'section_2'}}">
<view class="group_4"></view> <view class="group_4"></view>
<text lines="1" class="text_4">{{day.medicine_time}}</text> <text lines="1" class="text_4">{{day.medicine_time}}</text>
<text lines="1" class="text_7 active" wx:if="{{day.status == 2}}">已打卡</text>
<text lines="1" class="text_7" wx:if="{{day.status == 1}}">未打卡</text>
</view> </view>
<view class="section_3" wx:for="{{day.detail}}" wx:for-item="detail"> <view class="section_3" wx:for="{{day.detail}}" wx:for-item="detail">
<view class="block_1"> <view class="block_1">
<view class="image-text_1"> <view class="image-text_1">
<view class="section_4"></view> <!-- <view class="section_4"></view> -->
<view class="text-group_1"> <view class="text-group_1">
<view lines="1" class="text_5">{{detail.name}}</view> <view lines="1" class="text_5">{{detail.name}}</view>
<view lines="1" class="text_6">{{detail.dose}} {{detail.time}}</view> <view lines="1" class="text_6">{{detail.dose}} {{detail.time}}</view>
</view> </view>
</view> </view>
<view class="box_1"></view> <!-- <view class="box_1"></view> -->
<text lines="1" class="text_7 active" wx:if="{{day.status == 2}}">已打卡</text>
<text lines="1" class="text_7" wx:if="{{day.status == 1}}">未打卡</text>
</view> </view>
</view> </view>
</view> </view>

View File

@ -108,9 +108,10 @@ Page({
}) })
}, },
goQuestionnaire(e) { goQuestionnaire(e) {
const data = this.data.dataList[0] const data = this.data.dataList
const target = data.find(item => item.questionnaire_id === 0 && item.status === 2);
wx.navigateTo({ wx.navigateTo({
url: `/pages/followUp/index?planId=${data.id}&name=${data.plan_name}&time=${data.plan_date}&questionnaire_id=${data.questionnaire_id}` , url: `/pages/followUp/index?planId=${target.id}&name=&time=&questionnaire_id=0` ,
}) })
}, },
toRegister() { toRegister() {

View File

@ -38,7 +38,7 @@ async uploadFileToOSS(file, callback) {
const policyData = await request('admin/policy_token', 'post') const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token) const res = JSON.parse(policyData.token)
const fileNameWithExt = file.path.split('/').pop(); // hello.png const fileNameWithExt = file.tempFilePath.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = { const formData = {
@ -57,7 +57,7 @@ async uploadFileToOSS(file, callback) {
wx.uploadFile({ wx.uploadFile({
url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/',
method: 'put', method: 'put',
filePath: file.path, filePath: file.tempFilePath,
name: 'file', //固定值为file name: 'file', //固定值为file
formData: formData, formData: formData,
success(res) { success(res) {
@ -82,9 +82,10 @@ handleUpload(e) {
const { mode } = e.currentTarget.dataset; const { mode } = e.currentTarget.dataset;
wx.chooseImage({ wx.chooseMedia({
count: 1, // 选择一个文件 count: 1, // 选择一个文件
type: 'all', // 支持所有类型的文件 mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' }); wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' });
if (res.tempFiles.length > 0) { if (res.tempFiles.length > 0) {

View File

@ -57,6 +57,7 @@ Page({
const Token = wx.getStorageSync('access_token'); const Token = wx.getStorageSync('access_token');
if (Token) { if (Token) {
const personalInfo = await this.getPersonalInfo(); const personalInfo = await this.getPersonalInfo();
personalInfo.avatar = personalInfo.avatar ? personalInfo.avatar : 'https://image-fudan.oss-cn-beijing.aliyuncs.com/mini_images/my/baby.png';
let style = '' let style = ''
if(personalInfo.risk_type == '1' || !personalInfo.risk_type){ if(personalInfo.risk_type == '1' || !personalInfo.risk_type){
style = 'success' style = 'success'

View File

@ -171,6 +171,7 @@
background-color: rgba(255,255,255,0.5); background-color: rgba(255,255,255,0.5);
// padding: 20rpx; // padding: 20rpx;
border-radius: 120rpx; border-radius: 120rpx;
overflow: hidden;
// border: 4rpx solid rgba(255,255,255,1); // border: 4rpx solid rgba(255,255,255,1);
image{ image{
width: 100%; width: 100%;

View File

@ -18,7 +18,7 @@
<view class="section_2" wx:if="{{!isLoad}}" bind:tap="onNavigateTo"> <view class="section_2" wx:if="{{!isLoad}}" bind:tap="onNavigateTo">
<view class="image_5"> <view class="image_5">
<image src="https://image-fudan.oss-cn-beijing.aliyuncs.com/mini_images/my/baby.png" class=""></image> <image src="{{personalInfo.avatar}}" class=""></image>
</view> </view>
<view class="block_4"> <view class="block_4">

View File

@ -341,8 +341,71 @@ Page({
userInfoHandler(e){ userInfoHandler(e){
console.log(e.detail) console.log(e.detail)
this.uploadFileToOSS(e.detail.avatarUrl, (error, data) => {
if (error) {
wx.showToast({ title: '上传失败!', icon: 'none' });
console.error('上传失败:', error); // 输出具体的错误信息
} else {
wx.showToast({ title: '上传成功!', icon: 'success' });
this.setData({
'personInfo.avatar': data
})
console.log('上传成功:', data); // 输出上传成功后的数据
}
});
}, },
//上传文件方法
async uploadFileToOSS(file, callback) {
const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token)
const fileNameWithExt = file.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = {
key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
'x-oss-date': res.x_oss_date, //请求的时间
'x-oss-signature': res.signature, //签名认证描述信息
'x-oss-security-token': res.security_token, //安全令牌
success_action_status: "200" //上传成功后响应状态码
};
// console.log(filePath)
// return
// 发送请求上传文件
wx.uploadFile({
url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/',
method: 'put',
filePath: file,
name: 'file', //固定值为file
formData: formData,
success(res) {
console.log('上传响应:', res);
if (res.statusCode === 200) {
callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else {
console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res);
callback(res); // 上传失败,返回响应
}
},
fail(err) {
console.error('上传失败:', err); // 输出错误信息
wx.showToast({ title: '上传失败,请重试!', icon: 'none' });
callback(err); // 调用回调处理错误
}
});
},
async onSaveInfo() { async onSaveInfo() {
let obj = this.data.personInfo; let obj = this.data.personInfo;
let errorStatus = {}; let errorStatus = {};

View File

@ -67,12 +67,19 @@ page {
z-index: 999; z-index: 999;
} }
.info-edit__cell.avatar{
.t-cell__title{
line-height: 60rpx;
}
}
.user-avatar{ .user-avatar{
border: 0; border: 0;
padding: 0;
background-color: transparent; background-color: transparent;
width: 80rpx; width: 60rpx;
height: 80rpx; height: 60rpx;
border-radius: 80rpx; border-radius: 60rpx;
overflow: hidden; overflow: hidden;
image{ image{
width: 100%; width: 100%;

View File

@ -1,7 +1,7 @@
<view class="info-edit"> <view class="info-edit">
<view class="info-item"> <view class="info-item">
<t-cell class="info-edit__cell" title="头像" bordered="{{false}}"> <t-cell class="info-edit__cell avatar" arrow title="头像" bordered="{{false}}">
<button class="user-avatar" open-type="getUserInfo" bindgetuserinfo="userInfoHandler"> <button slot="note" class="user-avatar" open-type="chooseAvatar" bindchooseavatar="userInfoHandler">
<image src="{{personInfo.avatar}}"></image> <image src="{{personInfo.avatar}}"></image>
</button> </button>
</t-cell> </t-cell>