<template>
	<uni-forms ref="form" :modelValue="formData" :rules="rules" style="margin: 12px">
		<uni-forms-item label="意见反馈" name="content" label-position="top" required>
			<uni-easyinput type="textarea" :input-border="false" placeholder="请输入具体意见反馈" v-model="formData.content" />
		</uni-forms-item>
	</uni-forms>
	<view class="footer col-24 flex gap-8">
		<button class="col-12" @tap="back">取消</button>
		<button type="primary" @tap="submit" class="col-12">确定</button>
	</view>
</template>

<script>
	import {
		addFeedback
	} from '@/api/feedback.js'
	
	let _this;
	export default {
		data() {
			return {
				formData: {
				},
				rules: {
					thingDesc: {
						rules: [{
							required: true,
							errorMessage: '请输入具体意见反馈',
						}]
					}
				},
			}
		},
		onLoad() {
			_this = this;
		},
		methods: {
			submit() {
				this.$refs.form.validate().then(res => {
					addFeedback(this.formData).then(data => {
						_this.formData = {}
						uni.showToast({
							title: '操作成功',
							icon: 'none',
							duration: 3000
						})
						uni.navigateBack({
							
						});
					})
				}).catch(err => {
					console.log('表单错误信息：', err, this.formData);
				})
			},
			back() {
				uni.navigateBack({
					
				});
			}
		}
	}
</script>

<style>
</style>