home.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view>
  3. <view style="z-index: 999;">
  4. <u-navbar title="中正云学堂" :is-back="false">
  5. <view class="slot-wrap"><image src="/static/search.png" class="search" @click="jumpSearch"></image></view>
  6. </u-navbar>
  7. </view>
  8. <scroll-view scroll-y="true" @scroll="scroll" :style="'height: ' + windowHeight + 'px;'" @scrolltolower="scrollTolower">
  9. <view class="box">
  10. <view class="my_swiper"><u-swiper :list="list" height="330" border-radius="25" mode="none"></u-swiper></view>
  11. <!-- 日历-->
  12. <view class="calendar_card">
  13. <view class="card_box">
  14. <u-row gutter="16">
  15. <u-col span="11">
  16. <view>
  17. <text class="t1">距离</text>
  18. <text class="t2">二级建造师</text>
  19. <text class="t1">考试</text>
  20. <text class="t3">365</text>
  21. <text class="t1">天,继续加油哦!</text>
  22. </view>
  23. </u-col>
  24. <u-col span="1">
  25. <view @click="jumpPlan"><image src="/static/more.png" class="img_more"></image></view>
  26. </u-col>
  27. </u-row>
  28. </view>
  29. <u-line color="#EEEEEE" />
  30. <view style="width: 100%;display: flex;justify-content:center;margin-top: 20rpx;">
  31. <view v-for="(item, index) in date" :key="index" class="card_date">{{ item }}</view>
  32. </view>
  33. <view style="width: 100%;display: flex;justify-content:center;margin-top: 40rpx;">
  34. <view v-for="(item, index) in date_num" :key="index" class="date_num">{{ item }}</view>
  35. </view>
  36. <view style="width: 100%;margin-top: 20rpx;">
  37. <u-row gutter="16">
  38. <u-col span="2" text-align="center">
  39. <view><image src="/static/left.png" class="arr-icon"></image></view>
  40. </u-col>
  41. <u-col span="8" text-align="center"><view class="course_title">二级建造师市政公用工程</view></u-col>
  42. <u-col span="2" text-align="center">
  43. <view><image src="/static/right.png" class="arr-icon"></image></view>
  44. </u-col>
  45. </u-row>
  46. </view>
  47. </view>
  48. <!-- 筛选-->
  49. <view style="margin-top: 20rpx;">
  50. <u-row gutter="16">
  51. <u-col span="1">
  52. <view style="padding: 5rpx;"><image src="/static/select.png" class="arr-icon" @click="show = true"></image></view>
  53. </u-col>
  54. <u-col span="11">
  55. <view>
  56. <u-subsection
  57. @change="sectionChange"
  58. height="54"
  59. button-color="#2F4379"
  60. bg-color="#F8F9FF"
  61. active-color="#FFFFFF"
  62. inactive-color="#636A75"
  63. :list="tab_list"
  64. :current="current"
  65. ></u-subsection>
  66. </view>
  67. </u-col>
  68. </u-row>
  69. </view>
  70. <!-- 课程列表-->
  71. <view v-if="current==0">
  72. <view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list1" :key="index">
  73. <image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
  74. <view class="list_content">
  75. <view style="margin-left: 280rpx;margin-top: 10rpx;">
  76. <view class="list_title">{{item.courseName}}</view>
  77. <view class="old_price">原价:¥{{item.price}}</view>
  78. <view class="price">现价:¥{{item.price}}</view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 题库列表-->
  84. <view v-if="current==1">
  85. <view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list2" :key="index">
  86. <image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
  87. <view class="list_content">
  88. <view style="margin-left: 280rpx;margin-top: 10rpx;">
  89. <view class="list_title">{{item.bankName}}</view>
  90. <view class="old_price">原价:¥{{item.price}}</view>
  91. <view class="price">现价:¥{{item.price}}</view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <!-- 重点列表-->
  97. <view v-if="current==2">
  98. <view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list3" :key="index">
  99. <image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
  100. <view class="list_content">
  101. <view style="margin-left: 280rpx;margin-top: 10rpx;">
  102. <view class="list_title">{{item.name}}</view>
  103. <view class="old_price">原价:¥{{item.price}}</view>
  104. <view class="price">现价:¥{{item.price}}</view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view v-if="paramList[current].showStatus" style="text-align: center;margin-top: 24rpx;">
  110. 到底啦~
  111. </view>
  112. <u-popup v-model="show">
  113. <view style="width: 600rpx"><view class="popup_t1">选择你需要的</view></view>
  114. </u-popup>
  115. </view>
  116. </scroll-view>
  117. </view>
  118. </template>
  119. <script>
  120. export default {
  121. name: 'home',
  122. data() {
  123. return {
  124. show: false,
  125. tab_list: [
  126. {
  127. name: '课程'
  128. },
  129. {
  130. name: '刷题'
  131. },
  132. {
  133. name: '重点考点'
  134. }
  135. ],
  136. current: 0,
  137. list: [
  138. {
  139. image: 'http://192.168.0.222:8080/img/banner1.png'
  140. },
  141. {
  142. image: 'https://cdn.uviewui.com/uview/swiper/2.jpg'
  143. },
  144. {
  145. image: 'https://cdn.uviewui.com/uview/swiper/3.jpg'
  146. }
  147. ],
  148. paramList:[
  149. {
  150. pageNum:1,
  151. pageSize: 10,
  152. total:0,
  153. showStatus:0
  154. },
  155. {
  156. pageNum:1,
  157. pageSize: 10,
  158. total:0,
  159. showStatus:0
  160. },
  161. {
  162. pageNum:1,
  163. pageSize: 10,
  164. total:0,
  165. showStatus:0
  166. }
  167. ],
  168. date: ['日', '一', '二', '三', '四', '五', '六'],
  169. date_num: [23, 24, 25, 26, 27, 28, 29],
  170. list1: [],
  171. list2: [],
  172. list3: [],
  173. windowHeight: 0,
  174. };
  175. },
  176. onLoad(){},
  177. mounted() {
  178. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  179. this.initList()
  180. },
  181. methods: {
  182. initList(){
  183. this.courseList()
  184. this.bankList()
  185. this.noteList()
  186. },
  187. scroll(e) {},
  188. scrollTolower(){
  189. if(this.current==0){
  190. if(this.list1.length<this.paramList[0].total){
  191. this.paramList[0].pageNum++
  192. this.courseList()
  193. }
  194. }
  195. if(this.current==1){
  196. if(this.list1.length<this.paramList[1].total){
  197. this.paramList[1].pageNum++
  198. this.bankList()
  199. }
  200. }
  201. if(this.current==2){
  202. if(this.list1.length<this.paramList[2].total){
  203. this.paramList[2].pageNum++
  204. this.noteList()
  205. }
  206. }
  207. },
  208. sectionChange(index) {
  209. this.current = index;
  210. },
  211. //课程
  212. courseList(){
  213. var self = this
  214. var param = this.paramList[0]
  215. this.$api.courselist(param).then(res => {
  216. self.paramList[0].total = res.data.total
  217. self.list1.push.apply(self.list1,res.data.rows)
  218. if(self.list1.length === res.data.total){
  219. self.paramList[0].showStatus = true
  220. }
  221. })
  222. },
  223. //题库
  224. bankList(){
  225. var self = this
  226. var param = this.paramList[1]
  227. this.$api.banklist(param).then(res => {
  228. self.paramList[1].total = res.data.total
  229. self.list2.push.apply(self.list2,res.data.rows)
  230. if(self.list2.length === res.data.total){
  231. self.paramList[1].showStatus = true
  232. }
  233. })
  234. },
  235. //考试重点
  236. noteList(){
  237. var self = this
  238. var param = this.paramList[2]
  239. this.$api.notelist(param).then(res => {
  240. self.paramList[2].total = res.data.total
  241. self.list3.push.apply(self.list3,res.data.rows)
  242. if(self.list3.length === res.data.total){
  243. self.paramList[2].showStatus = true
  244. }
  245. })
  246. },
  247. jumpDetail(item) {
  248. if (this.current == 0) {
  249. this.$navTo.togo('/pages2/course/detail', item);
  250. return;
  251. }
  252. if (this.current == 1) {
  253. this.$navTo.togo('/pages2/bank/detail', {});
  254. return;
  255. }
  256. if (this.current == 2) {
  257. this.$navTo.togo('/pages2/course/keynote', {
  258. id:item.fileId
  259. });
  260. return;
  261. }
  262. },
  263. jumpPlan() {
  264. this.$navTo.togo('/pages2/plan/detail', {});
  265. },
  266. jumpSearch() {
  267. this.$navTo.togo('/pages2/index/search', {});
  268. }
  269. }
  270. };
  271. </script>
  272. <style scoped>
  273. .search {
  274. width: 40rpx;
  275. height: 40rpx;
  276. margin-left: 30rpx;
  277. }
  278. .slot-wrap {
  279. display: flex;
  280. align-items: center;
  281. }
  282. .popup_t1 {
  283. height: 29rpx;
  284. font-size: 30rpx;
  285. font-family: PingFang SC;
  286. font-weight: bold;
  287. color: #131b31;
  288. margin: 100rpx;
  289. }
  290. .price {
  291. font-size: 20rpx;
  292. font-family: PingFang SC;
  293. font-weight: bold;
  294. color: #ff0000;
  295. margin-top: 8rpx;
  296. }
  297. .old_price {
  298. font-size: 24rpx;
  299. font-family: PingFang SC;
  300. font-weight: bold;
  301. text-decoration: line-through;
  302. color: #999999;
  303. margin-top: 8rpx;
  304. }
  305. .list_title {
  306. font-size: 24rpx;
  307. font-family: PingFang SC;
  308. font-weight: bold;
  309. color: #2f4379;
  310. }
  311. .list_content {
  312. width: 656rpx;
  313. height: 134rpx;
  314. background: #ffffff;
  315. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  316. border-radius: 24rpx;
  317. position: absolute;
  318. top: 20rpx;
  319. left: 20rpx;
  320. }
  321. .list_box {
  322. position: relative;
  323. width: 100%;
  324. margin-top: 30rpx;
  325. }
  326. .list_img {
  327. width: 278rpx;
  328. height: 134rpx;
  329. z-index: 100;
  330. position: relative;
  331. }
  332. .course_title {
  333. color: #2f4379;
  334. box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(47, 67, 121, 0.1);
  335. border-radius: 28rpx;
  336. width: 100%;
  337. height: 48rpx;
  338. line-height: 48rpx;
  339. }
  340. .arr-icon {
  341. width: 40rpx;
  342. height: 40rpx;
  343. }
  344. .wrap {
  345. padding: 24rpx;
  346. }
  347. .u-row {
  348. margin: 40rpx 0;
  349. }
  350. .date_num {
  351. width: 14%;
  352. text-align: center;
  353. color: #34c759;
  354. }
  355. .card_date {
  356. width: 14%;
  357. text-align: center;
  358. color: #7f8caf;
  359. }
  360. page {
  361. background: #ffffff;
  362. font-size: 28rpx;
  363. }
  364. .calendar_card {
  365. width: 100%;
  366. height: 300rpx;
  367. background: #ffffff;
  368. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  369. border-radius: 22rpx;
  370. margin-top: 25rpx;
  371. }
  372. .box {
  373. margin: 30rpx;
  374. }
  375. .my_swiper {
  376. box-shadow: 0rpx 20rpx 16rpx 4rpx rgba(47, 67, 121, 0.08);
  377. border-radius: 25rpx;
  378. }
  379. .calendar_card .card_box {
  380. height: 60rpx;
  381. line-height: 60rpx;
  382. margin-left: 40rpx;
  383. }
  384. .calendar_card .t1 {
  385. color: #7f8caf;
  386. font-size: 24rpx;
  387. }
  388. .calendar_card .t2 {
  389. font-size: 24rpx;
  390. font-family: PingFang SC;
  391. font-weight: bold;
  392. color: #32467b;
  393. margin: 0 10rpx;
  394. }
  395. .calendar_card .t3 {
  396. font-size: 30rpx;
  397. font-weight: bold;
  398. color: #32467b;
  399. text-shadow: 0rpx 3rpx 3rpx rgba(0, 0, 0, 0.2);
  400. margin: 0 10rpx;
  401. }
  402. .img_more {
  403. width: 26rpx;
  404. height: 26rpx;
  405. }
  406. </style>