feat: 开站开始页面获取接口授权
This commit is contained in:
@@ -1,16 +1,58 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from 'vue';
|
import { onMounted, reactive } from 'vue';
|
||||||
import { fnToStepName } from '../hooks/useStep';
|
import { fnToStepName } from '../hooks/useStep';
|
||||||
|
import { guideStart } from '@/api';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
import { TOKEN_RESPONSE_FIELD } from '@/constants/token-constants';
|
||||||
|
import { getToken, setToken } from '@/plugins/auth-token';
|
||||||
|
import { Modal, message } from 'ant-design-vue/lib';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import useI18n from '@/hooks/useI18n';
|
||||||
|
const { t, changeLocale, optionsLocale } = useI18n();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
copyright: ` `,
|
copyright: ` `,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**引导开始 */
|
||||||
|
function fnGuideStart() {
|
||||||
|
if (getToken()) return;
|
||||||
|
guideStart().then(res => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
|
const token = res.data[TOKEN_RESPONSE_FIELD];
|
||||||
|
setToken(token);
|
||||||
|
} else {
|
||||||
|
router.push({ name: 'Login' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fnGuideStart();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div>欢迎使用</div>
|
<div>欢迎使用 {{ t('hello') }}</div>
|
||||||
<div>语言切换:中文</div>
|
<div>
|
||||||
|
语言切换:
|
||||||
|
|
||||||
|
<a-dropdown trigger="click">
|
||||||
|
<a-button size="small" type="default">
|
||||||
|
{{ t('i18n') }}
|
||||||
|
<DownOutlined />
|
||||||
|
</a-button>
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu @click="(e:any)=> changeLocale(e.key)">
|
||||||
|
<a-menu-item v-for="opt in optionsLocale" :key="opt.value">
|
||||||
|
{{ opt.label }}
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
</a-dropdown>
|
||||||
|
</div>
|
||||||
====
|
====
|
||||||
<div>软件声明:</div>
|
<div>软件声明:</div>
|
||||||
<div>1. 网管配置,网元安装可选</div>
|
<div>1. 网管配置,网元安装可选</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user