number_book.vue 2.6 KB
<template>
	<view>
		<view v-if="!data_list || data_list.length == 0 " class="gloabal-empty-content-c">

			<image class="gloabal-empty-image-c" src="../../static/empty-icon.jpeg"></image>

			<text>暂无号码</text>

		</view>
		<view v-else v-for="(item,index) in data_list" class="item-c">
			<view style="display: flex; justify-content: space-between;">
				<view class="qihao_c">{{'双色球' + item.qihao + '期选号'}}</view>

				<view class="type_name">{{item.typeName}}</view>
			</view>

			<view v-for="(item2, index2) in item.codes" style="margin-top: 12rpx; margin-bottom: 12rpx;">

				<NumberQiu :data_info="item2"></NumberQiu>

			</view>

			<view style="display: flex; margin: 30rpx;">

				<view @click="copyNumber(item.codes)">
					复制选号
				</view>

				<view style="margin-left: 30rpx;" @click="deleteDate(index)">
					删除选号
				</view>

			</view>

		</view>




	</view>
</template>

<script>
	import NumberQiu from '../../components/NumberQiu.vue'

	export default {
		components: {
			NumberQiu
		},
		data() {
			return {
				data_list: []
			}
		},
		async onLoad() {
			var temp_data = await uni.getStorageSync("number_book")
			console.log(temp_data)
			if (temp_data.length > 0) {
				let temp_list = JSON.parse(temp_data)
				temp_list.reverse()
				this.data_list.push(...temp_list)
			}
		},
		methods: {
			copyNumber(codes) {
				let value = JSON.stringify(codes)

				uni.setClipboardData({
					data: value,
					success: function() {
						uni.getClipboardData({
							success: function(res) {
								console.log(res.data);
								uni.showToast({
									title: "已复制到剪贴板",
									icon: "none"
								});
							},
						});
					},
				});

			},
			deleteDate(index) {
				this.data_list.splice(index, 1);
				let str = JSON.stringify(this.data_list)
				uni.setStorageSync("number_book", str)
				uni.showToast({
					title: "已删除",
					icon: "none"
				});
			}
		}
	}
</script>

<style>
	.gloabal-empty-content-c {
		min-height: 80vh;
	}

	.item-c {
		line-height: 20px;
		border-radius: 10px;
		background-color: rgba(255, 245, 245, 1);
		text-align: center;
		padding: 30rpx;
		margin: 30rpx;
	}

	.qihao_c {
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		text-align: left;
	}

	.type_name {
		padding: 6rpx 12rpx;
		line-height: 20px;
		border-radius: 4px;
		background: linear-gradient(88.38deg, rgba(255, 111, 56, 1) 2.07%, rgba(255, 160, 75, 1) 102.13%);
		color: rgba(255, 255, 255, 1);
		font-size: 12px;
		text-align: center;
		font-family: -apple-system;
	}
</style>