home.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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">
  35. <view v-if="item.color == 0" class="date_num_color0" v-show="item.date>0">
  36. {{ item.date }}
  37. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  38. <view v-if="item.dot" class="date_dot"></view>
  39. </view>
  40. <view v-if="item.color == 1" class="date_num_color1">
  41. {{ item.date }}
  42. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  43. <view v-if="item.dot" class="date_dot"></view>
  44. </view>
  45. <view v-if="item.color == 2" class="date_num_color2">
  46. {{ item.date }}
  47. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  48. <view v-if="item.dot" class="date_dot"></view>
  49. </view>
  50. <view v-if="item.color == 3" class="date_num_color3">
  51. {{ item.date }}
  52. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  53. <view v-if="item.dot" class="date_dot"></view>
  54. </view>
  55. </view>
  56. </view>
  57. <view style="width: 100%;margin-top: 20rpx;" v-if="workList.length>0" >
  58. <u-row gutter="16">
  59. <u-col span="2" text-align="center">
  60. <view><image src="/static/left.png" class="arr-icon" @click="preveItem"></image></view>
  61. </u-col>
  62. <u-col span="8" text-align="center"><view class="course_title" @click="jumpCourseDetail()">{{ courseItem.courseName }}</view></u-col>
  63. <u-col span="2" text-align="center">
  64. <view><image src="/static/right.png" class="arr-icon" @click="nextItem"></image></view>
  65. </u-col>
  66. </u-row>
  67. </view>
  68. </view>
  69. <!-- 筛选-->
  70. <view style="margin-top: 20rpx;">
  71. <u-row gutter="16">
  72. <u-col span="1">
  73. <view style="padding: 5rpx;"><image src="/static/select.png" class="arr-icon" @click="show = false"></image></view>
  74. </u-col>
  75. <u-col span="11">
  76. <view>
  77. <u-subsection
  78. @change="sectionChange"
  79. height="54"
  80. button-color="rgba(47,67,121,0.6)"
  81. bg-color="#F8F9FF"
  82. active-color="#FFFFFF"
  83. inactive-color="#636A75"
  84. :list="tab_list"
  85. :current="current"
  86. ></u-subsection>
  87. </view>
  88. </u-col>
  89. </u-row>
  90. </view>
  91. <!-- 课程列表-->
  92. <view v-if="current == 0">
  93. <view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list1" :key="index">
  94. <image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
  95. <view class="list_content">
  96. <view style="margin-left: 280rpx;margin-top: 10rpx;">
  97. <view class="list_title">{{ item.courseName }}</view>
  98. <view class="old_price">原价:¥{{ item.price }}</view>
  99. <view class="price">现价:¥{{ item.price }}</view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 题库列表-->
  105. <view v-if="current == 1">
  106. <view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list2" :key="index">
  107. <image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
  108. <view class="list_content">
  109. <view style="margin-left: 280rpx;margin-top: 10rpx;">
  110. <view class="list_title">{{ item.bankName }}</view>
  111. <view class="old_price">原价:¥{{ item.price }}</view>
  112. <view class="price">现价:¥{{ item.price }}</view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <!-- 重点列表-->
  118. <view v-if="current == 2">
  119. <view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list3" :key="index">
  120. <image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
  121. <view class="list_content">
  122. <view style="margin-left: 280rpx;margin-top: 10rpx;">
  123. <view class="list_title">{{ item.name }}</view>
  124. <view class="old_price">原价:¥{{ item.price }}</view>
  125. <view class="price">现价:¥{{ item.price }}</view>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. <view v-if="paramList[current].showStatus" style="text-align: center;margin-top: 24rpx;">到底啦~</view>
  131. <u-popup v-model="show">
  132. <view style="width: 600rpx"><view class="popup_t1">选择你需要的</view></view>
  133. </u-popup>
  134. </view>
  135. </scroll-view>
  136. </view>
  137. </template>
  138. <script>
  139. export default {
  140. name: 'home',
  141. data() {
  142. return {
  143. courseItem:{},
  144. courseIndex:0,
  145. vertical:"vertical",
  146. workList: [],
  147. workTextList: [],
  148. show: false,
  149. tab_list: [
  150. {
  151. name: '课程'
  152. },
  153. {
  154. name: '刷题'
  155. },
  156. {
  157. name: '重点考点'
  158. }
  159. ],
  160. current: 0,
  161. list: [],
  162. paramList: [
  163. {
  164. pageNum: 1,
  165. pageSize: 10,
  166. total: 0,
  167. showStatus: 0
  168. },
  169. {
  170. pageNum: 1,
  171. pageSize: 10,
  172. total: 0,
  173. showStatus: 0
  174. },
  175. {
  176. pageNum: 1,
  177. pageSize: 10,
  178. total: 0,
  179. showStatus: 0
  180. }
  181. ],
  182. date: ['日', '一', '二', '三', '四', '五', '六'],
  183. date_num: [],
  184. list1: [],
  185. list2: [],
  186. list3: [],
  187. windowHeight: 0
  188. };
  189. },
  190. onLoad() {},
  191. mounted() {
  192. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  193. this.initList();
  194. this.advertisingList();
  195. },
  196. methods: {
  197. init(){
  198. if(!this.$method.isLogin()){
  199. //未登录
  200. this.date_num = []
  201. this.workList = []
  202. this.initDay()
  203. }else{
  204. this.date_num = []
  205. this.workList = []
  206. this.userPlanSeven()
  207. }
  208. },
  209. initDay(){
  210. // d是当前星期一的日期对象
  211. var d=this.getMonDate();
  212. var arr=[];
  213. let date = new Date();
  214. let num = date.getDate();
  215. for(var i=0; i<7; i++)
  216. {
  217. let item = {date:d.getDate()}
  218. item.color = 0
  219. if(d.getDate()==num){
  220. item.color = 3;
  221. }
  222. this.date_num.push(item)
  223. d.setDate(d.getDate()+1);
  224. }
  225. },
  226. preveItem(){
  227. if(self.courseIndex>0){
  228. self.courseIndex = self.courseIndex-1
  229. self.courseItem = self.workList[self.courseIndex]
  230. }
  231. },
  232. nextItem(){
  233. if(self.courseIndex<self.workList.length-1){
  234. self.courseIndex = self.courseIndex+1
  235. self.courseItem = self.workList[self.courseIndex]
  236. }
  237. },
  238. jumpCourseDetail(){
  239. this.$navTo.togo('/pages2/course/detail', {
  240. id: this.courseItem.courseId
  241. });
  242. },
  243. noticeBar(index){
  244. let item = this.workList[index]
  245. this.$navTo.togo('/pages2/course/detail', {
  246. id: item.courseId
  247. });
  248. },
  249. userPlanSeven() {
  250. let self = this;
  251. this.$api.userPlanSeven().then(result => {
  252. if(result.data.data.coursePlanVo!=null){
  253. self.workList = result.data.data.coursePlanVo;
  254. if(self.workList!=null&&self.workList.length>0){
  255. self.courseItem = self.workList[self.courseIndex]
  256. }
  257. let date = new Date();
  258. let num = date.getDate();
  259. let list = result.data.data.calendarStudyVo[0].dayStudyList;
  260. for(let i = 0; i < list.length; i++) {
  261. let item = list[i]
  262. item.color = 0
  263. if (item.date == num) {
  264. item.color = 3;
  265. }
  266. if (item.perform == 1) {
  267. item.color = 1;
  268. }
  269. if (item.perform == 2) {
  270. item.color = 2;
  271. }
  272. item.note = item.studyCourseKnob
  273. if(item.note>0){
  274. item.dot = true
  275. }
  276. self.date_num.push(item)
  277. }
  278. }else{
  279. self.initDay()
  280. }
  281. });
  282. },
  283. getMonDate()
  284. {
  285. var d=new Date(),
  286. day=d.getDay(),
  287. date=d.getDate();
  288. if(day==0)
  289. return d;
  290. else
  291. d.setDate(date-day);
  292. return d;
  293. },
  294. swiperClick(index){
  295. let item = this.list[index]
  296. uni.navigateTo({
  297. url: item.jumpUrl
  298. });
  299. },
  300. advertisingList(){
  301. let self = this
  302. this.$api.advertisingList().then(res => {
  303. let index;
  304. for (index in res.data.rows ) {
  305. res.data.rows[index].image = res.data.rows[index].adverUrl
  306. }
  307. self.list = res.data.rows
  308. });
  309. },
  310. initList() {
  311. this.courseList();
  312. this.bankList();
  313. this.noteList();
  314. },
  315. scroll(e) {},
  316. scrollTolower() {
  317. if (this.current == 0) {
  318. if (this.list1.length < this.paramList[0].total) {
  319. this.paramList[0].pageNum++;
  320. this.courseList();
  321. }
  322. }
  323. if (this.current == 1) {
  324. if (this.list1.length < this.paramList[1].total) {
  325. this.paramList[1].pageNum++;
  326. this.bankList();
  327. }
  328. }
  329. if (this.current == 2) {
  330. if (this.list1.length < this.paramList[2].total) {
  331. this.paramList[2].pageNum++;
  332. this.noteList();
  333. }
  334. }
  335. },
  336. sectionChange(index) {
  337. this.current = index;
  338. },
  339. //课程
  340. courseList() {
  341. var self = this;
  342. var param = this.paramList[0];
  343. this.$api.courselist(param).then(res => {
  344. self.paramList[0].total = res.data.total;
  345. self.list1.push.apply(self.list1, res.data.rows);
  346. if (self.list1.length === res.data.total) {
  347. self.paramList[0].showStatus = true;
  348. }
  349. });
  350. },
  351. //题库
  352. bankList() {
  353. var self = this;
  354. var param = this.paramList[1];
  355. this.$api.banklist(param).then(res => {
  356. self.paramList[1].total = res.data.total;
  357. self.list2.push.apply(self.list2, res.data.rows);
  358. if (self.list2.length === res.data.total) {
  359. self.paramList[1].showStatus = true;
  360. }
  361. });
  362. },
  363. //考试重点
  364. noteList() {
  365. var self = this;
  366. var param = this.paramList[2];
  367. this.$api.notelist(param).then(res => {
  368. self.paramList[2].total = res.data.total;
  369. self.list3.push.apply(self.list3, res.data.rows);
  370. if (self.list3.length === res.data.total) {
  371. self.paramList[2].showStatus = true;
  372. }
  373. });
  374. },
  375. jumpDetail(item) {
  376. if (this.current == 0) {
  377. this.$navTo.togo('/pages2/course/detail', {
  378. id: item.courseId
  379. });
  380. return;
  381. }
  382. if (this.current == 1) {
  383. this.$navTo.togo('/pages2/bank/detail', {
  384. id: item.bankId
  385. });
  386. return;
  387. }
  388. if (this.current == 2) {
  389. this.$navTo.togo('/pages2/course/keynote', {
  390. id: item.fileId
  391. });
  392. return;
  393. }
  394. },
  395. jumpPlan() {
  396. if(!this.$method.isLogin()){
  397. this.$navTo.togo('/pages/login/login');
  398. }else{
  399. this.$navTo.togo('/pages2/plan/detail', {});
  400. }
  401. },
  402. jumpSearch() {
  403. this.$navTo.togo('/pages2/index/search', {});
  404. }
  405. }
  406. };
  407. </script>
  408. <style scoped>
  409. .search {
  410. width: 40rpx;
  411. height: 40rpx;
  412. margin-left: 30rpx;
  413. }
  414. .slot-wrap {
  415. display: flex;
  416. align-items: center;
  417. }
  418. .popup_t1 {
  419. height: 29rpx;
  420. font-size: 30rpx;
  421. font-family: PingFang SC;
  422. font-weight: bold;
  423. color: #131b31;
  424. margin: 100rpx;
  425. }
  426. .price {
  427. font-size: 20rpx;
  428. font-family: PingFang SC;
  429. font-weight: bold;
  430. color: #ff0000;
  431. margin-top: 8rpx;
  432. }
  433. .old_price {
  434. font-size: 24rpx;
  435. font-family: PingFang SC;
  436. font-weight: bold;
  437. text-decoration: line-through;
  438. color: #999999;
  439. margin-top: 8rpx;
  440. }
  441. .list_title {
  442. font-size: 24rpx;
  443. font-family: PingFang SC;
  444. font-weight: bold;
  445. color: #2f4379;
  446. }
  447. .list_content {
  448. width: 656rpx;
  449. height: 134rpx;
  450. background: #ffffff;
  451. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  452. border-radius: 24rpx;
  453. position: absolute;
  454. top: 20rpx;
  455. left: 20rpx;
  456. }
  457. .list_box {
  458. position: relative;
  459. width: 100%;
  460. margin-top: 30rpx;
  461. }
  462. .list_img {
  463. width: 278rpx;
  464. height: 134rpx;
  465. z-index: 100;
  466. position: relative;
  467. }
  468. .course_title {
  469. color: #2f4379;
  470. box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(47, 67, 121, 0.1);
  471. border-radius: 28rpx;
  472. width: 100%;
  473. height: 48rpx;
  474. line-height: 48rpx;
  475. }
  476. .arr-icon {
  477. width: 40rpx;
  478. height: 40rpx;
  479. }
  480. .wrap {
  481. padding: 24rpx;
  482. }
  483. .u-row {
  484. margin: 40rpx 0;
  485. }
  486. .date_dot {
  487. width: 6rpx;
  488. height: 6rpx;
  489. background: #ffcc00;
  490. border-radius: 50%;
  491. margin: 0 auto;
  492. }
  493. .date_note {
  494. border-radius: 50%;
  495. width: 29rpx;
  496. height: 29rpx;
  497. border: 1px solid #ffcc00;
  498. font-size: 18rpx;
  499. color: #ffcc00;
  500. text-align: center;
  501. display: inline-block;
  502. position: absolute;
  503. top: -19rpx;
  504. right: 9rpx;
  505. }
  506. .circle_num {
  507. border-radius: 50%;
  508. width: 29rpx;
  509. height: 29rpx;
  510. border: 1px solid #ffcc00;
  511. font-size: 18rpx;
  512. color: #ffcc00;
  513. text-align: center;
  514. display: inline-block;
  515. margin: 5rpx;
  516. }
  517. .date_num {
  518. width: 14%;
  519. text-align: center;
  520. position: relative;
  521. display: inline-block;
  522. margin-top: 20rpx;
  523. }
  524. .date_num_color0 {
  525. color: #32467b;
  526. }
  527. .date_num_color1 {
  528. color: #34c759;
  529. }
  530. .date_num_color2 {
  531. color: #ff3b30;
  532. }
  533. .date_num_color3 {
  534. color: #ffffff;
  535. background-color: #ffcc00;
  536. border-radius: 50%;
  537. width: 40rpx;
  538. height: 40rpx;
  539. display: inline-block;
  540. }
  541. .card_date {
  542. width: 14%;
  543. text-align: center;
  544. color: #7f8caf;
  545. }
  546. page {
  547. background: #ffffff;
  548. font-size: 28rpx;
  549. }
  550. .calendar_card {
  551. width: 100%;
  552. height: 300rpx;
  553. background: #ffffff;
  554. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  555. border-radius: 22rpx;
  556. margin-top: 25rpx;
  557. }
  558. .box {
  559. margin: 30rpx;
  560. }
  561. .my_swiper {
  562. box-shadow: 0rpx 20rpx 16rpx 4rpx rgba(47, 67, 121, 0.08);
  563. border-radius: 25rpx;
  564. }
  565. .calendar_card .card_box {
  566. height: 60rpx;
  567. line-height: 60rpx;
  568. margin-left: 40rpx;
  569. }
  570. .calendar_card .t1 {
  571. color: #7f8caf;
  572. font-size: 24rpx;
  573. }
  574. .calendar_card .t2 {
  575. font-size: 24rpx;
  576. font-family: PingFang SC;
  577. font-weight: bold;
  578. color: #32467b;
  579. margin: 0 10rpx;
  580. }
  581. .calendar_card .t3 {
  582. font-size: 30rpx;
  583. font-weight: bold;
  584. color: #32467b;
  585. text-shadow: 0rpx 3rpx 3rpx rgba(0, 0, 0, 0.2);
  586. margin: 0 10rpx;
  587. }
  588. .img_more {
  589. width: 26rpx;
  590. height: 26rpx;
  591. }
  592. </style>