index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="dljt-index-page">
  3. <MtaNavbar></MtaNavbar>
  4. <view class="index-swiper-box">
  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 class="index-content-box">
  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 class="index-more-btn" v-if="data.xinwenTotal>3">
  15. <text @click="handleXinwenGengDuo">更多</text>
  16. <icon @click="handleXinwenGengDuo"></icon>
  17. </view>
  18. </view>
  19. <view class="index-background-box">
  20. <view class="index-content-box">
  21. <view class="tab-item"><icon class="tzgg-icon"></icon><text>通知公告</text></view>
  22. <view class="index-list-item" v-for="item in data.gonggao" :key="item.id" @click="handleClickGonggao(item)">
  23. <view class="list-createTime">{{item.createTime}}</view>
  24. <view class="list-title">{{item.title}}</view>
  25. </view>
  26. <view class="index-more-btn more-btn-top" v-if="data.xiaowuTotal>5">
  27. <text @click="getTongzhigengduo">更多</text>
  28. <icon @click="getTongzhigengduo"></icon>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="index-background-box">
  33. <view class="index-content-box">
  34. <view class="tab-item"><icon class="xwgk-icon"></icon><text>校务公开</text></view>
  35. <view class="index-list-item" v-for="item in data.xiaowu" :key="item.id" @click="handleClickXiaowu(item)">
  36. <view class="list-createTime">{{item.createTime}}</view>
  37. <view class="list-title">{{item.title}}</view>
  38. </view>
  39. <view class="index-more-btn more-btn-top" v-if="data.xiaowuTotal>5">
  40. <text @click="getXiaowuGengduo">更多</text>
  41. <icon @click="getXiaowuGengduo"></icon></view>
  42. </view>
  43. </view>
  44. <!-- 招生就业 -->
  45. <view class="index-content-box zsjy-box">
  46. <view class="tab-item zsjy-tab-item"><icon class="zsjy-icon"></icon><text>招生就业</text></view>
  47. <view class="wnlqfs-box" @click="goFun('wnlqfs')">
  48. <view class="zsjy-text">往年录取分数</view>
  49. </view>
  50. <view class="xqhz-box" @click="goFun('xwhz')">
  51. <view class="zsjy-text">校企合作</view>
  52. </view>
  53. </view>
  54. <MtaFooter></MtaFooter>
  55. <!-- 底部导航 -->
  56. <!-- <MtaTabBar></MtaTabBar> -->
  57. </view>
  58. </template>
  59. <script setup>
  60. import {
  61. ref,
  62. reactive
  63. } from "vue";
  64. import {
  65. onLoad
  66. } from "@dcloudio/uni-app"
  67. import * as httpApi from "@/api/common.js"
  68. import MtaNavbar from "@/components/MtaNavbar/MtaNavbar.vue";
  69. import listTwoVue from "@/components/MtaCard/listTwo.vue";
  70. import MtaTabBar from "@/components/MtaTabBar/MtaTabBar.vue";
  71. import MtaFooter from "@/components/MtaFooter.vue"
  72. import default2 from '@/static/images/common/news-bj2.png'
  73. const banners = ref('');
  74. const data = reactive({
  75. xinwen: [],
  76. xinwenTotal: 0,
  77. gonggao: [],
  78. gonggaoTotal: 0,
  79. xiaowu: [],
  80. xiaowuTotal: 0,
  81. isGonggao: true,
  82. })
  83. onLoad(() => {
  84. pageInit();
  85. })
  86. function goFun(code) {
  87. if (code == 'wnlqfs') {
  88. uni.navigateTo({
  89. url: '/pages/zsjyWangnianluqufenshu/zsjyWangnianluqufenshu'
  90. })
  91. } else {
  92. uni.navigateTo({
  93. url: '/pages/zsjyXiaoqihezuo/zsjyXiaoqihezuo'
  94. })
  95. }
  96. }
  97. function handleClickXinwen(item) {
  98. uni.navigateTo({
  99. url:`/pages/xydtXueyuanxinwenInfo/xydtXueyuanxinwenInfo?id=${item.id}`
  100. })
  101. }
  102. function getXiaowuGengduo() {
  103. uni.navigateTo({
  104. url: `/pages/xydtXiaowugongkai/xydtXiaowugongkai`
  105. })
  106. }
  107. function handleClickGonggao(item) {
  108. uni.navigateTo({
  109. url:`/pages/xydtTongzhigonggaoInfo/xydtTongzhigonggaoInfo?id=${item.id}`
  110. })
  111. }
  112. function handleClickXiaowu(item) {
  113. uni.navigateTo({
  114. url: `/pages/xydtXiaowugongkaiInfo/xydtXiaowugongkaiInfo?id=${item.id}`
  115. })
  116. }
  117. function getTongzhigengduo() {
  118. uni.navigateTo({
  119. url: `/pages/xydtTongzhigonggao/xydtTongzhigonggao`
  120. })
  121. }
  122. function handleXinwenGengDuo() {
  123. uni.navigateTo({
  124. url: `/pages/xydtXueyuanxingwen/xydtXueyuanxingwen`
  125. })
  126. }
  127. function handleBannerSelect(item) {
  128. if (item.url) {
  129. window.location.href = item.url;
  130. }
  131. }
  132. function changeGonggao() {
  133. if (this.isGonggao) {
  134. return true
  135. }
  136. data.isGonggao = true;
  137. getGonggao()
  138. }
  139. function changeXiaowu() {
  140. if (!this.isGonggao) {
  141. return true
  142. }
  143. data.isGonggao = false;
  144. getXiaowu()
  145. }
  146. function getGonggao() {
  147. httpApi.getCommonXinwenTongzhiList().then(res => {
  148. data.gonggao = res.data.data;
  149. data.gonggaoTotal = res.data.total;
  150. })
  151. }
  152. function getXiaowu() {
  153. httpApi.getCommonXinwenXiaowuList().then(res => {
  154. data.xiaowu = res.data.data;
  155. data.xiaowuTotal = res.data.total;
  156. })
  157. }
  158. function pageInit() {
  159. Promise.all([
  160. httpApi.getCommonBanners({
  161. size: 1000
  162. }),
  163. httpApi.getCommonXinwenYuanxiaoList({
  164. page: 1,
  165. size: 3
  166. }),
  167. httpApi.getCommonXinwenTongzhiList({
  168. page: 1,
  169. size: 5
  170. }),
  171. httpApi.getCommonXinwenXiaowuList({
  172. page: 1,
  173. size: 5
  174. })
  175. ]).then(([res1, res2, res3, res4]) => {
  176. banners.value = res1.data.data;
  177. data.xinwen = res2.data.data;
  178. data.xinwenTotal = res2.data.total;
  179. data.gonggao = res3.data.data;
  180. data.gonggaoTotal = res3.data.total;
  181. data.xiaowu = res4.data.data;
  182. data.xiaowuTotal = res4.data.total;
  183. })
  184. }
  185. </script>
  186. <style lang="scss">
  187. </style>