فهرست منبع

添加附件简历列表

wkw 6 ماه پیش
والد
کامیت
a5796503d9

BIN
public/icon-pdf.png


+ 131 - 0
src/components/AttachmentSelectDialog/AttachmentSelectDialog.vue

@@ -0,0 +1,131 @@
+<template>
+    <el-dialog title="请选择要发送的文件" v-model="modelValue" width="600px" :close-on-click-modal="false" @close="handleClose">
+        <div v-if="fileList.length" class="file-list">
+            <div v-for="(item, index) in fileList" :key="index" class="file-item" @click="selectItem(item)"
+                :class="{ selected: selectedResume && selectedResume.attachmentAddress === item.attachmentAddress }">
+                <img class="file-icon" src="../../../public/icon-pdf.png" alt="icon" />
+                <div class="file-info">
+                    <div class="file-name">{{ item.attachmentName }}</div>
+                    <div class="file-desc">{{ item.attachmentSize }}kb 更新于 {{ item.createTime }}</div>
+                </div>
+                <el-button size="mini" @click.stop="previewDoc(item)">预览</el-button>
+            </div>
+        </div>
+        <div v-else class="empty-list">暂无附件</div>
+
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="goToManage">管理附件</el-button>
+            <el-button type="primary" :disabled="!selectedResume" @click="confirmSelect">确定</el-button>
+        </span>
+    </el-dialog>
+</template>
+
+<script>
+
+export default {
+    name: "AttachmentSelectDialog",
+    props: {
+        showDialog: {
+            type: Boolean,
+            default: false
+        },
+    },
+    data() {
+        return {
+            fileList: [],
+            selectedResume: null,
+            modelValue: false
+        }
+    },
+    mounted() {
+        this.modelValue = this.showDialog;
+        this.loadAttachmentList()
+    },
+    methods: {
+        async loadAttachmentList() {
+            try {
+                const res = await this.$Request.get('/app/resumes/getAttachment')
+                if (res.code === 0 && Array.isArray(res.data)) {
+                    res.data.forEach(item => {
+                        const ext = item.attachmentName.split('.').pop().toLowerCase()
+                        item.fileType = ext
+                    })
+                    this.fileList = res.data;
+                }
+            } catch (err) {
+                console.error('获取附件列表失败:', err)
+            }
+        },
+        previewDoc(item) {
+            window.open(item.attachmentAddress, '_blank')
+        },
+        goToManage() {
+            this.$router.push('addResume')
+        },
+        selectItem(item) {
+            this.selectedResume = item
+        },
+        confirmSelect() {
+            this.$emit('select', this.selectedResume)
+            this.handleClose()
+        },
+        handleClose() {
+            this.selectedResume = null
+            this.$emit('closePostPush', false)
+        },
+    }
+}
+</script>
+
+<style scoped>
+.file-list {
+    max-height: 400px;
+    overflow-y: auto;
+}
+
+.file-item {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 10px;
+    cursor: pointer;
+    border-bottom: 1px solid #eee;
+}
+
+.file-item.selected {
+    background-color: #f0f5ff;
+}
+
+.file-icon {
+    width: 30px;
+    height: 30px;
+    flex-shrink: 0;
+}
+
+.file-info {
+    flex: 1;
+    margin: 0 10px;
+}
+
+.file-name {
+    font-weight: 500;
+    color: #222;
+}
+
+.file-desc {
+    font-size: 12px;
+    color: #999;
+    margin-top: 2px;
+}
+
+.empty-list {
+    text-align: center;
+    color: #999;
+    padding: 20px 0;
+}
+
+.dialog-footer {
+    display: flex;
+    justify-content: space-between;
+}
+</style>

+ 250 - 0
src/components/UploadResume/UploadResume.vue

