diff --git a/index.html b/index.html index 9efab2f..21ded49 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + diff --git a/public/人口登记表.xlsx b/public/人口登记表.xlsx new file mode 100644 index 0000000..7e88377 Binary files /dev/null and b/public/人口登记表.xlsx differ diff --git a/src/components/DaiysuiTable/index.vue b/src/components/DaiysuiTable/index.vue index 923a24a..bbf3377 100644 --- a/src/components/DaiysuiTable/index.vue +++ b/src/components/DaiysuiTable/index.vue @@ -1,4 +1,3 @@ -import { mapActions } from 'pinia'; @@ -90,10 +101,10 @@ onUnmounted(() => { -
+
- + @click="playMusic(currentMusic.item)" @click.right.prevent="nextPlay"> +
diff --git a/src/hooks/useAudio.ts b/src/hooks/useAudio.ts deleted file mode 100644 index c8a295c..0000000 --- a/src/hooks/useAudio.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {ref} from 'vue' - -export const useAudio = () => { - const audio = ref(new Audio) - const audioPaused=ref(true) - const setAudioSrc = (src: string) => { - audio.value.src = src - } - const play = () => { - audio.value.play() - setPaused(false) - } - const pause = () => { - audio.value.pause() - setPaused(true) - } - const setPaused=(paused:boolean)=>{ - audioPaused.value=paused - } - const stop = () => { - audio.value.pause() - audio.value.currentTime = 0 - } - const nextPlay = (src:string) => { - pause() - setAudioSrc(src) - play() - } - - return { - audio, - audioPaused, - play, - nextPlay, - setPaused, - pause, - stop, - setAudioSrc - } -} diff --git a/src/hooks/useElement.ts b/src/hooks/useElement.ts index ae2547e..7a3e0ab 100644 --- a/src/hooks/useElement.ts +++ b/src/hooks/useElement.ts @@ -1,7 +1,7 @@ import { rgba } from '@/utils/color' export const useElementStyle=(element:any,cardColor:string,cardSize:{width:number,height:number},textSize:number,mod:'default'|'lucky'='default')=>{ - element.style.backgroundColor = rgba(cardColor, Math.random() * 0.5 + 0.25) + element.style.backgroundColor = rgba(cardColor, mod=='default'?Math.random() * 0.5 + 0.25:0.8) element.style.border = `1px solid ${rgba(cardColor, 0.25)}` element.style.boxShadow = `0 0 12px ${rgba(cardColor, 0.5)}` element.style.width = `${cardSize.width}px`; @@ -34,8 +34,6 @@ export const useElementStyle=(element:any,cardColor:string,cardSize:{width:numbe } export const useElementPosition=(element:any,count:number,cardSize:{width:number,height:number},windowSize:{width:number,height:number},cardIndex:number)=>{ - const rowCount=Math.floor(windowSize.width/(cardSize.width+100)) - const colCount=Math.ceil(count/rowCount) const centerPosition={ x:0, y:windowSize.height/2-cardSize.height/2 diff --git a/src/icons/sort-down.svg b/src/icons/sort-down.svg new file mode 100644 index 0000000..6b35882 --- /dev/null +++ b/src/icons/sort-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/sort-up.svg b/src/icons/sort-up.svg new file mode 100644 index 0000000..713c017 --- /dev/null +++ b/src/icons/sort-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index d40c9e7..730cb73 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -2,16 +2,16 @@ import { createRouter, createWebHistory } from 'vue-router'; import Layout from '@/layout/index.vue'; import Home from '@/views/Home/index.vue'; export const configRoutes={ - path: '/config', + path: '/log-lottery/config', name: 'Config', component: () => import('@/views/Config/index.vue'), children: [ { path: '', - redirect: '/config/person', + redirect: '/log-lottery/config/person', }, { - path: '/config/person', + path: '/log-lottery/config/person', name: 'PersonConfig', component: () => import('@/views/Config/Person/PersonConfig.vue'), meta: { @@ -21,10 +21,10 @@ export const configRoutes={ children:[ { path:'', - redirect: '/config/person/all', + redirect: '/log-lottery/config/person/all', }, { - path:'/config/person/all', + path:'/log-lottery/config/person/all', name:'AllPersonConfig', component:()=>import('@/views/Config/Person/PersonAll.vue'), meta:{ @@ -33,7 +33,7 @@ export const configRoutes={ } }, { - path:'/config/person/already', + path:'/log-lottery/config/person/already', name:'AlreadyPerson', component:()=>import('@/views/Config/Person/PersonAlready.vue'), meta:{ @@ -53,7 +53,7 @@ export const configRoutes={ ] }, { - path: '/config/prize', + path: '/log-lottery/config/prize', name: 'PrizeConfig', component: () => import('@/views/Config/Prize/PrizeConfig.vue'), meta:{ @@ -62,16 +62,16 @@ export const configRoutes={ } }, { - path:'/config/global', + path:'/log-lottery/config/global', name:'GlobalConfig', - redirect: '/config/global/all', + redirect: '/log-lottery/config/global/all', meta:{ title:'全局配置', icon:'global' }, children:[ { - path:'/config/global/face', + path:'/log-lottery/config/global/face', name:'FaceConfig', component:()=>import('@/views/Config/Global/FaceConfig.vue'), meta:{ @@ -80,7 +80,7 @@ export const configRoutes={ } }, { - path:'/config/global/image', + path:'/log-lottery/config/global/image', name:'ImageConfig', component:()=>import('@/views/Config/Global/ImageConfig.vue'), meta:{ @@ -89,7 +89,7 @@ export const configRoutes={ } }, { - path:'/config/global/music', + path:'/log-lottery/config/global/music', name:'MusicConfig', component:()=>import('@/views/Config/Global/MusicConfig.vue'), meta:{ @@ -103,17 +103,17 @@ export const configRoutes={ } const routes = [ { - path: '/', + path: '/log-lottery', component: Layout, - redirect: '/home', + redirect: '/log-lottery/home', children: [ { - path: '/home', + path: '/log-lottery/home', name: 'Home', component: Home, }, { - path:'/demo', + path:'/log-lottery/demo', name:'Demo', component:()=>import('@/views/Demo/index.vue') }, diff --git a/src/store/data.ts b/src/store/data.ts index b13c6b5..d489191 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -1,175 +1,177 @@ import { IPrizeConfig } from '@/types/prizeConfig'; -export const defaultMusicList=[ +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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }, { 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: '' }] +export const defaultMusicList = [ { - id:'Geoff Knorr - China (The Industrial Era).ogg'+new Date().getTime().toString(), - name:'Geoff Knorr - China (The Industrial Era).ogg', - url:'https://24years.top/resource/audio/Geoff Knorr - China (The Industrial Era).ogg' + id: 'Geoff Knorr - China (The Industrial Era).ogg' + new Date().getTime().toString(), + name: 'Geoff Knorr - China (The Industrial Era).ogg', + url: 'https://24years.top/resource/audio/Geoff Knorr - China (The Industrial Era).ogg' }, { - id:'Geoff Knorr&Phill Boucher - China (The Atomic Era).ogg'+new Date().getTime().toString(), - name:'Geoff Knorr&Phill Boucher - China (The Atomic Era).ogg', - url:'https://24years.top/resource/audio/Geoff Knorr&Phill Boucher - China (The Atomic Era).ogg' + id: 'Geoff Knorr&Phill Boucher - China (The Atomic Era).ogg' + new Date().getTime().toString(), + name: 'Geoff Knorr&Phill Boucher - China (The Atomic Era).ogg', + url: 'https://24years.top/resource/audio/Geoff Knorr&Phill Boucher - China (The Atomic Era).ogg' }, { - id:'Radetzky March.mp3'+new Date().getTime().toString(), - name:'Radetzky March.mp3', - url:'https://24years.top/resource/audio/Radetzky March.mp3' + id: 'Radetzky March.mp3' + new Date().getTime().toString(), + name: 'Radetzky March.mp3', + url: 'https://24years.top/resource/audio/Radetzky March.mp3' }, { - id:'Shanghai.mp3'+new Date().getTime().toString(), - name:'Shanghai.mp3', - url:'https://24years.top/resource/audio/Shanghai.mp3' + id: 'Shanghai.mp3' + new Date().getTime().toString(), + name: 'Shanghai.mp3', + url: 'https://24years.top/resource/audio/Shanghai.mp3' }, { - id:'Waltz No.2.mp3'+new Date().getTime().toString(), - name:'Waltz No.2.mp3', - url:'https://24years.top/resource/audio/Waltz No.2.mp3' + id: 'Waltz No.2.mp3' + new Date().getTime().toString(), + name: 'Waltz No.2.mp3', + url: 'https://24years.top/resource/audio/Waltz No.2.mp3' }, { - id:'WildChinaTheme.mp3'+new Date().getTime().toString(), - name:'WildChinaTheme.mp3', - url:'https://24years.top/resource/audio/WildChinaTheme.mp3' + id: 'WildChinaTheme.mp3' + new Date().getTime().toString(), + name: 'WildChinaTheme.mp3', + url: 'https://24years.top/resource/audio/WildChinaTheme.mp3' }, { - id:'边程&房东的猫 - 美好事物-再遇少年.ogg'+new Date().getTime().toString(), - name:'边程&房东的猫 - 美好事物-再遇少年.ogg', - url:'https://24years.top/resource/audio/边程&房东的猫 - 美好事物-再遇少年.ogg' + id: '边程&房东的猫 - 美好事物-再遇少年.ogg' + new Date().getTime().toString(), + name: '边程&房东的猫 - 美好事物-再遇少年.ogg', + url: 'https://24years.top/resource/audio/边程&房东的猫 - 美好事物-再遇少年.ogg' }, { - id:'大乔小乔 - 相见难别亦难.ogg'+new Date().getTime().toString(), - name:'大乔小乔 - 相见难别亦难.ogg', - url:'https://24years.top/resource/audio/大乔小乔 - 相见难别亦难.ogg' + id: '大乔小乔 - 相见难别亦难.ogg' + new Date().getTime().toString(), + name: '大乔小乔 - 相见难别亦难.ogg', + url: 'https://24years.top/resource/audio/大乔小乔 - 相见难别亦难.ogg' }, { - id:'你要跳舞吗-新裤子.mp3'+new Date().getTime().toString(), - name:'你要跳舞吗-新裤子.mp3', - url:'https://24years.top/resource/audio/你要跳舞吗-新裤子.mp3' + id: '你要跳舞吗-新裤子.mp3' + new Date().getTime().toString(), + name: '你要跳舞吗-新裤子.mp3', + url: 'https://24years.top/resource/audio/你要跳舞吗-新裤子.mp3' }, { - id:'生命-声音玩具.mp3'+new Date().getTime().toString(), - name:'生命-声音玩具.mp3', - url:'https://24years.top/resource/audio/生命-声音玩具.mp3' + id: '生命-声音玩具.mp3' + new Date().getTime().toString(), + name: '生命-声音玩具.mp3', + url: 'https://24years.top/resource/audio/生命-声音玩具.mp3' }, { - id:'与非门 - Happy New Year.ogg'+new Date().getTime().toString(), - name:'与非门 - Happy New Year.ogg', - url:'https://24years.top/resource/audio/与非门 - Happy New Year.ogg' + id: '与非门 - Happy New Year.ogg' + new Date().getTime().toString(), + name: '与非门 - Happy New Year.ogg', + url: 'https://24years.top/resource/audio/与非门 - Happy New Year.ogg' }, ] -export const defaultPrizeList=[ +export const defaultPrizeList = [ { - id:'001', - name:'一等奖', - sort:1, - isAll:true, - count:1, - isUsedCount:0, - picture:{ - id:'0', - name:'一等奖', - url:'https://24years.top/resource/image/image1.png' - }, - desc:'一等奖', - isShow:true, - isUsed:false, - frequency:1, - }, - { - id:'002', - name:'二等奖', - sort:2, - isAll:true, - count:1, - isUsedCount:0, + id: '001', + name: '一等奖', + sort: 1, + isAll: true, + count: 1, + isUsedCount: 0, picture: { - id:'1', - name:'二等奖', - url:'https://24years.top/resource/image/image2.png' + id: '0', + name: '一等奖', + url: 'https://24years.top/resource/image/image1.png' }, - desc:'二等奖', - isShow:true, - isUsed:false, - frequency:1, + desc: '一等奖', + isShow: true, + isUsed: false, + frequency: 1, }, { - id:'003', - name:'三等奖', - sort:3, - isAll:true, - count:1, - isUsedCount:0, + id: '002', + name: '二等奖', + sort: 2, + isAll: true, + count: 1, + isUsedCount: 0, picture: { - id:'2', - name:'三等奖', - url:'https://24years.top/resource/image/image3.png' + id: '1', + name: '二等奖', + url: 'https://24years.top/resource/image/image2.png' }, - desc:'三等奖', - isShow:true, - isUsed:false, - frequency:1, + desc: '二等奖', + isShow: true, + isUsed: false, + frequency: 1, }, { - id:'004', - name:'超级大奖', - sort:4, - isAll:true, - count:1, - isUsedCount:0, + id: '003', + name: '三等奖', + sort: 3, + isAll: true, + count: 1, + isUsedCount: 0, picture: { - id:'3', - name:'超级奖', - url:'https://24years.top/resource/image/image4.png' + id: '2', + name: '三等奖', + url: 'https://24years.top/resource/image/image3.png' }, - desc:'超级大奖', - isShow:true, - isUsed:false, - frequency:1, + desc: '三等奖', + isShow: true, + isUsed: false, + frequency: 1, }, { - id:'005', - name:'特别奖', - sort:5, - isAll:true, - count:1, - isUsedCount:0, - picture:{ - id:'4', - name:'特别奖', - url:'https://24years.top/resource/image/image5.png' + id: '004', + name: '超级大奖', + sort: 4, + isAll: true, + count: 1, + isUsedCount: 0, + picture: { + id: '3', + name: '超级奖', + url: 'https://24years.top/resource/image/image4.png' }, - desc:'特别奖', - isShow:true, - isUsed:false, - frequency:1, + desc: '超级大奖', + isShow: true, + isUsed: false, + frequency: 1, + }, + { + id: '005', + name: '特别奖', + sort: 5, + isAll: true, + count: 1, + isUsedCount: 0, + picture: { + id: '4', + name: '特别奖', + url: 'https://24years.top/resource/image/image5.png' + }, + desc: '特别奖', + isShow: true, + isUsed: false, + frequency: 1, } ] -export const defaultImageList=[ +export const defaultImageList = [ { - id:'0', - name:'一等奖', - url:'https://24years.top/resource/image/image1.png' + id: '0', + name: '一等奖', + url: 'https://24years.top/resource/image/image1.png' }, { - id:'1', - name:'二等奖', - url:'https://24years.top/resource/image/image2.png' + id: '1', + name: '二等奖', + url: 'https://24years.top/resource/image/image2.png' }, { - id:'2', - name:'三等奖', - url:'https://24years.top/resource/image/image3.png' + id: '2', + name: '三等奖', + url: 'https://24years.top/resource/image/image3.png' }, { - id:'3', - name:'超级奖', - url:'https://24years.top/resource/image/image4.png' + id: '3', + name: '超级奖', + url: 'https://24years.top/resource/image/image4.png' }, { - id:'4', - name:'特别奖', - url:'https://24years.top/resource/image/image5.png' + id: '4', + name: '特别奖', + url: 'https://24years.top/resource/image/image5.png' } ] diff --git a/src/store/globalConfig.ts b/src/store/globalConfig.ts index 4f0d3e2..6cc0c86 100644 --- a/src/store/globalConfig.ts +++ b/src/store/globalConfig.ts @@ -20,7 +20,11 @@ export const useGlobalConfig = defineStore('global', { }, musicList: defaultMusicList, imageList:defaultImageList, - } + }, + currentMusic: { + item:defaultMusicList[0], + paused:true, + }, }; }, getters: { @@ -67,6 +71,10 @@ export const useGlobalConfig = defineStore('global', { getMusicList(state) { return state.globalConfig.musicList; }, + // 获取当前音乐 + getCurrentMusic(state) { + return state.currentMusic; + }, // 获取图片列表 getImageList(state) { return state.globalConfig.imageList; @@ -132,6 +140,13 @@ export const useGlobalConfig = defineStore('global', { } } }, + // 设置当前播放音乐 + setCurrentMusic(musicItem: any,paused:boolean=true) { + this.currentMusic={ + item:musicItem, + paused:paused, + } + }, // 重置音乐列表 resetMusicList() { this.globalConfig.musicList = defaultMusicList; @@ -189,6 +204,10 @@ export const useGlobalConfig = defineStore('global', { }, musicList: defaultMusicList, imageList:defaultImageList, + }, + this.currentMusic= { + item:defaultMusicList[0], + paused:true, } } }, @@ -199,6 +218,7 @@ export const useGlobalConfig = defineStore('global', { // 如果要存储在localStorage中 storage: localStorage, key: 'globalConfig', + paths: ['globalConfig'], }, ], }, diff --git a/src/store/personConfig.ts b/src/store/personConfig.ts index 57c34c9..ee52a7e 100644 --- a/src/store/personConfig.ts +++ b/src/store/personConfig.ts @@ -1,12 +1,14 @@ import { defineStore } from 'pinia'; import { IPersonConfig } from '@/types/personConfig'; import { IPrizeConfig } from '@/types/prizeConfig'; +import {defaultPersonList} from './data' export const usePersonConfig = defineStore('person', { state() { return { personConfig: { - alreadyPersonList: [] as IPersonConfig[], - notPersonList: [] as IPersonConfig[], + allPersonList: [] as IPersonConfig[], + // alreadyPersonList: [] as IPersonConfig[], + // notPersonList: [] as IPersonConfig[], tableRowCount: 12, showField: [] as any[] } @@ -17,17 +19,21 @@ export const usePersonConfig = defineStore('person', { getPersonConfig(state) { return state.personConfig; }, + // 获取全部人员名单 + getAllPersonList(state) { + return state.personConfig.allPersonList; + }, // 获取已中奖人员名单 getAlreadyPersonList(state) { - return state.personConfig.alreadyPersonList; + return state.personConfig.allPersonList.filter((item: IPersonConfig) => { + return item.isWin === true; + }); }, // 获取未中奖人员名单 getNotPersonList(state) { - return state.personConfig.notPersonList; - }, - // 获取所有人员名单 - getAllPersonList(state) { - return state.personConfig.alreadyPersonList.concat(state.personConfig.notPersonList); + return state.personConfig.allPersonList.filter((item: IPersonConfig) => { + return item.isWin === false; + }); }, // 获取table列数 getTableRowCount(state) { @@ -45,7 +51,7 @@ export const usePersonConfig = defineStore('person', { return } personList.forEach((item: IPersonConfig) => { - this.personConfig.notPersonList.push(item); + this.personConfig.allPersonList.push(item); }); }, // 添加已中奖人员 @@ -54,57 +60,58 @@ export const usePersonConfig = defineStore('person', { return } personList.forEach((person: IPersonConfig) => { - this.personConfig.notPersonList = this.personConfig.notPersonList.filter((item: IPersonConfig) => - item.id !== person.id) - if (prize != null) { - person.isWin = true - person.prizeName = prize.name - person.prizeTime = new Date().toString() - } - this.personConfig.alreadyPersonList.push(person); + this.personConfig.allPersonList.map((item: IPersonConfig) => { + if (item.id === person.id&&prize!=null) { + item.isWin = true + item.prizeName = prize.name + item.prizeTime = new Date().toString() + } + }); }); }, // 从已中奖移动到未中奖 moveAlreadyToNot(person: IPersonConfig) { if (person.id != undefined || person.id != null) { - this.personConfig.alreadyPersonList = this.personConfig.alreadyPersonList.filter((item: IPersonConfig) => item.id !== person.id); - person.isWin = false - person.prizeTime = '' - person.prizeName = '' - this.personConfig.notPersonList.push(person); + for(let i=0;i item.id !== person.id); - this.personConfig.notPersonList = this.personConfig.notPersonList.filter((item: IPersonConfig) => item.id !== person.id); + this.personConfig.allPersonList = this.personConfig.allPersonList.filter((item: IPersonConfig) => item.id !== person.id); } }, // 删除所有人员 deleteAllPerson() { - this.personConfig.alreadyPersonList = []; - this.personConfig.notPersonList = []; + this.personConfig.allPersonList = []; }, // 重置所有人员 resetPerson() { - this.personConfig.alreadyPersonList = []; - this.personConfig.notPersonList = []; + this.personConfig.allPersonList = []; }, // 重置已中奖人员 resetAlreadyPerson() { // 把已中奖人员合并到未中奖人员,要验证是否已存在 - if (this.personConfig.alreadyPersonList.length > 0) { - this.personConfig.notPersonList = this.personConfig.notPersonList.concat(this.personConfig.alreadyPersonList); - this.personConfig.alreadyPersonList = []; - } + this.personConfig.allPersonList.forEach((item: IPersonConfig) => { + item.isWin = false; + }); + }, + setDefaultPersonList() { + this.personConfig.allPersonList = defaultPersonList; }, // 重置所有配置 reset() { this.personConfig = { - alreadyPersonList: [] as IPersonConfig[], - notPersonList: [] as IPersonConfig[], + allPersonList: [] as IPersonConfig[], tableRowCount: 12, showField: [] as string[] } diff --git a/src/store/prizeConfig.ts b/src/store/prizeConfig.ts index edf20a7..9dada6b 100644 --- a/src/store/prizeConfig.ts +++ b/src/store/prizeConfig.ts @@ -33,7 +33,7 @@ export const usePrizeConfig = defineStore('prize', { }, // 获取奖品列表 getPrizeConfig(state) { - return state.prizeConfig.prizeList; +return state.prizeConfig.prizeList; }, // 根据id获取配置 getPrizeConfigById(state) { diff --git a/src/utils/index.ts b/src/utils/index.ts index b0a762b..9f87b22 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,5 +1,5 @@ // 筛选人员数据 -export const filterData = (tableData: any[],localRowCount: number) => { +export const filterData = (tableData: any[],localRowCount: number,startIndex=0) => { const dataLength = tableData.length let j = 0; for (let i = 0; i < dataLength; i++) { diff --git a/src/views/Config/Global/MusicConfig.vue b/src/views/Config/Global/MusicConfig.vue index 5134f98..c0dad67 100644 --- a/src/views/Config/Global/MusicConfig.vue +++ b/src/views/Config/Global/MusicConfig.vue @@ -13,29 +13,12 @@ const audioDbStore = localforage.createInstance({ const globalConfig = useStore().globalConfig const { getMusicList: localMusicList } = storeToRefs(globalConfig); -const audio = ref(new Audio()) const limitType = ref('audio/*') const localMusicListValue = ref(localMusicList) const play = async (item: any) => { - let audioUrl = '' - if (!item.url) { - return - } - if (item.url == 'Storage') { - audioUrl = await audioDbStore.getItem(item.name) as string - } - else { - audioUrl = item.url - } - audio.value.pause() - audio.value.src = audioUrl + globalConfig.setCurrentMusic(item,false) +} - audio.value.currentTime = 0 - audio.value.play() -} -const pausePlay = () => { - audio.value.pause() -} const deleteMusic = (item: any) => { globalConfig.removeMusic(item.id) audioDbStore.removeItem(item.name) @@ -96,7 +79,6 @@ onMounted(() => { :accept="limitType" /> 上传音乐 -
diff --git a/src/views/Config/Person/PersonAll.vue b/src/views/Config/Person/PersonAll.vue index 4363f5b..25c8a3a 100644 --- a/src/views/Config/Person/PersonAll.vue +++ b/src/views/Config/Person/PersonAll.vue @@ -1,17 +1,17 @@ @@ -125,6 +124,13 @@ watch(() => prizeList, () => {
+