|
|
@@ -8,42 +8,88 @@
|
|
|
</header>
|
|
|
<div v-if="education.length > 0">
|
|
|
<template v-for="(item, idx) in education">
|
|
|
- <div v-if="editingItem.indexOf(idx) < 0" :key="item.company" class="show">
|
|
|
+ <div v-if="editingItem.indexOf(idx) < 0" :key="item.university" class="show">
|
|
|
<h4>
|
|
|
- <span>{{`${item.start} - ${item.end} ${item.company} ${item.position}`}}</span>
|
|
|
+ <span>{{`${item.start_time} - ${item.end_time || '至今'} ${item.university} ${item.major}`}}</span>
|
|
|
<el-button @click="editItem(idx)" type="text">编辑</el-button>
|
|
|
</h4>
|
|
|
- <p>{{item.des}}</p>
|
|
|
+ <p>{{item.description}}</p>
|
|
|
</div>
|
|
|
- <div v-else :key="item.company" class="edit">
|
|
|
- <el-form ref="form" :rules="rules" :model="education[idx]" label-width="147px">
|
|
|
+ <div v-else :key="'education' + idx" class="edit">
|
|
|
+ <el-form ref="form" :rules="rules" :model="item" label-width="147px">
|
|
|
<div class="header">
|
|
|
- <el-date-picker v-model="education[idx].start" type="date" placeholder="开始时间"></el-date-picker>
|
|
|
- <span class="to">至</span>
|
|
|
- <el-date-picker v-model="education[idx].end" type="date" placeholder="结束时间"></el-date-picker>
|
|
|
- <el-input
|
|
|
- :style="{width: '202px'}"
|
|
|
- v-model="education[idx].company"
|
|
|
+ <el-date-picker
|
|
|
+ v-model="item.date"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ ></el-date-picker>
|
|
|
+ <el-select
|
|
|
+ v-model="item.university"
|
|
|
+ allow-create
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ reserve-keyword
|
|
|
placeholder="学校名称"
|
|
|
- ></el-input>
|
|
|
- <el-select v-model="education[idx].position" placeholder="选择专业">
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
- <el-option label="区域二" value="beijing"></el-option>
|
|
|
+ :remote-method="fetchUniversity"
|
|
|
+ :loading="loadingUniversity"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in universities"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-select
|
|
|
+ class="small"
|
|
|
+ v-model="item.major"
|
|
|
+ allow-create
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ reserve-keyword
|
|
|
+ placeholder="选择专业"
|
|
|
+ :remote-method="fetchMajor"
|
|
|
+ :loading="loadingMajor"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in majors"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-select class="small" v-model="item.education_background" placeholder="学历">
|
|
|
+ <el-option
|
|
|
+ v-for="educationBackground in educationBackgrounds"
|
|
|
+ :key="educationBackground.value"
|
|
|
+ :label="educationBackground.label"
|
|
|
+ :value="educationBackground.value"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
<span class="opts">
|
|
|
<el-button type="danger" @click="handleDelete(idx)">删除</el-button>
|
|
|
<el-button type="info" @click="handleCancel(idx)">取消</el-button>
|
|
|
- <el-button type="primary" @click="onSubmit(idx)">确认</el-button>
|
|
|
+ <el-button type="primary" @click="handleConfirm(idx)">确认</el-button>
|
|
|
</span>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <el-input class="big" v-model="item.diploma_url" placeholder="请输入学信网在线验证报告地址"></el-input>
|
|
|
+ </div>
|
|
|
<div class="content">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
:rows="7"
|
|
|
placeholder="教育经历文字说明,不得低于15个字符"
|
|
|
- v-model="education[idx].des"
|
|
|
+ v-model="item.description"
|
|
|
></el-input>
|
|
|
- <uploader :imageUrl="education[idx].imageUrl" title="工作证明" @change="handleImageUrl"></uploader>
|
|
|
+ <uploader
|
|
|
+ :imageUrl="item.diploma_photo"
|
|
|
+ title="毕业证图片"
|
|
|
+ @change="val => handleImageUrl(idx, val)"
|
|
|
+ ></uploader>
|
|
|
</div>
|
|
|
<footer>
|
|
|
<p>学信网在线验证报告, 例如:https://www.proginn.com</p>
|
|
|
@@ -68,48 +114,153 @@ export default {
|
|
|
name: ""
|
|
|
},
|
|
|
init: {
|
|
|
- imageUrl: "",
|
|
|
+ diploma_photo: "",
|
|
|
+ diploma_url: "",
|
|
|
start: "",
|
|
|
end: "",
|
|
|
- company: "",
|
|
|
- position: "",
|
|
|
- des: ""
|
|
|
+ data: "",
|
|
|
+ university: "",
|
|
|
+ major: "",
|
|
|
+ education_background: "",
|
|
|
+ description: ""
|
|
|
},
|
|
|
education: [
|
|
|
// {
|
|
|
- // imageUrl: "",
|
|
|
+ // diploma_photo: "",
|
|
|
// start: "2019-01-02",
|
|
|
// end: "2019-01-02",
|
|
|
- // company: "程序员客栈",
|
|
|
- // position: "高级产品经理",
|
|
|
- // des:
|
|
|
+ // university: "程序员客栈",
|
|
|
+ // major: "高级产品经理",
|
|
|
+ // description:
|
|
|
// "主要负责程序员客栈“雇佣直通车、1980服务、云端项目、雇佣项目“项目前后端开发,参与整个项目的设计、需求讨论、代码开发、联调测试及系统维护迭代。 【主要工作成就】:解决“雇佣直通车”项目,系统智能自动匹配算法问题。"
|
|
|
// }
|
|
|
],
|
|
|
- current: null
|
|
|
+ current: null,
|
|
|
+ originEducation: [],
|
|
|
+ universities: [],
|
|
|
+ loadingUniversity: false,
|
|
|
+ majors: [],
|
|
|
+ loadingMajor: false,
|
|
|
+ educationBackgrounds: []
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
uploader
|
|
|
},
|
|
|
+ computed: {},
|
|
|
+ watch: {},
|
|
|
+ async mounted() {
|
|
|
+ this.getData();
|
|
|
+ this.getEducationBackground();
|
|
|
+ },
|
|
|
methods: {
|
|
|
- onSubmit(idx) {
|
|
|
- console.log("submit!", this.form);
|
|
|
- this.education.push(this.form);
|
|
|
+ async onSubmit(idx) {
|
|
|
+ console.log("submit!", this.originEducation);
|
|
|
+ if (this.originEducation.length > 10) {
|
|
|
+ this.$message.error("最多可添加10项工作经历!");
|
|
|
+ }
|
|
|
+ const res = await this.$axios.$post("/api/user_education/save_all", {
|
|
|
+ data: JSON.stringify(this.originEducation)
|
|
|
+ });
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message.success(res.info);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.info);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getData() {
|
|
|
+ const res = await this.$axios.$post("/api/user_education/list");
|
|
|
+ const data = res.data || [];
|
|
|
+ const education = data.map(it => ({
|
|
|
+ ...it,
|
|
|
+ date: [it.start_time, it.end_time]
|
|
|
+ }));
|
|
|
+ console.log(education);
|
|
|
+ this.education = education;
|
|
|
+ this.originEducation = data;
|
|
|
+ },
|
|
|
+ async getEducationBackground() {
|
|
|
+ const res = await this.$axios.$post(
|
|
|
+ "/api/simple_data/select_education_background"
|
|
|
+ );
|
|
|
+ const data = res.data || [];
|
|
|
+ this.educationBackgrounds = data.map(it => ({
|
|
|
+ value: it.id,
|
|
|
+ label: it.name
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ async fetchUniversity(keyword) {
|
|
|
+ console.log(keyword);
|
|
|
+ this.loadingUniversity = true;
|
|
|
+ const res = await this.$axios.$post(
|
|
|
+ "/api/simple_data/select_university",
|
|
|
+ { keyword }
|
|
|
+ );
|
|
|
+ this.loadingUniversity = false;
|
|
|
+ const data = res.data || [];
|
|
|
+ this.universities = data.map(it => ({ value: it.id, label: it.name }));
|
|
|
+ },
|
|
|
+ async fetchMajor(keyword) {
|
|
|
+ console.log(keyword);
|
|
|
+ this.loadingMajor = true;
|
|
|
+ const res = await this.$axios.$post("/api/simple_data/select_major", {
|
|
|
+ keyword
|
|
|
+ });
|
|
|
+ this.loadingMajor = false;
|
|
|
+ const data = res.data || [];
|
|
|
+ this.majors = data.map(it => ({ value: it.id, label: it.name }));
|
|
|
+ },
|
|
|
+ handleRankClose() {
|
|
|
+ this.rankForm = {
|
|
|
+ first: ""
|
|
|
+ };
|
|
|
+ },
|
|
|
+ handleRank() {
|
|
|
+ this.rankDialog = false;
|
|
|
},
|
|
|
handleAdd() {
|
|
|
this.education.push(this.init);
|
|
|
this.editingItem.push(this.education.length - 1);
|
|
|
},
|
|
|
- handleImageUrl(url) {
|
|
|
- this.form.imageUrl = url;
|
|
|
+ handleImageUrl(idx, url) {
|
|
|
+ this.education[idx].diploma_photo = url;
|
|
|
},
|
|
|
handleDelete(idx) {
|
|
|
- this.education.splice(this.education.indexOf(this.current), 1);
|
|
|
+ this.education.splice(idx, 1);
|
|
|
+ this.originEducation.splice(idx, 1);
|
|
|
+ this.onSubmit();
|
|
|
},
|
|
|
handleCancel(idx) {
|
|
|
this.editingItem.splice(this.editingItem.indexOf(idx), 1);
|
|
|
},
|
|
|
+ handleConfirm(idx) {
|
|
|
+ const item = this.education.slice(idx, idx + 1)[0];
|
|
|
+ const origin = this.originEducation.slice(idx, idx + 1)[0];
|
|
|
+ if (item == origin) {
|
|
|
+ this.$message.error("请修改后保存!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!item.date) {
|
|
|
+ this.$message.error("请设置开始时间/结束时间!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!item.university || !item.major || !item.education_background) {
|
|
|
+ this.$message.error("请设置学校名称/专业/学历!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!item.diploma_url && !item.diploma_photo) {
|
|
|
+ this.$message.error("请提供学历证明!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.editingItem.splice(this.editingItem.indexOf(idx), 1);
|
|
|
+ const submitItem = {
|
|
|
+ ...item,
|
|
|
+ start_time: item.date[0],
|
|
|
+ end_time: item.date[1]
|
|
|
+ };
|
|
|
+ this.originEducation.splice(idx, 1, submitItem);
|
|
|
+ this.onSubmit();
|
|
|
+ },
|
|
|
editItem(idx) {
|
|
|
this.editingItem.push(idx);
|
|
|
}
|
|
|
@@ -125,8 +276,18 @@ export default {
|
|
|
.edit {
|
|
|
padding: 20px;
|
|
|
> form {
|
|
|
+ .header {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
.opts {
|
|
|
- float: right;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .el-button {
|
|
|
+ margin-left: 5px;
|
|
|
+ }
|
|
|
}
|
|
|
.el-select,
|
|
|
.el-input {
|
|
|
@@ -136,6 +297,15 @@ export default {
|
|
|
padding-right: 0;
|
|
|
}
|
|
|
}
|
|
|
+ .small {
|
|
|
+ width: 100px;
|
|
|
+ }
|
|
|
+ .big {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ .el-date-editor {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
.to {
|
|
|
margin-right: 10px;
|
|
|
}
|