<template>
	<view class="help-and-feedback">
		<textarea placeholder-style="color: #D3D3D3; font-size:28rpx;" cols="30" rows="10"
			placeholder="如果你在使用小程序的过程中，遇到任何体验问题或功能建议，欢迎反馈~" v-model="content"></textarea>
		<view style="margin-top: 400rpx;">
			<u-button text="提交" type="primary" @click="doFeedback"></u-button>
		</view>
		
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import {addFeedback} from '@/api/feedbackApi.js';
	export default {
		data() {
			return {
				content:""
			}
		},
		methods: {
			async doFeedback(){
				let sdata = {
					opinion : this.content
				};
				let res = await addFeedback(sdata);
				if(res.code == 200){
					this.$refs.uToast.show({
						type: "success",
						message: res.msg,
						duration: 1500,
						complete: () => {
							this.content = "";
						}
					});
				}else{
					this.$refs.uToast.show({
						type: "error",
						message: res.msg,
						duration: 1500,
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.help-and-feedback {
		padding: 25rpx;

		textarea {

			padding: 10rpx 0;
			width: 100%;
			border-bottom: 1px solid #EFEFEF;
			border-top: 1px solid #EFEFEF;
		}
	}
</style>