<template>
	<view class="article">
		<view class="title" v-if="info.title">{{info.title}}</view>
		<view class="time" v-if="info.title">{{info.created_at}}</view>
		<view class="content" v-if="info.title" v-html="info.content"></view>
		<view class="p" v-if="!info.title">
			<u-empty mode="data" text="暂无相关信息">
			</u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: "",
				id: "",
				info: {}
			}
		},
		onLoad(options){
			// 1新手教程2系统公告3官方公告4用户协议5隐私政策6关于我们7 订购须知 8余额提现兑换规则 9查看图文教程 10会员详细介绍  11玩法规则介绍
			this.type= options.type;
			this.id = options.id;
			if(this.type == 3){
				this.info = uni.getStorageSync("articleInfo");
			}if(this.type == 1){
				this.info = uni.getStorageSync("articleInfo");
			}else{
				this.queryArticleList1();
			}
			
			uni.setNavigationBarTitle({
				title: options.type == 1?'新手教程':
				options.type == 2?'系统公告':
				options.type == 3?'官方公告':
				options.type == 4?'用户协议':
				options.type == 5?'隐私政策':
				options.type == 6?'关于我们':
				options.type == 7?'订购须知':
				options.type == 8?'余额提现兑换规则':
				options.type == 9?'查看图文教程':
				options.type == 10?'会员详细介绍':'玩法规则介绍'
			})
		},
		methods: {
			//系统公告
			async queryArticleList1() {
				const { code, data } = await this.$api.articleList({type: this.type})
				if(code == 200){
					if(data && data.length > 0){
						this.info = data[0]
					}
				}
			},
		},
		destroyed() {
			uni.removeStorageSync("articleInfo")
		}
	}
</script>

<style lang="scss" scoped>
.article{
	padding: 20rpx;
	overflow: hidden;
	background-color: #fff;
	.title{
		font-size: 36rpx;
		text-align: center;
		padding: 30rpx 0;
		color: #212121;
	}
	.time{
		font-size: 24rpx;
		color: #999999;
	}
	.content{
		padding: 30rpx 0;
		font-size: 26rpx;
		color: #212121;
		line-height: 48rpx;
		text-align: left;
	}
	.p{
		padding: 200rpx 0 50rpx;
	}
}
</style>
