index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="lli-index-page">
  3. <MtaNavbar></MtaNavbar>
  4. <view class="uni-margin-wrap">
  5. <swiper class="swiper" circular :indicator-dots="true" :autoplay="true" :interval="5000">
  6. <swiper-item v-for="item in banners" :key="item.id" @click="handleBannerSelect(item)">
  7. <image :src="item.pic"></image>
  8. </swiper-item>
  9. </swiper>
  10. </view>
  11. <view>
  12. <listTwoVue v-for="item in data.xinwen" :key="item.id" :data="item" @click.native="handleClickXinwen(item)"
  13. class=index-xinwen-box></listTwoVue>
  14. <view v-if="data.xinwenTotal>3" @click="handleXinwenGengDuo">更多</view>
  15. </view>
  16. <br />
  17. <view>
  18. <view>通知公告</view>
  19. <view v-for="item in data.gonggao" :key="item.id" @click="handleClickGonggao(item)">
  20. {{item}}
  21. </view>
  22. <view v-if="data.xiaowuTotal>5" @click="getXinwenGengduo">更多</view>
  23. </view>
  24. <br />
  25. <view>
  26. 校务: {{data.xiaowu}}
  27. <view>校务公开</view>
  28. <view v-for="item in data.xiaowu" :key="item.id" @click="handleClickXiaowu(item)(item)">
  29. {{item}}
  30. </view>
  31. <view v-if="data.xiaowuTotal>5" @click="getXiaowuGengduo">更多</view>
  32. </view>
  33. <!-- 招生就业 -->
  34. <view class="website-zsjy-title">
  35. <p>招生就业</p>
  36. </view>
  37. <view class="zsjy-box">
  38. <view class="wnlqfs-box" @click="goFun('wnlqfs')">
  39. <p>往年录取分数</p>
  40. </view>
  41. <view class="xqhz-box" @click="goFun('xwhz')">
  42. <p>校企合作</p>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script setup>
  48. import {
  49. ref,
  50. reactive
  51. } from "vue";
  52. import {
  53. onLoad
  54. } from "@dcloudio/uni-app"
  55. import * as httpApi from "@/api/common.js"
  56. import MtaNavbar from "@/components/MtaNavbar/MtaNavbar.vue";
  57. import listTwoVue from "@/components/MtaCard/listTwo.vue";
  58. const banners = ref('');
  59. const data = reactive({
  60. xinwen: [],
  61. xinwenTotal: 0,
  62. gonggao: [],
  63. gonggaoTotal: 0,
  64. xiaowu: [],
  65. xiaowuTotal: 0,
  66. isGonggao: true,
  67. })
  68. onLoad(() => {
  69. pageInit();
  70. })
  71. function getXiaowuGengduo() {}
  72. function handleClickXiaowu() {}
  73. function getXinwenGengduo() {}
  74. function handleXinwenGengDuo() {}
  75. function handleBannerSelect(item) {
  76. if (item.url) {
  77. window.location.href = item.url;
  78. }
  79. }
  80. function changeGonggao() {
  81. if (this.isGonggao) {
  82. return true
  83. }
  84. data.isGonggao = true;
  85. getGonggao()
  86. }
  87. function changeXiaowu() {
  88. if (!this.isGonggao) {
  89. return true
  90. }
  91. data.isGonggao = false;
  92. getXiaowu()
  93. }
  94. function getGonggao() {
  95. httpApi.getCommonXinwenTongzhiList().then(res => {
  96. data.gonggao = res.data.data;
  97. data.gonggaoTotal = res.data.total;
  98. })
  99. }
  100. function getXiaowu() {
  101. httpApi.getCommonXinwenXiaowuList().then(res => {
  102. data.xiaowu = res.data.data;
  103. data.xiaowuTotal = res.data.total;
  104. })
  105. }
  106. function pageInit() {
  107. Promise.all([
  108. httpApi.getCommonBanners({
  109. size: 1000
  110. }),
  111. httpApi.getCommonXinwenYuanxiaoList({
  112. page: 1,
  113. size: 3
  114. }),
  115. httpApi.getCommonXinwenTongzhiList({
  116. page: 1,
  117. size: 5
  118. }),
  119. httpApi.getCommonXinwenXiaowuList({
  120. page: 1,
  121. size: 5
  122. })
  123. ]).then(([res1, res2, res3, res4]) => {
  124. banners.value = res1.data.data;
  125. data.xinwen = res2.data.data;
  126. data.xinwenTotal = res2.data.total;
  127. data.gonggao = res3.data.data;
  128. data.gonggaoTotal = res3.data.total;
  129. data.xiaowu = res4.data.data;
  130. data.xiaowuTotal = res4.data.total;
  131. })
  132. }
  133. </script>
  134. <style lang="scss">
  135. </style>