feat: ui update

This commit is contained in:
2026-09-15 16:01:59 +08:00
parent 1a11816839
commit 26c392d612
89 changed files with 10377 additions and 4861 deletions
@@ -1,6 +1,7 @@
{
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar",
"empty-state": "/components/empty-state/empty-state"
"empty-state": "/components/empty-state/empty-state",
"v2-overlay": "/components/v2-overlay/index"
}
}
@@ -1,6 +1,7 @@
import { request, AUTH_EXPIRED_CODES } from '../../utils/request'
import { OutfitShareDetail, OutfitItem } from '../../types/models'
import { ShareStatus } from '../../utils/config'
import { navScroll } from '../../utils/nav'
import { logger } from '../../utils/logger'
// 日志模块名
@@ -10,14 +11,26 @@ Page({
data: {
uuid: '',
detail: null as OutfitShareDetail | null,
outfit: { items: [] } as OutfitItem,
outfit: { items: [] } as unknown as OutfitItem,
loading: true,
invalid: false,
invalidTitle: '该分享已取消',
invalidDesc: '分享链接已失效',
needLogin: false,
// 滚动收缩:由 utils/nav.ts 的共享 handler 驱动
navScrolled: false,
// 取消分享确认:v2 玻璃弹窗
cancelVisible: false,
cancelContent: '取消后该分享链接将失效',
cancelButtons: [
{ text: '再想想', value: '' },
{ text: '取消分享', value: 'ok', type: 'main' },
],
},
// scroll-view 滚动 → 导航收缩为玻璃小标题
onNavScroll: navScroll,
onLoad(query: Record<string, string>) {
const uuid = query.uuid || ''
logger.debug(LOG, 'onLoad, uuid=', uuid)
@@ -93,29 +106,29 @@ Page({
},
onCancel() {
wx.showModal({
title: '取消分享',
content: '取消后该分享链接将失效',
confirmText: '取消分享',
confirmColor: '#FF3B30',
success: (res) => {
if (!res.confirm) return
request({ url: `/outfit-share/${this.data.uuid}/cancel`, method: 'POST' })
.then(() => {
logger.info(LOG, '取消分享成功')
wx.showToast({ title: '已取消', icon: 'success' })
;(this as any).backTimer = setTimeout(
() =>
wx.navigateBack({
fail: (e: any) => logger.warn(LOG, 'navigateBack 失败, err=', e && e.errMsg),
}),
500,
)
})
.catch((e: any) => logger.warn(LOG, '取消分享失败, code=', e && e.code))
},
fail: (e: any) => logger.warn(LOG, '取消分享弹窗失败, err=', e && e.errMsg),
})
this.setData({ cancelVisible: true })
},
onCancelCancel() {
this.setData({ cancelVisible: false })
},
onCancelConfirm(e: WechatMiniprogram.CustomEvent) {
this.setData({ cancelVisible: false })
if (e.detail.value !== 'ok') return
request({ url: `/outfit-share/${this.data.uuid}/cancel`, method: 'POST' })
.then(() => {
logger.info(LOG, '取消分享成功')
wx.showToast({ title: '已取消', icon: 'success' })
;(this as any).backTimer = setTimeout(
() =>
wx.navigateBack({
fail: (err: any) => logger.warn(LOG, 'navigateBack 失败, err=', err && err.errMsg),
}),
500,
)
})
.catch((err: any) => logger.warn(LOG, '取消分享失败, code=', err && err.code))
},
onBackHome() {
@@ -1,5 +1,15 @@
<view class="page detail-page">
<navigation-bar title="穿搭分享" />
<wxs module="cl">
function cls(n) {
if (n >= 4) return ''
if (n === 3) return 'collage--3'
if (n === 2) return 'collage--2'
return 'collage--1'
}
module.exports = { cls: cls }
</wxs>
<view class="page page-flex">
<navigation-bar title="穿搭分享" scrolled="{{navScrolled}}" />
<empty-state
wx:if="{{invalid && needLogin}}"
@@ -19,69 +29,86 @@
bind:action="onBackHome"
/>
<scroll-view wx:else scroll-y class="scroll-body">
<!-- 分享者信息 -->
<view class="card owner-card">
<view class="avatar">
<image wx:if="{{detail.owner_avatar}}" class="avatar-img" src="{{detail.owner_avatar}}" mode="aspectFill" />
<view wx:else class="icon icon-user avatar-placeholder"></view>
<scroll-view wx:else scroll-y class="scroll-body pb-dock" bindscroll="onNavScroll">
<!-- 分享者行 -->
<view class="head">
<view class="eyebrow">Shared Look</view>
<view class="display">{{outfit.outfit_name}}</view>
</view>
<view class="osd-owner">
<view class="osd-av">
<image wx:if="{{detail.owner_avatar}}" class="pic" src="{{detail.owner_avatar}}" mode="aspectFill" />
<view wx:else class="icon icon-user"></view>
</view>
<view class="owner-info">
<view class="owner-name">{{detail.owner_name || '好友'}} 分享了穿搭</view>
<view class="owner-expire">共 {{outfit.items.length}} 件单品</view>
<view class="osd-owner-body">
<view class="osd-owner-n">{{detail.owner_name || '好友'}} 分享了穿搭</view>
<view class="osd-owner-e num">共 {{outfit.items.length}} 件单品</view>
</view>
</view>
<!-- 拼图封面 -->
<view class="cover">
<view
class="cover-item cover-{{index}}"
wx:for="{{outfit.items}}"
wx:key="clothes_uuid"
wx:if="{{index < 5}}"
>
<image wx:if="{{item.processed_image}}" class="cover-img" src="{{item.processed_image}}" mode="aspectFit" />
<view wx:else class="icon icon-hanger cover-placeholder"></view>
</view>
<view wx:if="{{!outfit.items.length}}" class="cover-empty">
<view class="icon icon-hanger"></view>
<!-- 无缝拼图封面 -->
<view class="osd-cover">
<view class="collage {{cl.cls(outfit.items.length)}}">
<view class="cg" wx:for="{{outfit.items}}" wx:key="clothes_uuid" wx:if="{{index < 4}}">
<image wx:if="{{item.processed_image}}" class="pic" src="{{item.processed_image}}" mode="aspectFill" />
<view wx:else class="ph icon icon-hanger"></view>
</view>
<view wx:if="{{outfit.items.length > 4}}" class="cg-more">+{{outfit.items.length - 4}}</view>
<text class="cg-badge num">{{outfit.items.length}} 件</text>
</view>
</view>
<!-- 信息卡片 -->
<view class="card info-card">
<view class="title-row">
<text class="title">{{outfit.outfit_name}}</text>
<!-- 信息区 -->
<view class="osd-info">
<view class="osd-tags">
<text wx:if="{{outfit.scene}}" class="pill pill--line">{{outfit.scene}}</text>
<text class="pill {{outfit.source === 2 ? 'pill--ink' : ''}}">{{outfit.source === 2 ? 'AI 推荐' : '自建'}}</text>
</view>
<view class="tag-row">
<text wx:if="{{outfit.scene}}" class="tag tag-gray">{{outfit.scene}}</text>
<text class="tag {{outfit.source === 2 ? 'tag-indigo' : 'tag-gray'}}">{{outfit.source === 2 ? 'AI 推荐' : '自建'}}</text>
</view>
<view class="desc" wx:if="{{outfit.outfit_desc}}">{{outfit.outfit_desc}}</view>
<view class="t-bd osd-desc" wx:if="{{outfit.outfit_desc}}">{{outfit.outfit_desc}}</view>
</view>
<!-- 包含衣物(点击只读查看) -->
<view class="items-title">包含衣物</view>
<scroll-view scroll-x class="items-scroll" show-scrollbar="{{false}}">
<view class="items-row">
<!-- 包含衣物:横滑(点击只读查看) -->
<view class="osd-items">
<view class="grp-hd">
<text class="gh-cn">包含衣物</text>
<text class="gh-en">Items</text>
</view>
<scroll-view scroll-x class="osd-items-scroll" show-scrollbar="{{false}}">
<view class="osd-items-row">
<view
class="item-chip"
class="osd-chip"
wx:for="{{outfit.items}}"
wx:key="clothes_uuid"
data-uuid="{{item.clothes_uuid}}"
bindtap="onItemTap"
>
<image wx:if="{{item.processed_image}}" class="item-img" src="{{item.processed_image}}" mode="aspectFill" />
<view wx:else class="item-img item-img-empty"><view class="icon icon-hanger"></view></view>
<view class="osd-thumb">
<image wx:if="{{item.processed_image}}" class="pic" src="{{item.processed_image}}" mode="aspectFill" />
<view wx:else class="ph icon icon-hanger"></view>
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 转发出口 -->
<button class="share-btn" open-type="share">分享给好友</button>
<!-- 属主取消 -->
<view wx:if="{{detail.is_owner}}" class="cancel-btn btn-danger-text" bindtap="onCancel">取消分享</view>
<view class="footer-space"></view>
<view class="gap-64"></view>
</scroll-view>
<!-- 悬浮玻璃操作条 -->
<view class="dock" wx:if="{{!invalid}}">
<view wx:if="{{detail.is_owner}}" class="btn--text osd-cancel" bindtap="onCancel">取消分享</view>
<button class="btn btn--ink btn--block" open-type="share">分享给好友</button>
</view>
<!-- 取消分享确认 -->
<v2-overlay
visible="{{cancelVisible}}"
type="modal"
title="取消分享"
content="{{cancelContent}}"
buttons="{{cancelButtons}}"
bind:confirm="onCancelConfirm"
bind:cancel="onCancelCancel"
/>
</view>
@@ -1,7 +1,9 @@
.detail-page {
/** 穿搭分享详情:分享者行 + 无缝拼图 + 横滑单品 + 悬浮玻璃操作条 **/
.page-flex {
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
.scroll-body {
@@ -9,193 +11,111 @@
height: 0;
}
/* 分享者信息 */
.owner-card {
margin: 24rpx;
.osd-owner {
display: flex;
align-items: center;
gap: 24rpx;
padding: 40rpx var(--pad) 0;
}
.avatar {
width: 96rpx;
height: 96rpx;
.osd-av {
width: 72rpx;
height: 72rpx;
border-radius: 50%;
background: #F2F2F7;
background: var(--paper-3);
color: var(--ink-3);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
color: #C7C7CC;
flex-shrink: 0;
}
.avatar-img {
.osd-av .pic {
width: 100%;
height: 100%;
}
.avatar-placeholder {
width: 56rpx;
height: 56rpx;
.osd-av .icon {
width: 36rpx;
height: 36rpx;
}
.owner-info {
margin-left: 24rpx;
.osd-owner-body {
min-width: 0;
}
.owner-name {
font-size: 30rpx;
font-weight: 600;
color: #000;
.osd-owner-n {
font-size: 27rpx;
color: var(--ink);
}
.owner-expire {
font-size: 24rpx;
color: #8E8E93;
margin-top: 8rpx;
.osd-owner-e {
margin-top: 6rpx;
font-size: 22rpx;
color: var(--ink-3);
}
/* 封面 */
.cover {
margin: 0 24rpx 24rpx;
height: 480rpx;
background: #fff;
border-radius: 32rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
.osd-cover {
padding: 48rpx var(--pad) 0;
}
.cover-item {
position: absolute;
width: 200rpx;
height: 260rpx;
background: #F8F8FA;
border-radius: 20rpx;
border: 1rpx solid #E5E5EA;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
.osd-info {
padding: 48rpx var(--pad) 0;
}
.cover-0 { left: 30rpx; top: 80rpx; transform: rotate(-6deg); }
.cover-1 { left: 120rpx; top: 140rpx; transform: rotate(2deg); }
.cover-2 { left: 220rpx; top: 70rpx; transform: rotate(5deg); }
.cover-3 { left: 320rpx; top: 150rpx; transform: rotate(-2deg); }
.cover-4 { left: 420rpx; top: 90rpx; transform: rotate(7deg); }
.cover-img {
width: 100%;
height: 100%;
}
.cover-placeholder {
width: 80rpx;
height: 80rpx;
color: #C7C7CC;
}
.cover-empty {
color: #C7C7CC;
}
.cover-empty .icon {
width: 120rpx;
height: 120rpx;
}
/* 信息卡 */
.info-card {
margin: 0 24rpx 24rpx;
}
.title {
font-size: 40rpx;
font-weight: 700;
color: #000;
}
.tag-row {
.osd-tags {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
margin-top: 20rpx;
}
.desc {
font-size: 28rpx;
color: #3C3C43;
margin-top: 20rpx;
line-height: 1.6;
.osd-desc {
margin-top: 26rpx;
}
.items-title {
font-size: 28rpx;
font-weight: 600;
color: #000;
margin-top: 32rpx;
.osd-items {
margin-top: 64rpx;
}
.items-scroll {
margin-top: 20rpx;
.osd-items-scroll {
white-space: nowrap;
}
.items-row {
.osd-items-row {
display: inline-flex;
gap: 24rpx;
padding: 0 var(--pad);
}
.item-chip {
display: flex;
flex-direction: column;
align-items: center;
width: 140rpx;
margin-right: 20rpx;
.osd-chip {
width: 160rpx;
}
.item-img {
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
background: #F2F2F7;
}
.item-img-empty {
.osd-thumb {
width: 160rpx;
height: 160rpx;
background: var(--paper-2);
border-radius: var(--r-img);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
color: #C7C7CC;
}
.item-img-empty .icon {
width: 56rpx;
height: 56rpx;
.osd-thumb .ph {
width: 52%;
height: 52%;
color: var(--art);
}
/* 转发出口 */
.share-btn {
margin: 32rpx 24rpx 0;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
font-weight: 500;
color: var(--color-primary, #000);
background: #fff;
border-radius: 24rpx;
.osd-thumb .pic {
width: 100%;
height: 100%;
}
.share-btn::after {
border: none;
}
.cancel-btn {
.osd-cancel {
display: block;
text-align: center;
padding: 32rpx 0;
}
.footer-space {
height: 40rpx;
padding: 8rpx 0 28rpx;
}