fix: bug路由校验 初始化跳转

This commit is contained in:
leiqiaochu 2023-03-30 15:39:04 +08:00
parent 3ea80b89c6
commit 2dbd7e31b6
2 changed files with 11 additions and 4 deletions

View File

@ -71,6 +71,7 @@ import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
import { FILE_UPLOAD } from '@/api/comm';
import { LocalStore } from '@/utils/comm';
import { message } from 'jetlinks-ui-components';
import { useUserInfo } from '@/store/userInfo';
const basicRef = ref();
const roleRef = ref();
const initDataRef = ref();
@ -81,6 +82,7 @@ const loading = ref(false);
*/
const activeKey = ref<string>('1');
const spinning = ref<boolean>(false);
const userInfo = useUserInfo();
// const action = ref<string>(`${BASE_API_PATH}/file/static`);
// const headers = ref({ [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) });
/**
@ -132,12 +134,16 @@ const submitData = async () => {
* 判断是否已有配置
*/
const judgeInitSet = async () => {
const resp:any = await getInit();
if(resp.status === 200 && resp.result.length){
if (userInfo.$state.userInfos.username === 'admin') {
const resp: any = await getInit();
if (resp.status === 200 && resp.result.length) {
window.location.href = '/';
}
} else {
window.location.href = '/';
}
}
onMounted(()=>{
};
onMounted(() => {
judgeInitSet();
});
</script>

View File

@ -101,6 +101,7 @@
message: '请输入页面地址',
},
{ max: 128, message: '最多可输入128字符' },
{ pattern: /^\// ,message:'请正确填写地址,以/开头'},
]"
>
<j-input