From d3fd4b0ab851bab89c30c199e27245f7f45f1c0e Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 08 十一月 2025 08:01:12 +0800
Subject: [PATCH] feat:实现了微信上传图片
---
app/pages/login.vue | 250 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 203 insertions(+), 47 deletions(-)
diff --git a/app/pages/login.vue b/app/pages/login.vue
index 7f0e8c8..94efe80 100644
--- a/app/pages/login.vue
+++ b/app/pages/login.vue
@@ -1,9 +1,9 @@
<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>
- <text class="title">鑻ヤ緷绉诲姩绔櫥褰�</text>
+ <text class="title">姘戣埅璋冨害绯荤粺</text>
</view>
<view class="login-form-content">
<view class="input-item flex align-center">
@@ -14,28 +14,32 @@
<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="agreement-checkbox">
+ <checkbox-group @change="onAgreementChange">
+ <label class="checkbox-label">
+ <checkbox :checked="agreedToPolicy" value="agreed" color="#007AFF" class="round-checkbox" style="margin-top: 0;" />
+ <text class="agreement-text">
+ <text class="text-grey1">鍚屾剰</text>
+ <text @click.stop="handleUserAgrement" class="text-blue agreement-link">銆婄敤鎴峰崗璁��</text>
+ <text class="text-grey1">鍜�</text>
+ <text @click.stop="handlePrivacy" class="text-blue agreement-link">銆婇殣绉佹斂绛栥��</text>
+ </text>
+ </label>
+ </checkbox-group>
+ </view>
+
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">鐧诲綍</button>
</view>
- <view class="reg text-center" v-if="register">
- <text class="text-grey1">娌℃湁璐﹀彿锛�</text>
- <text @click="handleUserRegister" class="text-blue">绔嬪嵆娉ㄥ唽</text>
- </view>
- <view class="xieyi text-center">
- <text class="text-grey1">鐧诲綍鍗充唬琛ㄥ悓鎰�</text>
- <text @click="handleUserAgrement" class="text-blue">銆婄敤鎴峰崗璁��</text>
- <text @click="handlePrivacy" class="text-blue">銆婇殣绉佸崗璁��</text>
- </view>
</view>
-
- </view>
+ </scroll-view>
</template>
<script>
@@ -48,10 +52,12 @@
captchaEnabled: true,
// 鐢ㄦ埛娉ㄥ唽寮�鍏�
register: false,
+ // 闅愮鏀跨瓥鍚屾剰鐘舵��(榛樿鏈�変腑,闇�瑕佺敤鎴蜂富鍔ㄥ嬀閫�)
+ agreedToPolicy: false,
globalConfig: getApp().globalData.config,
loginForm: {
- username: "admin",
- password: "admin123",
+ username: "",
+ password: "",
code: "",
uuid: ''
}
@@ -67,13 +73,15 @@
},
// 闅愮鍗忚
handlePrivacy() {
- let site = this.globalConfig.appInfo.agreements[0]
- this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
+ this.$tab.navigateTo('/pages/mine/privacy-policy/index')
},
// 鐢ㄦ埛鍗忚
handleUserAgrement() {
- let site = this.globalConfig.appInfo.agreements[1]
- this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
+ this.$tab.navigateTo('/pages/mine/user-agreement/index')
+ },
+ // 鍗忚鍚屾剰鐘舵�佸彉鏇�
+ onAgreementChange(e) {
+ this.agreedToPolicy = e.detail.value.length > 0
},
// 鑾峰彇鍥惧舰楠岃瘉鐮�
getCode() {
@@ -87,6 +95,10 @@
},
// 鐧诲綍鏂规硶
async handleLogin() {
+ if (!this.agreedToPolicy) {
+ this.$modal.msgError("璇峰厛闃呰骞跺悓鎰忕敤鎴峰崗璁拰闅愮鏀跨瓥")
+ return
+ }
if (this.loginForm.username === "") {
this.$modal.msgError("璇疯緭鍏ユ偍鐨勮处鍙�")
} else if (this.loginForm.password === "") {
@@ -113,6 +125,8 @@
loginSuccess(result) {
// 璁剧疆鐢ㄦ埛淇℃伅
this.$store.dispatch('GetInfo').then(res => {
+ // 瑙﹀彂鐧诲綍鎴愬姛浜嬩欢锛屽惎鍔ㄦ秷鎭疆璇�
+ uni.$emit('user-login')
this.$tab.reLaunch('/pages/index')
})
}
@@ -127,6 +141,24 @@
.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%;
@@ -158,45 +190,169 @@
.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;
+ height: 45px;
+ background: none;
+ }
+ }
+
+ .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;
}
+ .input {
+ margin-left: 20rpx;
+ width: 60%;
+ height: 45px;
+ background: none;
+ }
+
+ .login-code {
+ width: 30%;
+ height: 45px;
+ margin-left: 10rpx;
+ border-left: 1px solid #e0e0e0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ .login-code-img {
+ max-width: 100%;
+ max-height: 45px;
+ object-fit: contain;
+ cursor: pointer;
+ }
+ }
}
- .login-btn {
- margin-top: 40px;
- height: 45px;
+ .action-btn {
+ margin: 40rpx 0;
+
+ .login-btn {
+ height: 90rpx;
+ font-size: 32rpx;
+ }
}
-
+
.reg {
- margin-top: 15px;
+ margin: 20rpx 0;
+
+ .text-grey1 {
+ color: #888;
+ }
+
+ .text-blue {
+ margin: 0 10rpx;
+ color: #007AFF;
+ }
}
- .xieyi {
- color: #333;
- margin-top: 20px;
- }
-
- .login-code {
- height: 38px;
- float: right;
-
- .login-code-img {
- height: 38px;
- position: absolute;
- margin-left: 10px;
- width: 200rpx;
+ .agreement-checkbox {
+ margin: 50rpx 0 30rpx 0;
+ padding: 20rpx;
+ display: flex;
+ justify-content: flex-start;
+ align-items: left;
+
+ checkbox-group {
+ display: flex;
+ align-items: center;
+ }
+
+ .checkbox-label {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+
+ checkbox {
+ margin-right: 15rpx;
+ transform: scale(1.2);
+ flex-shrink: 0;
+ vertical-align: middle;
+ }
+
+ // 鍦嗗舰澶嶉�夋鏍峰紡
+ .round-checkbox {
+ border-radius: 50% !important;
+ }
+
+ // 閽堝寰俊灏忕▼搴忕殑鍦嗗舰鏍峰紡
+ ::v-deep .uni-checkbox-input,
+ ::v-deep .wx-checkbox-input {
+ border-radius: 50% !important;
+ }
+
+ // 閽堝H5鐨勫渾褰㈡牱寮�
+ ::v-deep input[type="checkbox"] {
+ border-radius: 50% !important;
+ -webkit-appearance: none;
+ appearance: none;
+ width: 36rpx;
+ height: 36rpx;
+ border: 2rpx solid #d1d1d1;
+ background-color: #fff;
+ position: relative;
+
+ &:checked {
+ background-color: #007AFF;
+ border-color: #007AFF;
+
+ &::after {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 12rpx;
+ height: 12rpx;
+ background-color: #fff;
+ border-radius: 50%;
+ }
+ }
+ }
+
+ .agreement-text {
+ display: inline-flex;
+ align-items: center;
+ flex-wrap: wrap;
+ line-height: 1.5;
+ font-size: 26rpx;
+ text-align: left;
+ justify-content: flex-start;
+
+ .text-grey1 {
+ color: #666;
+ font-size: 26rpx;
+ line-height: 1.5;
+ }
+
+ .text-blue {
+ color: #007AFF;
+ font-size: 26rpx;
+ padding: 8rpx 10rpx;
+ margin: 0 5rpx;
+ display: inline-block;
+ position: relative;
+ z-index: 10;
+ line-height: 1.5;
+ }
+ }
}
}
}
}
-
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.1