index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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)">
  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. <MtaFooter></MtaFooter>
  46. <!-- 底部导航 -->
  47. <MtaTabBarVue></MtaTabBarVue>
  48. </view>
  49. </template>
  50. <script setup>
  51. import {
  52. ref,
  53. reactive
  54. } from "vue";
  55. import {
  56. onLoad
  57. } from "@dcloudio/uni-app"
  58. import * as httpApi from "@/api/common.js"
  59. import MtaNavbar from "@/components/MtaNavbar/MtaNavbar.vue";
  60. import listTwoVue from "@/components/MtaCard/listTwo.vue";
  61. import MtaTabBarVue from "@/components/MtaTabBar/MtaTabBar.vue";
  62. import MtaFooter from "@/components/MtaFooter.vue"
  63. const banners = ref('');
  64. const data = reactive({
  65. xinwen: [],
  66. xinwenTotal: 0,
  67. gonggao: [],
  68. gonggaoTotal: 0,
  69. xiaowu: [],
  70. xiaowuTotal: 0,
  71. isGonggao: true,
  72. })
  73. onLoad(() => {
  74. pageInit();
  75. })
  76. function handleClickXinwen() {}
  77. function getXiaowuGengduo() {}
  78. function handleClickXiaowu() {}
  79. function getXinwenGengduo() {}
  80. function handleXinwenGengDuo() {}
  81. function handleBannerSelect(item) {
  82. if (item.url) {
  83. window.location.href = item.url;
  84. }
  85. }
  86. function changeGonggao() {
  87. if (this.isGonggao) {
  88. return true
  89. }
  90. data.isGonggao = true;
  91. getGonggao()
  92. }
  93. function changeXiaowu() {
  94. if (!this.isGonggao) {
  95. return true
  96. }
  97. data.isGonggao = false;
  98. getXiaowu()
  99. }
  100. function getGonggao() {
  101. httpApi.getCommonXinwenTongzhiList().then(res => {
  102. data.gonggao = res.data.data;
  103. data.gonggaoTotal = res.data.total;
  104. })
  105. }
  106. function getXiaowu() {
  107. httpApi.getCommonXinwenXiaowuList().then(res => {
  108. data.xiaowu = res.data.data;
  109. data.xiaowuTotal = res.data.total;
  110. })
  111. }
  112. function pageInit() {
  113. Promise.all([
  114. httpApi.getCommonBanners({
  115. size: 1000
  116. }),
  117. httpApi.getCommonXinwenYuanxiaoList({
  118. page: 1,
  119. size: 3
  120. }),
  121. httpApi.getCommonXinwenTongzhiList({
  122. page: 1,
  123. size: 5
  124. }),
  125. httpApi.getCommonXinwenXiaowuList({
  126. page: 1,
  127. size: 5
  128. })
  129. ]).then(([res1, res2, res3, res4]) => {
  130. banners.value = res1.data.data;
  131. data.xinwen = res2.data.data;
  132. data.xinwenTotal = res2.data.total;
  133. data.gonggao = res3.data.data;
  134. data.gonggaoTotal = res3.data.total;
  135. data.xiaowu = res4.data.data;
  136. data.xiaowuTotal = res4.data.total;
  137. })
  138. }
  139. </script>
  140. <style lang="scss">
  141. </style>