柒零 1 rok pred
rodič
commit
3176305b61

+ 26 - 5
subpages/evaluationIntroduction/evaluationIntroduction.js

@@ -6,9 +6,9 @@ Page({
    */
   data: {
     type: "physique",//报告类型
-    testMin:3,
+    testMin: 3,
     testSize: 9,
-    comScoreIndex:6,
+    comScoreIndex: 6,
     testTitle: "睡眠质量指数评测",
     testDesc: "本测评系统依据山东睡眠质量指数量表(SDPSQI)开发。\nSDPSQI由山东省中医药大学医学中心精神科睡眠和生物节律研究中心睡眠专家组编制,专门用于评定被试者近一个月的主观睡眠质量。SDPSQI作为一种科学、系统的睡眠质量评估工具为了解个体睡眠状况、诊断睡眠障碍以及制定相应的干预措施提供了重要的工具和平台。",
     isHaveRes: false,//是否有测试过
@@ -50,9 +50,30 @@ Page({
     }
 
   },
-
+  hasPrevPage() {
+    // 获取页面栈
+    let pages = getCurrentPages();
+    // 页面栈数组中的页面实例数量大于1时,表示当前页之前有页面
+    if (pages.length > 1) {
+      return true;
+    }
+    return false;
+  },
+  toHome() {
+    // 回家啦
+    wx.removeStorageSync('testType')
+    wx.reLaunch({
+      url: '/pages/index/index'
+    })
+  },
   leftBack() {
-    wx.navigateBack()
+    if (this.hasPrevPage()) {
+      wx.navigateBack()
+      console.log('当前页之前有上一页');
+    } else {
+      this.toHome()
+      console.log('当前页之前没有上一页');
+    }
   },
   toTest() {
     // 去测试
@@ -75,7 +96,7 @@ Page({
       })
     }
   },
- checkPhysiqueData() {
+  checkPhysiqueData() {
     var that = this;
     var userId = wx.getStorageSync("unionid");
     wx.request({