<template>
	<view>
		<u-mask :show="show" @click="show = false">
			<view class="u-flex" style="flex-direction: column; height: 100vh; justify-content: center; align-items: center;">
				<view class="auth-bg">
					<view class="auth-arc"></view>
					<image style="width: 70%; position: absolute; top: 64rpx;" src="../../static/poster/votesuccess.png" mode="widthFix"></image>
					<view class="avatar-vote flex justify-center align-center">
						<u-avatar size="159" :src="avatar"></u-avatar>
					</view>
					<view class="info-box">
						<view class="main-info">成功为该作品助力{{activeVote}}票</view>
						<view class="sub-info" style="padding: 0 20rpx;">
							你已获得{{vuex_active_setting.voteAndPointRate * activeVote}}个平台积分，可用于"积分换礼"兑换礼品哦
						</view>
						<view class="flex justify-center" style="margin-top: 30rpx;">
							<u-button  @click="show=false" shape="circle" :custom-style="customStyle">继续投票</u-button>
							<u-button  shape="circle" :custom-style="customStyle" @click="support">花积分</u-button>
						</view>
					</view>
				</view>
				
				<view style="width: 65%; margin: 60rpx auto 0;" v-if="list.length > 0">
					<u-swiper :list="list" name="url" @click="click"></u-swiper>
				</view>
			</view>
		</u-mask>
	</view>
</template>

<script>
	export default {
		name:"voteSuccess",
		data() {
			return {
				show: false,
				activeVote: 1,
				avatar: 'https://thirdwx.qlogo.cn/mmopen/vi_32/9UQvP3rrVDeMwwjSaaeXIJ2NBdKAB1SpVP8ozRxWiaDDHGJFSp0iaibclAlBeSKGMSOEVvGTia404po8yQ4ibDutO3A/132',
				popupStyle: {
					'u-mode-center-box': 'red'
				},
				customStyle: {
					color: 'white',
					background: "#E72226",
					width: '200rpx',
					margin: '10rpx',
					height:"60rpx",
					fontSize:"26rpx"
				},
				list: []
			};
		},
		created() {
			this.customStyle.background = this.vuex_theme.bgColor;
		},

		methods: {
			click(index){
				let url = this.list[index].path;
				if( !!url && (url.indexOf('http://') > -1 || url.indexOf('https://') > -1) ){
					window.location.href = url;
				}
			},
			toIndex(){
				uni.switchTab({
					url:"/pages/index/home"
				})
			},
			showSuccess(avatar,activeVote){
				this.avatar = avatar;
				this.activeVote = activeVote;
				this.show = true;
			},
			hide(){
				this.show = false;
			},
			support(){
				this.hide()
				this.$emit('support')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.auth-bg{
		width: 65%;
		background: #fff;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		min-height: 620rpx;
		position: relative;
		overflow: hidden;
		border-radius: 20rpx;
		margin: 0 auto;
		.auth-arc{
			position: absolute;
			width: 140%;
			height: 220rpx;
			left: 50%;
			top: 0;
			transform: translateX(-50%);
			background: var(--bgColor);
			border-radius: 0 0 50% 50%;
		}
	}
	.auth-msg{
		padding: 40rpx 40rpx 20rpx 40rpx;
		display: flex;
		align-items: center;
		justify-content: left;
	}
	.avatar-vote{
		position: absolute;
		width: 200rpx;
		height: 200rpx;
		top: 100rpx;
		left: calc(50% - 100rpx);
		border: 2px dashed #E8E8E8;
		border-radius: 50%;
	}
	.info-box{
		position: absolute;
		width: 100%;
		height: auto;
		top: 360rpx;
		left: 0;
		.main-info{
			margin: 10rpx;
			font-size: 30rpx;
			color: #353535;
			font-weight: 800;
			text-align: center;
		}
		.sub-info{
			margin: 15rpx auto 40rpx auto;
			text-align: center;
			color: #AAAAAA;
			font-size: 24rpx;
			font-weight: 400;
		}
	}
</style>