@@ -0,0 +1,250 @@
+<template>
+    <div class="upload-resume">
+        <div class="attached-resume">
+            <div class="attached-resume-title flex justify-between align-center">
+                <div>附件管理</div>
+                <div class="upload-btn" @click="handleUploadClick">上传</div>
+            </div>
+
+            <!-- 附件列表 -->
+            <div>
+                <div class="attached-resume-label">
+                    文件({{ fileList.length }}/{{ limit }})
+                </div>
+
+                <div v-for="(file, index) in fileList" :key="index"
+                    class="flex align-center justify-between attached-resume-item">
+                    <div class="flex align-center">
+                        <img class="attached-resume-img" src="../../../public/icon-pdf.png" alt="pdf" />
+                        <div class="attached-resume-info">
+                            <div>{{ file.attachmentName }}</div>
+                            <div class="attached-resume-time">
+                                {{ file.attachmentSize }}KB 更新于 {{ file.createTime }}
+                            </div>
+                        </div>
+                    </div>
+                    <div class="file-actions flex align-center">
+                        <el-link type="primary" :href="file.attachmentAddress" target="_blank">查看</el-link>
+                        <el-divider direction="vertical"></el-divider>
+                        <el-link type="danger" @click="removeFile(file.resumesAttachmentId)">删除</el-link>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 上传弹窗 -->
+        <el-dialog title="上传附件简历" v-model="uploadDialogVisible" width="500px" destroy-on-close>
+           <div style="padding: 20px;">
+                <el-upload drag :limit="limit - fileList.length" :before-upload="beforeUpload"
+                    :http-request="uploadFile" :show-file-list="false" accept=".pdf,.doc,.docx">
+                    <i class="el-icon-upload"></i>
+                    <div class="el-upload__text">
+                        拖拽文件到此处,或 <em>点击上传</em>
+                    </div>
+                    <div class="el-upload__tip">支持 PDF、Word 文件,最大 5MB</div>
+                </el-upload>
+           </div>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { ElMessage, ElMessageBox } from 'element-plus'
+
+export default {
+    name: "UploadResume",
+    props: {
+        modelValue: Array,
+        limit: {
+            type: Number,
+            default: 3
+        }
+    },
+    data() {
+        return {
+            uploadDialogVisible: false,
+            fileList: this.modelValue || []
+        }
+    },
+    watch: {
+        modelValue(val) {
+            this.fileList = val
+        }
+    },
+    computed: {
+        screenHeight() {
+            return window.innerHeight || document.documentElement.clientHeight
+        }
+    },
+    mounted() {
+        this.loadAttachmentList()
+    },
+    methods: {
+        handleUploadClick() {
+            if(this.fileList.length >= this.limit){
+                ElMessage({
+                    message: `最多只能上传${this.limit}个文件`,
+                    type: 'warning',
+                    duration: 1500,
+                    offset: this.screenHeight / 2
+                })
+                return
+            }
+            this.uploadDialogVisible = true
+        },
+        beforeUpload(file) {
+            const validExtensions = ["pdf", "doc", "docx"]
+            const ext = file.name.split('.').pop().toLowerCase()
+            if (!validExtensions.includes(ext)) {
+                this.$message.error("仅支持PDF/DOC/DOCX格式")
+                return false
+            }
+            const isLt5M = file.size / 1024 / 1024 < 5
+            if (!isLt5M) {
+                this.$message.error("文件大小不能超过 5MB")
+                return false
+            }
+            return true
+        },
+
+        // 上传逻辑
+        async uploadFile(param) {
+            try {
+                const formData = new FormData()
+                formData.append('file', param.file)
+
+                const uploadRes = await this.$Request.post('/alioss/upload', formData)
+                const content = uploadRes.data
+                if (!content) throw new Error('上传失败')
+
+                const fileSize = (param.file.size / 1024).toFixed(1)
+                const saveRes = await this.$Request.post('/app/resumes/saveAttachment', {
+                    attachmentAddress: content,
+                    attachmentName: param.file.name,
+                    attachmentSize: fileSize
+                }, { type: 'json' })
+
+                if (saveRes.code === 0) {
+                    ElMessage({
+                        message: '保存成功',
+                        type: 'success',
+                        duration: 1500,
+                        offset: this.screenHeight / 2
+                    })
+                    // 上传成功后重新获取附件列表
+                    this.loadAttachmentList()
+                    this.uploadDialogVisible = false
+                } else {
+                    param.onError()
+                }
+            } catch (err) {
+                console.error('上传出错:', err)
+                param.onError(err)
+            }
+        },
+        // 获取附件简历列表
+        async loadAttachmentList() {
+            try {
+                const res = await this.$Request.get('/app/resumes/getAttachment')
+                if (res.code === 0 && Array.isArray(res.data)) {
+                    res.data.forEach(item => {
+                        const ext = item.attachmentName.split('.').pop().toLowerCase()
+                        item.fileType = ext
+                    })
+                    this.fileList = res.data;
+                    console.log(this.fileList)
+                    this.$emit('update:modelValue', this.fileList)
+                    this.$emit('change', this.fileList)
+                }
+            } catch (err) {
+                console.error('获取附件列表失败:', err)
+            }
+        },
+
+        // 删除文件
+        removeFile(id) {
+            console.log(id)
+            ElMessageBox.confirm('确认删除该条内容么?', '提示', {
+                confirmButtonText: '确认',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                // 确认删除
+                this.$Request.post('/app/resumes/deleteAttachment',{ resumesAttachmentId: id}, { type: 'json' }).then((res) => {
+                    if(res.code == 0){
+                        ElMessage({
+                            message: '删除成功',
+                            type: 'success',
+                            duration: 1500,
+                            offset: this.screenHeight / 2
+                        });
+                        this.loadAttachmentList()
+                    }
+                    
+                }).catch(() => {
+                });
+            });
+            // this.fileList.splice(index, 1)
+            // this.$emit("update:modelValue", this.fileList)
+            // this.$emit("change", this.fileList)
+        }
+    }
+}
+</script>
+
+<style scoped lang="scss">
+.upload-resume {
+    width: 250px;
+}
+.attached-resume {
+    padding: 20px;
+    border-radius: 15px;
+    background-color: #fff;
+    width: 100%;
+
+    // height: 458px;
+    .attached-resume-title {
+        border-bottom: 1px solid #e4e7ed;
+        padding-bottom: 18px;
+        color: #303133;
+        font-size: 16px;
+        font-weight: 500;
+    }
+
+    .attached-resume-label {
+        padding: 15px 0;
+        font-size: 14px;
+    }
+
+    .attached-resume-item {
+        padding-bottom: 20px;
+
+        .attached-resume-img {
+            height: 44px;
+            margin-right: 8px;
+        }
+
+        .attached-resume-info {
+            line-height: 24px;
+            margin-bottom: 4px;
+            font-size: 14px;
+        }
+
+        .attached-resume-time {
+            font-size: 12px;
+            line-height: 17px;
+            color: #8d92a1;
+        }
+    }
+    .file-actions{
+        flex-shrink: 0;
+        :deep(.el-link){
+            font-size: 12px;
+        }
+    }
+}
+
+.attached-resume:hover {
+    cursor: pointer;
+}
+</style>

