feat: 规范化页面导航与交互体验,优化多端适配
- 统一定制顶部导航组件,支持沉浸式渐变主题与返回逻辑 - 适配 H5 环境的页面跳转逻辑,避免 reLaunch 导致的闪屏问题 - 重构会员、充值、发布等页面布局,改用 Grid 提升移动端适配 - 优化搜索、收藏、消息等页面交互细节,增加点击反馈 - 统一配置页面导航样式,替换原生导航为自定义组件
这个提交包含在:
@@ -67,11 +67,21 @@ export default {
|
||||
* 点击返回上一页,若无历史页面则返回首页
|
||||
*/
|
||||
onBack() {
|
||||
const pages = getCurrentPages()
|
||||
const pages = getCurrentPages ? getCurrentPages() : []
|
||||
if (pages && pages.length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
// #ifdef H5
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index',
|
||||
fail: () => {
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -106,28 +116,40 @@ export default {
|
||||
.fc-navbar__bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 24rpx;
|
||||
padding-left: 16rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
.fc-navbar__back {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
transition: background-color 0.2s ease, transform 0.15s ease;
|
||||
&:active {
|
||||
transform: scale(0.92);
|
||||
background-color: rgba(255, 255, 255, 0.18);
|
||||
}
|
||||
}
|
||||
.fc-navbar--white .fc-navbar__back:active {
|
||||
background-color: rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.fc-navbar__back-icon {
|
||||
font-size: 52rpx;
|
||||
font-size: 54rpx;
|
||||
line-height: 1;
|
||||
font-weight: 300;
|
||||
margin-top: -4rpx;
|
||||
}
|
||||
.fc-navbar__title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 12rpx;
|
||||
&--center {
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
@@ -135,7 +157,8 @@ export default {
|
||||
}
|
||||
.fc-navbar__title-text {
|
||||
font-size: $fc-font-xl;
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.5rpx;
|
||||
}
|
||||
.fc-navbar__right {
|
||||
position: relative;
|
||||
@@ -143,5 +166,7 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
min-width: 72rpx;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
<template>
|
||||
<view class="fc-post-card" @click="$emit('click', post)">
|
||||
<view class="fc-post-card__thumb">
|
||||
<image class="fc-post-card__thumb-img" :src="categoryIconUrl(post.categoryId)" mode="aspectFit" />
|
||||
<view class="fc-post-card__thumb" :class="{ 'fc-post-card__thumb--icon': !thumbUrl }">
|
||||
<image v-if="thumbUrl" class="fc-post-card__thumb-img" :src="thumbUrl" mode="aspectFill" />
|
||||
<image v-else class="fc-post-card__thumb-icon" :src="categoryIconUrl(post.categoryId)" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="fc-post-card__body">
|
||||
<view class="fc-post-card__title fc-ellipsis-2">{{ post.title }}</view>
|
||||
<view class="fc-post-card__tags">
|
||||
<view v-if="post.isTop || (post.tags && post.tags.length)" class="fc-post-card__tags">
|
||||
<text v-if="post.isTop" class="fc-tag fc-post-card__tag fc-post-card__tag--top">置顶</text>
|
||||
<text v-for="t in (post.tags || []).slice(0, 2)" :key="t" class="fc-tag fc-post-card__tag">{{ t }}</text>
|
||||
<text v-if="post.isTop" class="fc-post-card__tag fc-post-card__tag--top">置顶</text>
|
||||
</view>
|
||||
<view class="fc-post-card__meta">
|
||||
<text class="fc-post-card__area">{{ post.area }}</text>
|
||||
<text class="fc-post-card__area">{{ post.area || '同城' }}</text>
|
||||
<text v-if="distanceText" class="fc-post-card__dot">·</text>
|
||||
<text v-if="distanceText" class="fc-post-card__distance">{{ distanceText }}</text>
|
||||
<text class="fc-post-card__dot">·</text>
|
||||
<text class="fc-post-card__time">{{ timeText }}</text>
|
||||
</view>
|
||||
<view class="fc-post-card__bottom">
|
||||
<view class="fc-price">
|
||||
<text v-if="post.price > 0" class="fc-price__symbol">¥</text>
|
||||
<text v-if="post.price > 0" class="fc-post-card__amount">{{ post.price }}</text>
|
||||
<view class="fc-price fc-price--card">
|
||||
<template v-if="post.price > 0">
|
||||
<text class="fc-price__symbol">¥</text>
|
||||
<text class="fc-post-card__amount">{{ post.price }}</text>
|
||||
<text class="fc-post-card__unit">{{ post.priceUnit || '元' }}</text>
|
||||
</template>
|
||||
<text v-else class="fc-post-card__neg">面议</text>
|
||||
<text class="fc-post-card__unit">{{ post.priceUnit }}</text>
|
||||
</view>
|
||||
<view class="fc-post-card__stats">
|
||||
<view class="fc-post-card__stat">
|
||||
<image class="fc-icon fc-icon--xs" :src="iconUrl('eye')" mode="aspectFit" />
|
||||
<text class="fc-post-card__stat-num">{{ post.views }}</text>
|
||||
<text class="fc-post-card__stat-num">{{ post.views || 0 }}</text>
|
||||
</view>
|
||||
<view class="fc-post-card__stat">
|
||||
<image class="fc-icon fc-icon--xs" :src="iconUrl('comment-gray')" mode="aspectFit" />
|
||||
@@ -40,7 +43,7 @@
|
||||
|
||||
<script>
|
||||
import { iconUrl, categoryIconUrl } from '@/common/store/ui.js'
|
||||
import { fromNow, formatKm } from '@/common/utils/format.js'
|
||||
import { fromNow, formatKm, assetUrl } from '@/common/utils/format.js'
|
||||
|
||||
export default {
|
||||
name: 'FcPostCard',
|
||||
@@ -48,6 +51,7 @@ export default {
|
||||
post: { type: Object, required: true },
|
||||
},
|
||||
computed: {
|
||||
/** 相对发布时间描述 */
|
||||
timeText() {
|
||||
return fromNow(this.post.createdAt)
|
||||
},
|
||||
@@ -55,9 +59,26 @@ export default {
|
||||
distanceText() {
|
||||
return this.post.distance == null ? '' : formatKm(this.post.distance)
|
||||
},
|
||||
/**
|
||||
* 帖子封面图:优先使用实际上传封面或第一张实拍图,无图时回退为空由图标兜底
|
||||
*/
|
||||
thumbUrl() {
|
||||
if (this.post.cover) {
|
||||
return assetUrl(this.post.cover)
|
||||
}
|
||||
if (this.post.media && Array.isArray(this.post.media) && this.post.media.length) {
|
||||
const first = this.post.media[0]
|
||||
if (typeof first === 'string' && !first.match(/\.(mp4|mov|avi)$/i)) {
|
||||
return assetUrl(first)
|
||||
}
|
||||
}
|
||||
return ''
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 暴露图标地址解析工具 */
|
||||
iconUrl,
|
||||
/** 暴露分类图标解析工具 */
|
||||
categoryIconUrl,
|
||||
},
|
||||
}
|
||||
@@ -70,60 +91,77 @@ export default {
|
||||
margin: 0 24rpx 20rpx;
|
||||
background: $fc-bg-card;
|
||||
border-radius: $fc-radius-lg;
|
||||
box-shadow: $fc-shadow;
|
||||
transition: transform 0.15s ease;
|
||||
box-shadow: $fc-shadow-sm;
|
||||
border: 1rpx solid rgba(4, 48, 30, 0.05);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
&:hover {
|
||||
box-shadow: $fc-shadow;
|
||||
}
|
||||
&:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
}
|
||||
.fc-post-card__thumb {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
flex: 0 0 200rpx;
|
||||
margin-right: 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: $fc-gradient-soft;
|
||||
width: 190rpx;
|
||||
height: 190rpx;
|
||||
flex: 0 0 190rpx;
|
||||
margin-right: 22rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
background: #f1f5f9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
&--icon {
|
||||
background: $fc-gradient-soft;
|
||||
}
|
||||
}
|
||||
.fc-post-card__thumb-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.fc-post-card__thumb-icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.fc-post-card__body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.fc-post-card__title {
|
||||
font-size: $fc-font-lg;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $fc-text;
|
||||
line-height: 1.35;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
.fc-post-card__tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 10rpx;
|
||||
gap: 8rpx;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.fc-post-card__tag {
|
||||
margin-right: 10rpx;
|
||||
margin: 0;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
}
|
||||
.fc-post-card__tag--top {
|
||||
// 置顶:亮绿面 + 墨绿字(主题 v4 规则:亮绿面只配墨绿字)
|
||||
background: $fc-gradient-primary;
|
||||
color: $fc-primary-ink;
|
||||
font-weight: 700;
|
||||
}
|
||||
.fc-post-card__meta {
|
||||
margin-top: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: $fc-font-xs;
|
||||
font-size: 22rpx;
|
||||
color: $fc-text-placeholder;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.fc-post-card__dot {
|
||||
margin: 0 8rpx;
|
||||
@@ -133,26 +171,34 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
.fc-post-card__bottom {
|
||||
margin-top: auto;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
padding-top: 4rpx;
|
||||
}
|
||||
.fc-price--card {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
.fc-post-card__amount {
|
||||
font-size: 38rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
.fc-post-card__neg {
|
||||
font-size: $fc-font-lg;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: $fc-price;
|
||||
}
|
||||
.fc-post-card__unit {
|
||||
margin-left: 6rpx;
|
||||
font-size: $fc-font-xs;
|
||||
margin-left: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: $fc-text-secondary;
|
||||
font-weight: 400;
|
||||
}
|
||||
.fc-post-card__stats {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.fc-post-card__stat {
|
||||
display: flex;
|
||||
@@ -161,7 +207,7 @@ export default {
|
||||
}
|
||||
.fc-post-card__stat-num {
|
||||
margin-left: 6rpx;
|
||||
font-size: $fc-font-xs;
|
||||
font-size: 22rpx;
|
||||
color: $fc-text-placeholder;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -60,8 +60,18 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
// 其余常驻 Tab 页面平滑切换
|
||||
// 其余常驻 Tab 页面平滑切换:H5 环境优先 redirectTo 避免 reLaunch 导致的页面整体闪屏
|
||||
// #ifdef H5
|
||||
uni.redirectTo({
|
||||
url: item.path,
|
||||
fail: () => {
|
||||
uni.reLaunch({ url: item.path })
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
uni.reLaunch({ url: item.path })
|
||||
// #endif
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -94,6 +104,11 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-bottom: 8rpx;
|
||||
cursor: pointer;
|
||||
transition: transform 0.15s ease;
|
||||
&:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
&--active {
|
||||
.fc-tabbar__text {
|
||||
color: $fc-primary-text;
|
||||
|
||||
在新工单中引用
屏蔽一个用户