feat: add reset all data in global config
This commit is contained in:
@@ -76,15 +76,7 @@ export const defaultPrizeList = <IPrizeConfig[]>[
|
||||
},
|
||||
separateCount: {
|
||||
enable: true,
|
||||
countList: [{
|
||||
id: '0',
|
||||
count: 6,
|
||||
isUsedCount: 0,
|
||||
}, {
|
||||
id: '1',
|
||||
count: 6,
|
||||
isUsedCount: 0,
|
||||
}]
|
||||
countList: []
|
||||
},
|
||||
desc: '三等奖',
|
||||
isShow: true,
|
||||
|
||||
@@ -211,27 +211,26 @@ export const useGlobalConfig = defineStore('global', {
|
||||
// 重置所有配置
|
||||
reset() {
|
||||
this.globalConfig = {
|
||||
rowCount: 12,
|
||||
topTitle:'大明内阁六部御前奏对',
|
||||
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[],
|
||||
},
|
||||
this.currentMusic = {
|
||||
item:defaultMusicList[0] as IMusic,
|
||||
item: defaultMusicList[0],
|
||||
paused: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,17 +8,21 @@ export const usePrizeConfig = defineStore('prize', {
|
||||
prizeList: defaultPrizeList,
|
||||
currentPrize: {
|
||||
id: '001',
|
||||
name: '一等奖',
|
||||
name: '三等奖',
|
||||
sort: 1,
|
||||
isAll: true,
|
||||
count: 1,
|
||||
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,
|
||||
@@ -35,6 +39,10 @@ export const usePrizeConfig = defineStore('prize', {
|
||||
name: '',
|
||||
url: ''
|
||||
},
|
||||
separateCount: {
|
||||
enable: true,
|
||||
countList: []
|
||||
},
|
||||
desc: '',
|
||||
isShow: false,
|
||||
isUsed: false,
|
||||
@@ -148,17 +156,21 @@ return
|
||||
prizeList: defaultPrizeList,
|
||||
currentPrize: {
|
||||
id: '001',
|
||||
name: '一等奖',
|
||||
name: '三等奖',
|
||||
sort: 1,
|
||||
isAll: true,
|
||||
count: 1,
|
||||
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,
|
||||
|
||||
@@ -13,10 +13,11 @@ import PatternSetting from './components/PatternSetting.vue'
|
||||
|
||||
const globalConfig = useStore().globalConfig
|
||||
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 { getAlreadyPersonList: alreadyPersonList, getNotPersonList: notPersonList } = storeToRefs(personConfig)
|
||||
const colorPickerRef = ref()
|
||||
|
||||
const resetDataDialogRef=ref()
|
||||
interface ThemeDaType {
|
||||
[key: string]: any
|
||||
}
|
||||
@@ -87,6 +88,14 @@ const resetPattern = () => {
|
||||
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(() => {
|
||||
</script>
|
||||
|
||||
<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>
|
||||
<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">
|
||||
<div class="">
|
||||
<div class="label">
|
||||
|
||||
@@ -135,7 +135,7 @@ onMounted(() => {
|
||||
<dialog id="my_modal_1" ref="resetDataDialog" class="border-none modal">
|
||||
<div class="modal-box">
|
||||
<h3 class="text-lg font-bold">提示!</h3>
|
||||
<p class="py-4">该操作会重置所有人员数据,是否继续?</p>
|
||||
<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 -->
|
||||
@@ -161,7 +161,7 @@ onMounted(() => {
|
||||
<div class="min-w-1000px">
|
||||
|
||||
<h2>人员管理</h2>
|
||||
<div class="flex gap-3 justify-">
|
||||
<div class="flex gap-3">
|
||||
<button class="btn btn-error btn-sm" @click="delAllDataDialog.showModal()">全部删除</button>
|
||||
<div class="tooltip tooltip-bottom" data-tip="下载文件后,请在excel中填写数据,并保存为xlsx格式">
|
||||
<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> -->
|
||||
|
||||
</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>
|
||||
<div>
|
||||
<span>中奖人数:</span>
|
||||
|
||||
Reference in New Issue
Block a user