fix(修复登录界面验证码关闭issue): 🐛 https://gitee.com/huge-dream/django-vue3-admin/issues/I6OS75
This commit is contained in:
@@ -11,7 +11,7 @@ import { useRoutesList } from '/@/stores/routesList';
|
||||
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
|
||||
import { useMenuApi } from '/@/api/menu/index';
|
||||
import { handleMenu } from '../utils/menu';
|
||||
import {BtnPermissionStore} from "/@/plugin/permission/store.permission";
|
||||
import { BtnPermissionStore } from '/@/plugin/permission/store.permission';
|
||||
|
||||
const menuApi = useMenuApi();
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ConfigStates } from './interface';
|
||||
import { request } from '../utils/service';
|
||||
|
||||
export const urlPrefix = '/api/system/system_config/';
|
||||
export const urlPrefix = '/api/init/settings/';
|
||||
|
||||
/**
|
||||
* 系统配置数据
|
||||
@@ -19,15 +18,7 @@ export const SystemConfigStore = defineStore('SystemConfig', {
|
||||
method: 'get',
|
||||
}).then((ret: { data: [] }) => {
|
||||
// 转换数据格式并保存到pinia
|
||||
let dataList = ret.data;
|
||||
dataList.forEach((item: any) => {
|
||||
let childrens = item.children;
|
||||
if (childrens.length > 1) {
|
||||
this.systemConfig[item.key] = childrens;
|
||||
} else {
|
||||
this.systemConfig[item.key] = item.value;
|
||||
}
|
||||
});
|
||||
this.systemConfig = JSON.parse(JSON.stringify(ret.data));
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item class="login-animation3" v-if="showCaptcha()">
|
||||
<el-form-item class="login-animation3" v-if="isShowCaptcha">
|
||||
<el-col :span="15">
|
||||
<el-input
|
||||
type="text"
|
||||
@@ -103,10 +103,10 @@ export default defineComponent({
|
||||
const currentTime = computed(() => {
|
||||
return formatAxis(new Date());
|
||||
});
|
||||
|
||||
const showCaptcha = (): boolean => {
|
||||
return SystemConfigStore().systemConfig.captcha_state;
|
||||
};
|
||||
// 是否关闭验证码
|
||||
const isShowCaptcha = computed(() => {
|
||||
return SystemConfigStore().systemConfig['base.captcha_state'];
|
||||
});
|
||||
|
||||
const getCaptcha = async () => {
|
||||
loginApi.getCaptcha().then((ret: any) => {
|
||||
@@ -146,8 +146,7 @@ export default defineComponent({
|
||||
getUserInfo();
|
||||
//获取所有字典
|
||||
DictionaryStore().getSystemDictionarys();
|
||||
//获取系统配置
|
||||
SystemConfigStore().getSystemConfigs();
|
||||
|
||||
// 初始化登录成功时间问候语
|
||||
let currentTimeInfo = currentTime.value;
|
||||
// 登录成功,跳到转首页
|
||||
@@ -170,13 +169,15 @@ export default defineComponent({
|
||||
};
|
||||
onMounted(() => {
|
||||
getCaptcha();
|
||||
//获取系统配置
|
||||
SystemConfigStore().getSystemConfigs();
|
||||
});
|
||||
|
||||
return {
|
||||
refreshCaptcha,
|
||||
loginClick,
|
||||
loginSuccess,
|
||||
showCaptcha,
|
||||
isShowCaptcha,
|
||||
...toRefs(state),
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user