重构项目文件夹目录

This commit is contained in:
2026-06-15 15:53:55 +08:00
parent 8093e07190
commit 7cbe5b3de5
1098 changed files with 34 additions and 4441 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,5 @@
{
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar"
}
}
+287
View File
@@ -0,0 +1,287 @@
<view class="settings-page-root" style="{{themeVars}}">
<navigation-bar title="设置中心" showBack="{{true}}" fallbackPath="/pages/profile/index" color="{{navThemeColor || '#4A443F'}}" background="{{navThemeBackground || '#FDFBF9'}}"></navigation-bar>
<view class="settings-scroll">
<view class="page-shell settings-page-shell {{keyboardVisible ? 'keyboard-active' : ''}}">
<view class="page-content">
<view wx:if="{{!isLoggedIn}}" class="page-card empty-card">
<text class="empty-title">登录后进入设置中心</text>
<text class="empty-desc">登录后管理资料和安全设置。</text>
<view class="ghost-btn" bindtap="handleOpenAuth">去登录</view>
</view>
<block wx:elif="{{userInfo}}">
<view class="page-hero settings-hero">
<text class="hero-kicker">账号设置</text>
<text class="hero-title">资料与安全</text>
<text class="hero-desc">常用设置都在这里</text>
</view>
<view class="page-card settings-card">
<view class="section-title">个人资料</view>
<view class="profile-preview">
<image class="avatar" src="{{userInfo.avatar || defaultAvatar}}" mode="aspectFill" lazy-load="{{true}}" binderror="handleAvatarError"></image>
<view class="profile-preview-copy">
<view class="preview-name">{{userInfo.nickname || 'Yumi 用户'}}</view>
<view class="preview-account">{{userInfo.account}}</view>
<view class="preview-phone">{{userInfo.phone || '未绑定手机号'}}</view>
</view>
</view>
<view class="avatar-actions">
<view class="ghost-btn avatar-action" bindtap="handleChooseAvatar">{{uploadingAvatar ? '头像上传中...' : '更换头像'}}</view>
<view wx:if="{{userInfo.avatar}}" class="text-action" bindtap="handleDeleteAvatar">删除头像</view>
</view>
<view wx:if="{{needSetPassword}}" class="hint-card password-hint">
当前账号未设置登录密码。
</view>
<view id="settings-profile-nickname-anchor" class="field-block">
<text class="field-label">昵称</text>
<input
class="field-input"
placeholder="请输入昵称"
placeholder-class="field-placeholder"
value="{{form.nickname}}"
data-field="nickname"
data-keyboard-anchor="settings-profile-nickname-anchor"
bindinput="handleFormInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view id="settings-profile-signature-anchor" class="field-block">
<text class="field-label">个性签名</text>
<textarea
class="field-textarea"
placeholder="请输入个性签名"
placeholder-class="field-placeholder"
value="{{form.signature}}"
data-field="signature"
data-keyboard-anchor="settings-profile-signature-anchor"
bindinput="handleFormInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></textarea>
</view>
<view class="primary-btn save-btn" bindtap="handleSaveProfile">{{savingProfile ? '保存中...' : '保存资料'}}</view>
</view>
<view class="page-card settings-card security-card">
<view class="section-title">账号与安全</view>
<view class="setting-row" bindtap="handleSwitchShop">
<view class="setting-main">
<view class="setting-name">当前登录门店</view>
<view class="setting-desc">{{userInfo.shopName || '当前暂无可用门店'}}</view>
</view>
<view class="setting-action">{{(userInfo.shopIds && userInfo.shopIds.length > 1) ? '切换' : '查看'}}</view>
</view>
<view wx:if="{{!userInfo.phone}}" class="setting-row" data-panel="bindPhone" bindtap="handleToggleSecurityPanel">
<view class="setting-main">
<view class="setting-name">绑定手机号</view>
<view class="setting-desc">绑定后可设置密码</view>
</view>
<view class="setting-action">{{activeSecurityPanel === 'bindPhone' ? '收起' : '去绑定'}}</view>
</view>
<view wx:if="{{userInfo.phone}}" class="setting-row" data-panel="changePhone" bindtap="handleToggleSecurityPanel">
<view class="setting-main">
<view class="setting-name">修改手机号</view>
<view class="setting-desc">{{userInfo.phone}}</view>
</view>
<view class="setting-action">{{activeSecurityPanel === 'changePhone' ? '收起' : '修改'}}</view>
</view>
<view class="setting-row" data-panel="password" bindtap="handleToggleSecurityPanel">
<view class="setting-main">
<view class="setting-name">{{needSetPassword ? '设置登录密码' : '修改登录密码'}}</view>
<view class="setting-desc">{{userInfo.phone ? '短信验证后修改' : '请先绑定手机号'}}</view>
</view>
<view class="setting-action">{{activeSecurityPanel === 'password' ? '收起' : (needSetPassword ? '去设置' : '修改')}}</view>
</view>
<view wx:if="{{activeSecurityPanel === 'bindPhone'}}" class="security-panel">
<view class="section-subtitle">输入后完成绑定</view>
<view id="settings-bind-phone-anchor" class="field-block">
<text class="field-label">手机号</text>
<input
class="field-input"
type="number"
placeholder="请输入手机号"
placeholder-class="field-placeholder"
value="{{bindPhoneForm.phone}}"
data-field="phone"
data-keyboard-anchor="settings-bind-phone-anchor"
bindinput="handleBindPhoneInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view id="settings-bind-phone-code-anchor" class="field-block">
<text class="field-label">验证码</text>
<view class="code-row">
<input
class="field-input code-input"
type="number"
placeholder="请输入验证码"
placeholder-class="field-placeholder"
value="{{bindPhoneForm.verificationCode}}"
data-field="verificationCode"
data-keyboard-anchor="settings-bind-phone-code-anchor"
bindinput="handleBindPhoneInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<view class="code-btn {{countdown > 0 ? 'disabled' : ''}}" bindtap="handleSendBindPhoneCode">{{countdown > 0 ? countdown + 's' : '发送验证码'}}</view>
</view>
</view>
<view class="panel-actions">
<view class="secondary-btn panel-btn" bindtap="handleCloseSecurityPanel">取消</view>
<view class="primary-btn panel-btn" bindtap="handleBindPhoneSubmit">{{updatingPhone ? '绑定中...' : '确认绑定'}}</view>
</view>
</view>
<view wx:if="{{activeSecurityPanel === 'changePhone'}}" class="security-panel">
<view class="section-subtitle">验证后更新手机号</view>
<view class="field-block">
<text class="field-label">当前手机号</text>
<view class="field-static">{{userInfo.phone}}</view>
</view>
<view id="settings-change-phone-anchor" class="field-block">
<text class="field-label">新手机号</text>
<input
class="field-input"
type="number"
placeholder="请输入新的手机号"
placeholder-class="field-placeholder"
value="{{changePhoneForm.newPhone}}"
data-field="newPhone"
data-keyboard-anchor="settings-change-phone-anchor"
bindinput="handleChangePhoneInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view id="settings-change-phone-code-anchor" class="field-block">
<text class="field-label">验证码</text>
<view class="code-row">
<input
class="field-input code-input"
type="number"
placeholder="请输入验证码"
placeholder-class="field-placeholder"
value="{{changePhoneForm.verificationCode}}"
data-field="verificationCode"
data-keyboard-anchor="settings-change-phone-code-anchor"
bindinput="handleChangePhoneInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<view class="code-btn {{countdown > 0 ? 'disabled' : ''}}" bindtap="handleSendChangePhoneCode">{{countdown > 0 ? countdown + 's' : '发送验证码'}}</view>
</view>
</view>
<view class="panel-actions">
<view class="secondary-btn panel-btn" bindtap="handleCloseSecurityPanel">取消</view>
<view class="primary-btn panel-btn" bindtap="handleChangePhoneSubmit">{{updatingPhone ? '提交中...' : '确认修改'}}</view>
</view>
</view>
<view wx:if="{{activeSecurityPanel === 'password'}}" class="security-panel">
<view wx:if="{{!userInfo.phone}}" class="hint-card password-hint">请先绑定手机号,再通过验证码设置或修改登录密码。</view>
<block wx:else>
<view class="section-subtitle">密码需包含字母和数字</view>
<view id="settings-password-code-anchor" class="field-block">
<text class="field-label">验证码</text>
<view class="code-row">
<input
class="field-input code-input"
type="number"
placeholder="请输入验证码"
placeholder-class="field-placeholder"
value="{{passwordForm.verificationCode}}"
data-field="verificationCode"
data-keyboard-anchor="settings-password-code-anchor"
bindinput="handlePasswordInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<view class="code-btn {{countdown > 0 ? 'disabled' : ''}}" bindtap="handleSendPasswordCode">{{countdown > 0 ? countdown + 's' : '发送验证码'}}</view>
</view>
</view>
<view id="settings-password-anchor" class="field-block">
<text class="field-label">新密码</text>
<input
class="field-input"
password
placeholder="请输入新密码"
placeholder-class="field-placeholder"
value="{{passwordForm.password}}"
data-field="password"
data-keyboard-anchor="settings-password-anchor"
bindinput="handlePasswordInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view id="settings-password-confirm-anchor" class="field-block">
<text class="field-label">确认密码</text>
<input
class="field-input"
password
placeholder="请再次输入新密码"
placeholder-class="field-placeholder"
value="{{passwordForm.confirmPassword}}"
data-field="confirmPassword"
data-keyboard-anchor="settings-password-confirm-anchor"
bindinput="handlePasswordInput"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view class="panel-actions">
<view class="secondary-btn panel-btn" bindtap="handleCloseSecurityPanel">取消</view>
<view class="primary-btn panel-btn" bindtap="handleUpdatePassword">{{updatingPassword ? '提交中...' : '确认保存'}}</view>
</view>
</block>
</view>
<view class="setting-row danger-row" bindtap="handleDeactivateAccount">
<view class="setting-main">
<view class="setting-name">注销账号</view>
<view class="setting-desc">注销后不可继续登录</view>
</view>
<view class="setting-action danger-text">{{deactivating ? '处理中' : '注销'}}</view>
</view>
</view>
<view class="logout-btn" bindtap="handleLogout">退出登录</view>
</block>
</view>
<view wx:if="{{keyboardVisible}}" class="keyboard-spacer" style="height: {{keyboardInsetRpx}}rpx;"></view>
</view>
</view>
</view>
+224
View File
@@ -0,0 +1,224 @@
.settings-page-root {
min-height: 100vh;
background: var(--theme-page-bg);
}
.settings-scroll {
min-height: 100%;
}
.settings-page-shell {
min-height: 100%;
background: var(--theme-page-bg);
}
.settings-page-shell.keyboard-active {
padding-bottom: 0;
}
.settings-hero {
margin-bottom: 20rpx;
}
.settings-card + .settings-card {
margin-top: 20rpx;
}
.settings-card {
padding: 28rpx;
}
.profile-preview {
display: flex;
align-items: center;
gap: 20rpx;
margin-top: 22rpx;
}
.avatar {
width: 110rpx;
height: 110rpx;
border-radius: 50%;
background: var(--theme-primary-soft);
}
.profile-preview-copy {
flex: 1;
min-width: 0;
}
.preview-name {
font-size: 32rpx;
font-weight: 700;
color: var(--text-primary);
}
.preview-account,
.preview-phone {
margin-top: 10rpx;
font-size: 24rpx;
color: var(--text-secondary);
word-break: break-all;
}
.avatar-actions {
display: flex;
align-items: center;
gap: 18rpx;
margin-top: 22rpx;
}
.avatar-action {
width: auto;
min-width: 220rpx;
padding: 0 28rpx;
}
.text-action {
font-size: 24rpx;
font-weight: 600;
color: var(--theme-primary);
}
.field-block {
margin-top: 20rpx;
}
.save-btn {
margin-top: 26rpx;
}
.password-hint {
margin-top: 20rpx;
}
.security-card {
margin-top: 20rpx;
}
.setting-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18rpx;
padding: 24rpx 0;
border-bottom: 1rpx solid var(--theme-border);
}
.setting-row:first-of-type {
margin-top: 8rpx;
}
.setting-row:last-child {
border-bottom: 0;
padding-bottom: 0;
}
.setting-main {
flex: 1;
min-width: 0;
}
.setting-name {
font-size: 28rpx;
font-weight: 700;
color: var(--text-primary);
}
.setting-desc {
margin-top: 10rpx;
font-size: 24rpx;
line-height: 1.7;
color: var(--text-secondary);
}
.setting-action {
flex-shrink: 0;
font-size: 24rpx;
font-weight: 700;
color: var(--theme-primary);
}
.security-panel {
margin-top: 6rpx;
padding: 26rpx 24rpx;
border-radius: 28rpx;
background: var(--theme-primary-soft);
}
.field-static {
display: flex;
align-items: center;
min-height: 92rpx;
padding: 0 28rpx;
border-radius: 24rpx;
background: var(--theme-card-bg);
border: 1rpx solid var(--theme-border);
color: #5d4b55;
font-size: 28rpx;
}
.code-row {
display: flex;
align-items: center;
gap: 14rpx;
}
.code-input {
flex: 1;
}
.code-btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 180rpx;
height: 92rpx;
padding: 0 18rpx;
border-radius: 24rpx;
background: var(--theme-primary-soft);
color: var(--theme-primary);
font-size: 24rpx;
font-weight: 700;
}
.code-btn.disabled {
background: var(--theme-card-bg);
color: #a998a0;
}
.panel-actions {
display: flex;
gap: 14rpx;
margin-top: 24rpx;
}
.panel-btn {
flex: 1;
}
.danger-row {
margin-top: 8rpx;
}
.danger-text {
color: var(--theme-accent);
}
.logout-btn {
display: flex;
align-items: center;
justify-content: center;
height: 92rpx;
margin-top: 24rpx;
border-radius: 999rpx;
background: var(--theme-primary-soft);
color: var(--theme-accent);
font-size: 28rpx;
font-weight: 700;
}
.keyboard-spacer {
width: 100%;
flex-shrink: 0;
}