Skip to content

Commit befda45

Browse files
authored
Merge pull request #164 from LOG1997/dev
Dev
2 parents 6d3bf6d + 9e25b02 commit befda45

7 files changed

Lines changed: 195 additions & 126 deletions

File tree

build/updateVersion.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import fs from 'fs';
2+
import path from 'path';
3+
import { fileURLToPath } from 'url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
7+
8+
// 从命令行参数获取版本号
9+
const args = process.argv.slice(2);
10+
let version = args[0];
11+
12+
if (!version) {
13+
console.error('错误: 请提供版本号作为参数');
14+
console.error('用法: node build/updateVersion.js <version>');
15+
process.exit(1);
16+
}
17+
18+
// 验证版本号格式 (遵循语义化版本号格式,如 x.y.z)
19+
const versionRegex = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/;
20+
if (!versionRegex.test(version)) {
21+
console.error(`错误: 版本号格式不正确: ${version}`);
22+
console.error('正确的版本号格式示例: 1.0.0, 2.1.3, 0.5.0-beta 等');
23+
process.exit(1);
24+
}
25+
26+
// 更新 package.json
27+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
28+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
29+
packageJson.version = version;
30+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
31+
32+
// 读取并更新 tauri.conf.json
33+
const tauriConfPath = path.join(__dirname, '..', 'src-tauri', 'tauri.conf.json');
34+
const tauriConf = JSON.parse(fs.readFileSync(tauriConfPath, 'utf8'));
35+
36+
// 更新版本号
37+
tauriConf.version = version;
38+
39+
// 写回 tauri.conf.json
40+
fs.writeFileSync(tauriConfPath, JSON.stringify(tauriConf, null, 2));
41+
42+
// 读取并更新 Cargo.toml
43+
const cargoTomlPath = path.join(__dirname, '..', 'src-tauri', 'Cargo.toml');
44+
let cargoToml = fs.readFileSync(cargoTomlPath, 'utf8');
45+
46+
// 使用正则表达式替换版本号
47+
cargoToml = cargoToml.replace(
48+
/^(\s*version\s*=\s*["'])([^"']*)(["']\s*)$/m,
49+
`$1${version}$3`
50+
);
51+
52+
// 写回 Cargo.toml
53+
fs.writeFileSync(cargoTomlPath, cargoToml);
54+
55+
console.log(`版本号已更新至: ${version}`);
56+
console.log(`- package.json`);
57+
console.log(`- tauri.conf.json`);
58+
console.log(`- Cargo.toml`);

eslint.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export default antfu(
88
rules: {
99
'no-console': 'warn',
1010
'no-debugger': 'warn',
11+
'style/indent': ['error', 4],
12+
'indent': ['error', 4, { 'SwitchCase': 1 }],
1113
}
1214
},
13-
)
15+
)

package.json

