123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <view class="content">
- <u-card title="剩余课时" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <view slot="body">{{ residue }}</view>
- </u-card>
- <u-card title="签到记录" sub-title="查看更多" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle"
- @head-click="getSignInList">
- <view class="signIn-box" slot="body">
- <view class="signIn-col" v-for="(item, index) in signInList" :key="index" @click="handleSignClick(item.id,index)">
- <u-icon name="bookmark" :color="signIndex === index ? '#41b0fe' : '#666666'" size="64" v-if="!item.status"></u-icon>
- <u-icon name="bookmark-fill" :color="signIndex === index ? '#41b0fe' : mainColor" size="64" v-else></u-icon>
- <view class="signIn-date">{{item.date}}</view>
- </view>
- </view>
- </u-card>
- <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">
- <!-- <u-cell-group slot="body" :border="false" style="padding: 0px;">
- <u-cell-item :title="(item.type? '家长' : '教练') + '-' + item.name" :value="item.time" :label="item.content" v-for="(item, index) in classInfo.growList"
- :key="index" :arrow="false" :title-style="cellTitleStyle"></u-cell-item>
- </u-cell-group> -->
- <view slot="body">
- <u-rate :count="10" :current="rateRecordInfo.star" :size="40" :gutter="10" :active-color="mainColor" isClick></u-rate>
- <view class="rate-info">学生评价: {{ rateRecordInfo.userRemark }}</view>
- <view class="rate-info" v-if="rateRecordInfo.coachRemark">教练回复: {{ rateRecordInfo.coachRemark }}</view>
- </view>
- </u-card>
- <!-- <view class="handle-fix-box" v-if="Object.keys(rateRecordInfo).length"> -->
- <view class="handle-fix-box" v-if="Object.keys(rateRecordInfo).length && !rateRecordInfo.userRemark">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToCourseForm()">填写评价</u-button>
- </view>
- <u-calendar v-model="signInShow" mode="date" :active-bg-color="mainColor" btn-type="error" availableText="未签到"
- activeText="已签到" :available="availableList" :activeList="activeList" @change="setSingTime"></u-calendar>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor',
- 'customStyle',
- ])
- },
- data() {
- return {
- allDateList:[],
- classId: '',
- classId_b: '',
- signIndex: 0,
- signInShow: false,
- // 签到记录
- signInList: [],
- availableList: [],
- activeList: [],
- rateRecordInfo: {},
- // 签到id
- recordId: 0,
- // 剩余课时数
- residue: 0,
- cardStyle: {
- fontWeight: 'bold'
- },
- cellTitleStyle: {
- fontSize: '14px',
- fontWeight: 'bold',
- },
- }
- },
- onLoad(options) {
- this.classId = options.id
- },
- onShow() {
- this.initialize()
- this.signIndex = 0
- },
- onPullDownRefresh() {
- this.initialize()
- setTimeout(() => {
- uni.stopPullDownRefresh();
- }, 500)
- },
- methods: {
- setSingTime(object) {
- console.log(this.formatDatedel0(object.result))
- let selectDate=this.formatDatedel0(object.result)
- let newArr=[]
- for(var i=0;i<this.allDateList.length;i++){
- if(this.formatDatedel0(this.allDateList[i].lastDate)==selectDate){
- newArr=this.allDateList.slice(i,8)
- break
- }
- }
- if(newArr.length==0){
- return false
- }
- for(var i=0;i<newArr.length;i++){
- newArr[i].date=newArr[i].lastDate
- }
- this.signInList=newArr
- if(newArr[0].id==null){
- this.rateRecordInfo={}
- }
- NET.request(API.getSignRemark, {id: newArr[0].id}, 'POST').then( res => {
- this.rateRecordInfo = { ...res.data }
- }
- )
- },
- // 获取初始化数据
- initialize() {
- console.log(123123)
- // 获取会员服务班级详情
- NET.request(API.getMemberClassDetail, {
- id: this.classId
- }, 'POST').then(res => {
- this.residue = res.data.residue
- this.classId_b = res.data.classId
- this.signInList = res.data.signInList
- if(res.data.signInList.length) {
- const result = res.data.signInList
- if(result[0].status == 1) {
- let id=result[0].id
- this.recordId = id
- NET.request(API.getSignRemark, {id: id}, 'POST').then( res => {
- this.rateRecordInfo = { ...res.data }
- }
- )
- } else {
- this.rateRecordInfo = {}
- }
- }
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- // 获取我的班级全部请假列表
- NET.request(API.getAllLeaveList, {
- id: this.classId
- }, 'POST').then(res => {
- this.allDateList = res.data
- this.availableList = res.data.filter(site => site.status == 0).map(site => {
- return this.formatDatedel0(site.lastDate)
- })
- this.activeList = res.data.filter(site => site.status == 1).map(site => {
- return this.formatDatedel0(site.lastDate)
- })
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- formatDatedel0(str) {
- // 根据 - 符号拆分
- return str
- .split("-")
- .map((item) => {
- // +item 将item字符串转换为数字
- // 小于10的时候就补全一个前缀0
- if (+item < 10) {
- return Number(item);
- }
-
- // 大于10的时候不用补0
- return item;
- })
- .join("-"); // 最后重组回来
- },
- // 根据签到时间显示不同评价
- handleSignClick(id,index) {
- this.signIndex = index
- if(id) {
- this.recordId = id
- NET.request(API.getSignRemark, {id: id}, 'POST').then( res => {
- this.rateRecordInfo = { ...res.data }
- }
- )
- } else {
- this.rateRecordInfo = {}
- }
- },
- getSignInList(index) {
- this.signInShow = true
- },
- // 跳转历程表单
- goToCourseForm() {
- uni.navigateTo({
- url: '/pagesMember/courseForm?id=' + this.recordId + '&classId='+this.classId_b
- });
- },
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #f7f7f7;
- position: relative;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- padding-bottom: 60px;
- .signIn-box {
- display: flex;
- justify-content: space-around;
- .signIn-col {
- width: 40px;
- text-align: center;
- .signIn-date {
- margin-top: 5px;
- font-size: 10px;
- text-align: center;
- }
- }
- }
- /deep/.u-cell {
- padding: 26rpx 0;
- }
- }
- .rate-info {
- width: 100%;
- margin-top: 20rpx;
- margin-left: 5rpx;
- word-wrap: break-word;
- }
- </style>
|