classCall.vue 14 KB

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