profession-analysis.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="px-40 pb-40">
  3. <view class="bg-title bg-white p-40">
  4. <image src="/static/ie/entry/bg-ai-tab1.png" mode="heightFix"/>
  5. </view>
  6. <view class="fx-col gap-40">
  7. <view v-for="u in analysisData" :key="u.universityName">
  8. <view class="text-sm text-main mb-15">{{ u.universityName }}</view>
  9. <table class="table w-full mx-border text-2xs text-content">
  10. <tr>
  11. <th>专业名称</th>
  12. <th>{{ u.year }}年录取分</th>
  13. </tr>
  14. <tr v-for="(m,i) in u.majorDetails" :key="i">
  15. <td>
  16. <view>{{ m.majorName }}</view>
  17. <view v-if="m.majorDirection">({{ m.majorDirection }})</view>
  18. </td>
  19. <td>{{ m.history && m.history.score || '?' }}分</td>
  20. </tr>
  21. </table>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {useInjectTransfer} from "@/hooks/useTransfer";
  28. export default {
  29. name: 'profession-analysis',
  30. setup() {
  31. const {prevData} = useInjectTransfer()
  32. return {
  33. prevData
  34. }
  35. },
  36. computed: {
  37. analysisData() {
  38. // 院校的专业分差数据
  39. const {year} = this.prevData
  40. return this.prevData.details?.map(u => ({
  41. year,
  42. universityName: u.university?.name,
  43. majorDetails: u.majorDetails?.map(m => ({
  44. majorName: m.majorName,
  45. majorDirection: m.majorDirection,
  46. history: m.histories?.find(h => h.year == year)
  47. })) || []
  48. }))
  49. }
  50. }
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. .bg-title {
  55. position: sticky;
  56. top: 44px;
  57. z-index: 1;
  58. text-align: center;
  59. image {
  60. height: 36rpx;
  61. }
  62. }
  63. .table {
  64. border-collapse: collapse;
  65. th {
  66. background-color: #FEF7DB;
  67. }
  68. th,
  69. td {
  70. border: 0.5px solid #F3F2F2;
  71. line-height: 50rpx;
  72. text-align: center;
  73. word-wrap: break-word; /* 允许单词被折行 */
  74. word-break: break-word; /* 如果超出宽度,允许强制断行 */
  75. }
  76. }
  77. </style>