classCall.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  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+stopStudentList.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" @click="studentChecked(item)">
  50. <label class="radio">
  51. <radio value="" :checked="item.checked" /><text></text>
  52. </label>
  53. <view class="picture">
  54. <u-avatar class="avatar" mode="square"
  55. :src="item.headPhoto != null ? item.headPhoto : '../../assets/img/head.png'" size="112">
  56. </u-avatar>
  57. </view>
  58. <view class="info">
  59. <view class="name-tel">
  60. <view class="name">
  61. {{item.studentName}}
  62. </view>
  63. <view class="tel">
  64. <view class="img">
  65. <img src="../../../assets/img/riLine-smartphone-line@1x.png" alt="">
  66. </view>
  67. <view>
  68. {{item.firstContactPhone!=null ? getPhoneNum(item.firstContactPhone)
  69. : getPhoneNum(item.secondContactPhone)}}
  70. </view>
  71. </view>
  72. </view>
  73. <view class="else">
  74. <view class="remain">
  75. <view>剩余课时</view>
  76. <view class="num" v-if="item.courseAmountList != null">{{item.courseAmountList[0]}}</view>
  77. </view>
  78. <view class="leaved">
  79. </view>
  80. </view>
  81. </view>
  82. <view class="state">
  83. <view class="text" v-if="item.rollCallResult == '1'">到课</view>
  84. <view class="text" v-if="item.rollCallResult == '2'">请假</view>
  85. <view class="text" v-if="item.rollCallResult == '3'">旷课</view>
  86. <view class="text" v-if="item.rollCallResult == '4'">补课</view>
  87. <view class="text" v-if="item.rollCallResult == '5'">停课</view>
  88. <view class="text" v-if="item.rollCallResult == '6'">缺课</view>
  89. </view>
  90. <view class="iconBox" @click.stop="">
  91. <u-icon name="arrow-right" color="purple" size="36" ></u-icon>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <u-picker mode="selector" v-model="show" :default-selector="[0]" :range="selectorObj" range-key="cateName"
  97. @confirm="confirm"></u-picker>
  98. <!-- 底部 -->
  99. <view class="bottom">
  100. <view class="sign-result">
  101. <view class="title">
  102. 签到结果
  103. </view>
  104. <view class="result">
  105. <view class="itemClass leave" @click="qbStudent">
  106. 全部<text>{{studentList.length + stopStudentList.length}}</text>
  107. </view>
  108. <view class="itemClass arrive" @click="dkStudent">
  109. 到课<text>{{dkNum}}</text>
  110. </view>
  111. <view class="itemClass arrive" @click="qjStudent">
  112. 请假<text>{{qjNum}}</text>
  113. </view>
  114. <!-- <view class="itemClass leave" @click="qkStudent">
  115. 缺课<text>{{qkNum}}</text>
  116. </view> -->
  117. <!-- <view class="itemClass truant">
  118. 旷课<text>{{scheduleSheet.kkNum!=null?scheduleSheet.kkNum:'0'}}</text>
  119. </view> -->
  120. <!-- <view class="itemClass make-up">
  121. 补课<text>{{scheduleSheet.bkNum!=null?scheduleSheet.bkNum:'0'}}</text>
  122. </view> -->
  123. <view class="itemClass stop">
  124. 停课<text>{{tkNum}}</text>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="set-btn">
  129. <!-- 全选 -->
  130. <label class="radio" @click="studentCheckedAll">
  131. <radio value="" :checked="checkedAll" /><text>全选</text>
  132. </label>
  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. <u-toast ref="uToast" />
  151. </view>
  152. </view>
  153. </template>
  154. <script>
  155. import * as callNamesApi from '@/apis/teacher/callNames.js'
  156. export default {
  157. data() {
  158. return {
  159. resultName: '请选择',
  160. resultId: '',
  161. studentId: '',
  162. studentResult: '',
  163. classList: {},
  164. classRoom: {},
  165. employee: {},
  166. scheduleSheet: {},
  167. studentList: [],
  168. sheetId: '',
  169. show: false,
  170. selectorObj: [{
  171. cateName: '到课',
  172. id: '1'
  173. },
  174. {
  175. cateName: '请假',
  176. id: '2'
  177. },
  178. {
  179. cateName: '取消点名',
  180. id: ''
  181. },
  182. // {
  183. // cateName: '缺课',
  184. // id: '6'
  185. // },
  186. // {
  187. // cateName: '旷课',
  188. // id: '3'
  189. // },
  190. // {
  191. // cateName: '补课',
  192. // id: '4'
  193. // }
  194. ],
  195. list: [
  196. {name: '正常'},
  197. {name: '停课'}
  198. ],
  199. current: 0,
  200. leaveStudentList: [],
  201. stopStudentList: [],
  202. lackStudentList: [],
  203. rollCallList: [],
  204. dkNum: 0,
  205. qkNum: 0,
  206. qjNum: 0,
  207. tkNum: 0,
  208. rollCallListAll: [],
  209. checkedAll: false
  210. }
  211. },
  212. onLoad(op) {
  213. if (op.id) {
  214. this.sheetId = op.id;
  215. this.getRollCallDetail();
  216. }
  217. },
  218. methods: {
  219. getPhoneNum(num) {
  220. if(num.length == 11) {
  221. return num.slice(0,3)+'****'+num.slice(-4);
  222. } else {
  223. return num;
  224. }
  225. },
  226. studentChecked(item) {
  227. item.checked = !item.checked;
  228. if(!item.checked) {
  229. this.checkedAll = false;
  230. }
  231. this.$forceUpdate();
  232. },
  233. studentCheckedAll() {
  234. this.checkedAll = !this.checkedAll;
  235. for (var i = 0; i < this.rollCallList.length; i++) {
  236. this.rollCallList[i].checked = this.checkedAll;
  237. }
  238. },
  239. qbStudent() {
  240. this.rollCallList = this.studentList;
  241. },
  242. dkStudent() {
  243. var list = [];
  244. for (var i = 0; i < this.studentList.length; i++) {
  245. if(this.studentList[i].rollCallResult == '1') {
  246. list.push(this.studentList[i]);
  247. }
  248. }
  249. this.rollCallList = list;
  250. },
  251. qjStudent() {
  252. var list = [];
  253. for (var i = 0; i < this.studentList.length; i++) {
  254. if(this.studentList[i].rollCallResult == '2') {
  255. list.push(this.studentList[i]);
  256. }
  257. }
  258. this.rollCallList = list;
  259. },
  260. // qkStudent() {
  261. // var list = [];
  262. // for (var i = 0; i < this.studentList.length; i++) {
  263. // if(this.studentList[i].rollCallResult == '6') {
  264. // list.push(this.studentList[i]);
  265. // }
  266. // }
  267. // this.rollCallList = list;
  268. // },
  269. getRollCallSignIn() {
  270. uni.showLoading({
  271. title: "加载中",
  272. mask: true,
  273. })
  274. callNamesApi.rollCallSignIn(this.sheetId, this.rollCallListAll).then((response) => {
  275. uni.hideLoading();
  276. this.rollCallListAll = [];
  277. this.resultName = '请选择';
  278. if(response.message != '') {
  279. this.$refs.uToast.show({
  280. title: response.message+'课程为0或已经停课,不能点名!',
  281. type: 'warning ',
  282. position: 'top',
  283. duration: 5000
  284. })
  285. }
  286. this.getRollCallDetail();
  287. }).catch(error => {
  288. this.rollCallListAll = [];
  289. this.resultName = '请选择';
  290. if(error != null) {
  291. this.$refs.uToast.show({
  292. title: error,
  293. type: 'warning ',
  294. position: 'top',
  295. duration: 5000
  296. })
  297. }
  298. this.getRollCallDetail();
  299. })
  300. },
  301. getRollCallDetail() {
  302. this.studentList = [];
  303. uni.showLoading({
  304. title: "加载中",
  305. mask: true,
  306. })
  307. callNamesApi.loadRollcallData({
  308. sheetId: this.sheetId
  309. }).then((response) => {
  310. uni.hideLoading();
  311. this.classList = response.data.class;
  312. this.classRoom = response.data.classRoom;
  313. this.employee = response.data.employee;
  314. this.scheduleSheet = response.data.scheduleSheet;
  315. var mList = []
  316. var mList2 = response.data.studentList;
  317. for (var m = 0; m < mList2.length; m++) {
  318. if(mList2[m].rollCallResult!=null && mList2[m].rollCallResult!='' || mList2[m].courseAmountList[0]!=0) {
  319. mList.push(mList2[m]);
  320. }
  321. }
  322. this.studentList = mList;
  323. this.stopStudentList = response.data.stopStudentList;
  324. for (var n = 0; n < this.stopStudentList.length; n++) {
  325. var key = "checked";
  326. var value = false;
  327. this.stopStudentList[n][key] = value;
  328. if(this.stopStudentList[n].rollCallResult == null) {
  329. this.stopStudentList[n].rollCallResult = '5';
  330. }
  331. }
  332. this.list[0].name = '正常' + this.studentList.length;
  333. this.list[1].name = '停课' + this.stopStudentList.length;
  334. this.dkNum = 0;
  335. this.qjNum = 0;
  336. // this.qkNum = 0;
  337. this.tkNum = this.stopStudentList.length;
  338. for (var i = 0; i < this.studentList.length; i++) {
  339. var key = "checked";
  340. var value = false;
  341. this.studentList[i][key] = value;
  342. if(this.studentList[i].rollCallResult == '1') {
  343. this.dkNum += 1;
  344. }
  345. if(this.studentList[i].rollCallResult == '2') {
  346. this.qjNum += 1;
  347. }
  348. // if(this.studentList[i].rollCallResult == '6') {
  349. // this.qkNum += 1;
  350. // }
  351. }
  352. this.rollCallList = this.studentList;
  353. }).catch(error => {
  354. uni.showToast({
  355. title: error,
  356. icon: "none"
  357. })
  358. })
  359. },
  360. save() {
  361. for (var i = 0; i < this.rollCallList.length; i++) {
  362. if(this.rollCallList[i].checked) {
  363. this.rollCallListAll.push(this.rollCallList[i]);
  364. }
  365. }
  366. if(this.current == 1) {
  367. uni.showToast({
  368. title: "移动端无法更改‘停课学生’的点名状态",
  369. icon: "none"
  370. })
  371. return;
  372. }
  373. if(this.rollCallListAll.length == 0) {
  374. uni.showToast({
  375. title: "请先选择学生",
  376. icon: "none"
  377. })
  378. return;
  379. }
  380. this.getRollCallSignIn();
  381. },
  382. confirm(obj) {
  383. this.resultName = this.selectorObj[obj[0]].cateName;
  384. for (var i = 0; i < this.rollCallList.length; i++) {
  385. if(this.rollCallList[i].checked) {
  386. this.rollCallList[i].rollCallResult = this.selectorObj[obj[0]].id;
  387. }
  388. }
  389. },
  390. change(index) {
  391. this.current = index;
  392. if(index == 1) {
  393. this.rollCallList = this.stopStudentList;
  394. } else {
  395. this.rollCallList = this.studentList;
  396. }
  397. }
  398. }
  399. }
  400. </script>
  401. <style lang="scss" scoped>
  402. page{
  403. padding-bottom: 200px;
  404. }
  405. .main {
  406. background: linear-gradient(180deg, rgba(13, 186, 199, 1) 0%, rgba(244, 246, 246, 1) 100%);
  407. .position{
  408. background-color: rgba(13, 186, 199, 1);
  409. position: fixed;
  410. top: 88rpx;
  411. left: 0;
  412. right: 0;
  413. z-index: 999;
  414. }
  415. .infos {
  416. color: #fff;
  417. padding: 32rpx;
  418. .class {
  419. color: rgba(255, 255, 255, 1);
  420. font-size: 48rpx;
  421. font-weight: bold;
  422. margin-bottom: 16rpx;
  423. }
  424. .item {
  425. display: flex;
  426. margin-top: 16rpx;
  427. .value {
  428. margin-left: 8rpx;
  429. }
  430. }
  431. }
  432. .tabs {
  433. border-radius: 16px 16px 0px 0px;
  434. background-color: rgba(255, 255, 255, 1);
  435. height: 88rpx;
  436. padding: 0 170rpx;
  437. }
  438. .details {
  439. background-color: #fff;
  440. margin-top: 424rpx;
  441. .item {
  442. padding: 24rpx 32rpx;
  443. display: flex;
  444. border-top: 1px solid rgba(229, 231, 234, 1);
  445. .picture {
  446. width: 112rpx;
  447. height: 112rpx;
  448. img {
  449. width: 100%;
  450. height: 100%;
  451. }
  452. }
  453. .info {
  454. margin-left: 24rpx;
  455. display: flex;
  456. flex-direction: column;
  457. justify-content: space-around;
  458. .name-tel {
  459. display: flex;
  460. align-items: center;
  461. .name {
  462. color: rgba(51, 51, 51, 1);
  463. font-size: 18px;
  464. font-weight: bold
  465. }
  466. .tel {
  467. color: rgba(119, 119, 119, 1);
  468. display: flex;
  469. align-items: center;
  470. line-height: 32rpx;
  471. margin-left: 24rpx;
  472. .img {
  473. width: 32rpx;
  474. height: 32rpx;
  475. margin-right: 8rpx;
  476. img {
  477. width: 100%;
  478. height: 100%;
  479. }
  480. }
  481. }
  482. }
  483. .else {
  484. display: flex;
  485. align-items: center;
  486. .remain,
  487. .leaved {
  488. display: flex;
  489. color: rgba(119, 119, 119, 1);
  490. align-items: center;
  491. margin-right: 24rpx;
  492. .num {
  493. width: 50rpx;
  494. height: 32rpx;
  495. line-height: 32rpx;
  496. border-radius: 4px;
  497. background-color: rgba(153, 153, 153, 1);
  498. color: rgba(255, 255, 255, 1);
  499. font-size: 24rpx;
  500. text-align: center;
  501. margin-left: 8rpx;
  502. }
  503. }
  504. }
  505. }
  506. .state {
  507. display: flex;
  508. align-items: end;
  509. margin-left: 40rpx;
  510. .text {
  511. color: rgba(51, 51, 51, 1);
  512. }
  513. .icon {
  514. margin-left: 8rpx;
  515. }
  516. }
  517. .iconBox{
  518. margin-left: auto;
  519. // width: 80rpx;
  520. // border: 1px solid #cccccc;
  521. border-radius: 4px;
  522. display: flex;
  523. align-items: center;
  524. justify-content: center;
  525. }
  526. }
  527. }
  528. }
  529. // 单选框
  530. /deep/.radio{
  531. display: flex ;
  532. align-items: center;
  533. }
  534. /deep/.uni-radio-input{
  535. width: 32rpx;
  536. height: 32rpx;
  537. }
  538. /deep/.u-cell_title {
  539. color: rgba(119, 119, 119, 1);
  540. }
  541. /deep/.u-cell__value {
  542. color: #333333;
  543. }
  544. .teacher {
  545. /deep/.u-cell__value {
  546. color: #00BAC8;
  547. }
  548. }
  549. .student-details {
  550. padding: 12px 16px;
  551. background-color: #fff;
  552. display: flex;
  553. position: relative;
  554. border-bottom: 1px solid rgba(229, 231, 234, 1);
  555. ;
  556. .photo {
  557. width: 56px;
  558. height: 56px;
  559. border-radius: 4px;
  560. overflow: hidden;
  561. margin-right: 11px;
  562. img {
  563. width: 100%;
  564. height: 100%;
  565. }
  566. }
  567. .details {
  568. display: flex;
  569. flex-direction: column;
  570. justify-content: space-around;
  571. .name-tel {
  572. display: flex;
  573. .name {
  574. margin-right: 12px;
  575. color: rgba(51, 51, 51, 1);
  576. font-size: 18px;
  577. }
  578. .tel {
  579. color: rgba(119, 119, 119, 1);
  580. display: flex;
  581. align-items: center;
  582. }
  583. }
  584. .class-leave {
  585. color: rgba(119, 119, 119, 1);
  586. display: flex;
  587. .class {
  588. margin-right: 12px;
  589. line-height: 14px;
  590. display: flex;
  591. align-items: center;
  592. }
  593. .leave {
  594. display: flex;
  595. align-items: center;
  596. }
  597. text {
  598. display: inline-block;
  599. width: 16px;
  600. height: 16px;
  601. line-height: 16px;
  602. border-radius: 4px;
  603. background-color: rgba(153, 153, 153, 1);
  604. color: rgba(255, 255, 255, 1);
  605. font-size: 12px;
  606. text-align: center;
  607. margin-left: 4px;
  608. }
  609. }
  610. }
  611. .to-class {
  612. color: #333333;
  613. position: absolute;
  614. bottom: 34rpx;
  615. right: 24rpx;
  616. }
  617. }
  618. // 底部
  619. .bottom {
  620. padding: 12px 16px;
  621. background-color: #fff;
  622. position: fixed;
  623. bottom: 0;
  624. left: 0;
  625. right: 0;
  626. .sign-result {
  627. display: flex;
  628. justify-content: space-between;
  629. padding-bottom: 22rpx;
  630. border-bottom: 2rpx solid rgba(229, 231, 234, 1);
  631. .title {
  632. color: rgba(119, 119, 119, 1);
  633. line-height: 40rpx;
  634. }
  635. .result {
  636. display: flex;
  637. justify-content: space-between;
  638. .itemClass {
  639. font-size: 32rpx;
  640. display: flex;
  641. align-items: center;
  642. margin-left: 24rpx;
  643. text {
  644. display: inline-block;
  645. width: 40rpx;
  646. height: 40rpx;
  647. line-height: 40rpx;
  648. border-radius: 8rpx;
  649. background-color: rgba(22, 132, 252, 1);
  650. color: rgba(255, 255, 255, 1);
  651. font-size: 24rpx;
  652. text-align: center;
  653. margin-left: 6rpx;
  654. }
  655. }
  656. .arrive {
  657. color: rgba(22, 132, 252, 1);
  658. }
  659. .leave {
  660. color: rgba(129, 97, 255, 1);
  661. text {
  662. background-color: rgba(129, 97, 255, 1);
  663. }
  664. }
  665. .truant {
  666. color: rgba(255, 61, 0, 1);
  667. text {
  668. background-color: rgba(255, 61, 0, 1);
  669. }
  670. }
  671. .make-up {
  672. color: rgba(0, 187, 170, 1);
  673. text {
  674. background-color: rgba(0, 187, 170, 1);
  675. }
  676. }
  677. .stop {
  678. color: rgba(238, 49, 56, 1);
  679. text {
  680. background-color: rgba(238, 49, 56, 1);
  681. ;
  682. }
  683. }
  684. }
  685. }
  686. .set-btn {
  687. display: flex;
  688. margin-top: 20rpx;
  689. .set {
  690. display: flex;
  691. align-items: center;
  692. margin-left: auto;
  693. .set-text {
  694. color: rgba(51, 51, 51, 1);
  695. }
  696. .choose {
  697. margin-left: 34rpx;
  698. display: flex;
  699. align-items: center;
  700. height: 20px;
  701. .text {
  702. color: rgba(13, 186, 199, 1);
  703. font-weight: bold;
  704. }
  705. .icon {
  706. margin-left: 8rpx;
  707. }
  708. }
  709. }
  710. .btn {
  711. width: 200rpx;
  712. margin-left: 16rpx;
  713. }
  714. button {
  715. border-radius: 50px;
  716. background-color: rgba(13, 186, 199, 1);
  717. color: rgba(255, 255, 255, 1);
  718. font-size: 16px;
  719. height: 80rpx;
  720. line-height: 80rpx;
  721. }
  722. }
  723. }
  724. </style>