美化了样式2.0
This commit is contained in:
@ -1,106 +1,113 @@
|
||||
<view class="flex-col page">
|
||||
<image class="self-center image" src="./images/logo.png" />
|
||||
<view class="page">
|
||||
|
||||
<view class="flex-col items-center self-stretch group">
|
||||
<!-- 加上 bold-text -->
|
||||
<text class="font text bold-text">欢迎登陆—青橙校园</text>
|
||||
<text class="font mt-12">({{ showRole }}端)</text>
|
||||
<!-- 顶部 Logo -->
|
||||
<image class="logo" src="/static/logo.jpg" mode="aspectFit" />
|
||||
|
||||
<!-- 标题与角色 -->
|
||||
<view class="title-wrap">
|
||||
<text class="title bold-text">欢迎登录 — 丁香校园</text>
|
||||
<text class="subtitle">({{ showRole }}端)</text>
|
||||
</view>
|
||||
|
||||
<!-- 登录卡片 -->
|
||||
<view class="card">
|
||||
|
||||
<!-- 登录方式切换 -->
|
||||
<view class="tabs">
|
||||
<text
|
||||
class="tab {{loginType==='password' ? 'active' : ''}}"
|
||||
bindtap="switchToPassword"
|
||||
>密码登录</text>
|
||||
|
||||
<text
|
||||
class="tab {{loginType==='sms' ? 'active' : ''}}"
|
||||
bindtap="switchToSms"
|
||||
wx:if="{{ role === 'user' }}"
|
||||
>验证码登录</text>
|
||||
</view>
|
||||
|
||||
<view class="flex-col self-stretch group_2">
|
||||
<view class="flex-row">
|
||||
<!-- 密码登录 -->
|
||||
<text
|
||||
class="font_2 toggle-text {{loginType==='password'?'active':''}}"
|
||||
bindtap="switchToPassword"
|
||||
>密码登录</text>
|
||||
<!-- 表单 -->
|
||||
<view class="form">
|
||||
|
||||
<!-- 验证码登录 -->
|
||||
<text
|
||||
class="font_2 ml-8 toggle-text {{loginType==='sms'?'active':''}}"
|
||||
bindtap="switchToSms" wx:if="{{ role === 'user' }}"
|
||||
>验证码登录</text>
|
||||
<!-- 手机号 -->
|
||||
<view class="field">
|
||||
<input
|
||||
class="field-input"
|
||||
placeholder="请输入手机号"
|
||||
placeholder-class="ph"
|
||||
value="{{phone}}"
|
||||
bindinput="onPhoneInput"
|
||||
maxlength="11"
|
||||
type="number"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="flex-col group_1 mt-20">
|
||||
<!-- 手机号 输入框,保持原 .text-wrapper 样式 -->
|
||||
<view class="flex-col self-stretch">
|
||||
<view class="flex-col justify-start relative section">
|
||||
<input
|
||||
class="text-wrapper"
|
||||
placeholder="请输入手机号"
|
||||
value="{{phone}}"
|
||||
bindinput="onPhoneInput"
|
||||
maxlength="11"
|
||||
type="number"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 密码/验证码 输入框,保持原 .text-wrapper_2 样式 -->
|
||||
<view class="flex-row items-center section_2 mt-21">
|
||||
<input
|
||||
class="text-wrapper"
|
||||
placeholder="{{ loginType==='password' ? '请输入密码' : '请输入验证码' }}"
|
||||
value="{{credential}}"
|
||||
bindinput="onCredentialInput"
|
||||
password="{{ loginType==='password' }}"
|
||||
type="{{ loginType==='sms' ? 'number' : 'text' }}"
|
||||
/>
|
||||
|
||||
<!-- 仅验证码登录时显示倒计时按钮 -->
|
||||
<view
|
||||
class="flex-col justify-start items-center shrink-0 text-wrapper_3 ml-2"
|
||||
bindtap="getSmsCode"
|
||||
wx:if="{{ loginType==='sms' }}"
|
||||
>
|
||||
<text class="text_6">{{ codeButtonText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 忘记密码,仅密码登录时显示 -->
|
||||
<text
|
||||
class="self-end font_4 text_7"
|
||||
bindtap="gotoForgetPwd"
|
||||
wx:if="{{ loginType==='password' }}"
|
||||
>忘记密码</text>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<view
|
||||
class="flex-col justify-start items-center self-stretch text-wrapper_4"
|
||||
bindtap="onLogin"
|
||||
<!-- 密码 / 验证码 -->
|
||||
<view class="field field-row">
|
||||
<input
|
||||
class="field-input flex-1"
|
||||
placeholder="{{ loginType==='password' ? '请输入密码' : '请输入验证码' }}"
|
||||
placeholder-class="ph"
|
||||
value="{{credential}}"
|
||||
bindinput="onCredentialInput"
|
||||
password="{{ loginType==='password' }}"
|
||||
type="{{ loginType==='sms' ? 'number' : 'text' }}"
|
||||
/>
|
||||
<!-- 验证码按钮(仅验证码登录显示) -->
|
||||
<view
|
||||
class="code-btn"
|
||||
bindtap="getSmsCode"
|
||||
wx:if="{{ loginType==='sms' }}"
|
||||
>
|
||||
<text class="text_8">登录</text>
|
||||
</view>
|
||||
|
||||
<!-- 协议勾选 -->
|
||||
<view class="flex-row items-center self-stretch group_3">
|
||||
<checkbox-group bindchange="onAgreeChange">
|
||||
<checkbox
|
||||
class="checkbox"
|
||||
value="agree"
|
||||
checked="{{ isAgree }}"
|
||||
color="#FF8D1A"
|
||||
/>
|
||||
</checkbox-group>
|
||||
<view class="group_4 ml-12">
|
||||
<text class="font_5 text_9">登录代表您已同意</text>
|
||||
<text class="font_5" bindtap="gotoAgreement">《用户协议》</text>
|
||||
<text class="text_10">&</text>
|
||||
<text class="font_5" bindtap="gotoPolicy">《隐私协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 去注册 -->
|
||||
<view class="self-center group_5" wx:if="{{isShowRegister}}">
|
||||
<text class="font_4 text_11">没有账号?</text>
|
||||
<text class="font_5 text_12" bindtap="gotoRegister">去注册→</text>
|
||||
<text class="code-btn-text">{{ codeButtonText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex-row justify-evenly items-center self-end section_3" bind:tap="joinUs" wx:if="{{ role === 'user' }}">
|
||||
<text class="font_2 text_13">加入我们</text>
|
||||
<image class="image_3" src="./images/joinus.png" />
|
||||
<!-- 忘记密码(仅密码登录) -->
|
||||
<text
|
||||
class="link-right"
|
||||
bindtap="gotoForgetPwd"
|
||||
wx:if="{{ loginType==='password' }}"
|
||||
>忘记密码</text>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<view
|
||||
class="btn-primary"
|
||||
bindtap="onLogin"
|
||||
>
|
||||
<text class="btn-primary-text">登录</text>
|
||||
</view>
|
||||
|
||||
<!-- 协议 -->
|
||||
<view class="agreements">
|
||||
<checkbox-group bindchange="onAgreeChange">
|
||||
<checkbox
|
||||
class="checkbox"
|
||||
value="agree"
|
||||
checked="{{ isAgree }}"
|
||||
color="#FF8D1A"
|
||||
/>
|
||||
</checkbox-group>
|
||||
<view class="agreements-text">
|
||||
<text class="muted">登录代表您已同意</text>
|
||||
<text class="link" bindtap="gotoAgreement">《用户协议》</text>
|
||||
<text class="muted">&</text>
|
||||
<text class="link" bindtap="gotoPolicy">《隐私协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 去注册 -->
|
||||
<view class="register" wx:if="{{isShowRegister}}">
|
||||
<text class="muted">没有账号?</text>
|
||||
<text class="link-strong" bindtap="gotoRegister">去注册 →</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加入我们(仅 user 端) -->
|
||||
<view class="cta-join" bind:tap="joinUs" wx:if="{{ role === 'user' }}">
|
||||
<text class="cta-join-text">加入我们</text>
|
||||
<image class="cta-join-img" src="./images/joinus.png" mode="aspectFit" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
@ -1,190 +1,241 @@
|
||||
.mt-21 {
|
||||
margin-top: 39.38rpx;
|
||||
}
|
||||
/* ========== 基础 ========== */
|
||||
.page {
|
||||
padding: 105rpx 36.56rpx 40.31rpx 49.76rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 72rpx 32rpx 48rpx;
|
||||
background-color: #ffffff;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 24rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.06);
|
||||
}
|
||||
|
||||
.title-wrap {
|
||||
margin-top: 24rpx;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 40rpx;
|
||||
line-height: 1.2;
|
||||
color: #1c2023;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin-top: 12rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666a73;
|
||||
}
|
||||
|
||||
.bold-text { font-weight: 700; }
|
||||
|
||||
/* ========== 卡片容器 ========== */
|
||||
.card {
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.image {
|
||||
width: 232.5rpx;
|
||||
height: 232.5rpx;
|
||||
}
|
||||
.group {
|
||||
margin-top: 35.14rpx;
|
||||
}
|
||||
.font {
|
||||
font-size: 37.5rpx;
|
||||
font-family: AlibabaPuHuiTi;
|
||||
line-height: 34.73rpx;
|
||||
color: #1c2023;
|
||||
}
|
||||
.text {
|
||||
line-height: 35.21rpx;
|
||||
}
|
||||
.group_2 {
|
||||
margin-top: 87.15rpx;
|
||||
}
|
||||
.font_2 {
|
||||
font-size: 30rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 27.69rpx;
|
||||
color: #1c2023;
|
||||
}
|
||||
.text_2 {
|
||||
line-height: 28.29rpx;
|
||||
}
|
||||
.text_3 {
|
||||
line-height: 28.2rpx;
|
||||
}
|
||||
.group_1 {
|
||||
padding-left: 2.74rpx;
|
||||
padding-right: 2.74rpx;
|
||||
}
|
||||
.section {
|
||||
margin-right: 11.32rpx;
|
||||
padding: 20.63rpx 16.88rpx 18.75rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
box-shadow: 0rpx 3.75rpx 11.25rpx #00000040;
|
||||
}
|
||||
.text-wrapper {
|
||||
margin-left: 16.88rpx;
|
||||
margin-right: 16.88rpx;
|
||||
padding: 15.92rpx 0 12.64rpx;
|
||||
background-color: #ffffff00;
|
||||
margin-right: 100rpx;
|
||||
}
|
||||
.font_3 {
|
||||
font-size: 30rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 27.69rpx;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
.text_4 {
|
||||
margin-left: 16.26rpx;
|
||||
}
|
||||
.section_2 {
|
||||
margin-right: 11.32rpx;
|
||||
padding: 20.63rpx 16.88rpx 18.75rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
|
||||
}
|
||||
.text_5 {
|
||||
margin-left: 16.26rpx;
|
||||
line-height: 27.86rpx;
|
||||
}
|
||||
.text-wrapper_3 {
|
||||
margin-right: 5.63rpx;
|
||||
padding: 13.16rpx 0 10.93rpx;
|
||||
background-color: #ff8d1a;
|
||||
border-radius: 9.38rpx;
|
||||
width: 157.5rpx;
|
||||
height: 45rpx;
|
||||
}
|
||||
.text_6 {
|
||||
color: #ffffff;
|
||||
font-size: 22.5rpx;
|
||||
font-family: AlibabaPuHuiTi;
|
||||
line-height: 20.91rpx;
|
||||
}
|
||||
.font_4 {
|
||||
font-size: 26.25rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 24.49rpx;
|
||||
color: #383838;
|
||||
}
|
||||
.text_7 {
|
||||
margin-right: 6.39rpx;
|
||||
margin-top: 28.76rpx;
|
||||
line-height: 24.36rpx;
|
||||
}
|
||||
.text-wrapper_4 {
|
||||
margin-right: 11.32rpx;
|
||||
margin-top: 46.26rpx;
|
||||
padding: 36.73rpx 0 34.16rpx;
|
||||
background-color: #ff8d1a;
|
||||
border-radius: 9.38rpx;
|
||||
}
|
||||
.text_8 {
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
font-family: AlibabaPuHuiTi;
|
||||
line-height: 26.61rpx;
|
||||
}
|
||||
.group_3 {
|
||||
margin-top: 48.75rpx;
|
||||
}
|
||||
.image_2 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.image_1 {
|
||||
width: 37.5rpx;
|
||||
height: 37.5rpx;
|
||||
}
|
||||
.group_4 {
|
||||
line-height: 24.49rpx;
|
||||
height: 24.56rpx;
|
||||
}
|
||||
.font_5 {
|
||||
font-size: 26.25rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 24.49rpx;
|
||||
color: #ff5e00;
|
||||
}
|
||||
.text_9 {
|
||||
color: #1c2023;
|
||||
line-height: 24.43rpx;
|
||||
}
|
||||
.text_10 {
|
||||
color: #1c2023;
|
||||
font-size: 26.25rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 19.93rpx;
|
||||
}
|
||||
.group_5 {
|
||||
margin-top: 43.91rpx;
|
||||
line-height: 24.41rpx;
|
||||
}
|
||||
.text_11 {
|
||||
line-height: 24.28rpx;
|
||||
}
|
||||
.text_12 {
|
||||
line-height: 24.41rpx;
|
||||
}
|
||||
.section_3 {
|
||||
margin-top: 100.11rpx;
|
||||
padding: 12.06rpx 21.69rpx 12.32rpx 24.15rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
width: 215.63rpx;
|
||||
border: solid 1.88rpx #ff8d1a;
|
||||
}
|
||||
.text_13 {
|
||||
color: #ff8d1a;
|
||||
line-height: 27.66rpx;
|
||||
}
|
||||
.image_3 {
|
||||
width: 41.25rpx;
|
||||
height: 41.25rpx;
|
||||
margin-top: 32rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
box-shadow: 0 10rpx 28rpx rgba(0,0,0,0.06);
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
/* 欢迎文本加粗 */
|
||||
.bold-text {
|
||||
font-weight: bold;
|
||||
/* ========== 标签切换 ========== */
|
||||
.tabs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 32rpx;
|
||||
padding: 8rpx 4rpx 20rpx;
|
||||
border-bottom: 1rpx solid #f1f1f1;
|
||||
}
|
||||
|
||||
/* 切换按钮默认样式,保持原 font_2 大小;active 时放大加粗 */
|
||||
.toggle-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: normal;
|
||||
transition: font-size 0.2s;
|
||||
.tab {
|
||||
font-size: 28rpx;
|
||||
color: #666a73;
|
||||
padding: 8rpx 6rpx;
|
||||
position: relative;
|
||||
transition: color .2s, transform .2s;
|
||||
}
|
||||
.toggle-text.active {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
|
||||
.tab.active {
|
||||
color: #1c2023;
|
||||
font-weight: 700;
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.tab.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: -12rpx;
|
||||
height: 6rpx;
|
||||
background: #ff8d1a;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
/* ========== 表单区 ========== */
|
||||
.form { padding-top: 24rpx; }
|
||||
|
||||
.field {
|
||||
background: #fff;
|
||||
border: 1rpx solid #e9e9ec;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
box-shadow: 0 6rpx 16rpx rgba(0,0,0,0.04);
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.field-input {
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
color: #1c2023;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.field-input:focus {
|
||||
outline: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.field:focus-within {
|
||||
border-color: #ff8d1a;
|
||||
box-shadow: 0 8rpx 24rpx rgba(255,141,26,0.12);
|
||||
}
|
||||
|
||||
.ph { color: #9aa0a6; }
|
||||
|
||||
/* 输入+验证码并排 */
|
||||
.field-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding-right: 16rpx;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.flex-1 { flex: 1; }
|
||||
|
||||
/* 验证码按钮 */
|
||||
.code-btn {
|
||||
height: 44rpx;
|
||||
padding: 0 24rpx;
|
||||
background: #ff8d1a;
|
||||
border-radius: 14rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 8rpx 18rpx rgba(255,141,26,0.25);
|
||||
active-opacity: 0.85;
|
||||
}
|
||||
|
||||
.code-btn:active { transform: scale(0.98); }
|
||||
|
||||
.code-btn-text {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 忘记密码链接 */
|
||||
.link-right {
|
||||
margin-top: 16rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666a73;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
/* 登录按钮 */
|
||||
.btn-primary {
|
||||
margin-top: 32rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 18rpx;
|
||||
background: linear-gradient(180deg, #ff9a2d 0%, #ff8d1a 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 14rpx 28rpx rgba(255,141,26,0.28);
|
||||
transition: transform .06s ease-in-out;
|
||||
}
|
||||
|
||||
.btn-primary:active { transform: scale(0.985); }
|
||||
|
||||
.btn-primary-text {
|
||||
color: #ffffff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* 协议区 */
|
||||
.agreements {
|
||||
margin-top: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.checkbox { transform: scale(0.92); }
|
||||
|
||||
.agreements-text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.muted { color: #666a73; font-size: 26rpx; }
|
||||
.link { color: #ff5e00; font-size: 26rpx; }
|
||||
.link-strong { color: #ff5e00; font-size: 28rpx; font-weight: 700; }
|
||||
|
||||
/* 注册区 */
|
||||
.register {
|
||||
margin-top: 24rpx;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
/* 加入我们 CTA */
|
||||
.cta-join {
|
||||
margin-top: 48rpx;
|
||||
padding: 16rpx 22rpx;
|
||||
border: 1rpx solid #ff8d1a;
|
||||
border-radius: 14rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.cta-join-text { color: #ff8d1a; font-size: 28rpx; }
|
||||
.cta-join-img { width: 44rpx; height: 44rpx; }
|
||||
|
||||
/* ========== 兼容你原先用到的类名(可选保留) ========== */
|
||||
.font { font-size: 37.5rpx; color: #1c2023; }
|
||||
.font_2 { font-size: 30rpx; color: #1c2023; }
|
||||
.font_4 { font-size: 26rpx; color: #383838; }
|
||||
.font_5 { font-size: 26rpx; color: #ff5e00; }
|
||||
|
||||
.toggle-text { font-size: 28rpx; transition: font-size .2s; }
|
||||
.toggle-text.active { font-size: 36rpx; font-weight: 700; }
|
||||
|
||||
/* 简易工具类(若你全局已有可删除) */
|
||||
.items-center { align-items: center; }
|
||||
.self-center { align-self: center; }
|
||||
.self-end { align-self: flex-end; }
|
||||
.justify-evenly { justify-content: space-evenly; }
|
||||
.relative { position: relative; }
|
||||
.shrink-0 { flex-shrink: 0; }
|
||||
.ml-2 { margin-left: 16rpx; }
|
||||
.ml-8 { margin-left: 32rpx; }
|
||||
.ml-12 { margin-left: 48rpx; }
|
||||
.mt-12 { margin-top: 24rpx; }
|
||||
.mt-20 { margin-top: 40rpx; }
|
||||
|
Reference in New Issue
Block a user