diff --git a/flossom-ui/package.json b/flossom-ui/package.json index 2827a72..f7945b0 100644 --- a/flossom-ui/package.json +++ b/flossom-ui/package.json @@ -5,7 +5,8 @@ "author": "花至", "license": "MIT", "scripts": { - "dev": "vue-cli-service serve", + "local": "vue-cli-service serve --mode local", + "dev": "vue-cli-service serve --mode development", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", diff --git a/flossom-ui/src/permission.js b/flossom-ui/src/permission.js index 8f2d2ee..6ca9cc4 100644 --- a/flossom-ui/src/permission.js +++ b/flossom-ui/src/permission.js @@ -43,15 +43,13 @@ router.beforeEach((to, from, next) => { } } } else { - next(); - // 没有token - // if (whiteList.indexOf(to.path) !== -1) { - // // 在免登录白名单,直接进入 - // next() - // } else { - // next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 - // NProgress.done() - // } + if (whiteList.indexOf(to.path) !== -1) { + // 在免登录白名单,直接进入 + next(); + } else { + next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页 + NProgress.done(); + } } }); diff --git a/flossom-ui/vue.config.js b/flossom-ui/vue.config.js index 4858f78..7a45fff 100644 --- a/flossom-ui/vue.config.js +++ b/flossom-ui/vue.config.js @@ -11,6 +11,14 @@ const name = process.env.VUE_APP_TITLE || "花至管理系统"; // 网页标题 const port = process.env.port || process.env.npm_config_port || 80; // 端口 +function getTargetUrl() { + if (process.env.NODE_ENV === "local") { + return "http://110.41.134.131:8080"; + } else { + return `http://localhost:8080`; + } +} + // vue.config.js 配置说明 //官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions // 这里只列一部分,具体配置参考文档