4 Commits 772e721040 ... c1d72faf00

Author SHA1 Message Date
  sunjian c1d72faf00 edit 4 months ago
  sunjian 7bfe18fbe3 edit 4 months ago
  sunjian 85049a0d86 edit 4 months ago
  sunjian a248694f4d add 4 months ago
4 changed files with 40 additions and 17 deletions
  1. 11 11
      App.vue
  2. 2 2
      config.js
  3. 6 4
      manifest.json
  4. 21 0
      vite.config.js

+ 11 - 11
App.vue

@@ -1,17 +1,17 @@
 <script>
 	export default {
 		onLaunch: function() {
-			console.log('App Launch')
-			const path = this.$route.path;
-			console.log(path)
-			    if (path === '/') {
-			      uni.redirectTo({ url: '/pages/' });
-			    } else if (path === '/pages/canteenBackend') {
-				   console.log("满足这个路径")
-			      uni.redirectTo({ url: '/pages/backend/backend' });
-			    } else {
-			      uni.redirectTo({ url: '/pages/index/main' }); // 默认入口
-			    }
+			// console.log('App Launch')
+			// const path = this.$route.path;
+			// console.log(path)
+			//     if (path === '/') {
+			//       uni.redirectTo({ url: '/pages/index/index' });
+			//     } else if (path === '/pages/canteenBackend') {
+			// 	   console.log("满足这个路径")
+			//       uni.redirectTo({ url: '/pages/backend/backend' });
+			//     } else {
+			//       uni.redirectTo({ url: '/pages/index/index' }); // 默认入口
+			//     }
 		},
 		onShow: function() {
 			console.log('App Show')

+ 2 - 2
config.js

@@ -1,3 +1,3 @@
 // config.js (使用ES6模块语法)
-export const baseUrl = 'http://10.201.2.161:9400/centtenAdvise';
-export const imageBaseUrl = 'http://10.200.1.115:9000/canttenadvice/'
+export const baseUrl = '/api';
+export const imageBaseUrl = '/uploadApi'

+ 6 - 4
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "canteenproblemFeedback",
-    "appid" : "__UNI__9C10680",
+    "appid" : "__UNI__5ABF99B",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : "100",
@@ -71,15 +71,16 @@
     "vueVersion" : "3",
     "h5" : {
         "devServer" : {
-            "port" : 8080,
             "https" : false,
             "disableHostCheck" : true,
+            "port" : 9002,
             "proxy" : {
                 "/api" : {
                     //api是需要转发的请求(所有带有 /api 前缀的请求都会转发给 target 后的地址 (代理2)
                     "target" : "http://10.201.2.161:9400/centtenAdvise", // 你的目标接口域名
                     "changeOrigin" : true, // 开启代理
-                    "secure" : true, //
+                    "secure" : false,
+                    "ws" : false,
                     "pathRewrite" : {
                         //去除请求前缀,保证交给后台服务器的是正常请求地址(必须配置)
                         "^/api" : ""
@@ -88,7 +89,8 @@
             }
         },
         "router" : {
-            "base" : "canteenAdvise"
+            "base" : "./",
+            "mode" : "history"
         }
     },
     "locale" : "zh-Hans",

+ 21 - 0
vite.config.js

@@ -0,0 +1,21 @@
+import { defineConfig } from 'vite';
+import uni from '@dcloudio/vite-plugin-uni';
+ 
+export default defineConfig({
+	plugins: [uni()],
+	base:'/',
+	server: {
+		proxy: {
+			'/api': {
+				target: 'http://10.201.2.161:9400/centtenAdvise',
+				changeOrigin: true,
+				rewrite: (path) => path.replace(/^\/api/, '')
+			},
+			'/uploadApi':{
+				target: 'http://10.200.1.115:9000/canttenadvice/',
+				changeOrigin: true,
+				rewrite: (path) => path.replace(/^\/uploadApi/, '')
+			}
+		}
+	}
+});