diff --git a/src/store/data.ts b/src/store/data.ts index 41c61f7..4acac7c 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -76,15 +76,7 @@ export const defaultPrizeList = [ }, separateCount: { enable: true, - countList: [{ - id: '0', - count: 6, - isUsedCount: 0, - }, { - id: '1', - count: 6, - isUsedCount: 0, - }] + countList: [] }, desc: '三等奖', isShow: true, diff --git a/src/store/globalConfig.ts b/src/store/globalConfig.ts index d115fbc..ea58c13 100644 --- a/src/store/globalConfig.ts +++ b/src/store/globalConfig.ts @@ -1,14 +1,14 @@ import { defineStore } from 'pinia'; -import { defaultMusicList,defaultImageList,defaultPatternList } from './data' -import {IMusic,IImage} from '@/types/storeType'; +import { defaultMusicList, defaultImageList, defaultPatternList } from './data' +import { IMusic, IImage } from '@/types/storeType'; // import { IPrizeConfig } from '@/types/storeType'; export const useGlobalConfig = defineStore('global', { state() { return { globalConfig: { rowCount: 17, - isSHowPrizeList:true, - topTitle:'大明内阁六部御前奏对', + isSHowPrizeList: true, + topTitle: '大明内阁六部御前奏对', theme: { name: 'dark', detail: { primary: '#0f5fd3' }, @@ -16,17 +16,17 @@ export const useGlobalConfig = defineStore('global', { cardWidth: 140, cardHeight: 200, textColor: '#ffffff', - luckyCardColor:'#ECB1AC', + luckyCardColor: '#ECB1AC', textSize: 30, - patternColor:'#1b66c9', - patternList:defaultPatternList as number[], + patternColor: '#1b66c9', + patternList: defaultPatternList as number[], }, musicList: defaultMusicList as IMusic[], - imageList:defaultImageList as IImage[], + imageList: defaultImageList as IImage[], }, currentMusic: { - item:defaultMusicList[0], - paused:true, + item: defaultMusicList[0], + paused: true, }, }; }, @@ -71,11 +71,11 @@ export const useGlobalConfig = defineStore('global', { return state.globalConfig.theme.textSize; }, // 获取图案颜色 - getPatterColor(state){ + getPatterColor(state) { return state.globalConfig.theme.patternColor; }, // 获取图案列表 - getPatternList(state){ + getPatternList(state) { return state.globalConfig.theme.patternList; }, // 获取音乐列表 @@ -164,10 +164,10 @@ export const useGlobalConfig = defineStore('global', { } }, // 设置当前播放音乐 - setCurrentMusic(musicItem: IMusic,paused:boolean=true) { - this.currentMusic={ - item:musicItem, - paused:paused, + setCurrentMusic(musicItem: IMusic, paused: boolean = true) { + this.currentMusic = { + item: musicItem, + paused: paused, } }, // 重置音乐列表 @@ -179,7 +179,7 @@ export const useGlobalConfig = defineStore('global', { this.globalConfig.musicList = [] as IMusic[]; }, // 添加图片 - addImage(image:IImage){ + addImage(image: IImage) { for (let i = 0; i < this.globalConfig.imageList.length; i++) { if (this.globalConfig.imageList[i].name === image.name) { return; @@ -211,29 +211,28 @@ export const useGlobalConfig = defineStore('global', { // 重置所有配置 reset() { this.globalConfig = { - rowCount: 12, - topTitle:'大明内阁六部御前奏对', - isSHowPrizeList:true, + rowCount: 17, + isSHowPrizeList: true, + topTitle: '大明内阁六部御前奏对', theme: { name: 'dark', detail: { primary: '#0f5fd3' }, - cardColor: 'rgba(0, 255, 255)', - luckyCardColor:'#ECB1AC', - cardWidth: 200, - cardHeight: 140, + cardColor: '#ff79c6', + cardWidth: 140, + cardHeight: 200, textColor: '#ffffff', + luckyCardColor: '#ECB1AC', textSize: 30, patternColor: '#1b66c9', - patternList:defaultPatternList, - + patternList: defaultPatternList as number[], }, musicList: defaultMusicList as IMusic[], - imageList:defaultImageList as IImage[], + imageList: defaultImageList as IImage[], }, - this.currentMusic= { - item:defaultMusicList[0] as IMusic, - paused:true, - } + this.currentMusic = { + item: defaultMusicList[0], + paused: true, + } } }, persist: { diff --git a/src/store/personConfig.ts b/src/store/personConfig.ts index c891d61..7029d2f 100644 --- a/src/store/personConfig.ts +++ b/src/store/personConfig.ts @@ -30,8 +30,8 @@ export const usePersonConfig = defineStore('person', { const data = state.personConfig.allPersonList.filter((item: IPersonConfig) => { return !item.prizeId.includes(currentPrize.id as string); }); - -return data + + return data }, // 获取已中奖人员名单 getAlreadyPersonList(state) { @@ -99,7 +99,7 @@ return data } } for (let i = 0; i < alreadyPersonListLength; i++) { - this.personConfig.alreadyPersonList = this.personConfig.alreadyPersonList.filter((item: IPersonConfig) => + this.personConfig.alreadyPersonList = this.personConfig.alreadyPersonList.filter((item: IPersonConfig) => item.id !== person.id ) } diff --git a/src/store/prizeConfig.ts b/src/store/prizeConfig.ts index 52ad2c3..5642139 100644 --- a/src/store/prizeConfig.ts +++ b/src/store/prizeConfig.ts @@ -8,33 +8,41 @@ export const usePrizeConfig = defineStore('prize', { prizeList: defaultPrizeList, currentPrize: { id: '001', - name: '一等奖', + name: '三等奖', sort: 1, - isAll: true, - count: 1, - isUsedCount:0, + isAll: false, + count: 12, + isUsedCount: 0, picture: { - id: '0', - name: '一等奖', - url: 'https://24years.top/resource/image/image1.png' + id: '2', + name: '三等奖', + url: 'https://24years.top/resource/image/image3.png' }, - desc: '一等奖', + separateCount: { + enable: true, + countList: [] + }, + desc: '三等奖', isShow: true, isUsed: false, frequency: 1, } as IPrizeConfig, - temporaryPrize:{ + temporaryPrize: { id: '', name: '', sort: 0, isAll: false, count: 1, - isUsedCount:0, + isUsedCount: 0, picture: { id: '-1', name: '', url: '' }, + separateCount: { + enable: true, + countList: [] + }, desc: '', isShow: false, isUsed: false, @@ -50,7 +58,7 @@ export const usePrizeConfig = defineStore('prize', { }, // 获取奖品列表 getPrizeConfig(state) { -return state.prizeConfig.prizeList; + return state.prizeConfig.prizeList; }, // 根据id获取配置 getPrizeConfigById(state) { @@ -63,7 +71,7 @@ return state.prizeConfig.prizeList; return state.prizeConfig.currentPrize; }, // 获取临时的奖项 - getTemporaryPrize(state){ + getTemporaryPrize(state) { return state.prizeConfig.temporaryPrize; }, @@ -83,16 +91,16 @@ return state.prizeConfig.prizeList; }, // 更新奖项数据 updatePrizeConfig(prizeConfigItem: IPrizeConfig) { - const prizeListLength=this.prizeConfig.prizeList.length; - if(prizeConfigItem.isUsed&&prizeListLength){ - for(let i=0;i { globalConfig.resetPatternList() } +const resetData=()=>{ + globalConfig.reset(); + personConfig.reset(); + prizeConfig.resetDefault(); + // 刷新页面 + window.location.reload() +} + // const handleChangeShowFields = (fieldItem: any) => { // formData.value.showField.map((item) => { // if (item.label === fieldItem.label) { @@ -144,7 +153,24 @@ onMounted(() => {