Lines changed: 112 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,114 @@
11
{
2-
"name": "log-lottery",
3-
"private": true,
4-
"version": "0.5.1",
5-
"type": "module",
6-
"license": "MIT",
7-
"scripts": {
8-
"dev": "vite --host 0.0.0.0",
9-
"build": "vue-tsc --noEmit && vite build",
10-
"build:pre": "vue-tsc --noEmit && vite build --mode prebuild",
11-
"build:file": "vue-tsc --noEmit && vite build --mode file",
12-
"tauri": "node ./build/syncVersion.js && tauri",
13-
"test": "vitest",
14-
"test:ui": "vitest --ui",
15-
"preview": "vite preview",
16-
"lint": "eslint ./src",
17-
"lint:fix": "eslint ./src --fix",
18-
"prepare": "husky"
19-
},
20-
"dependencies": {
21-
"@tweenjs/tween.js": "23.1.2",
22-
"@vueuse/core": "^14.1.0",
23-
"axios": "^1.13.2",
24-
"canvas-confetti": "^1.9.4",
25-
"class-variance-authority": "^0.7.1",
26-
"clsx": "^2.1.1",
27-
"dayjs": "^1.11.19",
28-
"dexie": "^4.2.1",
29-
"github-markdown-css": "^5.8.1",
30-
"gsap": "^3.14.2",
31-
"localforage": "^1.10.0",
32-
"lodash-es": "^4.17.22",
33-
"lucide-vue-next": "^0.562.0",
34-
"markdown-it": "^14.1.0",
35-
"masonry-layout": "^4.2.2",
36-
"pinia": "^3.0.4",
37-
"pinia-plugin-persist": "^1.0.0",
38-
"reka-ui": "^2.7.0",
39-
"sparticles": "^1.3.1",
40-
"tailwind-merge": "^3.4.0",
41-
"three": "0.166.0",
42-
"three-css3d": "1.0.6",
43-
"uuid": "^13.0.0",
44-
"vue": "^3.5.26",
45-
"vue-dompurify-html": "^5.3.0",
46-
"vue-draggable-plus": "^0.6.0",
47-
"vue-i18n": "^11.2.7",
48-
"vue-router": "^4.6.4",
49-
"vue-sonner": "^2.0.9",
50-
"vue-toast-notification": "^3",
51-
"vue3-colorpicker": "^2.3.0",
52-
"xlsx": "^0.18.5",
53-
"zod": "^4.2.1"
54-
},
55-
"devDependencies": {
56-
"@antfu/eslint-config": "^6.7.3",
57-
"@eslint/eslintrc": "^3.3.3",
58-
"@eslint/js": "^9.39.2",
59-
"@iconify-json/ep": "^1.2.3",
60-
"@iconify-json/fluent": "^1.2.36",
61-
"@tailwindcss/typography": "^0.5.19",
62-
"@tailwindcss/vite": "^4.1.18",
63-
"@tauri-apps/cli": "^2.9.6",
64-
"@testing-library/vue": "^8.1.0",
65-
"@types/canvas-confetti": "^1.9.0",
66-
"@types/lodash-es": "^4.17.12",
67-
"@types/markdown-it": "^14.1.2",
68-
"@types/masonry-layout": "^4.2.8",
69-
"@types/node": "^25.0.3",
70-
"@types/three": "0.166.0",
71-
"@typescript-eslint/eslint-plugin": "^8.50.1",
72-
"@typescript-eslint/parser": "^8.50.1",
73-
"@vitejs/plugin-legacy": "^7.2.1",
74-
"@vitejs/plugin-vue": "^6.0.3",
75-
"@vitest/ui": "^4.0.16",
76-
"@vue/test-utils": "^2.4.6",
77-
"@vue/tsconfig": "^0.8.1",
78-
"autoprefixer": "^10.4.23",
79-
"baseline-browser-mapping": "^2.9.11",
80-
"child_process": "^1.0.2",
81-
"daisyui": "^5.5.14",
82-
"eslint": "^9.39.2",
83-
"eslint-plugin-vue": "^10.6.2",
84-
"fast-glob": "^3.3.3",
85-
"globals": "^16.5.0",
86-
"happy-dom": "^20.0.11",
87-
"husky": "^9.1.7",
88-
"jsdom": "^27.3.0",
89-
"path": "^0.12.7",
90-
"postcss": "^8.5.6",
91-
"rollup-plugin-visualizer": "^6.0.5",
92-
"sass": "^1.97.1",
93-
"sass-loader": "^16.0.6",
94-
"tailwindcss": "^4.1.18",
95-
"terser": "^5.44.1",
96-
"tw-animate-css": "^1.4.0",
97-
"typescript": "~5.9.3",
98-
"unplugin-auto-import": "^20.3.0",
99-
"unplugin-icons": "^22.5.0",
100-
"unplugin-vue-components": "^30.0.0",
101-
"vite": "^7.3.0",
102-
"vite-plugin-compression": "^0.5.1",
103-
"vite-plugin-inspect": "^11.3.3",
104-
"vite-plugin-svg-icons": "^2.0.1",
105-
"vite-plugin-vue-devtools": "^8.0.5",
106-
"vitest": "^4.0.16",
107-
"vue-tsc": "^3.2.1"
108-
},
109-
"engines": {
110-
"node": ">=22.x"
111-
},
112-
"packageManager": "pnpm@10.26.1"
2+
"name": "log-lottery",
3+
"private": true,
4+
"version": "0.5.2",
5+
"type": "module",
6+
"license": "MIT",
7+
"scripts": {
8+
"dev": "vite --host 0.0.0.0",
9+
"build": "vue-tsc --noEmit && vite build",
10+
"build:pre": "vue-tsc --noEmit && vite build --mode prebuild",
11+
"build:file": "vue-tsc --noEmit && vite build --mode file",
12+
"tauri": "node ./build/syncVersion.js && tauri",
13+
"update-version": "node ./build/updateVersion.js",
14+
"test": "vitest",
15+
"test:ui": "vitest --ui",
16+
"preview": "vite preview",
17+
"lint": "eslint ./src",
18+
"lint:fix": "eslint ./src --fix",
19+
"prepare": "husky"
20+
},
21+
"dependencies": {
22+
"@tweenjs/tween.js": "23.1.2",
23+
"@vueuse/core": "^14.1.0",
24+
"axios": "^1.13.2",
25+
"canvas-confetti": "^1.9.4",
26+
"class-variance-authority": "^0.7.1",
27+
"clsx": "^2.1.1",
28+
"dayjs": "^1.11.19",
29+
"dexie": "^4.2.1",
30+
"github-markdown-css": "^5.8.1",
31+
"gsap": "^3.14.2",
32+
"localforage": "^1.10.0",
33+
"lodash-es": "^4.17.22",
34+
"lucide-vue-next": "^0.562.0",
35+
"markdown-it": "^14.1.0",
36+
"masonry-layout": "^4.2.2",
37+
"pinia": "^3.0.4",
38+
"pinia-plugin-persist": "^1.0.0",
39+
"reka-ui": "^2.7.0",
40+
"sparticles": "^1.3.1",
41+
"tailwind-merge": "^3.4.0",
42+
"three": "0.166.0",
43+
"three-css3d": "1.0.6",
44+
"uuid": "^13.0.0",
45+
"vue": "^3.5.26",
46+
"vue-dompurify-html": "^5.3.0",
47+
"vue-draggable-plus": "^0.6.0",
48+
"vue-i18n": "^11.2.7",
49+
"vue-router": "^4.6.4",
50+
"vue-sonner": "^2.0.9",
51+
"vue-toast-notification": "^3",
52+
"vue3-colorpicker": "^2.3.0",
53+
"xlsx": "^0.18.5",
54+
"zod": "^4.2.1"
55+
},
56+
"devDependencies": {
57+
"@antfu/eslint-config": "^6.7.3",
58+
"@eslint/eslintrc": "^3.3.3",
59+
"@eslint/js": "^9.39.2",
60+
"@iconify-json/ep": "^1.2.3",
61+
"@iconify-json/fluent": "^1.2.36",
62+
"@tailwindcss/typography": "^0.5.19",
63+
"@tailwindcss/vite": "^4.1.18",
64+
"@tauri-apps/cli": "^2.9.6",
65+
"@testing-library/vue": "^8.1.0",
66+
"@types/canvas-confetti": "^1.9.0",
67+
"@types/lodash-es": "^4.17.12",
68+
"@types/markdown-it": "^14.1.2",
69+
"@types/masonry-layout": "^4.2.8",
70+
"@types/node": "^25.0.3",
71+
"@types/three": "0.166.0",
72+
"@typescript-eslint/eslint-plugin": "^8.50.1",
73+
"@typescript-eslint/parser": "^8.50.1",
74+
"@vitejs/plugin-legacy": "^7.2.1",
75+
"@vitejs/plugin-vue": "^6.0.3",
76+
"@vitest/ui": "^4.0.16",
77+
"@vue/test-utils": "^2.4.6",
78+
"@vue/tsconfig": "^0.8.1",
79+
"autoprefixer": "^10.4.23",
80+
"baseline-browser-mapping": "^2.9.11",
81+
"child_process": "^1.0.2",
82+
"daisyui": "^5.5.14",
83+
"eslint": "^9.39.2",
84+
"eslint-plugin-vue": "^10.6.2",
85+
"fast-glob": "^3.3.3",
86+
"globals": "^16.5.0",
87+
"happy-dom": "^20.0.11",
88+
"husky": "^9.1.7",
89+
"jsdom": "^27.3.0",
90+
"path": "^0.12.7",
91+
"postcss": "^8.5.6",
92+
"rollup-plugin-visualizer": "^6.0.5",
93+
"sass": "^1.97.1",
94+
"sass-loader": "^16.0.6",
95+
"tailwindcss": "^4.1.18",
96+
"terser": "^5.44.1",
97+
"tw-animate-css": "^1.4.0",
98+
"typescript": "~5.9.3",
99+
"unplugin-auto-import": "^20.3.0",
100+
"unplugin-icons": "^22.5.0",
101+
"unplugin-vue-components": "^30.0.0",
102+
"vite": "^7.3.0",
103+
"vite-plugin-compression": "^0.5.1",
104+
"vite-plugin-inspect": "^11.3.3",
105+
"vite-plugin-svg-icons": "^2.0.1",
106+
"vite-plugin-vue-devtools": "^8.0.5",
107+
"vitest": "^4.0.16",
108+
"vue-tsc": "^3.2.1"
109+
},
110+
"engines": {
111+
"node": ">=22.x"
112+
},
113+
"packageManager": "pnpm@10.26.1"
113114
}

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app"
3-
version = "0.5.1"
3+
version = "0.5.2"
44
description = "A Tauri App"
55
authors = ["you"]
66
license = ""