+ 18 - 36
src/components/messageCom/messageCom.vue

@@ -317,7 +317,8 @@
 				</template>
 			</el-dialog>
 		</el-dialog>
-
+		<!-- 附件列表 -->
+		<AttachmentSelectDialog @closePostPush="closePostPush" @select="selectItem" v-if="showDialog" :showDialog="showDialog" />
 	</div>
 </template>
 
@@ -335,7 +336,9 @@
 	} from 'element-plus'
 	import axios from 'axios';
 	import jsonp from 'axios-jsonp'
+	import AttachmentSelectDialog from '../AttachmentSelectDialog/AttachmentSelectDialog.vue'
 	export default {
+		components: { AttachmentSelectDialog },
 		props: {
 			// 显示弹窗
 			showMeg: {
@@ -369,6 +372,7 @@
 		},
 		data() {
 			return {
+				showDialog: false,
 				miamshi: {
 					hrPhone: '', //手机号
 					hrName: '', //联系人
@@ -467,6 +471,15 @@
 			this.getStatusInfo()
 		},
 		methods: {
+			closePostPush() {
+				this.showDialog = false
+			},
+			// 选择附件简历的数据
+			selectItem(item) {
+				if (item.resumesAttachmentId) {
+					this.sendResumesSave(item.resumesAttachmentId);
+				}
+			},
 			//关闭面试邀请回掉
 			closeMs() {
 				//清楚输入的值
@@ -631,11 +644,12 @@
 				})
 			},
 			// 同意简历请求并发送简历
-			sendResumesSave() {
+			sendResumesSave(resumesAttachmentId) {
 				let that = this
 				let data = {
 					to: this.byUserId, //接收人的userId
 					postPushId: this.postPushId, //岗位id
+					resumesAttachmentId
 				}
 				this.$Request.post("/app/resumes/sendResumes", data).then(res => {
 					if (res.code == 0) {
@@ -648,11 +662,6 @@
 						this.sendMessage(24)
 						this.getCHarList()
 						this.getStatusInfo()
-					} else {
-						uni.showToast({
-							title: res.msg,
-							icon: 'none'
-						})
 					}
 				})
 			},
@@ -667,7 +676,7 @@
 						}
 					)
 					.then(() => {
-						this.sendResumesSave()
+						this.showDialog = true;
 					}).catch(() => {
 
 					})
@@ -829,33 +838,6 @@
 				}
 
 			},
-			// 同意简历请求并发送简历
-			sendResumesSave() {
-				let that = this
-				let data = {
-					to: this.byUserId, //接收人的userId
-					postPushId: this.postPushId, //岗位id
-				}
-				this.$Request.post("/app/resumes/sendResumes", data).then(res => {
-					if (res.code == 0) {
-						ElMessage({
-							message: '简历已发送',
-							type: 'success',
-							duration: 1500,
-							offset: this.screenHeight / 2
-						})
-						that.getCHarList()
-						that.getStatusInfo()
-					} else {
-						ElMessage({
-							message: res.msg,
-							type: 'error',
-							duration: 1500,
-							offset: this.screenHeight / 2
-						})
-					}
-				})
-			},
 			//发简历
 			sendResumes() {
 				let that = this
@@ -868,7 +850,7 @@
 						}
 					)
 					.then(() => {
-						this.sendResumesSave()
+						this.showDialog = true;
 					}).catch(() => {
 
 					})

+ 18 - 37
src/views/message/index.vue

@@ -443,6 +443,8 @@
 				</span>
 			</template>
 		</el-dialog>
+		<!-- 附件列表 -->
+		<AttachmentSelectDialog @closePostPush="closePostPush" @select="selectItem" v-if="showDialog" :showDialog="showDialog" />
 	</div>
 </template>
 
@@ -460,9 +462,12 @@
 	} from 'element-plus'
 	import axios from 'axios';
 	import jsonp from 'axios-jsonp'
+	import AttachmentSelectDialog from '../../components/AttachmentSelectDialog/AttachmentSelectDialog.vue'
 	export default {
+		components: { AttachmentSelectDialog },
 		data() {
 			return {
+				showDialog: false,
 				miamshi: {
 					hrPhone: '', //手机号
 					hrName: '', //联系人
@@ -568,6 +573,15 @@
 			this.getChatList()
 		},
 		methods: {
+			closePostPush(){
+				this.showDialog = false
+			},
+			// 选择附件简历的数据
+			selectItem(item){
+				if(item.resumesAttachmentId){
+					this.sendResumesSave(item.resumesAttachmentId);
+				}
+			},
 			//关闭面试邀请回掉
 			closeMs() {
 				//清楚输入的值
@@ -845,11 +859,12 @@
 				this.isShowEmoj = false
 			},
 			// 同意简历请求并发送简历
-			sendResumesSave() {
+			sendResumesSave(resumesAttachmentId) {
 				let that = this
 				let data = {
 					to: this.byUserId, //接收人的userId
 					postPushId: this.postPushId, //岗位id
+					resumesAttachmentId
 				}
 				this.$Request.post("/app/resumes/sendResumes", data).then(res => {
 					if (res.code == 0) {
@@ -862,11 +877,6 @@
 						this.sendMessage(24)
 						this.getCHarList()
 						this.getStatusInfo()
-					} else {
-						uni.showToast({
-							title: res.msg,
-							icon: 'none'
-						})
 					}
 				})
 			},
@@ -881,7 +891,7 @@
 						}
 					)
 					.then(() => {
-						this.sendResumesSave()
+						this.showDialog = true;
 					}).catch(() => {
 
 					})
@@ -1043,37 +1053,8 @@
 				}
 
 			},
-			// 同意简历请求并发送简历
-			sendResumesSave() {
-				let that = this
-				let data = {
-					to: this.byUserId, //接收人的userId
-					postPushId: this.postPushId, //岗位id
-				}
-				this.$Request.post("/app/resumes/sendResumes", data).then(res => {
-					if (res.code == 0) {
-						ElMessage({
-							message: '简历已发送',
-							type: 'success',
-							duration: 1500,
-							offset: this.screenHeight / 2
-						})
-						this.sendMessage(24)
-						that.getCHarList()
-						that.getStatusInfo()
-					} else {
-						ElMessage({
-							message: res.msg,
-							type: 'error',
-							duration: 1500,
-							offset: this.screenHeight / 2
-						})
-					}
-				})
-			},
 			//发简历
 			sendResumes() {
-				let that = this
 				ElMessageBox.confirm(
 						'是否将简历发送给对方?',
 						'提示', {
@@ -1083,7 +1064,7 @@
 						}
 					)
 					.then(() => {
-						this.sendResumesSave()
+						this.showDialog = true;
 					}).catch(() => {
 
 					})

+ 10 - 2
src/views/resume/addResume.vue

@@ -3,7 +3,7 @@
         <div class="info flex align-center justify-center">
             <div class="info-box">
                 <div class="info-boxs flex justify-between">
-                    <div class="info-box-l">
+                    <div class="info-box-l" style="width:calc(100% - 690px)">
                         <div class="info-box-l-box">
                             <div class="info-box-l-title">
                                 个人中心
@@ -391,7 +391,7 @@
                                 </el-card>
                             </div>
                         </div>
-                        <div class="info-box-r-b flex align-center justify-around">
+                        <div class="info-box-r-b flex align-center justify-around" style="margin-top: 20px;padding-bottom: 10px;">
                             <div class="info-box-r-b-item" @click="goInterview(0)">
                                 <div class="info-box-r-b-item-t flex align-center justify-center">
                                     <img src="/images/resume/lljl.png" alt="" srcset="" />
@@ -418,6 +418,8 @@
                             </div>
                         </div>
                     </div>
+                    <!-- 附件简历 -->
+                     <upload-resume v-model="resumeFiles" :limit="3" @change="handleChange" />
                 </div>
                 <!----------------------------  工作经历 ---------------------------------->
                 <div class="info-boxsWork flex align-center justify-center">
@@ -928,9 +930,12 @@ import cityJs from '../../publicJs/city.js';
 import citySelect from '../../publicJs/citySelect.js';
 import { ElMessageBox, ElMessage } from 'element-plus';
 import { ROOTPATH } from '../../../comment/httpUrl.js';
+import UploadResume from "../../components/UploadResume/UploadResume.vue";
 export default {
+    components: { UploadResume },
     data() {
         return {
+            resumeFiles: [],
             cityAll: cityJs, //城市数据
             action: ROOTPATH + '/alioss/upload', //上传图片地址
             industryDialog: false, //是否打开行业选择
@@ -1138,6 +1143,9 @@ export default {
         }
     },
     methods: {
+        handleChange(list) {
+            console.log("当前上传的简历文件列表:", list);
+        },
         querySearch(queryString, cb) {
             const results = queryString
                 ? this.cityAll.filter(city =>