Compare commits
2 Commits
2b38c08846
...
6e0b7d3e88
Author | SHA1 | Date |
---|---|---|
a0049873 | 6e0b7d3e88 | |
a0049873 | a21a0490e1 |
|
@ -56,6 +56,7 @@
|
|||
"@vue/cli-service": "^4.4.6",
|
||||
"@vue/eslint-config-standard": "^5.1.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"element-theme-chalk": "^2.13.2",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
|
|
|
@ -36,6 +36,7 @@ t.prompt.deleteBatch = '请选择删除项'
|
|||
|
||||
t.validate = {}
|
||||
t.validate.required = '必填项不能为空'
|
||||
t.validate.pwdStrength = '密码需包含字母、数字、标点符号,并超过8位'
|
||||
t.validate.format = '{attr}格式错误'
|
||||
|
||||
t.upload = {}
|
||||
|
@ -558,25 +559,21 @@ t.projectList.technology='技术联系人电话'
|
|||
t.projectList.technologytel = '技术联系人电话'
|
||||
|
||||
t.dataresources = {}
|
||||
t.dataresources.componentType="组件类型"
|
||||
t.dataresources.componentName="组件名称"
|
||||
t.dataresources.putOnDate="上架时间"
|
||||
t.dataresources.resourcesName="数据资源名称"
|
||||
t.dataresources.resourcesCode="数据资源代码"
|
||||
t.dataresources.resourcesProvide="数据资源提供方"
|
||||
t.dataresources.resourcesAbstract="数据资源摘要"
|
||||
t.dataresources.associatedApplication="关联应用"
|
||||
t.dataresources.componentType = '组件类型'
|
||||
t.dataresources.componentName = '组件名称'
|
||||
t.dataresources.putOnDate = '上架时间'
|
||||
t.dataresources.resourcesName = '数据资源名称'
|
||||
t.dataresources.resourcesCode = '数据资源代码'
|
||||
t.dataresources.resourcesProvide = '数据资源提供方'
|
||||
t.dataresources.resourcesAbstract = '数据资源摘要'
|
||||
t.dataresources.associatedApplication = '关联应用'
|
||||
|
||||
t.infrastructure = {}
|
||||
t.infrastructure.resourceCategory="资源类别"
|
||||
t.infrastructure.resourceName="摄像头名称"
|
||||
t.infrastructure.district="所在区市"
|
||||
t.infrastructure.street="所在街道"
|
||||
t.infrastructure.department="所属部门"
|
||||
t.infrastructure.associatedApplication="关联应用"
|
||||
|
||||
|
||||
|
||||
|
||||
t.infrastructure.resourceCategory = '资源类别'
|
||||
t.infrastructure.resourceName = '摄像头名称'
|
||||
t.infrastructure.district = '所在区市'
|
||||
t.infrastructure.street = '所在街道'
|
||||
t.infrastructure.department = '所属部门'
|
||||
t.infrastructure.associatedApplication = '关联应用'
|
||||
|
||||
export default t
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-24 16:00:58
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-24 16:44:28
|
||||
* @Description: 告诉大家这是什么
|
||||
*/
|
||||
import CryptoJS from 'crypto-js/crypto-js'
|
||||
|
||||
// 默认的 KEY 与 iv 与后端保持一致 ,不采用后端传值密钥 上上下下左右左右BABA 一往无前虎山行拨开云雾见光明梦里花开牡丹亭幻想成真歌舞升平
|
||||
const KEY = CryptoJS.enc.Utf8.parse('YwwqhsxBkywjgm01') // 密钥
|
||||
const IV = CryptoJS.enc.Utf8.parse('SSXXZYZYBABA30TM') // 偏移量
|
||||
/**
|
||||
* AES加密 :字符串 key iv 返回base64
|
||||
*/
|
||||
export function Encrypt(word, keyStr, ivStr) {
|
||||
let key = KEY
|
||||
let iv = IV
|
||||
|
||||
if (keyStr) {
|
||||
key = CryptoJS.enc.Utf8.parse(keyStr)
|
||||
iv = CryptoJS.enc.Utf8.parse(ivStr)
|
||||
}
|
||||
|
||||
const srcs = CryptoJS.enc.Utf8.parse(word)
|
||||
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding,
|
||||
})
|
||||
|
||||
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext)
|
||||
}
|
||||
/**
|
||||
* AES 解密 :字符串 key iv 返回base64
|
||||
*
|
||||
*/
|
||||
export function Decrypt(word, keyStr, ivStr) {
|
||||
let key = KEY
|
||||
let iv = IV
|
||||
|
||||
if (keyStr) {
|
||||
key = CryptoJS.enc.Utf8.parse(keyStr)
|
||||
iv = CryptoJS.enc.Utf8.parse(ivStr)
|
||||
}
|
||||
|
||||
const base64 = CryptoJS.enc.Base64.parse(word)
|
||||
const src = CryptoJS.enc.Base64.stringify(base64)
|
||||
|
||||
var decrypt = CryptoJS.AES.decrypt(src, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding,
|
||||
})
|
||||
|
||||
var decryptedStr = decrypt.toString(CryptoJS.enc.Utf8)
|
||||
return decryptedStr.toString()
|
||||
}
|
|
@ -1,3 +1,10 @@
|
|||
<!--
|
||||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-23 16:41:46
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-24 17:51:42
|
||||
* @Description: 告诉大家这是什么
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
|
@ -13,7 +20,7 @@
|
|||
<el-input v-model="dataForm.password" type="password" :placeholder="$t('updatePassword.password')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="newPassword" :label="$t('updatePassword.newPassword')">
|
||||
<el-input v-model="dataForm.newPassword" type="password" :placeholder="$t('updatePassword.newPassword')"></el-input>
|
||||
<el-input v-model="dataForm.newPassword" type="password" :placeholder="$t('updatePassword.newPassword')" @input="changeInput"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="confirmPassword" :label="$t('updatePassword.confirmPassword')">
|
||||
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('updatePassword.confirmPassword')"></el-input>
|
||||
|
@ -28,6 +35,7 @@
|
|||
|
||||
<script>
|
||||
import debounce from 'lodash/debounce'
|
||||
import { Encrypt } from '@/utils/crypto'
|
||||
import { clearLoginInfo } from '@/utils'
|
||||
export default {
|
||||
data () {
|
||||
|
@ -42,6 +50,28 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
dataRule () {
|
||||
var validatePassword = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
this.showLevel = false
|
||||
return callback(new Error(this.$t('validate.pwdStrength')))
|
||||
}
|
||||
if (value.length < 8) {
|
||||
this.showLevel = false
|
||||
return callback(new Error(this.$t('validate.pwdStrength')))
|
||||
}
|
||||
const num = /^.*[0-9]+.*/
|
||||
const low = /^.*[a-z]+.*/
|
||||
const up = /^.*[A-Z]+.*/
|
||||
const spe = /^.*[^a-zA-Z0-9]+.*/
|
||||
console.log('包含数字', num.test(value), '包含字母', low.test(value), up.test(value), '包含特殊符号', spe.test(value))
|
||||
if (!(num.test(value) && (low.test(value) || up.test(value)) && spe.test(value))) {
|
||||
return callback(new Error(this.$t('validate.pwdStrength')))
|
||||
}
|
||||
// if (!this.dataForm.id && !/\S/.test(value)) {
|
||||
// return callback(new Error(this.$t('validate.required')))
|
||||
// }
|
||||
callback()
|
||||
}
|
||||
var validateConfirmPassword = (rule, value, callback) => {
|
||||
if (this.dataForm.newPassword !== value) {
|
||||
return callback(new Error(this.$t('updatePassword.validate.confirmPassword')))
|
||||
|
@ -53,7 +83,8 @@ export default {
|
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
newPassword: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
||||
{ validator: validatePassword, trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
||||
|
@ -63,19 +94,33 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
changeInput (value) {
|
||||
if (value !== value.replace(/ /g, '')) {
|
||||
this.$message({
|
||||
message: '密码中不允许存在空格!',
|
||||
type: 'warning'
|
||||
})
|
||||
this.dataForm.newPassword = value.replace(/ /g, '')
|
||||
// console.log('密码发生变化=============>', value)
|
||||
}
|
||||
},
|
||||
init () {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.$refs.dataForm.resetFields()
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(function () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
this.$refs.dataForm.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http.put('/sys/user/password', this.dataForm).then(({ data: res }) => {
|
||||
this.$http.put('/sys/user/password', {
|
||||
confirmPassword: Encrypt(this.dataForm.confirmPassword),
|
||||
newPassword: Encrypt(this.dataForm.newPassword),
|
||||
password: Encrypt(this.dataForm.password)
|
||||
}).then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
|
@ -91,7 +136,7 @@ export default {
|
|||
})
|
||||
}).catch(() => {})
|
||||
})
|
||||
}, 1000, { 'leading': true, 'trailing': false })
|
||||
}, 1000, { leading: true, trailing: false })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<el-form-item prop="deptName" :label="$t('user.deptName')">
|
||||
<ren-dept-tree v-model="dataForm.deptId" :placeholder="$t('dept.title')" :dept-name.sync="dataForm.deptName"></ren-dept-tree>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" :label="$t('user.password')" :class="{ 'is-required': !dataForm.id }" auto-complete="new-password">
|
||||
<el-input v-model="dataForm.password" type="password" :placeholder="$t('user.password')" auto-complete="new-password"></el-input>
|
||||
<el-form-item prop="password" :label="$t('user.password')" :class="{ 'is-required': !dataForm.id }" auto-complete="new-password" v-if="!dataForm.id">
|
||||
<el-input v-model="dataForm.password" type="password" :placeholder="$t('user.password')" auto-complete="new-password" @input="changeInput"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="confirmPassword" :label="$t('user.confirmPassword')" :class="{ 'is-required': !dataForm.id }">
|
||||
<el-form-item prop="confirmPassword" :label="$t('user.confirmPassword')" :class="{ 'is-required': !dataForm.id }" v-if="!dataForm.id">
|
||||
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('user.confirmPassword')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="realName" :label="$t('user.realName')">
|
||||
|
@ -51,6 +51,7 @@
|
|||
|
||||
<script>
|
||||
import debounce from 'lodash/debounce'
|
||||
import { Encrypt } from '@/utils/crypto'
|
||||
import { isEmail, isMobile } from '@/utils/validate'
|
||||
export default {
|
||||
data () {
|
||||
|
@ -79,9 +80,25 @@ export default {
|
|||
computed: {
|
||||
dataRule () {
|
||||
var validatePassword = (rule, value, callback) => {
|
||||
if (!this.dataForm.id && !/\S/.test(value)) {
|
||||
return callback(new Error(this.$t('validate.required')))
|
||||
if (!value) {
|
||||
this.showLevel = false
|
||||
return callback(new Error(this.$t('validate.pwdStrength')))
|
||||
}
|
||||
if (value.length < 8) {
|
||||
this.showLevel = false
|
||||
return callback(new Error(this.$t('validate.pwdStrength')))
|
||||
}
|
||||
const num = /^.*[0-9]+.*/
|
||||
const low = /^.*[a-z]+.*/
|
||||
const up = /^.*[A-Z]+.*/
|
||||
const spe = /^.*[^a-zA-Z0-9]+.*/
|
||||
console.log('包含数字', num.test(value), '包含字母', low.test(value), up.test(value), '包含特殊符号', spe.test(value))
|
||||
if (!(num.test(value) && (low.test(value) || up.test(value)) && spe.test(value))) {
|
||||
return callback(new Error(this.$t('validate.pwdStrength')))
|
||||
}
|
||||
// if (!this.dataForm.id && !/\S/.test(value)) {
|
||||
// return callback(new Error(this.$t('validate.required')))
|
||||
// }
|
||||
callback()
|
||||
}
|
||||
var validateConfirmPassword = (rule, value, callback) => {
|
||||
|
@ -131,6 +148,16 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
changeInput (value) {
|
||||
if (value !== value.replace(/ /g, '')) {
|
||||
this.$message({
|
||||
message: '密码中不允许存在空格!',
|
||||
type: 'warning'
|
||||
})
|
||||
this.dataForm.password = value.replace(/ /g, '')
|
||||
// console.log('密码发生变化=============>', value)
|
||||
}
|
||||
},
|
||||
init () {
|
||||
this.visible = true
|
||||
this.dataForm.deptId = ''
|
||||
|
@ -192,6 +219,10 @@ export default {
|
|||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.dataForm.password = Encrypt(this.dataForm.password)
|
||||
if (this.dataForm.id) {
|
||||
delete this.dataForm.password
|
||||
}
|
||||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
|
||||
...this.dataForm,
|
||||
roleIdList: [
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
import { Encrypt } from '@/utils/crypto'
|
||||
import debounce from 'lodash/debounce'
|
||||
import { messages } from '@/i18n'
|
||||
import { getUUID } from '@/utils'
|
||||
|
@ -105,7 +106,11 @@ export default {
|
|||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http.get('/login', { params: this.dataForm }).then(({ data: res }) => {
|
||||
if (this.dataForm.password !== this.dataForm.password.trim()) {
|
||||
this.$message.error('登陆失败,用户名或密码错误!')
|
||||
return
|
||||
}
|
||||
this.$http.get('/login', { params: { username: this.dataForm.username, password: Encrypt(this.dataForm.password) } }).then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
this.getCaptcha()
|
||||
return this.$message.error(res.msg)
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
"body-parser": "^1.19.0",
|
||||
"chalk": "^4.1.1",
|
||||
"chokidar": "^3.5.2",
|
||||
"crypto-js": "^4.1.1",
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-vue": "^7.13.0",
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-24 16:00:58
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-24 16:44:28
|
||||
* @Description: 告诉大家这是什么
|
||||
*/
|
||||
import CryptoJS from 'crypto-js/crypto-js'
|
||||
|
||||
// 默认的 KEY 与 iv 与后端保持一致 ,不采用后端传值密钥 上上下下左右左右BABA 一往无前虎山行拨开云雾见光明梦里花开牡丹亭幻想成真歌舞升平
|
||||
const KEY = CryptoJS.enc.Utf8.parse('YwwqhsxBkywjgm01') // 密钥
|
||||
const IV = CryptoJS.enc.Utf8.parse('SSXXZYZYBABA30TM') // 偏移量
|
||||
/**
|
||||
* AES加密 :字符串 key iv 返回base64
|
||||
*/
|
||||
export function Encrypt(word, keyStr, ivStr) {
|
||||
let key = KEY
|
||||
let iv = IV
|
||||
|
||||
if (keyStr) {
|
||||
key = CryptoJS.enc.Utf8.parse(keyStr)
|
||||
iv = CryptoJS.enc.Utf8.parse(ivStr)
|
||||
}
|
||||
|
||||
const srcs = CryptoJS.enc.Utf8.parse(word)
|
||||
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding,
|
||||
})
|
||||
|
||||
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext)
|
||||
}
|
||||
/**
|
||||
* AES 解密 :字符串 key iv 返回base64
|
||||
*
|
||||
*/
|
||||
export function Decrypt(word, keyStr, ivStr) {
|
||||
let key = KEY
|
||||
let iv = IV
|
||||
|
||||
if (keyStr) {
|
||||
key = CryptoJS.enc.Utf8.parse(keyStr)
|
||||
iv = CryptoJS.enc.Utf8.parse(ivStr)
|
||||
}
|
||||
|
||||
const base64 = CryptoJS.enc.Base64.parse(word)
|
||||
const src = CryptoJS.enc.Base64.stringify(base64)
|
||||
|
||||
var decrypt = CryptoJS.AES.decrypt(src, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding,
|
||||
})
|
||||
|
||||
var decryptedStr = decrypt.toString(CryptoJS.enc.Utf8)
|
||||
return decryptedStr.toString()
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-19 10:15:33
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-24 10:46:23
|
||||
* @LastEditTime: 2022-06-24 15:04:52
|
||||
* @Description: 告诉大家这是什么
|
||||
-->
|
||||
<template>
|
||||
|
@ -38,6 +38,7 @@
|
|||
import { ref } from 'vue'
|
||||
// import { count } from '@/api/file'
|
||||
import { dataResourceInfo } from '@/api/capabilityCloud'
|
||||
import { dataTool } from 'echarts'
|
||||
// import { abc } from './dataABC.json'
|
||||
// 左侧数据
|
||||
const resourcesLeft = ref([
|
||||
|
@ -141,9 +142,11 @@
|
|||
// console.log('数据资源数据===================>', res.data.data)
|
||||
resourcesLeft.value.forEach((val) => {
|
||||
const object = res.data.data.filter((item) => item.type === val.name)[0]
|
||||
console.log('object', object)
|
||||
if (object) {
|
||||
val.num = obj.amount
|
||||
val.num = object.amount
|
||||
}
|
||||
})
|
||||
const arr = res.data.data.filter((item) => item.resourceTop5)[0]
|
||||
console.log('数据资源数据===================>', arr)
|
||||
if (arr) {
|
||||
|
@ -152,12 +155,11 @@
|
|||
val.operation = ''
|
||||
})
|
||||
arr.resourceTop5.forEach((val, index) => {
|
||||
assignRankings.value[index].name = val.zyname || val.serviceName || 0
|
||||
assignRankings.value[index].operation = val.syqk || val.requestCount || 0
|
||||
assignRankings.value[index].name = val['服务名称'] || ''
|
||||
assignRankings.value[index].operation = val['申请次数'] || ''
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.data-resources {
|
||||
|
@ -170,6 +172,7 @@
|
|||
text-decoration: none;
|
||||
outline: none;
|
||||
-webkit-transition: all 100ms ease-out;
|
||||
|
||||
-moz-transition: all 100ms ease-out;
|
||||
transition: all 100ms ease-out;
|
||||
.resources-top {
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<script>
|
||||
import { dependencies, devDependencies } from '*/package.json'
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
import { Encrypt } from '@/utils/crypto'
|
||||
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
|
||||
|
@ -97,7 +98,15 @@
|
|||
async handleSubmit() {
|
||||
// debugger
|
||||
try {
|
||||
await this.login(this.form)
|
||||
// console.log('登录', Decrypt(Encrypt(this.form.password)))
|
||||
if (this.form.password !== this.form.password.trim()) {
|
||||
message.error('登陆失败,用户名或密码错误!')
|
||||
return
|
||||
}
|
||||
await this.login({
|
||||
password: Encrypt(this.form.password),
|
||||
username: this.form.username,
|
||||
})
|
||||
window.sessionStorage.setItem('visits', JSON.stringify([]))
|
||||
// console.log(this.handleRoute())
|
||||
await this.$router.push('/home')
|
||||
|
|
Loading…
Reference in New Issue