index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="pages">
  3. <view class="" :style="{height: navHeight+'px' }"></view>
  4. <u-swiper
  5. :list="bannerList"
  6. indicator
  7. height="300"
  8. :circular="true"
  9. keyName="sliderImg"
  10. indicatorMode="dot"
  11. @click="bannerClick"
  12. ></u-swiper>
  13. <view class="page-wrap">
  14. <view class="icon-nav u-flex u-row-around">
  15. <!-- <view class="nav-item" @click="$u.route('/center/mybalance')">
  16. <u--image class="image" :src="staticUrl+'/img/index-nav-4.png'" width="101rpx" height="101rpx"></u--image>
  17. 需要删除
  18. </view> -->
  19. <view class="nav-item" @click="$u.route('/examination/typelist')">
  20. <u--image class="image" src="../../static/img/index-nav-1.png" width="101rpx" height="101rpx"></u--image>
  21. 题库
  22. </view>
  23. <view class="nav-item" @click="$u.route('/study/studylist')">
  24. <u--image class="image" src="../../static/img/index-nav-2.png" width="101rpx" height="101rpx"></u--image>
  25. 安全学习
  26. </view>
  27. <view class="nav-item" @click="$u.route('/shopping/supermarket')">
  28. <u--image class="image" src="../../static/img/index-nav-3.png" width="101rpx" height="101rpx"></u--image>
  29. 云超市
  30. </view>
  31. <view class="nav-item" @click="$u.route('/pages/about/about')">
  32. <u--image class="image" src="../../static/img/index-nav-4.png" width="101rpx" height="101rpx"></u--image>
  33. 关于我们
  34. </view>
  35. </view>
  36. <view class="hot-product">
  37. <view class="single-til u-flex u-row-between">
  38. <text class="text">学习资料</text>
  39. <view class="u-flex" @click="$u.route('/study/studylist')">
  40. <text class="more-text">更多</text>
  41. <u-icon name="arrow-right" color="#676767" size="24rpx"></u-icon>
  42. </view>
  43. </view>
  44. <view class="course u-flex u-col-top" v-for="(item,index) in courseList" :key="item.id" @click="$u.route('/study/studydetails',{id:item.id})">
  45. <view class="pic">
  46. <u--image mode="scaleToFill" width="180rpx" height="170rpx" radius="10rpx" :showLoading="true" class="image" :src="item.mainImg"></u--image>
  47. </view>
  48. <view class="text">
  49. <view class="title ellipsis-2">
  50. <text class="new" v-if="index<9">最新</text>
  51. {{item.title}}
  52. </view>
  53. <view class="classify">
  54. <!-- <text class="classify-item">测试</text> -->
  55. </view>
  56. <view class="studyUserNum">
  57. {{item.studyUserNum}}人已学习
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <tabbar :tabbarIndexProps='0' />
  63. </view>
  64. <u-toast ref="uToast"></u-toast>
  65. </view>
  66. </template>
  67. <script>
  68. import { systemInfo } from "@/mixin.js";
  69. import tabbar from "../../components/tabbar.vue";
  70. export default {
  71. components:{
  72. tabbar,
  73. },
  74. mixins:[systemInfo],
  75. data() {
  76. return {
  77. staticUrl:this.$commonConfig.staticUrl,
  78. advantageSize:14,
  79. bannerList: [],
  80. courseList:[],
  81. xsIntro:{},
  82. indexData:{},
  83. }
  84. },
  85. onLoad() {
  86. // let userInfo = uni.getStorageSync('userInfo');
  87. // console.log('userInfo',userInfo);
  88. let that = this;
  89. this.swiperList();
  90. this.getSystemInfo();
  91. // console.log('statusBarHeight',this.statusBarHeight);
  92. // console.log('navigationBarHeight',this.navigationBarHeight);
  93. // console.log('windowHeight',this.windowHeight);
  94. // console.log('navHeight',this.navHeight);
  95. },
  96. onShow() {
  97. this.getStudyLib();
  98. },
  99. methods: {
  100. swiperList(){
  101. this.$u.api.swiperList({postion:1}).then(res=>{
  102. this.bannerList = res.data.rows;
  103. // console.log('res',res.data.rows);
  104. }).catch(err=>{
  105. console.log('swiperList',err.data);
  106. })
  107. },
  108. bannerClick(e){
  109. console.log('e',e);
  110. // console.log('bannerClick',this.bannerList[e]);
  111. let item = this.bannerList[e];
  112. uni.$u.route('/pages/news/newsdetails', {
  113. type: 'swiperDetail',
  114. id: item.id
  115. });
  116. },
  117. getStudyLib(){
  118. this.$u.api.studyLib({pageNum:1,pageSize:10}).then(res=>{
  119. this.courseList = res.data.rows;
  120. // console.log('res',res);
  121. }).catch(err=>{
  122. console.log('getHotGoods',err.data);
  123. })
  124. }
  125. }
  126. }
  127. </script>
  128. <style>
  129. page{
  130. background-color: #fff;
  131. padding-top: 0;
  132. }
  133. </style>
  134. <style lang="scss" scoped>
  135. .page-bg{
  136. .img{
  137. height: 100vh;
  138. }
  139. }
  140. .icon-nav{
  141. margin: 50rpx auto;
  142. }
  143. .product{
  144. background-color: #F5F5F5;
  145. border-bottom: 0;
  146. .btn{
  147. padding: 14rpx 40rpx;
  148. background: linear-gradient(90deg, #00D17D 0%, #00A447 100%);
  149. color: #fff;
  150. position: relative;
  151. right: -20rpx;
  152. border-top-left-radius: 50rpx;
  153. border-bottom-left-radius: 50rpx;
  154. }
  155. }
  156. </style>