<template>
	<view>
		<!-- 标题栏 -->
		<u-navbar
			:is-back="true" 
			back-icon-color="#2af" 
			:border-bottom="true"
			:back-text="$t('common.Back')" 
			:back-text-style="{color:'#2af'}" 
			:title="doctitle"
			>
		</u-navbar>
		<view class="detial">
			<view class="pageTitle">{{detial.title}}</view>
			<view class="pageContent">
				<rich-text :nodes="detial.contentHtml"></rich-text>
			</view>
			<view class="publishDate">{{publishLable}}: {{formatDate(detial.publishDate)}}</view>
		</view>
	</view>
</template>

<script>
	import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue';
	export default {
		components:{
			UNavbar,
		},
		data() {
			return {
				iniData:{
					name:'固定资产贷款',
					label:'固定资产贷款'
				},
				doctitle:'',
				pageTitle:'',
				publishLable:''

			}
		},
		computed:{
			detial(){
				return uni.getStorageSync('detialInfo')
			}
		},
		onLoad(data) {
			this.doctitle= this.$i18n.locale == 'zh'? '详情': 'Detial';
			this.publishLable=this.$i18n.locale == 'zh'? '发布时间': 'Publish Date';
			this.pageTitle=''
		},
		onUnload(){
			uni.removeStorageSync('detialInfo')
		},
		methods: {
			//格式化日期
			publishDate(timenumber){
				return new Date(parseInt(timenumber)).toLocaleDateString().replace(new RegExp(/\//,'mg'),'-');  
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.detial{
		position:absolute;
		width:100%;
		background-color:#fafafa;
		.pageTitle{
			height:100upx;
			line-height:100upx;
			text-align:center;
			font-weight:bold;
		}
		.pageContent,.publishDate{
			padding:3%;
		}
		.publishDate{
			font-size:20upx;
			color:#aaa;
		}
	}
</style>
