myClassDetail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="content">
  3. <u-card title="剩余课时" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  4. <view slot="body">{{ residue }}</view>
  5. </u-card>
  6. <u-card title="签到记录" sub-title="查看更多" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle"
  7. @head-click="getSignInList">
  8. <view class="signIn-box" slot="body">
  9. <view class="signIn-col" v-for="(item, index) in signInList" :key="index" @click="handleSignClick(item.id,index)">
  10. <u-icon name="bookmark" :color="signIndex === index ? '#41b0fe' : '#666666'" size="64" v-if="!item.status"></u-icon>
  11. <u-icon name="bookmark-fill" :color="signIndex === index ? '#41b0fe' : mainColor" size="64" v-else></u-icon>
  12. <view class="signIn-date">{{item.date}}</view>
  13. </view>
  14. </view>
  15. </u-card>
  16. <u-card v-if="Object.keys(rateRecordInfo).length && rateRecordInfo.userRemark" title="课程评价" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  17. <!-- <u-cell-group slot="body" :border="false" style="padding: 0px;">
  18. <u-cell-item :title="(item.type? '家长' : '教练') + '-' + item.name" :value="item.time" :label="item.content" v-for="(item, index) in classInfo.growList"
  19. :key="index" :arrow="false" :title-style="cellTitleStyle"></u-cell-item>
  20. </u-cell-group> -->
  21. <view slot="body">
  22. <u-rate :count="10" :current="rateRecordInfo.star" :size="40" :gutter="10" :active-color="mainColor" isClick></u-rate>
  23. <view class="rate-info">学生评价: {{ rateRecordInfo.userRemark }}</view>
  24. <view class="rate-info" v-if="rateRecordInfo.coachRemark">教练回复: {{ rateRecordInfo.coachRemark }}</view>
  25. </view>
  26. </u-card>
  27. <!-- <view class="handle-fix-box" v-if="Object.keys(rateRecordInfo).length"> -->
  28. <view class="handle-fix-box" v-if="Object.keys(rateRecordInfo).length && !rateRecordInfo.userRemark">
  29. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToCourseForm()">填写评价</u-button>
  30. </view>
  31. <u-calendar v-model="signInShow" mode="date" :active-bg-color="mainColor" btn-type="error" availableText="未签到"
  32. activeText="已签到" :available="availableList" :activeList="activeList" :handleStatus="false"></u-calendar>
  33. <u-top-tips ref="uTips"></u-top-tips>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapGetters
  39. } from 'vuex'
  40. const NET = require('@/utils/request')
  41. const API = require('@/config/api')
  42. export default {
  43. computed: {
  44. ...mapGetters([
  45. 'mainColor',
  46. 'customStyle',
  47. ])
  48. },
  49. data() {
  50. return {
  51. classId: '',
  52. classId_b: '',
  53. signIndex: 0,
  54. signInShow: false,
  55. // 签到记录
  56. signInList: [],
  57. availableList: [],
  58. activeList: [],
  59. rateRecordInfo: {},
  60. // 签到id
  61. recordId: 0,
  62. // 剩余课时数
  63. residue: 0,
  64. cardStyle: {
  65. fontWeight: 'bold'
  66. },
  67. cellTitleStyle: {
  68. fontSize: '14px',
  69. fontWeight: 'bold',
  70. },
  71. }
  72. },
  73. onLoad(options) {
  74. this.classId = options.id
  75. },
  76. onShow() {
  77. this.initialize()
  78. this.signIndex = 0
  79. },
  80. onPullDownRefresh() {
  81. this.initialize()
  82. setTimeout(() => {
  83. uni.stopPullDownRefresh();
  84. }, 500)
  85. },
  86. methods: {
  87. // 获取初始化数据
  88. initialize() {
  89. // 获取会员服务班级详情
  90. NET.request(API.getMemberClassDetail, {
  91. id: this.classId
  92. }, 'POST').then(res => {
  93. this.residue = res.data.residue
  94. this.classId_b = res.data.classId
  95. this.signInList = res.data.signInList
  96. if(res.data.signInList.length) {
  97. const result = res.data.signInList
  98. if(result[0].status == 1) {
  99. let id=result[0].id
  100. this.recordId = id
  101. NET.request(API.getSignRemark, {id: id}, 'POST').then( res => {
  102. this.rateRecordInfo = { ...res.data }
  103. }
  104. )
  105. } else {
  106. this.rateRecordInfo = {}
  107. }
  108. }
  109. }).catch(error => {
  110. this.$refs.uTips.show({
  111. title: error.message,
  112. type: 'warning',
  113. })
  114. })
  115. // 获取我的班级全部请假列表
  116. NET.request(API.getAllLeaveList, {
  117. id: this.classId
  118. }, 'POST').then(res => {
  119. this.availableList = res.data.filter(site => site.status == 0).map(site => {
  120. return site.lastDate
  121. })
  122. this.activeList = res.data.filter(site => site.status == 1).map(site => {
  123. return site.lastDate
  124. })
  125. }).catch(error => {
  126. this.$refs.uTips.show({
  127. title: error.message,
  128. type: 'warning',
  129. })
  130. })
  131. },
  132. // 根据签到时间显示不同评价
  133. handleSignClick(id,index) {
  134. this.signIndex = index
  135. if(id) {
  136. this.recordId = id
  137. NET.request(API.getSignRemark, {id: id}, 'POST').then( res => {
  138. this.rateRecordInfo = { ...res.data }
  139. }
  140. )
  141. } else {
  142. this.rateRecordInfo = {}
  143. }
  144. },
  145. getSignInList(index) {
  146. this.signInShow = true
  147. },
  148. // 跳转历程表单
  149. goToCourseForm() {
  150. uni.navigateTo({
  151. url: '/pagesMember/courseForm?id=' + this.recordId + '&classId='+this.classId_b
  152. });
  153. },
  154. },
  155. }
  156. </script>
  157. <style>
  158. page {
  159. width: 100%;
  160. height: 100%;
  161. background-color: #f7f7f7;
  162. position: relative;
  163. }
  164. </style>
  165. <style lang="scss" scoped>
  166. @import "@/static/css/themes.scss";
  167. .content {
  168. width: 100%;
  169. float: left;
  170. padding-bottom: 60px;
  171. .signIn-box {
  172. display: flex;
  173. justify-content: space-around;
  174. .signIn-col {
  175. width: 40px;
  176. text-align: center;
  177. .signIn-date {
  178. margin-top: 5px;
  179. font-size: 10px;
  180. text-align: center;
  181. }
  182. }
  183. }
  184. /deep/.u-cell {
  185. padding: 26rpx 0;
  186. }
  187. }
  188. .rate-info {
  189. width: 100%;
  190. margin-top: 20rpx;
  191. margin-left: 5rpx;
  192. word-wrap: break-word;
  193. }
  194. </style>