@@ -30,7 +30,7 @@ or
|
||||
<https://log1997.github.io/log-lottery/>
|
||||
|
||||
开发仓促,若以上网站内容存在bug还请宽容。
|
||||
如果想要访问2025年12月31日前的版本,请前往:<https://lottery.to2026.xyz/log-lottery>
|
||||
如果想要访问2025年12月31日前的版本,请前往:<https://to2026.xyz/log-lottery>
|
||||
|
||||
## TODO
|
||||
|
||||
|
||||
@@ -30,11 +30,10 @@ const actionsColumns = computed<any[]>(() => {
|
||||
|
||||
<template>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table min-w-[600px]">
|
||||
<table class="table min-w-150">
|
||||
<!-- head -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th />
|
||||
<th v-for="(item, index) in dataColumns" :key="index">
|
||||
{{ item.label }}
|
||||
</th>
|
||||
|
||||
@@ -1,109 +1,108 @@
|
||||
import { reset } from 'canvas-confetti'
|
||||
import { time } from 'zod/v4/core/regexes.cjs'
|
||||
|
||||
export const tableEn = {
|
||||
// field block name
|
||||
abilitySetting: 'Ability Setting',
|
||||
dataSetting: 'Data Setting',
|
||||
layoutSetting: 'Layout Setting',
|
||||
patternSetting: 'Pattern Setting',
|
||||
textSetting: 'Text Setting',
|
||||
themeSetting: 'Theme Setting',
|
||||
// person configuration
|
||||
number: 'Number',
|
||||
name: 'Name',
|
||||
prizeName: 'Name',
|
||||
department: 'Department',
|
||||
identity: 'Identity',
|
||||
isLucky: 'Is Lucky',
|
||||
operation: 'Operation',
|
||||
setLuckyNumber: 'Set Lucky Number',
|
||||
luckyPeopleNumber: 'Lucky People Number',
|
||||
detail: 'Detail',
|
||||
noneData: 'No Data',
|
||||
// prize configuration
|
||||
fullParticipation: 'FullParticipation',
|
||||
numberParticipants: 'NumberParticipants',
|
||||
isDone: 'is Done',
|
||||
image: 'Image',
|
||||
onceNumber: 'Once Number',
|
||||
time: 'Time',
|
||||
// view setting
|
||||
title: 'Main Title',
|
||||
columnNumber: 'Column Number',
|
||||
theme: 'Theme',
|
||||
language: 'Language',
|
||||
cardColor: 'Card Color',
|
||||
winnerColor: 'Winner Color',
|
||||
textColor: 'Text Color',
|
||||
cardWidth: 'Card Width',
|
||||
cardHeight: 'Card Height',
|
||||
textSize: 'Text Size',
|
||||
highlightColor: 'HighLight Color',
|
||||
alwaysDisplay: 'Always Display Prize List',
|
||||
avatarDisplay: 'Show avatars or not',
|
||||
selectPicture: 'Select a Picture',
|
||||
backgroundImage: 'Select Background Image',
|
||||
timedStop: 'Timed Stop',
|
||||
playWinMusic: 'Play Win Music',
|
||||
resetAllData: 'Reset All Data',
|
||||
globalFont: 'Global Font',
|
||||
titleFont: 'Title Font',
|
||||
syncGlobalFont: 'Sync Global Font',
|
||||
// field block name
|
||||
abilitySetting: 'Ability Setting',
|
||||
dataSetting: 'Data Setting',
|
||||
layoutSetting: 'Layout Setting',
|
||||
patternSetting: 'Pattern Setting',
|
||||
textSetting: 'Text Setting',
|
||||
themeSetting: 'Theme Setting',
|
||||
// person configuration
|
||||
number: 'Number',
|
||||
name: 'Name',
|
||||
prizeName: 'Name',
|
||||
department: 'Department',
|
||||
avatar: 'Avatar',
|
||||
identity: 'Identity',
|
||||
isLucky: 'Is Lucky',
|
||||
operation: 'Operation',
|
||||
setLuckyNumber: 'Set Lucky Number',
|
||||
luckyPeopleNumber: 'Lucky People Number',
|
||||
detail: 'Detail',
|
||||
noneData: 'No Data',
|
||||
// prize configuration
|
||||
fullParticipation: 'FullParticipation',
|
||||
numberParticipants: 'NumberParticipants',
|
||||
isDone: 'is Done',
|
||||
image: 'Image',
|
||||
onceNumber: 'Once Number',
|
||||
time: 'Time',
|
||||
// view setting
|
||||
title: 'Main Title',
|
||||
columnNumber: 'Column Number',
|
||||
theme: 'Theme',
|
||||
language: 'Language',
|
||||
cardColor: 'Card Color',
|
||||
winnerColor: 'Winner Color',
|
||||
textColor: 'Text Color',
|
||||
cardWidth: 'Card Width',
|
||||
cardHeight: 'Card Height',
|
||||
textSize: 'Text Size',
|
||||
highlightColor: 'HighLight Color',
|
||||
alwaysDisplay: 'Always Display Prize List',
|
||||
avatarDisplay: 'Show avatars or not',
|
||||
selectPicture: 'Select a Picture',
|
||||
backgroundImage: 'Select Background Image',
|
||||
timedStop: 'Timed Stop',
|
||||
playWinMusic: 'Play Win Music',
|
||||
resetAllData: 'Reset All Data',
|
||||
globalFont: 'Global Font',
|
||||
titleFont: 'Title Font',
|
||||
syncGlobalFont: 'Sync Global Font',
|
||||
}
|
||||
|
||||
export const tableZhCn = {
|
||||
// field block name
|
||||
abilitySetting: '功能设置',
|
||||
dataSetting: '数据设置',
|
||||
layoutSetting: '布局设置',
|
||||
patternSetting: '图案设置',
|
||||
textSetting: '文字设置',
|
||||
themeSetting: '主题设置',
|
||||
// person configuration
|
||||
number: '编号',
|
||||
name: '姓名',
|
||||
prizeName: '名称',
|
||||
department: '部门',
|
||||
identity: '身份',
|
||||
isLucky: '是否中奖',
|
||||
operation: '操作',
|
||||
setLuckyNumber: '设置中奖人数',
|
||||
luckyPeopleNumber: '中奖人数',
|
||||
detail: '详细信息',
|
||||
noneData: '暂无数据',
|
||||
// prize configuration
|
||||
fullParticipation: '可重复',
|
||||
numberParticipants: '抽奖人数',
|
||||
isDone: '已抽取',
|
||||
image: '图片',
|
||||
onceNumber: '单次抽取个数',
|
||||
time: '时间',
|
||||
// view setting
|
||||
title: '主标题',
|
||||
columnNumber: '列数',
|
||||
theme: '主题',
|
||||
language: '语言',
|
||||
cardColor: '卡片颜色',
|
||||
winnerColor: '中奖卡片颜色',
|
||||
textColor: '文字颜色',
|
||||
cardWidth: '卡片宽度',
|
||||
cardHeight: '卡片高度',
|
||||
textSize: '文字大小',
|
||||
highlightColor: '高亮颜色',
|
||||
alwaysDisplay: '常显奖项列表',
|
||||
avatarDisplay: '是否显示头像',
|
||||
selectPicture: '选择一张图片',
|
||||
backgroundImage: '选择背景图片',
|
||||
timedStop: '定时停止',
|
||||
playWinMusic: '播放中奖音乐',
|
||||
resetAllData: '重置数据',
|
||||
globalFont: '全局字体',
|
||||
titleFont: '标题字体',
|
||||
syncGlobalFont: '同步全局字体',
|
||||
// field block name
|
||||
abilitySetting: '功能设置',
|
||||
dataSetting: '数据设置',
|
||||
layoutSetting: '布局设置',
|
||||
patternSetting: '图案设置',
|
||||
textSetting: '文字设置',
|
||||
themeSetting: '主题设置',
|
||||
// person configuration
|
||||
number: '编号',
|
||||
name: '姓名',
|
||||
prizeName: '名称',
|
||||
department: '部门',
|
||||
avatar: '头像',
|
||||
identity: '身份',
|
||||
isLucky: '是否中奖',
|
||||
operation: '操作',
|
||||
setLuckyNumber: '设置中奖人数',
|
||||
luckyPeopleNumber: '中奖人数',
|
||||
detail: '详细信息',
|
||||
noneData: '暂无数据',
|
||||
// prize configuration
|
||||
fullParticipation: '可重复',
|
||||
numberParticipants: '抽奖人数',
|
||||
isDone: '已抽取',
|
||||
image: '图片',
|
||||
onceNumber: '单次抽取个数',
|
||||
time: '时间',
|
||||
// view setting
|
||||
title: '主标题',
|
||||
columnNumber: '列数',
|
||||
theme: '主题',
|
||||
language: '语言',
|
||||
cardColor: '卡片颜色',
|
||||
winnerColor: '中奖卡片颜色',
|
||||
textColor: '文字颜色',
|
||||
cardWidth: '卡片宽度',
|
||||
cardHeight: '卡片高度',
|
||||
textSize: '文字大小',
|
||||
highlightColor: '高亮颜色',
|
||||
alwaysDisplay: '常显奖项列表',
|
||||
avatarDisplay: '是否显示头像',
|
||||
selectPicture: '选择一张图片',
|
||||
backgroundImage: '选择背景图片',
|
||||
timedStop: '定时停止',
|
||||
playWinMusic: '播放中奖音乐',
|
||||
resetAllData: '重置数据',
|
||||
globalFont: '全局字体',
|
||||
titleFont: '标题字体',
|
||||
syncGlobalFont: '同步全局字体',
|
||||
}
|
||||
|
||||
export const table = {
|
||||
en: tableEn,
|
||||
zhCn: tableZhCn,
|
||||
en: tableEn,
|
||||
zhCn: tableZhCn,
|
||||
}
|
||||
|
||||
@@ -14,29 +14,29 @@ const singlePersonData = defineModel<any>('singlePersonData', { required: true }
|
||||
<form class="fieldset rounded-box w-xs p-4" @submit="(e) => addOnePerson(addOnePersonDrawerRef, e)">
|
||||
<label class="fieldset">
|
||||
<span class="label">{{ t('table.number') }}</span>
|
||||
<input v-model="singlePersonData.uid" type="text" class="input validator" :placeholder="t('placeHolder.number')">
|
||||
<input v-model="singlePersonData.uid" type="text" class="input validator" :placeholder="t('table.number')">
|
||||
</label>
|
||||
<fieldset class="fieldset">
|
||||
<label class="label" required>{{ t('table.name') }}<span class="text-red-500">*</span></label>
|
||||
<input v-model="singlePersonData.name" type="text" class="input validator" :placeholder="t('placeHolder.name')" required minlength="1">
|
||||
<input v-model="singlePersonData.name" type="text" class="input validator" :placeholder="t('table.name')" required minlength="1">
|
||||
<p class="validator-hint hidden">
|
||||
{{ t('error.personNameEmpty') }}
|
||||
</p>
|
||||
</fieldset>
|
||||
<label class="fieldset">
|
||||
<span class="label">{{ t('table.department') }}</span>
|
||||
<input v-model="singlePersonData.department" type="text" class="input validator" :placeholder="t('placeHolder.department')">
|
||||
<input v-model="singlePersonData.department" type="text" class="input validator" :placeholder="t('table.department')">
|
||||
</label>
|
||||
<label class="fieldset">
|
||||
<span class="label">{{ t('table.avatar') }}</span>
|
||||
<input v-model="singlePersonData.avatar" type="text" class="input validator" :placeholder="t('placeHolder.avatar')">
|
||||
<input v-model="singlePersonData.avatar" type="text" class="input validator" :placeholder="t('table.avatar')">
|
||||
</label>
|
||||
<label class="fieldset">
|
||||
<span class="label">{{ t('table.identity') }}</span>
|
||||
<input v-model="singlePersonData.identity" type="text" class="input validator" :placeholder="t('placeHolder.identity')">
|
||||
<input v-model="singlePersonData.identity" type="text" class="input validator" :placeholder="t('table.identity')">
|
||||
</label>
|
||||
<button class="btn btn-neutral mt-4" type="submit">
|
||||
{{ t('button.submit') }}
|
||||
{{ t('button.confirm') }}
|
||||
</button>
|
||||
<button class="btn btn-ghost mt-1" type="reset" @click="addOnePersonDrawerRef.closeDrawer()">
|
||||
{{ t('button.cancel') }}
|
||||
|
||||
@@ -1,60 +1,59 @@
|
||||
import * as XLSX from 'xlsx'
|
||||
import i18n from '@/locales/i18n'
|
||||
import { addOtherInfo } from '@/utils'
|
||||
// 定义消息类型
|
||||
interface WorkerMessage {
|
||||
type: 'start' | 'stop' | 'reset'
|
||||
data: any
|
||||
templateData: any
|
||||
type: 'start' | 'stop' | 'reset'
|
||||
data: any
|
||||
templateData: any
|
||||
}
|
||||
|
||||
let allData: any[] = []
|
||||
|
||||
function headersEqual(template: string[], actual: string[]): boolean {
|
||||
return template.length >= actual.length
|
||||
&& actual.some(item => template.includes(item))
|
||||
return template.length >= actual.length
|
||||
&& actual.some(item => template.includes(item))
|
||||
}
|
||||
// 接收主线程消息
|
||||
globalThis.onmessage = async (e: MessageEvent<WorkerMessage>) => {
|
||||
switch (e.data.type) {
|
||||
case 'start':
|
||||
{
|
||||
const fileData = e.data.data
|
||||
const templateData = e.data.templateData
|
||||
switch (e.data.type) {
|
||||
case 'start':
|
||||
{
|
||||
const fileData = e.data.data
|
||||
const templateData = e.data.templateData
|
||||
|
||||
const workBook = XLSX.read(fileData, { type: 'binary', cellDates: true })
|
||||
const workSheet = workBook.Sheets[workBook.SheetNames[0]]
|
||||
const excelData: object[] = XLSX.utils.sheet_to_json(workSheet)
|
||||
const workBook = XLSX.read(fileData, { type: 'binary', cellDates: true })
|
||||
const workSheet = workBook.Sheets[workBook.SheetNames[0]]
|
||||
const excelData: object[] = XLSX.utils.sheet_to_json(workSheet)
|
||||
|
||||
const templateWorkBook = XLSX.read(templateData, { type: 'array', cellDates: true })
|
||||
const templateWorkSheet = templateWorkBook.Sheets[templateWorkBook.SheetNames[0]]
|
||||
const templateExcelData: object[] = XLSX.utils.sheet_to_json(templateWorkSheet)
|
||||
const templateWorkBook = XLSX.read(templateData, { type: 'array', cellDates: true })
|
||||
const templateWorkSheet = templateWorkBook.Sheets[templateWorkBook.SheetNames[0]]
|
||||
const templateExcelData: object[] = XLSX.utils.sheet_to_json(templateWorkSheet)
|
||||
|
||||
const templateHeader = Object.keys(templateExcelData[0])
|
||||
const header = Object.keys(excelData[0])
|
||||
const templateHeader = Object.keys(templateExcelData[0])
|
||||
const header = Object.keys(excelData[0])
|
||||
|
||||
if (!headersEqual(templateHeader, header)) {
|
||||
globalThis.postMessage({
|
||||
type: 'error',
|
||||
data: null,
|
||||
message: 'not right template',
|
||||
})
|
||||
return
|
||||
}
|
||||
allData = addOtherInfo(excelData)
|
||||
globalThis.postMessage({
|
||||
type: 'done',
|
||||
data: allData,
|
||||
message: '读取完成',
|
||||
})
|
||||
break
|
||||
if (!headersEqual(templateHeader, header)) {
|
||||
globalThis.postMessage({
|
||||
type: 'error',
|
||||
data: null,
|
||||
message: 'not right template',
|
||||
})
|
||||
return
|
||||
}
|
||||
allData = addOtherInfo(excelData)
|
||||
globalThis.postMessage({
|
||||
type: 'done',
|
||||
data: allData,
|
||||
message: '读取完成',
|
||||
})
|
||||
break
|
||||
}
|
||||
default:
|
||||
globalThis.postMessage({
|
||||
type: 'fail',
|
||||
data: null,
|
||||
message: '读取失败',
|
||||
})
|
||||
break
|
||||
}
|
||||
default:
|
||||
globalThis.postMessage({
|
||||
type: 'fail',
|
||||
data: null,
|
||||
message: '读取失败',
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user