|
|
<template> <view class="pageBgImg"> <topNavbar title="评价"></topNavbar> <evaluateItem :info="schoolInfo" key="1" v-show="showSchool" @updatedForm="updatedSchoolInfo"/> <evaluateItem :info="coachInfo" key="2" @updatedForm="updatedCoachInfo"/>
<view class="btnBox"> <view class="btnBg" @click="submintFn" :class="{active: btnActive}">提交</view> </view> </view> </template>
<script> import evaluateItem from './comp/evaluateItem' import { getStudentinfo, addSchoolComment,addCoachComment } from '@/config/api.js' import school from '../../../store/modules/school' export default { components: { evaluateItem }, data() { return { checked: false, info: {}, schoolInfo: {}, coachInfo: {}, subject: '', showSchool: true, coachType: '', //1.教练 2.模拟教练 3.模拟器老师
} }, onLoad(options) { if(options.tit) { this.tit = options.tit this.showSchool = false } if(options.coachType) this.coachType = options.coachType this.subject = options.subject this.getStudentinfoFn() }, computed: { btnActive() { let {schoolInfo, coachInfo} = this let num1 = schoolInfo.schoolLevel + schoolInfo.qualityLevel + schoolInfo.teachLevel + schoolInfo.serviceLevel let num2 = coachInfo.qualityLevel + coachInfo.teachLevel + coachInfo.serviceLevel if(this.subject==2&&num1&&num2) { return true }else if(this.subject!=2&&num2){ return true }else { return false } } }, methods: { updatedCoachInfo(val) { this.coachInfo = val }, updatedSchoolInfo(val) { this.schoolInfo = val }, initFrom() { this.schoolInfo = { tit: '您对驾校满意吗?', school: 1, "schoolId": 8750, "schoolName": "", "stars": 0, "studentId": '', "studentIdcard": "", "studentPhone": "", "serviceLevel": 0, "schoolLevel": 0, "qualityLevel": 0, "teachLevel": 0, "subject": 0, "description": "", "images": "", "videoUrl": "", "anonymity": 2, "userId": 0, imgArr: [], coachType: this.coachType } this.coachInfo = { tit: '您对教练满意吗?', "schoolId": 8750, "stars": 0, "studentId": '', "studentIdcard": "", "studentPhone": "", "schoolInfo": 0, "schoolLevel": 0, "qualityLevel": 0, "serviceLevel": 0, "teachLevel": 0, "subject": 0, "description": "", "images": "", "videoUrl": "", "anonymity": 2, "userId": 0, coachName: '', imgArr: [], coachType: this.coachType } if(this.tit=='模拟器老师') { this.coachInfo.tit = '您对模拟器老师满意吗?' } if(this.tit=='考场模拟老师') { this.coachInfo.tit = '您对考场模拟老师满意吗?' } this.coachInfo.subject = this.schoolInfo.subject = this.subject this.coachInfo.userId = this.schoolInfo.userId = this.$store.state.user.vuex_loginInfo.userId this.coachInfo.studentPhone = this.vuex_userInfo.studentPhone this.coachInfo.schoolId = this.schoolInfo.schoolId = this.info.schoolId this.coachInfo.schoolName = this.schoolInfo.schoolName = this.info.schoolName this.coachInfo.coachName = this.info.coachName this.coachInfo.coachId = this.info.coachId }, // 获取用户驾校信息
async getStudentinfoFn() { const {data: res} = await getStudentinfo({id: this.$store.state.user.vuex_loginInfo.userId}) this.info = res this.initFrom() }, async submintFn() { if(this.coachInfo.imgArr.length) { this.coachInfo.images = this.coachInfo.imgArr.join(',') } if(this.schoolInfo.imgArr.length) { this.schoolInfo.images = this.schoolInfo.imgArr.join(',') } let schoolScore = [this.schoolInfo.serviceLevel,this.schoolInfo.schoolLevel,this.schoolInfo.teachLevel,this.schoolInfo.qualityLevel].some(item=>item*1>0) let coachInfoScore = [this.coachInfo.serviceLevel,this.coachInfo.teachLevel,this.coachInfo.qualityLevel].some(item=>item*1>0) if(this.subject==2&&!schoolScore) return this.$u.toast('请对驾校评分') if(!coachInfoScore) return this.$u.toast('请对教练评分') const res = await addSchoolComment(this.schoolInfo) const res2 = await addCoachComment(this.coachInfo) this.initFrom() this.$u.toast('评价成功') setTimeout(()=>{ this.$goPage('/pages/mineEntry/myEvaluate/myEvaluate') },1500) } } } </script>
<style lang="scss" scoped> @import '../../../common/css/textareaBg.scss';
.btnBox { padding-bottom: 76rpx; }
.btnBg { margin: 90rpx auto 0 auto; width: 396rpx; opacity: 0.5; &.active { opacity: 1; } }
.textareaBg { margin-top: 22rpx; }
.card { padding: 28rpx;
.top_row { display: flex; align-items: center; padding-bottom: 24rpx; border-bottom: 2rpx solid #E8E9EC; justify-content: space-between;
.tit { font-weight: 600; color: #333333; font-size: 32rpx; }
}
.user_row { width: 100%; height: 100rpx; display: flex; align-items: center;
.avatar { width: 60rpx; height: 60rpx; border-radius: 50%; overflow: hidden; }
.name { font-size: 28rpx; font-weight: 500; padding-left: 26rpx; } }
.star_row { padding: 14rpx 0; display: flex; align-items: center;
.lab { font-size: 28rpx; font-weight: 500; padding-right: 32rpx; }
.star {} } } </style>
|