index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="dljt-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. <MtaTabBar></MtaTabBar>
  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 MtaTabBar from "@/components/MtaTabBar/MtaTabBar.vue";
  62. import MtaFooter from "@/components/MtaFooter.vue"
  63. import default2 from '@/static/images/common/news-bj2.png'
  64. const banners = ref('');
  65. const data = reactive({
  66. xinwen: [],
  67. xinwenTotal: 0,
  68. gonggao: [],
  69. gonggaoTotal: 0,
  70. xiaowu: [],
  71. xiaowuTotal: 0,
  72. isGonggao: true,
  73. })
  74. onLoad(() => {
  75. pageInit();
  76. })
  77. function handleClickXinwen() {}
  78. function getXiaowuGengduo() {}
  79. function handleClickXiaowu() {}
  80. function getXinwenGengduo() {}
  81. function handleXinwenGengDuo() {}
  82. function handleBannerSelect(item) {
  83. if (item.url) {
  84. window.location.href = item.url;
  85. }
  86. }
  87. function changeGonggao() {
  88. if (this.isGonggao) {
  89. return true
  90. }
  91. data.isGonggao = true;
  92. getGonggao()
  93. }
  94. function changeXiaowu() {
  95. if (!this.isGonggao) {
  96. return true
  97. }
  98. data.isGonggao = false;
  99. getXiaowu()
  100. }
  101. function getGonggao() {
  102. httpApi.getCommonXinwenTongzhiList().then(res => {
  103. data.gonggao = res.data.data;
  104. data.gonggaoTotal = res.data.total;
  105. })
  106. }
  107. function getXiaowu() {
  108. httpApi.getCommonXinwenXiaowuList().then(res => {
  109. data.xiaowu = res.data.data;
  110. data.xiaowuTotal = res.data.total;
  111. })
  112. }
  113. function pageInit() {
  114. Promise.all([
  115. httpApi.getCommonBanners({
  116. size: 1000
  117. }),
  118. httpApi.getCommonXinwenYuanxiaoList({
  119. page: 1,
  120. size: 3
  121. }),
  122. httpApi.getCommonXinwenTongzhiList({
  123. page: 1,
  124. size: 5
  125. }),
  126. httpApi.getCommonXinwenXiaowuList({
  127. page: 1,
  128. size: 5
  129. })
  130. ]).then(([res1, res2, res3, res4]) => {
  131. banners.value = res1.data.data;
  132. data.xinwen = res2.data.data;
  133. data.xinwenTotal = res2.data.total;
  134. data.gonggao = res3.data.data;
  135. data.gonggaoTotal = res3.data.total;
  136. data.xiaowu = res4.data.data;
  137. data.xiaowuTotal = res4.data.total;
  138. })
  139. }
  140. </script>
  141. <style lang="scss">
  142. </style>