|
@ -3,56 +3,48 @@
|
|
|
<a-row :gutter="16">
|
|
|
<a-col :md="24" :lg="16">
|
|
|
|
|
|
<a-form layout="vertical">
|
|
|
<a-form layout="vertical" :form="form">
|
|
|
<a-form-item
|
|
|
label="昵称"
|
|
|
>
|
|
|
<a-input placeholder="给自己起个名字" />
|
|
|
<a-input placeholder="给自己起个昵称吧" v-decorator="['nickName']"/>
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="Bio"
|
|
|
label="生日"
|
|
|
>
|
|
|
<a-textarea rows="4" placeholder="You are not alone."/>
|
|
|
<a-date-picker placeholder="请选择生日" @change="onChange" style="width: 100%" v-decorator="['birthday', {rules: [{required: true, message: '请选择生日!'}]}]" />
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item
|
|
|
label="电子邮件"
|
|
|
:required="false"
|
|
|
label="性别"
|
|
|
>
|
|
|
<a-input placeholder="exp@admin.com"/>
|
|
|
<a-radio-group v-decorator="['sex',{rules: [{ required: true, message: '请选择性别!' }]}]" >
|
|
|
<a-radio v-for="(item,index) in sexData" :key="index" :value="item.code">{{ item.name }}</a-radio>
|
|
|
</a-radio-group>
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="加密方式"
|
|
|
:required="false"
|
|
|
label="手机"
|
|
|
>
|
|
|
<a-select defaultValue="aes-256-cfb">
|
|
|
<a-select-option value="aes-256-cfb">aes-256-cfb</a-select-option>
|
|
|
<a-select-option value="aes-128-cfb">aes-128-cfb</a-select-option>
|
|
|
<a-select-option value="chacha20">chacha20</a-select-option>
|
|
|
</a-select>
|
|
|
<a-input placeholder="请输入手机号" v-decorator="['phone', {rules: [{required: true, message: '请输入手机号!'}]}]"/>
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="连接密码"
|
|
|
:required="false"
|
|
|
label="电话"
|
|
|
>
|
|
|
<a-input placeholder="h3gSbecd"/>
|
|
|
<a-input placeholder="请输入电话" v-decorator="['tel', {rules: [{required: true, message: '请输入电话!'}]}]"/>
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="登录密码"
|
|
|
label="电子邮件"
|
|
|
:required="false"
|
|
|
>
|
|
|
<a-input placeholder="密码"/>
|
|
|
<a-input placeholder="请输入电子邮件地址" v-decorator="['email', {type: 'email',message: '请输入正确的邮箱号',rules: [{required: true, message: '请输入正确的邮箱号!'}]}]"/>
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item>
|
|
|
<a-button type="primary">提交</a-button>
|
|
|
<a-button style="margin-left: 8px">保存</a-button>
|
|
|
<a-button type="primary" @click="submitUserInfo">更新基本信息</a-button>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
|
|
|
</a-col>
|
|
|
<a-col :md="24" :lg="8" :style="{ minHeight: '180px' }">
|
|
|
<div class="ant-upload-preview" @click="$refs.modal.edit(1)" >
|
|
|
<div class="ant-upload-preview" @click="$refs.modal.edit(userInfo.id)" >
|
|
|
<a-icon type="cloud-upload-o" class="upload-icon"/>
|
|
|
<div class="mask">
|
|
|
<a-icon type="plus" />
|
|
@ -69,8 +61,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import AvatarModal from './AvatarModal'
|
|
|
|
|
|
import store from '@/store'
|
|
|
import AvatarModal from './AvatarModal'
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import moment from 'moment'
|
|
|
import { sysUserUpdateInfo } from '@/api/modular/system/userManage'
|
|
|
// mapActions
|
|
|
export default {
|
|
|
components: {
|
|
|
AvatarModal
|
|
@ -79,6 +75,8 @@ export default {
|
|
|
return {
|
|
|
// cropper
|
|
|
preview: {},
|
|
|
form: this.$form.createForm(this),
|
|
|
sexData: [],
|
|
|
option: {
|
|
|
img: '/avatar2.jpg',
|
|
|
info: true,
|
|
@ -92,13 +90,69 @@ export default {
|
|
|
fixedBox: true,
|
|
|
// 开启宽度和高度比例
|
|
|
fixed: true,
|
|
|
fixedNumber: [1, 1]
|
|
|
fixedNumber: [1, 1],
|
|
|
// userInfo
|
|
|
birthdayString: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(['userInfo'])
|
|
|
},
|
|
|
mounted () {
|
|
|
this.initUserInfo()
|
|
|
},
|
|
|
methods: {
|
|
|
// ...mapActions(['GetInfo']),
|
|
|
/**
|
|
|
* 初始化用户信息
|
|
|
*/
|
|
|
initUserInfo () {
|
|
|
setTimeout(() => {
|
|
|
this.form.setFieldsValue(
|
|
|
{
|
|
|
birthday: moment(this.userInfo.birthday, 'YYYY-MM-DD'),
|
|
|
nickName: this.userInfo.nickName,
|
|
|
sex: this.userInfo.sex.toString(),
|
|
|
email: this.userInfo.email,
|
|
|
phone: this.userInfo.phone,
|
|
|
tel: this.userInfo.tel
|
|
|
}
|
|
|
)
|
|
|
this.birthdayString = moment(this.userInfo.birthday).format('YYYY-MM-DD')
|
|
|
this.option.img = process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + this.userInfo.avatar
|
|
|
this.getSexData()
|
|
|
}, 100)
|
|
|
},
|
|
|
/**
|
|
|
* 日期需单独转换
|
|
|
*/
|
|
|
onChange (date, dateString) {
|
|
|
this.birthdayString = dateString
|
|
|
},
|
|
|
submitUserInfo () {
|
|
|
const { form: { validateFields } } = this
|
|
|
validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
values.birthday = this.birthdayString
|
|
|
values.id = this.userInfo.id
|
|
|
sysUserUpdateInfo(values).then((res) => {
|
|
|
if (res.success) {
|
|
|
this.$message.success('个人信息更新成功')
|
|
|
store.dispatch('GetInfo').then(() => {})
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
getSexData () {
|
|
|
this.sexData = this.$options.filters['dictData']('sex')
|
|
|
},
|
|
|
setavatar (url) {
|
|
|
this.option.img = url
|
|
|
this.option.img = process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + url
|
|
|
store.dispatch('GetInfo').then(() => {})
|
|
|
}
|
|
|
}
|
|
|
}
|