hot-profession.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="px-40 pb-40">
  3. <view class="bg-title bg-white p-40">
  4. <image class="" src="/static/ie/entry/bg-ai-tab2.png" mode="heightFix"/>
  5. </view>
  6. <view class="fx-col gap-40">
  7. <view class="rounded-lg p-10 bg-blue-100" v-for="u in professionData" :key="u.universityName">
  8. <view class="pl-10 pt-10 pb-20 text-primary-deep">{{ u.universityName }}</view>
  9. <view class="rounded-lg bg-white pt-40 pb-40">
  10. <uv-cell-group :border="false">
  11. <uv-cell v-for="(p, idx) in u.hotList" :key="idx" :border="false" isLink
  12. :right-icon-style="{color:'var(--primary-color)'}" @click="goMajorDetail(p)">
  13. <template #title>
  14. <view class="fx-row gap-20">
  15. <text class="mr-20" :class="{ 'is-highlight': idx < 3 }">{{ idx + 1 }}</text>
  16. <view class="flex-1 fx-col">
  17. <text>{{ p.name }}</text>
  18. <text class="text-primary-light text-2xs">{{ p.majorDirection }}</text>
  19. </view>
  20. </view>
  21. </template>
  22. <template #value>
  23. <text class="text-primary">详情</text>
  24. </template>
  25. </uv-cell>
  26. </uv-cell-group>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import {useInjectTransfer} from "@/hooks/useTransfer";
  34. export default {
  35. name: 'hot-profession',
  36. setup() {
  37. const {prevData, transferTo} = useInjectTransfer()
  38. return {
  39. prevData,
  40. transferTo
  41. }
  42. },
  43. computed: {
  44. professionData() {
  45. return this.prevData.details?.map(u => ({
  46. universityName: u.university?.name,
  47. hotList: u.professions?.filter(p => p.hot).filter((_, i) => i < 5)
  48. })) || []
  49. }
  50. },
  51. methods: {
  52. goMajorDetail(major) {
  53. this.transferTo('/pages/major-library/detail/detail', ['code'], major)
  54. }
  55. }
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. .bg-title {
  60. position: sticky;
  61. top: 44px;
  62. z-index: 1;
  63. text-align: center;
  64. image {
  65. height: 36rpx;
  66. }
  67. }
  68. .is-highlight {
  69. color: #f9422a;
  70. }
  71. </style>