diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/src/utils/maputils.js b/src/utils/maputils.js new file mode 100644 index 0000000..c23efa8 --- /dev/null +++ b/src/utils/maputils.js @@ -0,0 +1,35 @@ +import * as L from 'leaflet' +// 计算坐标集合中的最大最小经纬度 +export function getPathBounds(points, keyLng, keyLat) { + const lngs = points.map(item => item[keyLng]) + const lats = points.map(item => item[keyLat]) + const maxLng = Math.max(...lngs) + const minLng = Math.min(...lngs) + const maxLat = Math.max(...lats) + const minLat = Math.min(...lats) + return { maxLng, minLng, maxLat, minLat } +} +// 根据范围计算中心坐标 +export function getCenterByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const cenLng = (parseFloat(maxLng) + parseFloat(minLng)) / 2 + const cenLat = (parseFloat(maxLat) + parseFloat(minLat)) / 2 + return { cenLat, cenLng } +} + +// 根据范围计算缩放级别 +export function getZoomByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const zoom = ['50', '100', '200', '500', '1000', '2000', '5000', '10000', '20000', '25000', '50000', '100000', '200000', '500000', '1000000', '2000000']// 级别18到3。 + // 计算左上角和右下角距离 + const minPoint = L.latLng(minLat, minLng) + const maxPoint = L.latLng(maxLat, maxLng) + var distance = maxPoint.distanceTo(minPoint) + for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) { + if (zoom[i] - distance > 0) { + console.log(i) + return 18 - i + 2 // 之所以会多2,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。 + } + } + return 13 +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/src/utils/maputils.js b/src/utils/maputils.js new file mode 100644 index 0000000..c23efa8 --- /dev/null +++ b/src/utils/maputils.js @@ -0,0 +1,35 @@ +import * as L from 'leaflet' +// 计算坐标集合中的最大最小经纬度 +export function getPathBounds(points, keyLng, keyLat) { + const lngs = points.map(item => item[keyLng]) + const lats = points.map(item => item[keyLat]) + const maxLng = Math.max(...lngs) + const minLng = Math.min(...lngs) + const maxLat = Math.max(...lats) + const minLat = Math.min(...lats) + return { maxLng, minLng, maxLat, minLat } +} +// 根据范围计算中心坐标 +export function getCenterByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const cenLng = (parseFloat(maxLng) + parseFloat(minLng)) / 2 + const cenLat = (parseFloat(maxLat) + parseFloat(minLat)) / 2 + return { cenLat, cenLng } +} + +// 根据范围计算缩放级别 +export function getZoomByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const zoom = ['50', '100', '200', '500', '1000', '2000', '5000', '10000', '20000', '25000', '50000', '100000', '200000', '500000', '1000000', '2000000']// 级别18到3。 + // 计算左上角和右下角距离 + const minPoint = L.latLng(minLat, minLng) + const maxPoint = L.latLng(maxLat, maxLng) + var distance = maxPoint.distanceTo(minPoint) + for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) { + if (zoom[i] - distance > 0) { + console.log(i) + return 18 - i + 2 // 之所以会多2,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。 + } + } + return 13 +} diff --git a/src/utils/request.js b/src/utils/request.js index 6fc46fb..176d8e6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,8 @@ import axios from 'axios' // import { Message, MessageBox } from 'element-ui' -// import store from '../store' -// import { getToken } from '@/utils/auth' +import {Message} from 'ant-design-vue' +import store from '../store' +import { getToken } from '@/utils/auth' // 创建axios实例 const service = axios.create({ @@ -12,11 +13,11 @@ // request拦截器 service.interceptors.request.use( config => { - // if (store.getters.token) { - // console.log('request.js gettoken') - // config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - // console.log(config.headers['token']) - // } + if (store.getters.token) { + console.log('request.js gettoken') + config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + console.log(config.headers['token']) + } return config }, error => { @@ -55,12 +56,7 @@ // }) // }) } else { - // Message({ - // showClose: true, - // message: res.message, - // type: 'error', - // duration: 3000 - // }) + Message.error(res.message, 3) return Promise.reject(res) } // return Promise.reject(res) diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/src/utils/maputils.js b/src/utils/maputils.js new file mode 100644 index 0000000..c23efa8 --- /dev/null +++ b/src/utils/maputils.js @@ -0,0 +1,35 @@ +import * as L from 'leaflet' +// 计算坐标集合中的最大最小经纬度 +export function getPathBounds(points, keyLng, keyLat) { + const lngs = points.map(item => item[keyLng]) + const lats = points.map(item => item[keyLat]) + const maxLng = Math.max(...lngs) + const minLng = Math.min(...lngs) + const maxLat = Math.max(...lats) + const minLat = Math.min(...lats) + return { maxLng, minLng, maxLat, minLat } +} +// 根据范围计算中心坐标 +export function getCenterByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const cenLng = (parseFloat(maxLng) + parseFloat(minLng)) / 2 + const cenLat = (parseFloat(maxLat) + parseFloat(minLat)) / 2 + return { cenLat, cenLng } +} + +// 根据范围计算缩放级别 +export function getZoomByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const zoom = ['50', '100', '200', '500', '1000', '2000', '5000', '10000', '20000', '25000', '50000', '100000', '200000', '500000', '1000000', '2000000']// 级别18到3。 + // 计算左上角和右下角距离 + const minPoint = L.latLng(minLat, minLng) + const maxPoint = L.latLng(maxLat, maxLng) + var distance = maxPoint.distanceTo(minPoint) + for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) { + if (zoom[i] - distance > 0) { + console.log(i) + return 18 - i + 2 // 之所以会多2,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。 + } + } + return 13 +} diff --git a/src/utils/request.js b/src/utils/request.js index 6fc46fb..176d8e6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,8 @@ import axios from 'axios' // import { Message, MessageBox } from 'element-ui' -// import store from '../store' -// import { getToken } from '@/utils/auth' +import {Message} from 'ant-design-vue' +import store from '../store' +import { getToken } from '@/utils/auth' // 创建axios实例 const service = axios.create({ @@ -12,11 +13,11 @@ // request拦截器 service.interceptors.request.use( config => { - // if (store.getters.token) { - // console.log('request.js gettoken') - // config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - // console.log(config.headers['token']) - // } + if (store.getters.token) { + console.log('request.js gettoken') + config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + console.log(config.headers['token']) + } return config }, error => { @@ -55,12 +56,7 @@ // }) // }) } else { - // Message({ - // showClose: true, - // message: res.message, - // type: 'error', - // duration: 3000 - // }) + Message.error(res.message, 3) return Promise.reject(res) } // return Promise.reject(res) diff --git a/src/utils/security.js b/src/utils/security.js new file mode 100644 index 0000000..a991dd5 --- /dev/null +++ b/src/utils/security.js @@ -0,0 +1,30 @@ +/** + * 加密工具类 + * Created by wangxiaoying 2019/04/17 + * **/ +import JsEncrypt from 'jsencrypt' +import store from '../store' + +/** + * 加密 + * @param value 待加密数据 + * @returns 加密结果 + */ +export function RSAencrypt(value) { + var encrypt = new JsEncrypt() + // 如果公钥没有了,重新申请公钥 + if (store.getters.publicKey && store.getters.publicKey === '') { + store.dispatch('GetConfig').then(() => { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + }).catch((e) => { + console.log(e) + }) + } else { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + } +} + diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/src/utils/maputils.js b/src/utils/maputils.js new file mode 100644 index 0000000..c23efa8 --- /dev/null +++ b/src/utils/maputils.js @@ -0,0 +1,35 @@ +import * as L from 'leaflet' +// 计算坐标集合中的最大最小经纬度 +export function getPathBounds(points, keyLng, keyLat) { + const lngs = points.map(item => item[keyLng]) + const lats = points.map(item => item[keyLat]) + const maxLng = Math.max(...lngs) + const minLng = Math.min(...lngs) + const maxLat = Math.max(...lats) + const minLat = Math.min(...lats) + return { maxLng, minLng, maxLat, minLat } +} +// 根据范围计算中心坐标 +export function getCenterByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const cenLng = (parseFloat(maxLng) + parseFloat(minLng)) / 2 + const cenLat = (parseFloat(maxLat) + parseFloat(minLat)) / 2 + return { cenLat, cenLng } +} + +// 根据范围计算缩放级别 +export function getZoomByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const zoom = ['50', '100', '200', '500', '1000', '2000', '5000', '10000', '20000', '25000', '50000', '100000', '200000', '500000', '1000000', '2000000']// 级别18到3。 + // 计算左上角和右下角距离 + const minPoint = L.latLng(minLat, minLng) + const maxPoint = L.latLng(maxLat, maxLng) + var distance = maxPoint.distanceTo(minPoint) + for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) { + if (zoom[i] - distance > 0) { + console.log(i) + return 18 - i + 2 // 之所以会多2,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。 + } + } + return 13 +} diff --git a/src/utils/request.js b/src/utils/request.js index 6fc46fb..176d8e6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,8 @@ import axios from 'axios' // import { Message, MessageBox } from 'element-ui' -// import store from '../store' -// import { getToken } from '@/utils/auth' +import {Message} from 'ant-design-vue' +import store from '../store' +import { getToken } from '@/utils/auth' // 创建axios实例 const service = axios.create({ @@ -12,11 +13,11 @@ // request拦截器 service.interceptors.request.use( config => { - // if (store.getters.token) { - // console.log('request.js gettoken') - // config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - // console.log(config.headers['token']) - // } + if (store.getters.token) { + console.log('request.js gettoken') + config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + console.log(config.headers['token']) + } return config }, error => { @@ -55,12 +56,7 @@ // }) // }) } else { - // Message({ - // showClose: true, - // message: res.message, - // type: 'error', - // duration: 3000 - // }) + Message.error(res.message, 3) return Promise.reject(res) } // return Promise.reject(res) diff --git a/src/utils/security.js b/src/utils/security.js new file mode 100644 index 0000000..a991dd5 --- /dev/null +++ b/src/utils/security.js @@ -0,0 +1,30 @@ +/** + * 加密工具类 + * Created by wangxiaoying 2019/04/17 + * **/ +import JsEncrypt from 'jsencrypt' +import store from '../store' + +/** + * 加密 + * @param value 待加密数据 + * @returns 加密结果 + */ +export function RSAencrypt(value) { + var encrypt = new JsEncrypt() + // 如果公钥没有了,重新申请公钥 + if (store.getters.publicKey && store.getters.publicKey === '') { + store.dispatch('GetConfig').then(() => { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + }).catch((e) => { + console.log(e) + }) + } else { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + } +} + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 6d00389..49dc9ea 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -3,15 +3,19 @@
- +
-
- +
+ + + diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/src/utils/maputils.js b/src/utils/maputils.js new file mode 100644 index 0000000..c23efa8 --- /dev/null +++ b/src/utils/maputils.js @@ -0,0 +1,35 @@ +import * as L from 'leaflet' +// 计算坐标集合中的最大最小经纬度 +export function getPathBounds(points, keyLng, keyLat) { + const lngs = points.map(item => item[keyLng]) + const lats = points.map(item => item[keyLat]) + const maxLng = Math.max(...lngs) + const minLng = Math.min(...lngs) + const maxLat = Math.max(...lats) + const minLat = Math.min(...lats) + return { maxLng, minLng, maxLat, minLat } +} +// 根据范围计算中心坐标 +export function getCenterByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const cenLng = (parseFloat(maxLng) + parseFloat(minLng)) / 2 + const cenLat = (parseFloat(maxLat) + parseFloat(minLat)) / 2 + return { cenLat, cenLng } +} + +// 根据范围计算缩放级别 +export function getZoomByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const zoom = ['50', '100', '200', '500', '1000', '2000', '5000', '10000', '20000', '25000', '50000', '100000', '200000', '500000', '1000000', '2000000']// 级别18到3。 + // 计算左上角和右下角距离 + const minPoint = L.latLng(minLat, minLng) + const maxPoint = L.latLng(maxLat, maxLng) + var distance = maxPoint.distanceTo(minPoint) + for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) { + if (zoom[i] - distance > 0) { + console.log(i) + return 18 - i + 2 // 之所以会多2,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。 + } + } + return 13 +} diff --git a/src/utils/request.js b/src/utils/request.js index 6fc46fb..176d8e6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,8 @@ import axios from 'axios' // import { Message, MessageBox } from 'element-ui' -// import store from '../store' -// import { getToken } from '@/utils/auth' +import {Message} from 'ant-design-vue' +import store from '../store' +import { getToken } from '@/utils/auth' // 创建axios实例 const service = axios.create({ @@ -12,11 +13,11 @@ // request拦截器 service.interceptors.request.use( config => { - // if (store.getters.token) { - // console.log('request.js gettoken') - // config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - // console.log(config.headers['token']) - // } + if (store.getters.token) { + console.log('request.js gettoken') + config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + console.log(config.headers['token']) + } return config }, error => { @@ -55,12 +56,7 @@ // }) // }) } else { - // Message({ - // showClose: true, - // message: res.message, - // type: 'error', - // duration: 3000 - // }) + Message.error(res.message, 3) return Promise.reject(res) } // return Promise.reject(res) diff --git a/src/utils/security.js b/src/utils/security.js new file mode 100644 index 0000000..a991dd5 --- /dev/null +++ b/src/utils/security.js @@ -0,0 +1,30 @@ +/** + * 加密工具类 + * Created by wangxiaoying 2019/04/17 + * **/ +import JsEncrypt from 'jsencrypt' +import store from '../store' + +/** + * 加密 + * @param value 待加密数据 + * @returns 加密结果 + */ +export function RSAencrypt(value) { + var encrypt = new JsEncrypt() + // 如果公钥没有了,重新申请公钥 + if (store.getters.publicKey && store.getters.publicKey === '') { + store.dispatch('GetConfig').then(() => { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + }).catch((e) => { + console.log(e) + }) + } else { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + } +} + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 6d00389..49dc9ea 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -3,15 +3,19 @@
+ + + diff --git a/src/views/screen/mainComponents/mapView.vue b/src/views/screen/mainComponents/mapView.vue index a02bb5f..f415511 100644 --- a/src/views/screen/mainComponents/mapView.vue +++ b/src/views/screen/mainComponents/mapView.vue @@ -7,7 +7,9 @@
+ +
@@ -26,7 +28,7 @@
-
+
@@ -40,7 +42,7 @@
摄像头
-
+
@@ -55,15 +57,17 @@ import LeafletMap from "@/components/leafletMap/leafletMap"; import VideoLayer from "./videoLayer"; import AlarmLayer from "./alarmLayer"; + import PipeLayer from "./pipeLayer"; + import LampLayer from "./lampLayer"; export default { name: "mapView", - components: {AlarmLayer, VideoLayer, LeafletMap}, + components: {LampLayer, PipeLayer, AlarmLayer, VideoLayer, LeafletMap}, data(){ return { center:this.baseConfig.center, - currentLayer:'alarm', + currentLayer:'pipe', zooms:[13,18], - zoom:14, + zoom:this.baseConfig.zoom, currentMap:'影像地图', layers:[ {name:'tdtMap', show:false, url:this.baseConfig.mapUrl, zooms:[13,18]}, diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..f73b00b --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..eb88707 --- /dev/null +++ b/main.js @@ -0,0 +1,68 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 引入ant-design +import Antd from 'ant-design-vue' +// import 'ant-design-vue/dist/antd.less' +import '@/assets/css/antstyle.less' +Vue.use(Antd) + +// 引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) + +// 引入vuescroll +import vuescroll from 'vuescroll'; +Vue.use(vuescroll, { + ops: { + mode: 'native', + sizeStrategy: 'percent', + detectResize: true, + }, // 在这里设置全局默认配置 + name: 'vuescroll' // 在这里自定义组件名字,默认是vueScroll +}); + +// 按需引入vue-awesome图标 +import Icon from 'vue-awesome/components/Icon' +import 'vue-awesome/icons/chart-bar.js' +import 'vue-awesome/icons/chart-area.js' +import 'vue-awesome/icons/chart-pie.js' +import 'vue-awesome/icons/chart-line.js' +import 'vue-awesome/icons/align-left.js' + +// 全局注册图标 +Vue.component('icon', Icon) + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/css/style.scss' + + +//引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +// 获取配置文件 +import axios from 'axios' +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 // 设置默认请求网址 + new Vue({ + router, + store, + render: (h) => h(App), + }).$mount('#app') +}).catch((error) => { + console.log('get baseConfig error...' + error) +}) + + diff --git a/package.json b/package.json index ddf0717..f8d7343 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.4", "echarts": "^4.6.0", "js-cookie": "^2.2.1", + "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "video.js": "^7.14.3", "vue": "^2.6.11", diff --git a/public/static/project.config.json b/public/static/project.config.json index 49b4225..1173170 100644 --- a/public/static/project.config.json +++ b/public/static/project.config.json @@ -1,11 +1,9 @@ { "title": "珠海三溪科创小镇智慧园区平台", - "baseUrl": "http://111.198.10.15:11409/", + "baseUrl": "http://36.133.150.166:20005/", "singleSys": true, "city":"三溪小镇", - "mapType":[ - "leaflet" - ], + "mapType":["leaflet"], "center":[22.289856,113.496093], "zoom":15, "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=adbdd8e08c292f6cb4e3f0289f7d0447", diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 0000000..bdb74a3 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' +// 登录 +export function login(loginForm) { + return request({ + url: 'user/login', + method: 'post', + params: loginForm + }) +} + +// 登录 +export function appLogin(username) { + return request({ + url: 'sync/token', + method: 'get', + params: { + code: username + } + }) +} + +// 获取用户信息 +export function getInfo() { + return request({ + url: '/user/info', + method: 'get' + }) +} +// 获取用户权限(菜单、按钮) +export function getMenus() { + return request({ + url: '/user/permission', + method: 'get' + }) +} +// 登出 +export function logout() { + return request({ + url: '/user/logout', + method: 'get' + }) +} +// 获取系统基础配置:公钥,验证码是否开启 +export function getConfig() { + return request({ + url: '/config/baseConfig', + method: 'get' + }) +} +// 获取验证码图片 +export function getKaptcha(sid) { + return request({ + url: '/kaptcha/base64', + method: 'get', + params: { + sid + } + }) +} + +// 获取业务权限 +export function getBizPerm(token) { + return request({ + url: '/config/getAuthorByDept', + method: 'get', + params: { token } + }) +} diff --git a/src/api/overview.js b/src/api/overview.js new file mode 100644 index 0000000..7d89ee7 --- /dev/null +++ b/src/api/overview.js @@ -0,0 +1,61 @@ +/** + * 井总览模块接口 + */ +import request from '@/utils/request' +// 井查询 +export function getWellList(params) { + return request({ + url: 'overview/wellList', + method: 'get', + params + }) +} +// 获取井详情 +export function getWellInfo(id) { + return request({ + url: 'overview/wellInfo', + method: 'get', + params: { + id: id + } + }) +} +// 获取报警列表 +export function getAlarmsNow(params) { + return request({ + url: 'overview/alarmNow', + method: 'get', + params + }) +} + +// 某井报警信息 +export function getWellAlarms(id) { + return request({ + url: 'overview/alarmsByWell', + method: 'get', + params: { + id: id + } + }) +} + +// 井查询 +export function getDeviceList(params) { + return request({ + url: 'overview/deviceList', + method: 'get', + params + }) +} +// 获取井详情 +export function getDeviceInfo(id) { + return request({ + url: 'overview/deviceDetail', + method: 'get', + params: { + id: id + } + }) +} + diff --git a/src/assets/img/map/gas.png b/src/assets/img/map/gas.png new file mode 100644 index 0000000..406fa07 --- /dev/null +++ b/src/assets/img/map/gas.png Binary files differ diff --git a/src/assets/img/map/lamp-alarm.png b/src/assets/img/map/lamp-alarm.png new file mode 100644 index 0000000..00ad3c9 --- /dev/null +++ b/src/assets/img/map/lamp-alarm.png Binary files differ diff --git a/src/assets/img/map/lamp-off.png b/src/assets/img/map/lamp-off.png new file mode 100644 index 0000000..3baee19 --- /dev/null +++ b/src/assets/img/map/lamp-off.png Binary files differ diff --git a/src/assets/img/map/lamp-offline.png b/src/assets/img/map/lamp-offline.png new file mode 100644 index 0000000..891c54b --- /dev/null +++ b/src/assets/img/map/lamp-offline.png Binary files differ diff --git a/src/assets/img/map/lamp-on.png b/src/assets/img/map/lamp-on.png new file mode 100644 index 0000000..5ca5d14 --- /dev/null +++ b/src/assets/img/map/lamp-on.png Binary files differ diff --git a/src/assets/img/map/liquid.png b/src/assets/img/map/liquid.png new file mode 100644 index 0000000..8def9f6 --- /dev/null +++ b/src/assets/img/map/liquid.png Binary files differ diff --git a/src/assets/img/map/noise.png b/src/assets/img/map/noise.png new file mode 100644 index 0000000..b83f1a2 --- /dev/null +++ b/src/assets/img/map/noise.png Binary files differ diff --git a/src/assets/img/map/poison.png b/src/assets/img/map/poison.png new file mode 100644 index 0000000..9bcaf65 --- /dev/null +++ b/src/assets/img/map/poison.png Binary files differ diff --git a/src/assets/img/map/wellCover.png b/src/assets/img/map/wellCover.png new file mode 100644 index 0000000..cd78b23 --- /dev/null +++ b/src/assets/img/map/wellCover.png Binary files differ diff --git a/src/main.js b/src/main.js index eb88707..cdad555 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,8 @@ // 全局注册图标 Vue.component('icon', Icon) +import '@/permission' // permission control + // 适配flex import '@/common/flexible.js' diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..666d267 --- /dev/null +++ b/src/permission.js @@ -0,0 +1,42 @@ +import router from './router' +import store from './store' +import { Message } from 'ant-design-vue' +import { getToken } from '@/utils/auth' // getToken from cookie + + +const whiteList = ['/login', 'config/baseconfig','/map','/main'] // 不重定向白名单 +// 全局钩子 +router.beforeEach((to, from, next) => { + // 如果有token + if (getToken()) { + // 登录后进入登录页 + if (to.path === '/login') { + next() + } else { + // 当进入非登陆页时 + if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取用户信息 + console.log(res.data) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }).catch((err) => { + store.dispatch('FedLogOut').then(() => { + Message.error(err || '权限验证失败,请重新登录系统') + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + debugger + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() + } else { + next(`/login`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach(() => { +}) diff --git a/src/router/index.js b/src/router/index.js index 5831da6..644c0e5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true }, { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true }, + { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true }, // { path: '/', name: 'index', component: () => import('../views/index.vue') }, diff --git a/src/store/getters.js b/src/store/getters.js index 4002fec..805c02c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,5 +6,17 @@ sid: state => state.app.sid, // 用户标识 currentSystem: state => state.app.currentSystem, // 用户标识 changeFlag: state => state.app.changeFlag, // 切换子系统标志 + token: state => state.user.token, // token + id: state => state.user.id, // id + account: state => state.user.account, // 账户 + name: state => state.user.name, // 姓名 + roleList: state => state.user.roleList, // 角色列表 + roleNames: state => state.user.roleNames, // 角色名称列表 + roleTips: state => state.user.roleTips, // 角色名称列表 + deptId: state => state.user.deptId, // 权属单位 + deptName: state => state.user.deptName, // 权属单位名称s + area: state => state.user.area, // 用户所在区域 + lng: state => state.user.lng, // 纬度 + lat: state => state.user.lat, // 经度 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 086b931..7cd64b9 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,22 +1,22 @@ // import Cookies from 'js-cookie' -// import { getConfig } from '@/api/login' +import { getConfig } from '@/api/login' import { getRem, getPublicKey, setPublicKey } from '../../utils/auth' const state = { device: 'desktop', // 当前设备 rem: getRem(), // 1rem等于多少px publicKey: getPublicKey(), // 公钥 - // kaptcha: '', // 验证码 - // sid: '' // sid + kaptcha: '', // 验证码 + sid: '' // sid } const mutations = { TOGGLE_DEVICE: (state, device) => { state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.publicKey = config.publicKey - // state.sid = config.sid + state.kaptcha = config.kaptcha + state.publicKey = config.publicKey + state.sid = config.sid setPublicKey(config.publicKey) }, SET_REM: (state, rem)=>{ @@ -35,17 +35,17 @@ commit('TOGGLE_DEVICE', device) }, // 获取系统配置 - // GetConfig({ commit }) { - // return new Promise((resolve, reject) => { - // // getConfig().then(response => { - // // const data = response.data - // // commit('SYS_CONFIG', data) - // // resolve() - // // }).catch(error => { - // // reject(error) - // // }) - // }) - // }, + GetConfig({ commit }) { + return new Promise((resolve, reject) => { + getConfig().then(response => { + const data = response.data + commit('SYS_CONFIG', data) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 设置rem SetRem({commit}, rem){ commit('SET_REM', rem) diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 0000000..9bbe3d9 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,154 @@ +import { login, appLogin, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', // 用户id + account: '', // 用户名 + name: '', // 姓名 + deptId: '', // 部门编号 + deptName: '', // 部门名称 + roleList: [], // 角色编号集合 + roleNames: [], // 角色名称集合 + roleTips: [], // 角色标签集合 + area: '', // 默认地区 + lng: '116.4', + lat: '39.9' + }, + mutations: { + SET_TOKEN: (state, token) => { + setToken(token) + state.token = token + console.log('getToken:',getToken() ) + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_ACCOUNT: (state, account) => { + state.account = account + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_DEPTID: (state, deptId) => { + state.deptId = deptId + }, + SET_DEPTNAME: (state, deptName) => { + state.deptName = deptName + }, + SET_ROLELIST: (state, roleList) => { + state.roleList = roleList + }, + SET_ROLENAMES: (state, roleNames) => { + state.roleNames = roleNames + }, + SET_ROLETIPS: (state, roleTips) => { + state.roleTips = roleTips + }, + SET_AREA: (state, area) => { + state.area = area + }, + SET_LNG: (state, lng) => { + state.lng = parseFloat(lng) + }, + SET_LAT: (state, lat) => { + state.lat = parseFloat(lat) + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data.token) + commit('SET_TOKEN', data.token) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + }) + }, + AppLogin({ commit }, username) { + return new Promise((resolve, reject) => { + // 如果token存在直接setToken + if (username) { + appLogin(username).then(response => { + if (response.code === 200) { + const data = response.data + setToken(data) + commit('SET_TOKEN', data) + resolve() + } else { + reject(response.message) + } + }).catch(error => { + reject(error) + }) + } else { + reject() + } + }) + }, + // 获取用户信息 + GetInfo({ commit }) { + return new Promise((resolve, reject) => { + getInfo().then(response => { + const data = response.data + if (data.roleList && data.roleList.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLELIST', data.roleList) + commit('SET_ROLENAMES', data.roleNames) + commit('SET_ROLETIPS', data.roleTips) + } else { + reject('该用户无角色') + } + if (data.deptId) { + commit('SET_DEPTID', data.deptId) + commit('SET_DEPTNAME', data.deptName) + } else { + reject('该用户无组织机构') + } + commit('SET_ID', data.id) + commit('SET_ACCOUNT', data.account) + commit('SET_NAME', data.name) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + removeToken() + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/src/utils/maputils.js b/src/utils/maputils.js new file mode 100644 index 0000000..c23efa8 --- /dev/null +++ b/src/utils/maputils.js @@ -0,0 +1,35 @@ +import * as L from 'leaflet' +// 计算坐标集合中的最大最小经纬度 +export function getPathBounds(points, keyLng, keyLat) { + const lngs = points.map(item => item[keyLng]) + const lats = points.map(item => item[keyLat]) + const maxLng = Math.max(...lngs) + const minLng = Math.min(...lngs) + const maxLat = Math.max(...lats) + const minLat = Math.min(...lats) + return { maxLng, minLng, maxLat, minLat } +} +// 根据范围计算中心坐标 +export function getCenterByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const cenLng = (parseFloat(maxLng) + parseFloat(minLng)) / 2 + const cenLat = (parseFloat(maxLat) + parseFloat(minLat)) / 2 + return { cenLat, cenLng } +} + +// 根据范围计算缩放级别 +export function getZoomByBounds(bounds) { + const { maxLng, minLng, maxLat, minLat } = bounds + const zoom = ['50', '100', '200', '500', '1000', '2000', '5000', '10000', '20000', '25000', '50000', '100000', '200000', '500000', '1000000', '2000000']// 级别18到3。 + // 计算左上角和右下角距离 + const minPoint = L.latLng(minLat, minLng) + const maxPoint = L.latLng(maxLat, maxLng) + var distance = maxPoint.distanceTo(minPoint) + for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) { + if (zoom[i] - distance > 0) { + console.log(i) + return 18 - i + 2 // 之所以会多2,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。 + } + } + return 13 +} diff --git a/src/utils/request.js b/src/utils/request.js index 6fc46fb..176d8e6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,8 @@ import axios from 'axios' // import { Message, MessageBox } from 'element-ui' -// import store from '../store' -// import { getToken } from '@/utils/auth' +import {Message} from 'ant-design-vue' +import store from '../store' +import { getToken } from '@/utils/auth' // 创建axios实例 const service = axios.create({ @@ -12,11 +13,11 @@ // request拦截器 service.interceptors.request.use( config => { - // if (store.getters.token) { - // console.log('request.js gettoken') - // config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - // console.log(config.headers['token']) - // } + if (store.getters.token) { + console.log('request.js gettoken') + config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + console.log(config.headers['token']) + } return config }, error => { @@ -55,12 +56,7 @@ // }) // }) } else { - // Message({ - // showClose: true, - // message: res.message, - // type: 'error', - // duration: 3000 - // }) + Message.error(res.message, 3) return Promise.reject(res) } // return Promise.reject(res) diff --git a/src/utils/security.js b/src/utils/security.js new file mode 100644 index 0000000..a991dd5 --- /dev/null +++ b/src/utils/security.js @@ -0,0 +1,30 @@ +/** + * 加密工具类 + * Created by wangxiaoying 2019/04/17 + * **/ +import JsEncrypt from 'jsencrypt' +import store from '../store' + +/** + * 加密 + * @param value 待加密数据 + * @returns 加密结果 + */ +export function RSAencrypt(value) { + var encrypt = new JsEncrypt() + // 如果公钥没有了,重新申请公钥 + if (store.getters.publicKey && store.getters.publicKey === '') { + store.dispatch('GetConfig').then(() => { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + }).catch((e) => { + console.log(e) + }) + } else { + encrypt.setPublicKey(store.getters.publicKey)// 从store中读取公钥 + var enRes = encrypt.encrypt(value) + return enRes + } +} + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 6d00389..49dc9ea 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -3,15 +3,19 @@