HuaJingwen 6 years ago
parent
commit
a40e7e882b
2 changed files with 17 additions and 1 deletions
  1. 15 0
      app.js
  2. 2 1
      pages/application/application.js

+ 15 - 0
app.js

16
   // 监听小程序初始化
16
   // 监听小程序初始化
17
   onLaunch: function (){
17
   onLaunch: function (){
18
       let system = '', app = this;
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
       wx.getSystemInfo({
27
       wx.getSystemInfo({
20
         success: function(res) {
28
         success: function(res) {
21
           system = res.system
29
           system = res.system
92
         }
100
         }
93
         app.globalData.title = title;
101
         app.globalData.title = title;
94
         app.globalData.img = img;
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
   },
22
   },
23
   initApplication () {
23
   initApplication () {
24
       var that = this, token = wx.getStorageSync('user').token, list = [];
24
       var that = this, token = wx.getStorageSync('user').token, list = [];
25
+      console.log(token);
25
       that.setData({hidden: false});
26
       that.setData({hidden: false});
26
       if (that.data.page) {
27
       if (that.data.page) {
27
         list = that.data.dataList
28
         list = that.data.dataList
31
       wx.request({
32
       wx.request({
32
         url: app.globalData.HOST + '/user/wx/myapply',
33
         url: app.globalData.HOST + '/user/wx/myapply',
33
         method: "POST",
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
         success: function (res) {
36
         success: function (res) {
36
           var data = res.data;
37
           var data = res.data;
37
             // console.log(data);
38
             // console.log(data);