|
|
@@ -2,7 +2,9 @@ var config = require('../config/config.js')
|
|
|
import {
|
|
|
showToast
|
|
|
} from '../utils/tips.js'
|
|
|
-
|
|
|
+const noRelaunch = [
|
|
|
+ 'pages/interview-registration/index'
|
|
|
+]
|
|
|
//model状态
|
|
|
let model = true;
|
|
|
let loading = true;
|
|
|
@@ -48,6 +50,7 @@ const http = (params) => {
|
|
|
});
|
|
|
}
|
|
|
const pages = getCurrentPages();
|
|
|
+
|
|
|
wx.request({
|
|
|
url: apiUrl + params.url, //服务器url+参数中携带的接口具体地址
|
|
|
data: getData(params.data), //请求参数
|
|
|
@@ -72,7 +75,7 @@ const http = (params) => {
|
|
|
wx.setStorageSync('sessionKey', res.data.data.sessionKey);
|
|
|
wx.setStorageSync('unionId', res.data.data.unionId);
|
|
|
//前往绑定手机号
|
|
|
- wx.redirectTo({
|
|
|
+ wx.navigateTo({
|
|
|
url: '/pages/bind-phone/index',
|
|
|
})
|
|
|
} else if (errorCode == 4000) {
|
|
|
@@ -81,17 +84,7 @@ const http = (params) => {
|
|
|
confirmText: '好的',
|
|
|
content: res.data.errmsg,
|
|
|
showCancel: false,
|
|
|
- success: () => {
|
|
|
- // wx.setClipboardData({
|
|
|
- // data: '4009960099',
|
|
|
- // success: (res) => {
|
|
|
- // // wx.showToast({
|
|
|
- // // icon: 'none',
|
|
|
- // // title: '客服电话已复制',
|
|
|
- // // })
|
|
|
- // },
|
|
|
- // })
|
|
|
- }
|
|
|
+ success: () => { }
|
|
|
})
|
|
|
return
|
|
|
} else if (errorCode == 1005) {
|
|
|
@@ -109,55 +102,30 @@ const http = (params) => {
|
|
|
} else if (errorCode == 2008) {
|
|
|
//账号不存在,或token无效
|
|
|
if (model && params.data.task_id !== 10) {
|
|
|
- const _type = pages.length === 1 ? 'reLaunch' : 'navigateTo';
|
|
|
- wx[_type]({
|
|
|
- url: '/pages/login/login',
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '登录失效请重新登录',
|
|
|
+ // showCancel: false,
|
|
|
success: res => {
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '登录失效请重新登录',
|
|
|
- showCancel: false,
|
|
|
- success: res => {
|
|
|
- if (res.confirm) {
|
|
|
- model = true;
|
|
|
+ if (res.confirm) {
|
|
|
+ model = true;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (res.cancel) {
|
|
|
+ model = true;
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ fail: res => {
|
|
|
+ wx.switchTab({
|
|
|
+ url: '/pages/index/index',
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
- // if (pages.length === 1) {
|
|
|
- // wx.reLaunch({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // success: res => {
|
|
|
- // wx.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '登录失效请重新登录',
|
|
|
- // showCancel: false,
|
|
|
- // success: res => {
|
|
|
- // if (res.confirm) {
|
|
|
- // model = true;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // success: res => {
|
|
|
- // wx.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '登录失效请重新登录',
|
|
|
- // showCancel: false,
|
|
|
- // success: res => {
|
|
|
- // if (res.confirm) {
|
|
|
- // model = true;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
model = false
|
|
|
}
|
|
|
return
|
|
|
@@ -184,27 +152,6 @@ const http = (params) => {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- // if (pages.length === 1) {
|
|
|
- // wx.reLaunch({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // success: data => {
|
|
|
- // wx.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: '请先登录',
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // success: data => {
|
|
|
- // wx.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: '请先登录',
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
return
|
|
|
}
|
|
|
params.data.task_id !== 10 && showToast(res.data.errmsg);
|
|
|
@@ -238,11 +185,11 @@ const http = (params) => {
|
|
|
complete: (res) => {
|
|
|
wx.stopPullDownRefresh({
|
|
|
success: () => {
|
|
|
- console.log(`${pages[pages.length - 1] ? pages[pages.length - 1].route : pages} => stopPullDownRefresh`);
|
|
|
+ console.log(`${pages.length ? pages[pages.length - 1].route : '应用加载中...'} => stopPullDownRefresh`);
|
|
|
}
|
|
|
});
|
|
|
try {
|
|
|
- console.log('当前页面=>', pages[pages.length - 1].route)
|
|
|
+ console.log('当前页面=>', pages.length ? pages[pages.length - 1].route : '初始化中...')
|
|
|
console.log("请求参数=>", params);
|
|
|
console.log(`请求状态码=>${res.statusCode}`, `状态信息=>${res.errMsg}`);
|
|
|
console.log("返回结果=>", res.data);
|