<template>
	
		<van-popup :show="show" :round="true" @close="closepopup">
			<view class="commentPopup-box">
				<van-icon class="commentPopup-closure" name="cross" @click="closepopup" />
				<view class="commentPopup-title">修改评语</view>
				<view class="commentPopup-content">
					<textarea placeholder="请填写评语内容" v-model="stuCommentObj.Info" maxlength="-1"></textarea>
				</view>
				<view class="commentPopup-save flex">
					
					<view @click="save">确认</view>
				</view>
			</view>
		</van-popup>
</template>
<script>
	import {
		ref,
		reactive,
		toRefs,
		onMounted,
		getCurrentInstance,
		inject,
		watch
	} from "vue";
	import {
		uploadFile
	} from "@/utils/index";
	export default {
		props: {

		},
		components: {},
		emits: ['change'],
		setup(props, ctx) {
			// 双滑块模式时，值必须是数组
			const value = ref([10, 50]);
			let {
				proxy
			} = getCurrentInstance();
			let data = reactive({
				show: false,
				loading: false,
				stuCommentObj: {
					Id: 0,
					Info: ""
				}
			});
			let methods = {
				showFun(item) {
					if (item) {
						data.stuCommentObj.Id = item.Id;
						data.stuCommentObj.Info = item.Info;
					}
					data.show = true
				},
				closepopup() {
					data.show = false
				},
				save() {
					uni.showLoading()
					proxy.$request("/Teacher/SetStuCommentInfo", data.stuCommentObj).then(res => {
						if (res.Code == 1) {
							ctx.emit("change");
							data.show = false
						}else{
							uni.showToast({
								icon: 'none',
								duration: 2000,
								title:'保存失败，请重试'
							});
						}
						uni.hideLoading()
					});
				}
			};
			let that = methods;
			return {
				...toRefs(data),
				value,
				...methods
			};
		},
		onLoad() {

		},
		onShow() {

		}
	};
</script>
<style scoped>
	.commentPopup-content textarea{
		width: 100%;
		font-size: 30rpx;
		line-height: 58rpx;
		font-weight: 400;
		height: 50vh;
		color: #282828;
	}
	.commentPopup-content {
		background: #F7F7F7;
		border-radius: 30rpx;
		padding: 37rpx 43rpx;
	}

	.commentPopup-save view {
		background: #C91727;
		font-size: 30rpx;
		font-weight: bold;
		letter-spacing: 1rpx;
		width: 260rpx;
		line-height: 88rpx;
		border-radius: 44rpx;
		text-align: center;
		color: #FFFFFF;
	}
	.commentPopup-save{
		justify-content: center;
		margin-top: 60rpx;
	}
	.commentPopup-title {
		width: 100%;
		text-align: center;
		font-size: 30rpx;
		font-weight: 500;
		margin-bottom: 73rpx;
		letter-spacing: 1rpx;
	}

	.commentPopup-closure {
		position: absolute;
		right: 31rpx;
		top: 31rpx;
		color: #282828;
		font-size: 38rpx;
	}

	.commentPopup-box {
		position: relative;
		width: 548rpx;
		padding: 48rpx 55rpx 60rpx 55rpx;
	}

	.commentPopup-box {}
</style>
