index.vue 4.4 KB

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