<template>
	<view>

		<view class="echo-article-title bg-white">
			{{question.title}}
		</view>

		<view class="echo-article-meta bg-white">
			<view class="echo-article-meta-left">
				<text>{{question.createtime_text}}</text>
				<text>{{question.questionCate.title}}</text>
			</view>
			<view class="echo-article-meta-right">
				<text>浏览 {{question.volume}}</text>
			</view>
		</view>

		<view class="echo-article-details bg-white">
			<u-parse :content="question.details" noData="详情内容..." @navigate="navigate"></u-parse>
		</view>
	</view>
</template>

<script>
	import uParse from '@/components/gaoyia-parse/parse.vue';
	var _this;
	export default {
		components: {
			uParse
		},
		data() {
			return {
				question: {}
			}
		},
		onLoad: function(option) {
			_this = this;
			var questionid = option.questionid || 0;
			_this.$req.ajax({
				path: "question/getquestion",
				data: {
					questionid: questionid
				}
			}).then((data) => {
				_this.question = data.question;
			}).catch((err) => {
				uni.showModal({
					title: '信息提示',
					content: err,
					showCancel: false
				});
			});
		},
		onShareAppMessage: function(res) {
		    return {
				title: _this.question.title,
				path: "/pages/question/detail?questionid="+_this.question.id
		    }
		},
		methods: {
			navigate: function(href, e) {
				// #ifdef H5
				location.href = href;
				// #endif
				// #ifndef H5
				uni.navigateTo({
					url: '/pages/tool/webview?pagesrc=' + encodeURIComponent(href)
				});
				// #endif
			}
		}
	}
</script>

<style lang="scss">
</style>
