
@@ -472,13 +461,14 @@ import {
couldBookUpdate,
couldApply,
delBook,
+ addLists,
+ updateLists,
} from '@/api/tester/TesterApply'
export default {
components: { imageUpload },
data() {
return {
- flag: false,
active: 0,
// 实名认证
certifform: {},
@@ -514,7 +504,7 @@ export default {
intro: [{ required: true, message: '请输入工作内容', trigger: 'blur' }],
},
// 项目经历
- projectList: [{}],
+ projectList: [{ type: 0 }],
projectRules: {
name: [{ required: true, message: '请输入公司名称', trigger: 'blur' }],
startTime: [{ required: true, message: '请输入开始时间', trigger: 'blur' }],
@@ -545,7 +535,7 @@ export default {
url: [{ required: true, message: '请上传证书', trigger: 'blur' }],
},
// 教育经历
- educationList: [{}],
+ educationList: [{ type: 2 }],
educationRules: {
name: [{ required: true, message: '请输入学校名称', trigger: 'blur' }],
startTime: [{ required: true, message: '请输入开始时间', trigger: 'blur' }],
@@ -553,6 +543,7 @@ export default {
education: [{ required: true, message: '请输入学历', trigger: 'change' }],
major: [{ required: true, message: '请输入专业名称', trigger: 'blur' }],
},
+ base: process.env.VUE_APP_BASE_API,
}
},
watch: {
@@ -575,7 +566,7 @@ export default {
// 去修改
goedit() {
this.userForm.status = null
- this.active =1
+ this.active = 1
},
// 提交审核
saveInfo() {
@@ -592,7 +583,7 @@ export default {
// 经历
this.projectList = res.experience.filter((it) => it.type == 0)
if (!this.projectList.length) {
- this.projectList = [{}]
+ this.projectList = [{ type: 0 }]
}
this.workList = res.experience.filter((it) => it.type == 1)
if (!this.workList.length) {
@@ -600,34 +591,41 @@ export default {
}
this.educationList = res.experience.filter((it) => it.type == 2)
if (!this.educationList.length) {
- this.educationList = [{}]
+ this.educationList = [{ type: 2 }]
}
// 个人简介
if (res.personalInfo) {
this.userForm = res.personalInfo
- if (!this.userForm.city || !this.userForm.testSkills || !this.userForm.personalAdvantage) {
- this.userForm.flag = false
+ if (this.city) {
+ this.province = this.userForm.city.split('-')[0]
+ this.city = this.userForm.city.split('-')[1]
} else {
- this.userForm.flag = true
+ this.province = '北京市'
+ this.city = '北京市'
+ this.userForm.city = '北京市-北京市'
}
- this.province = this.userForm.city.split('-')[0]
- this.city = this.userForm.city.split('-')[1]
- // 审核状态 1审核通过 2不通过 没有或者0待审核
+ // 审核状态 状态,0未审核,1审核中,2审核通过,3审核不通过
if (res.personalInfo.status === 0) {
} else if (res.personalInfo.status === 1) {
this.active = 6
} else if (res.personalInfo.status === 2) {
this.active = 6
- } else {
- this.active = 6
+ } else if (res.personalInfo.status === 3) {
+ this.active = 6
+ }
+
+ if (res.personalInfo.status == 2 && this.userinform.testerStatus != 2) {
+ const data = JSON.parse(JSON.stringify(this.userinform))
+ data.testerStatus = 2
+ this.$store.commit('SET_USERINFORM', data)
}
}
// 证书
this.certificateList = res.credentials.map((it) => {
return {
- url: it.fileUrl,
+ url: this.base + it.filePath,
credentialsName: it.fileName,
fileId: it.fileId,
}
@@ -694,59 +692,175 @@ export default {
if (this.active == 0) {
if (this.certifform.status != 1) {
return this.$message.warning('请先通过实名认证')
+ } else {
+ this.active++
+ return
+ }
+ }
+ if (this.active == 1 && this.workList.length) {
+ const flagArr = []
+ this.workList.forEach((it, index) => {
+ this.$refs[`workRef${index}`][0].validate((valid) => {
+ if (valid) {
+ flagArr.push(true)
+ } else {
+ flagArr.push(false)
+ }
+ })
+ })
+ if (flagArr.some((it) => !it)) {
+ this.$message.warning('请填写完整')
+ } else {
+ // 全填了
+ if (this.workList[0].caseId) {
+ // 修改
+ updateLists(this.workList).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ } else {
+ addLists(this.workList).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ }
}
+ return
}
- if (this.active == 2) {
+ if (this.active == 1 && !this.workList.length) {
+ this.active++
+ return
+ }
+ if (this.active == 2 && this.projectList.length) {
// 项目经历
- if (this.projectList.length && this.projectList[0].caseId) {
+ const flagArr2 = []
+ this.projectList.forEach((it, index) => {
+ this.$refs[`projectRef${index}`][0].validate((valid) => {
+ if (valid) {
+ flagArr2.push(true)
+ } else {
+ flagArr2.push(false)
+ }
+ })
+ })
+ if (flagArr2.some((it) => !it)) {
+ this.$message.warning('请填写完整')
} else {
- return this.$message.warning('至少保存一条项目经历')
+ // 全填了
+ if (this.projectList[0].caseId) {
+ // 修改
+ updateLists(this.projectList).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ } else {
+ addLists(this.projectList).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ }
}
+ return
}
if (this.active == 3) {
// 个人简介
- if (!this.userForm.flag) {
- return this.$message.warning('请先保存个人简介')
- }
+ this.$refs[`userRef`].validate((valid) => {
+ if (valid) {
+ if (this.userForm.city.indexOf('--- 市 ---') != -1) {
+ return this.$message.warning('请选择市')
+ }
+ couldUserInfoAdd(this.userForm).then((res) => {
+ this.$message.success('保存个人简介成功')
+ this.getCloudAllList()
+ this.active++
+ return
+ })
+ }
+ })
}
- if (this.active == 5) {
+ if (this.active == 5 && this.educationList.length) {
// 教育经历
- if (this.educationList.length && this.educationList[0].caseId) {
+ const flagArr3 = []
+ this.educationList.forEach((it, index) => {
+ this.$refs[`educationRef${index}`][0].validate((valid) => {
+ if (valid) {
+ flagArr3.push(true)
+ } else {
+ flagArr3.push(false)
+ }
+ })
+ })
+ if (flagArr3.some((it) => !it)) {
+ this.$message.warning('请填写完整')
} else {
- return this.$message.warning('至少保存一条教育经历')
+ // 全填了
+ if (this.educationList[0].caseId) {
+ // 修改
+ updateLists(this.educationList).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ } else {
+ addLists(this.educationList).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ }
}
+ return
+ }
+ if (this.active == 4 && this.certificateList.length) {
+ const flagArr4 = []
+ this.certificateList.forEach((it, index) => {
+ this.$refs[`certificateRef${index}`][0].validate((valid) => {
+ if (valid) {
+ flagArr4.push(true)
+ } else {
+ flagArr4.push(false)
+ }
+ })
+ })
+ if (flagArr4.some((it) => !it)) {
+ this.$message.warning('请填写完整')
+ } else {
+ // 全填了
+ this.certificateList.forEach((it) => {
+ if (it.url) {
+ it.url = it.url.replace(/.*\/profile/, '/profile')
+ }
+ })
+ if (this.certificateList[0].fileId) {
+ // 修改
+ couldBookUpdate({ credentialsList: this.certificateList }).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ } else {
+ couldBookAdd({ credentialsList: this.certificateList }).then((res) => {
+ this.getCloudAllList()
+ this.active++
+ this.$message.success('保存成功')
+ })
+ }
+ }
+ return
+ }
+ if (this.active == 4 && !this.certificateList.length) {
+ this.active++
+ return
}
- this.active++
},
// 工作经历添加
addWork() {
if (this.workList.length >= 10) return this.$message.warning('工作经历最多添加10条')
- this.workList.push({})
- },
- // 工作经历保存
- saveWork(i) {
- this.$refs[`workRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = this.workList[i]
- data.type = 1
- couldInfoAdd(data).then((res) => {
- this.$message.success('工作经历保存成功')
- this.getCloudAllList()
- })
- }
- })
- },
- // 工作经历修改
- updateWork(i) {
- this.$refs[`workRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = this.workList[i]
- couldInfoUpdate(data).then((res) => {
- this.$message.success('工作经历修改成功')
- this.getCloudAllList()
- })
- }
- })
+ this.workList.push({ type: 1 })
},
// 工作经历删除
delWork(i) {
@@ -755,52 +869,17 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
- if (this.workList[i].caseId) {
- couldInfoDelete(this.workList[i].caseId).then(() => {
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- this.getCloudAllList()
- })
- } else {
- this.workList.splice(i, 1)
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- }
+ this.workList.splice(i, 1)
+ this.$message({
+ type: 'success',
+ message: '删除成功!',
+ })
})
},
// 项目经历添加
addProject() {
if (this.projectList.length >= 20) return this.$message.warning('项目经历最多添加20条')
- this.projectList.push({})
- },
- // 项目经历保存
- saveProject(i) {
- this.$refs[`projectRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = this.projectList[i]
- data.type = 0
- couldInfoAdd(data).then((res) => {
- this.$message.success('项目经历保存成功')
- this.getCloudAllList()
- })
- }
- })
- },
- // 项目经历修改
- updateProject(i) {
- this.$refs[`projectRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = this.projectList[i]
- couldInfoUpdate(data).then((res) => {
- this.$message.success('项目经历修改成功')
- this.getCloudAllList()
- })
- }
- })
+ this.projectList.push({ type: 0 })
},
// 项目经历删除
delProject(i) {
@@ -809,74 +888,19 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
- if (this.projectList[i].caseId) {
- couldInfoDelete(this.projectList[i].caseId).then(() => {
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- this.getCloudAllList()
- })
- } else {
- if (this.projectList.length == 1) return this.$message.warning('最少有一项')
- this.projectList.splice(i, 1)
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- }
- })
- },
- // 个人简介保存
- saveUser() {
- this.$refs[`userRef`].validate((valid) => {
- if (valid) {
- if (this.userForm.city.indexOf('--- 市 ---') != -1) {
- return this.$message.warning('请选择市')
- }
- couldUserInfoAdd(this.userForm).then((res) => {
- this.$message.success('保存个人简介成功')
- this.userForm.flag = true
- })
- }
+ if (this.projectList.length == 1) return this.$message.warning('最少有一项')
+ this.projectList.splice(i, 1)
+ this.$message({
+ type: 'success',
+ message: '删除成功!',
+ })
})
},
// 资格证书添加
addCertificate() {
this.certificateList.push({})
},
- // 保存证书
- saveCertificate(i) {
- this.$refs[`certificateRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = {
- credentialsList: [JSON.parse(JSON.stringify(this.certificateList[i]))],
- }
- data.credentialsList[0].url = data.credentialsList[0].url.replace(/.*\/profile/, '/profile')
- couldBookAdd(data).then((res) => {
- this.$message.success('资格证书保存成功')
- this.getCloudAllList()
- })
- }
- })
- },
- // 更新证书
- updateCertificate(i) {
- this.$refs[`certificateRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = {
- credentialsList: JSON.parse(JSON.stringify(this.certificateList)),
- }
- data.credentialsList.forEach((it) => {
- it.url = it.url.replace(/.*\/profile/, '/profile')
- })
- couldBookUpdate(data).then((res) => {
- this.$message.success('资格证书修改成功')
- this.getCloudAllList()
- })
- }
- })
- },
+
// 资格证书删除
delCertificate(i) {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
@@ -884,49 +908,17 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
- if (this.certificateList[i].fileId) {
- delBook(this.certificateList[i].fileId).then((res) => {
- this.$message.success('资格证书删除成功')
- this.getCloudAllList()
- })
- } else {
- this.certificateList.splice(i, 1)
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- }
+ this.certificateList.splice(i, 1)
+ this.$message({
+ type: 'success',
+ message: '删除成功!',
+ })
})
},
// 教育经历添加
addEducation() {
this.educationList.push({})
},
- // 教育经历保存
- saveEducation(i) {
- this.$refs[`educationRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = this.educationList[i]
- data.type = 2
- couldInfoAdd(data).then((res) => {
- this.$message.success('教育经历保存成功')
- this.getCloudAllList()
- })
- }
- })
- },
- // 教育经历修改
- updateEducation(i) {
- this.$refs[`educationRef${i}`][0].validate((valid) => {
- if (valid) {
- const data = this.educationList[i]
- couldInfoUpdate(data).then((res) => {
- this.$message.success('教育经历修改成功')
- this.getCloudAllList()
- })
- }
- })
- },
// 教育经历删除
delEducation(i) {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
@@ -934,22 +926,12 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
- if (this.educationList[i].caseId) {
- couldInfoDelete(this.educationList[i].caseId).then(() => {
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- this.getCloudAllList()
- })
- } else {
- if (this.educationList.length == 1) return this.$message.warning('最少有一项')
- this.educationList.splice(i, 1)
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
- }
+ if (this.educationList.length == 1) return this.$message.warning('最少有一项')
+ this.educationList.splice(i, 1)
+ this.$message({
+ type: 'success',
+ message: '删除成功!',
+ })
})
},
// 省
@@ -977,8 +959,8 @@ export default {