ZhangWenQiang пре 6 година
родитељ
комит
387bc017c1
4 измењених фајлова са 24 додато и 18 уклоњено
  1. 0 7
      app.js
  2. 8 1
      pages/auth/auth.js
  3. 13 7
      pages/mine/index.js
  4. 3 3
      utils/http.js

+ 0 - 7
app.js

@@ -93,13 +93,6 @@ App({
           if (this.userInfoReadyCallback) {
             this.userInfoReadyCallback(res)
           }
-          //检查手机号
-          checkPhone({
-            user_id: this.globalData.userId,
-            user_token: this.globalData.userToken
-          }).then(data => {
-            console.log("hh")
-          })
         }).catch(data => {
           console.log("gg", data)
         })

+ 8 - 1
pages/auth/auth.js

@@ -17,6 +17,13 @@ Page({
   },
   onLoad: function(options) {
     app.globalData.noPhone = true
+    var pages = getCurrentPages();
+    var currPage = pages[pages.length - 1]; //当前页面
+    var prevPage = pages[pages.length - 2]; //上一个页面
+
+    prevPage.setData({
+      noPhone: false
+    })
   },
   getPhoneNumber: function(e) {
     console.log(e)
@@ -39,8 +46,8 @@ Page({
       wx.showModal({
         title: '警告',
         content: '您点击了拒绝授权,将无法正常使用小程序,请授权之后再进入!!!',
-        showCancel: false,
         confirmText: '返回授权',
+        showCancel: false,
         success: function(res) {
           if (res.confirm) {
             console.log('用户点击了“返回授权”')

+ 13 - 7
pages/mine/index.js

@@ -8,12 +8,16 @@ import {
 import {
   updataStorageData
 } from '../../utils/storage.js'
+import {
+  checkPhone
+} from '../../services/wx.js'
 var app = getApp()
 
 Page({
   data: {
     imgServerUrl: imgServerUrl,
     userInfo: {},
+    noPhone:true,
   },
   onShow: function() {
     if (app.globalData.userInfo) {
@@ -42,15 +46,17 @@ Page({
         }
       })
     }
-    if (app.globalData.noPhone) {
-      app.globalData.noPhone = false
-      wx.switchTab({
-        url: '/pages/index/index',
-      })
-      return
-    }
     this.fetchData();
     this.getUserResume();
+    if (this.data.noPhone){
+      //检查手机号
+      checkPhone({
+        user_id: app.globalData.userId,
+        user_token: app.globalData.userToken
+      }).then(data => {
+        console.log("hh")
+      })
+    }
   },
   //获取用户简历详情
   getUserResume() {

+ 3 - 3
utils/http.js

@@ -55,9 +55,9 @@ const http = (params) => {
             if (!targetUrl) {
               targetUrl = '/pages/user-info/user-info'
             }
-            wx.navigateTo({
-              url: targetUrl,
-            })
+            // wx.navigateTo({
+            //   url: targetUrl,
+            // })
           } else if (errorCode == 40007) {
             //账号类型不符
           } else if (errorCode == 2006) {