feat(admin): 新增活动管理功能并优化字典组件
- 新增活动管理相关功能,包括活动创建、编辑、删除和状态管理 - 新增 PublishStatus 枚举定义活动发布状态 - 优化字典组件,支持字符串和数字类型的字典值 - 重构业务数据存储逻辑,简化字典数据获取流程 - 新增活动详情页面,支持分组管理和队伍配置 - 集成富文本编辑器用于活动规则编辑 - 优化图片上传组件,支持小图上传模式 - 修复模板管理中的区域选择和分页问题 - 更新 TypeScript 类型定义,完善 API 接口 - 调整主题配置,新增活动状态相关颜色
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { getDictionaryList, getDictionaryListUITypeByDicID } from '@/service/api/dictionary'
|
||||
import { getDictionaryItemListByDicID, getDictionaryList } from '@/service/api/dictionary'
|
||||
|
||||
export const useBusinessStore = defineStore('business-store', () => {
|
||||
const dictList = ref<Api.Dictionary.DictionaryItem[]>([])
|
||||
@ -21,28 +21,17 @@ export const useBusinessStore = defineStore('business-store', () => {
|
||||
|
||||
/** 获取字典数据 */
|
||||
async function getDict(key: string) {
|
||||
if (!isInitialized.value) {
|
||||
await initDict()
|
||||
}
|
||||
|
||||
// 已经加载过,直接返回
|
||||
if (dictData.value[key] && dictData.value[key].length > 0)
|
||||
return dictData.value[key]
|
||||
|
||||
// 查找 ID
|
||||
const dict = dictList.value.find(d => d.DicValue === key)
|
||||
if (!dict) {
|
||||
console.warn(`Dictionary key ${key} not found`)
|
||||
return []
|
||||
}
|
||||
|
||||
if (loadingMap.value[key]) {
|
||||
return []
|
||||
}
|
||||
|
||||
loadingMap.value[key] = true
|
||||
try {
|
||||
const { data: res, error } = await getDictionaryListUITypeByDicID(dict.Id)
|
||||
const { data: res, error } = await getDictionaryItemListByDicID(key)
|
||||
if (!error && res) {
|
||||
const list = res.data || []
|
||||
// 使用新对象赋值,确保触发响应式更新
|
||||
@ -67,4 +56,4 @@ export const useBusinessStore = defineStore('business-store', () => {
|
||||
initDict,
|
||||
getDict,
|
||||
}
|
||||
}, { persist: true })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user