diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/src/layout/LayoutApp.vue b/src/layout/LayoutApp.vue index 81db434..ae5731a 100644 --- a/src/layout/LayoutApp.vue +++ b/src/layout/LayoutApp.vue @@ -30,7 +30,7 @@ this.title = this.$route.query.name this.url = this.$route.query.url } - if(this.baseConfig.toDashboard===false){ + if (this.baseConfig.toDashboard===false){ this.showBack = false } }, diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/src/layout/LayoutApp.vue b/src/layout/LayoutApp.vue index 81db434..ae5731a 100644 --- a/src/layout/LayoutApp.vue +++ b/src/layout/LayoutApp.vue @@ -30,7 +30,7 @@ this.title = this.$route.query.name this.url = this.$route.query.url } - if(this.baseConfig.toDashboard===false){ + if (this.baseConfig.toDashboard===false){ this.showBack = false } }, diff --git a/src/main.js b/src/main.js index fd1d17e..1d4dbc5 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,9 @@ +console.log('==============main.js===============') import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import '../theme/index.css' // 引入自定义主题 import ElementUI from 'element-ui' +console.log('==============1111111===============') // import 'element-ui/lib/theme-chalk/index.css' import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n @@ -9,11 +11,16 @@ import '@/assets/font/font.css' import App from './App' +console.log('==============22222===============') import store from './store' +console.log('==============33333===============') import router from './router' +console.log('==============44444===============') import '@/icons' // icon +console.log('==============555555===============') import '@/permission' // permission control +console.log('==============66666===============') /** * This project originally used easy-mock to simulate data, diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/src/layout/LayoutApp.vue b/src/layout/LayoutApp.vue index 81db434..ae5731a 100644 --- a/src/layout/LayoutApp.vue +++ b/src/layout/LayoutApp.vue @@ -30,7 +30,7 @@ this.title = this.$route.query.name this.url = this.$route.query.url } - if(this.baseConfig.toDashboard===false){ + if (this.baseConfig.toDashboard===false){ this.showBack = false } }, diff --git a/src/main.js b/src/main.js index fd1d17e..1d4dbc5 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,9 @@ +console.log('==============main.js===============') import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import '../theme/index.css' // 引入自定义主题 import ElementUI from 'element-ui' +console.log('==============1111111===============') // import 'element-ui/lib/theme-chalk/index.css' import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n @@ -9,11 +11,16 @@ import '@/assets/font/font.css' import App from './App' +console.log('==============22222===============') import store from './store' +console.log('==============33333===============') import router from './router' +console.log('==============44444===============') import '@/icons' // icon +console.log('==============555555===============') import '@/permission' // permission control +console.log('==============66666===============') /** * This project originally used easy-mock to simulate data, diff --git a/src/permission.js b/src/permission.js index 839db2c..8d3f41d 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,8 +7,7 @@ import axios from 'axios' import { getCurrentSys } from './utils/auth' import Vue from 'vue' -import { getMenus } from '@/api/login' -import { queryString, stripscript, extractURLParameters } from '@/utils/validate' +import { extractURLParameters } from '@/utils/validate' import { fetchToken } from '@/api/system/user' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -109,20 +108,19 @@ zf_token: zfToken } // eslint-disable-next-line no-unused-vars - let systems debugger + // window.location.href = 'https://www.baidu.com/?tn=25017023_17_dg' fetchToken(sendParams).then((resToken) => { if (resToken.code === 200) { axios.get('./static/project.config.json').then((result) => { const params = '?token=' + resToken.data.token + '&url=' + result.data.singleSign const loginUrl = result.data.biUrl + '/sso/integrationConfig/login' - const url = loginUrl + params - next({ - path: '/appSubject', - query: { name: resToken.data.title, url: loginUrl + params } - }) - window.open(loginUrl + params, '_blank') - // this.$router.push({ path: '/appSubject', query: { name: resToken.data.title, url: loginUrl + params }}) + // next({ + // path: '/appSubject', + // query: { name: resToken.data.title, url: loginUrl + params } + // }) + // window.open(loginUrl + params, '_blank') + window.location.href = loginUrl + params }) } else { console.log('用户验证失败') diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/src/layout/LayoutApp.vue b/src/layout/LayoutApp.vue index 81db434..ae5731a 100644 --- a/src/layout/LayoutApp.vue +++ b/src/layout/LayoutApp.vue @@ -30,7 +30,7 @@ this.title = this.$route.query.name this.url = this.$route.query.url } - if(this.baseConfig.toDashboard===false){ + if (this.baseConfig.toDashboard===false){ this.showBack = false } }, diff --git a/src/main.js b/src/main.js index fd1d17e..1d4dbc5 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,9 @@ +console.log('==============main.js===============') import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import '../theme/index.css' // 引入自定义主题 import ElementUI from 'element-ui' +console.log('==============1111111===============') // import 'element-ui/lib/theme-chalk/index.css' import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n @@ -9,11 +11,16 @@ import '@/assets/font/font.css' import App from './App' +console.log('==============22222===============') import store from './store' +console.log('==============33333===============') import router from './router' +console.log('==============44444===============') import '@/icons' // icon +console.log('==============555555===============') import '@/permission' // permission control +console.log('==============66666===============') /** * This project originally used easy-mock to simulate data, diff --git a/src/permission.js b/src/permission.js index 839db2c..8d3f41d 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,8 +7,7 @@ import axios from 'axios' import { getCurrentSys } from './utils/auth' import Vue from 'vue' -import { getMenus } from '@/api/login' -import { queryString, stripscript, extractURLParameters } from '@/utils/validate' +import { extractURLParameters } from '@/utils/validate' import { fetchToken } from '@/api/system/user' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -109,20 +108,19 @@ zf_token: zfToken } // eslint-disable-next-line no-unused-vars - let systems debugger + // window.location.href = 'https://www.baidu.com/?tn=25017023_17_dg' fetchToken(sendParams).then((resToken) => { if (resToken.code === 200) { axios.get('./static/project.config.json').then((result) => { const params = '?token=' + resToken.data.token + '&url=' + result.data.singleSign const loginUrl = result.data.biUrl + '/sso/integrationConfig/login' - const url = loginUrl + params - next({ - path: '/appSubject', - query: { name: resToken.data.title, url: loginUrl + params } - }) - window.open(loginUrl + params, '_blank') - // this.$router.push({ path: '/appSubject', query: { name: resToken.data.title, url: loginUrl + params }}) + // next({ + // path: '/appSubject', + // query: { name: resToken.data.title, url: loginUrl + params } + // }) + // window.open(loginUrl + params, '_blank') + window.location.href = loginUrl + params }) } else { console.log('用户验证失败') diff --git a/src/permissionBak.js b/src/permissionBak.js new file mode 100644 index 0000000..ba87122 --- /dev/null +++ b/src/permissionBak.js @@ -0,0 +1,103 @@ +import router from './router' +import store from './store' +import NProgress from 'nprogress' // progress bar 进度条 +import 'nprogress/nprogress.css' // progress bar style 进度条样式 +import { Message } from 'element-ui' +import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' + +NProgress.configure({ showSpinner: false })// NProgress configuration + +const whiteList = ['/login', '/applogin', '/appFaceLogin', '/404', 'config/baseconfig', '/full/storageTopic', '/full/waterThreat', '/full/highConsequence', '/full/constructionThreat', '/full/routeTopic', '/full/waterThreat', '/full/sinkThreat', '/full/vip', '/full/weather', '/full/needTopic', '/full/supplyTopic', '/full/pipeOverview', '/full/overview'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + NProgress.start() // 加载进度条 + console.log('to Path:' + to.path) + // 如果有token + if (getToken()) { + console.log('hasToken') + // 登录后进入登录页 + if (to.path === '/login') { + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { + next('/appIndex') // 否则全部重定向到登录页 + } else { + next() + } + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else { + // 当进入非登陆页或非主页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + let currentSys = getCurrentSys() + // 根据路由去找当前子系统 + if (to.query.sys) { + currentSys = { + code: to.query.code, + name: to.query.sys, + url: to.query.url + } + // 将当前系统信息保存在localStorage中 + store.commit('SET_SYSTEM', currentSys) + } + // 如果已有当前可进入的子系统,刷新子系统菜单 + if (currentSys) { + console.log('hasCurrentSystem') + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + // 获取所有地址列表 + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + console.log('dontHasCurrentSystem') + next({ path: '/dashboard' }) + } + }).catch((err) => { + console.log('toFedLogOut') + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + // TODO: 判断路由是否被允许,不允许则重定向 + next() + } + } + } else { + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + console.log('is In WhiteList') + next() + } else { + // 获取链接里的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 { + if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { + next(`/applogin`) // 否则全部重定向到登录页 + } else { + next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + } + } + NProgress.done() + } + } +}) + +router.afterEach(() => { + NProgress.done() // 结束Progress +}) diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/src/layout/LayoutApp.vue b/src/layout/LayoutApp.vue index 81db434..ae5731a 100644 --- a/src/layout/LayoutApp.vue +++ b/src/layout/LayoutApp.vue @@ -30,7 +30,7 @@ this.title = this.$route.query.name this.url = this.$route.query.url } - if(this.baseConfig.toDashboard===false){ + if (this.baseConfig.toDashboard===false){ this.showBack = false } }, diff --git a/src/main.js b/src/main.js index fd1d17e..1d4dbc5 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,9 @@ +console.log('==============main.js===============') import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import '../theme/index.css' // 引入自定义主题 import ElementUI from 'element-ui' +console.log('==============1111111===============') // import 'element-ui/lib/theme-chalk/index.css' import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n @@ -9,11 +11,16 @@ import '@/assets/font/font.css' import App from './App' +console.log('==============22222===============') import store from './store' +console.log('==============33333===============') import router from './router' +console.log('==============44444===============') import '@/icons' // icon +console.log('==============555555===============') import '@/permission' // permission control +console.log('==============66666===============') /** * This project originally used easy-mock to simulate data, diff --git a/src/permission.js b/src/permission.js index 839db2c..8d3f41d 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,8 +7,7 @@ import axios from 'axios' import { getCurrentSys } from './utils/auth' import Vue from 'vue' -import { getMenus } from '@/api/login' -import { queryString, stripscript, extractURLParameters } from '@/utils/validate' +import { extractURLParameters } from '@/utils/validate' import { fetchToken } from '@/api/system/user' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -109,20 +108,19 @@ zf_token: zfToken } // eslint-disable-next-line no-unused-vars - let systems debugger + // window.location.href = 'https://www.baidu.com/?tn=25017023_17_dg' fetchToken(sendParams).then((resToken) => { if (resToken.code === 200) { axios.get('./static/project.config.json').then((result) => { const params = '?token=' + resToken.data.token + '&url=' + result.data.singleSign const loginUrl = result.data.biUrl + '/sso/integrationConfig/login' - const url = loginUrl + params - next({ - path: '/appSubject', - query: { name: resToken.data.title, url: loginUrl + params } - }) - window.open(loginUrl + params, '_blank') - // this.$router.push({ path: '/appSubject', query: { name: resToken.data.title, url: loginUrl + params }}) + // next({ + // path: '/appSubject', + // query: { name: resToken.data.title, url: loginUrl + params } + // }) + // window.open(loginUrl + params, '_blank') + window.location.href = loginUrl + params }) } else { console.log('用户验证失败') diff --git a/src/permissionBak.js b/src/permissionBak.js new file mode 100644 index 0000000..ba87122 --- /dev/null +++ b/src/permissionBak.js @@ -0,0 +1,103 @@ +import router from './router' +import store from './store' +import NProgress from 'nprogress' // progress bar 进度条 +import 'nprogress/nprogress.css' // progress bar style 进度条样式 +import { Message } from 'element-ui' +import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' + +NProgress.configure({ showSpinner: false })// NProgress configuration + +const whiteList = ['/login', '/applogin', '/appFaceLogin', '/404', 'config/baseconfig', '/full/storageTopic', '/full/waterThreat', '/full/highConsequence', '/full/constructionThreat', '/full/routeTopic', '/full/waterThreat', '/full/sinkThreat', '/full/vip', '/full/weather', '/full/needTopic', '/full/supplyTopic', '/full/pipeOverview', '/full/overview'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + NProgress.start() // 加载进度条 + console.log('to Path:' + to.path) + // 如果有token + if (getToken()) { + console.log('hasToken') + // 登录后进入登录页 + if (to.path === '/login') { + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { + next('/appIndex') // 否则全部重定向到登录页 + } else { + next() + } + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else { + // 当进入非登陆页或非主页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + let currentSys = getCurrentSys() + // 根据路由去找当前子系统 + if (to.query.sys) { + currentSys = { + code: to.query.code, + name: to.query.sys, + url: to.query.url + } + // 将当前系统信息保存在localStorage中 + store.commit('SET_SYSTEM', currentSys) + } + // 如果已有当前可进入的子系统,刷新子系统菜单 + if (currentSys) { + console.log('hasCurrentSystem') + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + // 获取所有地址列表 + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + console.log('dontHasCurrentSystem') + next({ path: '/dashboard' }) + } + }).catch((err) => { + console.log('toFedLogOut') + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + // TODO: 判断路由是否被允许,不允许则重定向 + next() + } + } + } else { + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + console.log('is In WhiteList') + next() + } else { + // 获取链接里的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 { + if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { + next(`/applogin`) // 否则全部重定向到登录页 + } else { + next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + } + } + NProgress.done() + } + } +}) + +router.afterEach(() => { + NProgress.done() // 结束Progress +}) diff --git a/src/views/system/resource/editResource.vue b/src/views/system/resource/editResource.vue index 2a22a73..acfc6b5 100644 --- a/src/views/system/resource/editResource.vue +++ b/src/views/system/resource/editResource.vue @@ -152,7 +152,7 @@ resourceType: row.resourceType, num: row.num, icon: row.icon, - tips:row.tips + tips: row.tips } } }, @@ -187,7 +187,7 @@ resourceType: '', num: '', icon: '', - tips:'' + tips: '' } }, // 保存数据 diff --git a/config/index.js b/config/index.js index ab8f4e5..2ef8b4a 100644 --- a/config/index.js +++ b/config/index.js @@ -64,7 +64,8 @@ * In most cases please use '/' !!! */ //定义静态资源的公开路径,也就是真正的引用路径 - assetsPublicPath: '/hxrq/', + // assetsPublicPath: '/hxrq/', + assetsPublicPath: './', //定义是否生成生产环境的SourceMap, sourcemap是用来debug编译后文件的,通过映射到编译前文件来实现 productionSourceMap: false, diff --git a/devDependenciesVersion.md b/devDependenciesVersion.md new file mode 100644 index 0000000..350f864 --- /dev/null +++ b/devDependenciesVersion.md @@ -0,0 +1,24 @@ +# 项目依赖版本统计 + +# "axios": "^0.19.0", +# "babel-polyfill": "^6.26.0", +# "echarts": "^4.2.1", +# "element-ui": "2.12.0", +# "event-source-polyfill": "^1.0.5", +# "js-cookie": "2.2.0", +# "js-md5": "^0.7.3", +# "jsencrypt": "^3.0.0-rc.1", +# "lodash": "^4.17.15", +# "mars3d": "^3.0.25", +# "mars3d-echarts": "^3.0.3", +# "mars3d-heatmap": "^3.0.6", +# "mars3d-mapv": "^3.0.3", +# "mockjs": "1.0.1-beta3", +# "moment": "^2.24.0", +# "normalize.css": "7.0.0", +# "nprogress": "0.2.0", +# "v-charts": "^1.19.0", +# "vue": "2.5.17", +# "vue-router": "3.0.1", +# "vuex": "3.0.1" +# "mars3d-cesium" 1.80.1 \ No newline at end of file diff --git a/package.json b/package.json index dd45e5b..e687665 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "js-md5": "^0.7.3", "jsencrypt": "^3.0.0-rc.1", "lodash": "^4.17.15", - "mars3d-cesium": "^1.94.3", + "mars3d": "^3.0.25", "mars3d-echarts": "^3.0.3", "mars3d-heatmap": "^3.0.6", "mars3d-mapv": "^3.0.3", diff --git a/src/components/Map/components/disasterLayer.vue b/src/components/Map/components/disasterLayer.vue index de58764..796fca6 100644 --- a/src/components/Map/components/disasterLayer.vue +++ b/src/components/Map/components/disasterLayer.vue @@ -56,7 +56,7 @@ '霜冻': '11', '大雾': '12', '霾': '13', - '道路结冰': '14', + '道路结冰': '14' }, // 灾害与数字对应表 disasterLevel: { '蓝色': '01', @@ -95,7 +95,7 @@ } }, loadData() { - const { mars3d, Cesium, layer, height, offset, scale } = this + const { mars3d, Cesium, layer, height, scale } = this const date = getToday() getDisasterList(date).then((res) => { if (res.data.length === 0) { @@ -114,8 +114,8 @@ data = data.filter(item => item.lng != null) this.data = data for (const item of data) { - let img='static/images/weather_disaster/0000.png' - if(this.disaster[item.zhlx]){ + let img = 'static/images/weather_disaster/0000.png' + if (this.disaster[item.zhlx]) { img = 'static/images/weather_disaster/' + this.disaster[item.zhlx] + this.disasterLevel[item.zhdj] + '.png' } const graphic = new mars3d.graphic.BillboardEntity({ diff --git a/src/layout/LayoutApp.vue b/src/layout/LayoutApp.vue index 81db434..ae5731a 100644 --- a/src/layout/LayoutApp.vue +++ b/src/layout/LayoutApp.vue @@ -30,7 +30,7 @@ this.title = this.$route.query.name this.url = this.$route.query.url } - if(this.baseConfig.toDashboard===false){ + if (this.baseConfig.toDashboard===false){ this.showBack = false } }, diff --git a/src/main.js b/src/main.js index fd1d17e..1d4dbc5 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,9 @@ +console.log('==============main.js===============') import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import '../theme/index.css' // 引入自定义主题 import ElementUI from 'element-ui' +console.log('==============1111111===============') // import 'element-ui/lib/theme-chalk/index.css' import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n @@ -9,11 +11,16 @@ import '@/assets/font/font.css' import App from './App' +console.log('==============22222===============') import store from './store' +console.log('==============33333===============') import router from './router' +console.log('==============44444===============') import '@/icons' // icon +console.log('==============555555===============') import '@/permission' // permission control +console.log('==============66666===============') /** * This project originally used easy-mock to simulate data, diff --git a/src/permission.js b/src/permission.js index 839db2c..8d3f41d 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,8 +7,7 @@ import axios from 'axios' import { getCurrentSys } from './utils/auth' import Vue from 'vue' -import { getMenus } from '@/api/login' -import { queryString, stripscript, extractURLParameters } from '@/utils/validate' +import { extractURLParameters } from '@/utils/validate' import { fetchToken } from '@/api/system/user' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -109,20 +108,19 @@ zf_token: zfToken } // eslint-disable-next-line no-unused-vars - let systems debugger + // window.location.href = 'https://www.baidu.com/?tn=25017023_17_dg' fetchToken(sendParams).then((resToken) => { if (resToken.code === 200) { axios.get('./static/project.config.json').then((result) => { const params = '?token=' + resToken.data.token + '&url=' + result.data.singleSign const loginUrl = result.data.biUrl + '/sso/integrationConfig/login' - const url = loginUrl + params - next({ - path: '/appSubject', - query: { name: resToken.data.title, url: loginUrl + params } - }) - window.open(loginUrl + params, '_blank') - // this.$router.push({ path: '/appSubject', query: { name: resToken.data.title, url: loginUrl + params }}) + // next({ + // path: '/appSubject', + // query: { name: resToken.data.title, url: loginUrl + params } + // }) + // window.open(loginUrl + params, '_blank') + window.location.href = loginUrl + params }) } else { console.log('用户验证失败') diff --git a/src/permissionBak.js b/src/permissionBak.js new file mode 100644 index 0000000..ba87122 --- /dev/null +++ b/src/permissionBak.js @@ -0,0 +1,103 @@ +import router from './router' +import store from './store' +import NProgress from 'nprogress' // progress bar 进度条 +import 'nprogress/nprogress.css' // progress bar style 进度条样式 +import { Message } from 'element-ui' +import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' + +NProgress.configure({ showSpinner: false })// NProgress configuration + +const whiteList = ['/login', '/applogin', '/appFaceLogin', '/404', 'config/baseconfig', '/full/storageTopic', '/full/waterThreat', '/full/highConsequence', '/full/constructionThreat', '/full/routeTopic', '/full/waterThreat', '/full/sinkThreat', '/full/vip', '/full/weather', '/full/needTopic', '/full/supplyTopic', '/full/pipeOverview', '/full/overview'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + NProgress.start() // 加载进度条 + console.log('to Path:' + to.path) + // 如果有token + if (getToken()) { + console.log('hasToken') + // 登录后进入登录页 + if (to.path === '/login') { + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { + next('/appIndex') // 否则全部重定向到登录页 + } else { + next() + } + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else { + // 当进入非登陆页或非主页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + let currentSys = getCurrentSys() + // 根据路由去找当前子系统 + if (to.query.sys) { + currentSys = { + code: to.query.code, + name: to.query.sys, + url: to.query.url + } + // 将当前系统信息保存在localStorage中 + store.commit('SET_SYSTEM', currentSys) + } + // 如果已有当前可进入的子系统,刷新子系统菜单 + if (currentSys) { + console.log('hasCurrentSystem') + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + // 获取所有地址列表 + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + console.log('dontHasCurrentSystem') + next({ path: '/dashboard' }) + } + }).catch((err) => { + console.log('toFedLogOut') + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + // TODO: 判断路由是否被允许,不允许则重定向 + next() + } + } + } else { + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + console.log('is In WhiteList') + next() + } else { + // 获取链接里的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 { + if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { + next(`/applogin`) // 否则全部重定向到登录页 + } else { + next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + } + } + NProgress.done() + } + } +}) + +router.afterEach(() => { + NProgress.done() // 结束Progress +}) diff --git a/src/views/system/resource/editResource.vue b/src/views/system/resource/editResource.vue index 2a22a73..acfc6b5 100644 --- a/src/views/system/resource/editResource.vue +++ b/src/views/system/resource/editResource.vue @@ -152,7 +152,7 @@ resourceType: row.resourceType, num: row.num, icon: row.icon, - tips:row.tips + tips: row.tips } } }, @@ -187,7 +187,7 @@ resourceType: '', num: '', icon: '', - tips:'' + tips: '' } }, // 保存数据 diff --git a/src/views/system/role/editRole.vue b/src/views/system/role/editRole.vue index 0c2a54b..cc48cf3 100644 --- a/src/views/system/role/editRole.vue +++ b/src/views/system/role/editRole.vue @@ -170,7 +170,7 @@ pids: '', num: 99, tips: '', - dataScopeType:'', + dataScopeType: '', version: '' } },