Selaa lähdekoodia

新增 版本检测

wzh 3 vuotta sitten
vanhempi
commit
3739ceef36

+ 18 - 1
miniprogram/app.js

@@ -3,7 +3,6 @@ import {
 } from "./utils/wxUtils"
 App({
   onLaunch: function () {
-    wxSetSessionKey()
     const updateManager = wx.getUpdateManager()
 
     updateManager.onCheckForUpdate(function (res) {
@@ -33,4 +32,22 @@ App({
     })
     this.globalData = {}
   },
+  onShow() {
+    this.checkEnvVersion()
+  },
+  checkEnvVersion() {
+    let v = wx.getAccountInfoSync()
+    let appVersion = wx.getStorageSync('appVersion')
+    let {
+      envVersion
+    } = v.miniProgram
+    if (appVersion != envVersion) {
+      wx.clearStorage({
+        success: (res) => {
+          wx.setStorageSync('appVersion', envVersion)
+        },
+      })
+    }
+    wxSetSessionKey()
+  }
 })

+ 12 - 5
miniprogram/components/voyages/voyages.js

@@ -31,31 +31,31 @@ Component({
           list: [{
             shipName: '体验船舶#1',
             loadPort: '南京',
-            dischargeProt: "小池",
+            dischargePorts: "小池",
             cargo: '石油焦',
             tons: '10000',
           }, {
             shipName: '体验船舶#2',
             loadPort: '小池',
-            dischargeProt: "武汉",
+            dischargePorts: "武汉",
             cargo: '豆粕',
             tons: '15000',
           }, {
             shipName: '体验船舶#3',
             loadPort: '北仑港',
-            dischargeProt: "小池",
+            dischargePorts: "小池",
             cargo: '煤炭',
             tons: '25000',
           }, {
             shipName: '体验船舶#4',
             loadPort: '张家港',
-            dischargeProt: "汉口",
+            dischargePorts: "汉口",
             cargo: '玉米',
             tons: '15000',
           }, {
             shipName: '体验船舶#5',
             loadPort: '武汉',
-            dischargeProt: "小池",
+            dischargePorts: "小池",
             cargo: '大豆',
             tons: '3000',
           }],
@@ -157,6 +157,13 @@ Component({
         list: []
       })
       this.getVoyageList()
+    },
+    clearList() {
+      this.setData({
+        currentPage: 1,
+        list: [],
+        total: 0
+      })
     }
   }
 })

+ 7 - 2
miniprogram/pages/index/index.js

@@ -36,15 +36,20 @@ Page({
       })
     }
     let rolePermission = wx.getStorageSync('rolePermission')
+    const child = this.selectComponent('.voyages');
 
     if (rolePermission.indexOf('VOYAGELIST') == -1) {
+      this.setData({
+        indexInfo: {}
+      })
+      child.clearList()
       wx.showToast({
         icon: "none",
         title: '暂无权限,请联系管理员',
       })
       return
+    } else {
+      child.getVoyageList()
     }
-    const child = this.selectComponent('.voyages');
-    child.getVoyageList()
   }
 })