[update] 修改授权码
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user