New file |
| | |
| | | # 所有环境默认 |
| | | |
| | | # 页面 title 前缀 |
| | | VUE_APP_TITLE=Basic |
| | | NODE_ENV=development |
| | | VUE_APP_BATH_PATH='http://192.168.20.119:9084' |
| | | # 网络请求公用地址 |
| | | VUE_APP_API=/api/ |
| | | |
| | | # 仓库地址 |
| | | VUE_APP_REPO="" |
| | | |
| | | # 国际化配置 |
| | | VUE_APP_I18N_LOCALE=zh-chs |
| | | VUE_APP_I18N_FALLBACK_LOCALE=en |
| | | |
| | | # element 颜色 |
| | | VUE_APP_ELEMENT_COLOR=#2A78FB |
New file |
| | |
| | | # 开发环境 |
| | | # 指定构建模式 |
| | | NODE_ENV=development |
| | | |
| | | # 页面 title 前缀 |
| | | VUE_APP_TITLE=Basic |
| | | VUE_APP_BATH_PATH='http://192.168.20.119:9084' |
| | | |
New file |
| | |
| | | # 构建预览页面 |
| | | |
| | | # 指定构建模式 |
| | | NODE_ENV=production |
| | | |
| | | # 标记当前构建方式 |
| | | VUE_APP_BUILD_MODE=PREVIEW |
| | | VUE_APP_BATH_PATH='http://www.fai365.com:9084 |
| | | VUE_APP_SCOURCE_LINK=TRUE |
| | | |
| | | # 部署路径 |
| | | VUE_APP_PUBLIC_PATH=/ |
| | |
| | | # 页面 title 前缀 |
| | | VUE_APP_TITLE=Basic |
| | | VUE_APP_BATH_PATH='http://192.168.20.119:9084' |
| | | # aps本地端口号 |
| | | VUE_APP_APS_PORT=9080 |
| | | |
New file |
| | |
| | | import router from '@/router'; |
| | | export const getPortFromUrl=(url) =>{ |
| | | try { |
| | | const portPattern = /:\d+/; |
| | | const urlObj = new URL(url); |
| | | const portMatch = portPattern.exec(urlObj.host)[0].slice(1); // 去掉冒号 |
| | | return parseInt(portMatch, 10); // 转换为整数 |
| | | } catch (error) { |
| | | console.error(error.message); |
| | | return null; |
| | | } |
| | | }; |
| | | export const doHostName=(hostname)=>{ |
| | | /* if(hostname.includes('localhost')){ |
| | | return hostname; |
| | | }*/ |
| | | return hostname.substring(hostname.indexOf(".")+1); |
| | | }; |
| | | export const getApsPage = () => { |
| | | // 首页部署在各个环境的端口 |
| | | /* const loginPathMap = { |
| | | prod:`//${window.location.hostname}:9080`, |
| | | test:`//192.168.20.119:9080`, |
| | | // 想跳到本地启动的登录页的话需要把dev改成你本地项目路径 |
| | | dev: `//192.168.8.112:8080` |
| | | };*/ |
| | | //return loginPathMap[environmentType()] |
| | | let port=getPortFromUrl(window.location.href);//获得端口号 |
| | | let hostname=window.location.hostname;// 一级域名 |
| | | if(hostname.includes('fai365.com')||hostname.includes('smartai.com')||hostname.includes('navicat.com')) {// 代表存在域名 |
| | | hostname='aps.'+doHostName(hostname); |
| | | } |
| | | if(hostname.includes('localhost')){ |
| | | port=process.env.VUE_APP_APS_PORT;//端口号与 .env.development 中 VUE_APP_APS_PORT 跟本地aps项目的端口号保持一致 |
| | | } |
| | | if(router.mode==='history'){ |
| | | if(port){ |
| | | return `${hostname}:${port}`; |
| | | }else{ |
| | | return `${hostname}`; |
| | | } |
| | | }else{ |
| | | if(port){ |
| | | return `${hostname}:${port}`+'/#'; |
| | | }else{ |
| | | return `${hostname}`+'/#'; |
| | | } |
| | | } |
| | | }; |
| | |
| | | import axios from "axios" |
| | | import { Message } from "element-ui" |
| | | |
| | | import {getApsPage} from './index.js'; |
| | | // import router from '@/router' |
| | | // 开发环境下将自己的token复制到这里, 也可以在浏览器中手动添加token到cookie中,cookie中的token优先 |
| | | const DEV_TOKEN = '' |
| | |
| | | responseType: "json", |
| | | withCredentials: true // 是否允许带cookie这些 |
| | | }) |
| | | const getApsPage = () => { |
| | | /*const getApsPage = () => { |
| | | // 首页部署在各个环境的端口 |
| | | const loginPathMap = { |
| | | prod:`//${window.location.hostname}:9080`, |
| | |
| | | dev: `//192.168.8.117:8080` |
| | | } |
| | | return loginPathMap[environmentType()] |
| | | } |
| | | }*/ |
| | | |
| | | /* //POST传参序列化(添加请求拦截器) */ |
| | | Axios.interceptors.request.use( |
| | |
| | | <script> |
| | | import Cookies from "js-cookie" |
| | | import UpdatePassWord from "./components/updatePassWord" |
| | | import {getApsPage} from '@/common/untils/index.js' |
| | | export default { |
| | | name: "SalesLead", |
| | | props: { |
| | |
| | | |
| | | return type |
| | | }, |
| | | getApsPage() { |
| | | /* getApsPage() { |
| | | // 首页部署在各个环境的端口 |
| | | const loginPathMap = { |
| | | prod: `//${window.location.hostname}:9080`, |
| | |
| | | dev: `//192.168.8.117:8080` |
| | | } |
| | | return loginPathMap[this.environmentType()] |
| | | }, |
| | | },*/ |
| | | handleCommand(command) { |
| | | console.log(command) |
| | | if (command === "logout") { |
| | | // this.$router.push({ path: "/login" }) |
| | | document.cookie = "cookieName=; path=/;" |
| | |
| | | .then(() => { |
| | | Cookies.remove("token") |
| | | // window.location.href = 'http://localhost:8080/login'; //本地的智慧工厂-登录页 |
| | | window.location.href = "http:" + this.getApsPage() + "/login" |
| | | //window.location.href = "http:" + this.getApsPage() + "/login" |
| | | this.$message({ |
| | | type: "success", |
| | | message: "注销成功!" |
| | | }) |
| | | setTimeout(()=>{ |
| | | window.open(`//${getApsPage()}/login`); |
| | | },500); |
| | | }) |
| | | .catch(() => { |
| | | this.$message({ |
| | |
| | | function resolve(dir) { |
| | | return path.join(__dirname, dir) |
| | | } |
| | | |
| | | const ipNum=144; |
| | | const serverPath=`http://192.168.0.${ipNum}:8001`; |
| | | // 设置不参与构建的库 |
| | | const externals = {} |
| | | module.exports = { |
| | |
| | | devServer: { |
| | | proxy: { |
| | | "/api/menu":{ |
| | | target:"http://192.168.20.119:8001", |
| | | target:serverPath, |
| | | ws: true, |
| | | changeOrigin: true |
| | | }, |
| | |
| | | // target: "http://192.168.20.118:8889", // http://192.168.20.119:8002 http://fai365.com:30150/ |
| | | // target: "http://192.168.20.120:8004", |
| | | // target: "http://192.168.20.119:8004", // http://192.168.20.119:8004 http://fai365.com:30150/ |
| | | target: "http://192.168.20.119:8004", // http://192.168.20.119:8004 http://fai365.com:30150/ |
| | | target: `http://192.168.0.${ipNum}:8004`, // http://192.168.20.119:8004 http://fai365.com:30150/ |
| | | ws: true, |
| | | changeOrigin: true |
| | | }, |
| | | "/api":{ |
| | | target:"http://192.168.20.119:8001", |
| | | target:serverPath, |
| | | ws: true, |
| | | changeOrigin: true |
| | | }, |