app
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
# Capacitor
|
||||
/android
|
||||
/ios
|
||||
.env.capacitor
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { CapacitorConfig } from '@capacitor/cli'
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'edu.mingxu.jiaowu',
|
||||
appName: '明序教务',
|
||||
webDir: 'dist',
|
||||
bundledWebRuntime: false,
|
||||
android: {
|
||||
allowMixedContent: true,
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="theme-color" content="#152550" />
|
||||
<meta name="description" content="明序大学教务管理系统" />
|
||||
<title>明序教务管理系统</title>
|
||||
|
||||
Generated
+1021
-3
File diff suppressed because it is too large
Load Diff
+11
-1
@@ -6,9 +6,18 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"preview": "vite preview"
|
||||
"build:capacitor": "vue-tsc -b && vite build --mode capacitor",
|
||||
"preview": "vite preview",
|
||||
"cap:sync": "npx cap sync",
|
||||
"cap:open:android": "npx cap open android",
|
||||
"cap:open:ios": "npx cap open ios",
|
||||
"cap:run:android": "npx cap run android",
|
||||
"cap:run:ios": "npx cap run ios"
|
||||
},
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^8.4.2",
|
||||
"@capacitor/core": "^8.4.2",
|
||||
"@capacitor/ios": "^8.4.2",
|
||||
"@ckeditor/ckeditor5-vue": "^8.2.0",
|
||||
"@element-plus/icons-vue": "^2.3.2",
|
||||
"axios": "^1.18.1",
|
||||
@@ -24,6 +33,7 @@
|
||||
"vue-router": "^4.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/cli": "^8.4.2",
|
||||
"@types/node": "^24.13.2",
|
||||
"@types/qrcode": "1.5.6",
|
||||
"@vitejs/plugin-vue": "^6.0.7",
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import { goLogin } from '../utils/navigate'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL ?? '/api',
|
||||
@@ -17,7 +18,7 @@ http.interceptors.response.use(
|
||||
if (error.response?.status === 401 && !error.config?.url?.endsWith('/auth/login')) {
|
||||
localStorage.removeItem('jiaowu_token')
|
||||
localStorage.removeItem('jiaowu_user')
|
||||
window.location.assign(`/login?redirect=${encodeURIComponent(location.pathname)}`)
|
||||
goLogin(location.pathname + location.search + location.hash)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
},
|
||||
|
||||
+6
-4
@@ -3,8 +3,10 @@ import { createPinia } from 'pinia'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { setRouter } from './utils/navigate'
|
||||
|
||||
createApp(App)
|
||||
.use(createPinia())
|
||||
.use(router)
|
||||
.mount('#app')
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
setRouter(router)
|
||||
app.mount('#app')
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
import AdminLayout from '../layouts/AdminLayout.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: import.meta.env.VITE_ROUTER_MODE === 'hash'
|
||||
? createWebHashHistory()
|
||||
: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/login',
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Router } from 'vue-router'
|
||||
|
||||
let router: Router | null = null
|
||||
|
||||
export function setRouter(r: Router): void {
|
||||
router = r
|
||||
}
|
||||
|
||||
export function goLogin(redirect: string): void {
|
||||
if (router) {
|
||||
router.push({ name: 'login', query: { redirect } })
|
||||
} else {
|
||||
window.location.assign(
|
||||
`/?redirect=${encodeURIComponent(redirect)}#/login`,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -314,8 +314,9 @@ async function showQrCode() {
|
||||
ElMessage.warning('未取得签到码,请刷新考勤表后重试。')
|
||||
return
|
||||
}
|
||||
const publicBase = import.meta.env.VITE_PUBLIC_BASE_URL ?? window.location.origin
|
||||
qrCheckInUrl.value =
|
||||
`${window.location.origin}/my-attendance?token=${encodeURIComponent(sheet.checkInToken)}`
|
||||
`${publicBase}/my-attendance?token=${encodeURIComponent(sheet.checkInToken)}`
|
||||
try {
|
||||
qrDataUrl.value = await QRCode.toDataURL(qrCheckInUrl.value, {
|
||||
width: 360,
|
||||
|
||||
@@ -610,9 +610,10 @@ function openCalendarClient() {
|
||||
function normalizeCalendarSubscription(value: any) {
|
||||
if (!value?.feedPath) return value
|
||||
const configuredBase = String(http.defaults.baseURL ?? '/api')
|
||||
const publicBase = import.meta.env.VITE_PUBLIC_BASE_URL ?? window.location.origin
|
||||
const apiBase = new URL(
|
||||
configuredBase.endsWith('/') ? configuredBase : `${configuredBase}/`,
|
||||
window.location.origin,
|
||||
publicBase,
|
||||
)
|
||||
const feedUrl = new URL(value.feedPath, apiBase).toString()
|
||||
return {
|
||||
|
||||
+34
-28
@@ -1,37 +1,43 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
AutoImport({
|
||||
resolvers: [ElementPlusResolver()],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
}),
|
||||
Components({
|
||||
resolvers: [ElementPlusResolver({ importStyle: 'css', directives: true })],
|
||||
dts: 'src/components.d.ts',
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
outDir: '../src/Jiaowu.Api/wwwroot',
|
||||
emptyOutDir: true,
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:5255',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/health': {
|
||||
target: 'http://localhost:5255',
|
||||
changeOrigin: true,
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const isCapacitor = env.VITE_ROUTER_MODE === 'hash'
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
vue(),
|
||||
AutoImport({
|
||||
resolvers: [ElementPlusResolver()],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
}),
|
||||
Components({
|
||||
resolvers: [ElementPlusResolver({ importStyle: 'css', directives: true })],
|
||||
dts: 'src/components.d.ts',
|
||||
}),
|
||||
],
|
||||
base: isCapacitor ? './' : '/',
|
||||
build: {
|
||||
outDir: isCapacitor ? 'dist' : '../src/Jiaowu.Api/wwwroot',
|
||||
emptyOutDir: true,
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:5255',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/health': {
|
||||
target: 'http://localhost:5255',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user