diff --git a/src/views/modules/user/user-add-or-update.vue b/src/views/modules/user/user-add-or-update.vue index a26ff61..2e1a6c1 100644 --- a/src/views/modules/user/user-add-or-update.vue +++ b/src/views/modules/user/user-add-or-update.vue @@ -25,6 +25,16 @@ + + + + + + + + + + + + + @@ -110,7 +129,10 @@ baseUrl: global.baseUrl, visible: false, dialogVisible: false, + photoDialogVisible: false, fileList: [], + photoFileList: [], + socialIdentityList: [], pickerOptions: { shortcuts: [{ text: '今天', @@ -156,6 +178,8 @@ wylqPower: 0, prescriptAPower: 0, prescriptBPower: 0, + socialIdentity: '', + photo: '', }, dataRule: { password: [{ @@ -187,12 +211,25 @@ } }, methods: { + getSocialIdentityList() { + this.$http({ + url: this.$http.adornUrl("/book/sysdictdata/selectByType/user_profile"), + method: 'get', + }).then(({ data }) => { + if (data && data.code === 0) { + this.socialIdentityList = data.dataList || []; + } else { + this.socialIdentityList = []; + } + }) + }, init(id) { this.dataForm.id = id || 0 this.visible = true this.$nextTick(() => { this.$refs['dataForm'].resetFields() if (this.dataForm.id) { + this.getSocialIdentityList() this.$http({ url: this.$http.adornUrl(`/book/user/info/${this.dataForm.id}`), method: 'get', @@ -206,6 +243,8 @@ this.dataForm.age = data.user.age this.dataForm.sex = data.user.sex this.dataForm.avatar = data.user.avatar + this.dataForm.socialIdentity = data.user.socialIdentity + this.dataForm.photo = data.user.photo this.dataForm.nickname = data.user.nickname this.dataForm.tel = data.user.tel this.dataForm.password = data.user.password @@ -231,6 +270,15 @@ attr.push(img) this.fileList = attr } + if (data.user.photo && data.user.photo != "") { + var photoImg = { + name: '', + url: data.user.photo + } + var photoAttr = [] + photoAttr.push(photoImg) + this.photoFileList = photoAttr + } } }) } @@ -271,6 +319,8 @@ 'age': this.dataForm.age, 'sex': this.dataForm.sex, 'avatar': this.dataForm.avatar, + 'socialIdentity': this.dataForm.socialIdentity, + 'photo': this.dataForm.photo, 'nickname': this.dataForm.nickname, 'tel': this.dataForm.tel, 'pointPower': this.dataForm.pointPower, @@ -320,6 +370,10 @@ this.dataForm.avatar = file.url; this.dialogVisible = true; }, + handlePictureCardPreviewPhoto(file) { + this.dataForm.photo = file.url; + this.photoDialogVisible = true; + }, handlePicSuccess(res, file) { if (res.msg == "success") { this.dataForm.avatar = res.url; @@ -328,15 +382,29 @@ this.$message.error("上传失败"); } }, + handlePicSuccessPhoto(res, file) { + if (res.msg == "success") { + this.dataForm.photo = res.url; + this.$message.success("上传成功"); + } else { + this.$message.error("上传失败"); + } + }, handleRemove(file) { this.dataForm.avatar = ''; }, + handleRemovePhoto(file) { + this.dataForm.photo = ''; + this.photoFileList = []; + }, handlereset() { // console.log('关闭了') this.$refs['dataForm'].resetFields() this.dataForm.password = '' - this.fileList = [], - this.visible = false + this.fileList = [] + this.photoFileList = [] + this.photoDialogVisible = false + this.visible = false }, } } diff --git a/src/views/modules/user/user.vue b/src/views/modules/user/user.vue index c80b88b..1e0d04d 100644 --- a/src/views/modules/user/user.vue +++ b/src/views/modules/user/user.vue @@ -154,6 +154,7 @@ +