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) => {
|
||||
return Request.post("/common/forward/financiald", data);
|
||||
return Request.post("/common/forward/financial", data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -129,17 +129,31 @@ function currentChange(page) {
|
|||
onMounted(async (e) => {
|
||||
|
||||
console.log("🚀 ~ route.query:", route.query)
|
||||
if (route.query?.token) {
|
||||
if (route.query?.token && !Session.get("token")) {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
sendToken({
|
||||
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();
|
||||
|
||||
if (!Session.get("token")) {
|
||||
LoginShow.value = true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const LoginShow = ref(false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue