<template>
	<view class="caseDetail pt-20">
		<uni-menubar title="图片列表" />
		<view class="grid col-3 text-center">
			<block v-for="(item,index) in albumList" :key="index">
				<view class="mb-40 px-10">
					<view class="bg-white shadow" @click="previewImg(item)" style="border-radius: 0 0 20rpx 20rpx;">
						<image :src="item.path" style="width: 100%;height: 260rpx;"></image>
						<view>{{item.name}}</view>
						<view class="text-right px-10"><tm-icons class="mr-10" :size="28" name="icon-eye-fill"></tm-icons>{{item.views}}</view>
					</view>
					
				</view>
			</block>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "",
				albumList: [],
				card_id: "",
				detailId: ""
			}
		},
		onLoad(option) {
			if (option) {
				this.detailId = option.id
				this.card_id = option.card_id
				this.$tm.vx.commit('card/cardId', option.card_id)
				this.getDetail(option.id)
				this.$point.point(3, this.detailId, this.card_id)
			}
		},
		onShareAppMessage(res) {
			return {
				title: this.info.title,
				path: '/pages/list/caseDetail?detailId=' + this.detailId + '&card_id=' + this.card_id,
				success: () => {
					this.$point.point(2, this.detailId, this.card_id)
				}
			}
		},
		methods: {
			getDetail(id) {
				this.$tm.request.post('album/piclist', {
					album_id: id
				}).then(res => {
					this.albumList = res.data
					if (this.card_id == '' || this.card_id != res.data[0].card_id) {
						this.$point.point(3, '', this.card_id)
					}
				})
			},
			previewImg(e){
				this.$tm.preview(e.path,this.albumList,'path')
				this.$tm.request.post('album/picinc', {
					id: e.id
				}).then(res => {
					
				})
			}
		}

	}
</script>

<style lang="scss" scoped>
	view,
	scroll-view,
	swiper,
	button,
	input,
	textarea,
	label,
	navigator,
	image {
		box-sizing: border-box;
	}
</style>
