ow
This commit is contained in:
1 parent
6c86c59bdc
commit
31de6c4cd6
15 files changed
+1001
-666
No files matched your search
@@ -9,7 +9,7 @@ import { useLocale } from "uview-pro";
|
||||
import { computed, ref } from "vue";
|
||||
import { apiBaseUrl } from "@/common/apiEndpoint";
|
||||
import { brandGlyph, veinGlyph } from "@/common/brand";
|
||||
import { backendLocale } from "@/common/http.interceptor";
|
||||
import { backendLocale, isNetworkError } from "@/common/http.interceptor";
|
||||
import { DEFAULT_LOCALE, setCurrentUiLocale } from "@/common/locale-const";
|
||||
import { encryptLoginPassword } from "@/common/pwd-crypto";
|
||||
import { useThemeGradient, useThemeTokens } from "@/composables";
|
||||
@@ -23,6 +23,8 @@ const userMobile = ref("");
|
||||
const password = ref("");
|
||||
const showPwd = ref(false);
|
||||
const loading = ref(false);
|
||||
/** 「访问线路」弹层显隐:登录连不上服务器时自动弹出(组件与「我的」共用) */
|
||||
const endpointPopupVisible = ref(false);
|
||||
const loginProfileStore = useLoginProfileStore();
|
||||
|
||||
/* 主题接线:页面底渐变与强调色全部跟随当前主题(与「我的」/媒体/共享页同一口径),
|
||||
@@ -127,13 +129,33 @@ async function handleLogin() {
|
||||
// 回到被拦前的页面(默认 dashboard):reLaunch 会清空页面栈,避免返回键退回登录页
|
||||
setTimeout(() => uni.reLaunch({ url: redirectUrl.value }), 800);
|
||||
}
|
||||
catch {
|
||||
// 错误提示已由 http.interceptor 统一处理
|
||||
catch (error: any) {
|
||||
// 连不上服务器(地址填错 / 服务器宕机):提示并自动弹出共用的「访问线路」让用户重设地址后原地重试;
|
||||
// 其余错误(如账号密码错)的提示已由 http.interceptor 统一处理
|
||||
// #ifdef APP-PLUS
|
||||
if (isNetworkError(error)) {
|
||||
uni.showModal({
|
||||
title: t("LoginForm.netFailTitle"),
|
||||
content: t("LoginForm.netFailContent"),
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
endpointPopupVisible.value = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 访问线路保存后:服务器真的变了就提示重试登录(本页本就未登录,无需再走登出) */
|
||||
function onEndpointSaved(payload: { changed: boolean }): void {
|
||||
if (payload.changed) {
|
||||
uni.showToast({ title: t("MinePage.lineSavedRelogin"), icon: "none" });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -197,6 +219,11 @@ async function handleLogin() {
|
||||
{{ envMode }} · {{ currentApiUrl }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 访问线路弹层(与「我的」共用组件):登录连不上服务器时自动弹出,改地址后原地重试 -->
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<endpoint-setting-popup v-model="endpointPopupVisible" @saved="onEndpointSaved" />
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in new issue
Block a user