<template>
	<view class="sjgl">
		<view v-for="(item,i) in datas">
			<uni-card style="padding: 0;">
				<view style="padding: 10px;">
					<custom-attr label="上报时间" :value="item.saveTime"></custom-attr>
					<custom-attr label="上报内容" :value="item.reason"></custom-attr>
					<custom-attr label="上报位置" :value="item.geom"></custom-attr>
				</view>
				<view style="margin-top: 10px;">
					<uni-row>
						<uni-col :span="24">
							<button style="color: #e64340;" @click="delItem(i)">
								移除
							</button>
						</uni-col>
					</uni-row>
				</view>
			</uni-card>
		</view>

		<button class="submit-btn" type="primary" @click="submit" :loading="submiting">上报所有数据</button>
	</view>
</template>

<script>
	import helper from '../../common/helper'
	export default {
		data() {
			return {
				datas: [],
				submiting: false
			}
		},
		onLoad() {},
		onShow(e) {
			console.log('onshow', e)
			uni.getStorage({
				key: 'sbsjTemp',
				success: (resp) => {
					this.datas = resp.data;
				},
				fail(err) {},
				complete: () => {}
			})
		},
		methods: {
			submit() {

			},
			delItem(index) {
				uni.showModal({
					title: '提示',
					content: '确定删除该条数据？',
					success: (e) => {
						if (e.confirm) {
							this.datas.splice(index, 1);
							uni.setStorage({
								data: this.datas,
								key: 'sbsjTemp'
							})
						}
					}
				})
			}
		}
	}
</script>

<style scoped>
	.submit-btn {
		height: 64px;
		background: linear-gradient(-90deg, #01C4B4, #01DC7F);
		border-radius: 47px;
		font-weight: 400;
		font-size: 30px;
		color: #FFFFFF;
		margin-top: 36px;
		line-height: 64px;
		margin: 16px;
		margin-top: 36px;
	}

	.img-btn {
		width: 16px;
		height: 16px;
		margin-right: 2px;
	}

	.sjgl>>>.uni-card__content {
		padding: 0 !important;
	}

	.sjgl>>>.uni-card {
		padding: 0 !important;
	}

</style>