index.vue 4.4 KB

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