index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <view class="index">
  3. <u-navbar :is-back="false" :border-bottom="false" title-color="#333333" back-icon-color="#ffffff">
  4. <view class="slot-wrap">
  5. <image src="/static/logo2.png"></image>
  6. </view>
  7. </u-navbar>
  8. <u-swiper :list="list" @change="e => current = e.current" :autoplay="false"></u-swiper>
  9. <view class="content">
  10. <view class="notice">
  11. <image src="/static/icon/msg_icon1.png" class="icon"></image>
  12. <view class="text">
  13. 您有2条新的通知
  14. </view>
  15. <view class="btn">立即查看</view>
  16. </view>
  17. <view>
  18. <!-- 日历-->
  19. <view class="calendar_card">
  20. <view class="card_box">
  21. <u-row gutter="16">
  22. <u-col span="11" v-if="false">
  23. <view>
  24. <text class="t1">距离</text>
  25. <text class="t2">二级建造师</text>
  26. <text class="t1">考试</text>
  27. <text class="t3">365</text>
  28. <text class="t1">天,继续加油哦!</text>
  29. </view>
  30. </u-col>
  31. <u-col offset="11" span="1">
  32. <view @click="jumpPlan"><image src="/static/more.png" class="img_more"></image></view>
  33. </u-col>
  34. </u-row>
  35. </view>
  36. <u-line color="#EEEEEE" />
  37. <view style="width: 100%;display: flex;justify-content:center;margin-top: 20rpx;">
  38. <view v-for="(item, index) in date" :key="index" class="card_date">{{ item }}</view>
  39. </view>
  40. <view style="width: 100%;display: flex;justify-content:center;margin-top: 40rpx;">
  41. <view v-for="(item, index) in date_num" :key="index" class="date_num">
  42. <view v-if="item.color == 0" class="date_num_color0" v-show="item.date > 0">
  43. {{ item.date }}
  44. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  45. <view v-if="item.dot" class="date_dot"></view>
  46. </view>
  47. <view v-if="item.color == 1" class="date_num_color1">
  48. {{ item.date }}
  49. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  50. <view v-if="item.dot" class="date_dot"></view>
  51. </view>
  52. <view v-if="item.color == 2" class="date_num_color2">
  53. {{ item.date }}
  54. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  55. <view v-if="item.dot" class="date_dot"></view>
  56. </view>
  57. <view v-if="item.color == 3" class="date_num_color3">
  58. {{ item.date }}
  59. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  60. <view v-if="item.dot" class="date_dot"></view>
  61. </view>
  62. </view>
  63. </view>
  64. <view style="width: 100%;margin-top: 20rpx;" v-if="workList.length > 0">
  65. <u-row gutter="16">
  66. <u-col span="2" text-align="center">
  67. <view><image src="/static/left.png" class="arr-icon" @click="preveItem"></image></view>
  68. </u-col>
  69. <u-col span="8" text-align="center">
  70. <view class="course_title" @click="jumpCourseDetail()">{{ workList[0].goodsName }}</view>
  71. </u-col>
  72. <u-col span="2" text-align="center">
  73. <view><image src="/static/right.png" class="arr-icon" @click="nextItem"></image></view>
  74. </u-col>
  75. </u-row>
  76. </view>
  77. </view>
  78. </view>
  79. <u-tabs class="tabs" :current="tabCurrent" @change="tab" :list="list1" :activeStyle="{fontSize:'36rpx'}" :inactiveStyle="{color:'#EAEEF1',fontSize:'30rpx'}" sticky></u-tabs>
  80. <view class="course-list">
  81. <view class="item" v-for="item in 3">
  82. <view class="img">
  83. <image src="/static/wd_bg_login.jpg"></image>
  84. <view class="time">2020</view>
  85. </view>
  86. <view class="text">
  87. <view class="title">施工现场专业人员岗位培训基础班(设备安装质量员)</view>
  88. <view class="desc">
  89. <view class="left">
  90. 60
  91. <text>学时</text>
  92. </view>
  93. <view class="right">¥ 999.00</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </template>
  101. <script>
  102. import { mapGetters } from 'vuex';
  103. export default {
  104. components: {},
  105. data() {
  106. return {
  107. list:[
  108. 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  109. 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  110. 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
  111. ],
  112. tabCurrent:0,
  113. date:['日','一','二','三','四','五','六'],
  114. date_num: [],
  115. current:0,
  116. indicatorDots: true,
  117. autoplay: true,
  118. interval: 2000,
  119. duration: 500,
  120. list1: [{
  121. name: '推荐课程',
  122. }, {
  123. name: '推荐题库',
  124. }],
  125. goodsIndex: 0,
  126. workList: [],
  127. workTextList: []
  128. };
  129. },
  130. onPullDownRefresh() {},
  131. onLoad(option) {
  132. this.init()
  133. },
  134. onShow() {
  135. /* if(this.current === 2 && this.$method.isLogin()){
  136. this.$refs.refMy.init();
  137. } */
  138. },
  139. onShareAppMessage(res) {
  140. var self = this;
  141. return {
  142. title: '中正',
  143. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  144. };
  145. },
  146. methods: {
  147. jumpPlan() {
  148. if (!this.$method.isLogin()) {
  149. this.$navTo.togo('/pages/login/login');
  150. } else {
  151. this.$navTo.togo('/pages2/plan/index', {});
  152. }
  153. },
  154. init() {
  155. if (!this.$method.isLogin()) {
  156. //未登录
  157. this.date_num = [];
  158. this.workList = [];
  159. this.initDay();
  160. } else {
  161. this.date_num = [];
  162. this.workList = [];
  163. this.userPlanSeven();
  164. }
  165. },
  166. getMonDate() {
  167. var d = new Date(),
  168. day = d.getDay(),
  169. date = d.getDate();
  170. if (day == 0) return d;
  171. else d.setDate(date - day);
  172. return d;
  173. },
  174. initDay() {
  175. // d是当前星期一的日期对象
  176. var d = this.getMonDate();
  177. var arr = [];
  178. let date = new Date();
  179. let num = date.getDate();
  180. for (var i = 0; i < 7; i++) {
  181. let item = { date: d.getDate() };
  182. item.color = 0;
  183. if (d.getDate() == num) {
  184. item.color = 3;
  185. }
  186. this.date_num.push(item);
  187. d.setDate(d.getDate() + 1);
  188. }
  189. },
  190. userPlanSeven() {
  191. let self = this;
  192. this.$api.userPlanSeven().then(result => {
  193. if (result.data.data.length>0) {
  194. self.workList = result.data.data[0].goodsVos;
  195. if (self.workList != null && self.workList.length > 0) {
  196. self.courseItem = self.workList[self.goodsIndex];
  197. }
  198. console.log(self.workList)
  199. let date = new Date();
  200. let num = date.getDate();
  201. let month = date.getMonth() + 1;
  202. let list = [];
  203. for (let i = 0; i < result.data.data[0].calendarStudyVo.length; i++) {
  204. let item = result.data.data[0].calendarStudyVo[i];
  205. if (item.month == month) {
  206. list = item.dayStudyList;
  207. }
  208. }
  209. for (let i = 0; i < list.length; i++) {
  210. let item = list[i];
  211. item.color = 0;
  212. if (item.date == num) {
  213. item.color = 3;
  214. }
  215. if (item.perform == 1) {
  216. item.color = 1;
  217. }
  218. if (item.perform == 2) {
  219. item.color = 2;
  220. }
  221. item.note = item.studyCourseKnob;
  222. if (item.note > 0) {
  223. item.dot = true;
  224. }
  225. self.date_num.push(item);
  226. }
  227. } else {
  228. self.initDay();
  229. }
  230. });
  231. },
  232. tab(e) {
  233. this.tabCurrent = e;
  234. },
  235. updateHomePlan() {
  236. this.$refs.home.init();
  237. },
  238. beforeSwitch(index) {
  239. let that = this;
  240. if (index == 1) {
  241. this.isClick1 = true;
  242. }
  243. if (index == this.current) {
  244. return false;
  245. }
  246. if (!this.$method.isLogin()) {
  247. if (index == 0 || index == 1) {
  248. return true;
  249. } else {
  250. this.$navTo.togo('/pages/login/login');
  251. return false;
  252. }
  253. } else {
  254. if (index == 2) {
  255. this.$refs.refMy.init();
  256. }
  257. return true;
  258. }
  259. }
  260. },
  261. onReachBottom() {},
  262. computed: { ...mapGetters(['userInfo']) }
  263. };
  264. </script>
  265. <style lang="scss" scoped>
  266. .index {
  267. .slot-wrap {
  268. width:100%;
  269. display: flex;
  270. align-items: center;
  271. justify-content: flex-end;
  272. image {
  273. margin-right:98rpx;
  274. width: 178rpx;
  275. height: 31rpx;
  276. }
  277. }
  278. .swiper {
  279. width:100%;
  280. image {
  281. width:100%;
  282. }
  283. .indicator__dot {
  284. background: rgba(255, 255, 255, 1);
  285. &.indicator__dot--active {
  286. background: rgba(0, 122, 255, 1);
  287. }
  288. }
  289. }
  290. .content {
  291. padding:16rpx;
  292. background: rgba(234, 238, 241, 1);
  293. .notice {
  294. padding:0 8rpx;
  295. height: 56rpx;
  296. background: linear-gradient(-90deg, rgba(255, 209, 0, 0.3), rgba(255, 255, 255, 0.3));
  297. border-radius: 16rpx;
  298. display: flex;
  299. align-items: center;
  300. .icon {
  301. width: 40rpx;
  302. height: 40rpx;
  303. margin-right: 8rpx;
  304. }
  305. .text {
  306. flex:1;
  307. font-size: 24rpx;
  308. color: #333333;
  309. }
  310. .btn {
  311. font-size: 24rpx;
  312. color: #007AFF;
  313. }
  314. }
  315. .date-list {
  316. margin-top:16rpx;
  317. width: 718rpx;
  318. height: 330rpx;
  319. background: #FFFFFF;
  320. border-radius: 16rpx;
  321. padding:18rpx 27rpx;
  322. .title {
  323. font-size: 30rpx;
  324. font-weight: bold;
  325. color: #007AFF;
  326. }
  327. .list {
  328. margin-top:40rpx;
  329. display: flex;
  330. justify-content: space-around;
  331. .item {
  332. .top {
  333. text-align: center;
  334. font-size: 26rpx;
  335. color: rgba(102, 102, 102, 0.6);
  336. }
  337. .bottom {
  338. text-align: center;
  339. line-height: 48rpx;
  340. margin-top:30rpx;
  341. width: 48rpx;
  342. height: 48rpx;
  343. border-radius: 50%;
  344. color:rgba(51, 51, 51, 1);
  345. font-size: 26rpx;
  346. position:relative;
  347. &.red {
  348. color:red;
  349. }
  350. &.green {
  351. color:green;
  352. }
  353. &.blue {
  354. background: #007AFF;
  355. color:#fff;
  356. }
  357. .note {
  358. width: 30rpx;
  359. height: 30rpx;
  360. border: 2rpx solid #FF9500;
  361. border-radius: 50%;
  362. position:absolute;
  363. top:-20rpx;
  364. right:-20rpx;
  365. line-height: 28rpx;
  366. text-align: center;
  367. color:#FF9500;
  368. font-size: 26rpx;
  369. }
  370. .point {
  371. margin:0 auto;
  372. width: 8rpx;
  373. height: 8rpx;
  374. background: #FF9500;
  375. border-radius: 50%;
  376. }
  377. }
  378. }
  379. }
  380. .btns {
  381. margin-top:50rpx;
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. .left,.right {
  386. width: 40rpx;
  387. height: 40rpx;
  388. }
  389. .center{
  390. width: 440rpx;
  391. height: 56rpx;
  392. background: #FFFFFF;
  393. box-shadow: 0px 0px 9rpx 1rpx rgba(47, 67, 121, 0.1);
  394. border-radius: 28rpx;
  395. color:rgba(255, 149, 0, 1);
  396. line-height: 56rpx;
  397. text-align: center;
  398. font-size: 30rpx;
  399. margin:0 30rpx;
  400. }
  401. }
  402. }
  403. .tabs {
  404. /deep/ .u-tabs {
  405. background:none!important;
  406. }
  407. }
  408. .course-list {
  409. background:#fff;
  410. padding:0 8rpx;
  411. box-shadow: 0px 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  412. border-radius: 16rpx ;
  413. .item {
  414. padding:8rpx 0;
  415. border-bottom:1rpx solid #eeeeee;
  416. display: flex;
  417. .img {
  418. position:relative;
  419. margin-right:10rpx;
  420. border-radius: 16rpx ;
  421. overflow: hidden;
  422. width: 320rpx;
  423. height: 155rpx;
  424. image {
  425. width:100%;
  426. height:100%;
  427. }
  428. .time {
  429. position:absolute;
  430. bottom:0;
  431. right:0;
  432. width: 80rpx;
  433. height: 32rpx;
  434. background: rgba(1, 25, 45, 0.4);
  435. color:#fff;
  436. text-align: center;
  437. line-height: 32rpx;
  438. font-size: 24rpx;
  439. border-radius: 10rpx 0px 10rpx 0px;
  440. }
  441. }
  442. .text {
  443. flex:1;
  444. padding-right:10rpx;
  445. .title {
  446. font-size: 30rpx;
  447. color: #333333;
  448. }
  449. .desc {
  450. margin-top:40rpx;
  451. display: flex;
  452. .left {
  453. flex:1;
  454. color:#333;
  455. font-size: 26rpx;
  456. text {
  457. font-size: 24rpx;
  458. color:#999;
  459. }
  460. }
  461. .right {
  462. font-size: 24rpx;
  463. font-weight: bold;
  464. color: #FF2D55;
  465. }
  466. }
  467. }
  468. }
  469. }
  470. }
  471. }
  472. .date_dot {
  473. width: 6rpx;
  474. height: 6rpx;
  475. background: #ffcc00;
  476. border-radius: 50%;
  477. margin: 0 auto;
  478. }
  479. .date_note {
  480. border-radius: 50%;
  481. width: 29rpx;
  482. height: 29rpx;
  483. border: 1px solid #ffcc00;
  484. font-size: 18rpx;
  485. color: #ffcc00;
  486. text-align: center;
  487. display: inline-block;
  488. position: absolute;
  489. top: -19rpx;
  490. right: 9rpx;
  491. }
  492. .circle_num {
  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. margin: 5rpx;
  502. }
  503. .date_num {
  504. width: 14%;
  505. text-align: center;
  506. position: relative;
  507. display: inline-block;
  508. margin-top: 20rpx;
  509. }
  510. .course_title {
  511. color: #2f4379;
  512. box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(47, 67, 121, 0.1);
  513. border-radius: 28rpx;
  514. width: 100%;
  515. height: 48rpx;
  516. line-height: 48rpx;
  517. overflow: hidden;
  518. text-overflow:ellipsis;
  519. white-space: nowrap;
  520. }
  521. .arr-icon {
  522. width: 40rpx;
  523. height: 40rpx;
  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. background: #ffffff;
  554. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  555. border-radius: 22rpx;
  556. margin-top: 25rpx;
  557. padding-bottom: 15rpx;
  558. }
  559. .calendar_card .card_box {
  560. height: 60rpx;
  561. line-height: 60rpx;
  562. margin-left: 40rpx;
  563. }
  564. .calendar_card .t1 {
  565. color: #7f8caf;
  566. font-size: 24rpx;
  567. }
  568. .calendar_card .t2 {
  569. font-size: 24rpx;
  570. font-family: PingFang SC;
  571. font-weight: bold;
  572. color: #32467b;
  573. margin: 0 10rpx;
  574. }
  575. .calendar_card .t3 {
  576. font-size: 30rpx;
  577. font-weight: bold;
  578. color: #32467b;
  579. text-shadow: 0rpx 3rpx 3rpx rgba(0, 0, 0, 0.2);
  580. margin: 0 10rpx;
  581. }
  582. .img_more {
  583. width: 26rpx;
  584. height: 26rpx;
  585. }
  586. .flex-d {
  587. display: flex;
  588. flex-direction: column;
  589. justify-content: space-between;
  590. height: 100%;
  591. }
  592. .contentZ {
  593. flex: 1;
  594. overflow-y: auto;
  595. padding-left: 35rpx;
  596. display: flex;
  597. justify-content: space-around;
  598. }
  599. .contentZ::-webkit-scrollbar {
  600. display: none;
  601. }
  602. .fots {
  603. height: 100rpx;
  604. display: flex;
  605. align-items: center;
  606. justify-content: space-around;
  607. border-top: 1rpx solid #eee;
  608. }
  609. .leftBtns {
  610. font-size: 30rpx;
  611. color: #32467b;
  612. font-weight: 500;
  613. }
  614. .right_Btns {
  615. font-size: 30rpx;
  616. color: #fff;
  617. background-color: #32467b;
  618. border-radius: 24rpx;
  619. height: 60rpx;
  620. line-height: 60rpx;
  621. text-align: center;
  622. padding: 0rpx 23rpx;
  623. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  624. }
  625. .lzs {
  626. width: 31%;
  627. margin: 0rpx 1%;
  628. max-width: 31%;
  629. }
  630. .tylsz{
  631. margin-top: 23rpx;
  632. color: #666;
  633. font-weight: 400;
  634. font-size: 24rpx;
  635. }
  636. .tylsz:first-child{
  637. text-align: center;
  638. }
  639. .activeStys{
  640. font-weight: bold;
  641. color: #32467B;
  642. }
  643. </style>