<template>
		<view>
			<rich-text :nodes="nodes"></rich-text>
			<view v-if="aricte.ad_type!=0" class="aricte" :class="isclose?'closeacrile':''">
				<view style="display: flex;justify-content: space-between;">
					<view>{{aricte.ad_title}}</view>
					<view style="color:#4399FC;" @click="close">x关闭</view>
				</view>
				<view   @click="godetail"  style="padding: 10upx 0upx;position: relative;">
					<image :src=" pictureUrl + '/' + aricte.ad_image" style="height: 600upx;width: 100%;" />
					<view style="color: #fff;position: absolute;bottom: 20upx;left: 20upx;">广告</view>
				</view>
			</view>
		</view>
</template>

<script>
	export default {
		data() {
			return {
				isclose: false,
				pictureUrl: this.pictureUrl,
				article_id: '',
				nodes:'',
				aricte: {}
		    }
		},
		onLoad(a) {
			this.article_id = a.id;
			let name = a.name;
			uni.setNavigationBarTitle({
			    title: name
			});
			this.getactrile();
		},
		
		methods: {
			godetail() {
				console.log(this.aricte.ad_type)
				if(this.aricte.ad_type == 1) {
					//商品 
					let id = this.aricte.goods_id;  // 商品Id
					let store_id = this.aricte.store_id;  // 商品Id
					uni.navigateTo({
						url:`/pages/index/shop?id=${id}&store_id=${store_id}`
					})
					// uni.navigateTo({
					// 	url:`/pages/index/shop/?id=${id}&store_id=${store_id}`
					// })
				}else if(this.aricte.ad_type == 2) {
				   //商品
				   let id = this.aricte.store_id;  // 商品Id
				   uni.navigateTo({
				         url: `/pages/index/hotel?id=${id}`
				   });
				}
			},
			close() {
				this.isclose = true;
			},
			getactrile() {
				this.request({
					url: '/v1/entry/news_desc',
					method: 'post',
					data: {
						article_id: this.article_id		 
					},
					success: (res) =>　{
						let { data } = res.data;
						this.aricte = data;
						this.nodes = data.article_content;
					}
				})
			}
		},
	}
</script>

<style>
	.aricte {
		background-color: #EEEEEE;
	}
	.closeacrile {
		display: none;
	}
	
</style>
