소스 검색

前端页面搭建

john 8 달 전
부모
커밋
4aa1f39645

+ 2 - 1
deployment.sh

@@ -9,7 +9,8 @@ save_file_name="$version-$current_git_branch_latest_short_id.tar"
 
 # 执行命令
 cd ./frontEndMobile && npm run build
-# copy -rf ./dist ../node_expores/public
+rm -rf ../node_expores/public
+cp -rf ./dist ../node_expores/public
 # docker build -t $docker_name .
 # cd ../
 # docker save -o ./$save_file_name $docker_name

+ 2 - 2
frontEndMobile/package.json

@@ -5,7 +5,7 @@
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
     "dev": "vite",
-    "build": "vue-tsc -b && vite build",
+    "build": "vue-tsc -noEmit && vite build",
     "preview": "vite preview"
   },
   "keywords": [],
@@ -16,7 +16,7 @@
     "registry": "https://registry.npmmirror.com"
   },
   "dependencies": {
-    "pina": "^0.20.2204228",
+    "pinia": "^2.1.7",
     "vant": "^4.9.8",
     "vue": "^3.5.12",
     "vue-router": "^4.4.5"

+ 4 - 0
frontEndMobile/src/main.ts

@@ -4,6 +4,8 @@ import vant from 'vant'
 // 2. 引入组件样式
 import 'vant/lib/index.css'
 
+import { createPinia } from 'pinia'
+
 import {setupRouter} from './router'
 
 import { setupStore } from './store'
@@ -11,10 +13,12 @@ import { setupStore } from './store'
 import './style.css'
 import App from './App.vue'
 
+const pinia = createPinia()
 const app = createApp(App)
 
 setupRouter(app);
 setupStore(app);
+app.use(pinia)
 app.use(vant)
 app.use(vant)
 app.mount('#app')

+ 3 - 1
frontEndMobile/src/router/routes/index.ts

@@ -2,12 +2,14 @@ import type { RouteRecordRaw } from 'vue-router'
 
 // 获取modules中的路由规则
 // https://cn.vitejs.dev/guide/features.html#glob-import
-const modules = import.meta.globEager('./modules/**/*.ts')
+const modules = import.meta.glob('./modules/**/*.ts', { eager: true }) as any
+console.log(66666, modules);
 
 // modules routes
 const routes: RouteRecordRaw[] = []
 
 Object.keys(modules).forEach((key) => {
+  console.log(12, key)
   const modulesRoutes = modules[key].default || {}
 
   let modRoutesList = []

+ 0 - 0
frontEndMobile/src/views/common/HomePage.vue → frontEndMobile/src/views/HomePage.vue


+ 0 - 0
frontEndMobile/src/views/common/LoginPage.vue → frontEndMobile/src/views/LoginPage.vue


+ 6 - 10
frontEndMobile/tsconfig.json

@@ -1,11 +1,10 @@
 {
   "compilerOptions": {
-    "target": "esnext",
+    "target": "ESNext",
     "useDefineForClassFields": true,
-    "module": "esnext",
-    "moduleResolution": "node",
-    "types": ["node", "vite/client", "pinia"], // 添加 Node.js 类型
-    "strict": true,
+    "module": "ESNext",
+    "moduleResolution": "Node",
+    "strict": false,
     "jsx": "preserve",
     "sourceMap": true,
     "resolveJsonModule": true,
@@ -18,9 +17,6 @@
       "@/*": ["src/*"]
     }
   },
-  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
-  "references": [
-    { "path": "./tsconfig.app.json" },
-    { "path": "./tsconfig.node.json" }
-  ]
+  "include": ["src/**/*.ts", "src/**/*.d.ts","src/**/*.vue"],
+  "references": [{ "path": "./tsconfig.node.json" }]
 }

+ 4 - 20
frontEndMobile/tsconfig.node.json

@@ -1,25 +1,9 @@
 {
   "compilerOptions": {
-    "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
-    "target": "ES2022",
-    "lib": ["ES2023"],
-    "module": "ESNext",
-    "skipLibCheck": true,
-
-    /* Bundler mode */
-    "moduleResolution": "Bundler",
-    "allowImportingTsExtensions": true,
-    "isolatedModules": true,
-    "moduleDetection": "force",
-
-    /* Linting */
-    "strict": true,
-    "noUnusedLocals": true,
-    "noUnusedParameters": true,
-    "noFallthroughCasesInSwitch": true,
-    "noUncheckedSideEffectImports": true,
-
     "composite": true,
+    "module": "ESNext",
+    "moduleResolution": "Node",
+    "allowSyntheticDefaultImports": true
   },
-  "include": ["vite.config.ts", "src/**/*"]
+  "include": ["vite.config.ts"]
 }

+ 2 - 2
frontEndMobile/vite.config.ts

@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
 
 
 // 获取当前文件的目录
-const __dirname = dirname(fileURLToPath(import.meta.url));
+// const __dirname = dirname(fileURLToPath(import.meta.url));
 
 // https://vitejs.dev/config/
 export default defineConfig({
@@ -17,7 +17,7 @@ export default defineConfig({
   plugins: [vue()],
   server: {
     host: 'localhost',
-    port: 3000,
+    port: 3031,
     open: true // 启动服务时自动打开浏览器
   },
   build: {

+ 13 - 5
frontEndMobile/yarn.lock

@@ -342,7 +342,7 @@
     de-indent "^1.0.2"
     he "^1.2.0"
 
-"@vue/devtools-api@^6.6.4":
+"@vue/devtools-api@^6.6.3", "@vue/devtools-api@^6.6.4":
   version "6.6.4"
   resolved "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.6.4.tgz#cbe97fe0162b365edc1dba80e173f90492535343"
   integrity sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==
@@ -522,10 +522,13 @@ picocolors@^1.1.1:
   resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
   integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
 
-pina@^0.20.2204228:
-  version "0.20.2204228"
-  resolved "https://registry.npmmirror.com/pina/-/pina-0.20.2204228.tgz#b57ff2862142f90c2b891396bdcfd21a17eb7385"
-  integrity sha512-osNVZg36DsDAEPHskmnTINhM5APSLsu+y8guYYX65nidbRPmnv/trAoPnacpfh8aCpsowGWR/DAYtQHZyZq8wQ==
+pinia@^2.1.7:
+  version "2.2.6"
+  resolved "https://registry.npmmirror.com/pinia/-/pinia-2.2.6.tgz#ff93f35b8c02033eaedc8c92ad5f10f215d6c804"
+  integrity sha512-vIsR8JkDN5Ga2vAxqOE2cJj4VtsHnzpR1Fz30kClxlh0yCHfec6uoMeM3e/ddqmwFUejK3NlrcQa/shnpyT4hA==
+  dependencies:
+    "@vue/devtools-api" "^6.6.3"
+    vue-demi "^0.14.10"
 
 postcss@^8.4.43, postcss@^8.4.47:
   version "8.4.48"
@@ -620,6 +623,11 @@ vscode-uri@^3.0.8:
   resolved "https://registry.npmmirror.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f"
   integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==
 
+vue-demi@^0.14.10:
+  version "0.14.10"
+  resolved "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.10.tgz#afc78de3d6f9e11bf78c55e8510ee12814522f04"
+  integrity sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==
+
 vue-router@^4.4.5:
   version "4.4.5"
   resolved "https://registry.npmmirror.com/vue-router/-/vue-router-4.4.5.tgz#bdf535e4cf32414ebdea6b4b403593efdb541388"

+ 1 - 0
node_expores/.gitignore

@@ -2,3 +2,4 @@ node_modules
 base_files/*
 *.tar
 pm2Log/*
+public/*

+ 4 - 0
node_expores/app.js

@@ -15,6 +15,8 @@ import { generateToken, verifyToken } from "#utils";
 const port = 3000;
 const app = express();
 const json = express.json({type: '*/json'})
+// 设置静态文件目录
+app.use(express.static('public'));
 
 // 全局启用 CORS
 const corsOptions = {
@@ -27,6 +29,8 @@ app.use(fileUpload());
 app.use(json);
 app.use(bodyParser.urlencoded({extended: false}));
 
+
+
 app.get("/", (req, res) => {
   res.send("Hello World!");
 });