<template>
	<view class="cotainer">
		<view class="line">
			<block v-if="showNo">
				<view class="line-item" v-for="pointer in pointers" @click="toDetail(pointer.id)">
					<view class="line-item-pointer">
						<image class="line-item-pointer-img" :src="pointer.image.url" mode="">
						</image>
						<view class="">
							<view class="line-item-pointer-title">{{pointer.name}}</view>
							<view class="line-item-pointer-detail">点位详情</view>
						</view>
					</view>
				</view>
			</block>
			<view v-else class="nodata">
				<u-empty text="还没有打卡记录" mode="data"></u-empty>
			</view>
		</view>
		<tabbar :currentPage="6"></tabbar>
	</view>
</template>

<script>
	import tabbar from '@/components/tabbar/tabbar.vue'
	import {
		shareInfo
	} from "@/common/util.js"
	export default {
		components: {
			tabbar
		},
		data() {
			return {
				keyword: '',
				pointers: [],
				showNo:true
			}
		},
		onShareAppMessage() {
			return shareInfo
		},
		onShareTimeline(){
			return shareInfo
		},
		onLoad() {
			this.getPoints()
		},
		methods: {
			
			getPoints() {
				this.pointers = []
				this.$u.api.getPoints({
					myself:1
				}).then((res) => {
					this.pointers = res.points
					this.showNo =  res.points.length>0?true:false
				})

			},
			toDetail(id) {
				uni.navigateTo({
					url: '/packages/detail/detail?id=' + id,
				});
			},
		}
	}
</script>

<style lang="scss">
	.cotainer {
		padding-bottom: 135rpx;
		background-color: #f5f5f5;
		width: 100vw;
		padding-top: 30rpx;
		min-height: 100vh;
	}

	.line {
		width: 90%;
		background-color: #f5f5f5;
		margin: 0 auto;

		.nodata {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
		}

		&-item {
			&-pointer {
				display: flex;
				align-items: center;
				padding: 20rpx;
				background-color: #fff;
				border-radius: 20rpx;
				// box-shadow: -2px -3rpx 12px rgba(0, 0, 0, 0.1);
				margin-bottom: 30rpx;
				width: 100%;
				height: 180rpx;

				&-img {
					width: 165rpx;
					height: 90rpx;
					border-radius: 20rpx;
					margin-right: 30rpx;
				}

				>view {
					width: calc(100% - 200rpx)
				}

				&-title {
					font-size: 32rpx;
					color: #000;
				}

				&-detail {
					color: #bc9766;
				}


				&-icon {
					width: 73rpx;
					height: 73rpx;
					position: absolute;
					right: 30rpx;
					bottom: 60rpx;

				}
			}
		}
	}
</style>