181 lines
5.2 KiB
JavaScript
181 lines
5.2 KiB
JavaScript
/*
|
||
* 手太欠
|
||
* 愿这世界都如故事里一样 美好而动人~
|
||
*/
|
||
|
||
var startPoint;
|
||
const min = 0; // 最小宽度 单位px
|
||
const max = 200; // 最大宽度 单位px
|
||
|
||
Page({
|
||
data: {
|
||
Type : '', //接口来源
|
||
barHeight : getApp().globalData.barHeight, // 状态栏高度
|
||
isFixedTop : 0,
|
||
loading : true,
|
||
imageId : '', // 报告id
|
||
coverImg : '', // 上传的图片
|
||
analyze : '', // 检测结果
|
||
createdAt : '', // 检测时间
|
||
footerPop : '', //底部菜单优先级
|
||
enlargedNumber : '', // 毛孔总数量
|
||
sensitivityArea: '', // 敏感区域面积
|
||
tactfulFace : false, // 敏感分析
|
||
acneFace : false, // 痤疮
|
||
oldFace : false, //衰老分析
|
||
pigmentFace : false, // 色素分析
|
||
pigmentFace : false, // 黑头分析
|
||
poreStatus : false, // 毛孔
|
||
|
||
zoneArea : '', // 油光占比 额头
|
||
leftcheekArea : '', // 油光占比 左脸颊
|
||
rightcheekArea : '', // 油光占比 右脸颊
|
||
|
||
buttonLeft: 100,
|
||
progress: 100, // 进度条的宽度,这里的单位是px,所以在wxml文件中要改为rpx
|
||
precent: 50, // 这个是百分比
|
||
|
||
refertoStatus: false,
|
||
suggest : {} // 推荐方案
|
||
},
|
||
|
||
onLoad(options) {
|
||
this.setData({
|
||
Type: options.type
|
||
})
|
||
|
||
if(this.data.Type == '1') {
|
||
this.setData({
|
||
refertoStatus: true
|
||
})
|
||
}
|
||
|
||
this.setData({
|
||
imageId: options.image_id
|
||
})
|
||
|
||
// 获取检测报告结果
|
||
this.aiInfo(options.image_id)
|
||
},
|
||
|
||
/**
|
||
* 检测报告结果
|
||
*/
|
||
aiInfo(imageid) {
|
||
wx.$api.health.aiSee(imageid).then(res => {
|
||
this.setData({
|
||
loading : false,
|
||
createdAt: res.data.created_at,
|
||
coverImg: res.data.cover,
|
||
analyze : res.data.skin_analyze.result.result,
|
||
sensitivityArea: (res.data.skin_analyze.result.result.sensitivity.sensitivity_area * 100).toFixed(3),
|
||
enlargedNumber: res.data.skin_analyze.result.result.enlarged_pore_count.forehead_count + res.data.skin_analyze.result.result.enlarged_pore_count.chin_count + res.data.skin_analyze.result.result.enlarged_pore_count.right_cheek_count + res.data.skin_analyze.result.result.enlarged_pore_count.left_cheek_count,
|
||
zoneArea : (res.data.skin_analyze.result.result.oily_intensity.t_zone.area * 100).toFixed(1),
|
||
leftcheekArea : (res.data.skin_analyze.result.result.oily_intensity.left_cheek.area * 100).toFixed(1),
|
||
rightcheekArea : (res.data.skin_analyze.result.result.oily_intensity.right_cheek.area * 100).toFixed(1),
|
||
suggest:res.data.suggest
|
||
})
|
||
// console.log(res)
|
||
}).catch(err => { })
|
||
},
|
||
|
||
/**
|
||
* 返回上一页
|
||
*/
|
||
returnGo() {
|
||
wx.navigateBack({
|
||
delta: 1
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 查看检测图
|
||
*/
|
||
faceSee(e) {
|
||
this.setData({
|
||
footerPop: !this.data.footerPop,
|
||
progress: 100,
|
||
precent: 50
|
||
})
|
||
let type = e.currentTarget.dataset.type
|
||
if(type == 'old') {
|
||
// 衰老
|
||
this.setData({
|
||
oldFace : !this.data.oldFace
|
||
})
|
||
} else if(type == 'acne') {
|
||
// 痤疮
|
||
this.setData({
|
||
acneFace : !this.data.acneFace
|
||
})
|
||
} else if(type == 'tactful') {
|
||
// 敏感
|
||
this.setData({
|
||
tactfulFace : !this.data.tactfulFace
|
||
})
|
||
} else if(type == 'pigment') {
|
||
// 色素性
|
||
this.setData({
|
||
pigmentFace : !this.data.pigmentFace
|
||
})
|
||
} else if(type == 'black') {
|
||
// 黑头
|
||
this.setData({
|
||
blackFace : !this.data.blackFace
|
||
})
|
||
} else if(type == 'pore') {
|
||
// 毛孔
|
||
this.setData({
|
||
poreStatus : !this.data.poreStatus
|
||
})
|
||
}
|
||
|
||
|
||
},
|
||
|
||
/**
|
||
* 查看检测图-状态栏
|
||
*/
|
||
buttonStart (e) {
|
||
startPoint = e.touches[0]
|
||
},
|
||
|
||
moveTo(e) {
|
||
var endPoint = e.touches[e.touches.length - 1]
|
||
var translateX = endPoint.clientX - startPoint.clientX
|
||
startPoint = endPoint;
|
||
var buttonLeft = this.data.buttonLeft + translateX;
|
||
if (buttonLeft > max) {
|
||
// 滑动位置大于进度条最大宽度的时候让它为最大宽度
|
||
buttonLeft = max
|
||
}
|
||
if (buttonLeft < min) {
|
||
// 滑动位置小于进度条最大宽度的时候让它为最小宽度
|
||
buttonLeft = min
|
||
}
|
||
this.setData({
|
||
buttonLeft: buttonLeft,
|
||
progress: buttonLeft,
|
||
precent:parseInt((buttonLeft/max)*100)
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 监听页面滑动事件
|
||
*/
|
||
onPageScroll(e) {
|
||
this.setData({
|
||
isFixedTop: parseInt(e.scrollTop)
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 关闭弹框,跳转首页
|
||
*/
|
||
refertoTap() {
|
||
this.setData({
|
||
refertoStatus: false
|
||
})
|
||
}
|
||
})
|