<template>
	<view>
		<slot v-if="phone"></slot>
		<u-popup zIndex="9999999999" style="z-index: 9999999999;" v-else show mode="center" closeable @close="back">
			<view class="tipPopup" v-if="!phone">

				<h3>提示</h3>

				<u--text margin="12px 0 12px 0" text="当前账号未绑定手机号" type="info"></u--text>

				<!-- <view class="btns">
					<view class="btn" @click="back">
						<view>
							返回
						</view>
					</view>

					<view class="btn1" @click="toUrl('/subPackages/user/user-mobile')">
						<view>
							前往绑定
						</view>
					</view>
				</view> -->
				<view>
					<view class="btn1" @click="toUrl('/subPackages/user/user-mobile')">
						<view>
							前往绑定
						</view>
					</view>
				</view>

			</view>
		</u-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			phone: true
		}
	},
	created() {
		uni.$on('changePhone', res => {
			console.log(res, '接收到的参数')
			this.phone = res
		})

		this.getInfo()
	},
	methods: {
		async getInfo() {
			const res = await this.$api.common.isPhone();
			this.phone = !!res.data
		},
		back() {
			uni.navigateBack();
		}
	},
};
</script>

<style scoped lang="scss">
.tipPopup {
	width: 90vw;
	margin: auto;
	// border-radius: 20rpx;
	overflow: hidden;
	box-sizing: border-box;

	padding: 36rpx;

	background-color: #fff;
	border-radius: 20rpx;
}

.btn {
	margin: 0 20rpx;
	margin-top: 40rpx;
	font-weight: 600;

	view {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 22rpx;
		color: white;
		border-radius: 100px;
		background: linear-gradient(to left, #ff2c2c, #ff4e4e);
		transition: .24s;
		background-size: 1000% 1000%;
		transition: all .2s ease;
		animation: Gradient 40s linear infinite;

		&:hover {
			opacity: 0.8;
		}
	}
}

.btn1 {
	margin: 0 20rpx;
	margin-top: 40rpx;
	font-weight: 600;

	view {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 22rpx;
		color: white;
		border-radius: 100px;
		transition: .24s;
		background: linear-gradient(-45deg, #448bff, #44e9ff, #ee7752, #e73c7e, #23a6d5, #23d5ab);
		background: linear-gradient(to left, #ff2c2c, #ff4e4e);
		background-size: 1000% 1000%;
		transition: all .2s ease;
		animation: Gradient 40s linear infinite;

		&:hover {
			opacity: 0.8;
		}
	}
}

.btns {
	display: grid;
	grid-template-columns: 1fr 2fr;
}

/deep/ {
	.u-fade-enter-active {
		background-color: rgba(0, 0, 0, 0.1) !important;
		filter: blur(100px);
	}
}
</style>