Browse Source

评价

master
unknown 1 year ago
parent
commit
fe94479254
  1. 1
      common/js/mixins.js
  2. 2
      config/api.js
  3. 26
      pages/carEntry/evaluate/evaluate.vue
  4. 28
      pages/mineEntry/myEvaluate/myEvaluate.vue

1
common/js/mixins.js

@ -7,6 +7,7 @@ export default {
city: state=> state.user.vuex_cityInfo.city, city: state=> state.user.vuex_cityInfo.city,
vuex_cityInfo: state=> state.user.vuex_cityInfo, vuex_cityInfo: state=> state.user.vuex_cityInfo,
vuex_userInfo: state=> state.user.vuex_userInfo, vuex_userInfo: state=> state.user.vuex_userInfo,
userId: state=> state.user.vuex_loginInfo.userId,
apiOk: state=> state.user.apiOk, apiOk: state=> state.user.apiOk,
}), }),
}, },

2
config/api.js

@ -24,6 +24,8 @@ export const getExamSiteInfo = (params) => http.get('business/school/getExamSite
export const addSchoolComment = (data={}) => http.post('business/appcomplain/addSchoolComment', data,) export const addSchoolComment = (data={}) => http.post('business/appcomplain/addSchoolComment', data,)
// 创建教练评价 // 创建教练评价
export const addCoachComment = (data={}) => http.post('business/appcomplain/addCoachComment', data,) export const addCoachComment = (data={}) => http.post('business/appcomplain/addCoachComment', data,)
// 我的评价
export const getUsersCommentById = (params) => http.get('business/appcomplain/getUsersById', {params: params})
// 获取已报名驾校 // 获取已报名驾校
export const getStudentinfo = (params) => http.get('business/appcomplain/getStudentinfo', {params: params}) export const getStudentinfo = (params) => http.get('business/appcomplain/getStudentinfo', {params: params})
// 驾校评论分页 // 驾校评论分页

26
pages/carEntry/evaluate/evaluate.vue

@ -5,7 +5,7 @@
<evaluateItem :info="coachInfo" key="2"/> <evaluateItem :info="coachInfo" key="2"/>
<view class="btnBox"> <view class="btnBox">
<view class="btnBg" @click="submintFn">提交</view>
<view class="btnBg" @click="submintFn" :class="{active: btnActive}">提交</view>
</view> </view>
</view> </view>
</template> </template>
@ -51,9 +51,10 @@
"studentName": "张三", "studentName": "张三",
"studentIdcard": "", "studentIdcard": "",
"studentPhone": "", "studentPhone": "",
"serviceLevel": 0,
"schoolInfo": 0,
"schoolLevel": 0, "schoolLevel": 0,
"qualityLevel": 0, "qualityLevel": 0,
"serviceLevel": 0,
"teachLevel": 0, "teachLevel": 0,
"subject": 0, "subject": 0,
"description": "随便", "description": "随便",
@ -68,11 +69,21 @@
}, },
onLoad() { onLoad() {
this.schoolInfo.userId = this.$store.state.user.vuex_loginInfo.userId this.schoolInfo.userId = this.$store.state.user.vuex_loginInfo.userId
this.coachInfo.userId = this.$store.state.user.vuex_loginInfo.userId
this.coachInfo.studentPhone = this.vuex_userInfo.studentPhone
this.getStudentinfoFn() this.getStudentinfoFn()
}, },
computed: { computed: {
btnActive() { btnActive() {
// if(this.schoolInfo.)
let {schoolInfo, coachInfo} = this
let num1 = schoolInfo.schoolLevel + schoolInfo.qualityLevel + schoolInfo.teachLevel + schoolInfo.serviceLevel
let num2 = coachInfo.qualityLevel + coachInfo.teachLevel + coachInfo.serviceLevel
if(num1&&num2) {
return true
}else {
return false
}
} }
}, },
methods: { methods: {
@ -93,7 +104,10 @@
} }
const res = await addSchoolComment(this.schoolInfo) const res = await addSchoolComment(this.schoolInfo)
const res2 = await addCoachComment(this.coachInfo) const res2 = await addCoachComment(this.coachInfo)
this.$u.toast('评价成功')
setTimeout(()=>{
this.$goPage('/pages/mineEntry/myEvaluate/myEvaluate')
},1500)
} }
} }
} }
@ -109,6 +123,10 @@
.btnBg { .btnBg {
margin: 124rpx auto 0 auto; margin: 124rpx auto 0 auto;
width: 396rpx; width: 396rpx;
opacity: 0.5;
&.active {
opacity: 1;
}
} }
.textareaBg { .textareaBg {

28
pages/mineEntry/myEvaluate/myEvaluate.vue

@ -1,17 +1,37 @@
<template> <template>
<view class="pageBgImg pad">
<view class="pageBgImg ">
<topNavbar title="我的评价"></topNavbar> <topNavbar title="我的评价"></topNavbar>
<view class="card">
<commentItem/>
<view class="pad">
<view class="card" v-for="(item,index) in list" :key="index">
<commentItem :item="item"/>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { getUsersCommentById } from '@/config/api.js'
export default { export default {
data() { data() {
return { return {
params: {
userId: '', pageNo: 1,pageSize: 20
},
total: 20,
list: []
}
},
onLoad() {
this.getUsersCommentByIdFn()
this.params.userId = this.userId
},
methods: {
async getUsersCommentByIdFn() {
const {data: res} = await getUsersCommentById(this.params)
this.params.pageNo ++
this.list.push(...res.list)
this.total = res.total
} }
} }
} }

Loading…
Cancel
Save