2025-07-03 18:16:42 +08:00

127 lines
2.1 KiB
JavaScript

import request from '~/api/request';
Page({
/**
* 页面的初始数据
*/
data: {
visible: false,
current: ['checkbox1', 'checkbox2'],
options: [],
message: ''
},
handleCheck(e) {
const {
index
} = e.currentTarget.dataset
this.setData({
[`options[${index}].checked`]: !this.data.options[index].checked
})
},
async openFlow() {
const list = this.data.options.filter(item => item.checked).map(item => {
return {
id: item.id,
title: item.title,
description: item.description
}
})
const res = await request('patient/symptom/submit', 'post', {
detail: JSON.stringify(list),
})
wx.navigateTo({
url: '/pages/diagnosticResults/index?msg=' + res.message
})
},
closeFlow() {
this.setData({
visible: false
})
},
async getList(){
const res = await request('patient/symptoms', 'get')
// const list = res.list.map((item, index) => {
// let icon = ''
// if(index == 0){
// icon = 'iconfont icon-fare'
// }
// if(index == 1){
// icon = 'iconfont icon-dabianhui'
// }
// if(index == 2){
// icon = 'iconfont icon-xiaohuaneike'
// }
// if(index == 3){
// icon = 'iconfont icon-dabianhong'
// }
// return {
// ...item,
// icon: icon,
// checked: false
// }
// })
this.setData({
options: res.list
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})