继续修复白屏bug
This commit is contained in:
@@ -23,6 +23,9 @@ const install = (Vue, vm) => {
|
|||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
// 响应拦截,判断状态码是否通过
|
// 响应拦截,判断状态码是否通过
|
||||||
|
// 防止多次跳转登录页
|
||||||
|
let isRedirectingToLogin = false;
|
||||||
|
|
||||||
Vue.prototype.$u.http.interceptor.response = (res) => {
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
||||||
// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
|
// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
|
||||||
// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
|
// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
|
||||||
@@ -32,17 +35,36 @@ const install = (Vue, vm) => {
|
|||||||
vm.$u.toast('警告:' + res.msg);
|
vm.$u.toast('警告:' + res.msg);
|
||||||
return false;
|
return false;
|
||||||
} else if(res.statusCode == 401 || res.statusCode == 403) {
|
} else if(res.statusCode == 401 || res.statusCode == 403) {
|
||||||
const currentPage = vm.$route.path;
|
// 防止多次跳转
|
||||||
|
if (isRedirectingToLogin) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 判断当前页面是否为登录页
|
// 判断当前页面是否为登录页
|
||||||
// 登录成功修改token与用户信息
|
const pages = getCurrentPages();
|
||||||
|
const currentPage = pages[pages.length - 1];
|
||||||
|
const currentPath = currentPage ? currentPage.route : '';
|
||||||
|
|
||||||
|
if (currentPath !== 'pages-biz/login/login') {
|
||||||
|
isRedirectingToLogin = true;
|
||||||
|
|
||||||
|
// 清除 token 和用户信息
|
||||||
vm.$u.vuex('vuex_token', '');
|
vm.$u.vuex('vuex_token', '');
|
||||||
vm.$u.vuex('vuex_user', {});
|
vm.$u.vuex('vuex_user', {});
|
||||||
uni.removeStorageSync('userInfo');
|
uni.removeStorageSync('userInfo');
|
||||||
if (currentPage !== '/pages-biz/login/login') {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages-biz/login/login'
|
|
||||||
});
|
|
||||||
vm.$u.toast('认证失败,请重新登录');
|
vm.$u.toast('认证失败,请重新登录');
|
||||||
|
|
||||||
|
// 使用 reLaunch 清空页面栈,避免返回时出现问题
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages-biz/login/login',
|
||||||
|
complete: () => {
|
||||||
|
// 跳转完成后重置标记
|
||||||
|
setTimeout(() => {
|
||||||
|
isRedirectingToLogin = false;
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if(res.statusCode == 500) {
|
} else if(res.statusCode == 500) {
|
||||||
|
|||||||
@@ -82,10 +82,15 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchContractList();
|
// fetchContractList 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken());
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.fetchContractList()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filteredAssets() {
|
filteredAssets() {
|
||||||
|
|||||||
@@ -175,12 +175,17 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
|
||||||
this.$checkToken(this.$getToken())
|
|
||||||
this.checkOaAuth()
|
|
||||||
},
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
// fetchApplys 移到 onShow 中,等 token 校验通过后再加载
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
this.fetchApplys()
|
this.fetchApplys()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -78,12 +78,17 @@
|
|||||||
this.scrollTop = e.scrollTop;
|
this.scrollTop = e.scrollTop;
|
||||||
this.updateNavbarStyle(e.scrollTop);
|
this.updateNavbarStyle(e.scrollTop);
|
||||||
},
|
},
|
||||||
onShow() {
|
|
||||||
this.$checkToken(this.$getToken())
|
|
||||||
this.checkOaAuth()
|
|
||||||
},
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchFallback();
|
// fetchFallback 移到 onShow 中,等 token 校验通过后再加载
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.fetchFallback()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
this.updateNavbarStyle(e.scrollTop);
|
this.updateNavbarStyle(e.scrollTop);
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// 从路由参数中获取留言ID
|
// 从路由参数中获取留言ID
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
this.loadBills();
|
this.loadBills();
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 切换年份选择器显示
|
// 切换年份选择器显示
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default {
|
|||||||
this.loadBillDetail(id);
|
this.loadBillDetail(id);
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadBillDetail(id) {
|
loadBillDetail(id) {
|
||||||
|
|||||||
@@ -96,11 +96,16 @@
|
|||||||
for (let i = 5; i >= 1; i--) {
|
for (let i = 5; i >= 1; i--) {
|
||||||
this.years.push(year - i);
|
this.years.push(year - i);
|
||||||
}
|
}
|
||||||
this.fetchPayRecord();
|
// fetchPayRecord 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.fetchPayRecord()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -70,11 +70,18 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadContracts();
|
// loadContracts 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
// token 有效,继续执行
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.loadContracts()
|
||||||
|
} catch (e) {
|
||||||
|
// token 无效,$checkToken 内部已处理跳转登录页
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -92,9 +92,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.getContractDetail()
|
this.getContractDetail()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
|||||||
@@ -43,11 +43,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() { // ✅ 修复生命周期拼写
|
onLoad() { // ✅ 修复生命周期拼写
|
||||||
this.fetchMessageList();
|
// fetchMessageList 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.fetchMessageList()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.id = e.id
|
this.id = e.id
|
||||||
|
|||||||
@@ -36,11 +36,16 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.cusNo = options.cusNo;
|
this.cusNo = options.cusNo;
|
||||||
this.loadAssets();
|
// loadAssets 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.loadAssets()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -96,10 +96,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options){
|
onLoad(options){
|
||||||
this.fetchReserve()
|
// fetchReserve 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.fetchReserve()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除 scroll-view 冲突的 onReachBottom
|
// ✅ 删除 scroll-view 冲突的 onReachBottom
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -82,11 +82,16 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadBills();
|
// loadBills 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.loadBills()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
|||||||
@@ -80,11 +80,16 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadBills();
|
// loadBills 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.loadBills()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ❌ 已删除冲突的 onReachBottom
|
// ❌ 已删除冲突的 onReachBottom
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -77,11 +77,16 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadBills();
|
// loadBills 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.checkOaAuth()
|
this.checkOaAuth()
|
||||||
|
this.loadBills()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ❌ 已删除冲突的 onReachBottom
|
// ❌ 已删除冲突的 onReachBottom
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchDataList();
|
this.fetchDataList();
|
||||||
|
|||||||
@@ -179,8 +179,9 @@
|
|||||||
onUnload() {
|
onUnload() {
|
||||||
uni.$off('updateAvatar')
|
uni.$off('updateAvatar')
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
this.loadUserInfo()
|
this.loadUserInfo()
|
||||||
this.countHandlingReserve()
|
this.countHandlingReserve()
|
||||||
this.countUnHandleContract()
|
this.countUnHandleContract()
|
||||||
@@ -188,6 +189,9 @@
|
|||||||
this.countUnpayWaeBills()
|
this.countUnpayWaeBills()
|
||||||
this.countUnreadMsg()
|
this.countUnreadMsg()
|
||||||
this.countUnpaidRentMargin()
|
this.countUnpaidRentMargin()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user