<!-- 投诉评价 -->
<template>
	<view class="pageBg">
		<view class="content">
			<view class="topBack" :style="{marginTop:phoneHeight + 'px'}">
				<image src="../../static/icon_back@2x(1).png" style="width:48rpx ;height: 48rpx;margin-left: 36rpx;margin-top: 18rpx;"
				 @tap="back"></image>
			</view>
			<view class="topImg">
				<image src="../../static/complain_icon_complain@2x.png" style="width: 100%;height: 100%;"></image>
			</view>
			<view class="topTitle">
				投诉评价
			</view>
			<view class="main">
				<image src="../../static/appraise_bgimage@2x.png" style="width: 100%;height: 100%;"></image>
				<image src="../../static/appraise_icon_appraise@2x.png" class="mainImg"></image>
				<view class="fa">发表评价</view>
				<view class="star">
					
					<uni-rate :value="starNum" style="margin-top: 10rpx;margin-left: 80rpx;" @change="changeRate()"></uni-rate>
				</view>
				<image src="../../static/guarantee_icon_content@2x.png" class="contentImg"></image>
				<view class="contentTitle">
					评价内容
				</view>
				<view class="textContent">
					<textarea placeholder="请填写评价" style="width: 100%;height: 100%;" v-model="textRea"></textarea>
				</view>
				<!-- 图片盒字 -->
				<view style="width:646rpx;height: 114rpx;position: absolute;left: 24rpx;bottom: 40rpx;display: flex;">
					<view style="height: 114rpx;margin-right: 10rpx;display: flex;justify-content: space-between;" v-show="imgData" >
						<image style="width: 114rpx;height: 114rpx;margin-right: 10rpx;" :src="item.path" v-for="(item,index) in imgData" :key="index"></image>
					</view>
					<image src="../../static/circle_image@2x.png" style="width: 114rpx;height: 114rpx;" @tap="uploadImg(item)"></image>
				</view>
			</view>
		</view>
		<view class="submit" :class="{active:starNum && textRea}" @tap="submit">提交</view>
	</view>
</template>

<script>
	import uniRate from '@/components/uni-rate/uni-rate.vue'
	export default {
		data() {
			return {
				textRea:'',//评价内容
				starNum:0,//星星数量
				phoneHeight: 0, //手机状态栏的高度
				isShow: false,
				imgData: []
			}
		},
		 components: {uniRate},
		created() {
			// 获取状态栏的高度
			this.phoneHeight = uni.getSystemInfoSync().statusBarHeight
		},
		methods: {
			// 选择评分
		changeRate(e){
			this.starNum=e.value
		},
			// 图片上传
			uploadImg(item) {
				let that = this
				uni.chooseImage({
					count: 3, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success:(res)=> {
						console.log(res);
						this.imgData = res.tempFiles
					},
					
				});
			},
			// 提交
			submit(){
			   if(!this.textRea || !this.starNum){
				   return
			   }else{
				   uni.navigateTo({
				   	url:"../onlineRpair/evalueSuccess"
				   })
			   }
			},
			// 返回上一层
			back(){
				uni.navigateBack({
					delta:1
				})
			}
		},
		
	}
</script>

<style scoped>
	.submit {
		width: 702rpx;
		height: 90rpx;
		background: rgba(244, 244, 244, 1);
		opacity: 1;
		border-radius: 18rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(204, 204, 204, 1);
		position: absolute;
		bottom:56rpx;
		left: 26rpx;
		text-align: center;
		line-height: 90rpx;
	}

	.textContent {
		width: 646rpx;
		height: 168rpx;
		background: rgba(246, 250, 255, 1);
		border: 2rpx solid rgba(197, 224, 255, 1);
		opacity: 1;
		border-radius: 6rpx;
		position: absolute;
		left: 24rpx;
		bottom: 180rpx;
	}

	.contentImg {
		width: 33rpx;
		height: 40rpx;
		position: absolute;
		bottom: 460rpx;
		left: 330rpx;
	}

	.contentTitle {
		width: 116rpx;
		height: 40rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(41, 138, 253, 1);
		position: absolute;
		bottom: 388rpx;
		left: 290rpx;
	}

	.star {
		width: 386rpx;
		height: 49rpx;
		display: flex;
		justify-content: space-between;
		position: absolute;
		left: 156rpx;
		top: 194rpx;

	}

	.starImg {
		width: 51rpx;
		height: 49rpx;
	}

	.fa {
		width: 116rpx;
		height: 40rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(41, 138, 253, 1);
		position: absolute;
		top: 114rpx;
		left: 288rpx;
	}

	.mainImg {
		width: 40rpx;
		height: 46rpx;
		position: absolute;
		top: 40rpx;
		left: 326rpx;
	}

	.main {
		width: 692rpx;
		height: 844rpx;
		margin: 0 auto;
		margin-top: 24rpx;
		position: relative;
	}

	.topTitle {
		width: 128rpx;
		height: 44rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		margin: 0 auto;
		margin-top: 26rpx;
	}

	.topImg {
		width: 122rpx;
		height: 122rpx;
		margin: 0 auto;
		margin-top: 4rpx;
	}

	.pageBg {
		width: 100%;
		height: 100vh;
		background: linear-gradient(180deg, rgba(205, 227, 255, 1) 0%, rgba(133, 188, 255, 1) 100%);
		opacity: 1;
	}

	.content {
		width: 100%;
		position: absolute;
		top: 0;
	}
	.active{
		color:rgba(255,255,255,1);
		background:rgba(41,138,253,1);
		opacity:1;
	}
</style>
