index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="center">
  3. <!-- <view class="cl"></view> -->
  4. <view class="carousel-section">
  5. <swiper class="carousel" autoplay="true" interval="5000" duration="400" @change="swiperChange">
  6. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"><image :src="item.pic" /></swiper-item>
  7. </swiper>
  8. </view>
  9. <view class="navBox">
  10. <view class="navBox-item" @click="nav('/pages/course/course')">
  11. <image class="bg1" src="../../static/img/indexMycourse.png"></image>
  12. <view class="font">我的课程</view>
  13. </view>
  14. <view class="navBox-item" @click="nav('/pages/course/courseWan')">
  15. <image class="bg2" src="../../static/img/indexKcpj.png"></image>
  16. <view class="font">课程评价</view>
  17. </view>
  18. <view class="navBox-item" @click="nav('/pages/leave/leaveClass')">
  19. <image class="bg3" src="../../static/img/indexQjsp.png" mode=""></image>
  20. <view class="font">请假审批</view>
  21. </view>
  22. <view class="navBox-item" @click="nav('/pages/problem/problem')">
  23. <image class="bg4" src="../../static/img/indexWtfq.png" mode="aspectFill"></image>
  24. <view class="font">问题反馈</view>
  25. </view>
  26. </view>
  27. <!-- <view class="title">教育资讯</view>
  28. <scroll-view scroll-y="true" class="listBox">
  29. <view v-for="(item, index) in dataList" :key="index" class="list" @click="navto(item)">
  30. <view class="img"><image :src="item.image_input[0]" mode=""></image></view>
  31. <view class="right">
  32. <view class="r-title">{{ item.title }}</view>
  33. <view class="time">{{ item.add_time }}</view>
  34. </view>
  35. </view>
  36. </scroll-view> -->
  37. </view>
  38. </template>
  39. <script>
  40. import { banner,category } from '@/api/index.js';
  41. export default {
  42. data() {
  43. return {
  44. swiperCurrent: 0,
  45. carouselList: [{
  46. pic:'../../static/img/banner.png',
  47. }],
  48. dataList: []
  49. };
  50. },
  51. onLoad() {
  52. this.loadData();
  53. },
  54. methods: {
  55. nav(url) {
  56. uni.navigateTo({
  57. url: url
  58. });
  59. },
  60. navto(e){
  61. uni.navigateTo({
  62. url:'/pages/index/message?id=' + e.id
  63. })
  64. },
  65. async loadData() {
  66. const obj = this;
  67. banner({}).then(e => {
  68. obj.carouselList = obj.carouselList.concat(e.data.banner);
  69. console.log(obj.carouselList)
  70. });
  71. category({page:1,limit: 1000},2).then(({data}) => {
  72. console.log(data)
  73. obj.dataList = data
  74. });
  75. },
  76. swiperChange(e) {
  77. const index = e.detail.current;
  78. this.swiperCurrent = index;
  79. }
  80. }
  81. };
  82. </script>
  83. <style lang="scss">
  84. .center {
  85. background: #FFFFFF;
  86. height: 100%;
  87. }
  88. .cl {
  89. height: 44px;
  90. }
  91. .carousel-section {
  92. margin: 0 auto;
  93. width: 90%;
  94. height: 280rpx;
  95. border-radius: 20rpx;
  96. image {
  97. border-radius: 20rpx;
  98. height: 100%;
  99. width: 100%;
  100. }
  101. // width: 100%;
  102. // height: 320rpx;
  103. // border-radius: 24rpx;
  104. // .titleNview-placing {
  105. // height: var(--status-bar-height);
  106. // padding-top: 44px;
  107. // box-sizing: content-box;
  108. // }
  109. // .carousel {
  110. // width: 92%;
  111. // height: 240rpx;
  112. // .carousel-item {
  113. // width: 100%;
  114. // height: 100%;
  115. // }
  116. // image {
  117. // width: 100%;
  118. // height: 100%;
  119. // border-radius: $border-radius-sm;
  120. // }
  121. // }
  122. }
  123. .bg1 {
  124. width: 70rpx;
  125. height: 60rpx;
  126. }
  127. .bg2 {
  128. width: 62rpx;
  129. height: 66rpx;
  130. }
  131. .bg3 {
  132. width: 78rpx;
  133. height: 70rpx;
  134. }
  135. .bg4 {
  136. width: 60rpx;
  137. height: 62rpx;
  138. }
  139. .navBox {
  140. display: flex;
  141. align-items: center;
  142. .navBox-item {
  143. text-align: center;
  144. margin-top: 100rpx;
  145. flex: 1;
  146. .font {
  147. font-size: 24rpx;
  148. font-family: PingFang SC;
  149. font-weight: 500;
  150. color: #69717b;
  151. }
  152. }
  153. }
  154. .title {
  155. margin-top: 60rpx;
  156. padding-left: 32rpx;
  157. font-size: 36rpx;
  158. font-family: PingFang SC;
  159. font-weight: bold;
  160. color: #24272c;
  161. }
  162. .listBox {
  163. margin-top: 28rpx;
  164. }
  165. .list {
  166. margin-bottom: 50rpx;
  167. padding-left: 34rpx;
  168. padding-right: 40rpx;
  169. display: flex;
  170. .img {
  171. background-color: #ffffff;
  172. width: 200rpx;
  173. height: 160rpx;
  174. flex-shrink: 0;
  175. image {
  176. width: 100%;
  177. height: 100%;
  178. }
  179. }
  180. .right {
  181. text-align: left;
  182. width: 100%;
  183. padding-left: 20rpx;
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: space-between;
  187. .r-title {
  188. font-size: 32rpx;
  189. font-weight: 400;
  190. color: #333333;
  191. }
  192. .time {
  193. font-size: 26rpx;
  194. font-weight: 400;
  195. color: #999999;
  196. }
  197. }
  198. }
  199. </style>