<template>
	<view class="u-p-30 backconfig">
		<view class="u-f-28 u-p-b-28" style="font-weight: 400; color: #333333">任务标题：{{ taskdetail.title }}</view>
		<view class="text-span">
			<textarea style="width: 100%; height: 180rpx" v-model="form.content" placeholder="请输入你反馈的内容"></textarea>
			<view class="m-w u-flex">
				<!-- <block>
					<view class="u-m-l-6" v-for="(item,index) in uploadlist4" :key="index">
						<u-image @click="previewImage(index,uploadlist4)" width="76" height="76" :src="item"></u-image>
					</view>
				</block>
				<view @click="unloadimg(3)" class="upload-image ">+</view> -->
				<c-img class="u-border" @changeImg="changeImg($event)"></c-img>
			</view>
			<view @click="submit" class="task-btn">提交</view>
			<u-toast ref="uToast" />
		</view>
	</view>
</template>

<script>
import cImg from '@/components/c-img/index.vue'
import { taskfeedbacksave } from '@/api/index.js'
export default {
	components: {
		cImg
	},
	data() {
		return {
			taskdetail: '', //任务详情
			//反馈提交表单
			form: {
				content: '',
				images: ''
			}
		}
	},
	onLoad() {
		this.taskdetail = this.$store.state.user.taskdetail
	},
	methods: {
		changeImg(img) {
			this.form.images = img
		},
		// 提交反馈请求
		submit() {
			const id = this.taskdetail.id

			taskfeedbacksave({
				taskId: id,
				...this.form
			}).then(({ code, message }) => {
				this.$refs.uToast.show({
					title: code == 200 ? '提交成功' : message,
					type: code == 200 ? 'success' : 'info',
					callback() {
						if (code == 200) {
							uni.navigateBack(1)
						}
					}
				})
			})
		}
	}
}
</script>

<style scoped>
.backconfig {
	height: 100vh;
	position: relative;
}

.text-span {
	width: 690rpx;
	height: 400rpx;
	background: #f2f2f2;
	border-radius: 10rpx;
	margin-top: 28rpx;
	padding: 21rpx;
}

.task-btn {
	width: 690rpx;
	height: 90rpx;
	background: #4a8bff;
	border-radius: 4rpx;
	position: absolute;
	bottom: 30rpx;
	font-size: 28rpx;
	font-family: Microsoft YaHei-3970(82674968);
	font-weight: bold;
	text-align: center;
	line-height: 90rpx;
	color: #ffffff;
}
</style>
