init
This commit is contained in:
25
frontend/user/dist/assets/index-wt7BFVvy.js
vendored
Normal file
25
frontend/user/dist/assets/index-wt7BFVvy.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
frontend/user/dist/index.html
vendored
Normal file
13
frontend/user/dist/index.html
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>QuyUn</title>
|
||||
<script type="module" crossorigin src="./assets/index-wt7BFVvy.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
13
frontend/user/index.html
Normal file
13
frontend/user/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>QuyUn</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1614
frontend/user/package-lock.json
generated
Normal file
1614
frontend/user/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
frontend/user/package.json
Normal file
23
frontend/user/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@quyun/user",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
"vue": "^3.5.13",
|
||||
"vue-router": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.10.2",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
4
frontend/user/src/App.vue
Normal file
4
frontend/user/src/App.vue
Normal file
@@ -0,0 +1,4 @@
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
8
frontend/user/src/api.ts
Normal file
8
frontend/user/src/api.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import axios from 'axios'
|
||||
import { getApiBaseURL } from './tenant'
|
||||
|
||||
export const api = axios.create({
|
||||
baseURL: getApiBaseURL(),
|
||||
withCredentials: true,
|
||||
})
|
||||
|
||||
2
frontend/user/src/env.d.ts
vendored
Normal file
2
frontend/user/src/env.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
6
frontend/user/src/main.ts
Normal file
6
frontend/user/src/main.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createApp } from 'vue'
|
||||
import { router } from './router'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).use(router).mount('#app')
|
||||
|
||||
12
frontend/user/src/router.ts
Normal file
12
frontend/user/src/router.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { getUserRouterBase } from './tenant'
|
||||
import HomePage from './views/HomePage.vue'
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(getUserRouterBase()),
|
||||
routes: [
|
||||
{ path: '/', component: HomePage },
|
||||
{ path: '/:pathMatch(.*)*', redirect: '/' },
|
||||
],
|
||||
})
|
||||
|
||||
16
frontend/user/src/tenant.ts
Normal file
16
frontend/user/src/tenant.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export function getTenantCodeFromPath(pathname = window.location.pathname): string {
|
||||
const parts = pathname.split('/').filter(Boolean)
|
||||
if (parts.length < 2 || parts[0] !== 't') return ''
|
||||
return decodeURIComponent(parts[1] || '').toLowerCase()
|
||||
}
|
||||
|
||||
export function getUserRouterBase(pathname = window.location.pathname): string {
|
||||
const tenantCode = getTenantCodeFromPath(pathname)
|
||||
return `/t/${tenantCode}/`
|
||||
}
|
||||
|
||||
export function getApiBaseURL(pathname = window.location.pathname): string {
|
||||
const tenantCode = getTenantCodeFromPath(pathname)
|
||||
return `/t/${tenantCode}/v1`
|
||||
}
|
||||
|
||||
20
frontend/user/src/views/HomePage.vue
Normal file
20
frontend/user/src/views/HomePage.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<main style="padding: 16px">
|
||||
<h1 style="font-size: 20px; font-weight: 600">QuyUn</h1>
|
||||
<p style="margin-top: 8px; color: #666">
|
||||
Router base: <code>{{ base }}</code>
|
||||
</p>
|
||||
<p style="margin-top: 4px; color: #666">
|
||||
API baseURL: <code>{{ apiBase }}</code>
|
||||
</p>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { getApiBaseURL, getUserRouterBase } from '../tenant'
|
||||
|
||||
const base = computed(() => getUserRouterBase())
|
||||
const apiBase = computed(() => getApiBaseURL())
|
||||
</script>
|
||||
|
||||
18
frontend/user/tsconfig.json
Normal file
18
frontend/user/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
"strict": true,
|
||||
"types": ["vite/client"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
11
frontend/user/vite.config.ts
Normal file
11
frontend/user/vite.config.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
base: './',
|
||||
server: {
|
||||
port: 5174,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user