/* * 手太欠 * 愿这世界都如故事里一样 美好而动人~ */ Page({ /** * 页面的初始数据 */ data: { disabled : false ,// 提交按钮状态 editState: false, //是否可以编辑表单 experience: '', numberVal: '', count : '', //查看我的病例内容 name : '', id_card : '', username: '', sex : '', cover : '', remark : '', age : '', height : '', weight : '', gout_case_id: '', isCase : '', status : '', sexIndex : 0, sexName : 'man', sexArray : [{ val : 'man', name : '男' },{ val : 'woman', name : '女' }], symptomSee: [], //查看身体状况 symptoms : [] ,//身体状况前置 statusArr: [] //身体状况选择 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ experience: options.experience }) }, /** * 生命周期函数--监听页面显示 */ onShow() { // 是否有档案 wx.$api.user.userIndex().then(res => { if(res.data.status.isCase){ this.setData({ editState: true, isCase : res.data.status.isCase }) // 获取已有档案信息 this.goutSeeInfo(); return } // 健康前置信息 wx.$api.member.goutCreate().then(res => { this.setData({ symptoms: res.data.symptoms }) }).catch(err => {}) }).catch(err => {}) }, /** * 查看已有档案信息 */ goutSeeInfo() { wx.$api.member.goutSee().then(res => { this.setData({ status : res.data.case.status, name : res.data.case.name, username : res.data.case.user.username, sex : res.data.case.sex, age : res.data.case.age, height : res.data.case.height, weight : res.data.case.weight, symptomSee : res.data.case.symptoms, sexName : res.data.case.sex, caseId : res.data.case.case_id, gout_case_id : res.data.case.gout_case_id }) }).catch(err => {}) }, // 高血脂 hyperlipemiaInput(e) { this.data.hyperlipemiaNumber = e.detail.value }, // 高血压 hypertensionInput(e) { this.data.hypertensionNumber = e.detail.value }, // 高血糖 hyperglycemiaInput(e) { this.data.hyperglycemiaNumber = e.detail.value }, // 身体状况多选 statusChange(e){ this.data.statusArr = String(e.detail.value) }, // 提交表单 hyperlipemia;hypertension;hyperglycemia issueForm(e) { let value = e.detail.value; let data = { name : value.name, age : value.age, height : value.height, weight : value.weight, remark : value.remark, symptoms : this.data.statusArr, sex : this.data.sexArray[this.data.sexIndex].val, experience : this.data.experience } wx.$api.member.goutAdd(data).then(res => { this.setData({ disabled: true }) wx.navigateBack() }).catch(err => {}) }, /** * 选择男女 */ bindSexChange(e) { this.setData({ sexIndex : parseInt(e.detail.value), sexName : this.data.sexArray[e.detail.value].val }) // if(this.data.sexArray[e.detail.value].val == 'woman') { // this.setData({ // hyperlipemiaMax : this.data.count.woman.hyperlipidemia.max, // hyperlipemiaMin : this.data.count.woman.hyperlipidemia.min, // hypertensionMax : this.data.count.woman.hypertension.max, // hypertensionMin : this.data.count.woman.hypertension.min, // hyperglycemiaMax : this.data.count.woman.hyperglycemia.max, // hyperglycemiaMin : this.data.count.woman.hyperglycemia.min // }) // }else { // this.setData({ // hyperlipemiaMax : this.data.count.man.hyperlipidemia.max, // hyperlipemiaMin : this.data.count.man.hyperlipidemia.min, // hypertensionMax : this.data.count.man.hypertension.max, // hypertensionMin : this.data.count.man.hypertension.min, // hyperglycemiaMax : this.data.count.man.hyperglycemia.max, // hyperglycemiaMin : this.data.count.man.hyperglycemia.min, // }) // } }, })