college-grouped-major.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <uv-cell v-for="[root, groups] in groupedMajors" :title="root.name"
  3. :value="`${groups.length}个专业`" is-link title-style="font-size:14px" class="-mx-20"
  4. @click="showGroups=groups,showRoot=root,$refs.popup.open()"/>
  5. <uv-popup ref="popup" mode="center" :safe-area-inset-bottom="false" close-on-click-overlay closeable round="12">
  6. <view style="width: 90vw">
  7. <view class="fx-row fx-cen-cen text-main text-lg h-[50px]">{{ showRoot.name }}</view>
  8. <view class="px-30 pb-30 fx-row flex-wrap gap-10">
  9. <college-major-tag v-for="m in showGroups" :major="m"/>
  10. </view>
  11. </view>
  12. </uv-popup>
  13. </template>
  14. <script>
  15. import CollegeMajorTag from "@/pages/college-library/components/college-major-tag.vue";
  16. import InjectAISingleDataMixin from "@/pages/ie/entry-single-result/components/InjectAISingleDataMixin";
  17. import {findTreeNode} from "@/utils/tree-helper";
  18. import {groupByObjectKey} from "@/utils";
  19. export default {
  20. name: "college-grouped-major",
  21. components: {CollegeMajorTag},
  22. mixins: [InjectAISingleDataMixin],
  23. data() {
  24. return {
  25. show: false,
  26. showGroups: [],
  27. showRoot: {}
  28. }
  29. },
  30. computed: {
  31. groupedMajors() {
  32. if (!this.detail.professions?.length) return {}
  33. if (!this.majorTree.length) return {}
  34. return groupByObjectKey(this.detail.professions,
  35. p => findTreeNode(this.majorTree, m => m.code == p.code).root)
  36. }
  37. }
  38. }
  39. </script>
  40. <style scoped>
  41. </style>