diff --git a/src/mixins/passwordSet.js b/src/mixins/passwordSet.js new file mode 100644 index 0000000..dca761e --- /dev/null +++ b/src/mixins/passwordSet.js @@ -0,0 +1,48 @@ +export default { + data() { + return { + passwordSafeOne: 0, + passwordSafeTwo: 0 + } + }, + methods: { + // 进度格式 + progressFormatOne(percentage) { + if (percentage === 100) { + return '强' + } else if (percentage === 33) { + return '弱' + } else if (percentage === 66) { + return '中' + } + }, + // 设置密码强度 + passwordOneChange(password) { + // 正则表单案例2 + // 密码组成:纯数字、纯大小写字母 + // 密码强度:一种:弱; 两种组成:中; 三种混合:强 + // 密码长度校验 + // 清除清除上一次密码检验的结果 + // 密码强度校验 + const weakReg = /^[0-9]{8,}$|^[a-zA-Z]{8,}$/ + const mediumReg = /^(?:(?=.*[0-9])(?=.*[a-zA-Z])|(?=.*[0-9])(?=.*[^a-zA-Z0-9])|(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9])).{8,}$/ + const strongReg = /^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,}$/ + if (password.length <= 0) { + this.passwordSafeOne = 0 + } else { + if (weakReg.test(password)) { + // 弱 + this.passwordSafeOne = 33 + } + if (mediumReg.test(password)) { + this.passwordSafeOne = 66 + } + if (strongReg.test(password)) { + // 强 + this.passwordSafeOne = 100 + } + } + } + } +} + diff --git a/src/page-subspecialty/App.vue b/src/page-subspecialty/App.vue index 8c137a4..277382d 100644 --- a/src/page-subspecialty/App.vue +++ b/src/page-subspecialty/App.vue @@ -37,7 +37,10 @@ export default { }) }, i18nHandle(val, oldVal) { - Cookies.set('language', val) + Cookies.set('language', val, { + secure: true, + httpOnly: true + }) document.querySelector('html').setAttribute('lang', val) document.title = messages[val].brand.lg // 非登录页面,切换语言刷新页面 diff --git a/src/page-subspecialty/views/main-navbar-update-password.vue b/src/page-subspecialty/views/main-navbar-update-password.vue index b0d6592..8e4306b 100644 --- a/src/page-subspecialty/views/main-navbar-update-password.vue +++ b/src/page-subspecialty/views/main-navbar-update-password.vue @@ -14,7 +14,9 @@ - + + + 密码至少8位,需涵盖大写、小写字母、数字、特殊字符 @@ -31,7 +33,9 @@ import debounce from 'lodash/debounce' import { clearLoginInfo } from '@/page-subspecialty/utils/request.js' import { resetRouter } from '@/page-subspecialty/router/index.js' +import passwordSet from '@/mixins/passwordSet' export default { + mixins: [passwordSet], data() { return { visible: false, diff --git a/src/page-subspecialty/views/modules/systemManagement/team/edit-password.vue b/src/page-subspecialty/views/modules/systemManagement/team/edit-password.vue index fed14fc..4d98286 100644 --- a/src/page-subspecialty/views/modules/systemManagement/team/edit-password.vue +++ b/src/page-subspecialty/views/modules/systemManagement/team/edit-password.vue @@ -2,7 +2,9 @@ - + + + 密码至少8位,需涵盖大写、小写字母、数字、特殊字符 @@ -19,7 +21,9 @@ import debounce from 'lodash/debounce' import { clearLoginInfo } from '@/page-subspecialty/utils/request.js' import { resetRouter } from '@/page-subspecialty/router/index.js' +import passwordSet from '@/mixins/passwordSet' export default { + mixins: [passwordSet], props: { roleNameList: { type: Array, diff --git a/src/page-subspecialty/views/modules/systemManagement/team/team-add-or-update.vue b/src/page-subspecialty/views/modules/systemManagement/team/team-add-or-update.vue index 7004c88..be7a58b 100644 --- a/src/page-subspecialty/views/modules/systemManagement/team/team-add-or-update.vue +++ b/src/page-subspecialty/views/modules/systemManagement/team/team-add-or-update.vue @@ -17,7 +17,9 @@ - + + + 密码至少8位,需涵盖大写、小写字母、数字、特殊字符 @@ -35,26 +37,7 @@ 视光医师 - - - - - - - - - - - - - - - - - - -
密码至少8位,需涵盖大写、小写字母、数字、特殊字符