Merge branch '94-添加软件打包tauri' into dev
3
.gitignore
vendored
@@ -79,6 +79,8 @@ web_modules/
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
components.d.ts
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
@@ -90,6 +92,7 @@ out
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
dist-file
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
|
||||
22
package.json
@@ -25,7 +25,7 @@
|
||||
"github-markdown-css": "^5.8.0",
|
||||
"localforage": "^1.10.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"lucide-vue-next": "^0.555.0",
|
||||
"lucide-vue-next": "^0.556.0",
|
||||
"markdown-it": "^14.1.0",
|
||||
"pinia": "^3.0.3",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
@@ -36,7 +36,7 @@
|
||||
"vue": "^3.5.13",
|
||||
"vue-dompurify-html": "^5.2.0",
|
||||
"vue-draggable-plus": "^0.6.0",
|
||||
"vue-i18n": "^11.1.12",
|
||||
"vue-i18n": "^11.2.2",
|
||||
"vue-router": "^4.5.0",
|
||||
"vue-toast-notification": "^3",
|
||||
"vue3-colorpicker": "^2.3.0",
|
||||
@@ -51,25 +51,27 @@
|
||||
"@iconify-json/fluent": "^1.2.8",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"@tailwindcss/vite": "^4.1.13",
|
||||
"@tauri-apps/cli": "^2.9.5",
|
||||
"@testing-library/vue": "^8.1.0",
|
||||
"@types/canvas-confetti": "^1.6.4",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/markdown-it": "^14.1.2",
|
||||
"@types/node": "^24.5.2",
|
||||
"@types/node": "^24.10.2",
|
||||
"@types/three": "^0.166.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.16.0",
|
||||
"@typescript-eslint/parser": "^8.16.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
||||
"@typescript-eslint/parser": "^8.49.0",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-vue": "^6.0.1",
|
||||
"@vitest/ui": "^4.0.15",
|
||||
"@vue/test-utils": "^2.4.6",
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"baseline-browser-mapping": "^2.8.32",
|
||||
"daisyui": "^5.1.13",
|
||||
"eslint": "^9.15.0",
|
||||
"eslint-plugin-vue": "^10.4.0",
|
||||
"globals": "^16.4.0",
|
||||
"happy-dom": "^18.0.1",
|
||||
"happy-dom": "^20.0.11",
|
||||
"husky": "^9.1.7",
|
||||
"jsdom": "^27.0.0",
|
||||
"path": "^0.12.7",
|
||||
@@ -77,18 +79,18 @@
|
||||
"rollup-plugin-visualizer": "^6.0.3",
|
||||
"sass": "^1.81.0",
|
||||
"sass-loader": "^16.0.3",
|
||||
"tailwindcss": "^4.1.13",
|
||||
"tailwindcss": "^4.1.17",
|
||||
"terser": "^5.36.0",
|
||||
"typescript": "5.5.3",
|
||||
"typescript": "~5.9.3",
|
||||
"unplugin-auto-import": "^20.1.0",
|
||||
"unplugin-icons": "^22.3.0",
|
||||
"unplugin-vue-components": "^29.1.0",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.1.6",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-inspect": "^11.3.3",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vite-plugin-vue-devtools": "^8.0.2",
|
||||
"vitest": "^3.2.4",
|
||||
"vitest": "^4.0.15",
|
||||
"vue-tsc": "^3.0.7"
|
||||
}
|
||||
}
|
||||
1205
pnpm-lock.yaml
generated
4
src-tauri/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
/gen/schemas
|
||||
5005
src-tauri/Cargo.lock
generated
Normal file
29
src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = [ "you" ]
|
||||
license = ""
|
||||
repository = ""
|
||||
edition = "2021"
|
||||
rust-version = "1.77.2"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
name = "app_lib"
|
||||
crate-type = [
|
||||
"staticlib",
|
||||
"cdylib",
|
||||
"rlib"
|
||||
]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.5.3", features = [] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
log = "0.4"
|
||||
tauri = { version = "2.9.4", features = [] }
|
||||
tauri-plugin-log = "2"
|
||||
3
src-tauri/build.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
11
src-tauri/capabilities/default.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "enables the default permissions",
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default"
|
||||
]
|
||||
}
|
||||
BIN
src-tauri/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src-tauri/icons/64x64.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
</adaptive-icon>
|
||||
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 106 KiB |
BIN
src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#fff</color>
|
||||
</resources>
|
||||
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
src-tauri/icons/icon.png
Normal file
|
After Width: | Height: | Size: 137 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@1x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@2x-1.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@2x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@3x.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@1x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@2x-1.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@2x.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@3x.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@1x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@2x-1.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@2x.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@3x.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/ios/AppIcon-512@2x.png
Normal file
|
After Width: | Height: | Size: 338 KiB |
BIN
src-tauri/icons/ios/AppIcon-60x60@2x.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/ios/AppIcon-60x60@3x.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src-tauri/icons/ios/AppIcon-76x76@1x.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-76x76@2x.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
16
src-tauri/src/lib.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
if cfg!(debug_assertions) {
|
||||
app.handle().plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.level(log::LevelFilter::Info)
|
||||
.build(),
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
6
src-tauri/src/main.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
app_lib::run();
|
||||
}
|
||||
37
src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "log-lottery",
|
||||
"version": "0.1.0",
|
||||
"identifier": "to2026.xyz",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:6719/log-lottery",
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
"beforeBuildCommand": "pnpm build"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "log-lottery",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"resizable": true,
|
||||
"fullscreen": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
||||
5
src/components.d.ts
vendored
@@ -1,8 +1,11 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// biome-ignore lint: disable
|
||||
// oxlint-disable
|
||||
// ------
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
// biome-ignore lint: disable
|
||||
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
|
||||
@@ -113,6 +113,10 @@ export const configRoutes = {
|
||||
],
|
||||
}
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/log-lottery',
|
||||
},
|
||||
{
|
||||
path: '/log-lottery',
|
||||
component: Layout,
|
||||
@@ -135,7 +139,7 @@ const routes = [
|
||||
const envMode = import.meta.env.MODE
|
||||
const router = createRouter({
|
||||
// 读取环境变量
|
||||
history: envMode === 'file' ? createWebHashHistory() : createWebHistory(),
|
||||
history: (envMode === 'file' || import.meta.env.TAURI_PLATFORM) ? createWebHashHistory() : createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { IPersonConfig, IPrizeConfig } from '@/types/storeType'
|
||||
|
||||
const originUrl = 'https://to2026.xyz'
|
||||
|
||||
export const defaultPersonList = <IPersonConfig[]>
|
||||
type IPersonConfigWithoutUuid = Omit<IPersonConfig, 'uuid'>
|
||||
export const defaultPersonList = <IPersonConfigWithoutUuid[]>
|
||||
[
|
||||
{ uid: 'U100156001', name: '朱厚熜', department: '皇室', identity: '万岁爷', avatar: 'https://img1.baidu.com/it/u=2165937980,813753762&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', x: 1, y: 1, id: 0, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] },
|
||||
{ uid: 'U100156002', name: '朱载垕', department: '皇室', identity: '裕王', avatar: 'https://img1.baidu.com/it/u=2165937980,813753762&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', x: 2, y: 1, id: 1, isWin: false, createTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', updateTime: 'Tue Jan 09 2024 23:20:07 GMT+0800 (China Standard Time)', prizeName: [], prizeTime: [], prizeId: [] },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { IPersonConfig, IPrizeConfig } from '@/types/storeType'
|
||||
import dayjs from 'dayjs'
|
||||
import { defineStore } from 'pinia'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { computed, ref, toRaw, watch } from 'vue'
|
||||
import { IndexDb } from '@/utils/dexie'
|
||||
import { defaultPersonList } from './data'
|
||||
@@ -150,7 +151,10 @@ export const usePersonConfig = defineStore('person', () => {
|
||||
personDb.deleteAll('alreadyPersonList')
|
||||
}
|
||||
function setDefaultPersonList() {
|
||||
personConfig.value.allPersonList = defaultPersonList
|
||||
personConfig.value.allPersonList = defaultPersonList.map((item: any) => {
|
||||
item.uuid = uuidv4()
|
||||
return item
|
||||
})
|
||||
personConfig.value.alreadyPersonList = []
|
||||
personDb.setAllData('allPersonList', defaultPersonList)
|
||||
personDb.deleteAll('alreadyPersonList')
|
||||
|
||||
@@ -22,9 +22,8 @@ const process = require('node:process')
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, __dirname)
|
||||
const chunkName = mode === 'prebuild' ? '[name]' : 'chunk'
|
||||
|
||||
return {
|
||||
base: mode === 'file' ? './' : '/log-lottery/',
|
||||
base: (mode === 'file' || process.env.TAURI_ENV_PLATFORM) ? './' : '/log-lottery/',
|
||||
plugins: [
|
||||
vue(),
|
||||
tailwindcss(),
|
||||
@@ -90,9 +89,15 @@ export default defineConfig(({ mode }) => {
|
||||
// ]
|
||||
// }
|
||||
},
|
||||
clearScreen: false,
|
||||
server: {
|
||||
host: 'localhost',
|
||||
port: 6719,
|
||||
strictPort: true,
|
||||
watch: {
|
||||
// 告诉 Vite 忽略监听 `src-tauri` 目录
|
||||
ignored: ['**/src-tauri/**'],
|
||||
},
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: env.VITE_BASE_URL,
|
||||
@@ -103,6 +108,8 @@ export default defineConfig(({ mode }) => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// 添加有关当前构建目标的额外前缀,使这些 CLI 设置的 Tauri 环境变量可以在客户端代码中访问
|
||||
envPrefix: ['VITE_', 'TAURI_ENV_*'],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
@@ -110,7 +117,13 @@ export default defineConfig(({ mode }) => {
|
||||
},
|
||||
build: {
|
||||
outDir: mode === 'file' ? 'dist-file' : 'dist',
|
||||
minify: 'terser',
|
||||
// Tauri 在 Windows 上使用 Chromium,在 macOS 和 Linux 上使用 WebKit
|
||||
// target: (process.env.TAURI_ENV_PLATFORM && mode !== 'file')
|
||||
// ? (process.env.TAURI_ENV_PLATFORM === 'windows' ? 'chrome105' : 'safari13')
|
||||
// : 'es2020', // 普通前端可使用更高版本 JS 支持
|
||||
minify: process.env.TAURI_ENV_PLATFORM
|
||||
? (!process.env.TAURI_ENV_DEBUG ? 'esbuild' : false)
|
||||
: 'terser', // 普通构建推荐使用 terser 提供更强压缩选项
|
||||
terserOptions: {
|
||||
compress: {
|
||||
// 生产环境时移除console
|
||||
@@ -121,7 +134,7 @@ export default defineConfig(({ mode }) => {
|
||||
// 关闭文件计算
|
||||
reportCompressedSize: false,
|
||||
// 关闭生成map文件 可以达到缩小打包体积
|
||||
sourcemap: false, // 这个生产环境一定要关闭,不然打包的产物会很大
|
||||
sourcemap: process.env.NODE_ENV === 'development' || !!process.env.TAURI_ENV_DEBUG, // 这个生产环境一定要关闭,不然打包的产物会很大
|
||||
rollupOptions: {
|
||||
output: {
|
||||
chunkFileNames: `js/${chunkName}-[hash].js`, // 引入文件名的名称
|
||||
@@ -145,6 +158,7 @@ export default defineConfig(({ mode }) => {
|
||||
environment: 'jsdom',
|
||||
// include: ['**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
||||
// passWithNoTests: true,
|
||||
testTimeout: 10000,
|
||||
transformMode: {
|
||||
web: [/\.[jt]sx$/],
|
||||
},
|
||||
|
||||