<template>
	<mobile-frame>
		<view class="main">
			<view class="one">
				<rich-text :nodes="info.content"></rich-text>
			</view>
		</view>
	</mobile-frame>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				info: {}
			};
		},
		onLoad: function(e) {
			const that = this;
			that.$set(that, `id`, e.id || '')
		},
		onShow: function() {
			const that = this;
			that.search();
		},
		methods: {
			async search() {
				const that = this;
				const res = await that.$api(`/banner/${that.id}`, 'GET');
				if (res.errcode == '0') {
					that.$set(that, `info`, res.data)
				} else {
					uni.showToast({
						title: res.errmsg,
						icon: 'none'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.main {
		display: flex;
		flex-direction: column;
		width: 100vw;
		height: 100vh;

		.one {
			padding: 2vw;
		}
	}
</style>
