| | |
| | | <template> |
| | | <view class="normal-login-container"> |
| | | <scroll-view class="normal-login-container" scroll-y="true"> |
| | | <view class="logo-content align-center justify-center flex"> |
| | | <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix"> |
| | | </image> |
| | |
| | | <view class="iconfont icon-password icon"></view> |
| | | <input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" /> |
| | | </view> |
| | | <view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled"> |
| | | <view class="input-item flex align-center captcha-container" v-if="captchaEnabled"> |
| | | <view class="iconfont icon-code icon"></view> |
| | | <input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" /> |
| | | <view class="login-code"> |
| | | <image :src="codeUrl" @click="getCode" class="login-code-img"></image> |
| | | <image :src="codeUrl" @click="getCode" class="login-code-img" mode="aspectFit"></image> |
| | | </view> |
| | | </view> |
| | | <view class="action-btn"> |
| | | <button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button> |
| | | </view> |
| | | <view class="wechat-login" @click="handleWechatLogin"> |
| | | <view class="wechat-btn"> |
| | | <image class="wechat-icon" src="/static/icons/profile.png"></image> |
| | | <text class="wechat-text">微信一键登录</text> |
| | | </view> |
| | | </view> |
| | | <view class="reg text-center" v-if="register"> |
| | | <text class="text-grey1">没有账号?</text> |
| | |
| | | <text @click="handlePrivacy" class="text-blue">《隐私协议》</text> |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | | </scroll-view> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | this.pwdLogin() |
| | | } |
| | | }, |
| | | // 微信登录方法 |
| | | async handleWechatLogin() { |
| | | // #ifdef MP-WEIXIN |
| | | // 微信小程序登录 |
| | | uni.login({ |
| | | provider: 'weixin', |
| | | success: (loginRes) => { |
| | | console.log('微信登录成功', loginRes); |
| | | // 获取用户信息 |
| | | uni.getUserInfo({ |
| | | provider: 'weixin', |
| | | success: (infoRes) => { |
| | | console.log('用户信息获取成功', infoRes); |
| | | // 跳转到微信登录确认页面 |
| | | this.$tab.navigateTo(`/pages/login/wechat?userInfo=${encodeURIComponent(JSON.stringify(infoRes.userInfo))}`); |
| | | }, |
| | | fail: (error) => { |
| | | console.error('获取用户信息失败', error); |
| | | this.$modal.msgError("获取微信用户信息失败"); |
| | | } |
| | | }); |
| | | }, |
| | | fail: (error) => { |
| | | console.error('微信登录失败', error); |
| | | this.$modal.msgError("微信登录失败"); |
| | | } |
| | | }); |
| | | // #endif |
| | | |
| | | // #ifndef MP-WEIXIN |
| | | // H5或其他平台提示 |
| | | this.$modal.msgError("请在微信客户端中使用微信登录功能"); |
| | | // #endif |
| | | }, |
| | | // 密码登录 |
| | | async pwdLogin() { |
| | | this.$store.dispatch('Login', this.loginForm).then(() => { |
| | |
| | | |
| | | .normal-login-container { |
| | | width: 100%; |
| | | min-height: 100vh; |
| | | // 隐藏滚动条但保持滚动功能 |
| | | ::-webkit-scrollbar { |
| | | display: none; |
| | | width: 0 !important; |
| | | height: 0 !important; |
| | | background: transparent; |
| | | } |
| | | |
| | | // Firefox滚动条隐藏 |
| | | * { |
| | | scrollbar-width: none; /* Firefox */ |
| | | } |
| | | |
| | | // IE/Edge滚动条隐藏 |
| | | * { |
| | | -ms-overflow-style: none; /* IE 10+ */ |
| | | } |
| | | |
| | | .logo-content { |
| | | width: 100%; |
| | |
| | | .icon { |
| | | font-size: 38rpx; |
| | | margin-left: 10px; |
| | | color: #999; |
| | | } |
| | | |
| | | .input { |
| | | margin-left: 20rpx; |
| | | width: 100%; |
| | | font-size: 14px; |
| | | line-height: 20px; |
| | | text-align: left; |
| | | padding-left: 15px; |
| | | } |
| | | |
| | | } |
| | | |
| | | .login-btn { |
| | | margin-top: 40px; |
| | | height: 45px; |
| | | background: none; |
| | | } |
| | | } |
| | | |
| | | .reg { |
| | | margin-top: 15px; |
| | | .captcha-container { |
| | | width: 100%; |
| | | margin: 20px auto; |
| | | background-color: #f5f6f7; |
| | | height: 45px; |
| | | border-radius: 20px; |
| | | padding-right: 10rpx; |
| | | box-sizing: border-box; |
| | | |
| | | .icon { |
| | | font-size: 38rpx; |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .xieyi { |
| | | color: #333; |
| | | margin-top: 20px; |
| | | .input { |
| | | margin-left: 20rpx; |
| | | width: 60%; |
| | | height: 45px; |
| | | background: none; |
| | | } |
| | | |
| | | .login-code { |
| | | height: 38px; |
| | | float: right; |
| | | width: 30%; |
| | | height: 45px; |
| | | margin-left: 10rpx; |
| | | border-left: 1px solid #e0e0e0; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | |
| | | .login-code-img { |
| | | height: 38px; |
| | | position: absolute; |
| | | margin-left: 10px; |
| | | width: 200rpx; |
| | | } |
| | | max-width: 100%; |
| | | max-height: 45px; |
| | | object-fit: contain; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .action-btn { |
| | | margin: 40rpx 0; |
| | | |
| | | .login-btn { |
| | | height: 90rpx; |
| | | font-size: 32rpx; |
| | | } |
| | | } |
| | | |
| | | .wechat-login { |
| | | margin: 20rpx 0; |
| | | |
| | | .wechat-btn { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background-color: #07c160; |
| | | height: 90rpx; |
| | | border-radius: 20px; |
| | | |
| | | .wechat-icon { |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | margin-right: 10rpx; |
| | | } |
| | | |
| | | .wechat-text { |
| | | color: white; |
| | | font-size: 32rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .reg, .xieyi { |
| | | margin: 20rpx 0; |
| | | |
| | | .text-grey1 { |
| | | color: #888; |
| | | } |
| | | |
| | | .text-blue { |
| | | margin: 0 10rpx; |
| | | color: #007AFF; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |