This commit is contained in:
2025-11-06 09:47:40 +08:00
parent 0a0e484349
commit a4eaf0d5cb
8 changed files with 735 additions and 282 deletions

View File

@@ -0,0 +1,208 @@
<template>
<div>
<!-- 个人简历弹出框 -->
<p style="margin: 0 0 25px 28px; font-size: 18px">CV. List</p>
<p style="color: #aaa; margin: 0 0 30px 28px" v-if="cvitaTable.length == 0">No data</p>
<div v-for="(item, index) in cvitaTable" style="margin: 0 0 0 30px">
{{ index + 1 }}.
<img src="../../assets/img/icon_0.png" alt="" class="icon_img" style="vertical-align: middle; margin-left: 10px" />
<span style="margin-left: 20px; color: #888; font-size: 13px">
<i class="el-icon-paperclip"></i>
{{ formatDate(item.ctime) }}
</span>
<a :href="mediaUrl + 'reviewer/' + item.cv" target="_blank" class="txt_pdf">
<i class="el-icon-download"></i>
</a>
<i
class="el-icon-delete"
@click="deletCVita(item)"
style="color: #f12424; cursor: pointer; font-weight: bold; margin: 0 0 0 15px"
></i>
</div>
<p style="width: 90%; background-color: #d7d7d7; height: 1px; margin: 10px auto 30px auto"></p>
<p style="margin: 0 0 25px 28px">If you want to update your resume, please upload it.</p>
<el-form :model="cvitaForm" :rules="rules" ref="cvita_Form" label-width="70px">
<el-form-item label="CV. :">
<el-upload
class="upload-demo"
:action="baseUrl + 'api/Ucenter/up_cv_file'"
:on-success="handleFileSuccess1"
name="reviewerCV"
type="reviewerCV"
:on-error="handleFileError"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-change="handleChange1"
accept=".pdf"
:on-exceed="handleExceed"
ref="uploadRef1"
>
<el-button type="text" style="font-weight: bolder">
<b class="el-icon-lx-top" style="font-weight: bolder"></b>upload
</el-button>
</el-upload>
<span style="font-size: 12px; color: #aaa"> Only pdf files can be uploaded(.pdf) </span>
</el-form-item>
</el-form>
</div>
</template>
<script>
import Schart from 'vue-schart';
import bus from '../common/bus';
export default {
name: 'dashboard',
data() {
return {
user_id: '',
baseUrl: this.Common.baseUrl,
mediaUrl: this.Common.mediaUrl,
cvitaTable1: [],
cvitaForm: {},
fileL_pdf1: []
};
},
created: function () {},
components: {
Schart,
'el-image-viewer': () => import('element-ui/packages/image/src/image-viewer')
},
computed: {},
methods: {
init() {
this.user_id = localStorage.getItem('U_id');
this.cvitaForm.user_id = this.user_id;
console.log('this.user_id at line 75:', this.user_id)
this.getCVitaData();
},
// 获取简历列表
getCVitaData() {
this.$api
.post('api/Ucenter/getUserInfo', {
user_id: this.user_id
})
.then((res) => {
if (res.code == 0) {
this.cvitaTable1 = res.data.cvs;
this.$emit('cvitaTable', this.cvitaTable1);
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
},
// 删除简历
deletCVita(e) {
// 二次确认删除
this.$confirm('Are you sure you want to delete the CV.?', 'Tip', {
type: 'warning'
})
.then(() => {
this.$api
.post('api/Ucenter/delUserCv', e)
.then((res) => {
if (res.code == 0) {
this.$message.success('Delete successful!');
this.getCVitaData();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
})
.catch(() => {});
},
// 星级弹出层
// 上传文件
handleChange1(file, fileList) {
if (fileList.length > 0) {
this.fileL_pdf1 = [fileList[fileList.length - 1]];
}
},
handleFileSuccess1(res, file) {
this.$refs.uploadRef1.clearFiles();
if (res.code == 0) {
this.cvitaForm.cv = res.upurl;
this.$api
.post('api/Ucenter/addUserCv', this.cvitaForm)
.then((res) => {
if (res.code == 0) {
this.$message.success('Upload succeeded!');
this.getCVitaData();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$message.error(res.msg);
}
},
beforeRemove(file, fileList) {
return this.$confirm(`Remove ${file.name}`);
},
handleFileError(res, file) {},
handleRemove(file, fileList) {},
handlePreview(file) {
window.open(file.url);
},
handleExceed(files, fileList) {
this.$message.warning('The current limit is 1 file. Please delete the current file first');
},
// 时间格式
formatDate(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D;
},
formatYear(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + ' . ';
var M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
return Y + M;
}
}
};
</script>
<style scoped>
.el-image-viewer__wrapper {
z-index: 5000 !important;
padding: 50px 0;
}
.el-image-viewer__wrapper .el-icon-circle-close {
color: #fff !important;
}
.txt_pdf {
margin: 0 0 20px 10px;
display: inline-block;
color: #333;
}
.txt_pdf > i {
color: #66a9f0;
font-weight: bold;
margin-left: 10px;
}
</style>