<template>
	<u-popup v-model="isShow" mode="center" border-radius="14" :closeable="true" length="80%" class="commentPopup-wrap">
		<view class="popup-con">
			<view class="popup-tit">查看评论</view>
			<view class="popup-main">
				<u-swiper :list="list" class="popup-swiper" @click="clickSwiper"></u-swiper>
				<view class="popup-des">未按规则着装，上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响上班时间玩手机抽烟等不良影响</view>
			</view>
		</view>
	</u-popup>
</template>

<script>
	export default{
		name: 'CommentPopup',
		props: {
			openPopup: {
				type: Boolean,
				default: false
			}
		},
		data(){
			return{
				isShow: this.openPopup,  //  是否显示弹框
				list: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: require('@/static/defaultMe.png'),
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
			}
		},
		methods: {
			//  查看评论大图
			clickSwiper(e){
				// 预览图片
				uni.previewImage({
					current: e,
					urls: this.list[e],
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				})
			}
		},
		watch: {
			openPopup(val){
				this.isShow = val
			},
			isShow(val){
				if(!val){
					this.$emit('close')
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.commentPopup-wrap{
		.popup-con{
			padding: 26upx 0 10upx;
			.popup-tit{
				padding: 10upx 30upx 26upx;
				border-bottom: 1upx solid #f8f8f8;
			}
			.popup-main{
				.popup-swiper{
					margin: 20upx 30upx 0;
				}
				.popup-des{
					padding: 20upx 30upx;
				}
			}
		}
	}
</style>
