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