lesson.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <template>
  2. <div class="pages">
  3. <img src="../static/images/main/banner.png" height="121" width="414"/>
  4. <h5 class="lessonName">
  5. {{ lessonName }}
  6. </h5>
  7. <!--<mu-tabs :value.sync="active" color="#F2F2F2" indicator-color="#33CAF7" v-if="reFresh">-->
  8. <!--<mu-tab v-for="(day,i) in weeks">{{ day.name }} <br> <em>{{ day.data }}</em></mu-tab>-->
  9. <!--</mu-tabs>-->
  10. <div class="tabs">
  11. <div :class="[{'tab':true},{'activeTab':i == active}]" v-for="(day,i) in weeks" @click="changeActive(i)">
  12. {{ day.name }} <br> <em>{{ day.data }}</em>
  13. </div>
  14. </div>
  15. <bottomTab :curTab="thisTab"></bottomTab>
  16. <div class="context">
  17. <ul class="list">
  18. <li v-for="(l,index) in previewDate"
  19. :style="{background:l.ClassColor}"
  20. >
  21. <em>
  22. {{ l.BeginStr }} - {{ l.EndStr }}
  23. </em>
  24. <span>
  25. {{ l.ClassName }}
  26. </span>
  27. </li>
  28. </ul>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import axios from 'axios';
  34. import bottomTab from '../components/bottomTab'
  35. import {
  36. SchoolTimeQueryByDate,
  37. QueryNextWeek,
  38. } from '../api/getApiRes.js'
  39. let qs = require('qs');
  40. import Global from '../Global.js'
  41. export default {
  42. data() {
  43. return {
  44. lessonName: '本周课程表',
  45. num: 0,
  46. thisTab: '预约课程',
  47. active: 0,
  48. sum: 0,
  49. openAlert: false,
  50. reFresh: true,
  51. list: [],
  52. previewDate: [],
  53. weeks: [],
  54. dialog: {
  55. id: '',
  56. name: '',
  57. timeLong: '',
  58. },
  59. }
  60. },
  61. mounted() {
  62. this.getQueryNextWeek();
  63. },
  64. beforeRouteEnter(to, from, next) {
  65. next(vm => {
  66. //因为当钩子执行前,组件实例还没被创建
  67. // vm 就是当前组件的实例相当于上面的 this,所以在 next 方法里你就可以把 vm 当 this 来用了。
  68. if (to.name == 'appoint') {
  69. this.getQueryNextWeek();
  70. }
  71. });
  72. },
  73. watch: {
  74. '$route'(to) {
  75. if (to.name == 'lesson') {
  76. this.getQueryNextWeek();
  77. }
  78. },
  79. 'active'() {
  80. this.getList();
  81. }
  82. },
  83. methods: {
  84. changeActive(i) {
  85. this.active = i;
  86. },
  87. getQueryNextWeek() {
  88. console.log(333);
  89. let that = this;
  90. let param = {
  91. token: localStorage.token,
  92. shopId: this.$route.query.shopId,
  93. };
  94. let postdata = qs.stringify(param);
  95. this.weeks = [];
  96. QueryNextWeek(postdata).then(res => {
  97. let json = res;
  98. if (json.Code == 0) {
  99. this.HaveDays = json.Rs;
  100. this.getFurtherDays(json.Rs);
  101. } else {
  102. that.list = [];
  103. that.$message.error(json.Memo);
  104. }
  105. })
  106. },
  107. // 获取未来7天的
  108. getFurtherDays(HaveDays) {
  109. let now = new Date();
  110. let nowTime = now.getTime();
  111. let oneDayTime = 24 * 60 * 60 * 1000;
  112. let days = '';
  113. let item = [];
  114. let month = 0;
  115. let day = 0;
  116. this.weeks = [];
  117. for (let i = 0; i < HaveDays; i++) {
  118. days = new Date(nowTime + (i) * oneDayTime);//显示周日
  119. month = days.getMonth() + 1;
  120. day = days.getDate();
  121. month = month < 10 ? '0' + month : month;
  122. day = day < 10 ? '0' + day : day;
  123. item = {
  124. name: this.numberToWeek(days.getDay()),
  125. data: days.getMonth() + 1 + '月' + days.getDate() + '日',
  126. orderDate: days.getFullYear() + '-' + month + '-' + day
  127. };
  128. this.weeks.push(item);
  129. }
  130. this.today = this.weeks[0].name;
  131. this.getList();
  132. },
  133. numberToWeek(val) {
  134. switch (parseInt(val)) {
  135. case 1:
  136. return '星期一';
  137. break;
  138. case 2:
  139. return '星期二';
  140. break;
  141. case 3:
  142. return '星期三';
  143. break;
  144. case 4:
  145. return '星期四';
  146. break;
  147. case 5:
  148. return '星期五';
  149. break;
  150. case 6:
  151. return '星期六';
  152. break;
  153. case 0:
  154. return '星期天';
  155. break;
  156. }
  157. },
  158. getList() {
  159. let that = this;
  160. let param = {
  161. token: localStorage.token,
  162. shopId: this.$route.query.shopId,
  163. queryDate: that.weeks[that.active].orderDate,//(字符串 年-月-日 格式)
  164. };
  165. let postdata = qs.stringify(param);
  166. that.previewDate = [];
  167. SchoolTimeQueryByDate(postdata).then(res => {
  168. let json = res;
  169. if (json.Code == 0) {
  170. // that.BigTitle = row.Name;
  171. // that.smallTitle = row.BeginDate + '至' + row.EndDate;
  172. that.previewDate = json.Rs;
  173. // 前台排序
  174. that.previewDate.sort((a, b) => a.ClassIndex - b.ClassIndex);//升序
  175. that.previewShow = true;
  176. } else {
  177. that.$message.error(json.Memo);
  178. }
  179. })
  180. },
  181. },
  182. components: {
  183. bottomTab
  184. }
  185. }
  186. </script>
  187. <style scoped>
  188. .pages {
  189. overflow: hidden;
  190. display: block;
  191. margin: 0 auto;
  192. }
  193. .lessonName {
  194. width: 100%;
  195. height: 40px;
  196. overflow: hidden;
  197. display: block;
  198. margin: 0 auto;
  199. text-align: center;
  200. font-size: 18px;
  201. }
  202. /*mu-header*/
  203. .mu-primary-color {
  204. line-height: 60px;
  205. height: 60px;
  206. background: url("../static/images/comm/headerBg.png") top center no-repeat;
  207. background-size: 100%;
  208. }
  209. /deep/ .mu-appbar-left {
  210. padding-top: 15px;
  211. }
  212. /deep/ .material-icons {
  213. color: #fff;
  214. }
  215. /deep/ .mu-appbar-title {
  216. text-align: center;
  217. }
  218. /deep/ .mu-tabs {
  219. display: flex;
  220. overflow-x: scroll;
  221. float: left;
  222. }
  223. /deep/ .mu-tab {
  224. width: 85px;
  225. min-width: 85px;
  226. float: left;
  227. height: 51px;
  228. margin-right: 6px;
  229. }
  230. /*/deep/ .mu-tab:nth-child(5) {*/
  231. /* margin-right: 0px;*/
  232. /*}*/
  233. /deep/ .mu-tab-wrapper {
  234. height: 51px;
  235. background: #fff;
  236. color: #363636;
  237. box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.16);
  238. border-radius: 8px 8px 0px 0px;
  239. font-size: 14px;
  240. }
  241. /deep/ .mu-tab-active .mu-tab-wrapper {
  242. height: 56px;
  243. border-radius: 8px 8px 0px 0px;
  244. background: #33caf7;
  245. box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.16);
  246. color: #fff;
  247. }
  248. /deep/ .mu-tab-wrapper em {
  249. font-size: 12px;
  250. }
  251. .sum {
  252. width: 100%;
  253. height: 55px;
  254. line-height: 55px;
  255. background: #fff;
  256. font-family: "PingFang SC";
  257. font-weight: 300;
  258. font-size: 16px;
  259. text-align: center;
  260. color: #909090;
  261. overflow: hidden;
  262. display: block;
  263. margin: 0 auto;
  264. }
  265. .green {
  266. color: #37CB00;
  267. }
  268. .red {
  269. color: #F8847F;
  270. }
  271. .list {
  272. width: 100%;
  273. overflow: hidden;
  274. display: block;
  275. margin: 0 auto;
  276. margin-top: 8px;
  277. padding-bottom: 30px;
  278. border-top: 5px solid #fff;
  279. }
  280. .list li {
  281. width: 100%;
  282. height: 50px;
  283. margin: 0;
  284. border-bottom: 1px solid #fff;
  285. list-style: none;
  286. line-height: 50px;
  287. /*padding-top: 16px;*/
  288. /*padding-bottom: 16px;*/
  289. }
  290. li em {
  291. width: 50%;
  292. float: left;
  293. padding-left: 10%;
  294. /*height: 40px;*/
  295. /*line-height: 40px;*/
  296. overflow: hidden;
  297. border-right: 1px solid #fff;
  298. color: #333;
  299. /*font-size: 16px;*/
  300. }
  301. li span {
  302. width: 45%;
  303. float: right;
  304. padding-left: 3px;
  305. /*height: 40px;*/
  306. /*line-height: 40px;*/
  307. overflow: hidden;
  308. text-align: center;
  309. color: #333;
  310. /*font-size: 16px;*/
  311. }
  312. .list .dotContainer {
  313. width: 50px;
  314. float: left;
  315. height: 60px;
  316. padding-left: 22px;
  317. padding-top: 10px;
  318. }
  319. .dotContainer .dot {
  320. width: 12px;
  321. height: 12px;
  322. background: #37cb00;
  323. border-radius: 250px;
  324. float: left;
  325. }
  326. .cubes {
  327. width: 12px;
  328. height: 12px;
  329. background: #f8847f;
  330. float: left;
  331. }
  332. .tri {
  333. width: 12px;
  334. height: 12px;
  335. background: url("../static/images/appoint/tri.png") top center no-repeat;
  336. background-size: 100% 100%;
  337. float: left;
  338. }
  339. .x {
  340. width: 12px;
  341. height: 12px;
  342. background: url("../static/images/appoint/x.png") top center no-repeat;
  343. background-size: 100% 100%;
  344. float: left;
  345. }
  346. .yellowLi {
  347. background: #FFFBED;
  348. }
  349. .redLi {
  350. background: #FFF7F7;
  351. }
  352. .greenLi {
  353. background: #F7FFF4;
  354. }
  355. .whiteLi {
  356. background: #fff;
  357. }
  358. .list li .title {
  359. width: 90px;
  360. height: 60px;
  361. float: left;
  362. }
  363. li .title h5 {
  364. width: 100%;
  365. overflow: hidden;
  366. display: block;
  367. margin: 0 auto;
  368. font-weight: normal;
  369. font-size: 14px;
  370. text-align: left;
  371. color: #3b3b3b;
  372. }
  373. li .title span {
  374. width: 100%;
  375. overflow: hidden;
  376. display: block;
  377. margin: 0 auto;
  378. font-weight: normal;
  379. font-size: 12px;
  380. text-align: left;
  381. color: #909090;
  382. }
  383. .list li .current {
  384. width: 120px;
  385. height: 60px;
  386. float: left;
  387. }
  388. li .current h5 {
  389. width: 100%;
  390. overflow: hidden;
  391. display: block;
  392. margin: 0 auto;
  393. font-family: "PingFang SC";
  394. font-weight: normal;
  395. font-size: 14px;
  396. text-align: left;
  397. color: #3b3b3b;
  398. }
  399. .current h5 em {
  400. font-family: "PingFang SC";
  401. font-weight: normal;
  402. font-size: 14px;
  403. text-align: left;
  404. }
  405. .current span {
  406. font-family: "PingFang SC";
  407. font-weight: normal;
  408. font-size: 12px;
  409. text-align: left;
  410. color: #909090;
  411. }
  412. .appointBtn {
  413. width: 79px;
  414. height: 37px;
  415. border-radius: 18.5px;
  416. background: #fff;
  417. float: right;
  418. font-family: "PingFang SC";
  419. font-weight: normal;
  420. font-size: 18px;
  421. margin-right: 2%;
  422. }
  423. .greenBtn {
  424. border: 1px solid #37cb00;
  425. color: #37cb00;
  426. }
  427. .redBtn {
  428. border: 1px solid #F8847F;
  429. color: #F8847F;
  430. }
  431. .yellowBtn {
  432. border: 1px solid #FFB43C;
  433. color: #fff;
  434. background: #FFB43C;
  435. }
  436. .disableBtn {
  437. border: 1px solid #C9C9C9;
  438. color: #C9C9C9;
  439. }
  440. /deep/ .mu-tabs-center {
  441. display: flex;
  442. overflow-x: auto;
  443. overflow-y: hidden;
  444. white-space: nowrap;
  445. }
  446. /deep/ .mu-tabs-center::-webkit-scrollbar {
  447. display: none;
  448. }
  449. /deep/ .mu-modal-inner {
  450. width: 90%;
  451. float: left;
  452. }
  453. /deep/ .mu-tab-link-highlight {
  454. display: none !important;
  455. }
  456. li .title span.lessons {
  457. width: auto;
  458. padding: 1px 11px;
  459. border-radius: 250px;
  460. float: left;
  461. text-align: center;
  462. color: #000;
  463. font-size: 14px;
  464. }
  465. /deep/ .mu-avatar {
  466. position: fixed;
  467. bottom: 10%;
  468. float: right;
  469. right: 10%;
  470. }
  471. .tabs {
  472. width: 100%;
  473. justify-content: space-between;
  474. white-space: nowrap;
  475. overflow-y: hidden;
  476. overflow-x: scroll;
  477. display: flex;
  478. border-bottom: 1px solid #ccc;
  479. }
  480. .tab {
  481. font-size: 14px;
  482. min-width: 72px;
  483. max-width: 264px;
  484. background: none;
  485. -webkit-appearance: none;
  486. -moz-appearance: none;
  487. appearance: none;
  488. text-decoration: none;
  489. border: none;
  490. outline: none;
  491. color: inherit;
  492. position: relative;
  493. line-height: normal;
  494. -webkit-transition: all .45s cubic-bezier(.445, .05, .55, .95);
  495. transition: all .45s cubic-bezier(.445, .05, .55, .95);
  496. width: 85px;
  497. float: left;
  498. height: 51px;
  499. margin-right: 6px;
  500. cursor: pointer;
  501. line-height: 20px;
  502. padding-top: 4px;
  503. text-align: center;
  504. border-top-left-radius: 5px;
  505. border-top-right-radius: 5px;
  506. border: 1px solid #ccc;
  507. border-bottom: 0;
  508. }
  509. .tab.activeTab {
  510. color: #fff;
  511. background-color: #2196f3;
  512. color: hsla(0, 0%, 100%, .7);
  513. }
  514. @media only screen and (max-width: 640px) {
  515. }
  516. @media only screen and (max-width: 480px) {
  517. }
  518. @media only screen and (max-width: 375px) {
  519. }
  520. @media only screen and (max-width: 360px) {
  521. }
  522. @media only screen and (max-width: 320px) {
  523. .list .dotContainer {
  524. width: 20px;
  525. padding-left: 5px;
  526. }
  527. .list li .title {
  528. width: 85px;
  529. }
  530. }
  531. @media only screen and (min-width: 641px) {
  532. }
  533. </style>