home.vue 14 KB

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