right.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div>
  3. <div class="accountBox d-flex mb-3 radius white-bgc flex-column">
  4. <div class="resume-header ml-3 mt-2">
  5. <div class="resume-title">{{ $t('points.wallet') }}</div>
  6. </div>
  7. <div class="d-flex" v-if="userAccount && Object.keys(userAccount).length">
  8. <div v-for="val in accountList" :key="val.title" class="accountItem cursor-pointer" @click="router.push({ path: '/recruit/personal/myWallet' })">
  9. <v-icon color="primary">{{ val.icon }}</v-icon>
  10. <div class="ml-1">
  11. <div v-if="val.key === 'balance'" class="title-text">{{ (userAccount[val.key] && userAccount[val.key] > 0 ? (userAccount[val.key] / 100.0).toFixed(2) : 0) + val.desc }}</div>
  12. <div v-else class="title-text">{{ (userAccount[val.key] || 0) + val.desc }}</div>
  13. <div class="tip-text">{{ val.title }}</div>
  14. </div>
  15. </div>
  16. </div>
  17. <div v-else class="text-center font-size-14 mb-3">
  18. 请先登录
  19. </div>
  20. </div>
  21. <div class="resume d-flex">
  22. <div v-for="val in resumeList" :key="val.title" class="topping white-bgc radius" @click="resumeClick(val)">
  23. <v-icon color="primary">{{ val.icon }}</v-icon>
  24. <div class="ml-1">
  25. <div class="title-text">{{ val.title }}</div>
  26. <div class="tip-text">{{ val.desc }}</div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="attachment white-bgc radius mt-3">
  31. <div>
  32. <span class="title">{{ $t('resume.attachmentResume') }}</span>
  33. <span class="upload--text cursor-pointer" @click="openFileInput">
  34. {{ $t('common.upload') }}
  35. <File ref="uploadFile" @success="handleUploadResume"></File>
  36. </span>
  37. </div>
  38. <span class="more-text">{{ $t('resume.uploadUpToFiveCopies') }}</span>
  39. <div v-if="attachmentList.length">
  40. <div class="d-flex attachment-item my-2" v-for="k in attachmentList" :key="k.id">
  41. <v-icon color="primary">mdi-file-account</v-icon>
  42. <div class="file-name ellipsis ml-2">{{ k.title }}</div>
  43. <!-- <v-icon class="cursor-pointer" color="primary" @click="previewFile(k.url)">mdi-eye-outline</v-icon>
  44. <v-icon class="cursor-pointer mx-2" color="primary" @click="handleDownload(k)">mdi-download-box-outline</v-icon>
  45. <v-icon class="cursor-pointer" color="error" @click="handleDelete(k)">mdi-trash-can-outline</v-icon> -->
  46. <span class="cursor-pointer color-primary" @click="previewFile(k.url)">预览</span>
  47. <span class="cursor-pointer mx-2 color-primary" @click="handleDownload(k)">下载</span>
  48. <span class="cursor-pointer color-error" @click="handleDelete(k)">删除</span>
  49. </div>
  50. </div>
  51. <div v-else class="more-text d-flex justify-center">暂无简历,请先上传</div>
  52. </div>
  53. <v-navigation-drawer
  54. v-model="showInterviewSchedule"
  55. style="height: 100vh; overflow: hidden;"
  56. temporary
  57. location="right"
  58. width="300"
  59. >
  60. <interviewSchedule :dataList="invitePageList" @handleMore="interviewScheduleMore()"></interviewSchedule>
  61. </v-navigation-drawer>
  62. </div>
  63. </template>
  64. <script setup>
  65. defineOptions({ name: 'personal-center-right'})
  66. import { ref } from 'vue'
  67. import { previewFile } from '@/utils'
  68. import { useRouter } from 'vue-router'
  69. import { useRoute } from 'vue-router'; const route = useRoute()
  70. import { getPersonResumeCv, savePersonResumeCv, deletePersonResumeCv } from '@/api/recruit/personal/resume'
  71. import { useI18n } from '@/hooks/web/useI18n'
  72. import { useUserStore } from '@/store/user'
  73. import Snackbar from '@/plugins/snackbar'
  74. import Confirm from '@/plugins/confirm'
  75. import interviewSchedule from './../components/interviewSchedule.vue'
  76. import { getUserInterviewInvitePage } from '@/api/recruit/personal/personalCenter'
  77. import { dealDictObjData } from '@/utils/position'
  78. const { t } = useI18n()
  79. const router = useRouter()
  80. const userStore = useUserStore()
  81. const accountList = [
  82. { icon: 'mdi-currency-cny', title: t('enterprise.account.accountBalances'), desc: t('unit.rmb'), key: 'balance' },
  83. { icon: 'mdi-octagram-outline', title: t('resume.goldCoins'), desc: t('unit.ge'), key: 'point' }
  84. ]
  85. let userAccount = ref(JSON.parse(localStorage.getItem('userAccount')) || {}) // 账户信息
  86. userStore.$subscribe((mutation, state) => {
  87. userAccount.value = state.userAccount || {}
  88. })
  89. const resumeList = ref([
  90. { name: 'refresh', icon: 'mdi-refresh', title: t('resume.refreshResume'), desc: t('resume.enhanceResumeActivity') },
  91. // { name: 'interview', icon: 'mdi-account-multiple-check-outline', title: t('resume.interviewSchedule'), desc: '' },
  92. { name: 'order', icon: 'mdi-clipboard-list-outline', title: '我的订单', desc: '交易订单' },
  93. ])
  94. const showInterviewSchedule = ref(false)
  95. const resumeClick = async (val) => {
  96. // if (val.name === 'interview') {
  97. // await getUserInterviewInvitePageList() // 获取最新数据
  98. // showInterviewSchedule.value = true
  99. // }
  100. if (val.name === 'order') router.push('/recruit/personal/tradeOrder')
  101. }
  102. // 获取附件
  103. const attachmentList = ref([])
  104. const getList = async () => {
  105. const data = await getPersonResumeCv()
  106. attachmentList.value = data
  107. }
  108. getList()
  109. // 选择文件
  110. const uploadFile = ref()
  111. const openFileInput = () => {
  112. if (attachmentList.value.length >= 5) return Snackbar.warning(t('resume.uploadFiveCopies'))
  113. uploadFile.value.trigger()
  114. }
  115. // 上传附件
  116. const handleUploadResume = async (url, title) => {
  117. if (!url || !title) return
  118. Snackbar.success(t('common.uploadSucMsg'))
  119. await savePersonResumeCv({ title, url })
  120. getList()
  121. }
  122. // 删除
  123. const handleDelete = ({ id }) => {
  124. Confirm(t('common.confirmTitle'), t('resume.deleteAttachment')).then(async () => {
  125. await deletePersonResumeCv(id)
  126. Snackbar.success(t('common.delMsg'))
  127. getList()
  128. })
  129. }
  130. const getBlob = (url) => {
  131. return new Promise(resolve => {
  132. const xhr = new XMLHttpRequest()
  133. xhr.open('GET', url, true)
  134. xhr.responseType = 'blob'
  135. xhr.onload = () => {
  136. if (xhr.status === 200) resolve(xhr.response)
  137. }
  138. xhr.send()
  139. })
  140. }
  141. const saveAs = (blob, filename) => {
  142. var link = document.createElement('a')
  143. link.href = window.URL.createObjectURL(blob)
  144. link.download = filename
  145. link.click()
  146. }
  147. // 下载附件
  148. const handleDownload = (k) => {
  149. getBlob(k.url).then(blob => {
  150. saveAs(blob, k.title)
  151. })
  152. }
  153. // 面试日程
  154. const invitePageList = ref([])
  155. const getUserInterviewInvitePageList = async () => {
  156. const res = await getUserInterviewInvitePage()
  157. invitePageList.value = res?.list.map(e => {
  158. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  159. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  160. return e
  161. }) || []
  162. // const interview = resumeList.value.find(f => f.name === 'interview')
  163. // if (interview) interview.desc = '有' + (res?.total || '0') + '个待面试'
  164. }
  165. // getUserInterviewInvitePageList()
  166. const interviewScheduleMore = () => {
  167. showInterviewSchedule.value = false
  168. const path = route.path
  169. router.push({ path, query: { showInterviewScheduleMore: true } })
  170. }
  171. </script>
  172. <style scoped lang="scss">
  173. .radius {
  174. border-radius: 8px;
  175. }
  176. .title {
  177. font-weight: 600;
  178. font-size: 17px;
  179. }
  180. .accountBox {
  181. width: 100%;
  182. .accountItem {
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. width: 50%;
  187. height: 80px;
  188. padding: 0 12px;
  189. .tip-text {
  190. font-size: 13px;
  191. color: var(--color-666);
  192. }
  193. .title-text {
  194. font-weight: 600;
  195. font-size: 18px;
  196. &:hover {
  197. color: var(--v-primary-base);
  198. }
  199. }
  200. }
  201. }
  202. .resume {
  203. width: 100%;
  204. .topping {
  205. display: flex;
  206. align-items: center;
  207. justify-content: center;
  208. width: 50%;
  209. height: 90px;
  210. padding: 12px;
  211. margin-right: 12px;
  212. cursor: pointer;
  213. &:nth-child(2n) {
  214. margin-right: 0;
  215. }
  216. .tip-text {
  217. font-size: 12px;
  218. color: var(--color-666);
  219. }
  220. .title-text {
  221. font-weight: 600;
  222. &:hover {
  223. color: var(--v-primary-base);
  224. }
  225. }
  226. }
  227. }
  228. .attachment {
  229. padding: 12px;
  230. .more-text {
  231. font-size: 12px;
  232. color: var(--color-666);
  233. margin-left: 4px;
  234. }
  235. .upload--text {
  236. float: right;
  237. color: var(--v-primary-base);
  238. font-size: 12px;
  239. }
  240. .last-update {
  241. font-size: 12px;
  242. color: var(--color-666);
  243. }
  244. .attachment-item {
  245. color: #555;
  246. font-size: 14px;
  247. .file-name {
  248. width: 219px;
  249. }
  250. }
  251. }
  252. </style>