diff --git a/config/prod.env.js b/config/prod.env.js index a37f46e..8592924 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - // BASE_API: '"http://139.198.17.115:20004/smartwell"', - BASE_API: '"http://111.198.10.15:11302/smartwell"', + // BASE_API: '"http://111.198.10.15:11302/smartwell"' + BASE_API: '"http://192.168.0.218:8080/smartwell"', } diff --git a/config/prod.env.js b/config/prod.env.js index a37f46e..8592924 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - // BASE_API: '"http://139.198.17.115:20004/smartwell"', - BASE_API: '"http://111.198.10.15:11302/smartwell"', + // BASE_API: '"http://111.198.10.15:11302/smartwell"' + BASE_API: '"http://192.168.0.218:8080/smartwell"', } diff --git a/src/store/getters.js b/src/store/getters.js index f27b783..5148318 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -25,6 +25,7 @@ communications: state => state.user.communications, // 用户支持的通讯方式 area: state => state.user.area, // 用户所在区域 lng: state => state.user.lng, // 纬度 - lat: state => state.user.lat // 经度 + lat: state => state.user.lat, // 经度 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/config/prod.env.js b/config/prod.env.js index a37f46e..8592924 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - // BASE_API: '"http://139.198.17.115:20004/smartwell"', - BASE_API: '"http://111.198.10.15:11302/smartwell"', + // BASE_API: '"http://111.198.10.15:11302/smartwell"' + BASE_API: '"http://192.168.0.218:8080/smartwell"', } diff --git a/src/store/getters.js b/src/store/getters.js index f27b783..5148318 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -25,6 +25,7 @@ communications: state => state.user.communications, // 用户支持的通讯方式 area: state => state.user.area, // 用户所在区域 lng: state => state.user.lng, // 纬度 - lat: state => state.user.lat // 经度 + lat: state => state.user.lat, // 经度 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a789622..cb35221 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -16,6 +16,7 @@ wellTypes: [], // 支持窨井类型 deviceTypes: [], // 支持设备类型 communications: [], // 支持通讯方式 + resetPwd: false, area: '', // 默认地区 lng: '', lat: '' @@ -68,6 +69,9 @@ }, SET_LAT: (state, lat) => { state.lat = parseFloat(lat) + }, + SET_RESETPWD: (state, resetPwd) => { + state.resetPwd = resetPwd } }, @@ -112,6 +116,7 @@ commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) commit('SET_DATASCOPE', data.dataScope) + commit('SET_RESETPWD', data.sysData.resetPwd) resolve(response) }).catch(error => { reject(error) diff --git a/config/prod.env.js b/config/prod.env.js index a37f46e..8592924 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - // BASE_API: '"http://139.198.17.115:20004/smartwell"', - BASE_API: '"http://111.198.10.15:11302/smartwell"', + // BASE_API: '"http://111.198.10.15:11302/smartwell"' + BASE_API: '"http://192.168.0.218:8080/smartwell"', } diff --git a/src/store/getters.js b/src/store/getters.js index f27b783..5148318 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -25,6 +25,7 @@ communications: state => state.user.communications, // 用户支持的通讯方式 area: state => state.user.area, // 用户所在区域 lng: state => state.user.lng, // 纬度 - lat: state => state.user.lat // 经度 + lat: state => state.user.lat, // 经度 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a789622..cb35221 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -16,6 +16,7 @@ wellTypes: [], // 支持窨井类型 deviceTypes: [], // 支持设备类型 communications: [], // 支持通讯方式 + resetPwd: false, area: '', // 默认地区 lng: '', lat: '' @@ -68,6 +69,9 @@ }, SET_LAT: (state, lat) => { state.lat = parseFloat(lat) + }, + SET_RESETPWD: (state, resetPwd) => { + state.resetPwd = resetPwd } }, @@ -112,6 +116,7 @@ commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) commit('SET_DATASCOPE', data.dataScope) + commit('SET_RESETPWD', data.sysData.resetPwd) resolve(response) }).catch(error => { reject(error) diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index f4c25b6..9504f95 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -51,10 +51,12 @@ import DeviceCountByOnline from './components/DeviceCountByOnline' import AlarmByDays from './components/AlarmByDays' import JobByStatus from './components/JobByStatus' +import ResetPwd from '../system/user/resetPwd' export default { name: 'Dashboard', components: { + ResetPwd, JobByStatus, AlarmByDays, PanelGroup, @@ -66,7 +68,8 @@ data() { return { // wsPath: 'ws://139.198.17.115:20004/smartwell/websocket/' - wsPath: 'ws://111.198.10.15:11302/smartwell/websocket/' + wsPath: 'ws://192.168.0.218:8080/smartwell/websocket/', + showSetPwd: this.$store.getters.resetPwd } }, computed: { diff --git a/config/prod.env.js b/config/prod.env.js index a37f46e..8592924 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - // BASE_API: '"http://139.198.17.115:20004/smartwell"', - BASE_API: '"http://111.198.10.15:11302/smartwell"', + // BASE_API: '"http://111.198.10.15:11302/smartwell"' + BASE_API: '"http://192.168.0.218:8080/smartwell"', } diff --git a/src/store/getters.js b/src/store/getters.js index f27b783..5148318 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -25,6 +25,7 @@ communications: state => state.user.communications, // 用户支持的通讯方式 area: state => state.user.area, // 用户所在区域 lng: state => state.user.lng, // 纬度 - lat: state => state.user.lat // 经度 + lat: state => state.user.lat, // 经度 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a789622..cb35221 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -16,6 +16,7 @@ wellTypes: [], // 支持窨井类型 deviceTypes: [], // 支持设备类型 communications: [], // 支持通讯方式 + resetPwd: false, area: '', // 默认地区 lng: '', lat: '' @@ -68,6 +69,9 @@ }, SET_LAT: (state, lat) => { state.lat = parseFloat(lat) + }, + SET_RESETPWD: (state, resetPwd) => { + state.resetPwd = resetPwd } }, @@ -112,6 +116,7 @@ commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) commit('SET_DATASCOPE', data.dataScope) + commit('SET_RESETPWD', data.sysData.resetPwd) resolve(response) }).catch(error => { reject(error) diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index f4c25b6..9504f95 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -51,10 +51,12 @@ import DeviceCountByOnline from './components/DeviceCountByOnline' import AlarmByDays from './components/AlarmByDays' import JobByStatus from './components/JobByStatus' +import ResetPwd from '../system/user/resetPwd' export default { name: 'Dashboard', components: { + ResetPwd, JobByStatus, AlarmByDays, PanelGroup, @@ -66,7 +68,8 @@ data() { return { // wsPath: 'ws://139.198.17.115:20004/smartwell/websocket/' - wsPath: 'ws://111.198.10.15:11302/smartwell/websocket/' + wsPath: 'ws://192.168.0.218:8080/smartwell/websocket/', + showSetPwd: this.$store.getters.resetPwd } }, computed: { diff --git a/src/views/layout/components/AppHeader.vue b/src/views/layout/components/AppHeader.vue index 9bd0ceb..260bdca 100644 --- a/src/views/layout/components/AppHeader.vue +++ b/src/views/layout/components/AppHeader.vue @@ -15,14 +15,14 @@ - 修改密码 + 修改密码 注销 - + @@ -43,9 +43,15 @@ computed: { ...mapGetters([ 'sidebar', - 'avatar' + 'avatar', + 'resetPwd' ]) }, + mounted() { + if (this.resetPwd) { + this.$refs.retPwd.initDialog(true) + } + }, methods: { toggleSideBar() { this.$store.dispatch('ToggleSideBar') @@ -55,7 +61,7 @@ location.reload() // 为了重新实例化vue-router对象 避免bug }) }, - resetPwd() { + resetPassword() { this.showSetPwd = true this.$refs.retPwd.initDialog(true) } diff --git a/config/prod.env.js b/config/prod.env.js index a37f46e..8592924 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,6 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - // BASE_API: '"http://139.198.17.115:20004/smartwell"', - BASE_API: '"http://111.198.10.15:11302/smartwell"', + // BASE_API: '"http://111.198.10.15:11302/smartwell"' + BASE_API: '"http://192.168.0.218:8080/smartwell"', } diff --git a/src/store/getters.js b/src/store/getters.js index f27b783..5148318 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -25,6 +25,7 @@ communications: state => state.user.communications, // 用户支持的通讯方式 area: state => state.user.area, // 用户所在区域 lng: state => state.user.lng, // 纬度 - lat: state => state.user.lat // 经度 + lat: state => state.user.lat, // 经度 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a789622..cb35221 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -16,6 +16,7 @@ wellTypes: [], // 支持窨井类型 deviceTypes: [], // 支持设备类型 communications: [], // 支持通讯方式 + resetPwd: false, area: '', // 默认地区 lng: '', lat: '' @@ -68,6 +69,9 @@ }, SET_LAT: (state, lat) => { state.lat = parseFloat(lat) + }, + SET_RESETPWD: (state, resetPwd) => { + state.resetPwd = resetPwd } }, @@ -112,6 +116,7 @@ commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) commit('SET_DATASCOPE', data.dataScope) + commit('SET_RESETPWD', data.sysData.resetPwd) resolve(response) }).catch(error => { reject(error) diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index f4c25b6..9504f95 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -51,10 +51,12 @@ import DeviceCountByOnline from './components/DeviceCountByOnline' import AlarmByDays from './components/AlarmByDays' import JobByStatus from './components/JobByStatus' +import ResetPwd from '../system/user/resetPwd' export default { name: 'Dashboard', components: { + ResetPwd, JobByStatus, AlarmByDays, PanelGroup, @@ -66,7 +68,8 @@ data() { return { // wsPath: 'ws://139.198.17.115:20004/smartwell/websocket/' - wsPath: 'ws://111.198.10.15:11302/smartwell/websocket/' + wsPath: 'ws://192.168.0.218:8080/smartwell/websocket/', + showSetPwd: this.$store.getters.resetPwd } }, computed: { diff --git a/src/views/layout/components/AppHeader.vue b/src/views/layout/components/AppHeader.vue index 9bd0ceb..260bdca 100644 --- a/src/views/layout/components/AppHeader.vue +++ b/src/views/layout/components/AppHeader.vue @@ -15,14 +15,14 @@ - 修改密码 + 修改密码 注销 - + @@ -43,9 +43,15 @@ computed: { ...mapGetters([ 'sidebar', - 'avatar' + 'avatar', + 'resetPwd' ]) }, + mounted() { + if (this.resetPwd) { + this.$refs.retPwd.initDialog(true) + } + }, methods: { toggleSideBar() { this.$store.dispatch('ToggleSideBar') @@ -55,7 +61,7 @@ location.reload() // 为了重新实例化vue-router对象 避免bug }) }, - resetPwd() { + resetPassword() { this.showSetPwd = true this.$refs.retPwd.initDialog(true) } diff --git a/src/views/system/user/resetPwd.vue b/src/views/system/user/resetPwd.vue index 8d18ff3..c960a03 100644 --- a/src/views/system/user/resetPwd.vue +++ b/src/views/system/user/resetPwd.vue @@ -1,5 +1,5 @@ @@ -26,6 +26,12 @@ export default { name: 'ResetPwd', components: { SelectTree }, + props: { + close: { + type: Boolean, + default: true + } // 是否显示关闭按钮 + }, data() { const validateOldPass = (rule, value, callback) => { console.log('验证旧密码') @@ -39,24 +45,24 @@ if (value === '') { callback(new Error('密码不能为空')) } else { - var reg = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*]+$)[a-zA-Z\d!@#$%^&*]+$/ + // var reg = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*]+$)[a-zA-Z\d!@#$%^&*]+$/ + var reg = /^(?![a-zA-Z]+$)(?![a-z\d]+$)(?![a-z!@#\$%]+$)(?![A-Z\d]+$)(?![A-Z!@#\$%]+$)(?![\d!@#\$%]+$)[a-zA-Z\d!@#\$%]+$/ if (value.match(reg)) { // 样式匹配 - if (value.length < 8 || value.length > 16) { - callback(new Error('密码长度必须在8到16位之间')) + if (value.length < 12 || value.length > 30) { + callback(new Error('密码长度至少12位')) } else { if (this.userForm.repassword !== '') { this.$refs.dataForm.validateField('repassword') } } } else { - callback(new Error('必须由数字、字母、字符中至少两种组成')) + callback(new Error('须包含数字、大小写字母、特殊字符中至少三种')) } callback() } } const validateRepass = (rule, value, callback) => { console.log('验证重复密码') - debugger if (value === '') { callback(new Error('重复密码不能为空')) } else if (value !== this.userForm.password) {