feat(用户模块): 添加社会身份和证件照功能

- 在用户新增/修改表单中添加社会身份选择项,支持动态加载社会身份数据
- 增加证件照上传功能,允许用户上传和预览证件照片
- 更新表单数据结构,确保社会身份和证件照信息的保存与展示
- 在用户列表中添加社会身份列,提升用户信息的可视化
This commit is contained in:
2026-04-01 10:19:49 +08:00
parent 4d4c644b81
commit 111174d324
2 changed files with 71 additions and 2 deletions

View File

@@ -25,6 +25,16 @@
<el-radio v-model="dataForm.sex" :label=1></el-radio>
<el-radio v-model="dataForm.sex" :label=0></el-radio>
</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-input v-model="dataForm.avatar" placeholder="头像"></el-input> -->
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
@@ -35,6 +45,15 @@
<img width="100%" :src="dataForm.avatar" alt="">
</el-dialog>
</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-input v-model="dataForm.nickname" placeholder="昵称"></el-input>
</el-form-item>
@@ -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
},
}
}

View File

@@ -154,6 +154,7 @@
<span v-else v-html="computedVipType(scope.row.userVips)"> </span>
</template>
</el-table-column>
<el-table-column prop="socialIdentity" header-align="center" align="center" label="社会身份"></el-table-column>
<el-table-column
min-width="170"
prop="tel"