fix: 修复token验证逻辑并修正接口路径
修复路由token验证逻辑,增加加载状态和错误处理 修正sendToken接口路径错误
This commit is contained in:
parent
e6beded4de
commit
a464d256a2
|
|
@ -74,5 +74,5 @@ export const editTopNews = (data: any) => {
|
||||||
|
|
||||||
// 编辑精选接口
|
// 编辑精选接口
|
||||||
export const sendToken = (data: any) => {
|
export const sendToken = (data: any) => {
|
||||||
return Request.post("/common/forward/financiald", data);
|
return Request.post("/common/forward/financial", data);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -129,17 +129,31 @@ function currentChange(page) {
|
||||||
onMounted(async (e) => {
|
onMounted(async (e) => {
|
||||||
|
|
||||||
console.log("🚀 ~ route.query:", route.query)
|
console.log("🚀 ~ route.query:", route.query)
|
||||||
if (route.query?.token) {
|
if (route.query?.token && !Session.get("token")) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
sendToken({
|
sendToken({
|
||||||
token: route.query.token,
|
token: route.query.token,
|
||||||
|
}).then((res) => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code == 200) {
|
||||||
|
Session.set("token", res.data.token);
|
||||||
|
Session.set("userPhone", res.data.phone);
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
if (!Session.get("token")) {
|
||||||
|
LoginShow.value = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getNewsList();
|
getNewsList();
|
||||||
|
|
||||||
if (!Session.get("token")) {
|
|
||||||
LoginShow.value = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const LoginShow = ref(false);
|
const LoginShow = ref(false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue