feat(用户模块): 添加社会身份和证件照功能
- 在用户新增/修改表单中添加社会身份选择项,支持动态加载社会身份数据 - 增加证件照上传功能,允许用户上传和预览证件照片 - 更新表单数据结构,确保社会身份和证件照信息的保存与展示 - 在用户列表中添加社会身份列,提升用户信息的可视化
This commit is contained in:
@@ -25,6 +25,16 @@
|
|||||||
<el-radio v-model="dataForm.sex" :label=1>男</el-radio>
|
<el-radio v-model="dataForm.sex" :label=1>男</el-radio>
|
||||||
<el-radio v-model="dataForm.sex" :label=0>女</el-radio>
|
<el-radio v-model="dataForm.sex" :label=0>女</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="社会身份" prop="socialIdentity">
|
||||||
|
<el-select v-model="dataForm.socialIdentity" placeholder="请选择社会身份" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in socialIdentityList"
|
||||||
|
:key="item.dictType + '_' + item.dictValue"
|
||||||
|
:label="item.dictValue"
|
||||||
|
:value="item.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="头像" prop="avatar">
|
<el-form-item label="头像" prop="avatar">
|
||||||
<!-- <el-input v-model="dataForm.avatar" placeholder="头像"></el-input> -->
|
<!-- <el-input v-model="dataForm.avatar" placeholder="头像"></el-input> -->
|
||||||
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
|
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
|
||||||
@@ -35,6 +45,15 @@
|
|||||||
<img width="100%" :src="dataForm.avatar" alt="">
|
<img width="100%" :src="dataForm.avatar" alt="">
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="证件照" prop="photo">
|
||||||
|
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreviewPhoto"
|
||||||
|
:file-list="photoFileList" :on-success="handlePicSuccessPhoto" :on-remove="handleRemovePhoto">
|
||||||
|
<i class="el-icon-plus"></i>
|
||||||
|
</el-upload>
|
||||||
|
<el-dialog :visible.sync="photoDialogVisible" :append-to-body="true">
|
||||||
|
<img width="100%" :src="dataForm.photo" alt="">
|
||||||
|
</el-dialog>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="昵称" prop="nickname">
|
<el-form-item label="昵称" prop="nickname">
|
||||||
<el-input v-model="dataForm.nickname" placeholder="昵称"></el-input>
|
<el-input v-model="dataForm.nickname" placeholder="昵称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -110,7 +129,10 @@
|
|||||||
baseUrl: global.baseUrl,
|
baseUrl: global.baseUrl,
|
||||||
visible: false,
|
visible: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
photoDialogVisible: false,
|
||||||
fileList: [],
|
fileList: [],
|
||||||
|
photoFileList: [],
|
||||||
|
socialIdentityList: [],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
shortcuts: [{
|
shortcuts: [{
|
||||||
text: '今天',
|
text: '今天',
|
||||||
@@ -156,6 +178,8 @@
|
|||||||
wylqPower: 0,
|
wylqPower: 0,
|
||||||
prescriptAPower: 0,
|
prescriptAPower: 0,
|
||||||
prescriptBPower: 0,
|
prescriptBPower: 0,
|
||||||
|
socialIdentity: '',
|
||||||
|
photo: '',
|
||||||
},
|
},
|
||||||
dataRule: {
|
dataRule: {
|
||||||
password: [{
|
password: [{
|
||||||
@@ -187,12 +211,25 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
init(id) {
|
||||||
this.dataForm.id = id || 0
|
this.dataForm.id = id || 0
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['dataForm'].resetFields()
|
this.$refs['dataForm'].resetFields()
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
|
this.getSocialIdentityList()
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`/book/user/info/${this.dataForm.id}`),
|
url: this.$http.adornUrl(`/book/user/info/${this.dataForm.id}`),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -206,6 +243,8 @@
|
|||||||
this.dataForm.age = data.user.age
|
this.dataForm.age = data.user.age
|
||||||
this.dataForm.sex = data.user.sex
|
this.dataForm.sex = data.user.sex
|
||||||
this.dataForm.avatar = data.user.avatar
|
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.nickname = data.user.nickname
|
||||||
this.dataForm.tel = data.user.tel
|
this.dataForm.tel = data.user.tel
|
||||||
this.dataForm.password = data.user.password
|
this.dataForm.password = data.user.password
|
||||||
@@ -231,6 +270,15 @@
|
|||||||
attr.push(img)
|
attr.push(img)
|
||||||
this.fileList = attr
|
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,
|
'age': this.dataForm.age,
|
||||||
'sex': this.dataForm.sex,
|
'sex': this.dataForm.sex,
|
||||||
'avatar': this.dataForm.avatar,
|
'avatar': this.dataForm.avatar,
|
||||||
|
'socialIdentity': this.dataForm.socialIdentity,
|
||||||
|
'photo': this.dataForm.photo,
|
||||||
'nickname': this.dataForm.nickname,
|
'nickname': this.dataForm.nickname,
|
||||||
'tel': this.dataForm.tel,
|
'tel': this.dataForm.tel,
|
||||||
'pointPower': this.dataForm.pointPower,
|
'pointPower': this.dataForm.pointPower,
|
||||||
@@ -320,6 +370,10 @@
|
|||||||
this.dataForm.avatar = file.url;
|
this.dataForm.avatar = file.url;
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
|
handlePictureCardPreviewPhoto(file) {
|
||||||
|
this.dataForm.photo = file.url;
|
||||||
|
this.photoDialogVisible = true;
|
||||||
|
},
|
||||||
handlePicSuccess(res, file) {
|
handlePicSuccess(res, file) {
|
||||||
if (res.msg == "success") {
|
if (res.msg == "success") {
|
||||||
this.dataForm.avatar = res.url;
|
this.dataForm.avatar = res.url;
|
||||||
@@ -328,15 +382,29 @@
|
|||||||
this.$message.error("上传失败");
|
this.$message.error("上传失败");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handlePicSuccessPhoto(res, file) {
|
||||||
|
if (res.msg == "success") {
|
||||||
|
this.dataForm.photo = res.url;
|
||||||
|
this.$message.success("上传成功");
|
||||||
|
} else {
|
||||||
|
this.$message.error("上传失败");
|
||||||
|
}
|
||||||
|
},
|
||||||
handleRemove(file) {
|
handleRemove(file) {
|
||||||
this.dataForm.avatar = '';
|
this.dataForm.avatar = '';
|
||||||
},
|
},
|
||||||
|
handleRemovePhoto(file) {
|
||||||
|
this.dataForm.photo = '';
|
||||||
|
this.photoFileList = [];
|
||||||
|
},
|
||||||
handlereset() {
|
handlereset() {
|
||||||
// console.log('关闭了')
|
// console.log('关闭了')
|
||||||
this.$refs['dataForm'].resetFields()
|
this.$refs['dataForm'].resetFields()
|
||||||
this.dataForm.password = ''
|
this.dataForm.password = ''
|
||||||
this.fileList = [],
|
this.fileList = []
|
||||||
this.visible = false
|
this.photoFileList = []
|
||||||
|
this.photoDialogVisible = false
|
||||||
|
this.visible = false
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@
|
|||||||
<span v-else v-html="computedVipType(scope.row.userVips)"> </span>
|
<span v-else v-html="computedVipType(scope.row.userVips)"> </span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="socialIdentity" header-align="center" align="center" label="社会身份"></el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
min-width="170"
|
min-width="170"
|
||||||
prop="tel"
|
prop="tel"
|
||||||
|
|||||||
Reference in New Issue
Block a user