update code3处理
This commit is contained in:
parent
9e43b3ebc9
commit
736fe6f729
@ -5,6 +5,7 @@ export default {
|
||||
data: {
|
||||
errorOne: 1,
|
||||
errorTwo: 1,
|
||||
errorThree: 1,
|
||||
mixin: 'MixinText'
|
||||
},
|
||||
methods: {
|
||||
@ -81,6 +82,13 @@ export default {
|
||||
// 发起请求
|
||||
return new Promise((resolve, reject) => {
|
||||
let vm = this
|
||||
let pages = getCurrentPages() // 获取加载的页面
|
||||
let currentPage = pages[pages.length - 1] // 获取当前页面的对象
|
||||
let options = currentPage.options
|
||||
let url = ''
|
||||
for (var key in options) {
|
||||
url = `${url}${key}=${options[key]}&`
|
||||
}
|
||||
wx.request(Object.assign(request, {
|
||||
success: ({statusCode, data}) => {
|
||||
wx.hideNavigationBarLoading()
|
||||
@ -142,13 +150,6 @@ export default {
|
||||
console.error(data.message)
|
||||
vm.errorTwo += 1
|
||||
if (vm.errorTwo <= 2) {
|
||||
var pages = getCurrentPages() // 获取加载的页面
|
||||
var currentPage = pages[pages.length - 1] // 获取当前页面的对象
|
||||
var options = currentPage.options
|
||||
let url = ''
|
||||
for (var key in options) {
|
||||
url = `${url}${key}=${options[key]}&`
|
||||
}
|
||||
utils.wx_login().then(({code, data}) => {
|
||||
if (code === 0) {
|
||||
vm.errorTwo = 1
|
||||
@ -170,6 +171,17 @@ export default {
|
||||
}
|
||||
let errorMessage = {message: '错误,需要重新登录'}
|
||||
throw errorMessage
|
||||
} else if (code === 3) {
|
||||
vm.errorThree += 1
|
||||
if (vm.errorThree <= 2) {
|
||||
utils.wx_login().then(({code, data}) => {
|
||||
if (code === 0) {
|
||||
vm.errorThree = 1
|
||||
currentPage.onLoad()
|
||||
currentPage.onShow()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user