Hanye官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JobCard.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div
  3. class="job-card group cursor-pointer"
  4. @click="handleClick"
  5. >
  6. <div class="relative p-8 bg-zinc-800/30 backdrop-blur-sm border border-zinc-700/30 rounded-2xl transition-all duration-700 hover:border-[#35F1FF]/50 hover:bg-zinc-800/50 hover:shadow-2xl hover:shadow-[#35F1FF]/10 hover:transform hover:scale-105">
  7. <!-- <div class="absolute inset-0 bg-gradient-to-br from-[#35F1FF]/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-700 rounded-2xl"></div>
  8. <div class="absolute -top-2 -right-2 w-4 h-4 bg-[#35F1FF]/20 rounded-full animate-ping group-hover:animate-pulse"></div> -->
  9. <div class="relative">
  10. <!-- 职位标题 -->
  11. <h4 class="text-white text-xl font-semibold mb-4 line-clamp-2 group-hover:text-[#35F1FF] transition-colors duration-500">
  12. {{ job.name }}
  13. </h4>
  14. <!-- 职位信息 -->
  15. <div class="flex flex-wrap items-center gap-6 text-zinc-400 text-sm mb-6">
  16. <span class="flex items-center">
  17. <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  18. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
  19. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
  20. </svg>
  21. {{ getLocationName(job.location) }}
  22. </span>
  23. <span class="flex items-center">
  24. <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  25. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2-2v2m8 0H8m8 0v2a2 2 0 002 2M8 6V4h8V6M8 6v2a2 2 0 002 2h4a2 2 0 002-2V6"></path>
  26. </svg>
  27. {{ getWorkType(job.webSite) }}
  28. </span>
  29. <span class="flex items-center">
  30. <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  31. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  32. </svg>
  33. {{ formatDate(job.createTime) }}
  34. </span>
  35. </div>
  36. <!-- 工作职责 -->
  37. <div class="mb-6">
  38. <h5 class="text-white text-sm font-medium mb-3 flex items-center">
  39. <svg class="w-4 h-4 mr-2 text-[#35F1FF]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  40. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
  41. </svg>
  42. {{ t('careers.PositionCard.job') }}
  43. </h5>
  44. <div class="text-zinc-300/80 text-sm leading-relaxed line-clamp-3">
  45. {{ formatJobDescription(job.jobResponsibilities) }}
  46. </div>
  47. </div>
  48. <!-- 薪资福利 -->
  49. <div class="mb-6">
  50. <h5 class="text-white text-sm font-medium mb-3 flex items-center">
  51. <svg class="w-4 h-4 mr-2 text-[#35F1FF]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  52. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1"></path>
  53. </svg>
  54. {{ t('careers.PositionCard.CB') }}
  55. </h5>
  56. <div class="text-zinc-300/80 text-sm leading-relaxed line-clamp-2">
  57. {{ formatBenefits(job.benefits) }}
  58. </div>
  59. </div>
  60. <!-- 工作时间 -->
  61. <div class="mb-6">
  62. <h5 class="text-white text-sm font-medium mb-3 flex items-center">
  63. <svg class="w-4 h-4 mr-2 text-[#35F1FF]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  64. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
  65. </svg>
  66. {{ t('careers.PositionCard.workingHours') }}
  67. </h5>
  68. <div class="text-zinc-300/80 text-sm leading-relaxed">
  69. {{ formatWorkTime(job.workTime) }}
  70. </div>
  71. </div>
  72. <!-- 申请按钮 -->
  73. <div class="flex justify-between items-center pt-4 border-t border-zinc-700/30">
  74. <div class="text-xs text-zinc-500">
  75. {{ formatDate(job.updateTime) }} {{ t('careers.PositionCard.update') }}
  76. </div>
  77. <button
  78. class="inline-flex items-center px-6 py-2 bg-[#35F1FF]/10 text-[#35F1FF] text-sm font-medium rounded-lg border border-[#35F1FF]/30 hover:bg-[#35F1FF]/20 hover:border-[#35F1FF]/50 transition-all duration-300 group-hover:scale-105"
  79. @click.stop="handleApply"
  80. >
  81. <span class="mr-2">{{ t('careers.PositionCard.JobDetails') }}</span>
  82. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  83. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3"></path>
  84. </svg>
  85. </button>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 投递邮箱弹窗 -->
  90. <div v-if="showApplyModal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm" @click="closeModal">
  91. <div class="relative bg-zinc-900/95 backdrop-blur-md border border-zinc-700/50 rounded-2xl p-8 max-w-md w-full mx-4 transform transition-all duration-300 scale-95 opacity-0"
  92. :class="{ 'scale-100 opacity-100': showApplyModal }"
  93. @click.stop>
  94. <div class="absolute inset-0 bg-gradient-to-br from-[#35F1FF]/10 to-transparent rounded-2xl"></div>
  95. <div class="relative">
  96. <!-- 关闭按钮 -->
  97. <button @click="closeModal" class="absolute -top-2 -right-2 w-8 h-8 bg-zinc-800/80 hover:bg-zinc-700/80 rounded-full flex items-center justify-center text-zinc-400 hover:text-white transition-colors">
  98. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  99. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
  100. </svg>
  101. </button>
  102. <!-- 标题 -->
  103. <div class="text-center mb-6">
  104. <div class="inline-flex items-center justify-center w-16 h-16 bg-[#35F1FF]/10 rounded-full mb-4">
  105. <svg class="w-8 h-8 text-[#35F1FF]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  106. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>
  107. </svg>
  108. </div>
  109. <h3 class="text-xl font-semibold text-white mb-2">{{ t('careers.jobs.button') }}</h3>
  110. <p class="text-zinc-400 text-sm">{{ t('contact.submit') }}</p>
  111. </div>
  112. <!-- 职位信息 -->
  113. <div class="bg-zinc-800/50 rounded-xl p-4 mb-6">
  114. <div class="text-sm text-zinc-400 mb-2">{{ t('careers.jobs.title') }}</div>
  115. <div class="text-white font-medium">{{ job.name }}</div>
  116. <div class="text-xs text-zinc-500 mt-1">ID: {{ job.id }}</div>
  117. </div>
  118. <!-- 邮箱信息 -->
  119. <div class="bg-zinc-800/50 rounded-xl p-4 mb-6">
  120. <div class="text-sm text-zinc-400 mb-2">{{ t('contact.email') }}</div>
  121. <div class="flex items-center justify-between">
  122. <div class="text-[#35F1FF] font-medium break-all">{{ job.email }}</div>
  123. <button @click="copyEmail" class="ml-3 px-3 py-1 bg-[#35F1FF]/10 text-[#35F1FF] text-xs rounded-lg hover:bg-[#35F1FF]/20 transition-colors flex-shrink-0">
  124. {{ copied ? t('common.copied') : t('common.copy') }}
  125. </button>
  126. </div>
  127. </div>
  128. <!-- 操作按钮 -->
  129. <div class="flex gap-3">
  130. <button @click="closeModal" class="flex-1 px-4 py-2 bg-zinc-800/80 text-zinc-300 rounded-lg hover:bg-zinc-700/80 transition-colors">
  131. {{ t('common.close') }}
  132. </button>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </template>
  139. <script setup lang="ts">
  140. import type { Job } from '~/data/jobs'
  141. import { locationMap, workTypeMap } from '~/data/jobs'
  142. import { useI18n } from 'vue-i18n'
  143. const { t } = useI18n()
  144. /**
  145. * 组件属性
  146. */
  147. interface Props {
  148. job: Job
  149. }
  150. const props = defineProps<Props>()
  151. /**
  152. * 组件事件
  153. */
  154. const emit = defineEmits<{
  155. click: [job: Job]
  156. }>()
  157. /**
  158. * 获取地点名称
  159. * @param location 地点编码
  160. * @returns 地点名称
  161. */
  162. const getLocationName = (location: number): string => {
  163. return locationMap[location] || 'Other'
  164. }
  165. /**
  166. * 获取工作类型
  167. * @param webSite 工作类型编码
  168. * @returns 工作类型
  169. */
  170. const getWorkType = (webSite: number): string => {
  171. // 假设 1 代表全职,其他值可以扩展
  172. return workTypeMap[webSite] || t('careers.workType.fullTime')
  173. }
  174. /**
  175. * 格式化日期
  176. * @param dateString 日期字符串
  177. * @returns 格式化后的日期
  178. */
  179. const formatDate = (dateString: string | undefined): string => {
  180. if (!dateString) return ''
  181. try {
  182. const date = new Date(dateString)
  183. return date.toLocaleDateString('zh-CN', {
  184. year: 'numeric',
  185. month: '2-digit',
  186. day: '2-digit'
  187. })
  188. } catch {
  189. return dateString
  190. }
  191. }
  192. /**
  193. * 格式化工作描述
  194. * @param description 工作描述
  195. * @returns 格式化后的描述
  196. */
  197. const formatJobDescription = (description: string): string => {
  198. if (!description) return ''
  199. // 将数字开头的项目转换为更易读的格式
  200. return description
  201. .replace(/(\d+\.)/g, '\n$1')
  202. .replace(/;/g, ';\n')
  203. .trim()
  204. .substring(0, 200) + (description.length > 200 ? '...' : '')
  205. }
  206. /**
  207. * 格式化福利待遇
  208. * @param benefits 福利待遇
  209. * @returns 格式化后的福利
  210. */
  211. const formatBenefits = (benefits: string): string => {
  212. if (!benefits) return ''
  213. return benefits
  214. .replace(/(\d+\.)/g, '\n$1')
  215. .trim()
  216. .substring(0, 100) + (benefits.length > 100 ? '...' : '')
  217. }
  218. /**
  219. * 格式化工作时间
  220. * @param workTime 工作时间
  221. * @returns 格式化后的工作时间
  222. */
  223. const formatWorkTime = (workTime: string): string => {
  224. if (!workTime) return ''
  225. return workTime
  226. .replace(/\\n/g, '\n')
  227. .replace(/(\d+\.)/g, '\n$1')
  228. .trim()
  229. }
  230. /**
  231. * 处理点击事件
  232. */
  233. const handleClick = () => {
  234. emit('click', props.job)
  235. }
  236. /**
  237. * 模态框状态
  238. */
  239. const showApplyModal = ref(false)
  240. const copied = ref(false)
  241. /**
  242. * 处理申请事件
  243. */
  244. const handleApply = () => {
  245. showApplyModal.value = true
  246. }
  247. /**
  248. * 关闭模态框
  249. */
  250. const closeModal = () => {
  251. showApplyModal.value = false
  252. copied.value = false
  253. }
  254. /**
  255. * 复制邮箱地址
  256. */
  257. const copyEmail = async () => {
  258. try {
  259. await navigator.clipboard.writeText(props.job.email)
  260. copied.value = true
  261. setTimeout(() => {
  262. copied.value = false
  263. }, 2000)
  264. } catch {
  265. // 降级处理:使用传统方式复制
  266. const textArea = document.createElement('textarea')
  267. textArea.value = props.job.email
  268. document.body.appendChild(textArea)
  269. textArea.select()
  270. document.execCommand('copy')
  271. document.body.removeChild(textArea)
  272. copied.value = true
  273. setTimeout(() => {
  274. copied.value = false
  275. }, 2000)
  276. }
  277. }
  278. </script>
  279. <style scoped>
  280. .line-clamp-2 {
  281. display: -webkit-box;
  282. -webkit-line-clamp: 2;
  283. -webkit-box-orient: vertical;
  284. overflow: hidden;
  285. }
  286. .line-clamp-3 {
  287. display: -webkit-box;
  288. -webkit-line-clamp: 3;
  289. -webkit-box-orient: vertical;
  290. overflow: hidden;
  291. }
  292. .job-card {
  293. opacity: 0;
  294. transform: translateY(20px);
  295. transition: opacity 0.8s ease, transform 0.8s ease;
  296. }
  297. .job-card.animate-in {
  298. opacity: 1;
  299. transform: translateY(0);
  300. }
  301. </style>