From 1681931812f11a8d4cd2fb3ddbe60bdbe540b36a Mon Sep 17 00:00:00 2001 From: haha Date: Sat, 24 Feb 2024 21:00:06 +0800 Subject: [PATCH] update code --- yanzhu-admin/src/main/resources/application-druid.yml | 2 +- yanzhu-ui/.env.development | 2 +- yanzhu-ui/.env.production | 2 +- yanzhu-ui/src/layout/components/Navbar.vue | 4 ++-- yanzhu-ui/src/router/index.js | 2 +- yanzhu-ui/src/views/login.vue | 8 ++++++-- yanzhu-ui/vue.config.js | 5 +++-- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/yanzhu-admin/src/main/resources/application-druid.yml b/yanzhu-admin/src/main/resources/application-druid.yml index 1fced24..6221291 100644 --- a/yanzhu-admin/src/main/resources/application-druid.yml +++ b/yanzhu-admin/src/main/resources/application-druid.yml @@ -19,7 +19,7 @@ server: port: 8080 servlet: # 应用的访问路径 - context-path: / + context-path: /prjapi tomcat: # tomcat的URI编码 uri-encoding: UTF-8 diff --git a/yanzhu-ui/.env.development b/yanzhu-ui/.env.development index edb5851..c84c48e 100644 --- a/yanzhu-ui/.env.development +++ b/yanzhu-ui/.env.development @@ -5,7 +5,7 @@ VUE_APP_TITLE = 研筑临时项目管理系统 ENV = 'development' # 研筑临时项目管理系统/开发环境 -VUE_APP_BASE_API = '/dev-api' +VUE_APP_BASE_API = '/prjapi' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/yanzhu-ui/.env.production b/yanzhu-ui/.env.production index ecce34d..f30d802 100644 --- a/yanzhu-ui/.env.production +++ b/yanzhu-ui/.env.production @@ -5,4 +5,4 @@ VUE_APP_TITLE = 研筑临时项目管理系统 ENV = 'production' # 研筑临时项目管理系统/生产环境 -VUE_APP_BASE_API = '/prod-api' +VUE_APP_BASE_API = '/prjapi' diff --git a/yanzhu-ui/src/layout/components/Navbar.vue b/yanzhu-ui/src/layout/components/Navbar.vue index 4eeb58f..f72bbdc 100644 --- a/yanzhu-ui/src/layout/components/Navbar.vue +++ b/yanzhu-ui/src/layout/components/Navbar.vue @@ -96,8 +96,8 @@ export default { cancelButtonText: '取消', type: 'warning' }).then(() => { - this.$store.dispatch('LogOut').then(() => { - location.href = '/index'; + this.$store.dispatch('LogOut').then(() => { + location.href = '#/login'; }) }).catch(() => {}); } diff --git a/yanzhu-ui/src/router/index.js b/yanzhu-ui/src/router/index.js index 2fff786..95b51f4 100644 --- a/yanzhu-ui/src/router/index.js +++ b/yanzhu-ui/src/router/index.js @@ -255,7 +255,7 @@ Router.prototype.replace = function push(location) { } export default new Router({ - mode: 'history', // 去掉url中的# + mode: 'hash', // 去掉url中的# scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) diff --git a/yanzhu-ui/src/views/login.vue b/yanzhu-ui/src/views/login.vue index 6781a93..74ebb74 100644 --- a/yanzhu-ui/src/views/login.vue +++ b/yanzhu-ui/src/views/login.vue @@ -72,8 +72,8 @@ export default { return { codeUrl: "", loginForm: { - username: "admin", - password: "admin123", + username: "", + password: "", rememberMe: false, code: "", uuid: "" @@ -104,6 +104,10 @@ export default { } }, created() { + if(location.href.indexOf("localhost")>0){ + this.loginForm.username="admin"; + this.loginForm.password="admin123"; + } this.getCode(); this.getCookie(); }, diff --git a/yanzhu-ui/vue.config.js b/yanzhu-ui/vue.config.js index e60b6a1..09e6073 100644 --- a/yanzhu-ui/vue.config.js +++ b/yanzhu-ui/vue.config.js @@ -18,7 +18,7 @@ module.exports = { // 部署生产环境和开发环境下的URL。 // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 例如 https://www.yanZhu.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.yanZhu.vip/admin/,则设置 baseUrl 为 /admin/。 - publicPath: process.env.NODE_ENV === "production" ? "/" : "/", + publicPath: process.env.NODE_ENV === "production" ? "/prjapp" : "/prjapp", // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) outputDir: 'dist', // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) @@ -35,7 +35,8 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, + //target: `http://localhost:8080${process.env.VUE_APP_BASE_API}`, + target: `http://49.235.181.228${process.env.VUE_APP_BASE_API}`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: ''