zhengyiming
3 天以前 4b5a4c322d5a777f2715e1574ab3ef7cbcf14d6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
  <PageLayoutWithBg class="flexJobDetail-page-wrapper" title="灵工详情" :need-auth="false">
    <LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
      <JobDetailContent
        :avatar="userResumeInfo.avatar"
        :name="userResumeInfo.name"
        :age="userResumeInfo.age"
        :isReal="userResumeInfo.isReal"
        :gender="userResumeInfo.gender"
        :personalIdentityContent="userResumeInfo.personalIdentityContent"
        :educationalBackgroundContent="userResumeInfo.educationalBackgroundContent"
        :taskCount="userResumeInfo.taskCount"
        :contactPhoneNumber="userResumeInfo.contactPhoneNumber"
        :identity="userResumeInfo.identity"
        :isCollapse="isCollapse"
        :userId="userId"
      >
        <template #footer>
          <PageFooterAction
            :icon="IconShare"
            text="分享"
            :isFlex="false"
            openType="share"
          ></PageFooterAction>
          <PageFooterAction
            :icon="IconAttentionActive"
            text="收藏"
            :isFlex="false"
            @click="handleAttention"
          ></PageFooterAction>
          <PageFooterBtn type="primary" @click="handleContact">立即联系</PageFooterBtn>
        </template>
      </JobDetailContent>
    </LoadingLayout>
  </PageLayoutWithBg>
</template>
 
<script setup lang="ts">
import Taro from '@tarojs/taro';
import { useQuery } from '@tanstack/vue-query';
import * as userResumeServices from '@12333/services/apiV2/userResume';
import IconShare from '@/assets/flexJob/icon-share.png';
import IconAttention from '@/assets/flexJob/icon-attention-lg.png';
import IconAttentionActive from '@/assets/flexJob/icon-attention-lg-active.png';
import { useToggle } from 'senin-mini/hooks';
import { Message } from '@12333/utils';
import { useUserResume } from '@12333/hooks';
import { useAccessLogin } from '@/hooks';
 
defineOptions({
  name: 'flexJobDetail',
});
 
const router = Taro.useRouter();
const userId = router.params?.id ?? '';
 
const { isLoading, isError, userResumeInfo, refetch } = useUserResume({
  userId,
});
 
const { isCollapse, toggle } = useToggle();
 
const handleContact = useAccessLogin(async () => {
  try {
    if (!isCollapse.value) {
      await userResumeServices.contactUserResume({ id: userId });
      toggle();
    }
  } catch (error) {}
});
 
async function handleAttention() {
  try {
    let params: API.CollectUserResumeCommand = {
      id: userId,
      // isCollected: userResumeInfo.value.i,
    };
    let res = await userResumeServices.collectUserResume(params);
    if (res) {
      Message.success('收藏成功');
    }
  } catch (error) {}
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
</style>