自动弹出 微信授权登录窗口

进入小程序首页 自动弹出 微信授权登录窗口-如下图

微信授权

代码如下

<!-- 授权弹窗 -->
<view class="auth" v-if="showModal">
    <view class="mask" catchtouchmove="preventTouchMove" v-if="showModal"></view>
    <!-- 弹出层 -->
    <view class="modalDlg" v-if="showModal">
        <view class="title">
            <text class="text0">微信授权</text>
        </view>
        <view class="cartLeft"></view>
        <u-image :lazy-load="true" width="150rpx" height="150rpx" :src="logo"></u-image>
        <view class="name">
            <text class="text1">小程序名称</text>
        </view>
        <view class="cartLeft1"></view>
        <view class="content">
            <text class="text2">获取您的公开信息(昵称、头像等)</text>
        </view>
        <view class="cartLeft2"></view>
        <view class="but">
            <view class="not">
                <u-button :hair-line="false" :custom-style='rejectStyle' size="mini" @click="rejectInfo">拒绝
                </u-button>
            </view>
            <view class="ok">
                <u-button :hair-line="false" :custom-style='customStyle' size="mini" @click="getUserProfileUrl">
                    允许</u-button>
            </view>
        </view>
    </view>
</view>

样式如下

<style>
// 授权窗口
	.auth {
		width: 620rpx;
		text-align: center;
		animation: auth 2s;
		-webkit-animation: auth 2s;

		/* 遮罩层 */
		.mask {
			width: 100%;
			height: 100%;
			position: fixed;
			top: 0;
			left: 0;
			background: #000;
			z-index: 9000;
			opacity: 0.5;
		}

		/* 弹出层 */
		.modalDlg {
			width: 70%;
			height: 480rpx;
			position: fixed;
			top: 300rpx;
			left: 0;
			right: 0;
			z-index: 9999;
			margin: 0 auto;
			background-color: #fff;
			border-radius: 10rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			/* 弹出层里面的文字 */
			.title {
				margin-top: 20rpx;

				.text0 {
					text-align: center;
					font-weight: bold;
					font-size: 34rpx;
					color: #000;
				}
			}

			.cartLeft {
				width: 90%;
				height: 20rpx;
				border-bottom: 1rpx solid #f3ebeb;
			}

			.name {
				margin-top: 10rpx;

				.text1 {
					text-align: center;
					font-size: 32rpx;
					color: #000;
					width: 360rpx;
				}
			}

			.cartLeft1 {
				width: 75%;
				height: 20rpx;
				border-bottom: 1rpx solid #f3ebeb;

			}

			.content {
				margin-top: 20rpx;

				.text2 {
					text-align: center; // 实现两端对齐文本效果
					font-size: 28rpx;
					color: #AFACB3;
				}
			}

			.cartLeft2 {
				width: 100%;
				height: 20rpx;
				border-bottom: 1rpx solid #f3ebeb;

			}

			.but {
				width: 70%;
				height: 18%;
				display: flex;
				justify-content: space-between;
				align-items: center;

				/* 弹出层里面的按钮 */
				.not {
					height: 60rpx;
					background: #fff;
					line-height: 10rpx;
					text-align: center;
					color: #44b549;

				}
				.ok {
					height: 60rpx;
					line-height: 10rpx;
					text-align: center;
					font-size: 30rpx;
				}
			}
		}
	}
</style>
  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

苦修的木鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值