杂务:整理文档并收口 YumiNail 修复
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
const authApi = require('./api/auth')
|
||||
const cartApi = require('./api/cart')
|
||||
const shopApi = require('./api/shop')
|
||||
const userApi = require('./api/user')
|
||||
const auth = require('./utils/auth')
|
||||
const idleSession = require('./utils/idle-session')
|
||||
const theme = require('./utils/theme')
|
||||
const file = require('./utils/file')
|
||||
const { IDLE_TIMEOUT_MS, IDLE_WARNING_MS } = require('./utils/config')
|
||||
|
||||
App({
|
||||
@@ -10,6 +13,7 @@ App({
|
||||
userInfo: null,
|
||||
isLoggedIn: false,
|
||||
cartCount: 0,
|
||||
shopTheme: theme.DEFAULT_SHOP_THEME,
|
||||
pendingProductFilter: null,
|
||||
pendingWechatMiniLogin: null,
|
||||
wechatMiniAutoLoginState: 'idle'
|
||||
@@ -41,6 +45,7 @@ App({
|
||||
const isLoggedIn = auth.isLoggedIn()
|
||||
this.globalData.userInfo = userInfo
|
||||
this.globalData.isLoggedIn = isLoggedIn
|
||||
this.refreshShopTheme(userInfo)
|
||||
|
||||
if (userInfo && userInfo.shopId) {
|
||||
auth.setPreferredMiniLoginShopId(userInfo.shopId)
|
||||
@@ -161,6 +166,7 @@ App({
|
||||
auth.setSession(payload)
|
||||
this.globalData.userInfo = auth.getStoredUserInfo()
|
||||
this.globalData.isLoggedIn = auth.isLoggedIn()
|
||||
this.refreshShopTheme(this.globalData.userInfo)
|
||||
|
||||
if (this.globalData.userInfo && this.globalData.userInfo.shopId) {
|
||||
auth.setPreferredMiniLoginShopId(this.globalData.userInfo.shopId)
|
||||
@@ -173,6 +179,7 @@ App({
|
||||
auth.updateStoredUserInfo(userInfo)
|
||||
this.globalData.userInfo = userInfo
|
||||
this.globalData.isLoggedIn = auth.isLoggedIn()
|
||||
this.refreshShopTheme(userInfo)
|
||||
|
||||
if (userInfo && userInfo.shopId) {
|
||||
auth.setPreferredMiniLoginShopId(userInfo.shopId)
|
||||
@@ -183,9 +190,62 @@ App({
|
||||
auth.clearSession()
|
||||
this.globalData.userInfo = null
|
||||
this.globalData.isLoggedIn = false
|
||||
this.setShopTheme(null)
|
||||
this.clearCartBadge()
|
||||
},
|
||||
|
||||
setShopTheme(shop) {
|
||||
const resolvedTheme = theme.resolveShopTheme(shop)
|
||||
this.globalData.shopTheme = resolvedTheme
|
||||
this.syncThemeToCurrentPages()
|
||||
if (resolvedTheme.backgroundImageFileId) {
|
||||
this.resolveShopThemeBackground(shop, resolvedTheme.backgroundImageFileId)
|
||||
}
|
||||
},
|
||||
|
||||
async resolveShopThemeBackground(shop, fileId) {
|
||||
try {
|
||||
const backgroundImageUrl = await file.getSignedUrl(fileId)
|
||||
if (
|
||||
!backgroundImageUrl
|
||||
|| !this.globalData.shopTheme
|
||||
|| this.globalData.shopTheme.backgroundImageFileId !== String(fileId)
|
||||
) {
|
||||
return
|
||||
}
|
||||
this.globalData.shopTheme = theme.resolveShopTheme({
|
||||
...(shop || {}),
|
||||
themeBackgroundImageUrl: backgroundImageUrl
|
||||
})
|
||||
this.syncThemeToCurrentPages()
|
||||
} catch (error) {}
|
||||
},
|
||||
|
||||
async refreshShopTheme(userInfo) {
|
||||
if (!userInfo || !userInfo.shopId) {
|
||||
this.setShopTheme(null)
|
||||
return
|
||||
}
|
||||
try {
|
||||
const shop = await shopApi.getShopById(userInfo.shopId)
|
||||
if (this.globalData.userInfo && String(this.globalData.userInfo.shopId) === String(userInfo.shopId)) {
|
||||
this.setShopTheme(shop)
|
||||
}
|
||||
} catch (error) {
|
||||
this.setShopTheme(null)
|
||||
}
|
||||
},
|
||||
|
||||
syncThemeToCurrentPages() {
|
||||
const pages = typeof getCurrentPages === 'function' ? getCurrentPages() : []
|
||||
const data = theme.pageThemeData(this.globalData.shopTheme)
|
||||
pages.forEach(page => {
|
||||
if (page && typeof page.setData === 'function') {
|
||||
page.setData(data)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async refreshSessionUserInfo() {
|
||||
if (!auth.isLoggedIn()) {
|
||||
return
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationStyle": "custom",
|
||||
"backgroundTextStyle": "light",
|
||||
"backgroundColor": "#fff7f8"
|
||||
"backgroundColor": "#fff7f9"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#8f7b83",
|
||||
"selectedColor": "#c6597d",
|
||||
"backgroundColor": "#fffaf9",
|
||||
"backgroundColor": "#fff7f9",
|
||||
"borderStyle": "black",
|
||||
"position": "bottom",
|
||||
"list": [
|
||||
|
||||
+36
-28
@@ -1,8 +1,15 @@
|
||||
page {
|
||||
min-height: 100%;
|
||||
background:
|
||||
radial-gradient(circle at top right, rgba(255, 205, 219, 0.38), transparent 32%),
|
||||
linear-gradient(180deg, #fff7f8 0%, #fffdfc 100%);
|
||||
--theme-primary: #c6597d;
|
||||
--theme-secondary: #e9b7c7;
|
||||
--theme-accent: #9f4967;
|
||||
--theme-page-bg: #fff7f9;
|
||||
--theme-card-bg: #ffffff;
|
||||
--theme-border: #efd8e0;
|
||||
--theme-primary-soft: #fbf1f4;
|
||||
--theme-gradient: linear-gradient(135deg, #c6597d 0%, #e9b7c7 100%);
|
||||
--theme-gradient-soft: linear-gradient(145deg, #ffffff 0%, #fff1f5 58%, #ffe8ef 100%);
|
||||
min-height: 100vh;
|
||||
background: var(--theme-page-bg);
|
||||
color: #2d2430;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
@@ -39,6 +46,7 @@ button::after {
|
||||
.page-shell {
|
||||
min-height: 100vh;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 48rpx);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.page-content {
|
||||
@@ -47,14 +55,14 @@ button::after {
|
||||
|
||||
.page-card {
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
border: 1rpx solid rgba(239, 216, 224, 0.86);
|
||||
background: var(--theme-card-bg);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
border-radius: 32rpx;
|
||||
box-shadow: 0 22rpx 56rpx rgba(122, 67, 88, 0.1);
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
background: rgba(255, 255, 255, 0.82);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.9);
|
||||
border-radius: 32rpx;
|
||||
box-shadow: 0 22rpx 56rpx rgba(122, 67, 88, 0.08);
|
||||
@@ -64,8 +72,8 @@ button::after {
|
||||
overflow: hidden;
|
||||
padding: 34rpx 30rpx;
|
||||
border-radius: 36rpx;
|
||||
background: linear-gradient(145deg, #fffdfd 0%, #fff1f5 56%, #ffe8ef 100%);
|
||||
border: 1rpx solid rgba(244, 214, 224, 0.92);
|
||||
background: var(--theme-gradient-soft);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
box-shadow: 0 28rpx 64rpx rgba(122, 67, 88, 0.1);
|
||||
}
|
||||
|
||||
@@ -74,7 +82,7 @@ button::after {
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
@@ -114,7 +122,7 @@ button::after {
|
||||
}
|
||||
|
||||
.hero-action.primary {
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
@@ -145,7 +153,7 @@ button::after {
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
@@ -165,7 +173,7 @@ button::after {
|
||||
|
||||
.section-link {
|
||||
font-size: 24rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -213,7 +221,7 @@ button::after {
|
||||
width: 100%;
|
||||
height: 92rpx;
|
||||
border-radius: 999rpx;
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
@@ -226,8 +234,8 @@ button::after {
|
||||
width: 100%;
|
||||
height: 84rpx;
|
||||
border-radius: 999rpx;
|
||||
border: 2rpx solid #efd7df;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid var(--theme-border);
|
||||
background: var(--theme-card-bg);
|
||||
color: #7a5262;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
@@ -241,8 +249,8 @@ button::after {
|
||||
height: 68rpx;
|
||||
padding: 0 26rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fdf0f4;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -264,8 +272,8 @@ button::after {
|
||||
min-height: 92rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fbf5f7;
|
||||
border: 1rpx solid rgba(239, 216, 224, 0.92);
|
||||
background: var(--theme-primary-soft);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
color: #2d2430;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
@@ -287,18 +295,18 @@ button::after {
|
||||
}
|
||||
|
||||
.status-text.success {
|
||||
color: #2ea36f;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.status-text.error {
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.hint-card {
|
||||
padding: 20rpx 22rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #fff8ea;
|
||||
color: #9b6900;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
@@ -336,17 +344,17 @@ button::after {
|
||||
}
|
||||
|
||||
.chip {
|
||||
background: #fce8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.soft-chip {
|
||||
background: #fbf5f7;
|
||||
background: var(--theme-primary-soft);
|
||||
color: #8d7a84;
|
||||
}
|
||||
|
||||
.divider-line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #f3e7eb;
|
||||
background: var(--theme-border);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 28rpx;
|
||||
background: #ffffff;
|
||||
border: 1rpx solid rgba(239, 216, 224, 0.84);
|
||||
background: var(--theme-card-bg);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
box-shadow: 0 18rpx 42rpx rgba(122, 67, 88, 0.08);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.product-cover {
|
||||
width: 100%;
|
||||
height: 288rpx;
|
||||
background: #f7ecf0;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.product-cover-shadow {
|
||||
@@ -82,8 +82,8 @@
|
||||
max-width: 100%;
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fbecf1;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 18rpx;
|
||||
line-height: 1;
|
||||
overflow: hidden;
|
||||
@@ -114,7 +114,7 @@
|
||||
font-size: 34rpx;
|
||||
line-height: 1.12;
|
||||
font-weight: 800;
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.product-stats {
|
||||
@@ -132,7 +132,7 @@
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 22rpx;
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
box-shadow: 0 14rpx 30rpx rgba(198, 89, 125, 0.22);
|
||||
}
|
||||
|
||||
@@ -209,8 +209,8 @@
|
||||
height: 56rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f8eef1;
|
||||
color: #8f6e7a;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -4,6 +4,7 @@ const userApi = require('../../api/user')
|
||||
const authStore = require('../../utils/auth')
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
const {
|
||||
createKeyboardSafeData,
|
||||
@@ -23,7 +24,7 @@ const phoneRegex = /^1[3-9]\d{9}$/
|
||||
Page({
|
||||
data: Object.assign(createKeyboardSafeData({
|
||||
cursorSpacing: 108
|
||||
}), {
|
||||
}), theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
redirect: '',
|
||||
activeTab: 'login',
|
||||
loginType: 'password',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<view class="auth-page-root">
|
||||
<navigation-bar title="账号中心" showBack="{{true}}" fallbackPath="/pages/home/index" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<view class="auth-page-root" style="{{themeVars}}">
|
||||
<navigation-bar title="账号中心" showBack="{{true}}" fallbackPath="/pages/home/index" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="auth-scroll">
|
||||
<scroll-view class="auth-scroll" scroll-y="true" enhanced="true" show-scrollbar="false">
|
||||
<view class="page-shell auth-page-shell auth-page">
|
||||
<view class="page-content auth-content {{keyboardVisible ? 'keyboard-active' : ''}}">
|
||||
<view class="page-card auth-panel">
|
||||
@@ -11,7 +11,7 @@
|
||||
</view>
|
||||
|
||||
<block wx:if="{{activeTab === 'login'}}">
|
||||
<view class="wechat-login-panel">
|
||||
<view wx:if="{{!traditionalLoginExpanded}}" class="wechat-login-panel">
|
||||
<view class="wechat-login-copy">
|
||||
<text class="wechat-login-title">微信手机号一键登录</text>
|
||||
<text class="wechat-login-desc">更快登录</text>
|
||||
@@ -213,7 +213,7 @@
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{activeTab === 'login' && traditionalLoginExpanded && !allowLoginShopless && loginShops.length}}" class="field-block">
|
||||
<view wx:if="{{activeTab === 'login' && traditionalLoginExpanded && loginShops.length}}" class="field-block">
|
||||
<text class="field-label">选择登录门店</text>
|
||||
<picker mode="selector" range="{{loginShops}}" range-key="shopName" value="{{loginShopIndex}}" bindchange="handleLoginShopChange">
|
||||
<view class="field-picker">{{loginShopDisplayName || '请选择登录门店'}}</view>
|
||||
@@ -306,7 +306,7 @@
|
||||
|
||||
<view wx:if="{{keyboardVisible}}" class="keyboard-spacer" style="height: {{keyboardInsetRpx}}rpx;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view wx:if="{{showMiniShopSelector}}" class="mini-shop-mask" catchtouchmove="noop">
|
||||
<view class="page-card mini-shop-modal">
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
.auth-page-root {
|
||||
min-height: 100vh;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.auth-scroll {
|
||||
min-height: 100%;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.auth-page-shell {
|
||||
@@ -11,18 +13,16 @@
|
||||
}
|
||||
|
||||
.auth-page {
|
||||
background:
|
||||
radial-gradient(circle at top right, rgba(255, 204, 219, 0.32), transparent 30%),
|
||||
linear-gradient(180deg, #fff8fa 0%, #fffdfc 100%);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.auth-content {
|
||||
min-height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 24rpx 24rpx 40rpx;
|
||||
padding: 24rpx 24rpx calc(80rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.auth-content.keyboard-active {
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
.auth-panel {
|
||||
margin-top: 0;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.reset-card {
|
||||
@@ -62,7 +62,7 @@
|
||||
margin-bottom: 14rpx;
|
||||
padding: 10rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #faf4f6;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.tab-item,
|
||||
@@ -80,16 +80,16 @@
|
||||
|
||||
.tab-item.active,
|
||||
.toggle-item.active {
|
||||
background: #fde8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.wechat-login-panel {
|
||||
padding: 24rpx 22rpx;
|
||||
border-radius: 28rpx;
|
||||
background: linear-gradient(145deg, #f3fff8 0%, #e4fff0 52%, #d5fae6 100%);
|
||||
border: 1rpx solid rgba(121, 214, 152, 0.46);
|
||||
box-shadow: 0 18rpx 38rpx rgba(45, 175, 93, 0.12);
|
||||
background: var(--theme-gradient-soft);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
box-shadow: 0 18rpx 38rpx rgba(122, 67, 88, 0.1);
|
||||
}
|
||||
|
||||
.wechat-login-copy {
|
||||
@@ -117,13 +117,13 @@
|
||||
}
|
||||
|
||||
.wechat-login-btn.primary-btn {
|
||||
background: linear-gradient(135deg, #32d16d 0%, #13a847 100%);
|
||||
box-shadow: 0 16rpx 36rpx rgba(19, 168, 71, 0.24);
|
||||
background: var(--theme-gradient);
|
||||
box-shadow: 0 16rpx 36rpx rgba(122, 67, 88, 0.16);
|
||||
}
|
||||
|
||||
.wechat-login-btn-disabled {
|
||||
color: #5d8f69;
|
||||
border-color: rgba(121, 214, 152, 0.42);
|
||||
color: var(--theme-accent);
|
||||
border-color: var(--theme-border);
|
||||
background: rgba(255, 255, 255, 0.82);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
margin-top: 14rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: #58806a;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.mini-login-resume {
|
||||
@@ -207,8 +207,8 @@
|
||||
height: 92rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fde8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -226,7 +226,7 @@
|
||||
|
||||
.aux-link {
|
||||
font-size: 24rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@
|
||||
}
|
||||
|
||||
.agreement-check.checked {
|
||||
border-color: #c6597d;
|
||||
background: #c6597d;
|
||||
border-color: var(--theme-primary);
|
||||
background: var(--theme-primary);
|
||||
}
|
||||
|
||||
.agreement-copy {
|
||||
@@ -278,7 +278,7 @@
|
||||
}
|
||||
|
||||
.agreement-link {
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
margin-top: 22rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #fff7f8;
|
||||
background: var(--theme-primary-soft);
|
||||
color: #5a4a52;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.85;
|
||||
@@ -366,7 +366,7 @@
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.mini-shop-title {
|
||||
|
||||
@@ -3,6 +3,7 @@ const couponApi = require('../../api/coupon')
|
||||
const orderApi = require('../../api/order')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
const { resolveLegacyImage } = require('../../utils/file')
|
||||
const { NO_COUPON_KEY } = require('../../utils/config')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
@@ -113,7 +114,7 @@ function buildCheckoutIssues(items) {
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
isLoggedIn: false,
|
||||
loading: false,
|
||||
minDate: getMinDateText(),
|
||||
@@ -128,7 +129,7 @@ Page({
|
||||
totalAmountText: '¥0.00',
|
||||
checkoutIssues: [],
|
||||
submittingOrder: false
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="购物车" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<navigation-bar title="购物车" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="page-shell cart-page">
|
||||
<view class="page-shell cart-page" style="{{themeVars}}">
|
||||
<view class="page-content cart-content">
|
||||
<view wx:if="{{!isLoggedIn}}" class="page-card empty-card">
|
||||
<text class="empty-title">登录后查看购物车</text>
|
||||
@@ -97,14 +97,14 @@
|
||||
|
||||
<radio-group bindchange="handleCouponChange">
|
||||
<label class="coupon-option">
|
||||
<radio value="NONE" checked="{{selectedCouponKey === 'NONE'}}" color="#c6597d"></radio>
|
||||
<radio value="NONE" checked="{{selectedCouponKey === 'NONE'}}" color="{{navThemeColor || '#C6597D'}}"></radio>
|
||||
<view class="coupon-texts">
|
||||
<view class="coupon-name">不使用优惠</view>
|
||||
</view>
|
||||
</label>
|
||||
|
||||
<label wx:for="{{availableCoupons}}" wx:key="key" wx:for-item="coupon" class="coupon-option {{selectedCouponKey === coupon.key ? 'active' : ''}}">
|
||||
<radio value="{{coupon.key}}" checked="{{selectedCouponKey === coupon.key}}" color="#c6597d"></radio>
|
||||
<radio value="{{coupon.key}}" checked="{{selectedCouponKey === coupon.key}}" color="{{navThemeColor || '#C6597D'}}"></radio>
|
||||
<view class="coupon-texts">
|
||||
<view class="coupon-name">{{coupon.displayText}}</view>
|
||||
<view class="coupon-desc">{{coupon.sourceType === 'SYSTEM_VIP' ? 'VIP 自动折扣' : '用户优惠券'}}</view>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.cart-page {
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 150rpx);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.cart-content {
|
||||
@@ -7,9 +8,7 @@
|
||||
}
|
||||
|
||||
.cart-hero {
|
||||
background:
|
||||
radial-gradient(circle at top right, rgba(255, 192, 210, 0.42), transparent 34%),
|
||||
linear-gradient(145deg, #fffdfd 0%, #fff2f6 56%, #ffe7ef 100%);
|
||||
background: var(--theme-gradient-soft);
|
||||
}
|
||||
|
||||
.issue-card {
|
||||
@@ -17,8 +16,8 @@
|
||||
margin-bottom: 20rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fff7e8;
|
||||
color: #9b6900;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.issue-title {
|
||||
@@ -57,15 +56,15 @@
|
||||
}
|
||||
|
||||
.select-dot.active {
|
||||
border-color: #c6597d;
|
||||
background: #c6597d;
|
||||
border-color: var(--theme-primary);
|
||||
background: var(--theme-primary);
|
||||
}
|
||||
|
||||
.cart-thumb {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #f6edf1;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.cart-main {
|
||||
@@ -91,7 +90,7 @@
|
||||
.cart-price {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.cart-meta-row {
|
||||
@@ -109,8 +108,8 @@
|
||||
height: 42rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff1f5;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -131,7 +130,7 @@
|
||||
min-height: 76rpx;
|
||||
padding: 0 22rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #fbf5f7;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.selector-row.compact {
|
||||
@@ -139,7 +138,7 @@
|
||||
}
|
||||
|
||||
.selector-row.issue {
|
||||
background: #fff7e8;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.selector-label {
|
||||
@@ -189,8 +188,8 @@
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 50%;
|
||||
background: #fbf5f7;
|
||||
color: #7a5262;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
@@ -204,7 +203,7 @@
|
||||
|
||||
.remove-btn {
|
||||
font-size: 24rpx;
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -228,7 +227,7 @@
|
||||
}
|
||||
|
||||
.coupon-option.active {
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.coupon-texts {
|
||||
@@ -255,8 +254,8 @@
|
||||
height: 44rpx;
|
||||
padding: 0 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff1f5;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -302,7 +301,7 @@
|
||||
.checkout-total {
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.checkout-meta {
|
||||
@@ -319,7 +318,7 @@
|
||||
height: 84rpx;
|
||||
padding: 0 26rpx;
|
||||
border-radius: 999rpx;
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const couponApi = require('../../api/coupon')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
|
||||
function getBenefitText(coupon) {
|
||||
if (Number(coupon.couponType) === 1) {
|
||||
@@ -14,7 +15,7 @@ function getBenefitText(coupon) {
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
loading: false,
|
||||
isLoggedIn: false,
|
||||
coupons: [],
|
||||
@@ -26,7 +27,7 @@ Page({
|
||||
{ value: 'used', label: '已使用' },
|
||||
{ value: 'expired', label: '已过期' }
|
||||
]
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="我的优惠券" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<navigation-bar title="我的优惠券" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="page-shell coupons-page">
|
||||
<view class="page-shell coupons-page" style="{{themeVars}}">
|
||||
<view class="page-content">
|
||||
<view wx:if="{{!isLoggedIn}}" class="page-card empty-card">
|
||||
<text class="empty-title">登录后查看优惠券</text>
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
height: 60rpx;
|
||||
padding: 0 24rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(255, 255, 255, 0.78);
|
||||
background: var(--theme-card-bg);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
color: #8d7a84;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.coupon-filter-chip.active {
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
border-color: transparent;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
@@ -34,7 +36,7 @@
|
||||
|
||||
.coupon-card {
|
||||
padding: 26rpx 28rpx;
|
||||
background: linear-gradient(135deg, #fff8fa 0%, #fff1f5 100%);
|
||||
background: var(--theme-gradient-soft);
|
||||
}
|
||||
|
||||
.coupon-top {
|
||||
@@ -65,7 +67,7 @@
|
||||
padding: 0 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -74,7 +76,7 @@
|
||||
margin-top: 26rpx;
|
||||
font-size: 42rpx;
|
||||
font-weight: 800;
|
||||
color: #d5536f;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.coupon-period {
|
||||
|
||||
@@ -15,6 +15,7 @@ const {
|
||||
const productApi = require('../../api/product')
|
||||
const shopApi = require('../../api/shop')
|
||||
const userApi = require('../../api/user')
|
||||
const theme = require('../../utils/theme')
|
||||
|
||||
/**
|
||||
* home page logic.
|
||||
@@ -23,7 +24,7 @@ const userApi = require('../../api/user')
|
||||
Page({
|
||||
data: Object.assign(createKeyboardSafeData({
|
||||
cursorSpacing: 96
|
||||
}), {
|
||||
}), theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
initialized: false,
|
||||
loading: false,
|
||||
loadingMore: false,
|
||||
@@ -146,7 +147,8 @@ Page({
|
||||
greeting: isLoggedIn ? '欢迎回来' : '游客模式',
|
||||
displayName: isLoggedIn
|
||||
? ((userInfo && userInfo.nickname) || 'Yumi 用户')
|
||||
: '先逛逛喜欢的款式和门店'
|
||||
: '先逛逛喜欢的款式和门店',
|
||||
bannerImages: isLoggedIn ? [] : this.data.bannerImages
|
||||
})
|
||||
},
|
||||
|
||||
@@ -187,10 +189,11 @@ Page({
|
||||
this.syncUserState()
|
||||
|
||||
try {
|
||||
const loggedIn = auth.isLoggedIn()
|
||||
await Promise.all([
|
||||
this.loadUserProfile(),
|
||||
this.loadAnnouncements(),
|
||||
this.loadBannerImages(requestId),
|
||||
loggedIn ? Promise.resolve() : this.loadBannerImages(requestId),
|
||||
this.loadFeaturedProducts(requestId),
|
||||
this.loadPopularProducts(true, requestId)
|
||||
])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<view class="home-page-root">
|
||||
<navigation-bar title="{{navTitle}}" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<view class="home-page-root" style="{{themeVars}}">
|
||||
<navigation-bar title="{{navTitle}}" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="home-scroll">
|
||||
<view class="page-shell home-page {{keyboardVisible ? 'keyboard-active' : ''}}">
|
||||
@@ -39,7 +39,7 @@
|
||||
</swiper>
|
||||
|
||||
<view class="summary-strip">
|
||||
<view class="summary-metric">
|
||||
<view wx:if="{{!isLoggedIn}}" class="summary-metric">
|
||||
<text class="summary-label">门店橱窗</text>
|
||||
<text class="summary-value">{{bannerImages.length ? bannerImages.length : 0}} 家</text>
|
||||
<text class="summary-note">看环境</text>
|
||||
@@ -61,7 +61,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-block">
|
||||
<view wx:if="{{!isLoggedIn}}" class="section-block">
|
||||
<view class="section-head">
|
||||
<view class="section-copy">
|
||||
<text class="section-kicker">门店氛围</text>
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
.home-page {
|
||||
min-height: 100%;
|
||||
background:
|
||||
radial-gradient(circle at top right, rgba(255, 196, 214, 0.4), transparent 36%),
|
||||
linear-gradient(180deg, #fff7f8 0%, #fffdfb 100%);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.home-page.keyboard-active {
|
||||
@@ -18,9 +16,7 @@
|
||||
}
|
||||
|
||||
.home-hero {
|
||||
background:
|
||||
radial-gradient(circle at top right, rgba(255, 186, 207, 0.5), transparent 36%),
|
||||
linear-gradient(145deg, #fffdfd 0%, #fff2f6 52%, #ffe8ef 100%);
|
||||
background: var(--theme-gradient-soft);
|
||||
}
|
||||
|
||||
.search-box {
|
||||
@@ -48,7 +44,7 @@
|
||||
min-width: 150rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 999rpx;
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
color: #ffffff;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
@@ -98,8 +94,8 @@
|
||||
height: 58rpx;
|
||||
margin-top: 18rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #fff7ed;
|
||||
border: 1rpx solid #fed7aa;
|
||||
background: var(--theme-primary-soft);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -108,7 +104,7 @@
|
||||
line-height: 58rpx;
|
||||
padding: 0 22rpx;
|
||||
font-size: 24rpx;
|
||||
color: #7c2d12;
|
||||
color: var(--theme-accent);
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
@@ -120,8 +116,8 @@
|
||||
justify-content: center;
|
||||
padding: 8rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fce8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ const orderApi = require('../../api/order')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
const theme = require('../../utils/theme')
|
||||
const { resolveLegacyImage } = require('../../utils/file')
|
||||
const { formatDateTime, formatPrice, getOrderStatusClass, getOrderStatusText } = require('../../utils/format')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
@@ -11,11 +12,11 @@ const { runWithLoading } = require('../../utils/loading')
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
loading: false,
|
||||
isLoggedIn: false,
|
||||
orders: []
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="我的订单" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<navigation-bar title="我的订单" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="page-shell orders-page">
|
||||
<view class="page-shell orders-page" style="{{themeVars}}">
|
||||
<view class="page-content">
|
||||
<view wx:if="{{!isLoggedIn}}" class="page-card empty-card">
|
||||
<text class="empty-title">登录后查看订单</text>
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
.order-head {
|
||||
padding-bottom: 18rpx;
|
||||
border-bottom: 2rpx solid #f3e7eb;
|
||||
border-bottom: 2rpx solid var(--theme-border);
|
||||
}
|
||||
|
||||
.order-shop {
|
||||
margin: 14rpx 0 0;
|
||||
color: #8f6e7a;
|
||||
color: #8d7a84;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
@@ -62,18 +62,18 @@
|
||||
}
|
||||
|
||||
.order-status.pending {
|
||||
background: #fff6e8;
|
||||
color: #cb7b00;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.order-status.completed {
|
||||
background: #ecfbf3;
|
||||
color: #2ea36f;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.order-status.cancelled {
|
||||
background: #fff1f5;
|
||||
color: #d5536f;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.order-item {
|
||||
@@ -86,7 +86,7 @@
|
||||
width: 132rpx;
|
||||
height: 132rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #f6edf1;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.order-main {
|
||||
@@ -126,8 +126,8 @@
|
||||
height: 60rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff1f5;
|
||||
color: #d5536f;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ const wishlistApi = require('../../api/wishlist')
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const { resolveImageList } = require('../../utils/file')
|
||||
const theme = require('../../utils/theme')
|
||||
const { getSignedUrl, resolveImageList } = require('../../utils/file')
|
||||
const { DEFAULT_PRODUCT_IMAGE } = require('../../utils/config')
|
||||
const { formatPrice, getProductTitle, splitCsv } = require('../../utils/format')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
@@ -83,7 +84,7 @@ function estimateEarliestBookable(businessHours) {
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
loading: true,
|
||||
loadError: '',
|
||||
productId: '',
|
||||
@@ -97,7 +98,7 @@ Page({
|
||||
isLiked: false,
|
||||
artistCountText: '门店安排',
|
||||
earliestBookableText: '以门店安排为准'
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onLoad` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
@@ -139,6 +140,18 @@ Page({
|
||||
const product = await productApi.getProductById(productId)
|
||||
const productImages = await resolveImageList(product.imageFileIds, DEFAULT_PRODUCT_IMAGE)
|
||||
const shopInfo = product.shopId ? await shopApi.getShopById(product.shopId) : null
|
||||
if (shopInfo) {
|
||||
const shopTheme = theme.resolveShopTheme(shopInfo)
|
||||
this.setData(theme.pageThemeData(shopTheme))
|
||||
if (shopTheme.backgroundImageFileId) {
|
||||
try {
|
||||
const backgroundImageUrl = await getSignedUrl(shopTheme.backgroundImageFileId)
|
||||
if (backgroundImageUrl) {
|
||||
this.setData(theme.pageThemeData(shopTheme, backgroundImageUrl))
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
const artistCount = typeof product.availableBookableArtistCount === 'number'
|
||||
? product.availableBookableArtistCount
|
||||
: splitCsv(product.bookableArtists).length
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="{{product ? product.displayTitle : '作品详情'}}" showBack="{{true}}" fallbackPath="/pages/products/index" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<navigation-bar title="{{product ? product.displayTitle : '作品详情'}}" showBack="{{true}}" fallbackPath="/pages/products/index" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="page-shell detail-page">
|
||||
<view class="page-shell detail-page" style="{{themeVars}}">
|
||||
<view wx:if="{{loadError}}" class="page-content">
|
||||
<view class="page-card empty-card">
|
||||
<text class="empty-title">暂时无法查看作品详情</text>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
.detail-page {
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 160rpx);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.media-box {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 0 0 40rpx 40rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.media-swiper,
|
||||
@@ -51,7 +53,7 @@
|
||||
margin-top: 12rpx;
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.product-brief {
|
||||
@@ -74,7 +76,7 @@
|
||||
margin-top: 28rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: linear-gradient(135deg, #fff8fa 0%, #fff1f5 100%);
|
||||
background: var(--theme-gradient-soft);
|
||||
}
|
||||
|
||||
.shop-box-head {
|
||||
@@ -92,7 +94,7 @@
|
||||
|
||||
.shop-link {
|
||||
font-size: 24rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -117,15 +119,15 @@
|
||||
height: 68rpx;
|
||||
padding: 0 24rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fbf5f7;
|
||||
color: #7a5262;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.action-pill.active {
|
||||
background: #fde8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.tags-wrap {
|
||||
@@ -141,8 +143,8 @@
|
||||
justify-content: center;
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fbecf1;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
@@ -181,7 +183,7 @@
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #fff8fa;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.comment-input {
|
||||
@@ -201,7 +203,7 @@
|
||||
.comment-submit,
|
||||
.comment-reply-btn {
|
||||
font-size: 24rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -212,7 +214,7 @@
|
||||
text-align: center;
|
||||
border-radius: 999rpx;
|
||||
color: #ffffff;
|
||||
background: #c6597d;
|
||||
background: var(--theme-primary);
|
||||
}
|
||||
|
||||
.comment-empty {
|
||||
@@ -252,7 +254,7 @@
|
||||
margin-top: 14rpx;
|
||||
padding: 16rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #faf4f6;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.reply-item {
|
||||
@@ -293,11 +295,11 @@
|
||||
}
|
||||
|
||||
.footer-btn.secondary {
|
||||
background: #fbf5f7;
|
||||
color: #7a5262;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.footer-btn.primary {
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ const cartApi = require('../../api/cart')
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
const { buildProductCards } = require('../../utils/product')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
const { CACHE_TTL } = require('../../utils/config')
|
||||
const {
|
||||
@@ -28,7 +29,7 @@ const CART_BUSY_MESSAGE = '\u8d2d\u7269\u8f66\u5904\u7406\u4e2d\uff0c\u8bf7\u52f
|
||||
Page({
|
||||
data: Object.assign(createKeyboardSafeData({
|
||||
cursorSpacing: 96
|
||||
}), {
|
||||
}), theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
initialized: false,
|
||||
loading: false,
|
||||
loadingMore: false,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="作品库" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<navigation-bar title="作品库" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="page-shell product-page {{keyboardVisible ? 'keyboard-active' : ''}}">
|
||||
<view class="page-shell product-page {{keyboardVisible ? 'keyboard-active' : ''}}" style="{{themeVars}}">
|
||||
<view class="page-content product-page-content" style="{{keyboardVisible ? 'padding-bottom: ' + keyboardInsetRpx + 'rpx;' : ''}}">
|
||||
<view class="sticky-filter-bar">
|
||||
<view class="filter-surface">
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
.product-page {
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(255, 207, 220, 0.35), transparent 34%),
|
||||
linear-gradient(180deg, #fff8fa 0%, #fffdfc 100%);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.product-page-content {
|
||||
@@ -13,15 +11,14 @@
|
||||
top: 0;
|
||||
z-index: 12;
|
||||
padding: 6rpx 0 16rpx;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 248, 250, 0.98) 0%, rgba(255, 252, 251, 0.94) 76%, rgba(255, 252, 251, 0) 100%);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.filter-surface {
|
||||
padding: 16rpx 16rpx 14rpx;
|
||||
border-radius: 24rpx;
|
||||
border: 1rpx solid rgba(239, 216, 224, 0.86);
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
background: var(--theme-card-bg);
|
||||
box-shadow: 0 18rpx 40rpx rgba(122, 67, 88, 0.08);
|
||||
}
|
||||
|
||||
@@ -36,7 +33,7 @@
|
||||
height: 68rpx;
|
||||
padding: 0 22rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fbf5f7;
|
||||
background: var(--theme-primary-soft);
|
||||
color: #2d2430;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
@@ -49,7 +46,7 @@
|
||||
height: 68rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 999rpx;
|
||||
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
|
||||
background: var(--theme-gradient);
|
||||
color: #ffffff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
@@ -80,15 +77,15 @@
|
||||
height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f7edf1;
|
||||
background: var(--theme-primary-soft);
|
||||
color: #8d7a84;
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.category-item.active {
|
||||
background: #fde8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.results-head {
|
||||
@@ -121,8 +118,8 @@
|
||||
height: 46rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fdeff4;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -6,6 +6,7 @@ const wishlistApi = require('../../api/wishlist')
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
const { DEFAULT_AVATAR } = require('../../utils/config')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
|
||||
@@ -14,7 +15,7 @@ const { runWithLoading } = require('../../utils/loading')
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
isLoggedIn: false,
|
||||
loading: false,
|
||||
needSetPassword: false,
|
||||
@@ -24,7 +25,7 @@ Page({
|
||||
wishlistCount: 0,
|
||||
unreadMessageCount: 0,
|
||||
defaultAvatar: DEFAULT_AVATAR
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<view class="profile-page-root">
|
||||
<view class="profile-page-root" style="{{themeVars}}">
|
||||
<navigation-bar title="个人中心" showBack="{{false}}" isTabPage="{{true}}" color="#ffffff" background="transparent" safeAreaMode="overlay"></navigation-bar>
|
||||
<view class="profile-bg"></view>
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
.profile-page-root {
|
||||
min-height: 100vh;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.profile-scroll {
|
||||
min-height: 100%;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.profile-page {
|
||||
min-height: 100%;
|
||||
background: linear-gradient(180deg, #d66c90 0%, #fff8fa 220rpx, #fffdfc 100%);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.profile-bg {
|
||||
@@ -17,7 +19,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 228rpx;
|
||||
background: linear-gradient(135deg, #d66c90 0%, #9a4f6d 100%);
|
||||
background: var(--theme-gradient);
|
||||
}
|
||||
|
||||
.profile-content {
|
||||
@@ -67,7 +69,7 @@
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
background: #f7edf1;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.profile-copy {
|
||||
@@ -100,7 +102,7 @@
|
||||
margin-top: 26rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fff1f5;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.shop-label {
|
||||
@@ -117,7 +119,7 @@
|
||||
|
||||
.shop-link {
|
||||
font-size: 24rpx;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -125,8 +127,8 @@
|
||||
margin-top: 22rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #fff7e8;
|
||||
color: #9b6900;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
@@ -167,7 +169,7 @@
|
||||
height: 36rpx;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #ff5c8a;
|
||||
background: var(--theme-primary);
|
||||
color: #ffffff;
|
||||
font-size: 22rpx;
|
||||
line-height: 36rpx;
|
||||
@@ -179,7 +181,7 @@
|
||||
}
|
||||
|
||||
.logout-item {
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ const authApi = require('../../api/auth')
|
||||
const userApi = require('../../api/user')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
const { DEFAULT_AVATAR } = require('../../utils/config')
|
||||
const { getDraftValue, clearDraft, scheduleDraftSave, clearDraftTimer } = require('../../utils/form-draft')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
@@ -23,7 +24,7 @@ const SETTINGS_DRAFT_KEY = 'user-settings'
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: Object.assign(createKeyboardSafeData({
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), createKeyboardSafeData({
|
||||
cursorSpacing: 108
|
||||
}), {
|
||||
isLoggedIn: false,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<view class="settings-page-root">
|
||||
<navigation-bar title="设置中心" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<view class="settings-page-root" style="{{themeVars}}">
|
||||
<navigation-bar title="设置中心" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="settings-scroll">
|
||||
<view class="page-shell settings-page-shell {{keyboardVisible ? 'keyboard-active' : ''}}">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.settings-page-root {
|
||||
min-height: 100vh;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.settings-scroll {
|
||||
@@ -8,6 +9,7 @@
|
||||
|
||||
.settings-page-shell {
|
||||
min-height: 100%;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.settings-page-shell.keyboard-active {
|
||||
@@ -37,7 +39,7 @@
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 50%;
|
||||
background: #f7edf1;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.profile-preview-copy {
|
||||
@@ -75,7 +77,7 @@
|
||||
.text-action {
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.field-block {
|
||||
@@ -100,7 +102,7 @@
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
padding: 24rpx 0;
|
||||
border-bottom: 1rpx solid rgba(239, 216, 224, 0.92);
|
||||
border-bottom: 1rpx solid var(--theme-border);
|
||||
}
|
||||
|
||||
.setting-row:first-of-type {
|
||||
@@ -134,14 +136,14 @@
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
color: #c6597d;
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
|
||||
.security-panel {
|
||||
margin-top: 6rpx;
|
||||
padding: 26rpx 24rpx;
|
||||
border-radius: 28rpx;
|
||||
background: #fff7f8;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.field-static {
|
||||
@@ -150,7 +152,8 @@
|
||||
min-height: 92rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #f5edf0;
|
||||
background: var(--theme-card-bg);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
color: #5d4b55;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
@@ -173,14 +176,14 @@
|
||||
height: 92rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fde8ef;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.code-btn.disabled {
|
||||
background: #f3e7eb;
|
||||
background: var(--theme-card-bg);
|
||||
color: #a998a0;
|
||||
}
|
||||
|
||||
@@ -199,7 +202,7 @@
|
||||
}
|
||||
|
||||
.danger-text {
|
||||
color: #d5536f;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
@@ -209,8 +212,8 @@
|
||||
height: 92rpx;
|
||||
margin-top: 24rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff1f5;
|
||||
color: #d5536f;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const shopApi = require('../../api/shop')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const { resolveImageList } = require('../../utils/file')
|
||||
const theme = require('../../utils/theme')
|
||||
const { getSignedUrl, resolveImageList } = require('../../utils/file')
|
||||
const { DEFAULT_SHOP_IMAGE } = require('../../utils/config')
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ const { DEFAULT_SHOP_IMAGE } = require('../../utils/config')
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
loading: true,
|
||||
loadError: '',
|
||||
shopId: '',
|
||||
@@ -16,7 +17,7 @@ Page({
|
||||
shopInfo: null,
|
||||
distanceText: '',
|
||||
shopImages: []
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onLoad` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
@@ -56,6 +57,16 @@ Page({
|
||||
try {
|
||||
const shopInfo = await shopApi.getShopById(this.data.shopId)
|
||||
const shopImages = await resolveImageList(shopInfo.imageFileIds || shopInfo.coverImageFileId, DEFAULT_SHOP_IMAGE)
|
||||
const shopTheme = theme.resolveShopTheme(shopInfo)
|
||||
this.setData(theme.pageThemeData(shopTheme))
|
||||
if (shopTheme.backgroundImageFileId) {
|
||||
try {
|
||||
const backgroundImageUrl = await getSignedUrl(shopTheme.backgroundImageFileId)
|
||||
if (backgroundImageUrl) {
|
||||
this.setData(theme.pageThemeData(shopTheme, backgroundImageUrl))
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
this.setData({
|
||||
shopInfo,
|
||||
shopImages,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="{{shopInfo ? shopInfo.shopName : '门店详情'}}" showBack="{{true}}" fallbackPath="{{returnTo || '/pages/home/index'}}" color="#ffffff" background="transparent" safeAreaMode="overlay"></navigation-bar>
|
||||
|
||||
<view class="page-shell shop-page">
|
||||
<view class="page-shell shop-page" style="{{themeVars}}">
|
||||
<view class="shop-hero">
|
||||
<image wx:if="{{shopImages.length}}" class="shop-hero-image" src="{{shopImages[0]}}" mode="aspectFill" lazy-load="{{true}}"></image>
|
||||
<view class="shop-hero-mask"></view>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.shop-page {
|
||||
background: linear-gradient(180deg, #f4dbe3 0%, #fff8fa 220rpx, #fffdfc 100%);
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.shop-hero {
|
||||
@@ -8,7 +8,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 320rpx;
|
||||
background: linear-gradient(135deg, #c6597d 0%, #8d4763 100%);
|
||||
background: var(--theme-gradient);
|
||||
}
|
||||
|
||||
.shop-hero-image {
|
||||
@@ -79,19 +79,22 @@
|
||||
}
|
||||
|
||||
.copy-row {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.map-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.copy-row .ghost-btn,
|
||||
.map-btn {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -105,5 +108,5 @@
|
||||
width: calc(50% - 9rpx);
|
||||
height: 240rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #f6edf1;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ const cartApi = require('../../api/cart')
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
const auth = require('../../utils/auth')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
const { buildProductCard } = require('../../utils/product')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
|
||||
@@ -11,11 +12,11 @@ const { runWithLoading } = require('../../utils/loading')
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
loading: false,
|
||||
isLoggedIn: false,
|
||||
wishlist: []
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<navigation-bar title="我的收藏" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="#fff7f8"></navigation-bar>
|
||||
<navigation-bar title="我的收藏" showBack="{{true}}" fallbackPath="/pages/profile/index" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
|
||||
|
||||
<view class="page-shell wishlist-page">
|
||||
<view class="page-shell wishlist-page" style="{{themeVars}}">
|
||||
<view class="page-content">
|
||||
<view wx:if="{{!isLoggedIn}}" class="page-card empty-card">
|
||||
<text class="empty-title">登录后查看收藏</text>
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
height: 74rpx;
|
||||
flex: 1;
|
||||
border-radius: 20rpx;
|
||||
background: #fff1f5;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wishlist-action--secondary {
|
||||
background: #fff1f5;
|
||||
color: #c6597d;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,11 @@ async function refreshToken() {
|
||||
}
|
||||
|
||||
async function handleUnauthorized(options) {
|
||||
if (options._retry || isWhitelistedPath(options.url)) {
|
||||
if (isWhitelistedPath(options.url)) {
|
||||
throw normalizeError('\u8bf7\u6c42\u9700\u8981\u767b\u5f55\uff0c\u4f46\u5f53\u524d\u9875\u9762\u5141\u8bb8\u533f\u540d\u67e5\u770b', 401)
|
||||
}
|
||||
|
||||
if (options._retry) {
|
||||
auth.clearSession()
|
||||
const app = getApp()
|
||||
if (app && typeof app.clearUserSession === 'function') {
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
const HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/
|
||||
|
||||
function normalizeHexColor(value) {
|
||||
if (!value || typeof value !== 'string') {
|
||||
return ''
|
||||
}
|
||||
const normalized = value.trim()
|
||||
return HEX_COLOR_PATTERN.test(normalized) ? normalized.toUpperCase() : ''
|
||||
}
|
||||
|
||||
function hexToRgb(color) {
|
||||
const value = color.replace('#', '')
|
||||
return {
|
||||
r: parseInt(value.slice(0, 2), 16),
|
||||
g: parseInt(value.slice(2, 4), 16),
|
||||
b: parseInt(value.slice(4, 6), 16)
|
||||
}
|
||||
}
|
||||
|
||||
function toHex(value) {
|
||||
return Math.min(255, Math.max(0, value)).toString(16).padStart(2, '0').toUpperCase()
|
||||
}
|
||||
|
||||
function rgbToHex(rgb) {
|
||||
return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`
|
||||
}
|
||||
|
||||
function mixColor(foreground, background, backgroundWeight) {
|
||||
const fg = hexToRgb(foreground)
|
||||
const bg = hexToRgb(background)
|
||||
const weight = Math.min(1, Math.max(0, backgroundWeight))
|
||||
return rgbToHex({
|
||||
r: Math.round(fg.r * (1 - weight) + bg.r * weight),
|
||||
g: Math.round(fg.g * (1 - weight) + bg.g * weight),
|
||||
b: Math.round(fg.b * (1 - weight) + bg.b * weight)
|
||||
})
|
||||
}
|
||||
|
||||
function buildStyleVars(theme) {
|
||||
const styleVars = [
|
||||
`--theme-primary: ${theme.primaryColor};`,
|
||||
`--theme-secondary: ${theme.secondaryColor};`,
|
||||
`--theme-accent: ${theme.accentColor};`,
|
||||
`--theme-page-bg: ${theme.pageBgColor};`,
|
||||
`--theme-card-bg: ${theme.cardBgColor};`,
|
||||
`--theme-border: ${theme.borderColor};`,
|
||||
`--theme-primary-soft: ${theme.primarySoftColor};`,
|
||||
`--theme-gradient: ${theme.gradient};`,
|
||||
`--theme-gradient-soft: ${theme.softGradient};`
|
||||
]
|
||||
if (theme.backgroundImageUrl) {
|
||||
styleVars.push(
|
||||
`background-image: url("${theme.backgroundImageUrl}");`,
|
||||
'background-size: cover;',
|
||||
'background-position: center top;'
|
||||
)
|
||||
}
|
||||
return styleVars.join(' ')
|
||||
}
|
||||
|
||||
function resolveShopTheme(source) {
|
||||
const themeSource = source || {}
|
||||
const normalizedPrimaryColor = normalizeHexColor(themeSource.themePrimaryColor)
|
||||
const primaryColor = normalizedPrimaryColor || DEFAULT_SHOP_THEME.primaryColor
|
||||
const secondaryColor = normalizeHexColor(themeSource.themeSecondaryColor)
|
||||
|| (normalizedPrimaryColor ? mixColor(primaryColor, '#FFFFFF', 0.68) : DEFAULT_SHOP_THEME.secondaryColor)
|
||||
const accentColor = normalizeHexColor(themeSource.themeAccentColor)
|
||||
|| (normalizedPrimaryColor ? mixColor(primaryColor, '#7A3F56', 0.38) : DEFAULT_SHOP_THEME.accentColor)
|
||||
const pageBgColor = normalizeHexColor(themeSource.themePageBgColor) || DEFAULT_SHOP_THEME.pageBgColor
|
||||
const cardBgColor = normalizeHexColor(themeSource.themeCardBgColor) || DEFAULT_SHOP_THEME.cardBgColor
|
||||
const borderColor = mixColor(primaryColor, cardBgColor, 0.82)
|
||||
const primarySoftColor = mixColor(primaryColor, cardBgColor, 0.88)
|
||||
const gradient = `linear-gradient(135deg, ${primaryColor} 0%, ${secondaryColor} 100%)`
|
||||
const softGradient = `linear-gradient(145deg, ${cardBgColor} 0%, ${mixColor(secondaryColor, pageBgColor, 0.55)} 58%, ${mixColor(primaryColor, pageBgColor, 0.82)} 100%)`
|
||||
const backgroundImageFileId = themeSource.themeBackgroundImageFileId
|
||||
? String(themeSource.themeBackgroundImageFileId).trim()
|
||||
: ''
|
||||
const backgroundImageUrl = themeSource.themeBackgroundImageUrl
|
||||
? String(themeSource.themeBackgroundImageUrl).trim()
|
||||
: ''
|
||||
const theme = {
|
||||
primaryColor,
|
||||
secondaryColor,
|
||||
accentColor,
|
||||
pageBgColor,
|
||||
cardBgColor,
|
||||
borderColor,
|
||||
primarySoftColor,
|
||||
gradient,
|
||||
softGradient,
|
||||
backgroundImageFileId,
|
||||
backgroundImageUrl
|
||||
}
|
||||
theme.styleVars = buildStyleVars(theme)
|
||||
return theme
|
||||
}
|
||||
|
||||
const DEFAULT_SHOP_THEME = {
|
||||
primaryColor: '#C6597D',
|
||||
secondaryColor: '#E9B7C7',
|
||||
accentColor: '#9F4967',
|
||||
pageBgColor: '#FFF7F9',
|
||||
cardBgColor: '#FFFFFF',
|
||||
borderColor: '#EFD8E0',
|
||||
primarySoftColor: '#FBF1F4',
|
||||
gradient: 'linear-gradient(135deg, #C6597D 0%, #E9B7C7 100%)',
|
||||
softGradient: 'linear-gradient(145deg, #FFFFFF 0%, #FFF1F5 58%, #FFE8EF 100%)',
|
||||
backgroundImageFileId: '',
|
||||
backgroundImageUrl: ''
|
||||
}
|
||||
|
||||
DEFAULT_SHOP_THEME.styleVars = buildStyleVars(DEFAULT_SHOP_THEME)
|
||||
|
||||
function pageThemeData(theme, backgroundImageUrl) {
|
||||
const resolved = theme || DEFAULT_SHOP_THEME
|
||||
const themeData = backgroundImageUrl
|
||||
? {
|
||||
...resolved,
|
||||
backgroundImageUrl: String(backgroundImageUrl).trim()
|
||||
}
|
||||
: resolved
|
||||
if (backgroundImageUrl) {
|
||||
themeData.styleVars = buildStyleVars(themeData)
|
||||
}
|
||||
return {
|
||||
theme: themeData,
|
||||
themeVars: themeData.styleVars,
|
||||
navThemeColor: themeData.primaryColor,
|
||||
navThemeBackground: themeData.pageBgColor
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
DEFAULT_SHOP_THEME,
|
||||
resolveShopTheme,
|
||||
pageThemeData
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
const assert = require('assert')
|
||||
const theme = require('./theme')
|
||||
|
||||
const customized = theme.resolveShopTheme({
|
||||
themePrimaryColor: '#8b4f65',
|
||||
themeSecondaryColor: '#f2c9d4',
|
||||
themeAccentColor: '#b86f84',
|
||||
themePageBgColor: '#fff8fa',
|
||||
themeCardBgColor: '#ffffff',
|
||||
themeBackgroundImageFileId: 'bg-file'
|
||||
})
|
||||
|
||||
assert.strictEqual(customized.primaryColor, '#8B4F65')
|
||||
assert.strictEqual(customized.secondaryColor, '#F2C9D4')
|
||||
assert.strictEqual(customized.accentColor, '#B86F84')
|
||||
assert.strictEqual(customized.pageBgColor, '#FFF8FA')
|
||||
assert.strictEqual(customized.cardBgColor, '#FFFFFF')
|
||||
assert.strictEqual(customized.backgroundImageFileId, 'bg-file')
|
||||
assert.ok(customized.styleVars.includes('--theme-primary: #8B4F65;'))
|
||||
assert.ok(customized.styleVars.includes('--theme-gradient: linear-gradient(135deg, #8B4F65 0%, #F2C9D4 100%);'))
|
||||
|
||||
const themedPageData = theme.pageThemeData(customized, 'https://static.example.test/bg.jpg')
|
||||
assert.ok(themedPageData.themeVars.includes('background-image: url("https://static.example.test/bg.jpg");'))
|
||||
assert.strictEqual(themedPageData.theme.backgroundImageUrl, 'https://static.example.test/bg.jpg')
|
||||
|
||||
const fallback = theme.resolveShopTheme({
|
||||
themePrimaryColor: '#fff',
|
||||
themeSecondaryColor: 'blue'
|
||||
})
|
||||
|
||||
assert.strictEqual(fallback.primaryColor, theme.DEFAULT_SHOP_THEME.primaryColor)
|
||||
assert.strictEqual(fallback.secondaryColor, theme.DEFAULT_SHOP_THEME.secondaryColor)
|
||||
assert.ok(fallback.styleVars.includes('--theme-page-bg:'))
|
||||
Reference in New Issue
Block a user