<template>
	<view class="content">
		<view class="param">
			<view class="proMiao">评价</view>
			<textarea class="proINname proIMi" v-model="evaluate" placeholder="请输入评价"/>
			<view class="proName">评分</view>
			<input class="proINname" v-model="score" placeholder="请输入评分"/>
			<view class="project">
				<view class="butt quxiao" @click="quxiao">取消</view>
				<view class="butt queren" @click="addScore">确定</view>
			</view>
			<view style="width: 100%;height: 60rpx;"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				evaluate:'',//评价
				score:'',//评分
				projectId:'',//项目id
			}
		},
		onLoad(option) {
			this.projectId=option.proId
		},
		methods: {
			//取消
			quxiao(){
				uni.switchTab({
					url:'/pages/project/index'
				})
			},
			//评分
			addScore(){
				let that = this
				if (!that.evaluate) {
					that.$queue.showToast("请输入评价");
				}else if (!that.score) {
					that.$queue.showToast("请输入评分");
				}else {
					uni.showLoading({
						title: '加载中',
						mask: true, // 是否显示透明蒙层，防止触摸穿透
					});
					var data={
						projectId: that.projectId,  
						evaluate: that.evaluate,
						score:that.score
					}
					that.$Request.postT('/api/sysProject/evaluate',data).then(res => {
						if (res.code==200) {
							uni.showToast({
								title: '评价成功',
								icon: 'none',
								duration:800
							});
							uni.hideLoading()
											
							setTimeout(function() {
								uni.switchTab({
									url:'/pages/project/index'
								})
							}, 1000)
						} else {
							uni.hideLoading();
							uni.showToast({
								title: res.message,
								icon: 'none',
								duration:800
							});
						}
					});
				}
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.param{
		margin: 20rpx 0 0 0;
		width: 100%;
		background-color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 41rpx;
		color: rgba(0, 0, 0, 1);
	}
	.proName{
		margin: 23rpx 0 0 20rpx;
	}
	.proINname{
		margin: 25rpx 0 0 21rpx;
		width: 709rpx;
		height: 90rpx;
		border-radius: 13rpx;
		background: rgba(245, 248, 252, 1);
		border: 1rpx solid rgba(229, 229, 229, 1);
		font-size: 28rpx;
		line-height: 90rpx;
		/* color: rgba(179, 179, 179, 1); */
	}
	.proIMi{
		height: 315rpx;
	}
	.proMiao{
		margin: 31rpx 0 0 20rpx;
	}
	.project{
		display: flex;
		margin: 61rpx 0 0 0;
		justify-content: space-evenly;
	}
	.butt{
		width: 330rpx;
		height: 90rpx;
		border-radius: 117rpx;
		font-size: 32rpx;
		line-height: 90rpx;
		text-align: center;
	}
	.quxiao{
		border: 1rpx solid rgba(0, 97, 255, 1);
		color: rgba(0, 97, 255, 1);
	}
	.queren{
		background: rgba(0, 97, 255, 1);
		color: rgba(255, 255, 255, 1);
	}
</style>