detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <view class="container">
  3. <scroll-view scroll-y class="scroll-body">
  4. <!-- 头部卡片 -->
  5. <view class="header-card">
  6. <view class="title-row">
  7. <text class="title">{{ job.title }}</text>
  8. <text class="salary">{{ job.salaryText }}</text>
  9. </view>
  10. <view class="urgent-tag-wrap" v-if="job.isUrgent">
  11. <text class="urgent-tag">急招</text>
  12. </view>
  13. <view class="meta-info">
  14. <view class="meta-item">
  15. <image src="/static/icons/location.svg" class="meta-icon" mode="aspectFit"></image>
  16. <text>{{ job.location }}</text>
  17. </view>
  18. <view class="meta-item">
  19. <image src="/static/icons/user.svg" class="meta-icon" mode="aspectFit"></image>
  20. <text>招录 {{ job.count }} 人</text>
  21. </view>
  22. <view class="meta-item">
  23. <image src="/static/icons/time.svg" class="meta-icon" mode="aspectFit"></image>
  24. <text>截止:{{ job.deadline }}</text>
  25. <text class="danger-text" v-if="job.isExpiring"> 即将截止</text>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 企业/招聘官信息 -->
  30. <view class="hr-section">
  31. <image src="https://img.js.design/assets/smartFill/img341164da0af508.png" class="hr-avatar" mode="aspectFill"></image>
  32. <view class="hr-info">
  33. <view class="hr-name-row">
  34. <text class="hr-name">丁先生</text>
  35. <text class="hr-tag">招聘中</text>
  36. </view>
  37. <text class="hr-company">{{ job.company }} · 人事负责人</text>
  38. </view>
  39. <image src="/static/icons/verified.svg" class="verified-icon" mode="aspectFit"></image>
  40. </view>
  41. <!-- 岗位详情 -->
  42. <view class="detail-section">
  43. <view class="section-title">岗位详情</view>
  44. <view class="tags-cloud">
  45. <text class="tag-item" v-for="(tag, index) in job.tags" :key="index">{{ tag }}</text>
  46. <text class="tag-item">内部审计</text>
  47. <text class="tag-item">风险控制</text>
  48. </view>
  49. <view class="description-block">
  50. <text class="sub-title">职位描述:</text>
  51. <text class="content-text">
  52. 我们需要一位经验丰富的审计师加入我们的团队。您将负责执行复杂的财务和运营审计,识别流程改进机会,并向高级管理层提供战略建议。
  53. </text>
  54. </view>
  55. <view class="description-block">
  56. <text class="sub-title">任职要求:</text>
  57. <view class="requirement-list">
  58. <view class="req-item" v-for="(req, index) in requirements" :key="index">
  59. <view class="dot"></view>
  60. <text class="req-text">{{ req }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="description-block">
  65. <text class="sub-title">福利待遇:</text>
  66. <view class="requirement-list">
  67. <view class="req-item">
  68. <view class="dot"></view>
  69. <text class="req-text">提供行业领先的薪资水平;</text>
  70. </view>
  71. <view class="req-item">
  72. <view class="dot"></view>
  73. <text class="req-text">完善的五险一金及其它补充福利;</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="bottom-placeholder"></view>
  79. </scroll-view>
  80. <!-- 底部操作栏 -->
  81. <view class="action-bar">
  82. <view class="action-left" @click="handleCollect">
  83. <view class="icon-btn">
  84. <image :src="isCollected ? '/static/icons/star_filled.svg' : '/static/icons/star_hollow.svg'" class="btn-icon" mode="aspectFit"></image>
  85. <text>{{ isCollected ? '已收藏' : '收藏' }}</text>
  86. </view>
  87. </view>
  88. <view
  89. class="main-btn"
  90. :class="[jobState]"
  91. @click="handleMainAction"
  92. >
  93. <text>{{ btnText }}</text>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script setup lang="js">
  99. import { ref, computed, onMounted } from 'vue';
  100. import { onShow } from '@dcloudio/uni-app';
  101. import { createOrGetSession } from '../../api/message.js';
  102. const isCollected = ref(false);
  103. // 岗位状态: 'initial', 'paid', 'assessed', 'added'
  104. const jobState = ref('initial');
  105. const btnText = computed(() => {
  106. switch (jobState.value) {
  107. case 'initial': return '咨询';
  108. case 'paid': return '开始测评';
  109. case 'assessed': return '加入意向岗位';
  110. case 'added': return '已加入意向岗位';
  111. default: return '咨询';
  112. }
  113. });
  114. const job = ref({
  115. id: 0,
  116. title: '高级审计师',
  117. salaryText: '13K-23K',
  118. location: '上海市·黄浦区',
  119. count: 1,
  120. deadline: '2025-12-12 24:00',
  121. isUrgent: true,
  122. isExpiring: true,
  123. company: '华财仁合',
  124. tags: ['全职', '五险一金', '本科', 'CPA']
  125. });
  126. const requirements = ref([
  127. '具备3年以上知名会计师事务所工作经验优先;',
  128. '精通财务审计准则及相关法律法规;',
  129. '出色的沟通表达能力与项目管理能力。'
  130. ]);
  131. onShow(() => {
  132. // 检查是否已支付 (由 chat 页面设置)
  133. const isPaid = uni.getStorageSync('job_0_paid') || uni.getStorageSync(`audit_paid_pos_${job.value?.id || 0}`);
  134. if (isPaid) {
  135. if (jobState.value === 'initial') {
  136. jobState.value = 'paid';
  137. }
  138. }
  139. // 检查持久化状态
  140. const savedState = uni.getStorageSync('job_0_state');
  141. if (savedState) {
  142. jobState.value = savedState;
  143. }
  144. });
  145. const handleMainAction = async () => {
  146. if (jobState.value === 'initial') {
  147. try {
  148. uni.showLoading({ title: '正在连接客服...' });
  149. const userInfo = uni.getStorageSync('userInfo') || {};
  150. const userId = userInfo.studentId || null;
  151. const userName = userInfo.name || '用户';
  152. const userAvatar = userInfo.avatarUrl || '/static/images/user_avatar.png';
  153. const res = await createOrGetSession({
  154. sessionType: 1,
  155. fromUserId: userId,
  156. fromUserName: userName,
  157. fromUserAvatar: userAvatar,
  158. sourceId: 'job_' + (job.value?.id || '')
  159. });
  160. uni.hideLoading();
  161. if (res.data) {
  162. const session = res.data;
  163. uni.navigateTo({
  164. url: `/pages/chat/chat?sessionId=${session.sessionId}&sessionNo=${session.sessionNo || ''}&fromUserId=${userId || ''}&userName=${encodeURIComponent(userName)}&type=job&positionId=${job.value?.id || 0}`
  165. });
  166. } else {
  167. uni.showToast({ title: '创建会话失败', icon: 'none' });
  168. }
  169. } catch (err) {
  170. uni.hideLoading();
  171. console.error('创建会话失败:', err);
  172. uni.showToast({ title: '连接失败,请重试', icon: 'none' });
  173. }
  174. } else if (jobState.value === 'paid') {
  175. uni.showLoading({ title: '加载测评中...' });
  176. setTimeout(() => {
  177. uni.hideLoading();
  178. uni.showModal({
  179. title: '测评通过',
  180. content: '恭喜您完成测评并合格!',
  181. showCancel: false,
  182. success: () => {
  183. updateState('assessed');
  184. }
  185. });
  186. }, 1500);
  187. } else if (jobState.value === 'assessed') {
  188. uni.showLoading({ title: '加入中...' });
  189. setTimeout(() => {
  190. uni.hideLoading();
  191. uni.showToast({ title: '加入成功', icon: 'success' });
  192. updateState('added');
  193. }, 1000);
  194. }
  195. };
  196. const updateState = (state) => {
  197. jobState.value = state;
  198. uni.setStorageSync('job_0_state', state);
  199. };
  200. const handleCollect = () => {
  201. isCollected.value = !isCollected.value;
  202. uni.showToast({
  203. title: isCollected.value ? '收藏成功' : '已取消收藏',
  204. icon: 'none'
  205. });
  206. };
  207. </script>
  208. <style lang="scss" scoped>
  209. .container {
  210. width: 100%;
  211. height: 100vh;
  212. background-color: #F8F9FB;
  213. display: flex;
  214. flex-direction: column;
  215. }
  216. .scroll-body {
  217. flex: 1;
  218. }
  219. .header-card {
  220. background-color: #FFFFFF;
  221. padding: 40rpx 30rpx;
  222. margin-bottom: 20rpx;
  223. .title-row {
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. margin-bottom: 20rpx;
  228. .title {
  229. font-size: 42rpx;
  230. font-weight: bold;
  231. color: #1A1A1A;
  232. }
  233. .salary {
  234. font-size: 38rpx;
  235. font-weight: bold;
  236. color: #1F6CFF;
  237. }
  238. }
  239. .urgent-tag-wrap {
  240. margin-bottom: 24rpx;
  241. .urgent-tag {
  242. background: #FFF2F0;
  243. color: #FF4D4F;
  244. font-size: 22rpx;
  245. padding: 4rpx 16rpx;
  246. border-radius: 6rpx;
  247. }
  248. }
  249. .meta-info {
  250. display: flex;
  251. flex-wrap: wrap;
  252. gap: 24rpx;
  253. .meta-item {
  254. display: flex;
  255. align-items: center;
  256. font-size: 26rpx;
  257. color: #999999;
  258. .meta-icon {
  259. width: 28rpx;
  260. height: 28rpx;
  261. margin-right: 8rpx;
  262. }
  263. .danger-text {
  264. color: #FF4D4F;
  265. margin-left: 8rpx;
  266. }
  267. }
  268. }
  269. }
  270. .hr-section {
  271. background-color: #FFFFFF;
  272. padding: 30rpx;
  273. display: flex;
  274. align-items: center;
  275. margin-bottom: 20rpx;
  276. .hr-avatar {
  277. width: 90rpx;
  278. height: 90rpx;
  279. border-radius: 50%;
  280. margin-right: 20rpx;
  281. background-color: #f0f0f0;
  282. }
  283. .hr-info {
  284. flex: 1;
  285. .hr-name-row {
  286. display: flex;
  287. align-items: center;
  288. margin-bottom: 6rpx;
  289. .hr-name {
  290. font-size: 30rpx;
  291. font-weight: bold;
  292. color: #333;
  293. margin-right: 12rpx;
  294. }
  295. .hr-tag {
  296. font-size: 20rpx;
  297. color: #FFFFFF;
  298. background: #1F6CFF;
  299. padding: 2rpx 10rpx;
  300. border-radius: 4rpx;
  301. }
  302. }
  303. .hr-company {
  304. font-size: 24rpx;
  305. color: #999;
  306. }
  307. }
  308. .verified-icon {
  309. width: 32rpx;
  310. height: 32rpx;
  311. }
  312. }
  313. .detail-section {
  314. background-color: #FFFFFF;
  315. padding: 40rpx 30rpx;
  316. .section-title {
  317. font-size: 32rpx;
  318. font-weight: bold;
  319. color: #1A1A1A;
  320. margin-bottom: 24rpx;
  321. border-left: 8rpx solid #1F6CFF;
  322. padding-left: 20rpx;
  323. }
  324. .tags-cloud {
  325. display: flex;
  326. flex-wrap: wrap;
  327. gap: 16rpx;
  328. margin-bottom: 30rpx;
  329. .tag-item {
  330. background: #F0F2F5;
  331. color: #777777;
  332. font-size: 24rpx;
  333. padding: 8rpx 20rpx;
  334. border-radius: 6rpx;
  335. }
  336. }
  337. .description-block {
  338. margin-bottom: 36rpx;
  339. .sub-title {
  340. font-size: 28rpx;
  341. font-weight: bold;
  342. color: #444444;
  343. margin-bottom: 12rpx;
  344. display: block;
  345. }
  346. .content-text {
  347. font-size: 28rpx;
  348. color: #666666;
  349. line-height: 1.6;
  350. }
  351. .requirement-list {
  352. .req-item {
  353. display: flex;
  354. align-items: flex-start;
  355. margin-bottom: 10rpx;
  356. .dot {
  357. width: 8rpx;
  358. height: 8rpx;
  359. background: #1F6CFF;
  360. border-radius: 50%;
  361. margin-top: 15rpx;
  362. margin-right: 16rpx;
  363. flex-shrink: 0;
  364. }
  365. .req-text {
  366. font-size: 28rpx;
  367. color: #666666;
  368. line-height: 1.5;
  369. }
  370. }
  371. }
  372. }
  373. }
  374. .bottom-placeholder {
  375. height: 140rpx;
  376. }
  377. .action-bar {
  378. position: fixed;
  379. left: 0;
  380. right: 0;
  381. bottom: 0;
  382. height: 110rpx;
  383. background-color: #FFFFFF;
  384. display: flex;
  385. align-items: center;
  386. padding: 0 40rpx;
  387. padding-bottom: env(safe-area-inset-bottom);
  388. box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.05);
  389. .action-left {
  390. margin-right: 40rpx;
  391. .icon-btn {
  392. display: flex;
  393. flex-direction: column;
  394. align-items: center;
  395. .btn-icon {
  396. width: 40rpx;
  397. height: 40rpx;
  398. margin-bottom: 4rpx;
  399. }
  400. text {
  401. font-size: 20rpx;
  402. color: #999;
  403. }
  404. }
  405. }
  406. .main-btn {
  407. flex: 1;
  408. height: 80rpx;
  409. background: #FFB800; // 默认黄色 (咨询/开始测评)
  410. border-radius: 100rpx;
  411. display: flex;
  412. align-items: center;
  413. justify-content: center;
  414. transition: all 0.3s;
  415. text {
  416. color: #FFFFFF;
  417. font-size: 28rpx;
  418. font-weight: bold;
  419. }
  420. &.initial, &.paid {
  421. background: #FFB800;
  422. }
  423. &.assessed {
  424. background: #1F6CFF; // 测评合格后变为蓝色
  425. }
  426. &.added {
  427. background: #E0E0E0; // 已加入后禁用灰色
  428. pointer-events: none;
  429. text {
  430. color: #999;
  431. }
  432. }
  433. }
  434. }
  435. </style>