feat: add reset all data in global config
This commit is contained in:
@@ -76,15 +76,7 @@ export const defaultPrizeList = <IPrizeConfig[]>[
|
|||||||
},
|
},
|
||||||
separateCount: {
|
separateCount: {
|
||||||
enable: true,
|
enable: true,
|
||||||
countList: [{
|
countList: []
|
||||||
id: '0',
|
|
||||||
count: 6,
|
|
||||||
isUsedCount: 0,
|
|
||||||
}, {
|
|
||||||
id: '1',
|
|
||||||
count: 6,
|
|
||||||
isUsedCount: 0,
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
desc: '三等奖',
|
desc: '三等奖',
|
||||||
isShow: true,
|
isShow: true,
|
||||||
|
|||||||
@@ -211,27 +211,26 @@ export const useGlobalConfig = defineStore('global', {
|
|||||||
// 重置所有配置
|
// 重置所有配置
|
||||||
reset() {
|
reset() {
|
||||||
this.globalConfig = {
|
this.globalConfig = {
|
||||||
rowCount: 12,
|
rowCount: 17,
|
||||||
topTitle:'大明内阁六部御前奏对',
|
|
||||||
isSHowPrizeList: true,
|
isSHowPrizeList: true,
|
||||||
|
topTitle: '大明内阁六部御前奏对',
|
||||||
theme: {
|
theme: {
|
||||||
name: 'dark',
|
name: 'dark',
|
||||||
detail: { primary: '#0f5fd3' },
|
detail: { primary: '#0f5fd3' },
|
||||||
cardColor: 'rgba(0, 255, 255)',
|
cardColor: '#ff79c6',
|
||||||
luckyCardColor:'#ECB1AC',
|
cardWidth: 140,
|
||||||
cardWidth: 200,
|
cardHeight: 200,
|
||||||
cardHeight: 140,
|
|
||||||
textColor: '#ffffff',
|
textColor: '#ffffff',
|
||||||
|
luckyCardColor: '#ECB1AC',
|
||||||
textSize: 30,
|
textSize: 30,
|
||||||
patternColor: '#1b66c9',
|
patternColor: '#1b66c9',
|
||||||
patternList:defaultPatternList,
|
patternList: defaultPatternList as number[],
|
||||||
|
|
||||||
},
|
},
|
||||||
musicList: defaultMusicList as IMusic[],
|
musicList: defaultMusicList as IMusic[],
|
||||||
imageList: defaultImageList as IImage[],
|
imageList: defaultImageList as IImage[],
|
||||||
},
|
},
|
||||||
this.currentMusic = {
|
this.currentMusic = {
|
||||||
item:defaultMusicList[0] as IMusic,
|
item: defaultMusicList[0],
|
||||||
paused: true,
|
paused: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,21 @@ export const usePrizeConfig = defineStore('prize', {
|
|||||||
prizeList: defaultPrizeList,
|
prizeList: defaultPrizeList,
|
||||||
currentPrize: {
|
currentPrize: {
|
||||||
id: '001',
|
id: '001',
|
||||||
name: '一等奖',
|
name: '三等奖',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
isAll: true,
|
isAll: false,
|
||||||
count: 1,
|
count: 12,
|
||||||
isUsedCount: 0,
|
isUsedCount: 0,
|
||||||
picture: {
|
picture: {
|
||||||
id: '0',
|
id: '2',
|
||||||
name: '一等奖',
|
name: '三等奖',
|
||||||
url: 'https://24years.top/resource/image/image1.png'
|
url: 'https://24years.top/resource/image/image3.png'
|
||||||
},
|
},
|
||||||
desc: '一等奖',
|
separateCount: {
|
||||||
|
enable: true,
|
||||||
|
countList: []
|
||||||
|
},
|
||||||
|
desc: '三等奖',
|
||||||
isShow: true,
|
isShow: true,
|
||||||
isUsed: false,
|
isUsed: false,
|
||||||
frequency: 1,
|
frequency: 1,
|
||||||
@@ -35,6 +39,10 @@ export const usePrizeConfig = defineStore('prize', {
|
|||||||
name: '',
|
name: '',
|
||||||
url: ''
|
url: ''
|
||||||
},
|
},
|
||||||
|
separateCount: {
|
||||||
|
enable: true,
|
||||||
|
countList: []
|
||||||
|
},
|
||||||
desc: '',
|
desc: '',
|
||||||
isShow: false,
|
isShow: false,
|
||||||
isUsed: false,
|
isUsed: false,
|
||||||
@@ -148,17 +156,21 @@ return
|
|||||||
prizeList: defaultPrizeList,
|
prizeList: defaultPrizeList,
|
||||||
currentPrize: {
|
currentPrize: {
|
||||||
id: '001',
|
id: '001',
|
||||||
name: '一等奖',
|
name: '三等奖',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
isAll: true,
|
isAll: false,
|
||||||
count: 1,
|
count: 12,
|
||||||
isUsedCount: 0,
|
isUsedCount: 0,
|
||||||
picture: {
|
picture: {
|
||||||
id: '0',
|
id: '2',
|
||||||
name: '一等奖',
|
name: '三等奖',
|
||||||
url: 'https://24years.top/resource/image/image1.png'
|
url: 'https://24years.top/resource/image/image3.png'
|
||||||
},
|
},
|
||||||
desc: '一等奖',
|
separateCount: {
|
||||||
|
enable: true,
|
||||||
|
countList: []
|
||||||
|
},
|
||||||
|
desc: '三等奖',
|
||||||
isShow: true,
|
isShow: true,
|
||||||
isUsed: false,
|
isUsed: false,
|
||||||
frequency: 1,
|
frequency: 1,
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ import PatternSetting from './components/PatternSetting.vue'
|
|||||||
|
|
||||||
const globalConfig = useStore().globalConfig
|
const globalConfig = useStore().globalConfig
|
||||||
const personConfig = useStore().personConfig
|
const personConfig = useStore().personConfig
|
||||||
|
const prizeConfig= useStore().prizeConfig
|
||||||
const { getTopTitle: topTitle, getTheme: localTheme, getPatterColor: patternColor, getPatternList: patternList, getCardColor: cardColor, getLuckyColor: luckyCardColor, getTextColor: textColor, getCardSize: cardSize, getTextSize: textSize, getRowCount: rowCount, getIsShowPrizeList: isShowPrizeList } = storeToRefs(globalConfig)
|
const { getTopTitle: topTitle, getTheme: localTheme, getPatterColor: patternColor, getPatternList: patternList, getCardColor: cardColor, getLuckyColor: luckyCardColor, getTextColor: textColor, getCardSize: cardSize, getTextSize: textSize, getRowCount: rowCount, getIsShowPrizeList: isShowPrizeList } = storeToRefs(globalConfig)
|
||||||
const { getAlreadyPersonList: alreadyPersonList, getNotPersonList: notPersonList } = storeToRefs(personConfig)
|
const { getAlreadyPersonList: alreadyPersonList, getNotPersonList: notPersonList } = storeToRefs(personConfig)
|
||||||
const colorPickerRef = ref()
|
const colorPickerRef = ref()
|
||||||
|
const resetDataDialogRef=ref()
|
||||||
interface ThemeDaType {
|
interface ThemeDaType {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
@@ -87,6 +88,14 @@ const resetPattern = () => {
|
|||||||
globalConfig.resetPatternList()
|
globalConfig.resetPatternList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resetData=()=>{
|
||||||
|
globalConfig.reset();
|
||||||
|
personConfig.reset();
|
||||||
|
prizeConfig.resetDefault();
|
||||||
|
// 刷新页面
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
|
||||||
// const handleChangeShowFields = (fieldItem: any) => {
|
// const handleChangeShowFields = (fieldItem: any) => {
|
||||||
// formData.value.showField.map((item) => {
|
// formData.value.showField.map((item) => {
|
||||||
// if (item.label === fieldItem.label) {
|
// if (item.label === fieldItem.label) {
|
||||||
@@ -144,7 +153,24 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<dialog id="my_modal_1" ref="resetDataDialogRef" class="border-none modal">
|
||||||
|
<div class="modal-box">
|
||||||
|
<h3 class="text-lg font-bold">提示!</h3>
|
||||||
|
<p class="py-4">该操作会重置所有数据,是否继续?</p>
|
||||||
|
<div class="modal-action">
|
||||||
|
<form method="dialog" class="flex gap-3">
|
||||||
|
<!-- if there is a button in form, it will close the modal -->
|
||||||
|
<button class="btn" @click="resetDataDialogRef.close()">取消</button>
|
||||||
|
<button class="btn" @click="resetData">确定</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
<div>
|
<div>
|
||||||
|
<h2>全局配置</h2>
|
||||||
|
<div class="mb-8">
|
||||||
|
<button class="btn btn-sm btn-primary" @click="resetDataDialogRef.showModal()">重置所有数据</button>
|
||||||
|
</div>
|
||||||
<label class="flex flex-row items-center w-full gap-24 mb-10 form-control">
|
<label class="flex flex-row items-center w-full gap-24 mb-10 form-control">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ onMounted(() => {
|
|||||||
<dialog id="my_modal_1" ref="resetDataDialog" class="border-none modal">
|
<dialog id="my_modal_1" ref="resetDataDialog" class="border-none modal">
|
||||||
<div class="modal-box">
|
<div class="modal-box">
|
||||||
<h3 class="text-lg font-bold">提示!</h3>
|
<h3 class="text-lg font-bold">提示!</h3>
|
||||||
<p class="py-4">该操作会重置所有人员数据,是否继续?</p>
|
<p class="py-4">该操作会清空人员中奖信息,是否继续?</p>
|
||||||
<div class="modal-action">
|
<div class="modal-action">
|
||||||
<form method="dialog" class="flex gap-3">
|
<form method="dialog" class="flex gap-3">
|
||||||
<!-- if there is a button in form, it will close the modal -->
|
<!-- if there is a button in form, it will close the modal -->
|
||||||
@@ -161,7 +161,7 @@ onMounted(() => {
|
|||||||
<div class="min-w-1000px">
|
<div class="min-w-1000px">
|
||||||
|
|
||||||
<h2>人员管理</h2>
|
<h2>人员管理</h2>
|
||||||
<div class="flex gap-3 justify-">
|
<div class="flex gap-3">
|
||||||
<button class="btn btn-error btn-sm" @click="delAllDataDialog.showModal()">全部删除</button>
|
<button class="btn btn-error btn-sm" @click="delAllDataDialog.showModal()">全部删除</button>
|
||||||
<div class="tooltip tooltip-bottom" data-tip="下载文件后,请在excel中填写数据,并保存为xlsx格式">
|
<div class="tooltip tooltip-bottom" data-tip="下载文件后,请在excel中填写数据,并保存为xlsx格式">
|
||||||
<a class="no-underline btn btn-secondary btn-sm" download="人口登记表.xlsx" target="_blank"
|
<a class="no-underline btn btn-secondary btn-sm" download="人口登记表.xlsx" target="_blank"
|
||||||
@@ -180,7 +180,7 @@ onMounted(() => {
|
|||||||
<!-- <button class="btn btn-primary btn-sm">上传excel</button> -->
|
<!-- <button class="btn btn-primary btn-sm">上传excel</button> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-error btn-sm" @click="resetDataDialog.showModal()">重置数据</button>
|
<button class="btn btn-error btn-sm" @click="resetDataDialog.showModal()">重置人员数据</button>
|
||||||
<button class="btn btn-accent btn-sm" @click="exportData">导出结果</button>
|
<button class="btn btn-accent btn-sm" @click="exportData">导出结果</button>
|
||||||
<div>
|
<div>
|
||||||
<span>中奖人数:</span>
|
<span>中奖人数:</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user