myClassDetail.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="content">
  3. <u-card title="签到记录" sub-title="查看更多" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle"
  4. @head-click="getSignInList">
  5. <view class="signIn-box" slot="body">
  6. <view class="signIn-col" v-for="(item, index) in classInfo.signInList" :key="index">
  7. <u-icon name="bookmark" color="#666666" size="64" v-if="!item.status"></u-icon>
  8. <u-icon name="bookmark-fill" :color="mainColor" size="64" v-else></u-icon>
  9. <view class="signIn-date">{{item.date}}</view>
  10. </view>
  11. </view>
  12. </u-card>
  13. <u-card title="成长经历" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  14. <u-cell-group slot="body" :border="false" style="padding: 0px;">
  15. <u-cell-item :title="(item.type? '家长' : '教练') + '-' + item.name" :value="item.time" :label="item.content" v-for="(item, index) in classInfo.growList"
  16. :key="index" :arrow="false" :title-style="cellTitleStyle"></u-cell-item>
  17. </u-cell-group>
  18. </u-card>
  19. <view class="handle-fix-box">
  20. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToCourseForm()">填写历程</u-button>
  21. </view>
  22. <u-calendar v-model="signInShow" mode="date" :active-bg-color="mainColor" btn-type="error" availableText="未签到"
  23. activeText="已签到" :available="availableList" :activeList="activeList" :handleStatus="false"></u-calendar>
  24. <u-top-tips ref="uTips"></u-top-tips>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. mapGetters
  30. } from 'vuex'
  31. const NET = require('@/utils/request')
  32. const API = require('@/config/api')
  33. export default {
  34. computed: {
  35. ...mapGetters([
  36. 'mainColor',
  37. 'customStyle',
  38. ])
  39. },
  40. data() {
  41. return {
  42. classId: '',
  43. classInfo: {
  44. growList: [],
  45. signInList: [],
  46. },
  47. signInShow: false,
  48. availableList: [],
  49. activeList: [],
  50. cardStyle: {
  51. fontWeight: 'bold'
  52. },
  53. cellTitleStyle: {
  54. fontSize: '14px',
  55. fontWeight: 'bold',
  56. },
  57. }
  58. },
  59. onLoad(options) {
  60. this.classId = options.id
  61. },
  62. onShow() {
  63. this.initialize()
  64. },
  65. onPullDownRefresh() {
  66. this.initialize()
  67. setTimeout(() => {
  68. uni.stopPullDownRefresh();
  69. }, 500)
  70. },
  71. methods: {
  72. // 获取初始化数据
  73. initialize() {
  74. NET.request(API.getMemberClassDetail, {
  75. id: this.classId
  76. }, 'POST').then(res => {
  77. this.classInfo = res.data
  78. }).catch(error => {
  79. this.$refs.uTips.show({
  80. title: error.message,
  81. type: 'warning',
  82. })
  83. })
  84. NET.request(API.getAllLeaveList, {
  85. id: this.classId
  86. }, 'POST').then(res => {
  87. this.availableList = res.data.filter(site => site.status == 0).map(site => {
  88. return site.lastDate
  89. })
  90. this.activeList = res.data.filter(site => site.status == 1).map(site => {
  91. return site.lastDate
  92. })
  93. }).catch(error => {
  94. this.$refs.uTips.show({
  95. title: error.message,
  96. type: 'warning',
  97. })
  98. })
  99. },
  100. getSignInList(index) {
  101. this.signInShow = true
  102. },
  103. // 跳转历程表单
  104. goToCourseForm() {
  105. uni.navigateTo({
  106. url: '/pagesMember/courseForm?id=' + this.classId
  107. });
  108. },
  109. },
  110. }
  111. </script>
  112. <style>
  113. page {
  114. width: 100%;
  115. height: 100%;
  116. background-color: #f7f7f7;
  117. position: relative;
  118. }
  119. </style>
  120. <style lang="scss" scoped>
  121. @import "@/static/css/themes.scss";
  122. .content {
  123. width: 100%;
  124. float: left;
  125. padding-bottom: 60px;
  126. .signIn-box {
  127. display: flex;
  128. justify-content: space-around;
  129. .signIn-col {
  130. width: 40px;
  131. text-align: center;
  132. .signIn-date {
  133. margin-top: 5px;
  134. font-size: 10px;
  135. text-align: center;
  136. }
  137. }
  138. }
  139. /deep/.u-cell {
  140. padding: 26rpx 0;
  141. }
  142. }
  143. </style>