- Add scan login service with Redis-based token management - Add scan login API routes for token generation and validation - Add QRCodeLogin component for PC-side QR code display - Add EntryQRCode component for mass login scenarios - Add ScanLoginView for mobile-side login form - Add localStorage persistence for user identity - Add logout functionality to mobile client - Add auto-redirect for logged-in users - Add admin console control for QR code display on big screen - Add socket event forwarding from admin to screen display Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
93 lines
2.2 KiB
TypeScript
93 lines
2.2 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import Components from 'unplugin-vue-components/vite';
|
|
import AutoImport from 'unplugin-auto-import/vite';
|
|
import { VantResolver } from '@vant/auto-import-resolver';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
import { resolve } from 'path';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
imports: ['vue', 'vue-router', 'pinia'],
|
|
dts: 'src/auto-imports.d.ts',
|
|
}),
|
|
Components({
|
|
resolvers: [VantResolver()],
|
|
dts: 'src/components.d.ts',
|
|
}),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.ico', 'apple-touch-icon.png'],
|
|
manifest: {
|
|
name: '年会互动系统',
|
|
short_name: '年会投票',
|
|
description: '公司年会投票与抽奖互动系统',
|
|
theme_color: '#c41230',
|
|
background_color: '#ffffff',
|
|
display: 'standalone',
|
|
icons: [
|
|
{
|
|
src: 'pwa-192x192.png',
|
|
sizes: '192x192',
|
|
type: 'image/png',
|
|
},
|
|
{
|
|
src: 'pwa-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
},
|
|
],
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/api\./i,
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-cache',
|
|
expiration: {
|
|
maxEntries: 100,
|
|
maxAgeSeconds: 60 * 60, // 1 hour
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5174,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
'/socket.io': {
|
|
target: 'http://localhost:3000',
|
|
ws: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
target: 'es2020',
|
|
minify: 'terser',
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
vue: ['vue', 'vue-router', 'pinia'],
|
|
vant: ['vant'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|