<template>
	<view class="helpcenterDetial">
		<!-- 标题栏 -->
		<u-navbar
			back-icon-color="#fff"
			:back-text="$t('common.Back')" 
			:is-back="true" 
			:background="{background:'#1777FE'}"
			:back-text-style="{color:'#fff'}" 
			:border-bottom="true"
			title-color="#fff"
			:title="title"
			:custom-back="back"
			>
		</u-navbar>
		<!-- 帮助详情 -->
		<view class="helpDetial" v-if="detial.title">
			<view class="pageTitle" >{{detial.title}}</view>
			<rich-text :nodes="detial.contentHtml"></rich-text>
		</view>
		<u-toast ref="uToast" />
		
	</view> 
</template>

<script>
	import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	import {getHelpColumnContent} from '@/api/operation/help/helpCenterEntity'
	export default {
		name:'HelpCenter',
		components:{
			UNavbar
		},
		data(){
			return {
				backtext:'',
				questId:'',
				title:'',
				pageNo:1,
				pageSize:10,
				totalPage:0,
				detial:{},
			}
		},
		onShow:function(){
			this.getDetial();
		},
		onLoad(e){
			this.questId=e.questionId;
			uni.showLoading({title: this.$i18n.locale == 'zh'? '加载中...': 'Loading...'})
			this.title= this.$i18n.locale == 'zh'? '帮助详情': 'Help Center'
			this.backtext= this.$i18n.locale == 'zh'? '返回': 'Back'
			setTimeout(()=>{uni.hideLoading();},100)
		},
		onUnload(e){
			uni.removeStorageSync('questionItem')
		},
		methods:{
			async getDetial(){
				let params = {
					pageNo:this.pageNo,
					pageSize:this.pageSize,
					businessType:'help_center',
					businessId:this.questId,
					language:this.$i18n.locale.toLocaleUpperCase()
				}
				let res = await this.$myRequest({
					url:'/cms/cmsInformationViews/',
					data:params
				})
				if(res.data.cmsInformationViews){
					this.detial=res.data.cmsInformationViews[0];
					this.totalPage=parseInt(res.data.page.totalPage)
				}else{
					let msg = this.$i18n.locale == 'zh'? '暂无详情': 'No Help info'
					this.$refs.uToast.show({title:msg,type:'info'})
				}
			},
			//路由后退一步
			back(){
				// #ifdef H5
				history.back()
				// #endif
				// #ifndef H5
				uni.navigateBack()
				// #endif
			},
		}
		
	}
</script>
	
<style lang="scss" scoped>
	.helpcenterDetial{
		background:#fefefe;
		.pageTitle{
			height:60rpx;
			line-height:60rpx;
			font-weight:bold;
			text-align:center;
			margin-bottom:60rpx;
			color:#1777FE;
		}
		.helpDetial{
			position:absolute;
			width:92%;
			padding:5%;
			border-radius:20rpx;
			background:#fff;
			left:0;
			right:0;
			margin:60upx auto;
			.contentHtml{
				.questitle{
					text-align:center;
					color:#666;
					line-height:50rpx;
				}
			}
		}
	}
</style>
