diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/src/page/login/login.vue b/src/page/login/login.vue index 43eb8fa..58e6cd6 100644 --- a/src/page/login/login.vue +++ b/src/page/login/login.vue @@ -13,6 +13,10 @@ +
+ + 验证码 +
登录 @@ -26,17 +30,22 @@ import { MyLocalStorage } from 'assets/js/utils' import { LOGIN_FLAG, AD_FLAG } from 'assets/js/storageConst' import { RSAencrypt } from '@/utils/security' + import { getKaptcha } from '@/api/login' export default { name: 'Login', data () { return { + loading: true, backgroundImg: require('@/assets/image/login-back.png'), logoImg: require('@/assets/image/icon-yizhuang.png'), + kaptcha_src: '', loginForm: { username: '', password: '', - } + kaptcha:'' + }, + showKaptcha: true } }, mounted(){ @@ -51,6 +60,11 @@ position: 'bottom', duration: 1 * 1000 }) + this.showKaptcha = this.$store.getters.kaptcha + if(this.showKaptcha){ + this.refreshCode() + } + this.loading = true }).catch((error)=>{ // this.getConfig() }) @@ -75,6 +89,16 @@ }) return false } + if(this.showKaptcha){ + if(this.loginForm.kaptcha.length==0){ + Toast({ + message: '验证码不能为空', + position: 'bottom', + duration: 3 * 1000 + }) + return false + } + } return true }, //登录 @@ -82,18 +106,32 @@ this.loading = true if (this.validateInputs()) {//通过验证 const loginForm = { - // sid: this.$store.getters.sid, + sid: this.$store.getters.sid, username: this.loginForm.username, password: RSAencrypt(this.loginForm.password), + kaptcha: this.loginForm.kaptcha } this.$store.dispatch('Login', loginForm).then(() => { this.loading = false this.$router.replace({name: 'index'}) }).catch(() => { this.loading = false + this.refreshCode() }) } - } + }, + // 刷新验证码 + refreshCode() { + new Promise((resolve, reject) => { + getKaptcha().then(response => { + console.log('kaptcha:' + response.data.kaptcha) + this.kaptcha_src = response.data.kaptcha + resolve() + }).catch(error => { + reject(error) + }) + }) + }, } } @@ -182,4 +220,25 @@ .slide-enter, .slide-leave-to transform: translate3d(100%, 0, 0) + .kaptcha-div{ + display flex; + /*justify-content space-between*/ + line-height 40px + margin-bottom 5px + input{ + width:60% + border-bottom 1px solid #f0f0f0 + padding-left 10px + background-color #fff + color $color-text!important + font-size 20px + -webkit-appearance: none + border-radius: 0 + } + .kaptcha{ + width:40%; + height 40px; + } + } + diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/src/page/login/login.vue b/src/page/login/login.vue index 43eb8fa..58e6cd6 100644 --- a/src/page/login/login.vue +++ b/src/page/login/login.vue @@ -13,6 +13,10 @@
+
+ + 验证码 +
登录 @@ -26,17 +30,22 @@ import { MyLocalStorage } from 'assets/js/utils' import { LOGIN_FLAG, AD_FLAG } from 'assets/js/storageConst' import { RSAencrypt } from '@/utils/security' + import { getKaptcha } from '@/api/login' export default { name: 'Login', data () { return { + loading: true, backgroundImg: require('@/assets/image/login-back.png'), logoImg: require('@/assets/image/icon-yizhuang.png'), + kaptcha_src: '', loginForm: { username: '', password: '', - } + kaptcha:'' + }, + showKaptcha: true } }, mounted(){ @@ -51,6 +60,11 @@ position: 'bottom', duration: 1 * 1000 }) + this.showKaptcha = this.$store.getters.kaptcha + if(this.showKaptcha){ + this.refreshCode() + } + this.loading = true }).catch((error)=>{ // this.getConfig() }) @@ -75,6 +89,16 @@ }) return false } + if(this.showKaptcha){ + if(this.loginForm.kaptcha.length==0){ + Toast({ + message: '验证码不能为空', + position: 'bottom', + duration: 3 * 1000 + }) + return false + } + } return true }, //登录 @@ -82,18 +106,32 @@ this.loading = true if (this.validateInputs()) {//通过验证 const loginForm = { - // sid: this.$store.getters.sid, + sid: this.$store.getters.sid, username: this.loginForm.username, password: RSAencrypt(this.loginForm.password), + kaptcha: this.loginForm.kaptcha } this.$store.dispatch('Login', loginForm).then(() => { this.loading = false this.$router.replace({name: 'index'}) }).catch(() => { this.loading = false + this.refreshCode() }) } - } + }, + // 刷新验证码 + refreshCode() { + new Promise((resolve, reject) => { + getKaptcha().then(response => { + console.log('kaptcha:' + response.data.kaptcha) + this.kaptcha_src = response.data.kaptcha + resolve() + }).catch(error => { + reject(error) + }) + }) + }, } } @@ -182,4 +220,25 @@ .slide-enter, .slide-leave-to transform: translate3d(100%, 0, 0) + .kaptcha-div{ + display flex; + /*justify-content space-between*/ + line-height 40px + margin-bottom 5px + input{ + width:60% + border-bottom 1px solid #f0f0f0 + padding-left 10px + background-color #fff + color $color-text!important + font-size 20px + -webkit-appearance: none + border-radius: 0 + } + .kaptcha{ + width:40%; + height 40px; + } + } + diff --git a/src/page/mine/modules/ResetPwd.vue b/src/page/mine/modules/ResetPwd.vue index 74f8334..8a7308b 100644 --- a/src/page/mine/modules/ResetPwd.vue +++ b/src/page/mine/modules/ResetPwd.vue @@ -3,13 +3,13 @@
-
+
- +
@@ -36,8 +36,19 @@ oldPasswordValidate:'', newPasswordValidate:'', rePasswordValidate:'', + force: false } }, + created(){ + debugger + if(this.$route.query && this.$route.query.force) + this.force = this.$route.query.force + Toast({ + message: '初次登录请修改密码', + position: 'center', + duration: 3 * 1000 + }) + }, methods:{ //验证原密码 validateOldPass(){ @@ -61,7 +72,7 @@ this.newPasswordValidate = 'error' return false }else{ - 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)){ this.newPasswordValidate = 'success' return true @@ -93,7 +104,7 @@ return } if(this.validateNewPass()==false){ - Toast('密码必须8到16位数字、字母组合,或数字、字符组合,或字母、字符组合') + Toast('密码长度至少12位,且包含数字、大、小写字母、特殊字符中至少三种') return } if(this.validateRePass()==false){ diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/src/page/login/login.vue b/src/page/login/login.vue index 43eb8fa..58e6cd6 100644 --- a/src/page/login/login.vue +++ b/src/page/login/login.vue @@ -13,6 +13,10 @@
+
+ + 验证码 +
登录 @@ -26,17 +30,22 @@ import { MyLocalStorage } from 'assets/js/utils' import { LOGIN_FLAG, AD_FLAG } from 'assets/js/storageConst' import { RSAencrypt } from '@/utils/security' + import { getKaptcha } from '@/api/login' export default { name: 'Login', data () { return { + loading: true, backgroundImg: require('@/assets/image/login-back.png'), logoImg: require('@/assets/image/icon-yizhuang.png'), + kaptcha_src: '', loginForm: { username: '', password: '', - } + kaptcha:'' + }, + showKaptcha: true } }, mounted(){ @@ -51,6 +60,11 @@ position: 'bottom', duration: 1 * 1000 }) + this.showKaptcha = this.$store.getters.kaptcha + if(this.showKaptcha){ + this.refreshCode() + } + this.loading = true }).catch((error)=>{ // this.getConfig() }) @@ -75,6 +89,16 @@ }) return false } + if(this.showKaptcha){ + if(this.loginForm.kaptcha.length==0){ + Toast({ + message: '验证码不能为空', + position: 'bottom', + duration: 3 * 1000 + }) + return false + } + } return true }, //登录 @@ -82,18 +106,32 @@ this.loading = true if (this.validateInputs()) {//通过验证 const loginForm = { - // sid: this.$store.getters.sid, + sid: this.$store.getters.sid, username: this.loginForm.username, password: RSAencrypt(this.loginForm.password), + kaptcha: this.loginForm.kaptcha } this.$store.dispatch('Login', loginForm).then(() => { this.loading = false this.$router.replace({name: 'index'}) }).catch(() => { this.loading = false + this.refreshCode() }) } - } + }, + // 刷新验证码 + refreshCode() { + new Promise((resolve, reject) => { + getKaptcha().then(response => { + console.log('kaptcha:' + response.data.kaptcha) + this.kaptcha_src = response.data.kaptcha + resolve() + }).catch(error => { + reject(error) + }) + }) + }, } } @@ -182,4 +220,25 @@ .slide-enter, .slide-leave-to transform: translate3d(100%, 0, 0) + .kaptcha-div{ + display flex; + /*justify-content space-between*/ + line-height 40px + margin-bottom 5px + input{ + width:60% + border-bottom 1px solid #f0f0f0 + padding-left 10px + background-color #fff + color $color-text!important + font-size 20px + -webkit-appearance: none + border-radius: 0 + } + .kaptcha{ + width:40%; + height 40px; + } + } + diff --git a/src/page/mine/modules/ResetPwd.vue b/src/page/mine/modules/ResetPwd.vue index 74f8334..8a7308b 100644 --- a/src/page/mine/modules/ResetPwd.vue +++ b/src/page/mine/modules/ResetPwd.vue @@ -3,13 +3,13 @@
-
+
- +
@@ -36,8 +36,19 @@ oldPasswordValidate:'', newPasswordValidate:'', rePasswordValidate:'', + force: false } }, + created(){ + debugger + if(this.$route.query && this.$route.query.force) + this.force = this.$route.query.force + Toast({ + message: '初次登录请修改密码', + position: 'center', + duration: 3 * 1000 + }) + }, methods:{ //验证原密码 validateOldPass(){ @@ -61,7 +72,7 @@ this.newPasswordValidate = 'error' return false }else{ - 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)){ this.newPasswordValidate = 'success' return true @@ -93,7 +104,7 @@ return } if(this.validateNewPass()==false){ - Toast('密码必须8到16位数字、字母组合,或数字、字符组合,或字母、字符组合') + Toast('密码长度至少12位,且包含数字、大、小写字母、特殊字符中至少三种') return } if(this.validateRePass()==false){ diff --git a/src/store/getters.js b/src/store/getters.js index 1107334..cc4eac7 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -23,6 +23,7 @@ wellTypes: state => state.user.wellTypes, // 用户支持的窨井类型 deviceTypes: state => state.user.deviceTypes, // 用户支持的设备类型 communications: state => state.user.communications, // 用户支持的通讯方式 - area: state => state.user.area // 用户所在区域 + area: state => state.user.area, // 用户所在区域 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/src/page/login/login.vue b/src/page/login/login.vue index 43eb8fa..58e6cd6 100644 --- a/src/page/login/login.vue +++ b/src/page/login/login.vue @@ -13,6 +13,10 @@
+
+ + 验证码 +
登录 @@ -26,17 +30,22 @@ import { MyLocalStorage } from 'assets/js/utils' import { LOGIN_FLAG, AD_FLAG } from 'assets/js/storageConst' import { RSAencrypt } from '@/utils/security' + import { getKaptcha } from '@/api/login' export default { name: 'Login', data () { return { + loading: true, backgroundImg: require('@/assets/image/login-back.png'), logoImg: require('@/assets/image/icon-yizhuang.png'), + kaptcha_src: '', loginForm: { username: '', password: '', - } + kaptcha:'' + }, + showKaptcha: true } }, mounted(){ @@ -51,6 +60,11 @@ position: 'bottom', duration: 1 * 1000 }) + this.showKaptcha = this.$store.getters.kaptcha + if(this.showKaptcha){ + this.refreshCode() + } + this.loading = true }).catch((error)=>{ // this.getConfig() }) @@ -75,6 +89,16 @@ }) return false } + if(this.showKaptcha){ + if(this.loginForm.kaptcha.length==0){ + Toast({ + message: '验证码不能为空', + position: 'bottom', + duration: 3 * 1000 + }) + return false + } + } return true }, //登录 @@ -82,18 +106,32 @@ this.loading = true if (this.validateInputs()) {//通过验证 const loginForm = { - // sid: this.$store.getters.sid, + sid: this.$store.getters.sid, username: this.loginForm.username, password: RSAencrypt(this.loginForm.password), + kaptcha: this.loginForm.kaptcha } this.$store.dispatch('Login', loginForm).then(() => { this.loading = false this.$router.replace({name: 'index'}) }).catch(() => { this.loading = false + this.refreshCode() }) } - } + }, + // 刷新验证码 + refreshCode() { + new Promise((resolve, reject) => { + getKaptcha().then(response => { + console.log('kaptcha:' + response.data.kaptcha) + this.kaptcha_src = response.data.kaptcha + resolve() + }).catch(error => { + reject(error) + }) + }) + }, } } @@ -182,4 +220,25 @@ .slide-enter, .slide-leave-to transform: translate3d(100%, 0, 0) + .kaptcha-div{ + display flex; + /*justify-content space-between*/ + line-height 40px + margin-bottom 5px + input{ + width:60% + border-bottom 1px solid #f0f0f0 + padding-left 10px + background-color #fff + color $color-text!important + font-size 20px + -webkit-appearance: none + border-radius: 0 + } + .kaptcha{ + width:40%; + height 40px; + } + } + diff --git a/src/page/mine/modules/ResetPwd.vue b/src/page/mine/modules/ResetPwd.vue index 74f8334..8a7308b 100644 --- a/src/page/mine/modules/ResetPwd.vue +++ b/src/page/mine/modules/ResetPwd.vue @@ -3,13 +3,13 @@
-
+
- +
@@ -36,8 +36,19 @@ oldPasswordValidate:'', newPasswordValidate:'', rePasswordValidate:'', + force: false } }, + created(){ + debugger + if(this.$route.query && this.$route.query.force) + this.force = this.$route.query.force + Toast({ + message: '初次登录请修改密码', + position: 'center', + duration: 3 * 1000 + }) + }, methods:{ //验证原密码 validateOldPass(){ @@ -61,7 +72,7 @@ this.newPasswordValidate = 'error' return false }else{ - 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)){ this.newPasswordValidate = 'success' return true @@ -93,7 +104,7 @@ return } if(this.validateNewPass()==false){ - Toast('密码必须8到16位数字、字母组合,或数字、字符组合,或字母、字符组合') + Toast('密码长度至少12位,且包含数字、大、小写字母、特殊字符中至少三种') return } if(this.validateRePass()==false){ diff --git a/src/store/getters.js b/src/store/getters.js index 1107334..cc4eac7 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -23,6 +23,7 @@ wellTypes: state => state.user.wellTypes, // 用户支持的窨井类型 deviceTypes: state => state.user.deviceTypes, // 用户支持的设备类型 communications: state => state.user.communications, // 用户支持的通讯方式 - area: state => state.user.area // 用户所在区域 + area: state => state.user.area, // 用户所在区域 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index b8ce2ac..d300a4c 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -18,8 +18,8 @@ state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.sid = config.sid + state.kaptcha = config.appKaptcha + state.sid = config.sid state.publicKey = config.publicKey setPublicKey(config.publicKey) }, diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/src/page/login/login.vue b/src/page/login/login.vue index 43eb8fa..58e6cd6 100644 --- a/src/page/login/login.vue +++ b/src/page/login/login.vue @@ -13,6 +13,10 @@
+
+ + 验证码 +
登录 @@ -26,17 +30,22 @@ import { MyLocalStorage } from 'assets/js/utils' import { LOGIN_FLAG, AD_FLAG } from 'assets/js/storageConst' import { RSAencrypt } from '@/utils/security' + import { getKaptcha } from '@/api/login' export default { name: 'Login', data () { return { + loading: true, backgroundImg: require('@/assets/image/login-back.png'), logoImg: require('@/assets/image/icon-yizhuang.png'), + kaptcha_src: '', loginForm: { username: '', password: '', - } + kaptcha:'' + }, + showKaptcha: true } }, mounted(){ @@ -51,6 +60,11 @@ position: 'bottom', duration: 1 * 1000 }) + this.showKaptcha = this.$store.getters.kaptcha + if(this.showKaptcha){ + this.refreshCode() + } + this.loading = true }).catch((error)=>{ // this.getConfig() }) @@ -75,6 +89,16 @@ }) return false } + if(this.showKaptcha){ + if(this.loginForm.kaptcha.length==0){ + Toast({ + message: '验证码不能为空', + position: 'bottom', + duration: 3 * 1000 + }) + return false + } + } return true }, //登录 @@ -82,18 +106,32 @@ this.loading = true if (this.validateInputs()) {//通过验证 const loginForm = { - // sid: this.$store.getters.sid, + sid: this.$store.getters.sid, username: this.loginForm.username, password: RSAencrypt(this.loginForm.password), + kaptcha: this.loginForm.kaptcha } this.$store.dispatch('Login', loginForm).then(() => { this.loading = false this.$router.replace({name: 'index'}) }).catch(() => { this.loading = false + this.refreshCode() }) } - } + }, + // 刷新验证码 + refreshCode() { + new Promise((resolve, reject) => { + getKaptcha().then(response => { + console.log('kaptcha:' + response.data.kaptcha) + this.kaptcha_src = response.data.kaptcha + resolve() + }).catch(error => { + reject(error) + }) + }) + }, } } @@ -182,4 +220,25 @@ .slide-enter, .slide-leave-to transform: translate3d(100%, 0, 0) + .kaptcha-div{ + display flex; + /*justify-content space-between*/ + line-height 40px + margin-bottom 5px + input{ + width:60% + border-bottom 1px solid #f0f0f0 + padding-left 10px + background-color #fff + color $color-text!important + font-size 20px + -webkit-appearance: none + border-radius: 0 + } + .kaptcha{ + width:40%; + height 40px; + } + } + diff --git a/src/page/mine/modules/ResetPwd.vue b/src/page/mine/modules/ResetPwd.vue index 74f8334..8a7308b 100644 --- a/src/page/mine/modules/ResetPwd.vue +++ b/src/page/mine/modules/ResetPwd.vue @@ -3,13 +3,13 @@
-
+
- +
@@ -36,8 +36,19 @@ oldPasswordValidate:'', newPasswordValidate:'', rePasswordValidate:'', + force: false } }, + created(){ + debugger + if(this.$route.query && this.$route.query.force) + this.force = this.$route.query.force + Toast({ + message: '初次登录请修改密码', + position: 'center', + duration: 3 * 1000 + }) + }, methods:{ //验证原密码 validateOldPass(){ @@ -61,7 +72,7 @@ this.newPasswordValidate = 'error' return false }else{ - 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)){ this.newPasswordValidate = 'success' return true @@ -93,7 +104,7 @@ return } if(this.validateNewPass()==false){ - Toast('密码必须8到16位数字、字母组合,或数字、字符组合,或字母、字符组合') + Toast('密码长度至少12位,且包含数字、大、小写字母、特殊字符中至少三种') return } if(this.validateRePass()==false){ diff --git a/src/store/getters.js b/src/store/getters.js index 1107334..cc4eac7 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -23,6 +23,7 @@ wellTypes: state => state.user.wellTypes, // 用户支持的窨井类型 deviceTypes: state => state.user.deviceTypes, // 用户支持的设备类型 communications: state => state.user.communications, // 用户支持的通讯方式 - area: state => state.user.area // 用户所在区域 + area: state => state.user.area, // 用户所在区域 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index b8ce2ac..d300a4c 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -18,8 +18,8 @@ state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.sid = config.sid + state.kaptcha = config.appKaptcha + state.sid = config.sid state.publicKey = config.publicKey setPublicKey(config.publicKey) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 4acb4d6..54111f0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -28,7 +28,8 @@ wellTypes: [], // 支持窨井类型 deviceTypes: [], // 支持设备类型 communications: [], // 支持通讯方式 - area: '' // 默认地区 + area: '', // 默认地区 + resetPwd: false // 需要重置密码 }, mutations: { SET_TOKEN: (state, token) => { @@ -79,6 +80,9 @@ }, SET_AREA: (state, area) => { state.area = area + }, + SET_RESETPWD: (state, resetPwd) => { + state.resetPwd = resetPwd } }, @@ -123,6 +127,7 @@ } commit('SET_NAME', data.name) commit('SET_PHONE', data.phone) + commit('SET_RESETPWD', data.sysData.resetPwd) resolve(response) }).catch(error => { reject(error) diff --git a/config/dev.env.js b/config/dev.env.js index 6b3a09b..16734ec 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,6 +4,7 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"http://111.198.10.15:11302/smartwell"', // BASE_API: '"http://192.168.0.166:14537"', }) diff --git a/config/prod.env.js b/config/prod.env.js index 074d9a2..f4c25bd 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,8 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://139.198.17.115:20004/smartwell"', + // BASE_API: '"http://139.198.17.115:20004/smartwell"', + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"', + // BASE_API: '"http://111.198.10.15:8098/smartwell"', // BASE_API: '"http://106.74.146.218:2031"', } diff --git a/src/page/layout/index.vue b/src/page/layout/index.vue index ea65b68..b79cae0 100644 --- a/src/page/layout/index.vue +++ b/src/page/layout/index.vue @@ -127,10 +127,22 @@ created () { console.log("created") plusReady(this.plusReady) + debugger + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } // this.setLocalStorage() // 储存本地存储 this.fetchData() }, activated(){ + // 判断是不是要强制修改密码,如果需要的话跳转到修改密码页面 + const resetPwd = this.$store.getters.resetPwd + if(resetPwd){ + this.$router.push({ path:'/resetPwd', query:{force:true}}) + } + // 注册个推 const cid = this.$store.getters.cid console.log('cid:'+cid) if(cid && cid!=''){ diff --git a/src/page/login/login.vue b/src/page/login/login.vue index 43eb8fa..58e6cd6 100644 --- a/src/page/login/login.vue +++ b/src/page/login/login.vue @@ -13,6 +13,10 @@
+
+ + 验证码 +
登录 @@ -26,17 +30,22 @@ import { MyLocalStorage } from 'assets/js/utils' import { LOGIN_FLAG, AD_FLAG } from 'assets/js/storageConst' import { RSAencrypt } from '@/utils/security' + import { getKaptcha } from '@/api/login' export default { name: 'Login', data () { return { + loading: true, backgroundImg: require('@/assets/image/login-back.png'), logoImg: require('@/assets/image/icon-yizhuang.png'), + kaptcha_src: '', loginForm: { username: '', password: '', - } + kaptcha:'' + }, + showKaptcha: true } }, mounted(){ @@ -51,6 +60,11 @@ position: 'bottom', duration: 1 * 1000 }) + this.showKaptcha = this.$store.getters.kaptcha + if(this.showKaptcha){ + this.refreshCode() + } + this.loading = true }).catch((error)=>{ // this.getConfig() }) @@ -75,6 +89,16 @@ }) return false } + if(this.showKaptcha){ + if(this.loginForm.kaptcha.length==0){ + Toast({ + message: '验证码不能为空', + position: 'bottom', + duration: 3 * 1000 + }) + return false + } + } return true }, //登录 @@ -82,18 +106,32 @@ this.loading = true if (this.validateInputs()) {//通过验证 const loginForm = { - // sid: this.$store.getters.sid, + sid: this.$store.getters.sid, username: this.loginForm.username, password: RSAencrypt(this.loginForm.password), + kaptcha: this.loginForm.kaptcha } this.$store.dispatch('Login', loginForm).then(() => { this.loading = false this.$router.replace({name: 'index'}) }).catch(() => { this.loading = false + this.refreshCode() }) } - } + }, + // 刷新验证码 + refreshCode() { + new Promise((resolve, reject) => { + getKaptcha().then(response => { + console.log('kaptcha:' + response.data.kaptcha) + this.kaptcha_src = response.data.kaptcha + resolve() + }).catch(error => { + reject(error) + }) + }) + }, } } @@ -182,4 +220,25 @@ .slide-enter, .slide-leave-to transform: translate3d(100%, 0, 0) + .kaptcha-div{ + display flex; + /*justify-content space-between*/ + line-height 40px + margin-bottom 5px + input{ + width:60% + border-bottom 1px solid #f0f0f0 + padding-left 10px + background-color #fff + color $color-text!important + font-size 20px + -webkit-appearance: none + border-radius: 0 + } + .kaptcha{ + width:40%; + height 40px; + } + } + diff --git a/src/page/mine/modules/ResetPwd.vue b/src/page/mine/modules/ResetPwd.vue index 74f8334..8a7308b 100644 --- a/src/page/mine/modules/ResetPwd.vue +++ b/src/page/mine/modules/ResetPwd.vue @@ -3,13 +3,13 @@
-
+
- +
@@ -36,8 +36,19 @@ oldPasswordValidate:'', newPasswordValidate:'', rePasswordValidate:'', + force: false } }, + created(){ + debugger + if(this.$route.query && this.$route.query.force) + this.force = this.$route.query.force + Toast({ + message: '初次登录请修改密码', + position: 'center', + duration: 3 * 1000 + }) + }, methods:{ //验证原密码 validateOldPass(){ @@ -61,7 +72,7 @@ this.newPasswordValidate = 'error' return false }else{ - 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)){ this.newPasswordValidate = 'success' return true @@ -93,7 +104,7 @@ return } if(this.validateNewPass()==false){ - Toast('密码必须8到16位数字、字母组合,或数字、字符组合,或字母、字符组合') + Toast('密码长度至少12位,且包含数字、大、小写字母、特殊字符中至少三种') return } if(this.validateRePass()==false){ diff --git a/src/store/getters.js b/src/store/getters.js index 1107334..cc4eac7 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -23,6 +23,7 @@ wellTypes: state => state.user.wellTypes, // 用户支持的窨井类型 deviceTypes: state => state.user.deviceTypes, // 用户支持的设备类型 communications: state => state.user.communications, // 用户支持的通讯方式 - area: state => state.user.area // 用户所在区域 + area: state => state.user.area, // 用户所在区域 + resetPwd: state => state.user.resetPwd // 是否要重置密码 } export default getters diff --git a/src/store/modules/app.js b/src/store/modules/app.js index b8ce2ac..d300a4c 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -18,8 +18,8 @@ state.device = device }, SYS_CONFIG: (state, config) => { - // state.kaptcha = config.kaptcha - // state.sid = config.sid + state.kaptcha = config.appKaptcha + state.sid = config.sid state.publicKey = config.publicKey setPublicKey(config.publicKey) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 4acb4d6..54111f0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -28,7 +28,8 @@ wellTypes: [], // 支持窨井类型 deviceTypes: [], // 支持设备类型 communications: [], // 支持通讯方式 - area: '' // 默认地区 + area: '', // 默认地区 + resetPwd: false // 需要重置密码 }, mutations: { SET_TOKEN: (state, token) => { @@ -79,6 +80,9 @@ }, SET_AREA: (state, area) => { state.area = area + }, + SET_RESETPWD: (state, resetPwd) => { + state.resetPwd = resetPwd } }, @@ -123,6 +127,7 @@ } commit('SET_NAME', data.name) commit('SET_PHONE', data.phone) + commit('SET_RESETPWD', data.sysData.resetPwd) resolve(response) }).catch(error => { reject(error) diff --git a/unpackage/resources/H58F8F36D/www/src/api/login.js b/unpackage/resources/H58F8F36D/www/src/api/login.js index f268db5..7927fba 100644 --- a/unpackage/resources/H58F8F36D/www/src/api/login.js +++ b/unpackage/resources/H58F8F36D/www/src/api/login.js @@ -44,7 +44,7 @@ // 获取验证码图片 export function getKaptcha() { return request({ - url: '/kaptcha', + url: '/kaptcha/base64', method: 'get' }) }