This repository was archived by the owner on Nov 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-18
lines changed
Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,31 @@ export default {
7575 async created () {
7676 let needToRoot = false ;
7777
78+ try {
79+ // Get current panel status information
80+ const statusInfo = await requestPanelStatus ();
81+ if (statusInfo .language ) {
82+ console .log (" SET_LANGUAGE:" , statusInfo .language , statusInfo);
83+ this .$i18n .locale = statusInfo .language ;
84+ } else {
85+ this .$i18n .locale = " en_us" ;
86+ }
87+ // If not installed, must route to /install
88+ if (statusInfo? .isInstall === false ) {
89+ return router .push ({ path: " /install" });
90+ }
91+ } catch (error) {
92+ alert (` Err: ${ error} , Please refresh!` );
93+ }
94+
7895 try {
7996 // After the first refresh, try to get user data once
8097 // If it fails, navigate to / view to further decide the jump route
8198 await setupUserInfo ();
8299 const userInfo = this .$store .state .userInfo ;
83100 if (! userInfo || ! userInfo .uuid ) throw new Error (" userInfo.uuid is null" );
84101 } catch (error) {
85- console .log (error );
102+ console .log (" App.vue redirected to root.vue " );
86103 needToRoot = true ;
87104 }
88105
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import zh_cn from "../language/zh_cn"
33import en_us from "../language/en_us"
44
55const i18n = createI18n ( {
6- locale : 'zh_cn ' ,
6+ locale : 'en_us ' ,
77 fallbackLocale : 'en_us' ,
88 messages : {
99 zh_cn,
Original file line number Diff line number Diff line change 1313<script >
1414import Panel from " ../../components/Panel" ;
1515import router from " ../router" ;
16- import { requestPanelStatus , setupUserInfo } from " ../service/protocol" ;
16+ import { setupUserInfo } from " ../service/protocol" ;
1717
1818export default {
1919 components: { Panel },
@@ -30,21 +30,6 @@ export default {
3030 }
3131 },
3232 async init () {
33- try {
34- // Get current panel status information
35- const statusInfo = await requestPanelStatus ();
36- if (statusInfo .language ) {
37- console .log (" SET_LANGUAGE:" , statusInfo .language , statusInfo);
38- this .$i18n .locale = statusInfo .language ;
39- } else {
40- this .$i18n .locale = " en_us" ;
41- }
42- // If not installed, must route to /install
43- if (statusInfo? .isInstall === false ) return router .push ({ path: " /install" });
44- } catch (error) {
45- alert (` Err: ${ error} , Please refresh!` );
46- }
47-
4833 try {
4934 // In order to adapt to seamless login, data must be requested again here
5035 if (this .$store .state .userInfo ? .permission && this .$store .state .userInfo ? .uuid )
You can’t perform that action at this time.
0 commit comments