|
@@ -19,7 +19,7 @@ Page({
|
|
|
answerJson: [],
|
|
answerJson: [],
|
|
|
columns: [[], []],
|
|
columns: [[], []],
|
|
|
BMI: null,
|
|
BMI: null,
|
|
|
- mInputId:"",
|
|
|
|
|
|
|
+ mInputScrollId:null,
|
|
|
weight: 0,
|
|
weight: 0,
|
|
|
height: 0,
|
|
height: 0,
|
|
|
promptTextMessageFlag: false,//结果弹窗
|
|
promptTextMessageFlag: false,//结果弹窗
|
|
@@ -27,8 +27,9 @@ Page({
|
|
|
privacyDetailShow: false,// 隐私条款弹出页是否显示
|
|
privacyDetailShow: false,// 隐私条款弹出页是否显示
|
|
|
changeValue: '',//
|
|
changeValue: '',//
|
|
|
comScore: 0,
|
|
comScore: 0,
|
|
|
- comScoreStatus: '',
|
|
|
|
|
- comScoreIndex:0,
|
|
|
|
|
|
|
+ comScoreStatus: '',
|
|
|
|
|
+ comScoreIndex: 0,
|
|
|
|
|
+ comScoreDesc: "如果你在这一级别内,那么你的睡眠质量可就亮起红灯了。你必须警惕,因为你的睡眠质量确实比较糟糕,健康状况明显受损。饮食起居会受到一定影响,甚至部分工作你都开始感觉吃力。",
|
|
|
ratingResultsList: [{
|
|
ratingResultsList: [{
|
|
|
title: "非常好",
|
|
title: "非常好",
|
|
|
icon: "/subpages/icons/ic_triangle_down_1.svg",
|
|
icon: "/subpages/icons/ic_triangle_down_1.svg",
|
|
@@ -96,7 +97,7 @@ Page({
|
|
|
for (let i = 0; i < oldJsonList.length; i++) {
|
|
for (let i = 0; i < oldJsonList.length; i++) {
|
|
|
const element = oldJsonList[i];
|
|
const element = oldJsonList[i];
|
|
|
if (element.num == item.num) {
|
|
if (element.num == item.num) {
|
|
|
- element['questionValue'] = event.detail;
|
|
|
|
|
|
|
+ element['questionValue'] = event.detail.value;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -105,6 +106,15 @@ Page({
|
|
|
qnaire: oldJsonList
|
|
qnaire: oldJsonList
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ onChangeFocus(event) {
|
|
|
|
|
+ const item = event.currentTarget.dataset.item
|
|
|
|
|
+ const that = this;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ that.setData({
|
|
|
|
|
+ mInputScrollId: "item" + item.num
|
|
|
|
|
+ });
|
|
|
|
|
+ }, 200);
|
|
|
|
|
+ },
|
|
|
onChangePrivacy(event) {
|
|
onChangePrivacy(event) {
|
|
|
const check = event.detail;
|
|
const check = event.detail;
|
|
|
|
|
|
|
@@ -209,13 +219,13 @@ Page({
|
|
|
var finish = true;
|
|
var finish = true;
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
let oldJsonList = _this.data.qnaire;
|
|
let oldJsonList = _this.data.qnaire;
|
|
|
- var mInputId = "";
|
|
|
|
|
|
|
+ var mInputScrollId = null;
|
|
|
for (let i = 0; i < oldJsonList.length; i++) {
|
|
for (let i = 0; i < oldJsonList.length; i++) {
|
|
|
const element = oldJsonList[i];
|
|
const element = oldJsonList[i];
|
|
|
if (!element.value) {
|
|
if (!element.value) {
|
|
|
finish = false;
|
|
finish = false;
|
|
|
console.log("未完成的:", element.num);
|
|
console.log("未完成的:", element.num);
|
|
|
- mInputId = "item" + element.num;
|
|
|
|
|
|
|
+ mInputScrollId = "item" + element.num;
|
|
|
wx.showModal({
|
|
wx.showModal({
|
|
|
title: '无法提交',
|
|
title: '无法提交',
|
|
|
content: '您还有部分题目未完成,请检查后重新提交',
|
|
content: '您还有部分题目未完成,请检查后重新提交',
|
|
@@ -224,7 +234,7 @@ Page({
|
|
|
confirmText: "好的",
|
|
confirmText: "好的",
|
|
|
success(res) {
|
|
success(res) {
|
|
|
_this.setData({
|
|
_this.setData({
|
|
|
- mInputId: mInputId
|
|
|
|
|
|
|
+ mInputScrollId: mInputScrollId
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -245,7 +255,7 @@ Page({
|
|
|
confirmText: "好的",
|
|
confirmText: "好的",
|
|
|
success(res) {
|
|
success(res) {
|
|
|
_this.setData({
|
|
_this.setData({
|
|
|
- mInputId: mInputId
|
|
|
|
|
|
|
+ mInputScrollId: mInputScrollId
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -402,6 +412,7 @@ Page({
|
|
|
let comAll = comA + comB + comC + comD + comE + comF + comG;
|
|
let comAll = comA + comB + comC + comD + comE + comF + comG;
|
|
|
let comScoreIndex = 0;
|
|
let comScoreIndex = 0;
|
|
|
let _comScoreStatus = "";
|
|
let _comScoreStatus = "";
|
|
|
|
|
+ let _comScoreDesc = "";
|
|
|
if (comAll >= 0 && comAll <= 5) {
|
|
if (comAll >= 0 && comAll <= 5) {
|
|
|
_comScoreStatus = "非常好";
|
|
_comScoreStatus = "非常好";
|
|
|
} else if (comAll >= 6 && comAll <= 10) {
|
|
} else if (comAll >= 6 && comAll <= 10) {
|
|
@@ -415,14 +426,28 @@ Page({
|
|
|
comScoreIndex = 3;
|
|
comScoreIndex = 3;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (this.judgmentScoreRange(comAll,0,3)) {
|
|
|
|
|
+ _comScoreDesc = "你目前的睡眠质量非常高,而且健康状况良好,这一切应该继续保持下去。"
|
|
|
|
|
+ } else if (this.judgmentScoreRange(comAll, 4, 8)) {
|
|
|
|
|
+ _comScoreDesc = "你的睡眠质量平平,健康状况也受到影响, 如果再不引起你对睡眠质量的足够重视, 那么你的睡眠质量很可能会迅速下降,向下一级别发展。"
|
|
|
|
|
+ } else if (this.judgmentScoreRange(comAll, 9, 16)) {
|
|
|
|
|
+ _comScoreDesc = "如果你在这一级别内,那么你的睡眠质量可 就亮起红灯了。你必须警惕,因为你的睡眠质量确实比较糟糕,健康状况明显受损。饮食起居会受到一定影响,甚至部分工作你都开始感觉吃力。"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _comScoreDesc = "天啊!你的睡眠质量已经到了令人发指的地 步—长期睡眠不足导致了你的健康状况严重恶化,这就是你工作力不从心,情绪起伏不定的原因。"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
console.log('comAll=' + comAll + ',comScoreStatus=' + _comScoreStatus);
|
|
console.log('comAll=' + comAll + ',comScoreStatus=' + _comScoreStatus);
|
|
|
this.setData({
|
|
this.setData({
|
|
|
comScore: comAll,
|
|
comScore: comAll,
|
|
|
comScoreStatus: _comScoreStatus,
|
|
comScoreStatus: _comScoreStatus,
|
|
|
comScoreIndex,
|
|
comScoreIndex,
|
|
|
|
|
+ comScoreDesc: _comScoreDesc,
|
|
|
promptTextMessageFlag: true,
|
|
promptTextMessageFlag: true,
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ judgmentScoreRange(scoreValue, startScore, endScore) {
|
|
|
|
|
+ return scoreValue >= startScore && scoreValue <= endScore;
|
|
|
|
|
+ },
|
|
|
resultABCD: function (a) {
|
|
resultABCD: function (a) {
|
|
|
if (a == 'a') {
|
|
if (a == 'a') {
|
|
|
return 0;
|
|
return 0;
|
|
@@ -515,6 +540,7 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
*/
|
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
|
|
|
+
|
|
|
|
|
|
|
|
let oldJsonList = qnaire.qnaire
|
|
let oldJsonList = qnaire.qnaire
|
|
|
oldJsonList.forEach(element => {
|
|
oldJsonList.forEach(element => {
|