简化Salon登录页面布局
This commit is contained in:
@@ -79,6 +79,7 @@ function clearLoginPreference() {
|
||||
|
||||
Page({
|
||||
data: {
|
||||
loginView: 'entry',
|
||||
loginMode: 'phone',
|
||||
form: {
|
||||
account: '',
|
||||
@@ -132,10 +133,14 @@ Page({
|
||||
|
||||
switchLoginMode(event) {
|
||||
const loginMode = event.currentTarget.dataset.mode
|
||||
if (loginMode === this.data.loginMode) {
|
||||
if (loginMode === 'entry') {
|
||||
this.setData({ loginView: 'entry' })
|
||||
return
|
||||
}
|
||||
this.setData({ loginMode })
|
||||
if (loginMode === this.data.loginMode && this.data.loginView === 'form') {
|
||||
return
|
||||
}
|
||||
this.setData({ loginMode, loginView: 'form' })
|
||||
},
|
||||
|
||||
async sendLoginCode() {
|
||||
|
||||
@@ -1,96 +1,20 @@
|
||||
<view class="page no-tab auth-page">
|
||||
<view class="brand">
|
||||
<image class="logo" src="/assets/images/app-icon.png" mode="aspectFill"></image>
|
||||
<text class="brand-name">{{appName}}</text>
|
||||
<text class="brand-sub">门店工作台 · 让每一次服务都有清晰安排</text>
|
||||
<view class="topbar"><text class="topbar-title">登录 Salon</text></view>
|
||||
<view wx:if="{{loginView === 'entry'}}" class="entry-view">
|
||||
<view class="brand entry-brand"><image class="logo" src="/assets/images/app-icon.png" mode="aspectFill"></image><text class="brand-name">{{appName}}</text><text class="brand-sub">门店工作台</text></view>
|
||||
<view class="entry-actions"><button class="primary-btn entry-primary" open-type="getPhoneNumber" bindgetphonenumber="wechatPhoneLogin">微信手机号快捷登录</button><button class="secondary-btn entry-secondary" data-mode="phone" bindtap="switchLoginMode">验证码登录</button><view class="entry-password" data-mode="password" bindtap="switchLoginMode">账号密码登录</view><view class="entry-register" bindtap="goRegister">注册账号 <text>›</text></view></view>
|
||||
<view class="agreement-row entry-agreement" bindtap="toggleAgreement"><view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view><view class="agreement-copy"><text>我已阅读并同意</text><text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text><text>和</text><text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text></view></view>
|
||||
</view>
|
||||
|
||||
<view class="card auth-card">
|
||||
<view class="welcome-copy">欢迎回来</view>
|
||||
<view class="welcome-hint">登录后继续管理门店与今日排班</view>
|
||||
<view class="mode-tabs">
|
||||
<view class="mode-tab {{loginMode === 'phone' ? 'active' : ''}}" data-mode="phone" bindtap="switchLoginMode">验证码登录</view>
|
||||
<view class="mode-tab {{loginMode === 'password' ? 'active' : ''}}" data-mode="password" bindtap="switchLoginMode">密码登录</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{loginMode === 'password'}}" class="field">
|
||||
<text class="field-label">账号</text>
|
||||
<input value="{{form.account}}" data-field="account" bindinput="onInput" placeholder="请输入账号" />
|
||||
</view>
|
||||
<view wx:if="{{loginMode === 'password'}}" class="field">
|
||||
<text class="field-label">密码</text>
|
||||
<input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="请输入密码" />
|
||||
</view>
|
||||
<view wx:if="{{loginMode === 'phone'}}" class="field">
|
||||
<text class="field-label">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="text" maxlength="11" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view wx:if="{{loginMode === 'phone'}}" class="field">
|
||||
<text class="field-label">验证码</text>
|
||||
<view class="code-row">
|
||||
<input class="code-input" value="{{form.code}}" data-field="code" bindinput="onInput" type="text" maxlength="6" placeholder="请输入验证码" />
|
||||
<button class="code-btn {{countdown > 0 ? 'counting' : ''}}" loading="{{codeLoading}}" disabled="{{codeLoading || countdown > 0}}" bindtap="sendLoginCode">
|
||||
<text wx:if="{{countdown > 0}}">重新获取 {{countdown}}s</text>
|
||||
<text wx:else>{{codeSent ? '重新获取' : '获取验证码'}}</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="agreement-row" bindtap="toggleAgreement">
|
||||
<view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view>
|
||||
<view class="agreement-copy">
|
||||
<text>我已阅读并同意</text>
|
||||
<text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text>
|
||||
<text>和</text>
|
||||
<text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{agreementError}}" class="agreement-error" bindtap="loadAgreements">{{agreementError}},点此重试</view>
|
||||
<view class="remember-row" bindtap="toggleRememberMe">
|
||||
<view class="agreement-check {{rememberMe ? 'checked' : ''}}">{{rememberMe ? '✓' : ''}}</view>
|
||||
<view class="agreement-copy">记住我,保持登录更久</view>
|
||||
</view>
|
||||
<button class="primary-btn login-btn {{agreementAccepted ? '' : 'disabled'}}" loading="{{loading}}" disabled="{{loading || agreementLoading}}" bindtap="submit">{{agreementLoading ? '协议加载中...' : '登录'}}</button>
|
||||
<view class="auth-links">
|
||||
<button class="text-btn">忘记密码</button>
|
||||
<button class="text-btn" bindtap="goRegister">注册账号</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="secondary-btn wechat-btn" open-type="getPhoneNumber" bindgetphonenumber="wechatPhoneLogin">微信手机号一键登录</button>
|
||||
|
||||
<view wx:if="{{shopSelectVisible}}" class="shop-select-mask">
|
||||
<view class="shop-select-dialog">
|
||||
<view class="shop-select-header">
|
||||
<text class="shop-select-title">选择店铺</text>
|
||||
<text class="shop-select-subtitle">请选择本次登录的店铺</text>
|
||||
</view>
|
||||
<scroll-view class="shop-option-list" scroll-y>
|
||||
<view
|
||||
wx:for="{{shopOptions}}"
|
||||
wx:key="id"
|
||||
class="shop-option {{switchingShop ? 'disabled' : ''}}"
|
||||
data-id="{{item.id}}"
|
||||
bindtap="selectLoginShop"
|
||||
>
|
||||
<view class="shop-option-icon">店</view>
|
||||
<view class="shop-option-copy">
|
||||
<text class="shop-option-name">{{item.name}}</text>
|
||||
<text class="shop-option-id">{{item.description || ('ID ' + item.id)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view wx:if="{{switchingShop}}" class="shop-switching">正在进入店铺...</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{agreementModalVisible}}" class="agreement-mask" catchtouchmove="stopTap">
|
||||
<view class="agreement-modal">
|
||||
<view class="agreement-modal-title">{{selectedAgreement.title || '协议详情'}}</view>
|
||||
<view class="agreement-modal-meta">版本:{{selectedAgreement.version || '-'}}</view>
|
||||
<scroll-view class="agreement-modal-body" scroll-y>
|
||||
<text>{{selectedAgreement.content || '暂无协议内容'}}</text>
|
||||
</scroll-view>
|
||||
<button class="primary-btn agreement-modal-close" bindtap="closeAgreementModal">我知道了</button>
|
||||
</view>
|
||||
<view wx:if="{{loginView === 'form'}}" class="form-view">
|
||||
<view class="form-heading"><view class="back-entry" data-mode="entry" bindtap="switchLoginMode">‹ <text>返回</text></view><view class="form-title">{{loginMode === 'phone' ? '手机号登录' : '账号密码登录'}}</view><view class="form-subtitle">{{loginMode === 'phone' ? '使用手机号验证码登录工作台' : '使用管理员提供的账号登录'}}</view></view>
|
||||
<view wx:if="{{loginMode === 'password'}}" class="field compact-field"><text class="field-label">账号</text><input value="{{form.account}}" data-field="account" bindinput="onInput" placeholder="请输入账号" /></view>
|
||||
<view wx:if="{{loginMode === 'password'}}" class="field compact-field"><text class="field-label">密码</text><input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="请输入密码" /></view>
|
||||
<view wx:if="{{loginMode === 'phone'}}" class="field compact-field"><text class="field-label">手机号</text><input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="text" maxlength="11" placeholder="请输入手机号" /></view>
|
||||
<view wx:if="{{loginMode === 'phone'}}" class="field compact-field"><text class="field-label">验证码</text><view class="code-row"><input class="code-input" value="{{form.code}}" data-field="code" bindinput="onInput" type="text" maxlength="6" placeholder="请输入验证码" /><button class="code-btn {{countdown > 0 ? 'counting' : ''}}" loading="{{codeLoading}}" disabled="{{codeLoading || countdown > 0}}" bindtap="sendLoginCode"><text wx:if="{{countdown > 0}}">重新获取 {{countdown}}s</text><text wx:else>{{codeSent ? '重新获取' : '获取验证码'}}</text></button></view></view>
|
||||
<view class="agreement-row" bindtap="toggleAgreement"><view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view><view class="agreement-copy"><text>我已阅读并同意</text><text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text><text>和</text><text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text></view></view>
|
||||
<view wx:if="{{agreementError}}" class="agreement-error" bindtap="loadAgreements">{{agreementError}},点此重试</view><view class="remember-row" bindtap="toggleRememberMe"><view class="agreement-check {{rememberMe ? 'checked' : ''}}">{{rememberMe ? '✓' : ''}}</view><view class="agreement-copy">记住我,保持登录更久</view></view><button class="primary-btn login-btn {{agreementAccepted ? '' : 'disabled'}}" loading="{{loading}}" disabled="{{loading || agreementLoading}}" bindtap="submit">{{agreementLoading ? '协议加载中...' : '登录'}}</button>
|
||||
<view class="form-links"><view bindtap="switchLoginMode" data-mode="phone" wx:if="{{loginMode === 'password'}}">验证码登录</view><view bindtap="switchLoginMode" data-mode="password" wx:if="{{loginMode === 'phone'}}">账号密码登录</view><view bindtap="goRegister">注册账号</view></view>
|
||||
</view>
|
||||
<view wx:if="{{agreementModalVisible}}" class="agreement-mask" catchtouchmove="stopTap"><view class="agreement-modal"><view class="agreement-modal-title">{{selectedAgreement.title || '协议详情'}}</view><view class="agreement-modal-meta">版本:{{selectedAgreement.version || '-'}}</view><scroll-view class="agreement-modal-body" scroll-y><text>{{selectedAgreement.content || '暂无协议内容'}}</text></scroll-view><button class="primary-btn agreement-modal-close" bindtap="closeAgreementModal">我知道了</button></view></view>
|
||||
<view wx:if="{{shopSelectVisible}}" class="shop-select-mask"><view class="shop-select-dialog"><view class="shop-select-header"><text class="shop-select-title">选择店铺</text><text class="shop-select-subtitle">请选择本次登录的店铺</text></view><scroll-view class="shop-option-list" scroll-y><view wx:for="{{shopOptions}}" wx:key="id" class="shop-option {{switchingShop ? 'disabled' : ''}}" data-id="{{item.id}}" bindtap="selectLoginShop"><view class="shop-option-icon">店</view><view class="shop-option-copy"><text class="shop-option-name">{{item.name}}</text><text class="shop-option-id">{{item.description || ('ID ' + item.id)}}</text></view></view></scroll-view><view wx:if="{{switchingShop}}" class="shop-switching">正在进入店铺...</view></view></view>
|
||||
</view>
|
||||
|
||||
@@ -355,3 +355,200 @@
|
||||
.agreement-modal-close {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
/* 简洁登录布局沿用 Salon 现有绿色配色和控件语言。 */
|
||||
.auth-page {
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
padding: 0 36rpx 48rpx;
|
||||
background: #f4f8f5;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 96rpx;
|
||||
border-bottom: 1rpx solid #e7eee9;
|
||||
}
|
||||
|
||||
.topbar-title {
|
||||
color: #2e4a3d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.entry-view,
|
||||
.form-view {
|
||||
width: 100%;
|
||||
max-width: 680rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.entry-brand {
|
||||
margin-top: 132rpx;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.entry-brand .logo {
|
||||
width: 128rpx;
|
||||
height: 128rpx;
|
||||
}
|
||||
|
||||
.entry-brand .brand-name {
|
||||
margin-top: 22rpx;
|
||||
font-size: 42rpx;
|
||||
}
|
||||
|
||||
.entry-brand .brand-sub {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.entry-actions {
|
||||
margin-top: 132rpx;
|
||||
}
|
||||
|
||||
.entry-primary,
|
||||
.entry-secondary {
|
||||
width: 100%;
|
||||
height: 92rpx;
|
||||
margin: 0;
|
||||
border-radius: 14rpx;
|
||||
font-size: 29rpx;
|
||||
line-height: 92rpx;
|
||||
}
|
||||
|
||||
.entry-primary {
|
||||
background: #6f8f83;
|
||||
color: #fffdf8;
|
||||
}
|
||||
|
||||
.entry-secondary {
|
||||
margin-top: 22rpx;
|
||||
border: 1rpx solid #9fbcac;
|
||||
background: #fbfdfb;
|
||||
color: #55786d;
|
||||
}
|
||||
|
||||
.entry-password,
|
||||
.entry-register {
|
||||
color: #6f8f83;
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.entry-password {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.entry-register {
|
||||
margin-top: 24rpx;
|
||||
color: #8b968f;
|
||||
}
|
||||
|
||||
.entry-register text {
|
||||
margin-left: 4rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.entry-agreement {
|
||||
margin-top: 118rpx;
|
||||
}
|
||||
|
||||
.form-view {
|
||||
padding-top: 54rpx;
|
||||
}
|
||||
|
||||
.form-heading {
|
||||
position: relative;
|
||||
margin-bottom: 72rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.back-entry {
|
||||
position: absolute;
|
||||
top: -8rpx;
|
||||
left: 0;
|
||||
color: #6f8f83;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.back-entry text {
|
||||
margin-left: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
color: #2e4a3d;
|
||||
font-size: 42rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.form-subtitle {
|
||||
margin-top: 12rpx;
|
||||
color: #87978c;
|
||||
font-size: 23rpx;
|
||||
}
|
||||
|
||||
.compact-field {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.compact-field .field-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.compact-field input {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
padding: 0 8rpx;
|
||||
border-bottom: 1rpx solid #dce7df;
|
||||
background: transparent;
|
||||
color: #2e4a3d;
|
||||
font-size: 29rpx;
|
||||
}
|
||||
|
||||
.compact-field .code-row {
|
||||
border-bottom: 1rpx solid #dce7df;
|
||||
}
|
||||
|
||||
.compact-field .code-input {
|
||||
height: 88rpx;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.compact-field .code-btn {
|
||||
width: 190rpx;
|
||||
min-width: 190rpx;
|
||||
max-width: 190rpx;
|
||||
height: 72rpx;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #55786d;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
|
||||
.form-view .agreement-row {
|
||||
margin-top: 44rpx;
|
||||
}
|
||||
|
||||
.form-view .remember-row {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.form-view .login-btn {
|
||||
height: 88rpx;
|
||||
margin-top: 38rpx;
|
||||
border-radius: 14rpx;
|
||||
line-height: 88rpx;
|
||||
}
|
||||
|
||||
.form-links {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 48rpx;
|
||||
margin-top: 28rpx;
|
||||
color: #6f8f83;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user