提交对首页跳转登录页的问题
This commit is contained in:
parent
01e3d60b6c
commit
6f253ba5b9
4
app.json
4
app.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"pages": [
|
||||
"pages/login/index",
|
||||
"pages/home/index",
|
||||
"pages/login/index",
|
||||
"pages/billList/index",
|
||||
"pages/rechargeRecord/index",
|
||||
"pages/invoiceList/index",
|
||||
|
@ -16,9 +16,7 @@
|
|||
"pages/qrCode/index",
|
||||
"pages/recharge/index",
|
||||
"pages/questions/index",
|
||||
"pages/editInvoice/index",
|
||||
"pages/rechargeDetail/index",
|
||||
|
||||
"pages/updateInvoice/index",
|
||||
"pages/rechargeWay/index"
|
||||
],
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
// pages/editInvoice/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
|
@ -1,2 +0,0 @@
|
|||
<!--pages/editInvoice/index.wxml-->
|
||||
<text>pages/editInvoice/index.wxml</text>
|
|
@ -32,10 +32,9 @@ Page({
|
|||
// })
|
||||
// return
|
||||
// }
|
||||
wx.switchTab({
|
||||
url: '/pages/home/index',
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
|
||||
},
|
||||
async getPrivacy() {
|
||||
const { code, message, data } = await getPrivaciList()
|
||||
|
@ -81,6 +80,7 @@ Page({
|
|||
},
|
||||
getPhoneNumber(e) {
|
||||
const { errno, code: phoneCode } = e.detail;
|
||||
console.log('e', e)
|
||||
switch(errno) {
|
||||
case 103:
|
||||
alertInfo("已拒绝");
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
"enhance": true,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"ignoreDevUnusedFiles": false,
|
||||
"minified": true,
|
||||
"newFeature": false,
|
||||
"coverView": true,
|
||||
"nodeModules": false,
|
||||
"nodeModules": true,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
|
@ -19,14 +18,19 @@
|
|||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"bundle": false,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": true,
|
||||
"packNpmRelationList": [
|
||||
|
@ -35,14 +39,8 @@
|
|||
"miniprogramNpmDistDir": "./"
|
||||
}
|
||||
],
|
||||
"minifyWXSS": true,
|
||||
"showES6CompileOption": false,
|
||||
"condition": false,
|
||||
"compileWorklet": false,
|
||||
"ignoreUploadUnusedFiles": false,
|
||||
"useIsolateContext": true
|
||||
"minifyWXSS": true
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
|
@ -51,5 +49,7 @@
|
|||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wxb34b4e70f8a5c6f1"
|
||||
"appid": "wxb34b4e70f8a5c6f1",
|
||||
"projectname": "elec",
|
||||
"condition": {}
|
||||
}
|
|
@ -238,4 +238,12 @@ export const getPixelRatio = () => {
|
|||
|
||||
export function isValidPhoneNumber(phoneNumber) {
|
||||
return /^1\d{10}$/.test(phoneNumber);
|
||||
}
|
||||
|
||||
/** 获取当前页面url */
|
||||
export function getPageUrl() {
|
||||
const pages = getCurrentPages() //获取加载的页面
|
||||
const currentPage = pages[pages.length-1] //获取当前页面的对象
|
||||
const url = currentPage.route //当前页面url
|
||||
return url
|
||||
}
|
|
@ -82,12 +82,16 @@ const parseResponse = function (response, url) {
|
|||
alertError("服务异常")
|
||||
return
|
||||
}
|
||||
|
||||
const { statusCode } = response;
|
||||
console.log('url', url, 'response.status', statusCode, 'response.data', response.data)
|
||||
if (statusCode === 401) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
const currentUrl = getPageUrl()
|
||||
if (!['pages/home/index', 'pages/login/index'].includes(currentUrl)) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
}
|
||||
wx.clearStorageSync()
|
||||
return { code: 401, message: '未登录状态' }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user