|
@@ -1,8 +1,10 @@
|
|
<!-- -->
|
|
<!-- -->
|
|
<template>
|
|
<template>
|
|
<view>
|
|
<view>
|
|
- <resume v-if="showResumeList" resumeAnalysis @submit="handleResumeAnalysis"></resume>
|
|
|
|
- <view v-if="formLIst?.length">
|
|
|
|
|
|
+ <!-- 选择简历 -->
|
|
|
|
+ <resume v-if="step === 1" resumeAnalysis @submit="handleResumeAnalysis"></resume>
|
|
|
|
+ <!-- 解析内容-表单 -->
|
|
|
|
+ <view v-if="step === 2 && formLIst?.length" style="padding-bottom: 150rpx;">
|
|
<uni-card v-for="item of formLIst" :key="item.id" :id="item.id">
|
|
<uni-card v-for="item of formLIst" :key="item.id" :id="item.id">
|
|
<uni-section :title="item.text" type="line">
|
|
<uni-section :title="item.text" type="line">
|
|
<template v-slot:right>
|
|
<template v-slot:right>
|
|
@@ -10,12 +12,22 @@
|
|
</template>
|
|
</template>
|
|
<avatarEdit v-if="item.path === 'avatarEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
<avatarEdit v-if="item.path === 'avatarEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
<baseInfoEdit v-if="item.path === 'baseInfoEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
<baseInfoEdit v-if="item.path === 'baseInfoEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
|
|
+ <advantageEdit v-if="item.path === 'advantageEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
|
|
+ <educationEdit v-if="item.path === 'educationEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
|
|
+ <workExperienceEdit v-if="item.path === 'workExperienceEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
|
|
+ <trainingExperienceEdit v-if="item.path === 'trainingExperienceEdit'" ref="componentRef" :id="item.id" :data="item.data" />
|
|
</uni-section>
|
|
</uni-section>
|
|
</uni-card>
|
|
</uni-card>
|
|
|
|
+ <!-- 保存 -->
|
|
|
|
+ <view class="bottom-sticky flex-column ss-p-b-25" style="background-color: #fff; z-index: 2000; border-top: 1px solid #eee;">
|
|
|
|
+ <button class="recomm-button" :loading="submitLoading" @click="submit">提交(保存至在线简历)</button>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
- <view v-else>
|
|
|
|
- <view v-if="loading">加载中...</view>
|
|
|
|
- <view v-else>加载失败</view>
|
|
|
|
|
|
+ <view v-if="step === 3">
|
|
|
|
+ <view class="tips">加载中...</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view v-if="step === 4">
|
|
|
|
+ <view class="tips">加载失败</view>
|
|
</view>
|
|
</view>
|
|
<!-- 确认框 -->
|
|
<!-- 确认框 -->
|
|
<uni-popup ref="confirmRef" type="dialog">
|
|
<uni-popup ref="confirmRef" type="dialog">
|
|
@@ -24,6 +36,7 @@
|
|
cancelText="取消"
|
|
cancelText="取消"
|
|
confirmText="确认"
|
|
confirmText="确认"
|
|
title="系统提示"
|
|
title="系统提示"
|
|
|
|
+ :showClose="showClose"
|
|
:content="dialogContent"
|
|
:content="dialogContent"
|
|
@confirm="handleConfirm"
|
|
@confirm="handleConfirm"
|
|
@close="null"
|
|
@close="null"
|
|
@@ -33,32 +46,27 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-// import { saveResumeInfo, resumeParser2 } from '@/api/recruit/personal/resume'
|
|
|
|
-// import { resumeParser2 } from '@/api/recruit/personal/resume'
|
|
|
|
|
|
+import { saveResumeInfo, resumeParser2 } from '@/api/user'
|
|
// import { envObj, baseUrl } from '@/utils/config'
|
|
// import { envObj, baseUrl } from '@/utils/config'
|
|
import resume from '../resume/index.vue'
|
|
import resume from '../resume/index.vue'
|
|
import { ref, shallowRef } from 'vue'
|
|
import { ref, shallowRef } from 'vue'
|
|
-import baseInfoEdit from './components/baseInfoEdit.vue'
|
|
|
|
import avatarEdit from './components/avatarEdit.vue'
|
|
import avatarEdit from './components/avatarEdit.vue'
|
|
-import { data } from './testData.js'
|
|
|
|
-
|
|
|
|
-const showResumeList = ref(true)
|
|
|
|
|
|
+import baseInfoEdit from './components/baseInfoEdit.vue'
|
|
|
|
+import advantageEdit from './components/advantage.vue'
|
|
|
|
+import educationEdit from './components/educationExp.vue'
|
|
|
|
+import workExperienceEdit from './components/workExperience.vue'
|
|
|
|
+import trainingExperienceEdit from './components/trainingExperience.vue'
|
|
|
|
+// import { data } from './testData.js'
|
|
|
|
|
|
-const handleResumeAnalysis = (url) => {
|
|
|
|
- if (!url) {
|
|
|
|
- return uni.showToast({ icon: 'none', title: '请选择要解析的简历' })
|
|
|
|
- }
|
|
|
|
- showResumeList.value = false
|
|
|
|
- // handleAnalysis(url)
|
|
|
|
-}
|
|
|
|
|
|
+const step = ref(1)
|
|
|
|
|
|
const exampleList = {
|
|
const exampleList = {
|
|
avatar: { text: '头像', id: 'avatar', path: 'avatarEdit' },
|
|
avatar: { text: '头像', id: 'avatar', path: 'avatarEdit' },
|
|
person: { text: '基础信息', id: 'person', path: 'baseInfoEdit' },
|
|
person: { text: '基础信息', id: 'person', path: 'baseInfoEdit' },
|
|
- advantage: { text: '个人优势', id: 'advantage', path: 'advantage' },
|
|
|
|
- eduList: { text: '教育经历', id: 'eduList', path: '' },
|
|
|
|
- workList: { text: '工作经历', id: 'workList', path: '' },
|
|
|
|
- trainList: { text: '培训经历', id: 'trainList', path: '' },
|
|
|
|
|
|
+ advantage: { text: '个人优势', id: 'advantage', path: 'advantageEdit' },
|
|
|
|
+ eduList: { text: '教育经历', id: 'eduList', path: 'educationEdit' },
|
|
|
|
+ workList: { text: '工作经历', id: 'workList', path: 'workExperienceEdit' },
|
|
|
|
+ trainList: { text: '培训经历', id: 'trainList', path: 'trainingExperienceEdit' },
|
|
}
|
|
}
|
|
|
|
|
|
const resumeTxt = ref([]) // 查看文本信息
|
|
const resumeTxt = ref([]) // 查看文本信息
|
|
@@ -97,36 +105,119 @@ const transformToLIst = async (result) => {
|
|
|
|
|
|
const confirmRef = ref()
|
|
const confirmRef = ref()
|
|
const dialogContent = ref('')
|
|
const dialogContent = ref('')
|
|
|
|
+const showClose = ref(true)
|
|
let delId = null
|
|
let delId = null
|
|
|
|
+let dialogType = 'del'
|
|
|
|
+
|
|
const del = (item) => {
|
|
const del = (item) => {
|
|
- dialogContent.value = `是否确认删除${item.text}?`
|
|
|
|
|
|
+ dialogContent.value = `是否确认删除${item.text}?`
|
|
delId = item.id
|
|
delId = item.id
|
|
|
|
+ dialogType = 'del'
|
|
|
|
+ showClose.value = true
|
|
confirmRef.value.open()
|
|
confirmRef.value.open()
|
|
}
|
|
}
|
|
|
|
+
|
|
const handleConfirm = () => {
|
|
const handleConfirm = () => {
|
|
- formLIst.value = formLIst.value.filter(e => e.id !== delId)
|
|
|
|
|
|
+ if (dialogType === 'del') {
|
|
|
|
+ formLIst.value = formLIst.value.filter(e => e.id !== delId)
|
|
|
|
+ }
|
|
|
|
+ if (dialogType === 'submitSuccess') {
|
|
|
|
+ uni.navigateTo({ url: '/pagesA/resumeOnline/index' })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
-const result = ref(JSON.parse(JSON.stringify(data)))
|
|
|
|
|
|
+// const result = ref(JSON.parse(JSON.stringify(data))) // 测试
|
|
|
|
+// transformToLIst(result.value) // 测试
|
|
|
|
+
|
|
|
|
+const result = ref({})
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
-transformToLIst(result.value)
|
|
|
|
-// const handleAnalysis = async (url) => {
|
|
|
|
-// url = decodeURIComponent(url)
|
|
|
|
-// if (!url) return
|
|
|
|
-// showSelect.value = false
|
|
|
|
-// loading.value = true
|
|
|
|
-// // const baseUrl = envObj.previewUrl
|
|
|
|
-// // fileUrl.value = !url.includes('.pdf') ? `${baseUrl}/onlinePreview?url=${encodeURIComponent(Base64.encode(url))}` : url
|
|
|
|
-// try {
|
|
|
|
-// const data = await resumeParser2({ fileUrl: url })
|
|
|
|
-// result.value = data || {}
|
|
|
|
-// await transformToLIst(result.value)
|
|
|
|
-// } catch (error) {
|
|
|
|
-// console.log(error)
|
|
|
|
-// } finally {
|
|
|
|
-// loading.value = false
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+const handleAnalysis = async (url) => {
|
|
|
|
+ url = decodeURIComponent(url)
|
|
|
|
+ if (!url) return
|
|
|
|
+ loading.value = true
|
|
|
|
+ step.value = 3
|
|
|
|
+ // const baseUrl = envObj.previewUrl
|
|
|
|
+ // fileUrl.value = !url.includes('.pdf') ? `${baseUrl}/onlinePreview?url=${encodeURIComponent(Base64.encode(url))}` : url
|
|
|
|
+ try {
|
|
|
|
+ const res = await resumeParser2({ fileUrl: url })
|
|
|
|
+ result.value = res?.data || {}
|
|
|
|
+ await transformToLIst(result.value)
|
|
|
|
+ step.value = 2
|
|
|
|
+ } catch (error) {
|
|
|
|
+ step.value = 4
|
|
|
|
+ console.log(error)
|
|
|
|
+ } finally {
|
|
|
|
+ loading.value = false
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const handleResumeAnalysis = (url) => {
|
|
|
|
+ if (!url) {
|
|
|
|
+ return uni.showToast({ icon: 'none', title: '请选择要解析的简历' })
|
|
|
|
+ }
|
|
|
|
+ handleAnalysis(url)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const componentRef = ref()
|
|
|
|
+const getValue = async () => {
|
|
|
|
+ let id = ''
|
|
|
|
+ let data = {}
|
|
|
|
+ for (let index = 0; index < componentRef.value.length; index++) {
|
|
|
|
+ const e = componentRef.value[index]
|
|
|
|
+ const query = await e.submit()
|
|
|
|
+ if (query && query.data) {
|
|
|
|
+ data[query.id] = query.data
|
|
|
|
+ } else {
|
|
|
|
+ id = id ? id : query.id
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log('id:', id)
|
|
|
|
+ if (id) {
|
|
|
|
+ uni.showToast({ icon: 'none', title: '请填写完整后提交!' })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 处理data
|
|
|
|
+ let obj = Object.keys(data).length ? {} : null
|
|
|
|
+ const keyTransform = { // 转换给后端的key
|
|
|
|
+ eduList: 'eduExp',
|
|
|
|
+ workList: 'workExp',
|
|
|
|
+ trainList: 'trainExp',
|
|
|
|
+ }
|
|
|
|
+ if (obj) {
|
|
|
|
+ Object.keys(data).forEach(key => {
|
|
|
|
+ if (key.includes('_')) { // 数组
|
|
|
|
+ const oldKey = key.split('_')[0]
|
|
|
|
+ const newKey = keyTransform[oldKey] ? keyTransform[oldKey] : oldKey
|
|
|
|
+ if (!obj[newKey]) obj[newKey] = [data[key]]
|
|
|
|
+ else obj[newKey].push(data[key])
|
|
|
|
+ } else {
|
|
|
|
+ const newKey = keyTransform[key] ? keyTransform[key] : key
|
|
|
|
+ obj[newKey] = data[key]
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ console.log('123456:', obj)
|
|
|
|
+ return obj && Object.keys(obj).length ? JSON.stringify(obj) : null
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const submitLoading = ref(false)
|
|
|
|
+const submit = async () => {
|
|
|
|
+ const obj = await getValue()
|
|
|
|
+ if (!obj) return
|
|
|
|
+ submitLoading.value = true
|
|
|
|
+ await saveResumeInfo(obj)
|
|
|
|
+ dialogType = 'submitSuccess'
|
|
|
|
+ dialogContent.value = '提交成功,立即前往在线简历查看'
|
|
|
|
+ showClose.value = false
|
|
|
|
+ confirmRef.value.open()
|
|
|
|
+ // await useUserStore().getUserBaseInfos() // 更新用户信息
|
|
|
|
+}
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.tips {
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin-top: 50px;
|
|
|
|
+ color: #777;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|