src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
33
"productName": "log-lottery",
4-
"version": "0.5.1",
4+
"version": "0.5.2",
55
"identifier": "to2026.xyz",
66
"build": {
77
"frontendDist": "../dist",
@@ -34,4 +34,4 @@
3434
"icons/icon.ico"
3535
]
3636
}
37-
}
37+
}

src/views/Home/useViewModel.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,20 @@ export function useViewModel() {
125125
detail.style.display = 'none'
126126
element.appendChild(detail)
127127

128-
const avatar = document.createElement('img')
129-
avatar.className = 'card-avatar'
130-
avatar.src = tableData.value[i].avatar
131-
avatar.alt = 'avatar'
132-
avatar.style.width = '140px'
133-
avatar.style.height = '140px'
134-
if (!isShowAvatar.value)
135-
avatar.style.display = 'none'
136-
element.appendChild(avatar)
128+
if (isShowAvatar.value) {
129+
const avatar = document.createElement('img')
130+
avatar.className = 'card-avatar'
131+
avatar.src = tableData.value[i].avatar
132+
avatar.alt = 'avatar'
133+
avatar.style.width = '140px'
134+
avatar.style.height = '140px'
135+
element.appendChild(avatar)
136+
}
137+
else {
138+
const avatarEmpty = document.createElement('div')
139+
avatarEmpty.style.display = 'none'
140+
element.appendChild(avatarEmpty)
141+
}
137142

138143
element = useElementStyle(element, tableData.value[i], i, patternList.value, patternColor.value, cardColor.value, cardSize.value, textSize.value)
139144
const object = new CSS3DObject(element)
@@ -518,7 +523,7 @@ export function useViewModel() {
518523
* @param {string} mod 模式
519524
*/
520525
function randomBallData(mod: 'default' | 'lucky' | 'sphere' = 'default') {
521-
// 两秒执行一次
526+
// 两秒执行一次
522527
intervalTimer.value = setInterval(() => {
523528
// 产生随机数数组
524529
const indexLength = 4
@@ -576,7 +581,7 @@ export function useViewModel() {
576581
* @description: 清理资源,避免内存溢出
577582
*/
578583
function cleanup() {
579-
// 停止所有Tween动画
584+
// 停止所有Tween动画
580585
TWEEN.removeAll()
581586

582587
// 清理动画循环

src/views/Home/utils/random.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ export function getRandomElements<T>(sourceArray: T[], count: number): T[] {
4646
crypto.getRandomValues(randomBuffer)
4747
const randomIndex = randomBuffer[0] % newArray.length
4848

49+
// 添加选中的元素到结果数组
4950
result.push(newArray[randomIndex])
51+
// 从原数组中移除已选中的元素,避免重复选择
52+
newArray.splice(randomIndex, 1)
5053
}
5154

5255
return result

0 commit comments

Comments
 (0)