classCall.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. <template>
  2. <view>
  3. <u-navbar title="班级点名"></u-navbar>
  4. <view class="main">
  5. <view class="position">
  6. <view class="infos">
  7. <view class="class">
  8. {{classList.className}}
  9. </view>
  10. <view class="item">
  11. <view class="title">
  12. 上课时间:
  13. </view>
  14. <view class="value">
  15. {{scheduleSheet.courseDate}} {{scheduleSheet.coursePeriods}}
  16. </view>
  17. </view>
  18. <view class="item">
  19. <view class="title">
  20. 上课教室:
  21. </view>
  22. <view class="value">
  23. {{classRoom.name}}
  24. </view>
  25. </view>
  26. <view class="item">
  27. <view class="title">
  28. 授课老师:
  29. </view>
  30. <view class="value">
  31. {{employee.employeeName}}
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="title">
  36. 学员总数:
  37. </view>
  38. <view class="value">
  39. {{studentList.length}}人
  40. </view>
  41. </view>
  42. </view>
  43. <view class="tabs">
  44. <u-tabs bar-width="80" inactive-color="#777777" active-color="#4F3C27" :list="list" :is-scroll="false"
  45. :current="current" @change="change"></u-tabs>
  46. </view>
  47. </view>
  48. <view class="details">
  49. <view class="item" v-for="(item,index) in rollCallList" :key="index">
  50. <view class="picture">
  51. <u-avatar class="avatar" mode="square"
  52. :src="item.headPhoto != null ? item.headPhoto : '../../assets/img/head.png'" size="112">
  53. </u-avatar>
  54. </view>
  55. <view class="info">
  56. <view class="name-tel">
  57. <view class="name">
  58. {{item.studentName}}
  59. </view>
  60. <view class="tel">
  61. <view class="img">
  62. <img src="../../../assets/img/riLine-smartphone-line@1x.png" alt="">
  63. </view>
  64. <view>
  65. {{item.firstContactPhone != null ? item.firstContactPhone : item.secondContactPhone}}
  66. </view>
  67. </view>
  68. </view>
  69. <view class="else">
  70. <view class="remain">
  71. <!-- <view>剩余课时</view>
  72. <view class="num"></view> -->
  73. </view>
  74. <view class="leaved">
  75. <!-- <view>已请假</view>
  76. <view class="num"></view> -->
  77. </view>
  78. </view>
  79. </view>
  80. <view class="state" @click="showStudent(item)">
  81. <view class="text" v-if="item.rollCallResult == '1'">到课</view>
  82. <view class="text" v-if="item.rollCallResult == '2'">请假</view>
  83. <view class="text" v-if="item.rollCallResult == '3'">旷课</view>
  84. <view class="text" v-if="item.rollCallResult == '4'">补课</view>
  85. <view class="text" v-if="item.rollCallResult == '5'">停课</view>
  86. <view class="text" v-if="item.rollCallResult == '6'">缺课</view>
  87. <view class="icon">
  88. <u-icon name="arrow-right" color="#cccccc"></u-icon>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- <u-cell-group>
  94. <u-cell-item title="班级名称" :value="classList.className" :arrow="false"></u-cell-item>
  95. <u-cell-item title="上课时间" :value="scheduleSheet.courseDate+' '+scheduleSheet.coursePeriods" :arrow="false"></u-cell-item>
  96. <u-cell-item title="上课教室" :value="classRoom.name" :arrow="false"></u-cell-item>
  97. <u-cell-item class="teacher" title="任课老师" :value="employee.employeeName"
  98. @click="gotoUrl('pages/teacher/myCourse/teacherHomepage?id='+employee.employeeId)"></u-cell-item>
  99. <u-cell-item title="学员总数" :value="studentList.length+'人'" :arrow="false"></u-cell-item>
  100. <u-cell-item title="点名结果批量设置" :value="resultName" @click="show = true"></u-cell-item>
  101. </u-cell-group> -->
  102. </view>
  103. <u-picker mode="selector" v-model="show" :default-selector="[0]" :range="selectorObj" range-key="cateName"
  104. @confirm="confirm"></u-picker>
  105. <!-- 底部 -->
  106. <view class="bottom">
  107. <view class="sign-result">
  108. <view class="title">
  109. 签到结果
  110. </view>
  111. <view class="result">
  112. <view class="itemClass leave" @click="qbStudent">
  113. 全部<text>{{dkNum+qkNum}}</text>
  114. </view>
  115. <view class="itemClass arrive" @click="dkStudent">
  116. 到课<text>{{dkNum}}</text>
  117. </view>
  118. <view class="itemClass leave" @click="qkStudent">
  119. 缺课<text>{{qkNum}}</text>
  120. </view>
  121. <!-- <view class="itemClass truant">
  122. 旷课<text>{{scheduleSheet.kkNum!=null?scheduleSheet.kkNum:'0'}}</text>
  123. </view> -->
  124. <!-- <view class="itemClass make-up">
  125. 补课<text>{{scheduleSheet.bkNum!=null?scheduleSheet.bkNum:'0'}}</text>
  126. </view> -->
  127. <view class="itemClass stop">
  128. 停课<text>{{tkNum}}</text>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="set-btn">
  133. <view class="set">
  134. <view class="set-text">点名结果批量设置</view>
  135. <view class="choose" @click="show = true">
  136. <view class="text">
  137. {{resultName}}
  138. </view>
  139. <view class="icon">
  140. <u-icon size="28" color="#cccccc" name="arrow-right"></u-icon>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="btn">
  145. <button @click="save()">保存</button>
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. </template>
  151. <script>
  152. import * as callNamesApi from '@/apis/teacher/callNames.js'
  153. export default {
  154. data() {
  155. return {
  156. resultName: '到课',
  157. studentId: '',
  158. studentResult: '',
  159. classList: {},
  160. classRoom: {},
  161. employee: {},
  162. scheduleSheet: {},
  163. studentList: [],
  164. sheetId: '',
  165. show: false,
  166. selectorObj: [{
  167. cateName: '到课',
  168. id: '1'
  169. },
  170. {
  171. cateName: '缺课',
  172. id: '6'
  173. },
  174. // {
  175. // cateName: '旷课',
  176. // id: '3'
  177. // },
  178. // {
  179. // cateName: '补课',
  180. // id: '4'
  181. // }
  182. ],
  183. list: [
  184. {name: '正常'},
  185. {name: '停课'}
  186. ],
  187. current: 0,
  188. leaveStudentList: [],
  189. stopStudentList: [],
  190. lackStudentList: [],
  191. rollCallList: [],
  192. dkNum: 0,
  193. qkNum: 0,
  194. qjNum: 0,
  195. tkNum: 0,
  196. rollCallListAll: []
  197. }
  198. },
  199. onLoad(op) {
  200. if (op.id) {
  201. this.sheetId = op.id;
  202. this.getRollCallDetail();
  203. }
  204. },
  205. methods: {
  206. qbStudent() {
  207. this.rollCallList = this.studentList;
  208. },
  209. dkStudent() {
  210. var list = [];
  211. for (var i = 0; i < this.studentList.length; i++) {
  212. if(this.studentList[i].rollCallResult == '1') {
  213. list.push(this.studentList[i]);
  214. }
  215. }
  216. this.rollCallList = list;
  217. },
  218. qkStudent() {
  219. var list = [];
  220. for (var i = 0; i < this.studentList.length; i++) {
  221. if(this.studentList[i].rollCallResult == '6') {
  222. list.push(this.studentList[i]);
  223. }
  224. }
  225. this.rollCallList = list;
  226. },
  227. getRollCallSignIn() {
  228. uni.showLoading({
  229. title: "加载中",
  230. mask: true,
  231. })
  232. callNamesApi.rollCallSignIn(this.sheetId, this.rollCallListAll).then((response) => {
  233. uni.hideLoading();
  234. this.getRollCallDetail();
  235. }).catch(error => {
  236. uni.showToast({
  237. title: error,
  238. icon: "none"
  239. })
  240. })
  241. },
  242. getRollCallDetail() {
  243. this.studentList = [];
  244. uni.showLoading({
  245. title: "加载中",
  246. mask: true,
  247. })
  248. callNamesApi.loadRollcallData({
  249. sheetId: this.sheetId
  250. }).then((response) => {
  251. uni.hideLoading();
  252. this.classList = response.data.class;
  253. this.classRoom = response.data.classRoom;
  254. this.employee = response.data.employee;
  255. this.scheduleSheet = response.data.scheduleSheet;
  256. this.studentList = response.data.studentList;
  257. this.rollCallList = this.studentList;
  258. this.stopStudentList = response.data.stopStudentList;
  259. for (var n = 0; n < this.stopStudentList.length; n++) {
  260. if(this.stopStudentList[n].rollCallResult == null) {
  261. this.stopStudentList[n].rollCallResult = '5';
  262. }
  263. }
  264. this.list[0].name = '正常' + this.studentList.length;
  265. this.list[1].name = '停课' + this.stopStudentList.length;
  266. this.dkNum = 0;
  267. this.qkNum = 0;
  268. this.tkNum = this.stopStudentList.length;
  269. for (var i = 0; i < this.studentList.length; i++) {
  270. if(this.studentList[i].rollCallResult == '1') {
  271. this.dkNum += 1;
  272. }
  273. if(this.studentList[i].rollCallResult == '6') {
  274. this.qkNum += 1;
  275. }
  276. }
  277. }).catch(error => {
  278. uni.showToast({
  279. title: error,
  280. icon: "none"
  281. })
  282. })
  283. },
  284. save() {
  285. if(this.current == 0) {
  286. for (var i = 0; i < this.rollCallList.length; i++) {
  287. if(this.rollCallList[i].rollCallResult == null) {
  288. this.rollCallList[i].rollCallResult = '1';
  289. }
  290. }
  291. console.log(this.rollCallList)
  292. this.rollCallListAll = this.rollCallList.concat(this.stopStudentList);
  293. }
  294. // if(this.current == 1) {
  295. // for (var i = 0; i < this.studentList.length; i++) {
  296. // if(this.studentList[i].rollCallResult == null) {
  297. // this.studentList[i].rollCallResult = '1';
  298. // }
  299. // }
  300. // this.rollCallListAll = this.rollCallList.concat(this.studentList, this.stopStudentList)
  301. // }
  302. if(this.current == 1) {
  303. for (var i = 0; i < this.studentList.length; i++) {
  304. if(this.studentList[i].rollCallResult == null) {
  305. this.studentList[i].rollCallResult = '1';
  306. }
  307. }
  308. this.rollCallListAll = this.rollCallList.concat(this.studentList);
  309. }
  310. this.getRollCallSignIn();
  311. },
  312. showStudent(item) {
  313. this.show = true;
  314. this.studentId = item.studentId;
  315. },
  316. confirm(obj) {
  317. if (!this.studentId) {
  318. this.resultName = this.selectorObj[obj[0]].cateName;
  319. for (var i = 0; i < this.rollCallList.length; i++) {
  320. this.rollCallList[i].rollCallResult = this.selectorObj[obj[0]].id;
  321. }
  322. } else {
  323. for (var i = 0; i < this.rollCallList.length; i++) {
  324. if (this.studentId == this.rollCallList[i].studentId) {
  325. this.rollCallList[i].rollCallResult = this.selectorObj[obj[0]].id;
  326. }
  327. }
  328. this.studentId = '';
  329. }
  330. },
  331. change(index) {
  332. this.current = index;
  333. if(index == 1) {
  334. this.rollCallList = this.stopStudentList;
  335. } else {
  336. this.rollCallList = this.studentList;
  337. }
  338. }
  339. }
  340. }
  341. </script>
  342. <style lang="scss" scoped>
  343. page{
  344. padding-bottom: 200px;
  345. }
  346. .main {
  347. background: linear-gradient(180deg, rgba(13, 186, 199, 1) 0%, rgba(244, 246, 246, 1) 100%);
  348. .position{
  349. background-color: rgba(13, 186, 199, 1);
  350. position: fixed;
  351. top: 88rpx;
  352. left: 0;
  353. right: 0;
  354. z-index: 999;
  355. }
  356. .infos {
  357. color: #fff;
  358. padding: 32rpx;
  359. .class {
  360. color: rgba(255, 255, 255, 1);
  361. font-size: 48rpx;
  362. font-weight: bold;
  363. margin-bottom: 16rpx;
  364. }
  365. .item {
  366. display: flex;
  367. margin-top: 16rpx;
  368. .value {
  369. margin-left: 8rpx;
  370. }
  371. }
  372. }
  373. .tabs {
  374. border-radius: 16px 16px 0px 0px;
  375. background-color: rgba(255, 255, 255, 1);
  376. height: 88rpx;
  377. padding: 0 170rpx;
  378. }
  379. .details {
  380. background-color: #fff;
  381. margin-top: 424rpx;
  382. .item {
  383. padding: 24rpx 32rpx;
  384. display: flex;
  385. border-top: 1px solid rgba(229, 231, 234, 1);
  386. .picture {
  387. width: 112rpx;
  388. height: 112rpx;
  389. img {
  390. width: 100%;
  391. height: 100%;
  392. }
  393. }
  394. .info {
  395. margin-left: 24rpx;
  396. display: flex;
  397. flex-direction: column;
  398. justify-content: space-around;
  399. .name-tel {
  400. display: flex;
  401. align-items: center;
  402. .name {
  403. color: rgba(51, 51, 51, 1);
  404. font-size: 18px;
  405. font-weight: bold
  406. }
  407. .tel {
  408. color: rgba(119, 119, 119, 1);
  409. display: flex;
  410. align-items: center;
  411. line-height: 32rpx;
  412. margin-left: 24rpx;
  413. .img {
  414. width: 32rpx;
  415. height: 32rpx;
  416. margin-right: 8rpx;
  417. img {
  418. width: 100%;
  419. height: 100%;
  420. }
  421. }
  422. }
  423. }
  424. .else {
  425. display: flex;
  426. align-items: center;
  427. .remain,
  428. .leaved {
  429. display: flex;
  430. color: rgba(119, 119, 119, 1);
  431. align-items: center;
  432. margin-right: 24rpx;
  433. .num {
  434. width: 40rpx;
  435. height: 32rpx;
  436. line-height: 32rpx;
  437. border-radius: 4px;
  438. background-color: rgba(153, 153, 153, 1);
  439. color: rgba(255, 255, 255, 1);
  440. font-size: 24rpx;
  441. text-align: center;
  442. margin-left: 8rpx;
  443. }
  444. }
  445. }
  446. }
  447. .state {
  448. display: flex;
  449. align-items: end;
  450. margin-left: auto;
  451. .text {
  452. color: rgba(51, 51, 51, 1);
  453. }
  454. .icon {
  455. margin-left: 8rpx;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. /deep/.u-cell_title {
  462. color: rgba(119, 119, 119, 1);
  463. }
  464. /deep/.u-cell__value {
  465. color: #333333;
  466. }
  467. .teacher {
  468. /deep/.u-cell__value {
  469. color: #00BAC8;
  470. }
  471. }
  472. .student-details {
  473. padding: 12px 16px;
  474. background-color: #fff;
  475. display: flex;
  476. position: relative;
  477. border-bottom: 1px solid rgba(229, 231, 234, 1);
  478. ;
  479. .photo {
  480. width: 56px;
  481. height: 56px;
  482. border-radius: 4px;
  483. overflow: hidden;
  484. margin-right: 11px;
  485. img {
  486. width: 100%;
  487. height: 100%;
  488. }
  489. }
  490. .details {
  491. display: flex;
  492. flex-direction: column;
  493. justify-content: space-around;
  494. .name-tel {
  495. display: flex;
  496. .name {
  497. margin-right: 12px;
  498. color: rgba(51, 51, 51, 1);
  499. font-size: 18px;
  500. }
  501. .tel {
  502. color: rgba(119, 119, 119, 1);
  503. display: flex;
  504. align-items: center;
  505. }
  506. }
  507. .class-leave {
  508. color: rgba(119, 119, 119, 1);
  509. display: flex;
  510. .class {
  511. margin-right: 12px;
  512. line-height: 14px;
  513. display: flex;
  514. align-items: center;
  515. }
  516. .leave {
  517. display: flex;
  518. align-items: center;
  519. }
  520. text {
  521. display: inline-block;
  522. width: 16px;
  523. height: 16px;
  524. line-height: 16px;
  525. border-radius: 4px;
  526. background-color: rgba(153, 153, 153, 1);
  527. color: rgba(255, 255, 255, 1);
  528. font-size: 12px;
  529. text-align: center;
  530. margin-left: 4px;
  531. }
  532. }
  533. }
  534. .to-class {
  535. color: #333333;
  536. position: absolute;
  537. bottom: 34rpx;
  538. right: 24rpx;
  539. }
  540. }
  541. // 底部
  542. .bottom {
  543. padding: 12px 16px;
  544. background-color: #fff;
  545. position: fixed;
  546. bottom: 0;
  547. left: 0;
  548. right: 0;
  549. .sign-result {
  550. display: flex;
  551. justify-content: space-between;
  552. padding-bottom: 22rpx;
  553. border-bottom: 2rpx solid rgba(229, 231, 234, 1);
  554. .title {
  555. color: rgba(119, 119, 119, 1);
  556. line-height: 40rpx;
  557. }
  558. .result {
  559. display: flex;
  560. justify-content: space-between;
  561. .itemClass {
  562. font-size: 32rpx;
  563. display: flex;
  564. align-items: center;
  565. margin-left: 24rpx;
  566. text {
  567. display: inline-block;
  568. width: 40rpx;
  569. height: 40rpx;
  570. line-height: 40rpx;
  571. border-radius: 8rpx;
  572. background-color: rgba(22, 132, 252, 1);
  573. color: rgba(255, 255, 255, 1);
  574. font-size: 24rpx;
  575. text-align: center;
  576. margin-left: 6rpx;
  577. }
  578. }
  579. .arrive {
  580. color: rgba(22, 132, 252, 1);
  581. }
  582. .leave {
  583. color: rgba(129, 97, 255, 1);
  584. text {
  585. background-color: rgba(129, 97, 255, 1);
  586. }
  587. }
  588. .truant {
  589. color: rgba(255, 61, 0, 1);
  590. text {
  591. background-color: rgba(255, 61, 0, 1);
  592. }
  593. }
  594. .make-up {
  595. color: rgba(0, 187, 170, 1);
  596. text {
  597. background-color: rgba(0, 187, 170, 1);
  598. }
  599. }
  600. .stop {
  601. color: rgba(238, 49, 56, 1);
  602. text {
  603. background-color: rgba(238, 49, 56, 1);
  604. ;
  605. }
  606. }
  607. }
  608. }
  609. .set-btn {
  610. display: flex;
  611. margin-top: 20rpx;
  612. .set {
  613. display: flex;
  614. align-items: center;
  615. .set-text {
  616. color: rgba(51, 51, 51, 1);
  617. }
  618. .choose {
  619. margin-left: 34rpx;
  620. display: flex;
  621. align-items: center;
  622. height: 20px;
  623. .text {
  624. color: rgba(13, 186, 199, 1);
  625. font-weight: bold;
  626. }
  627. .icon {
  628. margin-left: 8rpx;
  629. }
  630. }
  631. }
  632. .btn {
  633. width: 272rpx;
  634. margin-left: auto;
  635. }
  636. button {
  637. border-radius: 50px;
  638. background-color: rgba(13, 186, 199, 1);
  639. color: rgba(255, 255, 255, 1);
  640. font-size: 16px;
  641. height: 80rpx;
  642. line-height: 80rpx;
  643. }
  644. }
  645. }
  646. </style>