Преглед изворни кода

修改为使用token并不使用check检测是否登陆

junyuanz пре 4 година
родитељ
комит
ca076c4b3f

+ 1 - 1
app.js

@@ -7,7 +7,7 @@ App({
     this.login()
   },
   onShow: function () {
-    this.check()
+    // this.check()
   },
   login () {
     wx.login({

+ 1 - 1
packageMerchant/pages/merchant/order/order.js

@@ -14,7 +14,7 @@ Page({
     // })
   },
   onShow: function () {
-    this.check()
+    // this.check()
     this.getRadish()
   },
   getRadish () {

+ 1 - 1
packageUser/pages/user/exchange/exchange.js

@@ -36,7 +36,7 @@ Page({
   onLoad: function () {
   	// this.getBalanceInfo()
     this.getCompanyList()
-    this.check()
+    // this.check()
     this.getBanners()
   },
   onReachBottom: function () {

+ 1 - 1
packageUser/pages/user/invite/contribution/contribution.js

@@ -19,7 +19,7 @@ Page({
   onLoad: function (options) {
     this.getinfo()
     this.getContributions()
-    this.check()
+    // this.check()
     this.gethelpfarm()
   },
   getContributionTotal () {

+ 1 - 1
pages/helpfarm/helpfarm-detail/helpfarm-detail.js

@@ -70,7 +70,7 @@ Page({
     this.getProjectDetail()
     this.getPersonList()
     this.getInvestWayList()
-    this.check()
+    // this.check()
     this.showprogress()
     this.getCashTotal()
   },

+ 1 - 1
pages/projects/project-detail-noshare/project-detail-noshare.js

@@ -94,7 +94,7 @@ Page({
     this.getIphoneX()
     this.getProjectDetail()
 	this.getProjectComment()
-    this.check()
+    // this.check()
   },
   onHide: function () {
     this.getneedshare()

+ 19 - 1
pages/projects/project-detail/project-detail.js

@@ -79,7 +79,8 @@ Page({
     this.getIphoneX()
     this.getProjectDetail()
 	this.getProjectComment()
-    this.check()
+    // this.check()
+	this.info()
   },
   onHide: function () {
     this.getneedshare()
@@ -93,6 +94,23 @@ Page({
       imgindex: e.detail.current + 1
     })
   },
+  info(){
+  	  console.log('oninfo');
+    var that = this
+    var url = 'v1/user/info'
+    var params = {}
+    var success = function (res) {
+      console.log(res)
+      that.setData({
+        info: res.data,
+  		bindTel: res.data.user.tel ? true : false
+      })
+  	  if (res.data.wx_user_id > 0) {
+  	    that.getneedshare()
+  	  }
+    }
+    _request.$get(url, params, success)
+  },
   check () {
     var that = this
     var url = 'v1/user/check'

+ 1 - 1
pages/start/start.js

@@ -177,7 +177,7 @@ Page({
     }
   },
   getVersion: function (val) {
-    this.check()
+    // this.check()
     this.getAnimation(val)
     // var that = this
     // var url = 'v1/xcx/version/' + version

+ 17 - 12
pages/user/all/all.js

@@ -48,16 +48,16 @@ Page({
   onShow: function () {
     var that = this;
     this.info();
-    if (this.data.bindTel) {
-      this.getBalanceInfo()
-      this.getIntegralInfo()
-      if (that.data.checkData.merchant_id > 0) {
-        that.getmerchant()
-      }
-    } else {
-      this.check()
-      // this.info()
-    }
+    // if (this.data.bindTel) {
+    //   this.getBalanceInfo()
+    //   this.getIntegralInfo()
+    //   if (that.data.checkData.merchant_id > 0) {
+    //     that.getmerchant()
+    //   }
+    // } else {
+    //   // this.check()
+    //   // this.info()
+    // }
     
 	that.checkLogin();
     
@@ -89,6 +89,11 @@ Page({
 							that.setData({
 								userInfo: userInfo
 							})
+							that.getBalanceInfo()
+							that.getIntegralInfo()
+							if (that.data.checkData.merchant_id > 0) {
+							  that.getmerchant()
+							}
 								//checkwxhead---start
 								console.log('that.data.checkhead',that.data.checkhead);
 	  						    if(res.data.wx_user.full_head == '' && that.data.checkhead){
@@ -239,10 +244,10 @@ Page({
 	        	  that.onShow();
 	        	}
 	          }
-	        })
+	        }) 
   },
   getVersion: function (val) {
-    this.check()
+    // this.check()
   },
   info(){
 	  console.log('oninfo');

+ 1 - 1
utils/request.js

@@ -178,7 +178,7 @@ function login (res) {
     wx.setStorageSync('lbt_session_key', res.data.session_key)
     wx.setStorageSync('lbt_session_time', Date.now())
 	wx.setStorageSync('lbt_token_key', res.data.token)
-    check()
+    // check()
   }
   $get(url, params, success)
 }