driverSchool/newPages/evaluateAdd/index.vue

160 lines
4.9 KiB
Vue
Raw Normal View History

2025-03-15 17:32:23 +08:00
<template>
<view class="page flex-col">
2025-04-03 16:47:39 +08:00
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
<headers titles="评价表单">
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers>
2025-03-15 17:32:23 +08:00
</view>
<view class="section_2 flex-col">
<view class="box_2 flex-col">
<view class="block_3 flex-row">
<view class="text-group_1 flex-col justify-between">
2025-04-03 16:47:39 +08:00
<text class="text_2">{{ subjectArr[info.subject - 1] }}{{ title}}</text>
<text class="text_3">{{ info.time }}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
<view class="block_4 flex-row justify-between">
<view class="text-wrapper_1 flex-col">
2025-04-03 16:47:39 +08:00
<text class="text_4">{{ subjectArr[info.subject - 1] }}</text>
2025-03-15 17:32:23 +08:00
</view>
<view class="text-wrapper_2 flex-col">
2025-04-03 16:47:39 +08:00
<text class="text_5">{{ info.courseType }}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
<view class="block_5 flex-row">
<view class="image-text_1 flex-row justify-between">
<image
class="label_2"
referrerpolicy="no-referrer"
src="/static/lanhu_pingjiabiaodan/FigmaDDSSlicePNG9781bf564ae15eee66e88c90622422db.png"
/>
2025-04-03 16:47:39 +08:00
<text class="text-group_2">{{ info.coachName }}</text>
</view>
<view style="display: flex; align-items: center;">
<u-rate active-color="#EAA140" v-model="info.rate" allowHalf inactive-color="#b2b2b2" @change="changeRate"></u-rate>
<text style="margin-left: 5rpx;color:#E1A652;">{{ info.rate }}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
</view>
</view>
<view class="section_4 flex-col">
<text class="text_7">服务评价</text>
<view class="text-wrapper_3 flex-col">
2025-04-03 16:47:39 +08:00
<u--textarea v-model="info.serviceContent" placeholder="请输入内容" ></u--textarea>
2025-03-15 17:32:23 +08:00
</view>
<text class="text_9">技术评价</text>
<view class="text-wrapper_4 flex-col">
2025-04-03 16:47:39 +08:00
<u--textarea v-model="info.teachContent" placeholder="请输入内容" ></u--textarea>
</view>
</view>
<view class="bottom_" v-if="show">
<view class="text-wrapper_5 flex-col" style="display: flex; justify-content: center; width: 60%;" @click="submit">
<view style="background-color: #044EF2; padding: 20rpx 80rpx; border-radius: 18rpx;text-align: center ">
<text style="color: white; font-size: 28rpx;">确认评价</text>
</view>
2025-03-15 17:32:23 +08:00
</view>
</view>
</view>
</template>
<script>
2025-04-03 16:47:39 +08:00
import headers from "@/components/header/headers.vue";
import request from "@/utils/request";
import UInput from "@/uni_modules/uview-ui/components/u--input/u--input.vue";
import {getLocalUserInfo} from "@/utils/auth";
2025-03-15 17:32:23 +08:00
export default {
2025-04-03 16:47:39 +08:00
components: {UInput, headers},
2025-03-15 17:32:23 +08:00
data() {
return {
2025-04-03 16:47:39 +08:00
constants: {},
show: false,
title:'',
// 评价信息
info:{
rate: 0.0,
evaluateType: 0,
busiId: '',
tenantId: '',
subject: 0,
},
subjectArr: ['科目一', '科目二', '科目三', '科目四'],
2025-03-15 17:32:23 +08:00
};
},
2025-04-03 16:47:39 +08:00
onLoad(options){
const data = JSON.parse(options.data);
// 判断新增还是查看
if (options.controls) {
this.show = true
Object.assign(this.info, data);
this.info.id = null
//设置默认评分
this.info.rate = 0.0
if (options.type === 'xunlian') {
this.title = '训练'
//评价类型为训练
this.info.evaluateType = 0
//业务id
this.info.busiId = data.id
this.info.time = data.trainDay
} else if (options.type === 'kaoshi') {
this.title = '考试'
//评价类型为考试
this.info.evaluateType = 0
}
}
console.log(this.info)
},
methods: {
changeRate(){},
submit(){
// 判断评分、评价不能为空
if (this.info.rate === 0.0 || this.info.serviceEvaluate === '' || this.info.technologyEvaluate === '') {
uni.showToast({
title: '请填写完整评价信息',
icon: 'none',
duration: 2000
})
return
}
//获取userId
const user = getLocalUserInfo();
this.info.userId = user.id
this.info.userName = user.nickname
request({
url: '/app-api/feed-back',
method: 'post',
data: this.info,
}).then(res => {
uni.showToast({
title: '评价成功',
icon: 'none',
duration: 2000
})
setTimeout(() => {
//触发刷新事件
uni.$emit('refresh');
uni.navigateBack()
}, 2000)
})
}
}
2025-03-15 17:32:23 +08:00
};
</script>
<style lang='scss'>
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
2025-04-03 16:47:39 +08:00
.bottom_{
//固定在底部
position: fixed;
bottom: 10rpx;
width: 100%;
background: white;
padding: 40rpx 0;
display: flex;
justify-content: center; /* 新增:水平居中 */
}
2025-03-15 17:32:23 +08:00
</style>