homePage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <template>
  2. <view>
  3. <view class="navigation">
  4. 启航教培管家·教师端
  5. </view>
  6. <!-- 课时信息 -->
  7. <view class="class-infos-box">
  8. <view class="title">
  9. <view class="campus">
  10. 青少年宫校区
  11. </view>
  12. <view class="cut">
  13. 切换校区
  14. <view class="img">
  15. <img src="../../../assets/img/riLine-exchange-line@1x.png" alt="">
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 详细信息 -->
  20. <view class="main">
  21. <view class="time">
  22. <u-picker mode="time" v-model="show" :params="params" :defaultTime="defaultTime" @confirm="confirm">
  23. </u-picker>
  24. <view class="show" @click="show = true">
  25. <view class="text">
  26. {{teachTime}}
  27. </view>
  28. <view class="icon">
  29. <u-icon name="arrow-down" color="#fff" size="32"></u-icon>
  30. </view>
  31. </view>
  32. <!-- <view class="select" v-show="show">
  33. 2023年1月
  34. </view> -->
  35. </view>
  36. <!-- <view class="time">
  37. <view class="week" v-for="(item,index) in list" :key="index"
  38. :class="activeClass == index ? 'day' : ''" @click="activeClassClick(item,index)">{{item.name}}
  39. </view>
  40. </view> -->
  41. <!-- <view class="date" v-if="activeClass == 0">
  42. ({{day.replaceAll('-','.')}})
  43. </view> -->
  44. <view class="date" v-if="activeClass == 1">
  45. ({{weekStartDate.replaceAll('-','.')}}-{{weekEndDate.replaceAll('-','.')}})
  46. </view>
  47. <view class="date" v-if="activeClass == 2">
  48. ({{monthStartDate.replaceAll('-','.')}}-{{monthEndDate.replaceAll('-','.')}})
  49. </view>
  50. <view class="infos">
  51. <view class="infos-item">
  52. <view class="content">
  53. {{courseRpt.chargeNum != null ? courseRpt.chargeNum : 0}}
  54. </view>
  55. <view class="infos-name">
  56. 收费课时
  57. </view>
  58. </view>
  59. <u-line color="#E5E7EA" direction="col" length="80" />
  60. <view class="infos-item">
  61. <view class="content">
  62. {{courseRpt.freeNum != null ? courseRpt.freeNum : 0}}
  63. </view>
  64. <view class="infos-name">
  65. 赠送课时
  66. </view>
  67. </view>
  68. <u-line color="#E5E7EA" direction="col" length="80" />
  69. <view class="infos-item">
  70. <view class="content">
  71. {{courseRpt.makeupNum != null ? courseRpt.makeupNum : 0}}
  72. </view>
  73. <view class="infos-name">
  74. 补课课时
  75. </view>
  76. </view>
  77. <view class="infos-item">
  78. <view class="content">
  79. {{rollcallRpt.shouldNum != null ? rollcallRpt.shouldNum : 0}}
  80. </view>
  81. <view class="infos-name">
  82. 应到人次
  83. </view>
  84. </view>
  85. <u-line color="#E5E7EA" direction="col" length="80" />
  86. <view class="infos-item">
  87. <view class="content">
  88. {{rollcallRpt.realNum != null ? rollcallRpt.realNum : 0}}
  89. </view>
  90. <view class="infos-name">
  91. 实到人次
  92. </view>
  93. </view>
  94. <u-line color="#E5E7EA" direction="col" length="80" />
  95. <view class="infos-item">
  96. <view class="content">
  97. {{rollcallRpt.shouldNum-rollcallRpt.realNum}}
  98. </view>
  99. <view class="infos-name">
  100. 未到/请假
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <!-- 最近课程 -->
  107. <view class="course" v-if="courseList.length != 0">
  108. <view class="title">
  109. <img src="../../../assets/img/riFill-calendar-todo-fill@1x.png" alt="">最近课程
  110. </view>
  111. <view class="course-infos">
  112. <view class="info-box" v-for="(item,index) in courseList" :key="index"
  113. @click="gotoUrl('pages/teacher/myCourse/CourseDetails?id=' + item.sheetId)">
  114. <view class="position today" v-if="item.courseDate == day">
  115. </view>
  116. <view class="position tomorrow" v-if="item.courseDate == tomorrow">
  117. </view>
  118. <view class="class-name">
  119. {{item.className}}
  120. </view>
  121. <view class="location-time">
  122. <view class="location" style="width: 50%;">
  123. {{item.classroomName}}
  124. </view>
  125. <view class="time">
  126. {{item.coursePeriods}}
  127. </view>
  128. </view>
  129. <view class="date">
  130. {{item.courseDate}}
  131. </view>
  132. </view>
  133. <!-- <view class="info-box info-box2">
  134. <view class="position tomorrow">
  135. </view>
  136. <view class="class-name">
  137. 周开琴书法班2
  138. </view>
  139. <view class="location-time">
  140. <view class="location">
  141. 4楼6教室
  142. </view>
  143. <view class="time">
  144. 09:30-10:45
  145. </view>
  146. </view>
  147. <view class="date">
  148. 2023.1.3
  149. </view>
  150. </view> -->
  151. </view>
  152. </view>
  153. <!-- 我的应用 -->
  154. <view class="my-app">
  155. <view class="title">
  156. <img src="../../../assets/img/riFill-stack-fill@1x.png" alt="">我的应用
  157. </view>
  158. <view class="app-items">
  159. <!-- <view class="item" @click="gotoUrl('pages/teacher/message/messageNotification')">
  160. <view class="icon-box"
  161. style="background: linear-gradient(180deg, rgba(89,222,232,1) 1%,rgba(13,186,199,1) 100%)">
  162. <img src="../../../assets/img/riFill-notification-3-fill@1x.png" alt="">
  163. <view class="count">
  164. 99+
  165. </view>
  166. </view>
  167. <view class="text">
  168. 消息通知
  169. </view>
  170. </view> -->
  171. <view class="item" @click="gotoUrl('pages/teacher/myCourse/myCourse')">
  172. <view class="icon-box"
  173. style="background: linear-gradient(180deg, rgba(91,160,242,1) 1%,rgba(26,118,226,1) 100%);">
  174. <img src="../../../assets/img/riFill-calendar-2-fill@1x.png" alt="">
  175. </view>
  176. <view class="text">
  177. 我的课表
  178. </view>
  179. </view>
  180. <view class="item" @click="gotoUrl('pages/teacher/callNames/callNames')">
  181. <view class="icon-box"
  182. style="background: linear-gradient(180deg, rgba(255,189,96,1) 1%,rgba(255,150,0,1) 100%);">
  183. <img src="../../../assets/img/riFill-file-edit-fill@1x.png" alt="">
  184. </view>
  185. <view class="text">
  186. 点名签到
  187. </view>
  188. </view>
  189. <view class="item" @click="gotoUrl('pages/teacher/myClass/myClass')">
  190. <view class="icon-box"
  191. style="background: linear-gradient(180deg, rgba(169,147,255,1) 1%,rgba(129,97,255,1) 100%);">
  192. <img src="../../../assets/img/riFill-calendar-2-fill@1x.png" alt="">
  193. </view>
  194. <view class="text">
  195. 班级信息
  196. </view>
  197. </view>
  198. <view class="item" @click="gotoUrl('pages/teacher/makeUpAttendance/record')">
  199. <view class="icon-box"
  200. style="background: linear-gradient(180deg, rgba(169,147,255,1) 1%,rgba(129,97,255,1) 100%);">
  201. <img src="../../../assets/img/riFill-edit-box-fill@1x.png" alt="">
  202. </view>
  203. <view class="text">
  204. 补课
  205. </view>
  206. </view>
  207. <!-- <view class="item">
  208. <view class="icon-box"
  209. style="background: linear-gradient(180deg, rgba(89,222,232,1) 1%,rgba(13,186,199,1) 100%);">
  210. <img src="../../../assets/img/riFill-quill-pen-fill@1x.png" alt="">
  211. </view>
  212. <view class="text">
  213. 学员点评
  214. </view>
  215. </view> -->
  216. <!-- <view class="item">
  217. <view class="icon-box"
  218. style="background: linear-gradient(180deg, rgba(255,189,96,1) 1%,rgba(255,150,0,1) 100%);">
  219. <img src="../../../assets/img/riFill-star-fill@1x.png" alt="">
  220. </view>
  221. <view class="text">
  222. 学员秀
  223. </view>
  224. </view> -->
  225. <!-- <view class="item" @click="gotoUrl('pages/teacher/leaveApproval/leaveApproval')">
  226. <view class="icon-box"
  227. style="background: linear-gradient(180deg, rgba(91,160,242,1) 1%,rgba(26,118,226,1) 100%);">
  228. <img src="../../../assets/img/riFill-todo-fill@1x.png" alt="">
  229. <view class="count" v-if="leaveList.length != 0">
  230. {{leaveList.length > 10 ? '10+' : leaveList.length}}
  231. </view>
  232. </view>
  233. <view class="text">
  234. 请假审批
  235. </view>
  236. </view> -->
  237. </view>
  238. </view>
  239. <Tabbar :current="0" ref="tabbarMain"></Tabbar>
  240. </view>
  241. </template>
  242. <script>
  243. import * as homePageApi from '@/apis/teacher/homePage.js'
  244. import * as leaveApprovalApi from '@/apis/teacher/leaveApproval.js'
  245. import Tabbar from '@/components/Tabbar.vue'
  246. export default {
  247. components: {
  248. Tabbar
  249. },
  250. data() {
  251. return {
  252. leaveList: [],
  253. courseRpt: {
  254. chargeNum: 0,
  255. freeNum: 0,
  256. makeupNum: 0
  257. },
  258. rollcallRpt: {
  259. realNum: 0,
  260. shouldNum: 0
  261. },
  262. rptMonth: '',
  263. teachTime: '',
  264. defaultTime: '',
  265. params: {
  266. year: true,
  267. month: true,
  268. day: false,
  269. hour: false,
  270. minute: false,
  271. second: false,
  272. timestamp: true
  273. },
  274. show: false,
  275. list: [{
  276. name: '今日'
  277. }, {
  278. name: '本周'
  279. }, {
  280. name: '本月',
  281. }],
  282. activeClass: 0,
  283. month: '',
  284. day: '',
  285. weekStartDate: '',
  286. weekEndDate: '',
  287. monthStartDate: '',
  288. monthEndDate: '',
  289. courseList: [],
  290. tomorrow: '',
  291. }
  292. },
  293. onReady() {
  294. this.getDateList();
  295. this.getLatelyCourseList();
  296. this.getRptMyMonthCourse();
  297. },
  298. onShow() {
  299. this.getLoadLeaveLogForAudit();
  300. },
  301. methods: {
  302. getLoadLeaveLogForAudit() {
  303. uni.showLoading({
  304. title: "加载中",
  305. mask: true,
  306. })
  307. leaveApprovalApi.loadLeaveLogForAudit({
  308. auditedIf: 0,
  309. yyyyMM: '',
  310. pageNum: 1,
  311. pageSize: 10000
  312. }).then((res) => {
  313. uni.hideLoading();
  314. this.leaveList = res.data.data;
  315. }).catch(error => {
  316. uni.showToast({
  317. title: error,
  318. icon: "none"
  319. })
  320. })
  321. },
  322. getRptMyMonthCourse() {
  323. uni.showLoading({
  324. title: "加载中",
  325. mask: true,
  326. })
  327. homePageApi.rptMyMonthCourse({
  328. rptMonth: this.rptMonth
  329. }).then((response) => {
  330. uni.hideLoading();
  331. if(response.data.courseRpt != null) {
  332. this.courseRpt = response.data.courseRpt;
  333. }
  334. if(response.data.rollcallRpt != null) {
  335. this.rollcallRpt = response.data.rollcallRpt;
  336. }
  337. }).catch(error => {
  338. uni.showToast({
  339. title: error,
  340. icon: "none"
  341. })
  342. })
  343. },
  344. confirm(params) {
  345. var month = '';
  346. if (params.month.slice(0, 1) == '0') {
  347. month = params.month.slice(1);
  348. } else {
  349. month = params.month;
  350. }
  351. this.teachTime = params.year + '年' + month + '月';
  352. this.rptMonth = params.year + '-' + params.month;
  353. this.getRptMyMonthCourse();
  354. },
  355. getDateList() {
  356. let date = new Date() //当前日期
  357. let year = date.getFullYear(); //当前年
  358. let month = date.getMonth() + 1; //当前月
  359. let day = date.getDate(); //当天
  360. let mydate = new Date(year, month - 1, day);
  361. let weekday = mydate.getDay();
  362. let weekDate1 = new Date(year, month - 1, day + 1 - weekday);
  363. let weekDate2 = new Date(year, month - 1, day + 7 - weekday);
  364. this.day = this.getFormatDate(date, true);
  365. this.tomorrow = this.getFormatDate(new Date(date.setDate(date.getDate() + 1)), true);
  366. console.log(this.tomorrow)
  367. this.weekStartDate = this.getFormatDate(weekDate1, true);
  368. this.weekEndDate = this.getFormatDate(weekDate2, true);
  369. this.monthStartDate = this.getFormatDate(date, false) + "-" + '01';
  370. let days = new Date(year, month + 1, 0).getDate();
  371. this.monthEndDate = this.getFormatDate(date, false) + "-" + days;
  372. this.defaultTime = this.getFormatDate(date, true);
  373. this.teachTime = year + '年' + month + '月';
  374. this.rptMonth = this.getFormatDate(date, false);
  375. },
  376. getLatelyCourseList() {
  377. uni.showLoading({
  378. title: "加载中",
  379. mask: true,
  380. })
  381. homePageApi.getMyLastSchedules({
  382. count: 2
  383. }).then((response) => {
  384. uni.hideLoading();
  385. this.courseList = response.data;
  386. }).catch(error => {
  387. uni.showToast({
  388. title: error,
  389. icon: "none"
  390. })
  391. })
  392. },
  393. getFormatDate(date, m) {
  394. let myyear = date.getFullYear();
  395. let mymonth = date.getMonth() + 1;
  396. let myweekday = date.getDate();
  397. if (mymonth < 10) {
  398. mymonth = "0" + mymonth;
  399. }
  400. if (myweekday < 10) {
  401. myweekday = "0" + myweekday;
  402. }
  403. if (m) {
  404. return (myyear + "-" + mymonth + "-" + myweekday);
  405. } else {
  406. return (myyear + "-" + mymonth);
  407. }
  408. },
  409. activeClassClick(item, index) {
  410. this.activeClass = index;
  411. if (this.activeClass == 0) {
  412. console.log(this.day)
  413. } else if (this.activeClass == 1) {
  414. console.log(this.weekStartDate)
  415. console.log(this.weekEndDate)
  416. } else {
  417. console.log(this.monthStartDate)
  418. console.log(this.monthEndDate)
  419. }
  420. },
  421. }
  422. }
  423. </script>
  424. <style lang="scss" scoped>
  425. .navigation {
  426. height: 44px;
  427. line-height: 44px;
  428. background-color: rgba(13, 186, 199, 1);
  429. color: #ffffff;
  430. padding-left: 16px;
  431. font-size: 20px
  432. }
  433. // 课时信息
  434. ::v-deep.u-line {
  435. transform: scaleX(1) !important;
  436. }
  437. .class-infos-box {
  438. background: linear-gradient(#0DBAC7, #F4F6F6);
  439. .title {
  440. padding: 12px 16px;
  441. display: flex;
  442. justify-content: space-between;
  443. color: #fff;
  444. .cut {
  445. height: 16px;
  446. font-size: 14px;
  447. .img {
  448. display: inline-block;
  449. img {
  450. vertical-align: middle;
  451. }
  452. }
  453. }
  454. }
  455. // 详细信息
  456. .main {
  457. width: 91.4%;
  458. border-radius: 12px;
  459. padding-top: 32rpx;
  460. background-color: rgba(255, 255, 255, 1);
  461. text-align: center;
  462. margin: auto;
  463. }
  464. .time {
  465. margin-bottom: 36rpx;
  466. .show {
  467. display: flex;
  468. justify-content: center;
  469. align-items: center;
  470. border-radius: 50px;
  471. background-color: rgba(13, 186, 199, 1);
  472. font-size: 16px;
  473. text-align: center;
  474. height: 64rpx;
  475. margin: 0 224rpx;
  476. position: relative;
  477. .text {
  478. font-size: 32rpx;
  479. color: rgba(255, 255, 255, 1);
  480. }
  481. icon {
  482. margin-left: 8rpx;
  483. }
  484. }
  485. .select {
  486. position: absolute;
  487. left: 260rpx;
  488. ;
  489. right: 260rpx;
  490. ;
  491. background-color: #fff;
  492. z-index: 999;
  493. box-shadow: 0px 0px 8px 0px #E8E8E8;
  494. height: 72rpx;
  495. line-height: 72rpx;
  496. }
  497. }
  498. .date {
  499. height: 17px;
  500. color: rgba(119, 119, 119, 1);
  501. font-size: 12px;
  502. font-family: PingFangSC-regular;
  503. margin: 18px 0;
  504. }
  505. .infos {
  506. display: flex;
  507. flex-wrap: wrap;
  508. .infos-item {
  509. width: 33%;
  510. margin-bottom: 40rpx;
  511. .content {
  512. height: 28px;
  513. color: rgba(13, 186, 199, 1);
  514. font-size: 20px;
  515. text-align: center;
  516. font-family: PingFangSC-medium;
  517. }
  518. .infos-name {
  519. height: 20px;
  520. color: rgba(119, 119, 119, 1);
  521. }
  522. }
  523. }
  524. }
  525. // 最近课程
  526. .course {
  527. margin: auto;
  528. margin-top: 16px;
  529. width: 91.4%;
  530. .title {
  531. height: 20px;
  532. line-height: 20px;
  533. margin-bottom: 14px;
  534. color: #333333;
  535. font-weight: bold;
  536. img {
  537. vertical-align: middle;
  538. margin-right: 8px;
  539. }
  540. }
  541. .course-infos {
  542. display: flex;
  543. justify-content: space-between;
  544. .info-box {
  545. border-top: 2px solid #0DBAC7;
  546. background: linear-gradient(to right, #E4F8E3, #dcf5f6);
  547. width: 47.8%;
  548. padding: 24rpx 0 14rpx 24rpx;
  549. box-shadow: 2px 2px 2px 2px #e7e9e9;
  550. border-radius: 8px;
  551. position: relative;
  552. .position {
  553. width: 48rpx;
  554. height: 40rpx;
  555. line-height: 40rpx;
  556. position: absolute;
  557. top: 0;
  558. right: 16rpx;
  559. text-align: center;
  560. border-radius: 0px 0px 4px 4px;
  561. font-size: 12px;
  562. color: #fff;
  563. }
  564. .today {
  565. background-color: #0DBAC7;
  566. }
  567. .tomorrow {
  568. background-color: #0086FF;
  569. }
  570. .class-name {
  571. height: 20px;
  572. color: rgba(51, 51, 51, 1);
  573. font-size: 14px;
  574. text-overflow: ellipsis;
  575. white-space: nowrap;
  576. overflow: hidden;
  577. }
  578. .location-time {
  579. margin-top: 8rpx;
  580. display: flex;
  581. justify-content: start;
  582. color: rgba(119, 119, 119, 1);
  583. font-size: 12px;
  584. .time {
  585. margin-left: 8rpx;
  586. }
  587. }
  588. .date {
  589. color: rgba(119, 119, 119, 1);
  590. font-size: 12px;
  591. margin-top: 8rpx;
  592. }
  593. }
  594. .info-box2 {
  595. border-top: 2px solid #0086FF;
  596. }
  597. }
  598. }
  599. // 我的应用
  600. .my-app {
  601. margin: auto;
  602. margin-top: 16px;
  603. padding: 16px;
  604. background-color: #fff;
  605. margin-bottom: 300rpx;
  606. .title {
  607. height: 20px;
  608. line-height: 20px;
  609. margin-bottom: 14px;
  610. font-weight: bold;
  611. color: #333333;
  612. img {
  613. vertical-align: middle;
  614. margin-right: 8px;
  615. }
  616. }
  617. .app-items {
  618. display: flex;
  619. flex-wrap: wrap;
  620. .item {
  621. width: 25%;
  622. display: flex;
  623. flex-direction: column;
  624. align-items: center;
  625. margin-bottom: 40rpx;
  626. .icon-box {
  627. width: 40px;
  628. height: 40px;
  629. text-align: center;
  630. border-radius: 8px;
  631. position: relative;
  632. .count {
  633. width: 28px;
  634. height: 16px;
  635. line-height: 16px;
  636. border-radius: 50px;
  637. background-color: rgba(238, 49, 56, 1);
  638. color: rgba(255, 255, 255, 1);
  639. font-size: 10px;
  640. text-align: center;
  641. position: absolute;
  642. top: -16rpx;
  643. right: -28rpx;
  644. }
  645. img {
  646. margin: 8px 0;
  647. }
  648. }
  649. .text {
  650. margin-top: 16rpx;
  651. }
  652. }
  653. }
  654. }
  655. </style>