driverSchool/pagesA/evaluateAdd/index.vue

187 lines
5.4 KiB
Vue
Raw Normal View History

2025-03-15 17:32:23 +08:00
<template>
2025-04-07 16:47:05 +08:00
<view class="page flex-col">
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
2025-04-15 17:47:29 +08:00
<headers titles="评价详情">
2025-04-07 16:47:05 +08:00
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers>
</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">
<text class="text_2" v-if="show">{{ subjectArr[info.subject - 1] }}{{ title}}</text>
<text class="text_2" v-else>{{ info.busiName }}{{ title}}</text>
<text class="text_3">{{ info.time }}</text>
</view>
</view>
<view class="block_4 flex-row justify-between">
<view class="text-wrapper_1 flex-col">
<text class="text_4" v-if="show">{{ subjectArr[info.subject - 1] }}</text>
<text class="text_4" v-else>{{ info.busiName.slice(0, 3) }}</text>
</view>
<view class="text-wrapper_2 flex-col">
<text class="text_5">{{ info.courseType }}</text>
</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" />
<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" :readonly="!show"></u-rate>
<text style="margin-left: 5rpx;color:#E1A652;">{{ info.rate }}</text>
</view>
</view>
</view>
</view>
<view class="section_4 flex-col">
<text class="text_7">服务评价</text>
<view class="text-wrapper_3 flex-col">
<u--textarea v-model="info.serviceContent" :disabled="!show" autoHeight
placeholder="请输入内容"></u--textarea>
</view>
<text class="text_9">技术评价</text>
<view class="text-wrapper_4 flex-col">
<u--textarea v-model="info.teachContent" :disabled="!show" autoHeight placeholder="请输入内容"></u--textarea>
</view>
</view>
<view class="bottom_" v-if="show">
2025-04-03 16:47:39 +08:00
2025-04-15 17:47:29 +08:00
<view class="text-wrapper_5 flex-col" style="display: flex; justify-content: center; align-items: center; width: 80%;"
2025-04-07 16:47:05 +08:00
@click="submit">
2025-04-15 17:47:29 +08:00
<view style="background-color: #044EF2; padding: 20rpx 80rpx;text-align: center; border-radius: 20px; width: 85%;">
<text style="color: white; font-weight: 600; font-size: 32rpx;">确认评价</text>
2025-04-07 16:47:05 +08:00
</view>
</view>
</view>
</view>
2025-03-15 17:32:23 +08:00
</template>
<script>
2025-04-07 16:47:05 +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";
import {
login
} from "../../api/login";
2025-04-03 16:47:39 +08:00
2025-04-07 16:47:05 +08:00
export default {
components: {
UInput,
headers
},
data() {
return {
constants: {},
show: false,
title: '',
// 评价信息
info: {
rate: 0.0,
evaluateType: 0,
busiId: '',
tenantId: '',
subject: 0,
2025-04-12 17:52:46 +08:00
busiName: '',
2025-04-07 16:47:05 +08:00
},
subjectArr: ['科目一', '科目二', '科目三', '科目四'],
};
},
onLoad(options) {
const data = JSON.parse(options.data);
2025-04-12 17:52:46 +08:00
console.log('data',data)
2025-04-07 16:47:05 +08:00
// 判断新增还是查看
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 = '考试'
//评价类型为考试
2025-04-09 09:13:03 +08:00
this.info.evaluateType = 1
this.info.busiId = data.batchItemId
2025-04-07 16:47:05 +08:00
}
2025-04-09 09:13:03 +08:00
this.info.createTime = undefined
this.info.updataTime = undefined
this.info.creator = undefined
this.info.updater = undefined
2025-04-07 16:47:05 +08:00
} else {
Object.assign(this.info, data);
}
},
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
2025-04-03 16:47:39 +08:00
2025-04-07 16:47:05 +08:00
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'>
2025-04-07 16:47:05 +08:00
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
.bottom_ {
//固定在底部
position: fixed;
2025-04-15 17:47:29 +08:00
bottom: 1rpx;
2025-04-07 16:47:05 +08:00
width: 100%;
background: white;
2025-04-15 17:47:29 +08:00
padding: 15rpx 0;
2025-04-07 16:47:05 +08:00
display: flex;
justify-content: center;
2025-04-15 17:47:29 +08:00
2025-04-07 16:47:05 +08:00
/* 新增:水平居中 */
}
2025-04-09 09:13:03 +08:00
.text-group_2 {
display: inline-block;
max-width: 4em; /* 一个汉字大概占1em3em就是三个字 */
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
2025-03-15 17:32:23 +08:00
</style>