HuaJingwen 6 anni fa
parent
commit
a40e7e882b
2 ha cambiato i file con 17 aggiunte e 1 eliminazioni
  1. 15 0
      app.js
  2. 2 1
      pages/application/application.js

+ 15 - 0
app.js

@@ -16,6 +16,14 @@ App({
16 16
   // 监听小程序初始化
17 17
   onLaunch: function (){
18 18
       let system = '', app = this;
19
+      const shareInfo = wx.getStorageSync('shareInfo');
20
+
21
+      if (shareInfo) {
22
+          app.globalData.title = shareInfo.title;
23
+          app.globalData.img = shareInfo.img;
24
+      }else{
25
+          wx.redirectTo({url: '/pages/login/login'})
26
+      }
19 27
       wx.getSystemInfo({
20 28
         success: function(res) {
21 29
           system = res.system
@@ -92,6 +100,13 @@ App({
92 100
         }
93 101
         app.globalData.title = title;
94 102
         app.globalData.img = img;
103
+        wx.setStorage({
104
+            key: 'shareInfo',
105
+            data: {
106
+                title: title,
107
+                img: img
108
+            }
109
+        })
95 110
       }
96 111
     });
97 112
   },

+ 2 - 1
pages/application/application.js

@@ -22,6 +22,7 @@ Page({
22 22
   },
23 23
   initApplication () {
24 24
       var that = this, token = wx.getStorageSync('user').token, list = [];
25
+      console.log(token);
25 26
       that.setData({hidden: false});
26 27
       if (that.data.page) {
27 28
         list = that.data.dataList
@@ -31,7 +32,7 @@ Page({
31 32
       wx.request({
32 33
         url: app.globalData.HOST + '/user/wx/myapply',
33 34
         method: "POST",
34
-        data: Object.assign({}, app.globalData.common, {pageId: ++that.data.page}),
35
+        data: Object.assign({}, app.globalData.common, {token: token, pageId: ++that.data.page}),
35 36
         success: function (res) {
36 37
           var data = res.data;
37 38
             // console.log(data);