fix: 看站系统配置新增管理员账号变更
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { fnToStepName, stepState } from '../hooks/useStep';
|
||||
import { useRouter } from 'vue-router';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { reactive } from 'vue';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
@@ -12,8 +11,8 @@ import { sessionGet } from '@/utils/cache-session-utils';
|
||||
import { FileType } from 'ant-design-vue/lib/upload/interface';
|
||||
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||
import { changeValue } from '@/api/system/config';
|
||||
import { bootloaderAccount } from '@/api/system/quick-start/bootloader';
|
||||
const { t, currentLocale } = useI18n();
|
||||
const router = useRouter();
|
||||
const appStore = useAppStore();
|
||||
|
||||
type StateType = {
|
||||
@@ -29,6 +28,9 @@ type StateType = {
|
||||
/**国际化切换 */
|
||||
open: boolean;
|
||||
openOld: boolean;
|
||||
/**管理员账号密码 */
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
|
||||
const state: StateType = reactive({
|
||||
@@ -41,6 +43,8 @@ const state: StateType = reactive({
|
||||
titleOld: appStore.appName,
|
||||
open: appStore.i18nOpen,
|
||||
openOld: appStore.i18nOpen,
|
||||
username: 'admin',
|
||||
password: 'Abcd1234..',
|
||||
});
|
||||
|
||||
// LOGO地址
|
||||
@@ -111,8 +115,23 @@ function fnUpload(up: UploadRequestOption) {
|
||||
});
|
||||
}
|
||||
|
||||
/**保存信息 */
|
||||
function fnSave() {
|
||||
/**保存管理员账号信息 */
|
||||
function fnSaveAcount() {
|
||||
// 发送保存
|
||||
state.confirmLoading = true;
|
||||
bootloaderAccount(state.username, state.password).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('保存成功!');
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
state.confirmLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**保存系统信息 */
|
||||
function fnSaveSystem() {
|
||||
const language = currentLocale.value;
|
||||
const reqArr = [changeValue({ key: 'sys.logo.type', value: state.type })];
|
||||
// 改变LOGO地址
|
||||
@@ -184,17 +203,45 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="ne">
|
||||
<h2>系统配置</h2>
|
||||
|
||||
<a-form
|
||||
:label-col="{ span: 3 }"
|
||||
:label-col="{ span: 4 }"
|
||||
:label-wrap="true"
|
||||
:wrapper-col="{ span: 16 }"
|
||||
:wrapper-col="{ span: 10 }"
|
||||
style="flex: 1"
|
||||
>
|
||||
<a-divider orientation="left">管理员账号</a-divider>
|
||||
<a-form-item :label="t('views.system.user.account')" name="username">
|
||||
<a-input v-model:value="state.username" :maxlength="30">
|
||||
<template #prefix>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('views.system.user.loginPwd')" name="password">
|
||||
<a-input-password v-model:value="state.password" :maxlength="26">
|
||||
<template #prefix>
|
||||
<LockOutlined />
|
||||
</template>
|
||||
</a-input-password>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapper-col="{ offset: 4, span: 10 }">
|
||||
<a-button
|
||||
type="primary"
|
||||
:loading="state.confirmLoading"
|
||||
@click="fnSaveAcount()"
|
||||
>
|
||||
保存
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
|
||||
<a-divider orientation="left">系统信息</a-divider>
|
||||
<a-form-item
|
||||
label="系统LOGO"
|
||||
help="将整张图片展示到系统LOGO区域,请使用透明背景,尺寸比例适应区域大小"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<a-space direction="horizontal" :size="18">
|
||||
<a-radio-group v-model:value="state.type" button-style="solid">
|
||||
@@ -235,7 +282,6 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="系统名称" help="系统名称限制20个字符长度">
|
||||
<a-input
|
||||
v-model:value="state.title"
|
||||
@@ -244,10 +290,10 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
|
||||
:placeholder="t('common.inputPlease')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
label="国际化切换"
|
||||
help="进入系统后是否显示国际化切换,默认锁定当前语言"
|
||||
v-if="false"
|
||||
>
|
||||
<a-switch
|
||||
:checked-children="t('common.switch.open')"
|
||||
@@ -255,14 +301,21 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
|
||||
v-model:checked="state.open"
|
||||
></a-switch>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapper-col="{ offset: 4, span: 10 }">
|
||||
<a-button
|
||||
type="primary"
|
||||
:loading="state.confirmLoading"
|
||||
@click="fnSaveSystem()"
|
||||
>
|
||||
保存
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<div>
|
||||
<div class="ne-oper">
|
||||
<a-space direction="horizontal" :size="18">
|
||||
<a-button @click="fnStepPrev()"> 上一步 </a-button>
|
||||
<a-button type="primary" :loading="state.confirmLoading" @click="fnSave()">
|
||||
保存信息
|
||||
</a-button>
|
||||
|
||||
<a-button type="dashed" @click="fnStepNext('NeInfoConfig')">
|
||||
下一步
|
||||
</a-button>
|
||||
@@ -322,4 +375,17 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.ne {
|
||||
height: 78vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&-oper {
|
||||
padding-top: 24px;
|
||||
text-align: end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user