<template>
	<view class="browseHistory">
		<view class="topEditOpar" v-if="browseHistory.length>0">
			<view class="text opartxt"  @click="delCollection">
				清空足迹
			</view>
		</view>
		<view class="list">
			<view class="list_item" v-for="(item, index) in browseHistory" :key="index">
				<view class="list_left">
					<image :src="item.cover" mode="aspectFit" error-icon="../../static/img/quesheng.png"></image>
				</view>
				<view class="list_right">
					<view class="goods_title shu-elip-2">{{ item.title }}</view>
					<view class="goods_titlesm shu-elip-1" v-if="item.publish">{{item.publish}}</view>
				</view>
			</view>			
		</view>
	
		
		<NoData v-if="browseHistory.length<1"></NoData>
	</view>
</template>

<script>
	var _self;
	export default {
		data() {
			return {
				browseHistory:[],				
			};
		},
		onLoad(ops) {
			_self = this;
			this.getBrowseHistory();
		},
		methods: {
			getBrowseHistory(){
				const hist = uni.getStorageSync('browseHistory');
				console.log('browseHistory>>>',hist)
				if(hist){
					this.browseHistory = [].concat(hist);
				}
			},
			delCollection(){
				uni.showModal({
					title: '提示',
					content: '清空后不可找回回，确认清空吗？',
					success: function(res) {
						if (res.confirm) {
							_self.browseHistory = [];
							uni.removeStorageSync('browseHistory');
						}
					}
				});
			},
		}
	};
</script>

<style lang="scss" scoped>
.browseHistory {
	padding: 20rpx;
	min-height: 100vh;
	box-sizing: border-box;
}
.selcheck{
	width: 80rpx;
	padding-left: 20rpx;
}
.topEditOpar{
	display: flex;
	padding: 10rpx 20rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: center;
	.text{
		flex: 1;
		text-align: right;
		font-weight: bold;
		font-size: 32rpx;
	}
	.opartxt{
		color: $app-theme-deep-color;
	}
}

.list {
	background-color: #fff;
	border-radius: 20rpx;
}
.list_item{
	display: flex;
	align-items: center;
	// padding: 24rpx 24rpx 24rpx 24rpx;
		padding: 20rpx 10rpx;
		border-bottom: 1rpx solid #efefef;
		.list_left {
			width: 170rpx;
			height: 170rpx;
			position: relative;
			image {
				width: 170rpx;
				height: 170rpx;
			}
			.xiajia{
				position: absolute;
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				color: #fff;
				display: flex;
				align-items: center;
				justify-content: center;
				background-color: rgba(0, 0, 0, .5);
				top: 40rpx;
				left: 40rpx;
				transform: rotate(30deg);
				font-size: 24rpx;
			}
		}
	
		.list_right {
			margin-left: 24rpx;
			width: 100%;
			.goods_title {
				font-size: 28rpx;
				font-weight: 400;
				color: #171717;
				height: 80rpx;
				margin-top: 6rpx;
			}
			.goods_titlesm{
				font-size: 24rpx;
				font-weight: 400;
				color: #999;
				
			}
			.right_bottom {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 10rpx;
	
				.bottom_left {
					display: flex;
					align-items: center;
					image {
						width: 32rpx;
						height: 32rpx;
						margin-right: 10rpx;
					}
	
					span {
						font-size: 24rpx;
						font-weight: 400;
						color: #696969;
						line-height: 34rpx;
					}
	
					.bottom_num {
						font-size: 32rpx;
						font-weight: 500;
						color: #fd4558;
						line-height: 44rpx;
						margin-right: 8rpx;
					}
				}
	
				.bottom_right {
					font-size: 40rpx;
					font-weight: 400;
					text-align: center;
					color: $app-theme-color;
					// line-height: 56rpx;
					// width: 56rpx;
					// height: 56rpx;
					// background: rgba( $app-theme-color, .6);
					// border-radius: 30rpx;
				}
			}
		}
	
}
.goodsItem {
	display: flex;
	flex: 1;
}
</style>
