diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index e83f4be..e89510b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.0.10:20005"' + BASE_API: '"http://111.198.10.15:11413/bridge"' // BASE_API: '"http://192.168.8.211:20005"' } diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index e83f4be..e89510b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.0.10:20005"' + BASE_API: '"http://111.198.10.15:11413/bridge"' // BASE_API: '"http://192.168.8.211:20005"' } diff --git a/package.json b/package.json index f23903f..c9b115b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "normalize.css": "7.0.0", "nprogress": "0.2.0", "v-charts": "^1.19.0", - "vue": "2.5.17", + "vue": "^2.5.17", "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "^3.0.1", diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index e83f4be..e89510b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.0.10:20005"' + BASE_API: '"http://111.198.10.15:11413/bridge"' // BASE_API: '"http://192.168.8.211:20005"' } diff --git a/package.json b/package.json index f23903f..c9b115b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "normalize.css": "7.0.0", "nprogress": "0.2.0", "v-charts": "^1.19.0", - "vue": "2.5.17", + "vue": "^2.5.17", "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "^3.0.1", diff --git a/src/main.js b/src/main.js index a4c19b6..3228edb 100644 --- a/src/main.js +++ b/src/main.js @@ -82,25 +82,20 @@ export const attendanceEnable = true import axios from 'axios' -// import service from '@/utils/request' -axios.get('./static/config.json').then((result) => { +import service from '@/utils/request' +axios.get('./static/project.config.json').then((result) => { + console.log('get config') Vue.prototype.baseConfig = result.data document.title = result.data.title // 首先设置网页的title - // service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 + service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 new Vue({ el: '#app', router, - data() { - return { - ws: null, - wsURL: 'ws://127.0.0.1:1234', - devInited: false - } - }, store, render: h => h(App) }) }).catch((error) => { - console.log('get base config ...' + error) + console.log('get baseConfig error...' + error) }) + diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index e83f4be..e89510b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.0.10:20005"' + BASE_API: '"http://111.198.10.15:11413/bridge"' // BASE_API: '"http://192.168.8.211:20005"' } diff --git a/package.json b/package.json index f23903f..c9b115b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "normalize.css": "7.0.0", "nprogress": "0.2.0", "v-charts": "^1.19.0", - "vue": "2.5.17", + "vue": "^2.5.17", "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "^3.0.1", diff --git a/src/main.js b/src/main.js index a4c19b6..3228edb 100644 --- a/src/main.js +++ b/src/main.js @@ -82,25 +82,20 @@ export const attendanceEnable = true import axios from 'axios' -// import service from '@/utils/request' -axios.get('./static/config.json').then((result) => { +import service from '@/utils/request' +axios.get('./static/project.config.json').then((result) => { + console.log('get config') Vue.prototype.baseConfig = result.data document.title = result.data.title // 首先设置网页的title - // service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 + service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 new Vue({ el: '#app', router, - data() { - return { - ws: null, - wsURL: 'ws://127.0.0.1:1234', - devInited: false - } - }, store, render: h => h(App) }) }).catch((error) => { - console.log('get base config ...' + error) + console.log('get baseConfig error...' + error) }) + diff --git a/src/permission.js b/src/permission.js index 75c7e4a..7e243c9 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,7 +40,27 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // 获取链接里的token + const token = to.query.token + console.log('token' + to.query.token) + if (token) { + // 调用自动登录接口,否则跳转到登录页 + store.dispatch('AppLogin', token).then(() => { + console.log('自动登录成功') + console.log(to.path) + next({ ...to, replace: true }) // 登录成功继续 + }).catch(() => { + next('/401') // 否则全部重定向到401没有权限页面 + }) + } else { + // 判断是独立运行的子系统还是和其他基础子系统一起的 + const config = Vue.prototype.baseConfig + if (config.singleSys) { + next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + } else { + window.location.href = config.mainPage + } + } NProgress.done() } } diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index e83f4be..e89510b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.0.10:20005"' + BASE_API: '"http://111.198.10.15:11413/bridge"' // BASE_API: '"http://192.168.8.211:20005"' } diff --git a/package.json b/package.json index f23903f..c9b115b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "normalize.css": "7.0.0", "nprogress": "0.2.0", "v-charts": "^1.19.0", - "vue": "2.5.17", + "vue": "^2.5.17", "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "^3.0.1", diff --git a/src/main.js b/src/main.js index a4c19b6..3228edb 100644 --- a/src/main.js +++ b/src/main.js @@ -82,25 +82,20 @@ export const attendanceEnable = true import axios from 'axios' -// import service from '@/utils/request' -axios.get('./static/config.json').then((result) => { +import service from '@/utils/request' +axios.get('./static/project.config.json').then((result) => { + console.log('get config') Vue.prototype.baseConfig = result.data document.title = result.data.title // 首先设置网页的title - // service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 + service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 new Vue({ el: '#app', router, - data() { - return { - ws: null, - wsURL: 'ws://127.0.0.1:1234', - devInited: false - } - }, store, render: h => h(App) }) }).catch((error) => { - console.log('get base config ...' + error) + console.log('get baseConfig error...' + error) }) + diff --git a/src/permission.js b/src/permission.js index 75c7e4a..7e243c9 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,7 +40,27 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // 获取链接里的token + const token = to.query.token + console.log('token' + to.query.token) + if (token) { + // 调用自动登录接口,否则跳转到登录页 + store.dispatch('AppLogin', token).then(() => { + console.log('自动登录成功') + console.log(to.path) + next({ ...to, replace: true }) // 登录成功继续 + }).catch(() => { + next('/401') // 否则全部重定向到401没有权限页面 + }) + } else { + // 判断是独立运行的子系统还是和其他基础子系统一起的 + const config = Vue.prototype.baseConfig + if (config.singleSys) { + next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + } else { + window.location.href = config.mainPage + } + } NProgress.done() } } diff --git a/src/views/layout/components/AppHeader.vue b/src/views/layout/components/AppHeader.vue index bf36e89..2044201 100644 --- a/src/views/layout/components/AppHeader.vue +++ b/src/views/layout/components/AppHeader.vue @@ -8,12 +8,10 @@ - - - - - - + + 回首页 + + 修改密码 @@ -35,7 +33,7 @@ components: { ResetPwd }, data() { return { - title: getProject().title, + title: this.baseConfig.title, // 修改此处 name: this.$store.getters.name, showSetPwd: false, headerUrl: require('../../../assets/global_images/header.png')// 头部图片 diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index cf5c1d4..a041b2c 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -44,7 +44,7 @@ }, module: { rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), + // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', diff --git a/config/index.js b/config/index.js index 5c5a936..44c92e8 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris/', + assetsPublicPath: '/bridge/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index e83f4be..e89510b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.0.10:20005"' + BASE_API: '"http://111.198.10.15:11413/bridge"' // BASE_API: '"http://192.168.8.211:20005"' } diff --git a/package.json b/package.json index f23903f..c9b115b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "normalize.css": "7.0.0", "nprogress": "0.2.0", "v-charts": "^1.19.0", - "vue": "2.5.17", + "vue": "^2.5.17", "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "^3.0.1", diff --git a/src/main.js b/src/main.js index a4c19b6..3228edb 100644 --- a/src/main.js +++ b/src/main.js @@ -82,25 +82,20 @@ export const attendanceEnable = true import axios from 'axios' -// import service from '@/utils/request' -axios.get('./static/config.json').then((result) => { +import service from '@/utils/request' +axios.get('./static/project.config.json').then((result) => { + console.log('get config') Vue.prototype.baseConfig = result.data document.title = result.data.title // 首先设置网页的title - // service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 + service.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 new Vue({ el: '#app', router, - data() { - return { - ws: null, - wsURL: 'ws://127.0.0.1:1234', - devInited: false - } - }, store, render: h => h(App) }) }).catch((error) => { - console.log('get base config ...' + error) + console.log('get baseConfig error...' + error) }) + diff --git a/src/permission.js b/src/permission.js index 75c7e4a..7e243c9 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,7 +40,27 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // 获取链接里的token + const token = to.query.token + console.log('token' + to.query.token) + if (token) { + // 调用自动登录接口,否则跳转到登录页 + store.dispatch('AppLogin', token).then(() => { + console.log('自动登录成功') + console.log(to.path) + next({ ...to, replace: true }) // 登录成功继续 + }).catch(() => { + next('/401') // 否则全部重定向到401没有权限页面 + }) + } else { + // 判断是独立运行的子系统还是和其他基础子系统一起的 + const config = Vue.prototype.baseConfig + if (config.singleSys) { + next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + } else { + window.location.href = config.mainPage + } + } NProgress.done() } } diff --git a/src/views/layout/components/AppHeader.vue b/src/views/layout/components/AppHeader.vue index bf36e89..2044201 100644 --- a/src/views/layout/components/AppHeader.vue +++ b/src/views/layout/components/AppHeader.vue @@ -8,12 +8,10 @@ - - - - - - + + 回首页 + + 修改密码 @@ -35,7 +33,7 @@ components: { ResetPwd }, data() { return { - title: getProject().title, + title: this.baseConfig.title, // 修改此处 name: this.$store.getters.name, showSetPwd: false, headerUrl: require('../../../assets/global_images/header.png')// 头部图片 diff --git a/static/project.config.json b/static/project.config.json new file mode 100644 index 0000000..29571c1 --- /dev/null +++ b/static/project.config.json @@ -0,0 +1,11 @@ +{ + "title": "路桥养护子系统", + "baseUrl": "http://111.198.10.15:11409/", + "mainPage": "http://111.198.10.15:11404/dcms/", + "singleSys": true, + "city":"崇仁县", + "mapUrl":"https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=216ee92889e17ab1b083fae665d522b8", + "labelUrl":"https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=216ee92889e17ab1b083fae665d522b8", + "center":[27.75962, 116.06021], + "zoom":15 +}