/* * 手太欠 * 愿这世界都如故事里一样 美好而动人~ */ Page({ /** * 页面的初始数据 */ data: { userData : '', // 用户信息 goodsData : '', // 商品信息 aiSeeData : '', // 检测结果 baseData : '', // 基本资料 typesType : '', // 类型分类 typesData : '', // 舌象类型 resultData : '', // 舌象类型结果 imageId : '', // 结果id typesState : false,// 舌象类型结果弹出 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ imageId: options.tongue_id }) // 获取用户信息 this.userInfo(); // 获取基本资料初始化 this.baseInfo(); // 获取检测报告结果 this.aiInfo(options.tongue_id) // 获取舌象类型结果 wx.$api.record.types(this.data.imageId, {type: ''}).then(res => { this.setData({ typesData : res.data }) }).catch(err => { }); }, /** * 生命周期函数--监听页面显示 */ onShow() {}, /** * 用户信息 */ userInfo() { wx.$api.user.home().then(res => { this.setData({ userData: res.data }) }).catch(err => {}) }, /** * 基本资料初始化 */ baseInfo() { wx.$api.water.Base().then(res => { this.setData({ baseData: res.data.base }) }).catch(err => {}) }, /** * 检测报告结果 */ aiInfo(imageid) { wx.$api.record.aiSee(imageid).then(res => { let {goods, tongue} = res.data this.setData({ goodsData: goods, aiSeeData: tongue }) }).catch(err => { }) }, /** * 舌象类型分类 */ assayTap(e) { this.setData({ typesType: e.currentTarget.dataset.type, typesState: true }) // 获取舌象类型结果 this.typesInfo(); }, /** * 舌象类型结果 */ typesInfo() { wx.$api.record.types(this.data.imageId, {type: this.data.typesType}).then(res => { switch (this.data.typesType){ case 'shexing': this.setData({ resultData: res.data.shexing }) break; case 'shese': this.setData({ resultData: res.data.shese }) break; case 'taizhi': this.setData({ resultData: res.data.taizhi }) break; default: this.setData({ resultData: res.data.taise }) } }).catch(err => { }) }, /** * 舌象类型结果-关闭 */ perfect() { this.setData({ typesState: false }) }, /** * 查看检测原图 */ previewImg(e) { wx.previewImage({ urls : [e.currentTarget.dataset.imgs], //需要预览的图片http链接列表,注意是数组 current : '' // 当前显示图片的http链接,默认是第一个 }) } })