<template>
	<view class="pre-container">
		<view class="pre-image" v-for="(item, i) in pageData" :key="i">
			<image v-if="item.type == 'image/jpeg' || item.type == 'image/png'" :src="baseURL + downUrl + item.pageComponent" mode="widthFix" style="width: 100%;"></image>
			<video v-else :src="baseURL + downUrl + item.pageComponent" object-fit="fill" class="pre-video" />
		</view>
		<view style="width: 100%; height: 40rpx;"></view>
	</view>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { baseURL } from '@/services/request';

let pageData = ref();
let downUrl = '/wx/storage/fetch/';

onLoad((options: any) => {
	pageData.value = JSON.parse(options.pageData);
	console.log(pageData.value);
});
</script>

<style lang="scss" scoped>
.pre-container {
	box-sizing: border-box;
	padding: 30rpx;
	width: 100%;
	height: 100vh;
	.pre-image {
		display: flex;
	}
	.pre-video {
		width: 100%;
		video {
			width: 100%;
			height: 0;
			padding-bottom: 56.25%;
		}
	}
}
</style>
