|
1 | 1 | <template> |
2 | 2 | <div> |
3 | | - <div v-if="!loading"> |
4 | | - <div class="login-background" v-if="errStatus === ''"> |
5 | | - <div class="login-wrapper"> |
6 | | - <div :class="screenWidth > 1110 ? 'left inline-block' : ''"> |
7 | | - <div class="login-title"> |
8 | | - <span>{{ globalStore.themeConfig.title || $t('setting.description') }}</span> |
| 3 | + <div v-if="init"> |
| 4 | + <div v-if="errStatus === ''"> |
| 5 | + <div class="login-background"> |
| 6 | + <div class="login-wrapper"> |
| 7 | + <div :class="screenWidth > 1110 ? 'left inline-block' : ''"> |
| 8 | + <div class="login-title"> |
| 9 | + <span>{{ globalStore.themeConfig.title || $t('setting.description') }}</span> |
| 10 | + </div> |
| 11 | + <img src="@/assets/images/1panel-login.png" alt="" v-if="screenWidth > 1110" /> |
9 | 12 | </div> |
10 | | - <img src="@/assets/images/1panel-login.png" alt="" v-if="screenWidth > 1110" /> |
11 | | - </div> |
12 | | - <div :class="screenWidth > 1110 ? 'right inline-block' : ''"> |
13 | | - <div class="login-container"> |
14 | | - <LoginForm ref="loginRef"></LoginForm> |
| 13 | + <div :class="screenWidth > 1110 ? 'right inline-block' : ''"> |
| 14 | + <div class="login-container"> |
| 15 | + <LoginForm ref="loginRef"></LoginForm> |
| 16 | + </div> |
15 | 17 | </div> |
16 | 18 | </div> |
17 | 19 | </div> |
@@ -46,45 +48,40 @@ import ErrIP from '@/components/error-message/err_ip.vue'; |
46 | 48 | import ErrCode from '@/components/error-message/error_code.vue'; |
47 | 49 | import ErrDomain from '@/components/error-message/err_domain.vue'; |
48 | 50 | import ErrFound from '@/components/error-message/404.vue'; |
49 | | -import { ref, onMounted, watch } from 'vue'; |
| 51 | +import { ref, onMounted } from 'vue'; |
50 | 52 | import { GlobalStore } from '@/store'; |
51 | 53 | import { getXpackSettingForTheme } from '@/utils/xpack'; |
52 | 54 | const globalStore = GlobalStore(); |
53 | 55 |
|
54 | 56 | const screenWidth = ref(null); |
55 | | -const errStatus = ref(''); |
56 | | -const loading = ref(); |
| 57 | +const errStatus = ref('x'); |
| 58 | +const init = ref(false); |
57 | 59 |
|
58 | 60 | const mySafetyCode = defineProps({ |
59 | 61 | code: { |
60 | 62 | type: String, |
61 | 63 | default: '', |
62 | 64 | }, |
63 | 65 | }); |
64 | | -watch( |
65 | | - () => globalStore.errStatus, |
66 | | - (newVal) => { |
67 | | - if (newVal?.startsWith('err-') || newVal?.startsWith('code-')) { |
68 | | - errStatus.value = newVal; |
69 | | - } |
70 | | - }, |
71 | | -); |
| 66 | +
|
72 | 67 | const getStatus = async () => { |
73 | | - let info = globalStore.errStatus; |
74 | | - if (info?.startsWith('err-') || info?.startsWith('code-')) { |
75 | | - errStatus.value = info; |
76 | | - return; |
77 | | - } |
78 | 68 | let code = mySafetyCode.code; |
79 | 69 | globalStore.entrance = code; |
80 | | - loading.value = true; |
81 | 70 | await checkIsSafety(code) |
82 | 71 | .then(() => { |
83 | | - loading.value = false; |
| 72 | + let info = globalStore.errStatus; |
| 73 | + if (info?.startsWith('err-') || info?.startsWith('code-')) { |
| 74 | + errStatus.value = info; |
| 75 | + init.value = true; |
| 76 | + return; |
| 77 | + } |
| 78 | + errStatus.value = ''; |
| 79 | + init.value = true; |
84 | 80 | getXpackSettingForTheme(); |
85 | 81 | }) |
86 | | - .catch(() => { |
87 | | - loading.value = false; |
| 82 | + .catch((err) => { |
| 83 | + errStatus.value = 'code-' + err.status; |
| 84 | + init.value = true; |
88 | 85 | }); |
89 | 86 | }; |
90 | 87 |
|
|
0 commit comments