Hanye官网
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

JobCard.vue 12KB

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