classCall.vue 15 KB

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