Browse Source

增添手机验证码登录

wangyi/feature-20251022162725-启动页登录注册
Ethereal 1 month ago
parent
commit
1fde0e423c
  1. 158
      pages/start/login/login.vue
  2. BIN
      static/icons/Frame.png
  3. BIN
      static/icons/GoogleIcons.png
  4. BIN
      static/icons/Iphone.png
  5. BIN
      static/icons/Mail.png
  6. BIN
      static/icons/People-safe.png
  7. BIN
      static/icons/Text-recognition.png
  8. BIN
      static/icons/Unlock.png
  9. BIN
      static/icons/appleIcons.png
  10. BIN
      static/icons/headset.png

158
pages/start/login/login.vue

@ -5,11 +5,17 @@
class="custom-navbar"
:style="{ paddingTop: safeAreaInsets?.top + 'px' }"
>
<view class="nav-left">
<!-- <view class="nav-left">
<text class="back-btn" @click="goToIndex"></text>
</view>
</view> -->
<view class="nav-right">
<text class="headphone-btn">🎧</text>
<image class="icons" src="../../../static/icons/Headset.png" alt="" />
<image
class="icons"
@click="goToIndex"
src="../../../static/icons/Frame.png"
alt=""
/>
</view>
</view>
@ -36,22 +42,36 @@
</view>
<!-- 输入框 -->
<view class="input-container">
<view v-if="switchType === 'Email'">
<!-- 修改邮箱输入框容器将图标包含在内 -->
<view class="input-with-icon">
<image class="input-icon" src="../../../static/icons/People-safe.png" alt="" />
<input
v-if="switchType === 'Email'"
class="input-field"
type="text"
placeholder="输入邮箱/用户名"
placeholder="请输入邮箱/DeepChart ID"
v-model="email"
/>
</view>
<view class="input-with-icon">
<image class="input-icon" src="../../../static/icons/Unlock.png" alt="" />
<input
class="input-field"
type="text"
placeholder="请输入密码"
v-model="password"
/>
</view>
</view>
<view v-else class="phone-input-container">
<view class="country-code-selector" @click="showCountryPicker">
<image
class="country-flag-img"
:src="selectedCountry.flag"
src="../../../static/icons/Iphone.png"
mode="aspectFit"
></image>
<text class="country-code">{{ selectedCountry.code }}</text>
<text class="arrow-down"></text>
<!-- <text class="arrow-down"></text> -->
</view>
<input
class="input-field phone-input"
@ -60,6 +80,26 @@
v-model="phone"
@input="onPhoneInput"
/>
<view>
<button
class="send-code-btn"
:disabled="isCodeBtnDisabled"
:class="{ 'send-code-btn-disabled': isCodeBtnDisabled }"
@click="sendCode">
<text class="send-code-text"
:class="{ 'send-code-btn-disabled-text': isCodeBtnDisabled }"
>{{ codeBtnText }}</text>
</button>
</view>
</view>
<view v-if="switchType === 'Phone'" class="input-with-icon">
<image class="input-icon" src="../../../static/icons/Text-recognition.png" alt="" />
<input
class="input-field"
type="text"
placeholder="请输入密码"
v-model="password"
/>
</view>
</view>
@ -74,7 +114,7 @@
<view class="third-party-btn" @click="loginWithApple">
<image
class="apple-icon"
src="/static/apple-icon.png"
src="../../../static/icons/appleIcons.png"
mode="aspectFit"
></image>
<text class="third-party-text">通过 Apple 继续</text>
@ -83,7 +123,7 @@
<view class="third-party-btn" @click="loginWithGoogle">
<image
class="google-icon"
src="/static/google-icon.png"
src="../../../static/icons/GoogleIcons.png"
mode="aspectFit"
></image>
<text class="third-party-text">通过 Google 继续</text>
@ -104,10 +144,13 @@ import { ref } from "vue";
import countryList from "./list.js";
const email = ref("");
const password = ref("");
const phone = ref("");
const agreed = ref(false);
const switchType = ref("Email"); //
const { safeAreaInsets } = uni.getSystemInfoSync();
const codeBtnText = ref("获取验证码");
const isCodeBtnDisabled = ref(false); //
// 使list.js
const countries = ref(
@ -202,7 +245,6 @@ function loginWithApple() {
//
// err.code`(code)`
console.log(err);
},
});
}
@ -247,6 +289,29 @@ function onPhoneInput(e) {
phone.value = value;
}
}
function sendCode(){
//
if (isCodeBtnDisabled.value) return;
//
isCodeBtnDisabled.value = true;
codeBtnText.value = "重新发送"
let time = 6
const timer = setInterval(() => {
time--
codeBtnText.value = "重新发送 " + time + "s"
if (time <= 0) {
clearInterval(timer)
codeBtnText.value = "重新发送"
//
isCodeBtnDisabled.value = false;
}
}, 1000)
return
}
</script>
<style scoped>
@ -285,6 +350,12 @@ function onPhoneInput(e) {
justify-content: flex-end;
}
.icons {
margin: 20rpx;
width: 40rpx;
height: 40rpx;
/* margin-right: 10rpx; */
}
.back-btn,
.headphone-btn {
font-size: 36rpx;
@ -354,15 +425,30 @@ function onPhoneInput(e) {
margin-bottom: 40rpx;
}
/* 添加图标输入框样式 */
.input-with-icon {
display: flex;
align-items: center;
width: 100%;
height: 80rpx;
border-bottom: 2rpx solid #e5e5e5;
margin-bottom: 20rpx;
}
.input-icon {
width: 40rpx;
height: 40rpx;
margin: 0 20rpx;
}
.input-field {
width: 90%;
flex: 1;
height: 80rpx;
border-radius: 20rpx;
border: 2rpx solid #e5e5e5;
padding: 0 30rpx;
padding: 15rpx 0;
font-size: 28rpx;
color: #333333;
background-color: #f5f5f5;
border: none;
background-color: transparent;
}
.phone-input-container {
@ -370,19 +456,22 @@ function onPhoneInput(e) {
align-items: center;
width: 95.8%;
height: 80rpx;
border-radius: 20rpx;
border: 2rpx solid #e5e5e5;
background-color: #f5f5f5;
/* border-radius: 20rpx; */
/* border: 2rpx solid #e5e5e5; */
/* background-color: #f5f5f5; */
padding: 0 10rpx;
border-bottom: 2rpx solid #e5e5e5;
margin-bottom: 20rpx;
}
.country-code-selector {
display: flex;
align-items: center;
padding: 0 20rpx;
padding: 0 10rpx;
padding-bottom: 1rpx;
height: 100%;
border-right: 2rpx solid #e5e5e5;
background-color: #f5f5f5;
/* border-right: 2rpx solid #e5e5e5; */
/* background-color: #f5f5f5; */
border-radius: 20rpx 0 0 20rpx;
}
@ -412,6 +501,31 @@ function onPhoneInput(e) {
padding: 0 20rpx;
}
.send-code-btn {
width: 200rpx;
height: 60rpx;
display: inline-flex;
padding: 0rpx 10rpx;
justify-content: center;
align-items: center;
gap: 10px;
border-radius: 4px;
background: #000;
}
.send-code-btn-disabled {
background: #E6E6E6; /* 禁用状态下的灰色背景 */
}
.send-code-btn-disabled-text {
color: #999999 !important;
}
.send-code-text{
color: #fff;
font-size: 28rpx;
}
.agreement-container {
/* display: flex; */
align-items: center;
@ -441,7 +555,7 @@ function onPhoneInput(e) {
.register-btn {
width: 100%;
height: 80rpx;
background-color: #333333;
background-color: #000000;
color: white;
font-size: 32rpx;
font-weight: bold;

BIN
static/icons/Frame.png

After

Width: 40  |  Height: 40  |  Size: 837 B

BIN
static/icons/GoogleIcons.png

After

Width: 68  |  Height: 68  |  Size: 3.9 KiB

BIN
static/icons/Iphone.png

After

Width: 40  |  Height: 40  |  Size: 607 B

BIN
static/icons/Mail.png

After

Width: 40  |  Height: 40  |  Size: 709 B

BIN
static/icons/People-safe.png

After

Width: 40  |  Height: 40  |  Size: 1.5 KiB

BIN
static/icons/Text-recognition.png

After

Width: 40  |  Height: 40  |  Size: 726 B

BIN
static/icons/Unlock.png

After

Width: 40  |  Height: 40  |  Size: 905 B

BIN
static/icons/appleIcons.png

After

Width: 68  |  Height: 68  |  Size: 3.2 KiB

BIN
static/icons/headset.png

Before

Width: 17  |  Height: 21  |  Size: 647 B

After

Width: 40  |  Height: 40  |  Size: 1.3 KiB

Loading…
Cancel
Save