<template>
	<view class="content">
		<view class="title">{{info.title}}</view>
		<!-- <view class="time">{{setDateFormat(articleDetail.publish_time)}}</view> -->
		<view v-html="info.content">
			
		</view>
	</view>
</template>

<script>
	import util from '../../common/util.js'
export default {
	data() {
		return {
			articleDetail: {},
			info: {},
			type: ''
		};
	},
	onLoad(e) {
		console.log(e)
		this.type = e.type
		this.getdata()
		this.getdata2()
	},
	methods: {
		getdata(){
			let data = { 
			}
			this.$api.config(data,res=>{ 
				if(res.code == '1'){
					// this.info = res.data 
					// switch(this.type){
					// 	case 'about':
					// 		this.info.title = res.data.about_title
					// 		this.info.content = res.data.about_text
					// 		wx.setNavigationBarTitle({
					// 			title:"关于我们"
					// 		});
					// 		break;
					// 	case 'userProt':
					// 		this.info.title = res.data.xieyi_title
					// 		this.info.content = res.data.xieyi
					// 		wx.setNavigationBarTitle({
					// 			title:"用户协议"
					// 		});
					// 	break;
					// 	case 'privacy':
					// 		this.info.title = res.data.privacy_title
					// 		this.info.content = res.data.privacy_content
					// 		wx.setNavigationBarTitle({
					// 			title:"隐私政策"
					// 		});
					// 	break;
					// 	case 'recycleProt':
					// 		this.info.title = res.data.recycleProt_title
					// 		this.info.content = res.data.recycleProt_content
					// 		wx.setNavigationBarTitle({
					// 			title:"用户回收协议"
					// 		});
					// 	break;
					// }
				}
			})
		},
		getdata2(){
			let data = { 
			}
			this.$api.indexInfo(data,res=>{ 
				if(res.code == '1'){
					console.log(res.data.example.list,'nnnnnnnnnn')
					let arr = res.data.example.list;
					this.info = res.data 
					switch(this.type){
						case 'about':
							// this.info.title = res.data.about_title
							// this.info.content = res.data.about_text
							this.info.title = arr.find((item,index)=>item.name == 'app_about_title').value
							this.info.content = arr.find((item,index)=>item.name == 'app_about_text').value
							wx.setNavigationBarTitle({
								title:"关于我们"
							});
							break;
						case 'userProt':
							// this.info.title = res.data.xieyi_title
							// this.info.content = res.data.xieyi
							this.info.title = arr.find((item,index)=>item.name == 'app_xieyi_title').value
							this.info.content = arr.find((item,index)=>item.name == 'app_xieyi').value
							wx.setNavigationBarTitle({
								title:"用户协议"
							});
						break;
						case 'privacy':
							// this.info.title = res.data.privacy_title
							// this.info.content = res.data.privacy_content
							this.info.title = arr.find((item,index)=>item.name == 'app_privacy_title').value
							this.info.content = arr.find((item,index)=>item.name == 'app_privacy_content').value
							wx.setNavigationBarTitle({
								title:"隐私政策"
							});
						break;
						case 'recycleProt':
							// this.info.title = res.data.recycleProt_title
							// this.info.content = res.data.recycleProt_content
							this.info.title = arr.find((item,index)=>item.name == 'app_recycleProt_title').value
							this.info.content = arr.find((item,index)=>item.name == 'app_recycleProt_content').value
							wx.setNavigationBarTitle({
								title:"用户回收协议"
							});
						break;
					}
				}
			})
		}
	}
};
</script>

<style lang="scss">
 .content{
	 padding: 37rpx 37rpx;
	 border-top: 4rpx solid rgba(100,100,100,.1);
	 .title{
		 font-weight: bold;
		 font-size: 36rpx;
		 color: #282F38;
	 }
	 .time{
		 font-weight: 500;
		 font-size: 24rpx;
		 color: #999999;
		 margin-top: 18rpx;
		 margin-bottom: 40rpx;
	 }
 }
 
.news_title{
	border-bottom: 1px solid #eee;
    padding: 20rpx 5%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    width: 100%; }
.news_title	.title{
		color: #333;
		line-height: 50rpx;
	}
.news_title	.time{
		color: #777;
		margin-top: 20rpx;
	}
.news_title	.tag{ 
			color: #e01f20;
	}
 
 
 	.biaoti{
		color: #777777;
		height: 90rpx;
		line-height: 90rpx;
		margin-top: 20rpx; }
	.biaoti	image{width: 35rpx;margin-right: 10rpx; margin-bottom: -6rpx;}
 .main{
 	line-height: 60rpx;}
  .main	.li{
 		display: flex;
 		justify-content: space-between;
 	}
 
  
 .line{border:solid 3px #eee}.button-bottom {
		padding: 15upx 26upx;
		text-align: right;
		display: block;
	}

	.button-bottom .btn {
		margin-left: 20upx;
	}
	.ti{width:115px}
</style>
