fix(修复登录界面验证码关闭issue): 🐛 https://gitee.com/huge-dream/django-vue3-admin/issues/I6OS75

This commit is contained in:
H0nGzA1
2023-03-22 19:56:54 +08:00
parent b5f50bdf30
commit 5ab2aaa066
3 changed files with 12 additions and 20 deletions

View File

@@ -11,7 +11,7 @@ import { useRoutesList } from '/@/stores/routesList';
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes'; import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
import { useMenuApi } from '/@/api/menu/index'; import { useMenuApi } from '/@/api/menu/index';
import { handleMenu } from '../utils/menu'; import { handleMenu } from '../utils/menu';
import {BtnPermissionStore} from "/@/plugin/permission/store.permission"; import { BtnPermissionStore } from '/@/plugin/permission/store.permission';
const menuApi = useMenuApi(); const menuApi = useMenuApi();

View File

@@ -1,8 +1,7 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { ConfigStates } from './interface'; import { ConfigStates } from './interface';
import { request } from '../utils/service'; import { request } from '../utils/service';
export const urlPrefix = '/api/init/settings/';
export const urlPrefix = '/api/system/system_config/';
/** /**
* 系统配置数据 * 系统配置数据
@@ -19,15 +18,7 @@ export const SystemConfigStore = defineStore('SystemConfig', {
method: 'get', method: 'get',
}).then((ret: { data: [] }) => { }).then((ret: { data: [] }) => {
// 转换数据格式并保存到pinia // 转换数据格式并保存到pinia
let dataList = ret.data; this.systemConfig = JSON.parse(JSON.stringify(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;
}
});
}); });
}, },
}, },

View File

@@ -27,7 +27,7 @@
</template> </template>
</el-input> </el-input>
</el-form-item> </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-col :span="15">
<el-input <el-input
type="text" type="text"
@@ -103,10 +103,10 @@ export default defineComponent({
const currentTime = computed(() => { const currentTime = computed(() => {
return formatAxis(new Date()); return formatAxis(new Date());
}); });
// 是否关闭验证码
const showCaptcha = (): boolean => { const isShowCaptcha = computed(() => {
return SystemConfigStore().systemConfig.captcha_state; return SystemConfigStore().systemConfig['base.captcha_state'];
}; });
const getCaptcha = async () => { const getCaptcha = async () => {
loginApi.getCaptcha().then((ret: any) => { loginApi.getCaptcha().then((ret: any) => {
@@ -146,8 +146,7 @@ export default defineComponent({
getUserInfo(); getUserInfo();
//获取所有字典 //获取所有字典
DictionaryStore().getSystemDictionarys(); DictionaryStore().getSystemDictionarys();
//获取系统配置
SystemConfigStore().getSystemConfigs();
// 初始化登录成功时间问候语 // 初始化登录成功时间问候语
let currentTimeInfo = currentTime.value; let currentTimeInfo = currentTime.value;
// 登录成功,跳到转首页 // 登录成功,跳到转首页
@@ -170,13 +169,15 @@ export default defineComponent({
}; };
onMounted(() => { onMounted(() => {
getCaptcha(); getCaptcha();
//获取系统配置
SystemConfigStore().getSystemConfigs();
}); });
return { return {
refreshCaptcha, refreshCaptcha,
loginClick, loginClick,
loginSuccess, loginSuccess,
showCaptcha, isShowCaptcha,
...toRefs(state), ...toRefs(state),
}; };
}, },