Xiao_123 пре 7 месеци
родитељ
комит
58a2133428

+ 8 - 0
src/api/recruit/personal/resume/index.js

@@ -213,4 +213,12 @@ export const updatePersonAvatar = async (url) => {
   return await request.post({
     url: `/app-api/menduner/system/person/resume/avatar/update?avatar=${url}`
   })
+}
+
+// 修改个人画像
+export const savePersonPortrait = async (data) => {
+  return await request.post({
+    url: '/app-api/menduner/system/person/resume/tag/update',
+    data
+  })
 }

+ 1 - 1
src/layout/personal/navBar.vue

@@ -7,7 +7,7 @@
     >
       <div class="innerBox d-flex justify-space-between">
         <div>
-          <div class="nav-logo mr-5 mt-1 cursor-pointer" @click="router.push('/')">
+          <div class="nav-logo mr-5 mt-1 cursor-pointer" @click="router.push('/recruitHome')">
             <v-img src="../../assets/logo.png"  aspect-ratio="16/9" cover :width="90" style="height: 40px"></v-img>
           </div>
           <!-- <div class="nav-city">

+ 3 - 3
src/views/recruit/personal/PersonalCenter/resume/online/components/basicInfo.vue

@@ -97,9 +97,9 @@
               </div>
             </div>
           </div>
+          <!-- 个人画像 -->
           <div class="mt-4 ml-50">
-            <span style="font-size: 15px;">个人画像:</span>
-            <v-chip size="small" label v-for="(k, i) in welfareList.slice(0, 8)" :key="i" class="mr-2" color="primary">{{ k }}</v-chip>
+            <portrait></portrait>
           </div>
         </div>
       </div>
@@ -122,6 +122,7 @@ import { useUserStore } from '@/store/user'
 import { uploadFile } from '@/api/common'
 import { getUserAvatar } from '@/utils/avatar'
 import { useI18n } from '@/hooks/web/useI18n'
+import portrait from './portrait.vue'
 import { ref } from 'vue';
 defineOptions({name: 'resume-components-basicInfo'})
 const emit = defineEmits(['complete'])
@@ -132,7 +133,6 @@ const CtFormRef = ref()
 const isEdit = ref(false)
 const showIcon = ref(false)
 const overlay = ref(false) // 加载中
-const welfareList = ref(['响应', '改变', '诚信', '进取精神', '信任', '卓越'])
 let baseInfo = ref({})
 let userInfo = ref({})
 const getBasicInfo = () => { // 获取基础信息

+ 130 - 0
src/views/recruit/personal/PersonalCenter/resume/online/components/portrait.vue

@@ -0,0 +1,130 @@
+<template>
+  <div>
+    <span>个人画像:</span>
+    <v-chip size="small" label v-for="(k, i) in list" :key="i" class="mr-2 mb-2" color="primary" closable @click:close="handleDelete(k)">{{ k }}</v-chip>
+    <v-btn icon="mdi-plus" variant="outlined" color="primary" size="small" @click="handleAdd"></v-btn>
+  </div>
+
+  <CtDialog
+    :visible="visible"
+    titleClass="text-h6"
+    title="个人画像标签选择"
+    :footer="true"
+    @close="handleCancel"
+    @submit="handleSubmit"
+  >
+    <div>已选中标签:</div>
+      <div v-if="select.length">
+        <v-chip v-for="(item, index) in select" :key="index" class="chip mr-2 mt-4" label color="#ea8d03">
+          {{ item }}
+          <v-icon size="18" color="#ea8d03" style="margin-left: 6px;" @click="handleCancelSelect(item)">mdi-close-circle</v-icon>
+        </v-chip>
+    </div>
+    <v-divider class="my-5"></v-divider>
+    <div v-for="val in tagList" :key="val.id" class="mb-8">
+      <span style="font-size: 16px;">{{ val?.nameCn || '--' }}</span>
+      <div v-if="val?.children?.length">
+        <v-chip 
+          v-for="k in val.children" 
+          :key="k.id"
+          class="mx-2 mt-4 cursor-pointer"
+          :text="k.nameCn"
+          variant="outlined"
+          color="primary"
+          :value="k.id"
+          label
+          :disabled="select.includes(k.nameCn)"
+          @click="handleSelect(k.nameCn)"
+        >
+          <v-icon icon="mdi-plus" start></v-icon>
+          {{ k?.nameCn || '--' }}
+        </v-chip>
+      </div>
+    </div>
+  </CtDialog>
+
+  <Loading :visible="loading"></Loading>
+</template>
+
+<script setup>
+// 逻辑思维能力
+defineOptions({ name: 'person-portrait'})
+import { ref } from 'vue'
+import { getTagTreeDataApi } from '@/api/enterprise'
+import { useUserStore } from '@/store/user'
+import { savePersonPortrait } from '@/api/recruit/personal/resume'
+import Snackbar from '@/plugins/snackbar'
+import cloneDeep from 'lodash/cloneDeep'
+
+const loading = ref(false)
+const visible = ref(false)
+const user = useUserStore()
+const baseInfo = ref(JSON.parse(localStorage.getItem('baseInfo')) || {})
+const list = ref(baseInfo.value?.tagList || [])
+const select = ref([])
+const tagList = ref([])
+
+user.$subscribe((mutation, state) => {
+  if (Object.keys(state.baseInfo).length) {
+    baseInfo.value = state.baseInfo
+    list.value = baseInfo.value?.tagList || []
+  }
+})
+
+// 获取标签字典数据
+const getTagList = async () => {
+  const data = await getTagTreeDataApi({ type: 0 })
+  tagList.value = data || []
+}
+getTagList()
+
+const handleAdd = () => {
+  visible.value = true
+  select.value = cloneDeep(list.value)
+}
+
+// 选择
+const handleSelect = (nameCn) => {
+  const result = select.value.includes(nameCn)
+  if (!result) return select.value.push(nameCn)
+  else select.value = select.value.filter(e => e !== nameCn)
+}
+
+const handleCancelSelect = (nameCn) => {
+  select.value = select.value.filter(e => e !== nameCn)
+}
+
+// 删除标签
+const handleDelete = async (k) => {
+  loading.value = true
+  try {
+    list.value = list.value.filter(e => e !== k)
+    await savePersonPortrait({ tagList: list.value })
+    await user.getUserBaseInfos()
+  } finally {
+    loading.value = false
+    Snackbar.success('删除成功')
+  }
+}
+
+// 取消
+const handleCancel = () => {
+  visible.value = false
+}
+// 提交
+const handleSubmit = async () => {
+  loading.value = true
+  try {
+    await savePersonPortrait({ tagList: select.value })
+    Snackbar.success('保存成功')
+    await user.getUserBaseInfos()
+  } finally {
+    loading.value = false
+    visible.value = false
+  }
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>