<template>
	<view class='use-page'>
		<view class='use-mian'>
			<view class='main-con'>
				<view class='box-title'>
					<view class='label-icon'>*</view>
					<view class='label-text'>描述</view>
				</view>
				<view class='box-tarea'>
					<textarea class='box-con' placeholder="请详细描述您的问题或建议，我们将及时跟进" maxlength="100"
						@input="sufontnum($event)"></textarea>
					<text class='contain-length'>{{ fountNum }}/<text class="length-total">100</text>字</text>
				</view>
			</view>
		</view>
		<view class='my-n-footer'>
			<view class='footer-btn' @click="needSubmit">提交</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			fountNum: 0,
			desQuest: ''
		}
	},
	onLoad() {
		this.buryingPoint('app:useFeed_pageView')
	},
	methods: {
		needSubmit() {
			const content = this.desQuest;
			if (!content) {
				return this.toast('描述不能为空')
			}
			this.$request('/pawn/feed/addFeed', 'POST', { content }).then(res => {
				if (res.success) {
					this.toast('提交成功', 'success')
					setTimeout(() => {
						this.Back()
					}, 500)
				}
			}).catch(err => {
				console.log(err, '请求出错')
			})
		},
		sufontnum(e) {
			if (e.detail.value.length > 100) {
				self.toast('不可超过100字')
				return false
			}
			this.desQuest = e.detail.value
			this.fountNum = e.detail.value.length
		},
	}
}
</script>

<style src='./index.less' lang="less" scoped></style>
