From 6ae32114a68dab74fd183668791e8e9df840713a Mon Sep 17 00:00:00 2001 From: "ex_zhangwenlei@exiot.cmcc" <15196725410@139.com> Date: Wed, 24 Jan 2024 22:37:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E5=8D=95?= =?UTF-8?q?=E6=AC=A1=E6=8A=BD=E5=A5=96=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components.d.ts | 2 + .../NumberSeparate/EditSeparateDialog.vue | 102 ++++++++++++++ src/components/NumberSeparate/index.vue | 87 ++++++++++++ src/store/data.ts | 51 +++++-- src/types/storeType.ts | 71 +++++----- src/views/Config/Person/PersonAll.vue | 2 + src/views/Config/Person/PersonAlready.vue | 2 + src/views/Config/Prize/PrizeConfig.vue | 128 ++++++++++++++---- src/views/Config/Readme/index.vue | 2 +- src/views/Demo/index.vue | 16 ++- src/views/Home/index.vue | 35 +++-- tailwind.config.js | 3 + 12 files changed, 413 insertions(+), 88 deletions(-) create mode 100644 src/components/NumberSeparate/EditSeparateDialog.vue create mode 100644 src/components/NumberSeparate/index.vue diff --git a/src/components.d.ts b/src/components.d.ts index bdba1f1..9c49508 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -8,8 +8,10 @@ export {} declare module 'vue' { export interface GlobalComponents { DaiysuiTable: typeof import('./components/DaiysuiTable/index.vue')['default'] + EditSeparateDialog: typeof import('./components/NumberSeparate/EditSeparateDialog.vue')['default'] HelloWorld: typeof import('./components/HelloWorld.vue')['default'] ImageSync: typeof import('./components/ImageSync/index.vue')['default'] + NumberSeparate: typeof import('./components/NumberSeparate/index.vue')['default'] PlayMusic: typeof import('./components/PlayMusic/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/components/NumberSeparate/EditSeparateDialog.vue b/src/components/NumberSeparate/EditSeparateDialog.vue new file mode 100644 index 0000000..936efb2 --- /dev/null +++ b/src/components/NumberSeparate/EditSeparateDialog.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/components/NumberSeparate/index.vue b/src/components/NumberSeparate/index.vue new file mode 100644 index 0000000..0d1c257 --- /dev/null +++ b/src/components/NumberSeparate/index.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/store/data.ts b/src/store/data.ts index 1ea35bc..41c61f7 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -1,5 +1,4 @@ import { IPrizeConfig, IPersonConfig } from '@/types/storeType'; -import * as dayjs from 'dayjs' export const defaultPersonList = [ { uid: 'U100156001', name: '朱厚熜', department: '皇室', identity: '万岁爷', x: 1, y: 1, id: 0, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156002', name: '朱载垕', department: '皇室', identity: '裕王', x: 2, y: 1, id: 1, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156003', name: '朱翊钧 ', department: '皇室', identity: '裕王世子', x: 3, y: 1, id: 2, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156004', name: '严嵩', department: '内阁', identity: '首辅', x: 4, y: 1, id: 3, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156005', name: '徐阶', department: '内阁', identity: '次辅、户部尚书', x: 5, y: 1, id: 4, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156006', name: '张居正', department: '内阁', identity: '阁臣、兵部侍郞', x: 6, y: 1, id: 5, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156007', name: '高拱', department: '内阁', identity: '阁臣、户部侍郞', x: 7, y: 1, id: 6, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156008', name: '严世蕃', department: '内阁', identity: '吏部侍郞', x: 8, y: 1, id: 7, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156009', name: '胡宗宪', department: '大臣', identity: '浙直总督', x: 9, y: 1, id: 8, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156010', name: '戚继光', department: '大臣', identity: '都督佥事', x: 10, y: 1, id: 9, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156011', name: '高瀚文', department: '大臣', identity: '杭州知府', x: 11, y: 1, id: 10, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156012', name: '赵贞吉', department: '大臣', identity: '江苏巡抚', x: 12, y: 1, id: 11, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156013', name: '海瑞', department: '大臣', identity: '淳安知县', x: 13, y: 1, id: 12, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156014', name: '何茂才', department: '大臣', identity: '浙江布政使兼按察使', x: 14, y: 1, id: 13, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156015', name: '郑泌昌', department: '大臣', identity: '浙江巡抚', x: 15, y: 1, id: 14, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156016', name: '王用汲', department: '大臣', identity: '建德知县', x: 16, y: 1, id: 15, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156017', name: '谭纶', department: '大臣', identity: '浙直总督府参军', x: 17, y: 1, id: 16, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156018', name: '朱七', department: '大臣', identity: '北镇抚司', x: 1, y: 2, id: 17, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156019', name: '罗龙文', department: '大臣', identity: '通政使司通政使', x: 2, y: 2, id: 18, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156020', name: '马宁远', department: '大臣', identity: '杭州知府', x: 3, y: 2, id: 19, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156021', name: '田有禄 ', department: '大臣', identity: '淳安县丞', x: 4, y: 2, id: 20, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156022', name: '周云逸', department: '大臣', identity: '钦天监监正', x: 5, y: 2, id: 21, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156023', name: '蒋千户', department: '大臣', identity: '浙江按察使司', x: 6, y: 2, id: 22, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156024', name: '徐千户', department: '大臣', identity: '浙江按察使司', x: 7, y: 2, id: 23, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156025', name: '王牢头 ', department: '大臣', identity: '牢头', x: 8, y: 2, id: 24, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156026', name: '赵班头', department: '大臣', identity: '班头', x: 9, y: 2, id: 25, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156027', name: '吕芳', department: '太监', identity: '掌印太监', x: 10, y: 2, id: 26, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156028', name: '杨金水', department: '太监', identity: '织造局', x: 11, y: 2, id: 27, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156029', name: '陈洪', department: '太监', identity: '首席秉笔太监', x: 12, y: 2, id: 28, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156030', name: '黄锦', department: '太监', identity: '秉笔太监', x: 13, y: 2, id: 29, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156031', name: '李玄', department: '太监', identity: '新安江河道监管', x: 14, y: 2, id: 30, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156032', name: '冯保', department: '太监', identity: '世子大伴', x: 15, y: 2, id: 31, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156033', name: '李时珍', department: '江湖', identity: '名医', x: 16, y: 2, id: 32, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156034', name: '沈一石 ', department: '江湖', identity: '商人', x: 17, y: 2, id: 33, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156035', name: '井上十四郎', department: '江湖', identity: '倭寇', x: 1, y: 3, id: 34, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }, { uid: 'U100156036', name: '芸娘', department: '江湖', x: 2, y: 3, id: 35, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] }] @@ -65,17 +64,29 @@ export const defaultMusicList = [ export const defaultPrizeList = [ { id: '001', - name: '一等奖', + name: '三等奖', sort: 1, isAll: false, - count: 1, + 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: [{ + id: '0', + count: 6, + isUsedCount: 0, + }, { + id: '1', + count: 6, + isUsedCount: 0, + }] + }, + desc: '三等奖', isShow: true, isUsed: false, frequency: 1, @@ -92,6 +103,10 @@ export const defaultPrizeList = [ name: '二等奖', url: 'https://24years.top/resource/image/image2.png' }, + separateCount: { + enable: false, + countList: [] + }, desc: '二等奖', isShow: true, isUsed: false, @@ -99,17 +114,21 @@ export const defaultPrizeList = [ }, { id: '003', - name: '三等奖', + name: '一等奖', sort: 3, isAll: false, count: 1, isUsedCount: 0, picture: { - id: '2', - name: '三等奖', - url: 'https://24years.top/resource/image/image3.png' + id: '0', + name: '一等奖', + url: 'https://24years.top/resource/image/image1.png' }, - desc: '三等奖', + separateCount: { + enable: false, + countList: [] + }, + desc: '一等奖', isShow: true, isUsed: false, frequency: 1, @@ -126,6 +145,10 @@ export const defaultPrizeList = [ name: '超级奖', url: 'https://24years.top/resource/image/image4.png' }, + separateCount: { + enable: false, + countList: [] + }, desc: '超级大奖', isShow: true, isUsed: false, @@ -143,6 +166,10 @@ export const defaultPrizeList = [ name: '特别奖', url: 'https://24years.top/resource/image/image5.png' }, + separateCount: { + enable: false, + countList: [] + }, desc: '特别奖', isShow: true, isUsed: false, diff --git a/src/types/storeType.ts b/src/types/storeType.ts index 90631c4..9ab7682 100644 --- a/src/types/storeType.ts +++ b/src/types/storeType.ts @@ -2,42 +2,51 @@ export interface IPersonConfig { id: number; uid: string; name: string; - department:string; - identity:string; - isWin:boolean; - x:number; - y:number + department: string; + identity: string; + isWin: boolean; + x: number; + y: number createTime: string; updateTime: string; - prizeName:string[]; - prizeId:string[]; + prizeName: string[]; + prizeId: string[]; prizeTime: string[]; } -export interface IPrizeConfig { - id: number|string; - name:string; - sort:number; - isAll:boolean; - count:number; - isUsedCount:number, - picture:{ - id:string|number, - name:string, - url:string - }; - desc:string; - isShow:boolean; - isUsed:boolean, - frequency:number; +export type Separate = { + id: string, + count: number, + isUsedCount: number, } -export interface IMusic{ - id:string, - name:string, - url:string, +export interface IPrizeConfig { + id: number | string; + name: string; + sort: number; + isAll: boolean; + count: number; + isUsedCount: number, + picture: { + id: string | number, + name: string, + url: string + }; + separateCount: { + enable: boolean, + countList: Separate[], + }; + desc: string; + isShow: boolean; + isUsed: boolean, + frequency: number; +} +export interface IMusic { + id: string, + name: string, + url: string, } -export interface IImage{ - id:string, - name:string, - url:string, +export interface IImage { + id: string, + name: string, + url: string, } diff --git a/src/views/Config/Person/PersonAll.vue b/src/views/Config/Person/PersonAll.vue index 34d862a..649bf17 100644 --- a/src/views/Config/Person/PersonAll.vue +++ b/src/views/Config/Person/PersonAll.vue @@ -159,6 +159,8 @@ onMounted(() => {
+ +

人员管理

diff --git a/src/views/Config/Person/PersonAlready.vue b/src/views/Config/Person/PersonAlready.vue index 4023866..625ab72 100644 --- a/src/views/Config/Person/PersonAlready.vue +++ b/src/views/Config/Person/PersonAlready.vue @@ -105,6 +105,8 @@ const tableColumnsDetail = [ diff --git a/src/views/Config/Readme/index.vue b/src/views/Config/Readme/index.vue index fc172c4..983613b 100644 --- a/src/views/Config/Readme/index.vue +++ b/src/views/Config/Readme/index.vue @@ -17,7 +17,7 @@ onMounted(() => { diff --git a/src/views/Demo/index.vue b/src/views/Demo/index.vue index 88c6719..38aca13 100644 --- a/src/views/Demo/index.vue +++ b/src/views/Demo/index.vue @@ -1,12 +1,24 @@ diff --git a/src/views/Home/index.vue b/src/views/Home/index.vue index 2279fa4..da10be3 100644 --- a/src/views/Home/index.vue +++ b/src/views/Home/index.vue @@ -403,21 +403,20 @@ const stopLottery = async () => { intervalTimer.value = null canOperate.value = false rollBall(0, 1) - // 抽奖池是否为全体人员 - // 每次最多抽十个 luckyCount.value = 10 - const leftover = currentPrize.value.count - currentPrize.value.isUsedCount - leftover < luckyCount.value ? luckyCount.value = leftover : luckyCount - if (personPool.value.length < leftover) { - toast.open({ - message: '抽奖人数不够', - type: 'warning', - position: 'top-right', - duration: 10000 - }) - - return; + // 自定义抽奖个数 + + let leftover = currentPrize.value.count - currentPrize.value.isUsedCount + const customCount=currentPrize.value.separateCount + if(customCount.enable&&customCount.countList.length>0){ + for(let i=0;i 0) { const randomIndex = Math.round(Math.random() * (personPool.value.length - 1)) @@ -465,6 +464,16 @@ const continueLottery = async () => { if (!canOperate.value) { return } + + const customCount=currentPrize.value.separateCount + if(customCount.enable&&customCount.countList.length>0){ + for(let i=0;i= currentPrize.value.count) { diff --git a/tailwind.config.js b/tailwind.config.js index 14c1c36..136b8fc 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -4,6 +4,9 @@ module.exports = { corePlugins: { preflight: false }, + theme: { + + }, content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], plugins: [require('@tailwindcss/typography'), require('daisyui')], daisyui: { From 00655fa3fd386a4d2afed117b3f61d6e23e483a0 Mon Sep 17 00:00:00 2001 From: "ex_zhangwenlei@exiot.cmcc" <15196725410@139.com> Date: Wed, 24 Jan 2024 22:55:08 +0800 Subject: [PATCH 2/4] feat: add reset all data in global config --- src/store/data.ts | 10 +--- src/store/globalConfig.ts | 61 ++++++++++--------- src/store/personConfig.ts | 6 +- src/store/prizeConfig.ts | 82 +++++++++++++++----------- src/views/Config/Global/FaceConfig.vue | 28 ++++++++- src/views/Config/Person/PersonAll.vue | 6 +- 6 files changed, 111 insertions(+), 82 deletions(-) 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(() => {