[update] 修改授权码

This commit is contained in:
zhaoxiao
2021-12-16 19:01:34 +08:00
parent bdbd72f438
commit 22294682d0
2 changed files with 25 additions and 12 deletions
+23 -11
View File
@@ -10,12 +10,9 @@
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
@paste.native.capture.prevent="handleOperate"
autocomplete="new-password"
label="邮箱">
<a-input placeholder="请输入邮箱" :maxLength='50' disabled
v-decorator="[ 'email', validatorRules.email]"/>
@@ -38,6 +35,8 @@
<script>
import { postAction } from '../../api/manage'
import { getRSAPublicKey } from '../../api/login'
import { encrypt } from '../../utils/util'
export default {
name: 'UserAuthorizationCode',
@@ -69,30 +68,43 @@ export default {
xs: { span: 24 },
sm: { span: 16 }
},
url: '',
username: null
url: '/home/modify',
model: {}
}
},
methods: {
show(uname, uEmail) {
show(uname, uEmail, uId) {
this.form.resetFields()
if (!uname) {
this.$message.warning('当前系统无登录用户!')
return
} else {
this.username = uname
// this.getPublicKey()
this.form.resetFields()
this.form.setFields({email: uEmail})
this.model = {
id: uId,
email: uEmail
}
this.getPublicKey()
let timer = setTimeout(() => {
this.form.setFieldsValue({ email: this.model.email })
clearTimeout(timer)
timer = null
}, 0)
this.visible = true
}
},
getPublicKey() {
getRSAPublicKey().then(res => {
this.rsaPublicKey = res.result
})
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let params = Object.assign({}, values)
let params = Object.assign(this.model, values)
params.emailPassword = encrypt(this.rsaPublicKey, values.emailPassword)
console.log('修改授权码提交数据', params)
postAction(this.url, params).then((res) => {
if (res.success) {
+2 -1
View File
@@ -235,7 +235,8 @@ export default {
updateAuthorizationCode() {
let username = this.userInfo().username
let userEmail = this.userInfo().email
this.$refs.userAuthorizationCode.show(username, userEmail)
let uId = this.userInfo().id
this.$refs.userAuthorizationCode.show(username, userEmail, uId)
}
}
}