college-major-result.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <num-common-card :num="model.num">
  3. <template #header>
  4. <college-item :item="detail.baseInfo" hidden-logo hidden-address/>
  5. </template>
  6. <view class="mx-40 my-10">
  7. <uv-line/>
  8. </view>
  9. <view class="mt-20 px-40 fx-col">
  10. <view v-for="([label, values],i) in groupedResults">
  11. <view class="text-primary mb-20">{{ label }}</view>
  12. <view class="fx-col gap-20">
  13. <view v-for="(m, idx) in values" class="px-20 fx-row fx-bet-cen" @click="goMajorReport(m)">
  14. <view class="fx-col">
  15. <view class="fx-row text-sm text-main">
  16. <text style="width: 55px">专业{{ ' ' + (idx + 1) }}</text>
  17. <view class="fx-col">
  18. <text>{{ m.majorName }}</text>
  19. <text v-if="m.majorDirection" class="text-primary-light text-4xs">
  20. {{ m.majorDirection }}
  21. </text>
  22. </view>
  23. </view>
  24. <view class="text-2xs font-light mt-5">录取概率
  25. <text class="text-primary ml-10">{{ m.enrollRate || '-' }}%</text>
  26. </view>
  27. </view>
  28. <view>
  29. <uv-text size="12" type="primary" text="查看" class="keep-all" suffix-icon="eye"
  30. :icon-style="{color:'var(--primary-color)'}"/>
  31. </view>
  32. </view>
  33. </view>
  34. <uv-divider v-if="i<groupedResults.length-1"/>
  35. </view>
  36. </view>
  37. <uv-gap height="12"/>
  38. </num-common-card>
  39. </template>
  40. <script>
  41. import _ from 'lodash';
  42. import NumCommonCard from "@/pages/ie/entry-analysis/components/num-common-card.vue";
  43. import CollegeItem from "@/pages/college-library/components/college-item.vue";
  44. import {useTransfer} from "@/hooks/useTransfer";
  45. import {useCacheStore} from "@/hooks/useCacheStore";
  46. import {universityDetail} from "@/api/webApi/collegemajor";
  47. export default {
  48. name: "college-major-result",
  49. components: {CollegeItem, NumCommonCard},
  50. props: {
  51. model: {
  52. type: Object,
  53. default: () => ({num: 0, code: '', majorCodes: []})
  54. },
  55. results: {
  56. type: Array,
  57. default: () => []
  58. }
  59. },
  60. data() {
  61. return {
  62. detail: {
  63. baseInfo: {},
  64. professions: []
  65. }
  66. }
  67. },
  68. computed: {
  69. groupedResults() {
  70. return Object.entries(_.groupBy(this.results, m => m.majorGroup))
  71. }
  72. },
  73. setup() {
  74. const {transferTo} = useTransfer()
  75. const {dispatchCache} = useCacheStore()
  76. return {
  77. transferTo,
  78. dispatchCache
  79. }
  80. },
  81. mounted() {
  82. this.loadDetail()
  83. },
  84. methods: {
  85. async loadDetail() {
  86. const payload = {code: this.model.code}
  87. const res = await this.dispatchCache(universityDetail, payload)
  88. this.detail = res.data
  89. },
  90. goMajorReport(single) {
  91. const path = '/pages/ie/entry-analysis/analysis-major-detail'
  92. this.transferTo(path, single, null, true)
  93. }
  94. }
  95. }
  96. </script>
  97. <style scoped>
  98. </style>