feat: 系统引导使用接口变更
This commit is contained in:
@@ -108,12 +108,12 @@ export function getSysConf() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次引导安装开始
|
||||
* 首次引导开始
|
||||
* @returns object
|
||||
*/
|
||||
export function guideStart() {
|
||||
export function bootloaderStart() {
|
||||
return request({
|
||||
url: `/guide`,
|
||||
url: `/bootloader`,
|
||||
method: 'post',
|
||||
whithToken: false,
|
||||
repeatSubmit: false,
|
||||
@@ -121,12 +121,23 @@ export function guideStart() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次引导安装完成
|
||||
* 首次引导完成
|
||||
* @returns object
|
||||
*/
|
||||
export function guideDone() {
|
||||
export function bootloaderDone() {
|
||||
return request({
|
||||
url: `/guide`,
|
||||
url: `/bootloader`,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 引导系统数据重置
|
||||
* @returns object
|
||||
*/
|
||||
export function bootloaderReset() {
|
||||
return request({
|
||||
url: `/bootloader`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
console.log(to.path);
|
||||
// 需要系统引导跳转
|
||||
if (appStore.sysGuide && to.path !== '/quick-start') {
|
||||
if (appStore.bootloader && to.path !== '/quick-start') {
|
||||
next({ name: 'QuickStart' });
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ type AppStore = {
|
||||
/**服务版本 */
|
||||
version: string;
|
||||
buildTime: string;
|
||||
/**系统首次使用 */
|
||||
sysGuide: boolean;
|
||||
/**系统引导使用 */
|
||||
bootloader: boolean;
|
||||
// 序列号
|
||||
serialNum: string;
|
||||
/**应用版权声明 */
|
||||
@@ -51,7 +51,7 @@ const useAppStore = defineStore('app', {
|
||||
|
||||
version: `-`,
|
||||
buildTime: `-`,
|
||||
sysGuide: false,
|
||||
bootloader: false,
|
||||
serialNum: `-`,
|
||||
copyright: `Copyright ©2023 For ${import.meta.env.VITE_APP_NAME}`,
|
||||
logoType: 'icon',
|
||||
@@ -80,9 +80,9 @@ const useAppStore = defineStore('app', {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
this.version = res.data.version;
|
||||
this.buildTime = res.data.buildTime;
|
||||
this.sysGuide = res.data.sysGuide === 'true';
|
||||
this.bootloader = res.data.bootloader === 'true';
|
||||
// 引导时
|
||||
if (this.sysGuide) {
|
||||
if (this.bootloader) {
|
||||
removeToken();
|
||||
}
|
||||
this.serialNum = res.data.serialNum;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { guideDone } from '@/api';
|
||||
import { bootloaderDone } from '@/api';
|
||||
import { stepState, fnToStepName } from '../hooks/useStep';
|
||||
import { message, Form, Modal } from 'ant-design-vue/lib';
|
||||
import { Modal } from 'ant-design-vue/lib';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { removeToken } from '@/plugins/auth-token';
|
||||
import { useRouter } from 'vue-router';
|
||||
@@ -68,11 +68,11 @@ function fnStepPrev() {
|
||||
|
||||
/**引导完成 */
|
||||
function fnGuideDone() {
|
||||
guideDone()
|
||||
bootloaderDone()
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
removeToken();
|
||||
useAppStore().sysGuide = false;
|
||||
useAppStore().bootloader = false;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import { fnToStepName } from '../hooks/useStep';
|
||||
import { guideStart } from '@/api';
|
||||
import { bootloaderStart } 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();
|
||||
@@ -18,7 +17,7 @@ const state = reactive({
|
||||
/**引导开始 */
|
||||
function fnGuideStart() {
|
||||
if (getToken()) return;
|
||||
guideStart().then(res => {
|
||||
bootloaderStart().then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const token = res.data[TOKEN_RESPONSE_FIELD];
|
||||
setToken(token);
|
||||
|
||||
Reference in New Issue
Block a user