feat: 配置单次抽奖个数
This commit is contained in:
2
src/components.d.ts
vendored
2
src/components.d.ts
vendored
@@ -8,8 +8,10 @@ export {}
|
|||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
DaiysuiTable: typeof import('./components/DaiysuiTable/index.vue')['default']
|
DaiysuiTable: typeof import('./components/DaiysuiTable/index.vue')['default']
|
||||||
|
EditSeparateDialog: typeof import('./components/NumberSeparate/EditSeparateDialog.vue')['default']
|
||||||
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
||||||
ImageSync: typeof import('./components/ImageSync/index.vue')['default']
|
ImageSync: typeof import('./components/ImageSync/index.vue')['default']
|
||||||
|
NumberSeparate: typeof import('./components/NumberSeparate/index.vue')['default']
|
||||||
PlayMusic: typeof import('./components/PlayMusic/index.vue')['default']
|
PlayMusic: typeof import('./components/PlayMusic/index.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
|
|||||||
102
src/components/NumberSeparate/EditSeparateDialog.vue
Normal file
102
src/components/NumberSeparate/EditSeparateDialog.vue
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<script setup lang='ts'>
|
||||||
|
import { ref, watch, onMounted, toRefs } from 'vue'
|
||||||
|
import { Separate } from '@/types/storeType'
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
totalNumber: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
separatedNumber: {
|
||||||
|
type: Array<Separate>,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emits = defineEmits(['clearData'])
|
||||||
|
|
||||||
|
const separatedNumberRef = ref()
|
||||||
|
const { separatedNumber, totalNumber } = toRefs(props)
|
||||||
|
const scaleList = ref<number[]>([])
|
||||||
|
const editScale = (item: number) => {
|
||||||
|
if (item == totalNumber.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (scaleList.value.includes(item)) {
|
||||||
|
const index = scaleList.value.indexOf(item)
|
||||||
|
scaleList.value.splice(index, 1)
|
||||||
|
separatedNumber.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scaleList.value.push(item)
|
||||||
|
scaleList.value.sort((a, b) => a - b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const clearData = () => {
|
||||||
|
separatedNumberRef.value.close()
|
||||||
|
emits('clearData')
|
||||||
|
}
|
||||||
|
watch(scaleList, (val: number[]) => {
|
||||||
|
separatedNumber.value = []
|
||||||
|
for (let i = 1; i < scaleList.value.length; i++) {
|
||||||
|
separatedNumber.value[i-1] = {
|
||||||
|
id: i.toString(),
|
||||||
|
count: val[i] - val[i - 1],
|
||||||
|
isUsedCount:0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, { deep: true })
|
||||||
|
|
||||||
|
watch(totalNumber, (val) => {
|
||||||
|
if (val <= 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
separatedNumberRef.value.showModal()
|
||||||
|
scaleList.value = new Array(separatedNumber.value.length + 1).fill(totalNumber.value)
|
||||||
|
console.log('code line-56 \n\r😀 scaleList.value:\n\r',scaleList.value);
|
||||||
|
for (let i = separatedNumber.value.length - 1; i >= 0; i--) {
|
||||||
|
scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].count
|
||||||
|
}
|
||||||
|
if(scaleList.value[0]!==0){
|
||||||
|
scaleList.value.unshift(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('code line-56 \n\r😀 scaleList.value:\n\r',scaleList.value);
|
||||||
|
})
|
||||||
|
onMounted(() => {
|
||||||
|
// 阻止esc事件
|
||||||
|
document.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<dialog id="my_modal_1" ref="separatedNumberRef" class="z-50 overflow-hidden border-none modal">
|
||||||
|
<div class="overflow-hidden modal-box">
|
||||||
|
<h3 class="pb-6 text-lg font-bold">提示!</h3>
|
||||||
|
<p class="pb-8">单次抽取只能抽取10位</p>
|
||||||
|
<div class="flex justify-between px-3 text-center separated-number">
|
||||||
|
<div v-for="item in props.totalNumber" :key="item"
|
||||||
|
class="relative flex flex-col items-center cursor-pointer">
|
||||||
|
<div class="absolute mb-12 text-center tooltip -top-5 hover:text-lg" data-tip="左键切割右键取消"
|
||||||
|
@click.left="editScale(item)">
|
||||||
|
<span> {{ item }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center" :class="scaleList.includes(item) ? 'text-red-500 font-extrabold' : ''">|</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-action">
|
||||||
|
<form method="dialog">
|
||||||
|
<!-- if there is a button in form, it will close the modal -->
|
||||||
|
<button class="btn" @click="clearData">关闭</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='scss' scoped></style>
|
||||||
87
src/components/NumberSeparate/index.vue
Normal file
87
src/components/NumberSeparate/index.vue
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<script setup lang='ts'>
|
||||||
|
import { Separate } from '@/types/storeType'
|
||||||
|
import { ref, onMounted, watch, toRefs } from 'vue';
|
||||||
|
const props = defineProps({
|
||||||
|
totalNumber: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
separatedNumber: {
|
||||||
|
type: Array<Separate>,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const separatedNumberRef = ref()
|
||||||
|
const { separatedNumber, totalNumber } = toRefs(props)
|
||||||
|
const scaleList = ref<number[]>([])
|
||||||
|
const openEdit = () => {
|
||||||
|
console.log('openedit',separatedNumberRef.value)
|
||||||
|
separatedNumberRef.value.showModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
const addScale = (item: number) => {
|
||||||
|
if (scaleList.value.includes(item)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scaleList.value.push(item)
|
||||||
|
scaleList.value.sort((a, b) => a - b)
|
||||||
|
}
|
||||||
|
const delScale = (item: number) => {
|
||||||
|
if (!scaleList.value.includes(item)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scaleList.value.splice(scaleList.value.indexOf(item), 1)
|
||||||
|
}
|
||||||
|
watch(scaleList, (val: number[]) => {
|
||||||
|
separatedNumber.value = []
|
||||||
|
for (let i = 1; i < scaleList.value.length; i++) {
|
||||||
|
separatedNumber.value[i - 1] = {
|
||||||
|
id: i.toString(),
|
||||||
|
isUsed: false,
|
||||||
|
num: val[i]-val[i-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, { deep: true })
|
||||||
|
onMounted(() => {
|
||||||
|
scaleList.value = new Array(separatedNumber.value.length + 1).fill(totalNumber.value)
|
||||||
|
for (let i = separatedNumber.value.length - 1; i >= 0; i--) {
|
||||||
|
scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].num
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ul class="flex flex-wrap w-full h-full gap-1 cursor-pointer" @click="openEdit">
|
||||||
|
<li class="flex items-center justify-center w-8 h-8 bg-slate-900/60 separated" v-for="item in separatedNumber"
|
||||||
|
:key="item.id">
|
||||||
|
<span>{{ item.num }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<dialog id="my_modal_1" ref="separatedNumberRef" class="z-50 overflow-hidden border-none modal">
|
||||||
|
<div class="overflow-hidden modal-box">
|
||||||
|
<h3 class="pb-12 text-lg font-bold">提示!</h3>
|
||||||
|
<div class="flex justify-between px-3 text-center separated-number">
|
||||||
|
<div v-for="item in props.totalNumber" :key="item"
|
||||||
|
class="relative flex flex-col items-center cursor-pointer">
|
||||||
|
<div class="absolute mb-12 text-center tooltip -top-5 hover:text-lg" data-tip="左键切割右键取消"
|
||||||
|
@click.left="addScale(item)" @click.right.prevent="delScale(item)">
|
||||||
|
<span> {{ item }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center" :class="scaleList.includes(item) ? 'text-red-500' : ''">|</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-action">
|
||||||
|
<form method="dialog">
|
||||||
|
<!-- if there is a button in form, it will close the modal -->
|
||||||
|
<button class="btn">退出</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
.separated-number {
|
||||||
|
border-bottom: 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because one or more lines are too long
@@ -2,42 +2,51 @@ export interface IPersonConfig {
|
|||||||
id: number;
|
id: number;
|
||||||
uid: string;
|
uid: string;
|
||||||
name: string;
|
name: string;
|
||||||
department:string;
|
department: string;
|
||||||
identity:string;
|
identity: string;
|
||||||
isWin:boolean;
|
isWin: boolean;
|
||||||
x:number;
|
x: number;
|
||||||
y:number
|
y: number
|
||||||
createTime: string;
|
createTime: string;
|
||||||
updateTime: string;
|
updateTime: string;
|
||||||
prizeName:string[];
|
prizeName: string[];
|
||||||
prizeId:string[];
|
prizeId: string[];
|
||||||
prizeTime: string[];
|
prizeTime: string[];
|
||||||
}
|
}
|
||||||
export interface IPrizeConfig {
|
export type Separate = {
|
||||||
id: number|string;
|
id: string,
|
||||||
name:string;
|
count: number,
|
||||||
sort:number;
|
isUsedCount: number,
|
||||||
isAll:boolean;
|
|
||||||
count:number;
|
|
||||||
isUsedCount:number,
|
|
||||||
picture:{
|
|
||||||
id:string|number,
|
|
||||||
name:string,
|
|
||||||
url:string
|
|
||||||
};
|
|
||||||
desc:string;
|
|
||||||
isShow:boolean;
|
|
||||||
isUsed:boolean,
|
|
||||||
frequency:number;
|
|
||||||
}
|
}
|
||||||
export interface IMusic{
|
export interface IPrizeConfig {
|
||||||
id:string,
|
id: number | string;
|
||||||
name:string,
|
name: string;
|
||||||
url:string,
|
sort: number;
|
||||||
|
isAll: boolean;
|
||||||
|
count: number;
|
||||||
|
isUsedCount: number,
|
||||||
|
picture: {
|
||||||
|
id: string | number,
|
||||||
|
name: string,
|
||||||
|
url: string
|
||||||
|
};
|
||||||
|
separateCount: {
|
||||||
|
enable: boolean,
|
||||||
|
countList: Separate[],
|
||||||
|
};
|
||||||
|
desc: string;
|
||||||
|
isShow: boolean;
|
||||||
|
isUsed: boolean,
|
||||||
|
frequency: number;
|
||||||
|
}
|
||||||
|
export interface IMusic {
|
||||||
|
id: string,
|
||||||
|
name: string,
|
||||||
|
url: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IImage{
|
export interface IImage {
|
||||||
id:string,
|
id: string,
|
||||||
name:string,
|
name: string,
|
||||||
url:string,
|
url: string,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,8 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
<div class="min-w-1000px">
|
<div class="min-w-1000px">
|
||||||
|
|
||||||
|
<h2>人员管理</h2>
|
||||||
<div class="flex gap-3 justify-">
|
<div class="flex gap-3 justify-">
|
||||||
<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格式">
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ const tableColumnsDetail = [
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="overflow-y-auto">
|
<div class="overflow-y-auto">
|
||||||
|
|
||||||
|
<h2>已中奖人员管理</h2>
|
||||||
<div class="flex items-center justify-start gap-10">
|
<div class="flex items-center justify-start gap-10">
|
||||||
<!-- <button class="btn btn-error btn-sm" @click="deleteAll">全部删除</button> -->
|
<!-- <button class="btn btn-error btn-sm" @click="deleteAll">全部删除</button> -->
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import useStore from '@/store'
|
|||||||
import { IPrizeConfig } from '@/types/storeType'
|
import { IPrizeConfig } from '@/types/storeType'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import localforage from 'localforage'
|
import localforage from 'localforage'
|
||||||
|
import EditSeparateDialog from '@/components/NumberSeparate/EditSeparateDialog.vue'
|
||||||
|
|
||||||
const imageDbStore = localforage.createInstance({
|
const imageDbStore = localforage.createInstance({
|
||||||
name: 'imgStore'
|
name: 'imgStore'
|
||||||
@@ -15,6 +16,9 @@ const { getPrizeConfig: localPrizeList, getCurrentPrize: currentPrize } = storeT
|
|||||||
const { getImageList: localImageList } = storeToRefs(globalConfig)
|
const { getImageList: localImageList } = storeToRefs(globalConfig)
|
||||||
const prizeList = ref(localPrizeList)
|
const prizeList = ref(localPrizeList)
|
||||||
const imgList = ref<any[]>([])
|
const imgList = ref<any[]>([])
|
||||||
|
|
||||||
|
const selectedPrize = ref<IPrizeConfig | null>()
|
||||||
|
|
||||||
const addPrize = () => {
|
const addPrize = () => {
|
||||||
const defaultPrizeCOnfig: IPrizeConfig = {
|
const defaultPrizeCOnfig: IPrizeConfig = {
|
||||||
id: new Date().getTime().toString(),
|
id: new Date().getTime().toString(),
|
||||||
@@ -22,12 +26,16 @@ const addPrize = () => {
|
|||||||
sort: 0,
|
sort: 0,
|
||||||
isAll: false,
|
isAll: false,
|
||||||
count: 1,
|
count: 1,
|
||||||
isUsedCount:0,
|
isUsedCount: 0,
|
||||||
picture: {
|
picture: {
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
url: ''
|
url: ''
|
||||||
},
|
},
|
||||||
|
separateCount: {
|
||||||
|
enable: false,
|
||||||
|
countList: []
|
||||||
|
},
|
||||||
desc: '',
|
desc: '',
|
||||||
isUsed: false,
|
isUsed: false,
|
||||||
isShow: true,
|
isShow: true,
|
||||||
@@ -35,6 +43,49 @@ const addPrize = () => {
|
|||||||
}
|
}
|
||||||
prizeConfig.addPrizeConfig(defaultPrizeCOnfig)
|
prizeConfig.addPrizeConfig(defaultPrizeCOnfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectPrize = (item: IPrizeConfig) => {
|
||||||
|
selectedPrize.value = item
|
||||||
|
selectedPrize.value.isUsedCount = 0
|
||||||
|
selectedPrize.value.isUsed = false
|
||||||
|
|
||||||
|
if (selectedPrize.value.separateCount.countList.length > 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
selectedPrize.value.separateCount = {
|
||||||
|
enable: true,
|
||||||
|
countList: [
|
||||||
|
{
|
||||||
|
id: '0',
|
||||||
|
count: item.count,
|
||||||
|
isUsedCount: 0,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changePrizeStatus=(item:IPrizeConfig)=>{
|
||||||
|
if(item.isUsed==true){
|
||||||
|
item.isUsedCount=0;
|
||||||
|
if(item.separateCount.countList.length){
|
||||||
|
item.separateCount.countList.forEach((countItem:any)=>{
|
||||||
|
countItem.isUsedCount=0;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
item.isUsedCount=item.count;
|
||||||
|
if(item.separateCount.countList.length){
|
||||||
|
item.separateCount.countList.forEach((countItem:any)=>{
|
||||||
|
countItem.isUsedCount=countItem.count;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.isUsed=!item.isUsed
|
||||||
|
}
|
||||||
|
const clearSelectedPrize = () => {
|
||||||
|
selectedPrize.value = null
|
||||||
|
}
|
||||||
const resetDefault = () => {
|
const resetDefault = () => {
|
||||||
prizeConfig.resetDefault()
|
prizeConfig.resetDefault()
|
||||||
}
|
}
|
||||||
@@ -70,9 +121,10 @@ const delAll = async () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getImageDbStore()
|
getImageDbStore()
|
||||||
})
|
})
|
||||||
watch(() => prizeList.value, (val:IPrizeConfig[]) => {
|
watch(() => prizeList.value, (val: IPrizeConfig[]) => {
|
||||||
prizeConfig.setPrizeConfig(val)
|
prizeConfig.setPrizeConfig(val)
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -84,7 +136,14 @@ watch(() => prizeList.value, (val:IPrizeConfig[]) => {
|
|||||||
<button class="btn btn-error btn-sm" @click="delAll">全部删除</button>
|
<button class="btn btn-error btn-sm" @click="delAll">全部删除</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<div role="alert" class="w-full my-4 alert alert-info">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-6 h-6 stroke-current shrink-0">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||||
|
</svg>
|
||||||
|
<span>进行操作可能会重置数据,请谨慎操作</span>
|
||||||
|
</div>
|
||||||
|
<ul class="p-0 m-0">
|
||||||
<li v-for="item in prizeList" :key="item.id" class="flex gap-10"
|
<li v-for="item in prizeList" :key="item.id" class="flex gap-10"
|
||||||
:class="currentPrize.id == item.id ? 'border-1 border-dotted rounded-xl' : null">
|
:class="currentPrize.id == item.id ? 'border-1 border-dotted rounded-xl' : null">
|
||||||
<label class="max-w-xs mb-10 form-control">
|
<label class="max-w-xs mb-10 form-control">
|
||||||
@@ -97,38 +156,43 @@ watch(() => prizeList.value, (val:IPrizeConfig[]) => {
|
|||||||
:class="prizeList.indexOf(item) == prizeList.length - 1 ? 'opacity-0 cursor-default' : ''"></svg-icon>
|
:class="prizeList.indexOf(item) == prizeList.length - 1 ? 'opacity-0 cursor-default' : ''"></svg-icon>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
<label class="w-1/2 max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">名称</span>
|
<span class="label-text">名称</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" v-model="item.name" placeholder="名称"
|
<input type="text" v-model="item.name" placeholder="名称"
|
||||||
class="w-full max-w-xs input-sm input input-bordered" />
|
class="w-full max-w-xs input-sm input input-bordered" />
|
||||||
</label>
|
</label>
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
<label class="w-1/2 max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">是否全员参加</span>
|
<span class="label-text">全员参加</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="checkbox" :checked="item.isAll" @change="item.isAll = !item.isAll"
|
<input type="checkbox" :checked="item.isAll" @change="item.isAll = !item.isAll"
|
||||||
class="mt-2 border-solid checkbox checkbox-secondary border-1" />
|
class="mt-2 border-solid checkbox checkbox-secondary border-1" />
|
||||||
</label>
|
</label>
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
<label class="w-1/2 max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">获奖人数</span>
|
<span class="label-text">抽奖人数</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="number" v-model="item.count" placeholder="获奖人数"
|
<input type="number" v-model="item.count" placeholder="获奖人数"
|
||||||
class="w-full max-w-xs input-sm input input-bordered" />
|
class="w-full max-w-xs p-0 m-0 input-sm input input-bordered" />
|
||||||
|
<div class="tooltip tooltip-bottom" :data-tip="'已抽取:'+item.isUsedCount + '/' + item.count">
|
||||||
|
<progress class="w-full progress" :value="item.isUsedCount" :max="item.count"></progress>
|
||||||
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
<!-- <label class="w-1/2 max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">已获奖人数</span>
|
<span class="label-text">已获奖人数</span>
|
||||||
</div>
|
</div>
|
||||||
<input disabled type="number" v-model="item.isUsedCount" placeholder="获奖人数" class="w-full max-w-xs input-sm input input-bordered" />
|
<input disabled type="number" v-model="item.isUsedCount" placeholder="获奖人数"
|
||||||
</label>
|
class="w-full max-w-xs input-sm input input-bordered" />
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
</label> -->
|
||||||
|
<label class="w-1/2 max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">已抽取</span>
|
<span class="label-text">已抽取</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="checkbox" :checked="item.isUsed" @change="item.isUsed?(()=>{item.isUsed=false;item.isUsedCount=0})():(()=>{item.isUsed=true;item.isUsedCount=item.count})()"
|
<input type="checkbox" :checked="item.isUsed"
|
||||||
|
@change="changePrizeStatus(item)"
|
||||||
class="mt-2 border-solid checkbox checkbox-secondary border-1" />
|
class="mt-2 border-solid checkbox checkbox-secondary border-1" />
|
||||||
</label>
|
</label>
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
<label class="w-full max-w-xs mb-10 form-control">
|
||||||
@@ -136,28 +200,31 @@ watch(() => prizeList.value, (val:IPrizeConfig[]) => {
|
|||||||
<span class="label-text">图片</span>
|
<span class="label-text">图片</span>
|
||||||
</div>
|
</div>
|
||||||
<select class="w-full max-w-xs select select-warning select-sm" v-model="item.picture">
|
<select class="w-full max-w-xs select select-warning select-sm" v-model="item.picture">
|
||||||
|
<option v-if="item.picture.id" :value="{ id: '', name: '', url: '' }"><span>❌</span></option>
|
||||||
|
|
||||||
<option v-if="item.picture.id" :value="{id:'',name:'',url:''}"><span>❌</span></option>
|
|
||||||
<option disabled selected>选择一张图片</option>
|
<option disabled selected>选择一张图片</option>
|
||||||
<option v-for="picItem in localImageList" :key="picItem.id" :value="picItem">{{ picItem.name }}
|
<option v-for="picItem in localImageList" :key="picItem.id" :value="picItem">{{ picItem.name }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<!-- <label class="w-full max-w-xs mb-10 form-control">
|
<label class="w-full max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">展示在主界面</span>
|
<span class="label-text">单次抽取个数</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="checkbox" :checked="item.isShow" @change="item.isShow = !item.isShow"
|
<div class="flex justify-start w-full h-full" @click="selectPrize(item)">
|
||||||
class="mt-2 border-solid checkbox checkbox-secondary border-1" />
|
<ul class="flex flex-wrap w-full h-full gap-1 p-0 pt-1 m-0 cursor-pointer"
|
||||||
</label> -->
|
v-if="item.separateCount.countList.length">
|
||||||
<!-- <label class="w-full max-w-xs mb-10 form-control">
|
<li class="relative flex items-center justify-center w-8 h-8 bg-slate-600/60 separated"
|
||||||
<div class="label">
|
v-for="se in item.separateCount.countList" :key="se.id">
|
||||||
<span class="label-text">抽取次数</span>
|
<div class="flex items-center justify-center w-full h-full tooltip" :data-tip="'已抽取:'+se.isUsedCount + '/' + se.count">
|
||||||
|
<div class="absolute left-0 z-50 h-full bg-blue-300/80"
|
||||||
|
:style="`width:${se.isUsedCount * 100 / se.count}%`"></div>
|
||||||
|
<span>{{ se.count }}</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" v-model="item.frequency" placeholder="抽取次数"
|
</li>
|
||||||
class="w-full max-w-xs input-sm input input-bordered" />
|
</ul>
|
||||||
</label> -->
|
<button v-else class="btn btn-secondary btn-xs">设置</button>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
<label class="w-full max-w-xs mb-10 form-control">
|
<label class="w-full max-w-xs mb-10 form-control">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="label-text">操作</span>
|
<span class="label-text">操作</span>
|
||||||
@@ -168,6 +235,9 @@ watch(() => prizeList.value, (val:IPrizeConfig[]) => {
|
|||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div></template>
|
<EditSeparateDialog :totalNumber="selectedPrize?.count" :separated-number="selectedPrize?.separateCount.countList"
|
||||||
|
@clearData="clearSelectedPrize" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<style lang='scss' scoped></style>
|
<style lang='scss' scoped></style>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mb-10 ml-3">
|
<div class="w-3/4 mb-10 ml-3">
|
||||||
<div class="markdown-body" v-dompurify-html="readmeHtml"></div>
|
<div class="markdown-body" v-dompurify-html="readmeHtml"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,12 +1,24 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
|
import NumberSeparate from '@/components/NumberSeparate/index.vue'
|
||||||
|
import {ref} from 'vue'
|
||||||
|
|
||||||
import StarsBackground from '../../components/StarsBackground/index.vue'
|
const total=ref(12)
|
||||||
|
const sep=ref([
|
||||||
|
{id:'0',num:3,isUsed:false},
|
||||||
|
{id:'1',num:4,isUsed:false},
|
||||||
|
{id:'2',num:2,isUsed:false},
|
||||||
|
{id:'3',num:3,isUsed:false},
|
||||||
|
])
|
||||||
|
|
||||||
|
const printPoo=()=>{
|
||||||
|
console.log(sep.value)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<StarsBackground></StarsBackground>
|
<NumberSeparate :totalNumber="total" :separatedNumber="sep"></NumberSeparate>
|
||||||
|
<button class="btn btn-error" @click="printPoo">打印</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -403,21 +403,20 @@ const stopLottery = async () => {
|
|||||||
intervalTimer.value = null
|
intervalTimer.value = null
|
||||||
canOperate.value = false
|
canOperate.value = false
|
||||||
rollBall(0, 1)
|
rollBall(0, 1)
|
||||||
// 抽奖池是否为全体人员
|
|
||||||
// 每次最多抽十个
|
|
||||||
luckyCount.value = 10
|
luckyCount.value = 10
|
||||||
const leftover = currentPrize.value.count - currentPrize.value.isUsedCount
|
// 自定义抽奖个数
|
||||||
leftover < luckyCount.value ? luckyCount.value = leftover : luckyCount
|
|
||||||
if (personPool.value.length < leftover) {
|
|
||||||
toast.open({
|
|
||||||
message: '抽奖人数不够',
|
|
||||||
type: 'warning',
|
|
||||||
position: 'top-right',
|
|
||||||
duration: 10000
|
|
||||||
})
|
|
||||||
|
|
||||||
return;
|
let leftover = currentPrize.value.count - currentPrize.value.isUsedCount
|
||||||
|
const customCount=currentPrize.value.separateCount
|
||||||
|
if(customCount.enable&&customCount.countList.length>0){
|
||||||
|
for(let i=0;i<customCount.countList.length;i++){
|
||||||
|
if(customCount.countList[i].isUsedCount<customCount.countList[i].count){
|
||||||
|
leftover=customCount.countList[i].count-customCount.countList[i].isUsedCount
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leftover < luckyCount.value ? luckyCount.value = leftover : luckyCount
|
||||||
for (let i = 0; i < luckyCount.value; i++) {
|
for (let i = 0; i < luckyCount.value; i++) {
|
||||||
if (personPool.value.length > 0) {
|
if (personPool.value.length > 0) {
|
||||||
const randomIndex = Math.round(Math.random() * (personPool.value.length - 1))
|
const randomIndex = Math.round(Math.random() * (personPool.value.length - 1))
|
||||||
@@ -465,6 +464,16 @@ const continueLottery = async () => {
|
|||||||
if (!canOperate.value) {
|
if (!canOperate.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const customCount=currentPrize.value.separateCount
|
||||||
|
if(customCount.enable&&customCount.countList.length>0){
|
||||||
|
for(let i=0;i<customCount.countList.length;i++){
|
||||||
|
if(customCount.countList[i].isUsedCount<customCount.countList[i].count){
|
||||||
|
customCount.countList[i].isUsedCount+= luckyCount.value
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
currentPrize.value.isUsedCount += luckyCount.value
|
currentPrize.value.isUsedCount += luckyCount.value
|
||||||
luckyCount.value = 0
|
luckyCount.value = 0
|
||||||
if (currentPrize.value.isUsedCount >= currentPrize.value.count) {
|
if (currentPrize.value.isUsedCount >= currentPrize.value.count) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ module.exports = {
|
|||||||
corePlugins: {
|
corePlugins: {
|
||||||
preflight: false
|
preflight: false
|
||||||
},
|
},
|
||||||
|
theme: {
|
||||||
|
|
||||||
|
},
|
||||||
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
|
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
|
||||||
plugins: [require('@tailwindcss/typography'), require('daisyui')],
|
plugins: [require('@tailwindcss/typography'), require('daisyui')],
|
||||||
daisyui: {
|
daisyui: {
|
||||||
|
|||||||
Reference in New Issue
Block a user