This commit is contained in:
@zuopngfei 2025-08-01 14:19:38 +08:00
parent b6fb882a7e
commit 240e99a962
3 changed files with 99 additions and 55 deletions

View File

@ -118,9 +118,12 @@ Page({
}); });
await wx.setStorageSync('access_token', res.token); await wx.setStorageSync('access_token', res.token);
if (res.is_personal_information_complete) { if (res.is_personal_information_complete) {
wx.switchTab({ wx.navigateBack({
url: `/pages/my/index`, delta: 2
}); });
// wx.switchTab({
// url: `/pages/my/index`,
// });
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: `/pages/my/info-edit/index`, url: `/pages/my/info-edit/index`,

View File

@ -43,9 +43,7 @@ Page({
}, },
onLoad(options) { onLoad(options) {
if(options.scrm_userid){
this.scrmBindTag(options.scrm_userid)
}
}, },
handelClick(e) { handelClick(e) {
@ -136,13 +134,6 @@ Page({
}, },
// 通过分享页面设置手术时间标签
scrmBindTag(user_id){
request('patient/bind_tag', 'post', {
wx_user_id: user_id,
})
},

View File

@ -125,12 +125,17 @@ Page({
timePickerTitle: '选择日期', timePickerTitle: '选择日期',
}, },
onLoad() { async onLoad(options) {
// this.initAreaData(); // this.getPersonalInfo()
this.getPersonalInfo()
this.setData({ this.setData({
isIOS: wx.getSystemInfoSync().platform === 'ios' isIOS: wx.getSystemInfoSync().platform === 'ios'
}) })
if (options.scrm_userid) {
await wx.setStorageSync('scrm_userid', options.scrm_userid);
}
},
onShow() {
this.getPersonalInfo()
}, },
async getPersonalInfo() { async getPersonalInfo() {
const info = await request('patient/basic/0') const info = await request('patient/basic/0')
@ -153,6 +158,9 @@ Page({
avatar: info.avatar ? info.avatar : 'https://image-fudan.oss-cn-beijing.aliyuncs.com/mini_images/my/baby.png', avatar: info.avatar ? info.avatar : 'https://image-fudan.oss-cn-beijing.aliyuncs.com/mini_images/my/baby.png',
} }
}) })
if (wx.getStorageSync('scrm_userid')) {
this.scrmBindTag(wx.getStorageSync('scrm_userid'))
}
}, },
@ -294,16 +302,22 @@ Page({
const value = e.detail.value; const value = e.detail.value;
// Validate name length (2-20) // Validate name length (2-20)
if (value.length < 2 || value.length > 20) { if (value.length < 2 || value.length > 20) {
this.setData({ 'errorStatus.name': true }); this.setData({
'errorStatus.name': true
});
} else if (this.data.errorStatus.name) { } else if (this.data.errorStatus.name) {
this.setData({ 'errorStatus.name': false }); this.setData({
'errorStatus.name': false
});
} }
}, },
onGenderChange(e) { onGenderChange(e) {
this.personInfoFieldChange('sex', e); this.personInfoFieldChange('sex', e);
if (this.data.errorStatus.gender) { if (this.data.errorStatus.gender) {
this.setData({ 'errorStatus.gender': false }); this.setData({
'errorStatus.gender': false
});
} }
}, },
// onYearChange(e) { // onYearChange(e) {
@ -349,10 +363,16 @@ Page({
this.uploadFileToOSS(e.detail.avatarUrl, (error, data) => { this.uploadFileToOSS(e.detail.avatarUrl, (error, data) => {
if (error) { if (error) {
wx.showToast({ title: '上传失败!', icon: 'none' }); wx.showToast({
title: '上传失败!',
icon: 'none'
});
console.error('上传失败:', error); // 输出具体的错误信息 console.error('上传失败:', error); // 输出具体的错误信息
} else { } else {
wx.showToast({ title: '上传成功!', icon: 'success' }); wx.showToast({
title: '上传成功!',
icon: 'success'
});
this.setData({ this.setData({
'personInfo.avatar': data 'personInfo.avatar': data
}) })
@ -403,7 +423,10 @@ Page({
}, },
fail(err) { fail(err) {
console.error('上传失败:', err); // 输出错误信息 console.error('上传失败:', err); // 输出错误信息
wx.showToast({ title: '上传失败,请重试!', icon: 'none' }); wx.showToast({
title: '上传失败,请重试!',
icon: 'none'
});
callback(err); // 调用回调处理错误 callback(err); // 调用回调处理错误
} }
}); });
@ -436,7 +459,9 @@ Page({
errorStatus.prenatal_check_remark = false; errorStatus.prenatal_check_remark = false;
} }
console.log(errorStatus); console.log(errorStatus);
this.setData({ errorStatus }); this.setData({
errorStatus
});
if (Object.values(errorStatus).some(v => v)) { if (Object.values(errorStatus).some(v => v)) {
return; return;
} }
@ -460,7 +485,9 @@ Page({
const value = e.detail.value; const value = e.detail.value;
const reg18 = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/; const reg18 = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
if (this.data.errorStatus.id) { if (this.data.errorStatus.id) {
this.setData({ 'errorStatus.id': false }); this.setData({
'errorStatus.id': false
});
} }
this.personInfoFieldChange('id_number', e); this.personInfoFieldChange('id_number', e);
// 如果输入合法身份证号,自动提取出生日期 // 如果输入合法身份证号,自动提取出生日期
@ -479,18 +506,26 @@ Page({
// this.setData({ 'errorStatus.birth_weight': false }); // this.setData({ 'errorStatus.birth_weight': false });
// } // }
if (!e.detail.value || e.detail.value == 0) { if (!e.detail.value || e.detail.value == 0) {
this.setData({ 'errorStatus.birth_weight': true }); this.setData({
'errorStatus.birth_weight': true
});
} else { } else {
this.setData({ 'errorStatus.birth_weight': false }); this.setData({
'errorStatus.birth_weight': false
});
} }
this.personInfoFieldChange('birth_weight', e); this.personInfoFieldChange('birth_weight', e);
}, },
onWeekInput(e) { onWeekInput(e) {
console.log(e.detail.value == true) console.log(e.detail.value == true)
if (!e.detail.value || e.detail.value == 0) { if (!e.detail.value || e.detail.value == 0) {
this.setData({ 'errorStatus.gestational_week': true }); this.setData({
'errorStatus.gestational_week': true
});
} else { } else {
this.setData({ 'errorStatus.gestational_week': false }); this.setData({
'errorStatus.gestational_week': false
});
} }
this.personInfoFieldChange('gestational_week', e); this.personInfoFieldChange('gestational_week', e);
}, },
@ -540,4 +575,19 @@ Page({
wx.hideKeyboard(); wx.hideKeyboard();
}, 50) }, 50)
}, },
// 通过分享页面设置手术时间标签
async scrmBindTag(user_id) {
const res = await request('patient/bind_tag', 'post', {
wx_user_id: user_id,
})
await wx.removeStorageSync('scrm_userid');
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
}); });