diff --git a/src/assets/css/common/right-box-common.scss b/src/assets/css/common/right-box-common.scss
index 1a9c970a..c0f78639 100644
--- a/src/assets/css/common/right-box-common.scss
+++ b/src/assets/css/common/right-box-common.scss
@@ -145,6 +145,20 @@ $border-radius-small: 2px;
width: calc(50% - 10px);
}
}
+
+ .my-progress {
+ margin-bottom: 6px;
+
+ .el-progress-bar__innerText {
+ color: rgba(0,0,0,0) !important;
+ }
+ }
+
+ .password-hint {
+ color: var(--el-color-info);
+ font-size: 12px;
+ margin-bottom: 12px;
+ }
}
.right-box__footer {
diff --git a/src/components/rightBox/settings/UserBox.vue b/src/components/rightBox/settings/UserBox.vue
index b1f5b5ad..18f35f11 100644
--- a/src/components/rightBox/settings/UserBox.vue
+++ b/src/components/rightBox/settings/UserBox.vue
@@ -23,12 +23,20 @@
-
+
+
+
+
+
{{ handleSpecialCode($t('validate.passwordHint')) }}
-
@@ -104,6 +112,7 @@ import axios from 'axios'
import _ from 'lodash'
import { themeData, langData, storageKey } from '@/utils/constants'
import { api } from '@/utils/api'
+import { handleSpecialCode } from '@/utils/tools'
export default {
name: 'UserBox',
@@ -114,8 +123,8 @@ export default {
const isValid = value.match(reg) // 返回匹配到的值
if (value && value.length < 8) {
callback(new Error(this.$t('validate.atLeastEight')))
- } else if (!isValid) {
- callback(new Error(this.$t('validate.passwordError')))
+ } else if (!isValid || this.passwordLevel(this.editObject.pin) === 1) {
+ callback(new Error(handleSpecialCode(this.$t('validate.passwordError'))))
} else {
callback()
}
@@ -197,7 +206,14 @@ export default {
},
roleData: [],
themeData,
- langData
+ langData,
+ percentage: 0, // 密码强度
+ customColors: [ // 密码强度颜色指标
+ { color: '#d32423', percentage: 26 },
+ { color: '#fdbf12', percentage: 51 },
+ { color: '#99c708', percentage: 76 },
+ { color: '#099407', percentage: 100 }
+ ]
}
},
setup () {
@@ -206,6 +222,7 @@ export default {
this.getRoleData()
},
methods: {
+ handleSpecialCode,
isCurrentUser (username) {
return localStorage.getItem(storageKey.username) === username
},
@@ -284,6 +301,47 @@ export default {
this.roleData = _.get(response, 'data.data.list', [])
}
})
+ },
+ pinInput () {
+ if (this.editObject?.pin.length < 8) {
+ this.percentage = 25
+ } else if (this.editObject?.pin.length < 10) {
+ this.percentage = this.passwordLevel(this.editObject.pin) > 1 ? 2 * 25 : this.passwordLevel(this.editObject.pin) * 25
+ } else if (this.editObject?.pin.length < 12) {
+ this.percentage = this.passwordLevel(this.editObject.pin) === 4 ? 3 * 25 : this.passwordLevel(this.editObject.pin) * 25
+ } else {
+ this.percentage = this.passwordLevel(this.editObject.pin) * 25
+ }
+ },
+ passwordLevel (I) {
+ let H = 0
+ for (let a = 0; a < I.length; a++) {
+ H |= this.CharMode(I.charCodeAt(a))
+ }
+ return this.bitTotal(H)
+ },
+ CharMode (H) {
+ if (H >= 48 && H <= 57) { // 数字
+ return 1
+ }
+ if (H >= 65 && H <= 90) { // 大写
+ return 2
+ }
+ if (H >= 97 && H <= 122) { // 小写
+ return 4
+ } else {
+ return 8
+ }
+ },
+ bitTotal (H) {
+ let I = 0
+ for (let j = 0; j < 4; j++) {
+ if (H & 1) {
+ I++
+ }
+ H >>>= 1
+ }
+ return I
}
},
watch: {
diff --git a/src/components/table/administration/I18nTable.vue b/src/components/table/administration/I18nTable.vue
index 5ba08983..8a1fcdb1 100644
--- a/src/components/table/administration/I18nTable.vue
+++ b/src/components/table/administration/I18nTable.vue
@@ -32,7 +32,8 @@
- {{scope.row[item.prop] || '-'}}
+ {{handleSpecialCode(scope.row[item.prop]) || '-'}}
+ {{scope.row[item.prop] || '-'}}
@@ -45,6 +46,7 @@
diff --git a/src/mixins/data-list.js b/src/mixins/data-list.js
index 18e2244f..3fb259f0 100644
--- a/src/mixins/data-list.js
+++ b/src/mixins/data-list.js
@@ -1,4 +1,4 @@
-import { tableSort } from '@/utils/tools'
+import { handleSpecialCode, tableSort } from '@/utils/tools'
import { defaultPageSize, fromRoute, position, storageKey, dbTableColumnCustomizeConfigPre, dbTableColumnCustomizeConfig } from '@/utils/constants'
import _ from 'lodash'
import { ref } from 'vue'
@@ -242,6 +242,9 @@ export default {
axios.get(`${this.url}/${this.batchDeleteObjs[0].id}`).then(response => {
if (response.status === 200) {
this.object = response.data.data
+ if (this.url === '/sys/i18n') {
+ this.object.value = handleSpecialCode(this.object.value)
+ }
this.rightBox.show = true
}
})
diff --git a/src/utils/tools.js b/src/utils/tools.js
index 46256abd..18af7dcc 100644
--- a/src/utils/tools.js
+++ b/src/utils/tools.js
@@ -1584,3 +1584,10 @@ const tagValueHandler = (value) => {
export const headerCellClass = (row) => {
return 'my-header-cell-class'
}
+
+/**
+ * & 被转译为& 将转义后的值转为 &
+ */
+export const handleSpecialCode = (str) => {
+ return str.indexOf('&') > -1 ? str.replaceAll('&', '&') : str
+}