feat: 粒子背景+动起来了

This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-01-07 00:05:55 +08:00
parent ae2f21daaf
commit 18c5429b58
25 changed files with 1073 additions and 2798 deletions

View File

@@ -1,3 +1,4 @@
import { IPrizeConfig } from '@/types/prizeConfig';
export const defaultMusicList=[
{
id:'Geoff Knorr - China (The Industrial Era).ogg'+new Date().getTime().toString(),
@@ -56,3 +57,109 @@ export const defaultMusicList=[
},
]
export const defaultPrizeList=<IPrizeConfig[]>[
{
id:'001',
name:'一等奖',
sort:1,
isAll:true,
count:1,
picture:{
id:'0',
name:'一等奖',
url:'https://24years.top/resource/image/image1.png'
},
desc:'一等奖',
isShow:true,
frequency:1,
},
{
id:'002',
name:'二等奖',
sort:2,
isAll:true,
count:1,
picture: {
id:'1',
name:'二等奖',
url:'https://24years.top/resource/image/image2.png'
},
desc:'二等奖',
isShow:true,
frequency:1,
},
{
id:'003',
name:'三等奖',
sort:3,
isAll:true,
count:1,
picture: {
id:'2',
name:'三等奖',
url:'https://24years.top/resource/image/image3.png'
},
desc:'三等奖',
isShow:true,
frequency:1,
},
{
id:'004',
name:'超级大奖',
sort:4,
isAll:true,
count:1,
picture: {
id:'3',
name:'超级奖',
url:'https://24years.top/resource/image/image4.png'
},
desc:'超级大奖',
isShow:true,
frequency:1,
},
{
id:'005',
name:'特别奖',
sort:5,
isAll:true,
count:1,
picture:{
id:'4',
name:'特别奖',
url:'https://24years.top/resource/image/image5.png'
},
desc:'特别奖',
isShow:true,
frequency:1,
}
]
export const defaultImageList=[
{
id:'0',
name:'一等奖',
url:'https://24years.top/resource/image/image1.png'
},
{
id:'1',
name:'二等奖',
url:'https://24years.top/resource/image/image2.png'
},
{
id:'2',
name:'三等奖',
url:'https://24years.top/resource/image/image3.png'
},
{
id:'3',
name:'超级奖',
url:'https://24years.top/resource/image/image4.png'
},
{
id:'4',
name:'特别奖',
url:'https://24years.top/resource/image/image5.png'
}
]

View File

@@ -1,5 +1,5 @@
import { defineStore } from 'pinia';
import { defaultMusicList } from './data'
import { defaultMusicList,defaultImageList } from './data'
// import { IPrizeConfig } from '@/types/prizeConfig';
export const useGlobalConfig = defineStore('global', {
state() {
@@ -16,6 +16,7 @@ export const useGlobalConfig = defineStore('global', {
textSize: 30
},
musicList: defaultMusicList,
imageList:defaultImageList,
}
};
},
@@ -54,6 +55,10 @@ export const useGlobalConfig = defineStore('global', {
// 获取音乐列表
getMusicList(state) {
return state.globalConfig.musicList;
},
// 获取图片列表
getImageList(state) {
return state.globalConfig.imageList;
}
},
@@ -112,6 +117,32 @@ export const useGlobalConfig = defineStore('global', {
clearMusicList() {
this.globalConfig.musicList = [];
},
// 添加图片
addImage(image:any){
for (let i = 0; i < this.globalConfig.imageList.length; i++) {
if (this.globalConfig.imageList[i].name === image.name) {
return;
}
}
this.globalConfig.imageList.push(image);
},
// 删除图片
removeImage(imageId: string) {
for (let i = 0; i < this.globalConfig.imageList.length; i++) {
if (this.globalConfig.imageList[i].id === imageId) {
this.globalConfig.imageList.splice(i, 1);
break;
}
}
},
// 重置图片列表
resetImageList() {
this.globalConfig.imageList = defaultImageList;
},
// 清空图片列表
clearImageList() {
this.globalConfig.imageList = [];
},
// 重置所有配置
reset() {
this.globalConfig = {
@@ -126,7 +157,8 @@ export const useGlobalConfig = defineStore('global', {
textSize: 30
},
musicList: defaultMusicList
musicList: defaultMusicList,
imageList:defaultImageList,
}
}
},

View File

@@ -24,6 +24,10 @@ export const usePersonConfig = defineStore('person', {
getNotPersonList(state) {
return state.personConfig.notPersonList;
},
// 获取所有人员名单
getAllPersonList(state) {
return state.personConfig.alreadyPersonList.concat(state.personConfig.notPersonList);
},
// 获取table列数
getTableRowCount(state) {
return state.personConfig.tableRowCount;
@@ -53,6 +57,14 @@ export const usePersonConfig = defineStore('person', {
this.personConfig.notPersonList = this.personConfig.notPersonList.filter((item: IPersonConfig) => item.id!== item.id);
});
},
// 删除指定人员
deletePerson(person:IPersonConfig){
console.log('delperson:',person);
if(person.id!=undefined||person.id!=null){
this.personConfig.alreadyPersonList = this.personConfig.alreadyPersonList.filter((item: IPersonConfig) => item.id!== person.id);
this.personConfig.notPersonList = this.personConfig.notPersonList.filter((item: IPersonConfig) => item.id!== person.id);
}
},
// 删除所有人员
deleteAllPerson() {
this.personConfig.alreadyPersonList = [];

View File

@@ -1,15 +1,20 @@
import { defineStore } from 'pinia';
import { IPrizeConfig } from '@/types/prizeConfig';
import {defaultPrizeList} from './data';
export const usePrizeConfig = defineStore('prize', {
state() {
return {
prizeConfig:{
prizeList:[] as IPrizeConfig[],
prizeList:defaultPrizeList,
}
};
},
getters: {
// 获取全部配置
getPrizeConfigAll(state) {
return state.prizeConfig;
},
// 获取奖品列表
getPrizeConfig(state) {
return state.prizeConfig.prizeList;
},
@@ -39,10 +44,14 @@ export const usePrizeConfig = defineStore('prize', {
const index = this.prizeConfig.prizeList.findIndex(item => item.id === prizeConfigItem.id);
this.prizeConfig.prizeList[index] = prizeConfigItem;
},
// 删除全部奖项
deleteAllPrizeConfig() {
this.prizeConfig.prizeList = [];
},
// 重置所有配置
reset() {
resetDefault() {
this.prizeConfig = {
prizeList:[] as IPrizeConfig[],
prizeList:defaultPrizeList,
}
},
},