<template>
	<view style="letter-spacing: 1rpx;">
		<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
			<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
				<view style="padding-left: 15rpx;" @click="goBack()">
					<text class="tn-icon-left" style="font-size: 40rpx;"></text>
				</view>
				<view style="width: 83%;font-weight: bold;">
					<text>意见建议</text>
				</view>
			</view>
		</tn-nav-bar>
		<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
			<view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top tn-margin">
				<view class="tn-flex justify-content-item">
					<view class="tn-text-lg tn-padding-right-xs tn-text-bold">建议内容<text style="color: red;">*</text>
					</view>
				</view>
			</view>
			<view class="tn-margin tn-bg-gray--light tn-padding" style="border-radius: 10rpx;">
				<textarea v-model="text" maxlength="1000" placeholder="请填写内容" placeholder-style="color:#AAAAAA"
					style="height: 160rpx;"></textarea>
			</view>
		</view>
		<view style="margin-top: 80rpx;">
			<view class="tn-flex-1 justify-content-item tn-text-center">
				<tn-button shape="round" backgroundColor="#3B89FB" padding="40rpx 0" width="70%" fontBold
					@click="doSubmit()">
					<text class="tn-color-white">提 交</text>
				</tn-button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		messageAdd,
	} from '@/util/api.js';
	import store from '@/store/index.js'
	export default {
		data() {
			return {
				text: '',
			}
		},
		// mounted() {
		// 	var id = window.location.href.split("=")[1];
		// 	this.id = id;
		// 	this.getNewsInfo();
		// },
		onLoad(d) {

		},
		methods: {
			doSubmit() {
				messageAdd({
						text: this.text,
					})
					.then(res => {
						console.log(res);
						if (res.code == 1) {
							uni.showToast({
								title: '反馈成功！',
								duration: 2000
							});
						} else {
							uni.showToast({
								icon: "error",
								title: res.msg,
								duration: 2000
							});
						}
					})
					.catch(error => {
						uni.showToast({
							title: error,
							duration: 2000
						});
					})
			},
			goBack() {
				if (getCurrentPages().length > 1) {
					uni.navigateBack()
				} else {
					uni.redirectTo({
						url: '/pages/index/index'
					})

				}
			},
		}
	}
</script>

<style>
	.ks_html img {
		width: 100% !important;
	}
</style>