index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view>
  3. <u-navbar :is-back="false" title="选课中心" :border-bottom="false" title-color="#333333" back-icon-color="#ffffff">
  4. <view class="slot-wrap">
  5. <image src="/static/logo2.png" style="width: 178rpx;height: 31rpx;margin-left: 30rpx;"></image>
  6. </view>
  7. </u-navbar>
  8. <view>
  9. <view style="position: fixed;width: 100%;z-index: 999;background-color: #FFFFFF;">
  10. <u-line color="#D6D6DB" />
  11. <view style="display: flex;justify-content: space-between;height: 78rpx;line-height: 78rpx;padding: 0 30rpx;font-size: 32rpx;">
  12. <view style="color: #666666;">考前培训:建造师-二级</view>
  13. <view style="color: #007AFF;">重新选择</view>
  14. </view>
  15. <u-line color="#D6D6DB" />
  16. <view>
  17. <view style="width: 160px;margin: 0 auto;"><u-tabs :list="list" item-width="150" font-size="24" bar-width="110" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
  18. </view>
  19. <u-line color="#D6D6DB" />
  20. <view class="menuSel" v-show="current==0">
  21. <scroll-view class="r_sliper" scroll-x="true" >
  22. <view v-for="(item,index) in array" :key="index" style="margin-right: 20rpx;display:inline-block">
  23. <view :class="menuIndex==index?'r_t1':'r_t2'" @click="cMenu(index)">
  24. {{item}}
  25. </view>
  26. </view>
  27. </scroll-view>
  28. </view>
  29. <view class="menuSel" v-show="current==1">
  30. <scroll-view class="r_sliper" scroll-x="true" >
  31. <view v-for="(item,index) in array" :key="index" style="margin-right: 20rpx;display:inline-block">
  32. <view :class="menuIndex1==index?'r_t1':'r_t2'" @click="cMenu1(index)">
  33. {{item}}
  34. </view>
  35. </view>
  36. </scroll-view>
  37. </view>
  38. </view>
  39. <view v-show="current==0">
  40. <view class="listBox">
  41. <navigator url="/pages2/course/detail" v-for="(item,index) in list1" :key="index" >
  42. <view class="itemBox">
  43. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  44. <view style="display: flex;margin-top: 13rpx;">
  45. <view class="yearTag">{{item.year}}</view>
  46. <view class="titleTag">{{item.goodsName}}</view>
  47. </view>
  48. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  49. <view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  50. 共 <text class="blackFont">6</text> 科 <text class="blackFont">120</text> 节 <text class="blackFont">60</text> 学时</view>
  51. <view class="priceTag">¥ {{item.standPrice}}</view>
  52. </view>
  53. </view>
  54. </navigator>
  55. </view>
  56. </view>
  57. <view v-show="current==1">
  58. <view class="listBox">
  59. <navigator url="/pages2/bank/detail" v-for="(item,index) in list2" :key="index" >
  60. <view class="itemBox">
  61. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  62. <view style="display: flex;margin-top: 13rpx;">
  63. <view class="yearTag">{{item.year}}</view>
  64. <view class="titleTag">{{item.goodsName}}</view>
  65. </view>
  66. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  67. <view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  68. 共 <text class="blackFont">6</text> 张卷 <text class="blackFont">120</text>道题 </view>
  69. <view class="priceTag">¥ {{item.standPrice}}</view>
  70. </view>
  71. </view>
  72. </navigator>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import { mapGetters } from 'vuex';
  80. export default {
  81. components: {
  82. },
  83. data() {
  84. return {
  85. list:[
  86. {
  87. name: '网课'
  88. },
  89. {
  90. name: '题库通'
  91. }
  92. ],
  93. array:['全部','建设工程施工管理','机电全科','机电工程管理与实','机电全科','全科'],
  94. current:0,
  95. menuIndex:0,
  96. menuIndex1:0,
  97. paramList: [
  98. {
  99. pageNum: 1,
  100. pageSize: 10,
  101. total: 0,
  102. showStatus: 0,
  103. goodsType:1
  104. },
  105. {
  106. pageNum: 1,
  107. pageSize: 10,
  108. total: 0,
  109. showStatus: 0,
  110. goodsType:2
  111. }
  112. ],
  113. list1: [],
  114. list2: [],
  115. };
  116. },
  117. onPullDownRefresh(){
  118. let that = this
  119. this.initList();
  120. setTimeout(function(){
  121. uni.stopPullDownRefresh()
  122. },500)
  123. },
  124. onLoad(option) {
  125. this.initList();
  126. },
  127. methods: {
  128. initList() {
  129. this.paramList[0].pageNum = 1
  130. this.paramList[1].pageNum = 1
  131. this.list1 = []
  132. this.list2 = []
  133. this.courseList();
  134. this.bankList();
  135. },
  136. cMenu(index){
  137. this.menuIndex = index;
  138. },
  139. cMenu1(index){
  140. this.menuIndex1 = index;
  141. },
  142. change(index){
  143. this.current = index;
  144. },
  145. //课程
  146. courseList() {
  147. var self = this;
  148. var param = this.paramList[0];
  149. this.$api.goodsList(param).then(res => {
  150. self.paramList[0].total = res.data.total;
  151. self.list1.push.apply(self.list1, res.data.rows);
  152. if (self.list1.length === res.data.total) {
  153. self.paramList[0].showStatus = true;
  154. }
  155. });
  156. },
  157. //题库
  158. bankList() {
  159. var self = this;
  160. var param = this.paramList[1];
  161. this.$api.goodsList(param).then(res => {
  162. self.paramList[1].total = res.data.total;
  163. self.list2.push.apply(self.list2, res.data.rows);
  164. if (self.list2.length === res.data.total) {
  165. self.paramList[1].showStatus = true;
  166. }
  167. });
  168. },
  169. },
  170. onReachBottom() {
  171. console.log(34535)
  172. if (this.current == 0) {
  173. if (this.list1.length < this.paramList[0].total) {
  174. this.paramList[0].pageNum++;
  175. this.courseList();
  176. }
  177. }
  178. if (this.current == 1) {
  179. if (this.list2.length < this.paramList[1].total) {
  180. this.paramList[1].pageNum++;
  181. this.bankList();
  182. }
  183. }
  184. },
  185. computed: { ...mapGetters(['userInfo']) }
  186. };
  187. </script>
  188. <style >
  189. ::-webkit-scrollbar{
  190. width: 0;
  191. height: 0;
  192. color: transparent
  193. }
  194. page{
  195. background-color: #EAEEF1;
  196. }
  197. </style>
  198. <style scoped>
  199. .blackFont{
  200. color: #333333;
  201. margin: 0 4rpx;
  202. }
  203. .wk_icon{
  204. width: 24rpx;
  205. height: 24rpx;
  206. margin-right: 12rpx;
  207. }
  208. .noteTag{
  209. ont-size: 24rpx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. color: #999999;
  213. align-items: center;
  214. }
  215. .priceTag{
  216. font-size: 30rpx;
  217. font-family: PingFang SC;
  218. font-weight: bold;
  219. color: #FF2D55;
  220. }
  221. .titleTag{
  222. font-size: 32rpx;
  223. font-weight: bold;
  224. color: #333333;
  225. margin-left: 8rpx;
  226. }
  227. .yearTag{
  228. width: 80rpx;
  229. height: 32rpx;
  230. background: #EBF5FF;
  231. border: 2rpx solid #007AFF;
  232. border-radius: 16rpx;
  233. font-size: 24rpx;
  234. color: #007AFF;
  235. text-align: center;
  236. line-height: 32rpx;
  237. }
  238. .itemBox{
  239. background: #FFFFFF;
  240. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  241. border-radius: 24rpx;
  242. width: 100%;
  243. padding: 20rpx;
  244. margin-bottom: 20rpx;
  245. }
  246. .listBox{
  247. background-color: #EAEEF1;
  248. padding: 30rpx;
  249. position: relative;
  250. top: 240rpx;
  251. }
  252. .menuSel{
  253. width: 100%;
  254. height: 70rpx;
  255. background: #EAEEF1;
  256. white-space:nowrap;
  257. overflow: hidden;
  258. }
  259. .r_sliper{
  260. padding: 0 20rpx;
  261. }
  262. .r_t1{
  263. height: 48rpx;
  264. background: #007AFF;
  265. border-radius: 16rpx;
  266. padding: 3rpx 8rpx;
  267. margin-top: 11rpx;
  268. color: #FFFFFF;
  269. }
  270. .r_t2{
  271. height: 48rpx;
  272. background: #FFFFFF;
  273. border: 2rpx solid #EEEEEE;
  274. border-radius: 16rpx;
  275. padding: 3rpx 8rpx;
  276. margin-top: 11rpx;
  277. color: #666666;
  278. }
  279. </style>