<template>
	<view class="container">
		<far-bottom></far-bottom>
		<view class="page-message" style="min-height: 100vh;">
			<view class="msg-h">
				{{ param.title }}
			</view>
			<view class="msg-c">
				<textarea name="msg" focus='ture' auto-height cursor-spacing="80" placeholder="请在这里输入您的留言" v-model="content" />
				</view>
		  <view class="msg-b">
		    <view class="span" @click="comment()">留言</view>
		  </view>
		</view>
	</view>
</template>

<script>
	import App from '@/common/js/app.js'
	export default {
		data() {
			return {
				loading: false,
				mid: '',
				token: '',
				param: {
					headline_id: '',
					title: ''
				},
				content: ""
			}
		},
		computed: {
		
		},
		onLoad(option) {
			this.param = {
				headline_id: option.headline_id,
				title: option.title
			};
		},
		mounted() {
	
		},
		methods: {
			comment() {
				let _this = this;
				if (_this.content.replace(/\s/g, "").length == 0) {
					uni.showToast({
						title: '请输入留言',
						icon: 'none',
						duration: 1000,
						mask: true
					})
					return false
				}
				uni.showLoading({})
				let requestData = {
					hid: _this['param']['headline_id'],
					text: _this.content
				};
				App._post_form('&p=headline&do=HeadlineComment', requestData, res => {
					if (res.errno === 0) {
						uni.hideLoading()
						App.showSuccess('留言成功', () => {
							uni.navigateBack({
								delta: 1
							});
						})
					}
				}, false, () => {
					uni.hideLoading();
				})
			},
			// navToLogin() {
			// 	uni.navigateTo({
			// 		url: '/pagesIndex/login/index'
			// 	})
			// }
		}
	}
</script>

<style scoped>
	page{
		background-color: #F3F3F3 !important;
	}
	.container {
		background-color: #F3F3F3;
	}

	.page-message {
		background-color: #F3F3F3;
	}

	.msg-h {
		line-height: 48upx;
		font-size: 32upx;
		padding: 30upx;
	}

	.msg-c {
		background-color: #fff;
	}

	.msg-c textarea {
		width: calc(100vw - 80upx);
		min-height: 160upx;
		line-height: 40upx;
		margin: 0;
		padding: 40upx;
		font-size: 28upx;
		resize: none;
		border: none;
		display: block;
	}

	.msg-b {
		height: 90upx;
		line-height: 90upx;
		font-size: 32upx;
		text-align: center;
		padding: 30upx;
	}

	.msg-b .span {
		background-color: #FFD93F;
		border-radius: 100upx;
		display: block;
	}
</style>
