home.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  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" @click="swiperClick" 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" v-if="false">
  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 offset="11" 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" @click="preveItem"></image></view>
  40. </u-col>
  41. <u-col span="8" text-align="center"><view class="course_title" @click="jumpCourseDetail()">{{ courseItem.courseName }}</view></u-col>
  42. <u-col span="2" text-align="center">
  43. <view><image src="/static/right.png" class="arr-icon" @click="nextItem"></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 = false"></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;">到底啦~</view>
  110. <u-popup v-model="show">
  111. <view style="width: 600rpx"><view class="popup_t1">选择你需要的</view></view>
  112. </u-popup>
  113. </view>
  114. </scroll-view>
  115. </view>
  116. </template>
  117. <script>
  118. export default {
  119. name: 'home',
  120. data() {
  121. return {
  122. courseItem:{},
  123. courseIndex:0,
  124. vertical:"vertical",
  125. workList: [],
  126. workTextList: [],
  127. show: false,
  128. tab_list: [
  129. {
  130. name: '课程'
  131. },
  132. {
  133. name: '刷题'
  134. },
  135. {
  136. name: '重点考点'
  137. }
  138. ],
  139. current: 0,
  140. list: [],
  141. paramList: [
  142. {
  143. pageNum: 1,
  144. pageSize: 10,
  145. total: 0,
  146. showStatus: 0
  147. },
  148. {
  149. pageNum: 1,
  150. pageSize: 10,
  151. total: 0,
  152. showStatus: 0
  153. },
  154. {
  155. pageNum: 1,
  156. pageSize: 10,
  157. total: 0,
  158. showStatus: 0
  159. }
  160. ],
  161. date: ['日', '一', '二', '三', '四', '五', '六'],
  162. date_num: [],
  163. list1: [],
  164. list2: [],
  165. list3: [],
  166. windowHeight: 0
  167. };
  168. },
  169. onLoad() {},
  170. mounted() {
  171. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  172. this.initList();
  173. this.advertisingList();
  174. if(!this.$method.isLogin()){
  175. //未登录
  176. // d是当前星期一的日期对象
  177. var d=this.getMonDate();
  178. var arr=[];
  179. for(var i=0; i<7; i++)
  180. {
  181. this.date_num.push(d.getDate())
  182. d.setDate(d.getDate()+1);
  183. }
  184. }else{
  185. this.userPlanSeven()
  186. }
  187. console.log(arr)
  188. },
  189. methods: {
  190. preveItem(){
  191. if(self.courseIndex>0){
  192. self.courseIndex = self.courseIndex-1
  193. self.courseItem = self.workList[self.courseIndex]
  194. }
  195. },
  196. nextItem(){
  197. if(self.courseIndex<self.workList.length-1){
  198. self.courseIndex = self.courseIndex+1
  199. self.courseItem = self.workList[self.courseIndex]
  200. }
  201. },
  202. jumpCourseDetail(){
  203. this.$navTo.togo('/pages2/course/detail', {
  204. id: this.courseItem.courseId
  205. });
  206. },
  207. noticeBar(index){
  208. let item = this.workList[index]
  209. this.$navTo.togo('/pages2/course/detail', {
  210. id: item.courseId
  211. });
  212. },
  213. userPlanSeven() {
  214. let self = this;
  215. this.$api.userPlanSeven().then(result => {
  216. self.workList = result.data.data.coursePlanVo;
  217. if(self.workList.length>0){
  218. self.courseItem = self.workList[self.courseIndex]
  219. }
  220. });
  221. },
  222. getMonDate()
  223. {
  224. var d=new Date(),
  225. day=d.getDay(),
  226. date=d.getDate();
  227. if(day==0)
  228. return d;
  229. else
  230. d.setDate(date-day);
  231. return d;
  232. },
  233. swiperClick(index){
  234. let item = this.list[index]
  235. uni.navigateTo({
  236. url: item.jumpUrl
  237. });
  238. },
  239. advertisingList(){
  240. let self = this
  241. this.$api.advertisingList().then(res => {
  242. let index;
  243. for (index in res.data.rows ) {
  244. res.data.rows[index].image = res.data.rows[index].adverUrl
  245. }
  246. self.list = res.data.rows
  247. });
  248. },
  249. initList() {
  250. this.courseList();
  251. this.bankList();
  252. this.noteList();
  253. },
  254. scroll(e) {},
  255. scrollTolower() {
  256. if (this.current == 0) {
  257. if (this.list1.length < this.paramList[0].total) {
  258. this.paramList[0].pageNum++;
  259. this.courseList();
  260. }
  261. }
  262. if (this.current == 1) {
  263. if (this.list1.length < this.paramList[1].total) {
  264. this.paramList[1].pageNum++;
  265. this.bankList();
  266. }
  267. }
  268. if (this.current == 2) {
  269. if (this.list1.length < this.paramList[2].total) {
  270. this.paramList[2].pageNum++;
  271. this.noteList();
  272. }
  273. }
  274. },
  275. sectionChange(index) {
  276. this.current = index;
  277. },
  278. //课程
  279. courseList() {
  280. var self = this;
  281. var param = this.paramList[0];
  282. this.$api.courselist(param).then(res => {
  283. self.paramList[0].total = res.data.total;
  284. self.list1.push.apply(self.list1, res.data.rows);
  285. if (self.list1.length === res.data.total) {
  286. self.paramList[0].showStatus = true;
  287. }
  288. });
  289. },
  290. //题库
  291. bankList() {
  292. var self = this;
  293. var param = this.paramList[1];
  294. this.$api.banklist(param).then(res => {
  295. self.paramList[1].total = res.data.total;
  296. self.list2.push.apply(self.list2, res.data.rows);
  297. if (self.list2.length === res.data.total) {
  298. self.paramList[1].showStatus = true;
  299. }
  300. });
  301. },
  302. //考试重点
  303. noteList() {
  304. var self = this;
  305. var param = this.paramList[2];
  306. this.$api.notelist(param).then(res => {
  307. self.paramList[2].total = res.data.total;
  308. self.list3.push.apply(self.list3, res.data.rows);
  309. if (self.list3.length === res.data.total) {
  310. self.paramList[2].showStatus = true;
  311. }
  312. });
  313. },
  314. jumpDetail(item) {
  315. if (this.current == 0) {
  316. this.$navTo.togo('/pages2/course/detail', {
  317. id: item.courseId
  318. });
  319. return;
  320. }
  321. if (this.current == 1) {
  322. this.$navTo.togo('/pages2/bank/detail', {
  323. id: item.bankId
  324. });
  325. return;
  326. }
  327. if (this.current == 2) {
  328. this.$navTo.togo('/pages2/course/keynote', {
  329. id: item.fileId
  330. });
  331. return;
  332. }
  333. },
  334. jumpPlan() {
  335. if(!this.$method.isLogin()){
  336. this.$navTo.togo('/pages/login/login');
  337. }else{
  338. this.$navTo.togo('/pages2/plan/detail', {});
  339. }
  340. },
  341. jumpSearch() {
  342. this.$navTo.togo('/pages2/index/search', {});
  343. }
  344. }
  345. };
  346. </script>
  347. <style scoped>
  348. .search {
  349. width: 40rpx;
  350. height: 40rpx;
  351. margin-left: 30rpx;
  352. }
  353. .slot-wrap {
  354. display: flex;
  355. align-items: center;
  356. }
  357. .popup_t1 {
  358. height: 29rpx;
  359. font-size: 30rpx;
  360. font-family: PingFang SC;
  361. font-weight: bold;
  362. color: #131b31;
  363. margin: 100rpx;
  364. }
  365. .price {
  366. font-size: 20rpx;
  367. font-family: PingFang SC;
  368. font-weight: bold;
  369. color: #ff0000;
  370. margin-top: 8rpx;
  371. }
  372. .old_price {
  373. font-size: 24rpx;
  374. font-family: PingFang SC;
  375. font-weight: bold;
  376. text-decoration: line-through;
  377. color: #999999;
  378. margin-top: 8rpx;
  379. }
  380. .list_title {
  381. font-size: 24rpx;
  382. font-family: PingFang SC;
  383. font-weight: bold;
  384. color: #2f4379;
  385. }
  386. .list_content {
  387. width: 656rpx;
  388. height: 134rpx;
  389. background: #ffffff;
  390. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  391. border-radius: 24rpx;
  392. position: absolute;
  393. top: 20rpx;
  394. left: 20rpx;
  395. }
  396. .list_box {
  397. position: relative;
  398. width: 100%;
  399. margin-top: 30rpx;
  400. }
  401. .list_img {
  402. width: 278rpx;
  403. height: 134rpx;
  404. z-index: 100;
  405. position: relative;
  406. }
  407. .course_title {
  408. color: #2f4379;
  409. box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(47, 67, 121, 0.1);
  410. border-radius: 28rpx;
  411. width: 100%;
  412. height: 48rpx;
  413. line-height: 48rpx;
  414. }
  415. .arr-icon {
  416. width: 40rpx;
  417. height: 40rpx;
  418. }
  419. .wrap {
  420. padding: 24rpx;
  421. }
  422. .u-row {
  423. margin: 40rpx 0;
  424. }
  425. .date_num {
  426. width: 14%;
  427. text-align: center;
  428. color: #34c759;
  429. }
  430. .card_date {
  431. width: 14%;
  432. text-align: center;
  433. color: #7f8caf;
  434. }
  435. page {
  436. background: #ffffff;
  437. font-size: 28rpx;
  438. }
  439. .calendar_card {
  440. width: 100%;
  441. height: 300rpx;
  442. background: #ffffff;
  443. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  444. border-radius: 22rpx;
  445. margin-top: 25rpx;
  446. }
  447. .box {
  448. margin: 30rpx;
  449. }
  450. .my_swiper {
  451. box-shadow: 0rpx 20rpx 16rpx 4rpx rgba(47, 67, 121, 0.08);
  452. border-radius: 25rpx;
  453. }
  454. .calendar_card .card_box {
  455. height: 60rpx;
  456. line-height: 60rpx;
  457. margin-left: 40rpx;
  458. }
  459. .calendar_card .t1 {
  460. color: #7f8caf;
  461. font-size: 24rpx;
  462. }
  463. .calendar_card .t2 {
  464. font-size: 24rpx;
  465. font-family: PingFang SC;
  466. font-weight: bold;
  467. color: #32467b;
  468. margin: 0 10rpx;
  469. }
  470. .calendar_card .t3 {
  471. font-size: 30rpx;
  472. font-weight: bold;
  473. color: #32467b;
  474. text-shadow: 0rpx 3rpx 3rpx rgba(0, 0, 0, 0.2);
  475. margin: 0 10rpx;
  476. }
  477. .img_more {
  478. width: 26rpx;
  479. height: 26rpx;
  480. }
  481. </style>