| | |
| | | proxyTable: {}, |
| | | |
| | | // Various Dev Server settings |
| | | host: 'localhost', // can be overwritten by process.env.HOST |
| | | host: '0.0.0.0', // can be overwritten by process.env.HOST |
| | | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined |
| | | autoOpenBrowser: false, |
| | | errorOverlay: true, |
| | |
| | | CAloading.close(); |
| | | if (res.code == 200) { |
| | | let tokenData = res.token; |
| | | let times = new Date().getTime(); |
| | | window.localStorage.setItem("TokenTime", times); |
| | | window.localStorage.setItem("TokenKey", tokenData); |
| | | this.$router.push("/index"); |
| | | } else { |
| | |
| | | JBloading.close(); |
| | | if (res.code == 200) { |
| | | let tokenData = res.token; |
| | | let times = new Date().getTime(); |
| | | window.localStorage.setItem("TokenTime", times); |
| | | window.localStorage.setItem("TokenKey", tokenData); |
| | | this.$router.push("/index"); |
| | | } else { |
| | |
| | | window.sgworld = new SmartEarth.EarthCtrl( |
| | | "sdkContainer", |
| | | { |
| | | StaticFileBaseUrl: "../../../static/CimSDK/", |
| | | // StaticFileBaseUrl: "../../../SW/static/CimSDK/", |
| | | // StaticFileBaseUrl: "../../../static/CimSDK/", |
| | | StaticFileBaseUrl: "../../../SW/static/CimSDK/", |
| | | }, |
| | | {}, |
| | | {}, |
| | |
| | | window.sgworld1 = new SmartEarth.EarthCtrl( |
| | | "sdkContainer1", |
| | | { |
| | | StaticFileBaseUrl: "../../static/CimSDK/", |
| | | // StaticFileBaseUrl: "../../../SW/static/CimSDK/", |
| | | // StaticFileBaseUrl: "../../static/CimSDK/", |
| | | StaticFileBaseUrl: "../../../SW/static/CimSDK/", |
| | | }, |
| | | {}, |
| | | null, |
| | |
| | | const router = new Router({ |
| | | mode: "history", |
| | | // base: '/YZXNCS',//正式版 打包时解开 |
| | | // base: '/SW',//测试版 打包时解开 |
| | | base: '/SW',//测试版 打包时解开 |
| | | routes, |
| | | }); |
| | | router.beforeEach((to, from, next) => { |
| | | // next(); |
| | | if (to.path === "/login") { //去登录页,直接跳转 |
| | | // next(); |
| | | // 去登录页,直接跳转 |
| | | if (to.path === "/login") { |
| | | next(); |
| | | } else { //去index,判断token |
| | | } else { |
| | | //去index,判断token |
| | | let token = localStorage.getItem("TokenKey"); |
| | | if (token === null || token === "") { // 没有token,去登陆页 |
| | | next("/login"); |
| | | } else { // 有token,判断超时 |
| | | } else { |
| | | // 有token,判断超时 |
| | | let TokenTime = window.localStorage.getItem("TokenTime"); |
| | | let nowTime = new Date().getTime() |
| | | if (nowTime - TokenTime > 60 * 60 * 1000) { // 超过60分钟,去登陆页 |
| | | next("/login"); |
| | | localStorage.removeItem("TokenKey"); |
| | | localStorage.removeItem("TokenTime"); |
| | | } else { // 去index,有token,没过期,进入系统 |
| | | } else { |
| | | // 去index,有token,没过期,进入系统 |
| | | next(); |
| | | } |
| | | |