classRecord.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view>
  3. <u-navbar :title="className">
  4. </u-navbar>
  5. <!-- 头部 -->
  6. <view class="header">
  7. <view class="infos">
  8. <view class="title">
  9. {{className}}
  10. </view>
  11. <view class="times">
  12. 已上 {{classTimes}} 节 / 共 {{allClassTimes}} 课次
  13. </view>
  14. </view>
  15. <view class="state" v-if="status=='1' || status=='5'">
  16. 进行中
  17. </view>
  18. <view class="stateClose" v-if="status=='2'">
  19. 已结课
  20. </view>
  21. </view>
  22. <!-- 课次 -->
  23. <view class="class-times">
  24. <view class="item-box" v-for="(item,index) in classList" :key="index">
  25. <view class="item">
  26. <view class="class">
  27. 课程&nbsp;{{index+1}}
  28. </view>
  29. <view class="state0" v-if="item.rollcall == ''">
  30. {{item.rollcall}}
  31. </view>
  32. <view class="state2" v-else>
  33. {{item.rollcall}}
  34. </view>
  35. <!-- <view class="state4" v-if="item.rollcall == '请假'">
  36. {{item.rollcall}}
  37. </view>
  38. <view class="state3" v-if="item.rollcall == '旷课'">
  39. {{item.rollcall}}
  40. </view>
  41. <view class="state1" v-if="item.rollcall == '停课'">
  42. {{item.rollcall}}
  43. </view> -->
  44. <view class="boder-right">
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import * as mineApi from '@/apis/youth/mine.js'
  53. export default {
  54. data() {
  55. return {
  56. buyId: '',
  57. classList: [],
  58. allClassTimes: 0,
  59. classTimes: 0,
  60. className: '',
  61. status: '',
  62. studentId: ''
  63. }
  64. },
  65. onLoad(op) {
  66. if(op.id) {
  67. this.buyId = op.id;
  68. this.studentId = this.carhelp.getNsStudentId().studentId;
  69. this.getLoadMyCourses();
  70. }
  71. },
  72. methods: {
  73. toDetail(item) {
  74. if(item.id) {
  75. uni.navigateTo({
  76. url: '/pages/youth/classSchedule/classScheduleDetails?id='+item.id
  77. })
  78. }
  79. },
  80. getLoadMyCourses() {
  81. this.classList = [];
  82. uni.showLoading({
  83. title: "加载中",
  84. mask: true,
  85. })
  86. mineApi.loadMyCourses({
  87. studentId: this.studentId,
  88. pageNum: 1,
  89. pageSize: 10000
  90. }).then((res) => {
  91. uni.hideLoading();
  92. var list = res.data.data;
  93. for (var i = 0; i < list.length; i++) {
  94. if(list[i].buyId == this.buyId) {
  95. this.allClassTimes = list[i].courseAmount+list[i].freeAmount;
  96. if(list[i].rollcallCount != null) {
  97. this.classTimes = list[i].rollcallCount;
  98. }
  99. this.className = list[i].className;
  100. this.status = list[i].status;
  101. }
  102. }
  103. for (var i = 0; i < this.allClassTimes; i++) {
  104. this.classList.push({id: '',rollcall: ''});
  105. }
  106. for (var j = 0; j < this.classTimes; j++) {
  107. this.classList[j].rollcall = '已上课';
  108. this.classList[j].id = j+1;
  109. }
  110. // this.getLoadCourseRollcall();
  111. }).catch(error => {
  112. uni.showToast({
  113. title: error,
  114. icon: "none"
  115. })
  116. })
  117. },
  118. getLoadCourseRollcall() {
  119. uni.showLoading({
  120. title: "加载中",
  121. mask: true,
  122. })
  123. mineApi.loadCourseRollcall({
  124. buyId: this.buyId
  125. }).then((res) => {
  126. uni.hideLoading();
  127. var list = res.data;
  128. for (var i = 0; i < list.length; i++) {
  129. this.classList[i].rollcall = list[i].rollcall;
  130. this.classList[i].id = list[i].sheetId;
  131. }
  132. }).catch(error => {
  133. uni.showToast({
  134. title: error,
  135. icon: "none"
  136. })
  137. })
  138. }
  139. }
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. page {
  144. padding-bottom: 140rpx;
  145. }
  146. // 头部
  147. .header {
  148. background: linear-gradient(90deg, rgba(0, 156, 185, 1) 0%, rgba(13, 186, 199, 1) 100%);
  149. padding: 24rpx 32rpx;
  150. color: #fff;
  151. display: flex;
  152. align-items: center;
  153. .infos {
  154. .title {
  155. font-size: 40rpx;
  156. font-family: PingFangSC-medium;
  157. }
  158. .times {
  159. font-family: PingFangSC-regular;
  160. margin-top: 8rpx;
  161. }
  162. }
  163. .state {
  164. margin-left: auto;
  165. border-radius: 8rpx;
  166. background-color: rgba(13, 186, 199, 1);
  167. color: rgba(255, 255, 255, 1);
  168. font-size: 24rpx;
  169. text-align: center;
  170. font-family: Arial;
  171. border: 1px solid rgba(255, 255, 255, 1);
  172. width: 100rpx;
  173. height: 48rpx;
  174. line-height: 48rpx;
  175. }
  176. .stateClose {
  177. margin-left: auto;
  178. border-radius: 8rpx;
  179. background-color: rgba(13, 186, 199, 1);
  180. color: rgba(255, 255, 255, 1);
  181. font-size: 24rpx;
  182. text-align: center;
  183. font-family: Arial;
  184. border: 1px solid rgba(255, 255, 255, 1);
  185. width: 100rpx;
  186. height: 48rpx;
  187. line-height: 48rpx;
  188. }
  189. }
  190. // 课次
  191. .class-times {
  192. background-color: #F2F4F4;
  193. display: flex;
  194. flex-wrap: wrap;
  195. .item-box {
  196. width: 33.3%;
  197. padding: 24rpx 0;
  198. background-color: #fff;
  199. margin-bottom: 16rpx;
  200. }
  201. .item {
  202. border-right: 1px #e8e8e8 solid;
  203. text-align: center;
  204. .class {
  205. color: rgba(51, 51, 51, 1);
  206. font-size: 32rpx;
  207. text-align: center;
  208. font-family: PingFangSC-medium;
  209. height: 44rpx;
  210. line-height: 44rpx;
  211. font-weight: bold;
  212. }
  213. .state0 {
  214. margin-top: 8rpx;
  215. height: 36rpx;
  216. }
  217. .state1 {
  218. color: rgba(238, 49, 56, 1);
  219. font-family: PingFangSC-regular;
  220. margin-top: 8rpx;
  221. height: 36rpx;
  222. }
  223. .state2 {
  224. color: rgba(13, 186, 199, 1);
  225. font-family: PingFangSC-regular;
  226. margin-top: 8rpx;
  227. height: 36rpx;
  228. }
  229. .state3 {
  230. color: rgba(255, 107, 0, 1);
  231. font-family: PingFangSC-regular;
  232. margin-top: 8rpx;
  233. height: 36rpx;
  234. }
  235. .state4 {
  236. color: rgba(129, 97, 255, 1);
  237. font-family: PingFangSC-regular;
  238. margin-top: 8rpx;
  239. height: 36rpx;
  240. }
  241. }
  242. }
  243. </style>