|
@@ -15,6 +15,43 @@
|
|
|
<el-radio label="1">女</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="照片" prop="photo" v-if="user.userId">
|
|
|
+ <el-upload
|
|
|
+ ref="photo"
|
|
|
+ :headers="photo.headers"
|
|
|
+ :action="photo.url + '?pType=' + photo.pType + '&pId=' + user.userId"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ list-type="picture-card">
|
|
|
+ <img v-if="user.photoUrl" :src="user.photoUrl" class="avatar">
|
|
|
+ <i v-else class="el-icon-plus "></i>
|
|
|
+ </el-upload>
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :visible.sync="dialogVisible" append-to-body>
|
|
|
+ <img width="100%" :src="dialogImageUrl" alt="">
|
|
|
+ </el-dialog>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="签名" prop="signUrl" v-if="user.userId">
|
|
|
+ <el-upload
|
|
|
+ ref="sign"
|
|
|
+ list-type="picture-card"
|
|
|
+ :action="signPic.url + '?pType=' + signPic.pType + '&pId=' + user.userId"
|
|
|
+ :headers="signPic.headers"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ >
|
|
|
+ <img v-if="user.signUrl" :src="user.signUrl" class="avatar">
|
|
|
+ <i v-else class="el-icon-plus "></i>
|
|
|
+ </el-upload>
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :visible.sync="dialogVisible" append-to-body>
|
|
|
+ <img width="100%" :src="dialogSignUrl" alt="">
|
|
|
+ </el-dialog>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" size="mini" @click="submit">保存</el-button>
|
|
|
<el-button type="danger" size="mini" @click="close">关闭</el-button>
|
|
@@ -23,7 +60,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { updateUserProfile } from "@/api/system/user";
|
|
|
+import { getUser, updateUserProfile } from "@/api/system/user";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
@@ -33,6 +71,35 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ dialogSignUrl: '',
|
|
|
+ dialogImageUrl: '',
|
|
|
+ dialogVisible: false,
|
|
|
+ signPic: {
|
|
|
+ file: "",
|
|
|
+ // 报告附件上传位置编号
|
|
|
+ ids: 0,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ // 上传的地址
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/system/user/uploadSignUrl",
|
|
|
+ pType: 'userSignUrl',
|
|
|
+ pId: null
|
|
|
+ },
|
|
|
+ signUrl: '',
|
|
|
+ // 人员照片参数
|
|
|
+ photo: {
|
|
|
+ file: "",
|
|
|
+ // 报告附件上传位置编号
|
|
|
+ ids: 0,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ // 上传的地址
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/system/user/uploadPhoto",
|
|
|
+ pType: 'userPhoto',
|
|
|
+ pId: null
|
|
|
+ },
|
|
|
+ //照片回显
|
|
|
+ photoUrl: '',
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
nickName: [
|
|
@@ -58,6 +125,35 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleAvatarProgress(event, file, fileList) {
|
|
|
+ this.photo.file = file;
|
|
|
+ this.photoUrl = file;
|
|
|
+ },
|
|
|
+ handleAvatarSuccess(res, file, fileList) {
|
|
|
+ // this.photoUrl = URL.createObjectURL(file.raw);
|
|
|
+ getUser(this.user.userId).then(response => {
|
|
|
+ if (response.data.photo) {
|
|
|
+ this.user.photoUrl = process.env.VUE_APP_BASE_API + response.data.photo;
|
|
|
+ this.dialogImageUrl = process.env.VUE_APP_BASE_API + response.data.photo;
|
|
|
+ }
|
|
|
+ if (response.data.signUrl) {
|
|
|
+ this.user.signUrl = process.env.VUE_APP_BASE_API + response.data.signUrl;
|
|
|
+ this.dialogSignUrl = process.env.VUE_APP_BASE_API + response.data.signUrl;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$alert(res.msg, '导入结果', { dangerouslyUseHTMLString: true });
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error('上传图片只能是 JPG、png 格式!');
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片大小不能超过 2MB!');
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
submit() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
@@ -73,3 +169,28 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ .avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409EFF;
|
|
|
+ }
|
|
|
+ .avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ line-height: 178px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .avatar {
|
|
|
+ width: 120px;
|
|
|
+ height: 140px;
|
|
|
+ }
|
|
|
+</style>
|