record.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view>
  3. <u-navbar title="补课记录"></u-navbar>
  4. <view class="screen">
  5. <view class="date" @click="show = true">
  6. <view class="text">
  7. {{signTime}}
  8. </view>
  9. <view class="icon">
  10. <u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
  11. </view>
  12. </view>
  13. <u-picker mode="time" :defaultTime="defaultTime" v-model="show" :params="params" @confirm="confirm"></u-picker>
  14. <view class="course" @click="cshow = true">
  15. <view class="text">
  16. {{className}}
  17. </view>
  18. <view class="icon">
  19. <u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
  20. </view>
  21. </view>
  22. <u-select v-model="cshow" mode="single-column" :list="classList" @confirm="classConfirm"></u-select>
  23. </view>
  24. <view class="record">
  25. <view class="record-card" v-for="(item, index) in recordList" :key="index" @click="toModifyRecords(item)">
  26. <view class="title-time">
  27. <view class="title">
  28. {{item.className}}
  29. </view>
  30. <view class="time">
  31. {{item.courseDate}}
  32. </view>
  33. </view>
  34. <view class="condition">
  35. {{item.studentMessage}}
  36. </view>
  37. </view>
  38. </view>
  39. <u-divider v-if="recordList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px">
  40. 没有更多数据了</u-divider>
  41. <!-- 底部 -->
  42. <view class="btn">
  43. <button @click="toAddRecords">新增补课记录</button>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import * as myClassApi from '@/apis/teacher/myClass.js'
  49. import * as makeUpAttendanceApi from '@/apis/teacher/makeUpAttendance.js'
  50. export default {
  51. data() {
  52. return {
  53. signTime: '',
  54. params: {
  55. year: true,
  56. month: true,
  57. day: false,
  58. hour: false,
  59. minute: false,
  60. second: false
  61. },
  62. show: false,
  63. defaultTime: '',
  64. cshow: false,
  65. classList: [],
  66. classId: '',
  67. className: '全部课程',
  68. recordList: [],
  69. pageIndex: 1,
  70. pageSize: 10,
  71. recordsTotal: 0
  72. }
  73. },
  74. onLoad() {
  75. var date = new Date();
  76. var year = date.getFullYear();
  77. var month = date.getMonth() + 1;
  78. if (month >= 1 && month <= 9) {
  79. month = '0' + month;
  80. }
  81. this.defaultTime = year + '-' + month;
  82. this.signTime = this.defaultTime;
  83. this.getLoadMyClass();
  84. },
  85. onReady() {
  86. },
  87. onShow() {
  88. this.getSupplementaryPageList(true);
  89. },
  90. onReachBottom() {
  91. if (this.recordList.length < this.recordsTotal) {
  92. this.myLoadmore();
  93. }
  94. },
  95. methods: {
  96. myLoadmore() {
  97. this.pageIndex += 1;
  98. this.getSupplementaryPageList()
  99. },
  100. getSupplementaryPageList(bl) {
  101. uni.showLoading({
  102. title: "加载中",
  103. mask: true,
  104. })
  105. if (bl) {
  106. this.recordList = [];
  107. this.pageIndex = 1;
  108. }
  109. makeUpAttendanceApi.pageList({
  110. yearMonth: this.signTime,
  111. classId: this.classId,
  112. pageIndex: this.pageIndex,
  113. pageSize: this.pageSize
  114. }).then((res) => {
  115. uni.hideLoading();
  116. this.recordList = [
  117. ...this.recordList,
  118. ...res.data.data
  119. ];
  120. this.recordsTotal = res.data.recordsTotal;
  121. }).catch(error => {
  122. uni.showToast({
  123. title: error,
  124. icon: "none"
  125. })
  126. })
  127. },
  128. getLoadMyClass() {
  129. uni.showLoading({
  130. title: "加载中",
  131. mask: true,
  132. })
  133. myClassApi.loadMyClass().then((res) => {
  134. uni.hideLoading();
  135. var list = res.data;
  136. var list2 = [];
  137. list2.push({
  138. value: '',
  139. label: '全部课程'
  140. })
  141. for (var i = 0; i < list.length; i++) {
  142. list2.push({
  143. value: list[i].classId,
  144. label: list[i].className
  145. })
  146. }
  147. this.classList = list2;
  148. }).catch(error => {
  149. uni.showToast({
  150. title: error,
  151. icon: "none"
  152. })
  153. })
  154. },
  155. classConfirm(e) {
  156. this.classId = e[0].value;
  157. this.className = e[0].label;
  158. this.getSupplementaryPageList(true);
  159. },
  160. confirm(params) {
  161. this.signTime = params.year + '-' + params.month;
  162. this.getSupplementaryPageList(true);
  163. },
  164. toAddRecords() {
  165. uni.navigateTo({
  166. url: '/pages/teacher/makeUpAttendance/addModifyRecords'
  167. })
  168. },
  169. toModifyRecords(item) {
  170. uni.navigateTo({
  171. url: '/pages/teacher/makeUpAttendance/addModifyRecords?id=' + item.id
  172. + '&classId=' + item.classId
  173. })
  174. },
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. // 底部
  180. .btn {
  181. position: fixed;
  182. left: 0;
  183. right: 0;
  184. bottom: 0;
  185. padding: 10px 12px;
  186. background-color: #fff;
  187. button {
  188. border-radius: 50px;
  189. background-color: rgba(13, 186, 199, 1);
  190. color: rgba(255, 255, 255, 1);
  191. font-size: 16px;
  192. line-height: 40px;
  193. }
  194. }
  195. .screen {
  196. background-color: #fff;
  197. display: flex;
  198. justify-content: space-between;
  199. text-align: center;
  200. height: 44px;
  201. line-height: 44px;
  202. position: fixed;
  203. top: 88rpx;
  204. left: 0;
  205. right: 0;
  206. z-index: 999;
  207. .date {
  208. flex: 1;
  209. display: flex;
  210. align-items: center;
  211. justify-content: center;
  212. .text {
  213. margin-right: 8rpx;
  214. }
  215. }
  216. .course {
  217. display: flex;
  218. flex: 1;
  219. align-items: center;
  220. justify-content: center;
  221. .text {
  222. margin-right: 8rpx;
  223. }
  224. }
  225. }
  226. .record {
  227. margin: 112rpx 32rpx 0;
  228. .record-card {
  229. margin-top: 12px;
  230. background-color: #fff;
  231. border-radius: 12px;
  232. padding: 12px;
  233. display: flex;
  234. justify-content: space-between;
  235. .title-time {
  236. color: rgba(51, 51, 51, 1);
  237. .title {
  238. font-weight: bold;
  239. font-size: 18px;
  240. }
  241. .time {
  242. margin-top: 16rpx;
  243. font-size: 12px;
  244. }
  245. }
  246. .condition {
  247. // color: #0DBAC7;
  248. font-size: 16px;
  249. display: flex;
  250. align-items: center;
  251. }
  252. .leave {
  253. color: rgba(129, 97, 255, 1);
  254. }
  255. .truant {
  256. color: rgba(255, 61, 0, 1);
  257. }
  258. }
  259. }
  260. ::v-deep.u-divider {
  261. margin-top: 12px !important;
  262. }
  263. </style>