detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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. if (uni.getStorageSync('job_0_paid')) {
  134. if (jobState.value === 'initial') {
  135. jobState.value = 'paid';
  136. }
  137. }
  138. // 检查持久化状态
  139. const savedState = uni.getStorageSync('job_0_state');
  140. if (savedState) {
  141. jobState.value = savedState;
  142. }
  143. });
  144. const handleMainAction = async () => {
  145. if (jobState.value === 'initial') {
  146. try {
  147. uni.showLoading({ title: '正在连接客服...' });
  148. const userInfo = uni.getStorageSync('userInfo') || {};
  149. const userId = userInfo.studentId || null;
  150. const userName = userInfo.name || '用户';
  151. const userAvatar = userInfo.avatarUrl || '/static/images/user_avatar.png';
  152. const res = await createOrGetSession({
  153. sessionType: 1,
  154. fromUserId: userId,
  155. fromUserName: userName,
  156. fromUserAvatar: userAvatar,
  157. sourceId: 'job_' + (job.value?.id || '')
  158. });
  159. uni.hideLoading();
  160. if (res.data) {
  161. const session = res.data;
  162. uni.navigateTo({
  163. url: `/pages/chat/chat?sessionId=${session.sessionId}&sessionNo=${session.sessionNo || ''}&fromUserId=${userId || ''}&userName=${encodeURIComponent(userName)}`
  164. });
  165. } else {
  166. uni.showToast({ title: '创建会话失败', icon: 'none' });
  167. }
  168. } catch (err) {
  169. uni.hideLoading();
  170. console.error('创建会话失败:', err);
  171. uni.showToast({ title: '连接失败,请重试', icon: 'none' });
  172. }
  173. } else if (jobState.value === 'paid') {
  174. uni.showLoading({ title: '加载测评中...' });
  175. setTimeout(() => {
  176. uni.hideLoading();
  177. uni.showModal({
  178. title: '测评通过',
  179. content: '恭喜您完成测评并合格!',
  180. showCancel: false,
  181. success: () => {
  182. updateState('assessed');
  183. }
  184. });
  185. }, 1500);
  186. } else if (jobState.value === 'assessed') {
  187. uni.showLoading({ title: '加入中...' });
  188. setTimeout(() => {
  189. uni.hideLoading();
  190. uni.showToast({ title: '加入成功', icon: 'success' });
  191. updateState('added');
  192. }, 1000);
  193. }
  194. };
  195. const updateState = (state) => {
  196. jobState.value = state;
  197. uni.setStorageSync('job_0_state', state);
  198. };
  199. const handleCollect = () => {
  200. isCollected.value = !isCollected.value;
  201. uni.showToast({
  202. title: isCollected.value ? '收藏成功' : '已取消收藏',
  203. icon: 'none'
  204. });
  205. };
  206. </script>
  207. <style lang="scss" scoped>
  208. .container {
  209. width: 100%;
  210. height: 100vh;
  211. background-color: #F8F9FB;
  212. display: flex;
  213. flex-direction: column;
  214. }
  215. .scroll-body {
  216. flex: 1;
  217. }
  218. .header-card {
  219. background-color: #FFFFFF;
  220. padding: 40rpx 30rpx;
  221. margin-bottom: 20rpx;
  222. .title-row {
  223. display: flex;
  224. justify-content: space-between;
  225. align-items: center;
  226. margin-bottom: 20rpx;
  227. .title {
  228. font-size: 42rpx;
  229. font-weight: bold;
  230. color: #1A1A1A;
  231. }
  232. .salary {
  233. font-size: 38rpx;
  234. font-weight: bold;
  235. color: #1F6CFF;
  236. }
  237. }
  238. .urgent-tag-wrap {
  239. margin-bottom: 24rpx;
  240. .urgent-tag {
  241. background: #FFF2F0;
  242. color: #FF4D4F;
  243. font-size: 22rpx;
  244. padding: 4rpx 16rpx;
  245. border-radius: 6rpx;
  246. }
  247. }
  248. .meta-info {
  249. display: flex;
  250. flex-wrap: wrap;
  251. gap: 24rpx;
  252. .meta-item {
  253. display: flex;
  254. align-items: center;
  255. font-size: 26rpx;
  256. color: #999999;
  257. .meta-icon {
  258. width: 28rpx;
  259. height: 28rpx;
  260. margin-right: 8rpx;
  261. }
  262. .danger-text {
  263. color: #FF4D4F;
  264. margin-left: 8rpx;
  265. }
  266. }
  267. }
  268. }
  269. .hr-section {
  270. background-color: #FFFFFF;
  271. padding: 30rpx;
  272. display: flex;
  273. align-items: center;
  274. margin-bottom: 20rpx;
  275. .hr-avatar {
  276. width: 90rpx;
  277. height: 90rpx;
  278. border-radius: 50%;
  279. margin-right: 20rpx;
  280. background-color: #f0f0f0;
  281. }
  282. .hr-info {
  283. flex: 1;
  284. .hr-name-row {
  285. display: flex;
  286. align-items: center;
  287. margin-bottom: 6rpx;
  288. .hr-name {
  289. font-size: 30rpx;
  290. font-weight: bold;
  291. color: #333;
  292. margin-right: 12rpx;
  293. }
  294. .hr-tag {
  295. font-size: 20rpx;
  296. color: #FFFFFF;
  297. background: #1F6CFF;
  298. padding: 2rpx 10rpx;
  299. border-radius: 4rpx;
  300. }
  301. }
  302. .hr-company {
  303. font-size: 24rpx;
  304. color: #999;
  305. }
  306. }
  307. .verified-icon {
  308. width: 32rpx;
  309. height: 32rpx;
  310. }
  311. }
  312. .detail-section {
  313. background-color: #FFFFFF;
  314. padding: 40rpx 30rpx;
  315. .section-title {
  316. font-size: 32rpx;
  317. font-weight: bold;
  318. color: #1A1A1A;
  319. margin-bottom: 24rpx;
  320. border-left: 8rpx solid #1F6CFF;
  321. padding-left: 20rpx;
  322. }
  323. .tags-cloud {
  324. display: flex;
  325. flex-wrap: wrap;
  326. gap: 16rpx;
  327. margin-bottom: 30rpx;
  328. .tag-item {
  329. background: #F0F2F5;
  330. color: #777777;
  331. font-size: 24rpx;
  332. padding: 8rpx 20rpx;
  333. border-radius: 6rpx;
  334. }
  335. }
  336. .description-block {
  337. margin-bottom: 36rpx;
  338. .sub-title {
  339. font-size: 28rpx;
  340. font-weight: bold;
  341. color: #444444;
  342. margin-bottom: 12rpx;
  343. display: block;
  344. }
  345. .content-text {
  346. font-size: 28rpx;
  347. color: #666666;
  348. line-height: 1.6;
  349. }
  350. .requirement-list {
  351. .req-item {
  352. display: flex;
  353. align-items: flex-start;
  354. margin-bottom: 10rpx;
  355. .dot {
  356. width: 8rpx;
  357. height: 8rpx;
  358. background: #1F6CFF;
  359. border-radius: 50%;
  360. margin-top: 15rpx;
  361. margin-right: 16rpx;
  362. flex-shrink: 0;
  363. }
  364. .req-text {
  365. font-size: 28rpx;
  366. color: #666666;
  367. line-height: 1.5;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. .bottom-placeholder {
  374. height: 140rpx;
  375. }
  376. .action-bar {
  377. position: fixed;
  378. left: 0;
  379. right: 0;
  380. bottom: 0;
  381. height: 110rpx;
  382. background-color: #FFFFFF;
  383. display: flex;
  384. align-items: center;
  385. padding: 0 40rpx;
  386. padding-bottom: env(safe-area-inset-bottom);
  387. box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.05);
  388. .action-left {
  389. margin-right: 40rpx;
  390. .icon-btn {
  391. display: flex;
  392. flex-direction: column;
  393. align-items: center;
  394. .btn-icon {
  395. width: 40rpx;
  396. height: 40rpx;
  397. margin-bottom: 4rpx;
  398. }
  399. text {
  400. font-size: 20rpx;
  401. color: #999;
  402. }
  403. }
  404. }
  405. .main-btn {
  406. flex: 1;
  407. height: 80rpx;
  408. background: #FFB800; // 默认黄色 (咨询/开始测评)
  409. border-radius: 100rpx;
  410. display: flex;
  411. align-items: center;
  412. justify-content: center;
  413. transition: all 0.3s;
  414. text {
  415. color: #FFFFFF;
  416. font-size: 28rpx;
  417. font-weight: bold;
  418. }
  419. &.initial, &.paid {
  420. background: #FFB800;
  421. }
  422. &.assessed {
  423. background: #1F6CFF; // 测评合格后变为蓝色
  424. }
  425. &.added {
  426. background: #E0E0E0; // 已加入后禁用灰色
  427. pointer-events: none;
  428. text {
  429. color: #999;
  430. }
  431. }
  432. }
  433. }
  434. </style>