home.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  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 -100;
  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(this.courseIndex>0){
  228. this.courseIndex = this.courseIndex-1
  229. this.courseItem = this.workList[this.courseIndex]
  230. }
  231. },
  232. nextItem(){
  233. if(this.courseIndex<this.workList.length-1){
  234. this.courseIndex = this.courseIndex+1
  235. this.courseItem = this.workList[this.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 month = date.getMonth()+1
  260. let list = [];
  261. for(let i = 0; i < result.data.data.calendarStudyVo.length; i++){
  262. let item = result.data.data.calendarStudyVo[i]
  263. if(item.month==month){
  264. list = item.dayStudyList
  265. }
  266. }
  267. for(let i = 0; i < list.length; i++) {
  268. let item = list[i]
  269. item.color = 0
  270. if (item.date == num) {
  271. item.color = 3;
  272. }
  273. if (item.perform == 1) {
  274. item.color = 1;
  275. }
  276. if (item.perform == 2) {
  277. item.color = 2;
  278. }
  279. item.note = item.studyCourseKnob
  280. if(item.note>0){
  281. item.dot = true
  282. }
  283. self.date_num.push(item)
  284. }
  285. }else{
  286. self.initDay()
  287. }
  288. });
  289. },
  290. getMonDate(){
  291. var d=new Date(),
  292. day=d.getDay(),
  293. date=d.getDate();
  294. if(day==0)
  295. return d;
  296. else
  297. d.setDate(date-day);
  298. return d;
  299. },
  300. swiperClick(index){
  301. let item = this.list[index]
  302. uni.navigateTo({
  303. url: item.jumpUrl
  304. });
  305. },
  306. advertisingList(){
  307. let self = this
  308. this.$api.advertisingList().then(res => {
  309. let index;
  310. for (index in res.data.rows ) {
  311. res.data.rows[index].image = self.$method.splitImgHost(res.data.rows[index].adverUrl)
  312. }
  313. self.list = res.data.rows
  314. });
  315. },
  316. initList() {
  317. this.courseList();
  318. this.bankList();
  319. this.noteList();
  320. },
  321. scroll(e) {},
  322. scrollTolower() {
  323. if (this.current == 0) {
  324. if (this.list1.length < this.paramList[0].total) {
  325. this.paramList[0].pageNum++;
  326. this.courseList();
  327. }
  328. }
  329. if (this.current == 1) {
  330. if (this.list1.length < this.paramList[1].total) {
  331. this.paramList[1].pageNum++;
  332. this.bankList();
  333. }
  334. }
  335. if (this.current == 2) {
  336. if (this.list1.length < this.paramList[2].total) {
  337. this.paramList[2].pageNum++;
  338. this.noteList();
  339. }
  340. }
  341. },
  342. sectionChange(index) {
  343. this.current = index;
  344. },
  345. //课程
  346. courseList() {
  347. var self = this;
  348. var param = this.paramList[0];
  349. this.$api.courselist(param).then(res => {
  350. self.paramList[0].total = res.data.total;
  351. self.list1.push.apply(self.list1, res.data.rows);
  352. if (self.list1.length === res.data.total) {
  353. self.paramList[0].showStatus = true;
  354. }
  355. });
  356. },
  357. //题库
  358. bankList() {
  359. var self = this;
  360. var param = this.paramList[1];
  361. this.$api.banklist(param).then(res => {
  362. self.paramList[1].total = res.data.total;
  363. self.list2.push.apply(self.list2, res.data.rows);
  364. if (self.list2.length === res.data.total) {
  365. self.paramList[1].showStatus = true;
  366. }
  367. });
  368. },
  369. //考试重点
  370. noteList() {
  371. var self = this;
  372. var param = this.paramList[2];
  373. this.$api.notelist(param).then(res => {
  374. self.paramList[2].total = res.data.total;
  375. self.list3.push.apply(self.list3, res.data.rows);
  376. if (self.list3.length === res.data.total) {
  377. self.paramList[2].showStatus = true;
  378. }
  379. });
  380. },
  381. jumpDetail(item) {
  382. if (this.current == 0) {
  383. this.$navTo.togo('/pages2/course/detail', {
  384. id: item.courseId
  385. });
  386. return;
  387. }
  388. if (this.current == 1) {
  389. this.$navTo.togo('/pages2/bank/detail', {
  390. id: item.bankId
  391. });
  392. return;
  393. }
  394. if (this.current == 2) {
  395. this.$navTo.togo('/pages2/course/keynote', {
  396. id: item.fileId
  397. });
  398. return;
  399. }
  400. },
  401. jumpPlan() {
  402. if(!this.$method.isLogin()){
  403. this.$navTo.togo('/pages/login/login');
  404. }else{
  405. this.$navTo.togo('/pages2/plan/detail', {});
  406. }
  407. },
  408. jumpSearch() {
  409. this.$navTo.togo('/pages2/index/search', {});
  410. }
  411. }
  412. };
  413. </script>
  414. <style scoped>
  415. .search {
  416. width: 40rpx;
  417. height: 40rpx;
  418. margin-left: 30rpx;
  419. }
  420. .slot-wrap {
  421. display: flex;
  422. align-items: center;
  423. }
  424. .popup_t1 {
  425. height: 29rpx;
  426. font-size: 30rpx;
  427. font-family: PingFang SC;
  428. font-weight: bold;
  429. color: #131b31;
  430. margin: 100rpx;
  431. }
  432. .price {
  433. font-size: 20rpx;
  434. font-family: PingFang SC;
  435. font-weight: bold;
  436. color: #ff0000;
  437. margin-top: 8rpx;
  438. }
  439. .old_price {
  440. font-size: 24rpx;
  441. font-family: PingFang SC;
  442. font-weight: bold;
  443. text-decoration: line-through;
  444. color: #999999;
  445. margin-top: 8rpx;
  446. }
  447. .list_title {
  448. font-size: 24rpx;
  449. font-family: PingFang SC;
  450. font-weight: bold;
  451. color: #2f4379;
  452. }
  453. .list_content {
  454. width: 656rpx;
  455. height: 134rpx;
  456. background: #ffffff;
  457. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  458. border-radius: 24rpx;
  459. position: absolute;
  460. top: 20rpx;
  461. left: 20rpx;
  462. }
  463. .list_box {
  464. position: relative;
  465. width: 100%;
  466. margin-top: 30rpx;
  467. }
  468. .list_img {
  469. width: 278rpx;
  470. height: 134rpx;
  471. z-index: 100;
  472. position: relative;
  473. }
  474. .course_title {
  475. color: #2f4379;
  476. box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(47, 67, 121, 0.1);
  477. border-radius: 28rpx;
  478. width: 100%;
  479. height: 48rpx;
  480. line-height: 48rpx;
  481. }
  482. .arr-icon {
  483. width: 40rpx;
  484. height: 40rpx;
  485. }
  486. .wrap {
  487. padding: 24rpx;
  488. }
  489. .u-row {
  490. margin: 40rpx 0;
  491. }
  492. .date_dot {
  493. width: 6rpx;
  494. height: 6rpx;
  495. background: #ffcc00;
  496. border-radius: 50%;
  497. margin: 0 auto;
  498. }
  499. .date_note {
  500. border-radius: 50%;
  501. width: 29rpx;
  502. height: 29rpx;
  503. border: 1px solid #ffcc00;
  504. font-size: 18rpx;
  505. color: #ffcc00;
  506. text-align: center;
  507. display: inline-block;
  508. position: absolute;
  509. top: -19rpx;
  510. right: 9rpx;
  511. }
  512. .circle_num {
  513. border-radius: 50%;
  514. width: 29rpx;
  515. height: 29rpx;
  516. border: 1px solid #ffcc00;
  517. font-size: 18rpx;
  518. color: #ffcc00;
  519. text-align: center;
  520. display: inline-block;
  521. margin: 5rpx;
  522. }
  523. .date_num {
  524. width: 14%;
  525. text-align: center;
  526. position: relative;
  527. display: inline-block;
  528. margin-top: 20rpx;
  529. }
  530. .date_num_color0 {
  531. color: #32467b;
  532. }
  533. .date_num_color1 {
  534. color: #34c759;
  535. }
  536. .date_num_color2 {
  537. color: #ff3b30;
  538. }
  539. .date_num_color3 {
  540. color: #ffffff;
  541. background-color: #ffcc00;
  542. border-radius: 50%;
  543. width: 40rpx;
  544. height: 40rpx;
  545. display: inline-block;
  546. }
  547. .card_date {
  548. width: 14%;
  549. text-align: center;
  550. color: #7f8caf;
  551. }
  552. page {
  553. background: #ffffff;
  554. font-size: 28rpx;
  555. }
  556. .calendar_card {
  557. width: 100%;
  558. background: #ffffff;
  559. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  560. border-radius: 22rpx;
  561. margin-top: 25rpx;
  562. padding-bottom: 15rpx;
  563. }
  564. .box {
  565. margin: 30rpx;
  566. }
  567. .my_swiper {
  568. box-shadow: 0rpx 20rpx 16rpx 4rpx rgba(47, 67, 121, 0.08);
  569. border-radius: 25rpx;
  570. }
  571. .calendar_card .card_box {
  572. height: 60rpx;
  573. line-height: 60rpx;
  574. margin-left: 40rpx;
  575. }
  576. .calendar_card .t1 {
  577. color: #7f8caf;
  578. font-size: 24rpx;
  579. }
  580. .calendar_card .t2 {
  581. font-size: 24rpx;
  582. font-family: PingFang SC;
  583. font-weight: bold;
  584. color: #32467b;
  585. margin: 0 10rpx;
  586. }
  587. .calendar_card .t3 {
  588. font-size: 30rpx;
  589. font-weight: bold;
  590. color: #32467b;
  591. text-shadow: 0rpx 3rpx 3rpx rgba(0, 0, 0, 0.2);
  592. margin: 0 10rpx;
  593. }
  594. .img_more {
  595. width: 26rpx;
  596. height: 26rpx;
  597. }
  598. </style>