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

This commit is contained in:
H0nGzA1
2023-03-21 18:01:42 +08:00
parent 256c6e4ab9
commit b5f50bdf30
6 changed files with 56 additions and 9 deletions

View File

@@ -91,4 +91,7 @@ export interface ThemeConfigStates {
export interface DictionaryStates {
data: any;
}
}
export interface ConfigStates {
systemConfig: any;
}

View File

@@ -0,0 +1,37 @@
import { defineStore } from 'pinia';
import { ConfigStates } from './interface';
import { request } from '../utils/service';
export const urlPrefix = '/api/system/system_config/';
/**
* 系统配置数据
* @methods getSystemConfig 获取系统配置数据
*/
export const SystemConfigStore = defineStore('SystemConfig', {
state: (): ConfigStates => ({
systemConfig: {},
}),
actions: {
async getSystemConfigs() {
request({
url: urlPrefix,
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;
}
});
});
},
},
persist: {
enabled: true,
},
});