feat(for): for

This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-01-09 01:03:42 +08:00
parent bea54865ea
commit f34e850ff0
26 changed files with 500 additions and 404 deletions

View File

@@ -65,6 +65,7 @@ export const defaultPrizeList=<IPrizeConfig[]>[
sort:1,
isAll:true,
count:1,
isUsedCount:0,
picture:{
id:'0',
name:'一等奖',
@@ -81,6 +82,7 @@ export const defaultPrizeList=<IPrizeConfig[]>[
sort:2,
isAll:true,
count:1,
isUsedCount:0,
picture: {
id:'1',
name:'二等奖',
@@ -97,6 +99,7 @@ export const defaultPrizeList=<IPrizeConfig[]>[
sort:3,
isAll:true,
count:1,
isUsedCount:0,
picture: {
id:'2',
name:'三等奖',
@@ -113,6 +116,7 @@ export const defaultPrizeList=<IPrizeConfig[]>[
sort:4,
isAll:true,
count:1,
isUsedCount:0,
picture: {
id:'3',
name:'超级奖',
@@ -129,6 +133,7 @@ export const defaultPrizeList=<IPrizeConfig[]>[
sort:5,
isAll:true,
count:1,
isUsedCount:0,
picture:{
id:'4',
name:'特别奖',

View File

@@ -7,6 +7,7 @@ export const useGlobalConfig = defineStore('global', {
globalConfig: {
rowCount: 12,
isSHowPrizeList:true,
topTitle:'大明内阁六部御前奏对',
theme: {
name: 'dark',
detail: { primary: '#0f5fd3' },
@@ -27,6 +28,10 @@ export const useGlobalConfig = defineStore('global', {
getGlobalConfig(state) {
return state.globalConfig;
},
// 获取标题
getTopTitle(state) {
return state.globalConfig.topTitle;
},
// 获取行数
getRowCount(state) {
return state.globalConfig.rowCount;
@@ -77,6 +82,10 @@ export const useGlobalConfig = defineStore('global', {
setRowCount(rowCount: number) {
this.globalConfig.rowCount = rowCount;
},
// 设置标题
setTopTitle(topTitle: string) {
this.globalConfig.topTitle = topTitle;
},
// 设置主题
setTheme(theme: any) {
const { name, detail } = theme;
@@ -165,6 +174,7 @@ export const useGlobalConfig = defineStore('global', {
reset() {
this.globalConfig = {
rowCount: 12,
topTitle:'大明内阁六部御前奏对',
isSHowPrizeList:true,
theme: {
name: 'dark',

View File

@@ -1,5 +1,6 @@
import { defineStore } from 'pinia';
import { IPersonConfig } from '@/types/personConfig';
import { IPrizeConfig } from '@/types/prizeConfig';
export const usePersonConfig = defineStore('person', {
state() {
return {
@@ -48,16 +49,31 @@ export const usePersonConfig = defineStore('person', {
});
},
// 添加已中奖人员
addAlreadyPersonList(personList: IPersonConfig[]) {
addAlreadyPersonList(personList: IPersonConfig[], prize: IPrizeConfig | null) {
if (personList.length <= 0) {
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);
});
},
// 从已中奖移动到未中奖
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);
}
},
// 删除指定人员
deletePerson(person: IPersonConfig) {
if (person.id != undefined || person.id != null) {
@@ -70,14 +86,7 @@ export const usePersonConfig = defineStore('person', {
this.personConfig.alreadyPersonList = [];
this.personConfig.notPersonList = [];
},
// 设置table列数
setTableRowCount(tableRowCount: number) {
this.personConfig.tableRowCount = tableRowCount;
},
// 设置要展示那些字段
setShowFields(showField: any[]) {
this.personConfig.showField = showField;
},
// 重置所有人员
resetPerson() {
this.personConfig.alreadyPersonList = [];

View File

@@ -12,6 +12,7 @@ export const usePrizeConfig = defineStore('prize', {
sort: 1,
isAll: true,
count: 1,
isUsedCount:0,
picture: {
id: '0',
name: '一等奖',
@@ -63,6 +64,10 @@ export const usePrizeConfig = defineStore('prize', {
updatePrizeConfig(prizeConfigItem: IPrizeConfig) {
const index = this.prizeConfig.prizeList.findIndex(item => item.id === prizeConfigItem.id);
this.prizeConfig.prizeList[index] = prizeConfigItem;
if(prizeConfigItem.isUsed&&index+1<this.prizeConfig.prizeList.length){
// 设置下一个为currentPrize
this.setCurrentPrize(this.prizeConfig.prizeList[index+1]);
}
},
// 删除全部奖项
deleteAllPrizeConfig() {
@@ -82,6 +87,7 @@ export const usePrizeConfig = defineStore('prize', {
sort: 1,
isAll: true,
count: 1,
isUsedCount:0,
picture: {
id: '0',
name: '一等奖',
@@ -101,7 +107,7 @@ export const usePrizeConfig = defineStore('prize', {
{
// 如果要存储在localStorage中
storage: localStorage,
key: 'personConfig',
key: 'prizeConfig',
},
],
},