From 67229cbd61314cfdf34e447b8a1e99f611d9306c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B7=A6=E5=93=A5?= <17630302050@163.com>
Date: Thu, 10 Jul 2025 22:11:05 +0800
Subject: [PATCH] sdsd
---
api/request.js | 4 ++
pages/AddTherapeuticRegimen/index.js | 9 +++--
pages/followUp/index.js | 35 +++++++++++++++---
pages/followUp/index.wxml | 2 +-
pages/loginCode/loginCode.js | 28 ++++++++------
pages/message/index.js | 4 +-
pages/message/index.wxml | 2 +-
pages/mmp-7/index.js | 7 ++--
pages/my/info-edit/index.js | 55 +++++++++++++++++++++++-----
pages/my/info-edit/index.wxml | 7 ++--
10 files changed, 112 insertions(+), 41 deletions(-)
diff --git a/api/request.js b/api/request.js
index b01acec..1eb533c 100644
--- a/api/request.js
+++ b/api/request.js
@@ -36,6 +36,10 @@ function request(url, method = 'GET', data = {}) {
}
reject(res.data);
}
+ wx.showToast({
+ title: res.data.message,
+ icon: 'none'
+ });
reject(res.data);
} else {
resolve(res.data);
diff --git a/pages/AddTherapeuticRegimen/index.js b/pages/AddTherapeuticRegimen/index.js
index 00e2f7e..7ab07cb 100644
--- a/pages/AddTherapeuticRegimen/index.js
+++ b/pages/AddTherapeuticRegimen/index.js
@@ -303,10 +303,11 @@ Page({
const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token)
-
+ const fileNameWithExt = file.path.split('/').pop(); // hello.png
+ const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = {
- key: 'upload_file/' + file.name, //上传文件名称
+ key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
@@ -327,7 +328,7 @@ Page({
success(res) {
console.log('上传响应:', res);
if (res.statusCode === 200) {
- callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ file.name); // 上传成功
+ callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else {
console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res);
@@ -376,7 +377,7 @@ Page({
}
});
},
- handleDelete(){
+ handleDelete(e){
this.setData({
imageFile: ''
});
diff --git a/pages/followUp/index.js b/pages/followUp/index.js
index ea686a2..1a82e86 100644
--- a/pages/followUp/index.js
+++ b/pages/followUp/index.js
@@ -223,7 +223,7 @@ Page({
data.coagulation_function_image = data.coagulation_function_image.length > 0 ? data.coagulation_function_image.join(',') : '',
data.mdt_image = data.mdt_image.length > 0 ? data.mdt_image.join(',') : '',
data.nutritional_indicator_image = data.nutritional_indicator_image.length > 0 ? data.nutritional_indicator_image.join(',') : ''
- await request('patient/follow_questionnaire', 'post',{planId: this.planId, ...data})
+ await request('patient/follow_questionnaire', 'post',{plan_id: Number(this.planId), ...data})
wx.showToast({
title: '提交成功',
icon: 'success',
@@ -248,9 +248,11 @@ Page({
const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token)
+ const fileNameWithExt = file.path.split('/').pop(); // hello.png
+ const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = {
- key: 'upload_file/' + file.name, //上传文件名称
+ key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
@@ -271,7 +273,7 @@ Page({
success(res) {
console.log('上传响应:', res);
if (res.statusCode === 200) {
- callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ file.name); // 上传成功
+ callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else {
console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res);
@@ -287,6 +289,11 @@ Page({
},
handleUpload(e) {
+ const { mode } = e.currentTarget.dataset;
+ if(this.data.form[mode].length >= 9){
+ wx.showToast({ title: '最多上传9张图片!', icon: 'none' });
+ return
+ }
wx.chooseImage({
count: 1, // 选择一个文件
type: 'all', // 支持所有类型的文件
@@ -339,7 +346,7 @@ Page({
imageVisible: false
})
},
- handleDelete(){
+ handleDelete(e){
const { mode, index } = e.currentTarget.dataset;
let arr = this.data.form[mode]
arr.splice(index, 1)
@@ -366,10 +373,28 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- console.log(options)
this.planId = options.planId
+ this.setData({
+ ['form.follow_name']: options.name,
+ ['form.follow_date']: options.time
+ })
+ this.getDetail()
},
+ async getDetail(){
+ const res = await request('patient/questionnaire_info', 'post',{patient_id : 0, questionnaire_id: Number(this.planId)})
+ const data = res.data
+ data.liver_function_image = data.liver_function_image ? data.liver_function_image.split(',') : []
+ data.b_mode_image = data.b_mode_image ? data.b_mode_image.split(',') : []
+ data.blood_routine_image = data.blood_routine_image ? data.blood_routine_image.split(',') : []
+ data.coagulation_function_image = data.coagulation_function_image ? data.coagulation_function_image.split(',') : []
+ data.mdt_image = data.mdt_image ? data.mdt_image.split(',') : []
+ data.nutritional_indicator_image = data.nutritional_indicator_image ? data.nutritional_indicator_image.split(',') : []
+
+ this.setData({
+ form: data
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/pages/followUp/index.wxml b/pages/followUp/index.wxml
index e721506..8bb6f96 100644
--- a/pages/followUp/index.wxml
+++ b/pages/followUp/index.wxml
@@ -46,7 +46,7 @@
- 头围(cm)
+ 头围(cm)
diff --git a/pages/loginCode/loginCode.js b/pages/loginCode/loginCode.js
index 0130c1d..8bb7580 100644
--- a/pages/loginCode/loginCode.js
+++ b/pages/loginCode/loginCode.js
@@ -23,7 +23,7 @@ Page({
async getCode(){
if (!this.data.phoneNumber) {
wx.showToast({
- title: '请输入手机号',
+ title: '手机号码不能为空',
icon: 'none'
});
return;
@@ -31,7 +31,7 @@ Page({
// 验证手机号格式
if (!/^1[3-9]\d{9}$/.test(this.data.phoneNumber)) {
wx.showToast({
- title: '请输入正确的手机号',
+ title: '手机号码格式不正确',
icon: 'none'
});
return;
@@ -79,7 +79,7 @@ Page({
// 验证手机号
if (!this.data.phoneNumber) {
wx.showToast({
- title: '请输入手机号',
+ title: '手机号码不能为空',
icon: 'none'
});
return;
@@ -87,7 +87,7 @@ Page({
// 验证手机号格式
if (!/^1[3-9]\d{9}$/.test(this.data.phoneNumber)) {
wx.showToast({
- title: '请输入正确的手机号',
+ title: '手机号码格式不正确',
icon: 'none'
});
return;
@@ -95,24 +95,28 @@ Page({
// 验证验证码
if (!this.data.code) {
wx.showToast({
- title: '请输入验证码',
+ title: '验证码不能为空',
icon: 'none'
});
return;
}
// 验证验证码格式(假设验证码为6位数字)
- if (!/^\d{6}$/.test(this.data.code)) {
- wx.showToast({
- title: '请输入6位数字验证码',
- icon: 'none'
- });
- return;
- }
+ // if (!/^\d{6}$/.test(this.data.code)) {
+ // wx.showToast({
+ // title: '请输入6位数字验证码',
+ // icon: 'none'
+ // });
+ // return;
+ // }
const res = await request('patient/code_login', 'post', {
code: this.data.code,
mobile: this.data.phoneNumber
});
+ wx.showToast({
+ title: '登录成功',
+ icon: 'success'
+ });
await wx.setStorageSync('access_token', res.token);
if (res.is_personal_information_complete) {
wx.switchTab({
diff --git a/pages/message/index.js b/pages/message/index.js
index f8a105d..a395730 100644
--- a/pages/message/index.js
+++ b/pages/message/index.js
@@ -101,9 +101,9 @@ Page({
},
toQuestionnaire(e) {
- const id = e.currentTarget.dataset.id
+ const { id, time, name } = e.currentTarget.dataset
wx.navigateTo({
- url: '/pages/followUp/index?planId='+id,
+ url: `/pages/followUp/index?planId=${id}&name=${name}&time=${time}` ,
})
},
toRegister() {
diff --git a/pages/message/index.wxml b/pages/message/index.wxml
index a06be49..8986144 100644
--- a/pages/message/index.wxml
+++ b/pages/message/index.wxml
@@ -16,7 +16,7 @@
{{item.plan_name}}
- 填写随访问卷
+ 填写随访问卷
预约挂号
diff --git a/pages/mmp-7/index.js b/pages/mmp-7/index.js
index 617679c..c9c26c8 100644
--- a/pages/mmp-7/index.js
+++ b/pages/mmp-7/index.js
@@ -38,10 +38,11 @@ async uploadFileToOSS(file, callback) {
const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token)
-
+ const fileNameWithExt = file.path.split('/').pop(); // hello.png
+ const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = {
- key: 'upload_file/' + file.name, //上传文件名称
+ key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
@@ -62,7 +63,7 @@ async uploadFileToOSS(file, callback) {
success(res) {
console.log('上传响应:', res);
if (res.statusCode === 200) {
- callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ file.name); // 上传成功
+ callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else {
console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res);
diff --git a/pages/my/info-edit/index.js b/pages/my/info-edit/index.js
index 2ea8a98..7a0a290 100644
--- a/pages/my/info-edit/index.js
+++ b/pages/my/info-edit/index.js
@@ -237,6 +237,17 @@ Page({
years--;
months += 12;
}
+ if (years <= 0 && months <= 0) {
+ // 小于一个月,显示几周
+ const diffTime = today - birthDate;
+ const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
+ if (diffDays < 7) {
+ return `${diffDays}天`;
+ } else {
+ const weeks = Math.floor(diffDays / 7);
+ return `${weeks}周`;
+ }
+ }
if (years <= 0) {
return `${months}个月`;
}
@@ -251,11 +262,13 @@ Page({
if (mode == 'birth') {
this.setData({
['personInfo.birthday']: value,
- ['personInfo.age']: this.getAgeByBirthday(value)
+ ['personInfo.age']: this.getAgeByBirthday(value),
+ ['errorStatus.birthday']: false
})
} else {
this.setData({
- ['personInfo.operative_date']: value
+ ['personInfo.operative_date']: value,
+ ['errorStatus.operative_date']: false
})
}
@@ -272,7 +285,11 @@ Page({
onNameChange(e) {
this.personInfoFieldChange('username', e);
- if (this.data.errorStatus.name) {
+ const value = e.detail.value;
+ // Validate name length (2-20)
+ if (value.length < 2 || value.length > 20) {
+ this.setData({ 'errorStatus.name': true });
+ } else if (this.data.errorStatus.name) {
this.setData({ 'errorStatus.name': false });
}
},
@@ -324,7 +341,8 @@ Page({
async onSaveInfo() {
let obj = this.data.personInfo;
let errorStatus = {};
- errorStatus.name = !obj.username;
+ // Name must be 2-20 characters
+ errorStatus.name = !obj.username || obj.username.length < 2 || obj.username.length > 20;
errorStatus.gender = !obj.sex;
errorStatus.id = obj.id_number ? !/^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(obj.id_number) : false;
errorStatus.birthday = !obj.birthday;
@@ -334,9 +352,10 @@ Page({
errorStatus.parity_number = !obj.parity_number;
errorStatus.birth_number = !obj.birth_number;
errorStatus.conception_type = !obj.conception_type;
- errorStatus.gestational_week = !/^\d+(\.\d+)?$/.test(obj.gestational_week);
+ errorStatus.gestational_week = !/^\d+(\.\d+)?$/.test(obj.gestational_week) || Number(obj.gestational_week) <= 0;
errorStatus.prenatal_check_type = !obj.prenatal_check_type;
errorStatus.delivery_type = !obj.delivery_type;
+ errorStatus.prenatal_check_remark = !obj.prenatal_check_remark;
this.setData({ errorStatus });
if (Object.values(errorStatus).some(v => v)) {
return;
@@ -377,15 +396,22 @@ Page({
}
},
onWeightInput(e) {
- const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value);
- if (this.data.errorStatus.birth_weight) {
+ // const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value);
+ // if (this.data.errorStatus.birth_weight) {
+ // this.setData({ 'errorStatus.birth_weight': false });
+ // }
+ if(!e.detail.value || e.detail.value == 0){
+ this.setData({ 'errorStatus.birth_weight': true });
+ } else {
this.setData({ 'errorStatus.birth_weight': false });
}
this.personInfoFieldChange('birth_weight', e);
},
onWeekInput(e) {
- const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value);
- if (this.data.errorStatus.gestational_week) {
+ console.log(e.detail.value == true)
+ if(!e.detail.value || e.detail.value == 0){
+ this.setData({ 'errorStatus.gestational_week': true });
+ } else {
this.setData({ 'errorStatus.gestational_week': false });
}
this.personInfoFieldChange('gestational_week', e);
@@ -408,7 +434,16 @@ Page({
label
} = e.detail;
this.setData({
- [`personInfo.${modeText}`]: value[0]
+ [`personInfo.${modeText}`]: value[0],
+ [`errorStatus.${modeText}`]: false
})
+
+ },
+ onPrenatalCheckRemarkChange(e) {
+ this.setData({
+ ['personInfo.prenatal_check_remark']: e.detail.value,
+ ['errorStatus.prenatal_check_remark']: false
+ })
+
},
});
\ No newline at end of file
diff --git a/pages/my/info-edit/index.wxml b/pages/my/info-edit/index.wxml
index e049edb..b9e54b7 100644
--- a/pages/my/info-edit/index.wxml
+++ b/pages/my/info-edit/index.wxml
@@ -3,7 +3,7 @@
- 请输入患者姓名
+ 姓名字数在2至20之间
@@ -39,7 +39,7 @@
- 请选择胆道闭锁手术时间名
+ 请选择胆道闭锁手术时间
@@ -69,8 +69,9 @@
-
+
请选择产检是否有异常
+ 请输入异常描述