home.vue 14 KB

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