myClassDetail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. signIndex: 0,
  53. signInShow: false,
  54. // 签到记录
  55. signInList: [],
  56. availableList: [],
  57. activeList: [],
  58. rateRecordInfo: {},
  59. // 签到id
  60. recordId: 0,
  61. // 剩余课时数
  62. residue: 0,
  63. cardStyle: {
  64. fontWeight: 'bold'
  65. },
  66. cellTitleStyle: {
  67. fontSize: '14px',
  68. fontWeight: 'bold',
  69. },
  70. }
  71. },
  72. onLoad(options) {
  73. this.classId = options.id
  74. },
  75. onShow() {
  76. this.initialize()
  77. this.signIndex = 0
  78. },
  79. onPullDownRefresh() {
  80. this.initialize()
  81. setTimeout(() => {
  82. uni.stopPullDownRefresh();
  83. }, 500)
  84. },
  85. methods: {
  86. // 获取初始化数据
  87. initialize() {
  88. // 获取会员服务班级详情
  89. NET.request(API.getMemberClassDetail, {
  90. id: this.classId
  91. }, 'POST').then(res => {
  92. this.residue = res.data.residue
  93. this.signInList = res.data.signInList
  94. if(res.data.signInList.length) {
  95. const result = res.data.signInList
  96. if(result[0].status == 1) {
  97. this.recordId = id
  98. NET.request(API.getSignRemark, {id: id}, 'POST').then( res => {
  99. this.rateRecordInfo = { ...res.data }
  100. }
  101. )
  102. } else {
  103. this.rateRecordInfo = {}
  104. }
  105. }
  106. }).catch(error => {
  107. this.$refs.uTips.show({
  108. title: error.message,
  109. type: 'warning',
  110. })
  111. })
  112. // 获取我的班级全部请假列表
  113. NET.request(API.getAllLeaveList, {
  114. id: this.classId
  115. }, 'POST').then(res => {
  116. this.availableList = res.data.filter(site => site.status == 0).map(site => {
  117. return site.lastDate
  118. })
  119. this.activeList = res.data.filter(site => site.status == 1).map(site => {
  120. return site.lastDate
  121. })
  122. }).catch(error => {
  123. this.$refs.uTips.show({
  124. title: error.message,
  125. type: 'warning',
  126. })
  127. })
  128. },
  129. // 根据签到时间显示不同评价
  130. handleSignClick(id,index) {
  131. this.signIndex = index
  132. if(id) {
  133. this.recordId = id
  134. NET.request(API.getSignRemark, {id: id}, 'POST').then( res => {
  135. this.rateRecordInfo = { ...res.data }
  136. }
  137. )
  138. } else {
  139. this.rateRecordInfo = {}
  140. }
  141. },
  142. getSignInList(index) {
  143. this.signInShow = true
  144. },
  145. // 跳转历程表单
  146. goToCourseForm() {
  147. uni.navigateTo({
  148. url: '/pagesMember/courseForm?id=' + this.recordId
  149. });
  150. },
  151. },
  152. }
  153. </script>
  154. <style>
  155. page {
  156. width: 100%;
  157. height: 100%;
  158. background-color: #f7f7f7;
  159. position: relative;
  160. }
  161. </style>
  162. <style lang="scss" scoped>
  163. @import "@/static/css/themes.scss";
  164. .content {
  165. width: 100%;
  166. float: left;
  167. padding-bottom: 60px;
  168. .signIn-box {
  169. display: flex;
  170. justify-content: space-around;
  171. .signIn-col {
  172. width: 40px;
  173. text-align: center;
  174. .signIn-date {
  175. margin-top: 5px;
  176. font-size: 10px;
  177. text-align: center;
  178. }
  179. }
  180. }
  181. /deep/.u-cell {
  182. padding: 26rpx 0;
  183. }
  184. }
  185. .rate-info {
  186. width: 100%;
  187. margin-top: 20rpx;
  188. margin-left: 5rpx;
  189. word-wrap: break-word;
  190. }
  191. </style>