feat: 规范化页面导航与交互体验,优化多端适配
- 统一定制顶部导航组件,支持沉浸式渐变主题与返回逻辑 - 适配 H5 环境的页面跳转逻辑,避免 reLaunch 导致的闪屏问题 - 重构会员、充值、发布等页面布局,改用 Grid 提升移动端适配 - 优化搜索、收藏、消息等页面交互细节,增加点击反馈 - 统一配置页面导航样式,替换原生导航为自定义组件
这个提交包含在:
@@ -8,15 +8,23 @@
|
||||
* @returns {Object} 包含 statusBarHeight, navBarHeight, capsulePadding, capsuleWidth, capsuleHeight, capsuleTop, totalHeight
|
||||
*/
|
||||
export function getNavMetrics() {
|
||||
let statusBarHeight = 20
|
||||
let statusBarHeight = 0
|
||||
let navBarHeight = 44
|
||||
let capsulePadding = 0
|
||||
let capsuleWidth = 0
|
||||
let capsuleHeight = 32
|
||||
let capsuleTop = 24
|
||||
let capsuleTop = 6
|
||||
let capsuleRight = 0
|
||||
|
||||
try {
|
||||
// #ifdef H5
|
||||
// 浏览器环境下通常无需模拟系统状态栏,状态栏高度置 0,导航栏高度固定 44px
|
||||
statusBarHeight = 0
|
||||
navBarHeight = 44
|
||||
capsulePadding = 0
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
const sys = uni.getSystemInfoSync ? uni.getSystemInfoSync() : null
|
||||
if (sys && sys.statusBarHeight) {
|
||||
statusBarHeight = sys.statusBarHeight
|
||||
@@ -44,8 +52,9 @@ export function getNavMetrics() {
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// #endif
|
||||
} catch (e) {
|
||||
capsulePadding = 96
|
||||
capsulePadding = 0
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -21,24 +21,24 @@
|
||||
"path": "pages/post/create",
|
||||
"style": {
|
||||
"navigationBarTitleText": "发布信息",
|
||||
"navigationBarBackgroundColor": "#04874a",
|
||||
"navigationBarTextStyle": "white"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/post/mine",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的发布",
|
||||
"navigationBarBackgroundColor": "#04874a",
|
||||
"navigationBarTextStyle": "white"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/message/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "通知中心",
|
||||
"navigationBarBackgroundColor": "#04874a",
|
||||
"navigationBarTextStyle": "white"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -53,31 +53,32 @@
|
||||
"path": "pages/auth/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"navigationStyle": "custom"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/search/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "搜索",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f8fafc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/post/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类信息",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/detail/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "详情",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -92,24 +93,24 @@
|
||||
"path": "pages/member/orders",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的订单",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/member/recharge",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额充值",
|
||||
"navigationBarBackgroundColor": "#04874a",
|
||||
"navigationBarTextStyle": "white"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/favorite/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的收藏",
|
||||
"navigationBarBackgroundColor": "#04874a",
|
||||
"navigationBarTextStyle": "white"
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#f2fef7"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -158,7 +158,20 @@ export default {
|
||||
const res = await store.switchType(this.userType, license)
|
||||
uni.showToast({ title: res.needAudit ? '已提交资质,等待审核' : '登录成功', icon: 'none' })
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
const pages = (typeof getCurrentPages === 'function') ? getCurrentPages() : []
|
||||
if (pages && pages.length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
// #ifdef H5
|
||||
uni.redirectTo({
|
||||
url: '/pages/mine/index',
|
||||
fail: () => uni.reLaunch({ url: '/pages/mine/index' }),
|
||||
})
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
uni.reLaunch({ url: '/pages/mine/index' })
|
||||
// #endif
|
||||
}
|
||||
}, 600)
|
||||
} catch (e) {
|
||||
uni.showToast({ title: e.message || '登录失败', icon: 'none' })
|
||||
@@ -169,6 +182,7 @@ export default {
|
||||
getWxCode() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fail = () => reject(new Error('微信授权失败,请重试'))
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
if (typeof uni !== 'undefined' && uni.login) {
|
||||
uni.login({
|
||||
@@ -179,8 +193,24 @@ export default {
|
||||
return
|
||||
}
|
||||
} catch (e) {}
|
||||
// 非微信小程序环境(H5/Node)无 uni.login,无法换取真实 code:
|
||||
// 不再伪造 'mock_code'(否则线上所有失败用户会派生到同一个 openid 账号)
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
// H5 浏览器端调试体验:独立分配每个客户端浏览器独享的测试 Openid
|
||||
let devCode = ''
|
||||
try {
|
||||
devCode = uni.getStorageSync('fc_h5_openid')
|
||||
} catch (e) {}
|
||||
if (!devCode) {
|
||||
devCode = 'openid_h5_' + Math.random().toString(36).slice(2, 10)
|
||||
try {
|
||||
uni.setStorageSync('fc_h5_openid', devCode)
|
||||
} catch (e) {}
|
||||
}
|
||||
resolve(devCode)
|
||||
return
|
||||
// #endif
|
||||
|
||||
fail()
|
||||
})
|
||||
},
|
||||
|
||||
@@ -289,6 +289,7 @@ export default {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.cat-header__search {
|
||||
cursor: pointer;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 64rpx;
|
||||
@@ -322,6 +323,7 @@ export default {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.cat-sidebar__item {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
height: 110rpx;
|
||||
display: flex;
|
||||
@@ -376,6 +378,7 @@ export default {
|
||||
box-shadow: $fc-shadow-sm;
|
||||
}
|
||||
.cat-sort__item {
|
||||
cursor: pointer;
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
|
||||
@@ -1,7 +1,31 @@
|
||||
<template>
|
||||
<view class="detail fc-page">
|
||||
<!-- 顶部视觉 -->
|
||||
<view class="detail__hero">
|
||||
<!-- 规范化顶部导航 -->
|
||||
<fc-navbar title="详情" theme="gradient" :show-back="true" />
|
||||
|
||||
<!-- 顶部实拍画廊 / 轮播图或分类插画 -->
|
||||
<view v-if="imageUrls.length" class="detail__gallery">
|
||||
<swiper
|
||||
class="detail__swiper"
|
||||
circular
|
||||
:autoplay="imageUrls.length > 1"
|
||||
:interval="4000"
|
||||
:duration="400"
|
||||
@change="onSwiperChange"
|
||||
>
|
||||
<swiper-item v-for="(img, idx) in imageUrls" :key="idx" @click="previewImages(idx)">
|
||||
<image class="detail__swiper-img" :src="img" mode="aspectFill" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view v-if="imageUrls.length > 1" class="detail__swiper-badge">
|
||||
<text>{{ activeSwiperIndex + 1 }} / {{ imageUrls.length }}</text>
|
||||
</view>
|
||||
<view class="detail__hero-badges detail__hero-badges--float">
|
||||
<text class="fc-tag detail__badge">{{ post.categoryName }}</text>
|
||||
<text v-if="post.isPaid" class="fc-tag detail__badge detail__badge--paid">置顶推荐</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="detail__hero">
|
||||
<view class="detail__hero-thumb">
|
||||
<image class="detail__hero-img" :src="catIcon()" mode="aspectFit" />
|
||||
</view>
|
||||
@@ -194,8 +218,11 @@ import { fromNow, maskPhone } from '@/common/utils/format.js'
|
||||
import { pay } from '@/common/utils/pay.js'
|
||||
import { useUserStore } from '@/common/store/index.js'
|
||||
import config from '@/common/config/index.js'
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import { assetUrl } from '@/common/utils/format.js'
|
||||
|
||||
export default {
|
||||
components: { FcNavbar },
|
||||
data() {
|
||||
return {
|
||||
id: 0,
|
||||
@@ -214,6 +241,7 @@ export default {
|
||||
commentText: '',
|
||||
// 支付/提交中:防连点重复下单(余额支付是即时扣款)
|
||||
submitting: false,
|
||||
activeSwiperIndex: 0,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -221,6 +249,20 @@ export default {
|
||||
return fromNow(this.post.createdAt)
|
||||
},
|
||||
/** 详情是否带真实坐标(契约新增 lat/lng) */
|
||||
imageUrls() {
|
||||
const list = []
|
||||
if (this.post.media && Array.isArray(this.post.media)) {
|
||||
this.post.media.forEach((m) => {
|
||||
if (typeof m === 'string' && !m.match(/\.(mp4|mov|avi)$/i)) {
|
||||
list.push(assetUrl(m))
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!list.length && this.post.cover) {
|
||||
list.push(assetUrl(this.post.cover))
|
||||
}
|
||||
return list
|
||||
},
|
||||
hasLocation() {
|
||||
return this.post.lat != null && this.post.lng != null
|
||||
},
|
||||
@@ -424,6 +466,51 @@ export default {
|
||||
.detail {
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.detail__gallery {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 480rpx;
|
||||
overflow: hidden;
|
||||
background: #000000;
|
||||
}
|
||||
.detail__swiper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.detail__swiper-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
.detail__swiper-badge {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
bottom: 24rpx;
|
||||
padding: 4rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
color: #ffffff;
|
||||
font-size: 22rpx;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
.detail__hero-badges--float {
|
||||
position: absolute;
|
||||
left: 24rpx;
|
||||
bottom: 24rpx;
|
||||
margin-top: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
.detail__content {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.detail__title {
|
||||
word-break: break-all;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.detail__hero {
|
||||
padding: 32rpx 24rpx 0;
|
||||
}
|
||||
|
||||
@@ -325,9 +325,14 @@ export default {
|
||||
}
|
||||
.dist__invite-link {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: $fc-font-xs;
|
||||
color: $fc-text-regular;
|
||||
}
|
||||
.dist__invite-copy {
|
||||
flex-shrink: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.dist__invite-copy {
|
||||
margin-left: 16rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<view class="fav fc-page">
|
||||
<!-- 规范化顶部导航 -->
|
||||
<fc-navbar title="我的收藏" theme="gradient" :show-back="true" />
|
||||
|
||||
<view v-if="loading && !list.length" class="fav__loading">
|
||||
<view v-for="i in 3" :key="i" class="fc-skeleton fav__skeleton"></view>
|
||||
</view>
|
||||
@@ -9,9 +12,13 @@
|
||||
<view v-else class="fav__list">
|
||||
<view v-for="p in list" :key="p.id" class="fav__item">
|
||||
<fc-post-card :post="p" @click="goDetail(p)" />
|
||||
<view class="fav__ops">
|
||||
<text class="fav__op" @click.stop="goDetail(p)">查看</text>
|
||||
<text class="fav__op fav__op--danger" @click.stop="remove(p)">取消收藏</text>
|
||||
<view class="fav__action-bar">
|
||||
<view class="fav__btn fav__btn--ghost" @click.stop="remove(p)">
|
||||
<text>取消收藏</text>
|
||||
</view>
|
||||
<view class="fav__btn fav__btn--primary" @click.stop="goDetail(p)">
|
||||
<text>查看详情</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -25,12 +32,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import FcPostCard from '@/components/fc-post-card/fc-post-card.vue'
|
||||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||||
import favoriteApi from '@/common/api/favorite.js'
|
||||
|
||||
export default {
|
||||
components: { FcPostCard, FcEmpty },
|
||||
components: { FcNavbar, FcPostCard, FcEmpty },
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
@@ -52,6 +60,10 @@ export default {
|
||||
this.loadMore()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 拉取当前用户的收藏列表
|
||||
* @param {boolean} reset 是否重置分页重新拉取
|
||||
*/
|
||||
async fetch(reset = false) {
|
||||
this.loading = true
|
||||
try {
|
||||
@@ -64,19 +76,39 @@ export default {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 触底加载下一页数据
|
||||
*/
|
||||
loadMore() {
|
||||
if (!this.hasMore || this.loading) return
|
||||
this.page += 1
|
||||
this.fetch()
|
||||
},
|
||||
/**
|
||||
* 跳转到帖子详情
|
||||
* @param {Object} p 目标帖子对象
|
||||
*/
|
||||
goDetail(p) {
|
||||
uni.navigateTo({ url: `/pages/detail/detail?id=${p.id}` })
|
||||
},
|
||||
/**
|
||||
* 返回首页浏览
|
||||
*/
|
||||
goHome() {
|
||||
// 项目用自绘 fc-tabbar(pages.json 无 tabBar),switchTab 会失败,统一用 reLaunch
|
||||
// #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
|
||||
},
|
||||
/** 取消收藏:调接口成功后从列表移除(失败保留并 Toast) */
|
||||
/**
|
||||
* 取消收藏当前信息
|
||||
* @param {Object} p 帖子对象
|
||||
*/
|
||||
async remove(p) {
|
||||
try {
|
||||
await favoriteApi.toggle({ postId: p.id })
|
||||
@@ -93,6 +125,8 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.fav {
|
||||
padding-bottom: 60rpx;
|
||||
min-height: 100vh;
|
||||
background: #f8fafc;
|
||||
}
|
||||
.fav__loading {
|
||||
padding: 24rpx;
|
||||
@@ -102,23 +136,42 @@ export default {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.fav__list {
|
||||
padding-top: 24rpx;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.fav__item {
|
||||
position: relative;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.fav__ops {
|
||||
.fav__action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin: -10rpx 40rpx 24rpx 0;
|
||||
align-items: center;
|
||||
padding: 0 32rpx 20rpx;
|
||||
margin-top: -10rpx;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.fav__op {
|
||||
margin-left: 28rpx;
|
||||
font-size: $fc-font-sm;
|
||||
color: $fc-primary-text;
|
||||
font-weight: 600;
|
||||
&--danger {
|
||||
color: $fc-danger;
|
||||
.fav__btn {
|
||||
padding: 8rpx 24rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 24rpx;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
&--ghost {
|
||||
color: $fc-text-placeholder;
|
||||
border: 1rpx solid $fc-border;
|
||||
background: #ffffff;
|
||||
&:active {
|
||||
background: #f1f5f9;
|
||||
color: $fc-danger;
|
||||
}
|
||||
}
|
||||
&--primary {
|
||||
color: $fc-primary-text;
|
||||
background: $fc-primary-lighter;
|
||||
border: 1rpx solid rgba(4, 135, 74, 0.25);
|
||||
font-weight: 600;
|
||||
&:active {
|
||||
background: rgba(4, 135, 74, 0.15);
|
||||
}
|
||||
}
|
||||
}
|
||||
.fav__more {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<view class="fc-card home__cats">
|
||||
<view class="home__cats-head">
|
||||
<text class="home__cats-title">同城分类</text>
|
||||
<text class="home__cats-more" @click="go('/pages/post/list')">全部分类 ›</text>
|
||||
<text class="home__cats-more" @click="goCategoryTab">全部分类 ›</text>
|
||||
</view>
|
||||
<view class="home__cats-grid">
|
||||
<view v-for="c in categories" :key="c.id" class="home__cat" @click="goCategory(c)">
|
||||
@@ -365,9 +365,28 @@ export default {
|
||||
this.page = 1
|
||||
this.fetchFeed(true)
|
||||
},
|
||||
/**
|
||||
* 页面跳转助手
|
||||
* @param {string} url 目标路径
|
||||
*/
|
||||
go(url) {
|
||||
if (!url) return
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
/**
|
||||
* 规范跳转到全部分类 Tab 页面
|
||||
*/
|
||||
goCategoryTab() {
|
||||
// #ifdef H5
|
||||
uni.redirectTo({
|
||||
url: '/pages/category/index',
|
||||
fail: () => uni.reLaunch({ url: '/pages/category/index' }),
|
||||
})
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
uni.reLaunch({ url: '/pages/category/index' })
|
||||
// #endif
|
||||
},
|
||||
goSearch() {
|
||||
uni.navigateTo({ url: '/pages/search/index' })
|
||||
},
|
||||
|
||||
@@ -406,22 +406,22 @@ export default {
|
||||
color: $fc-text-placeholder;
|
||||
}
|
||||
.vip__plans {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.vip__plan {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
border: 2rpx solid $fc-border;
|
||||
border-radius: $fc-radius-lg;
|
||||
background: $fc-bg;
|
||||
padding: 28rpx 8rpx;
|
||||
padding: 24rpx 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
&:not(:last-child) {
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
&--active {
|
||||
border-color: $fc-primary-text;
|
||||
background: $fc-primary-lighter;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<view class="orders fc-page">
|
||||
<!-- 规范化顶部导航 -->
|
||||
<fc-navbar title="我的订单" theme="gradient" :show-back="true" />
|
||||
<view class="orders__tabs">
|
||||
<view v-for="t in tabs" :key="t.value" class="orders__tab"
|
||||
:class="{ 'orders__tab--active': type === t.value }" @click="type = t.value">
|
||||
@@ -39,6 +41,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||||
import memberApi from '@/common/api/member.js'
|
||||
import { ORDER_TEXT, ORDER_ICON_KEY } from '@/common/constants/ui.js'
|
||||
@@ -46,7 +49,7 @@ import { formatTime } from '@/common/utils/format.js'
|
||||
import { iconUrl, loadUiConfig } from '@/common/store/ui.js'
|
||||
|
||||
export default {
|
||||
components: { FcEmpty },
|
||||
components: { FcNavbar, FcEmpty },
|
||||
data() {
|
||||
return {
|
||||
type: 'all',
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<view class="recharge fc-page">
|
||||
<!-- 规范化顶部导航 -->
|
||||
<fc-navbar title="余额充值" theme="gradient" :show-back="true" />
|
||||
<!-- 余额卡 -->
|
||||
<view class="recharge__hero">
|
||||
<text class="recharge__hero-label">账户余额(元)</text>
|
||||
@@ -42,6 +44,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import memberApi from '@/common/api/member.js'
|
||||
import orderApi from '@/common/api/order.js'
|
||||
import { iconUrl, loadUiConfig } from '@/common/store/ui.js'
|
||||
@@ -49,6 +52,7 @@ import { pay } from '@/common/utils/pay.js'
|
||||
import config from '@/common/config/index.js'
|
||||
|
||||
export default {
|
||||
components: { FcNavbar },
|
||||
data() {
|
||||
return {
|
||||
assets: {},
|
||||
@@ -154,14 +158,13 @@ export default {
|
||||
color: $fc-text;
|
||||
}
|
||||
.recharge__tiers {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.recharge__tier {
|
||||
position: relative;
|
||||
width: 31.5%;
|
||||
margin: 0 2.6% 20rpx 0;
|
||||
padding: 28rpx 0;
|
||||
border: 2rpx solid $fc-border;
|
||||
border-radius: $fc-radius;
|
||||
@@ -169,12 +172,12 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
&:nth-child(3n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
&--active {
|
||||
border-color: $fc-primary-text;
|
||||
background: $fc-primary-lighter;
|
||||
box-shadow: 0 4rpx 14rpx rgba(4, 135, 74, 0.15);
|
||||
}
|
||||
}
|
||||
.recharge__tier-amount {
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
<template>
|
||||
<view class="msg fc-page">
|
||||
<!-- 规范化顶部导航:与首页、分类、我的统一沉浸式渐变顶栏 -->
|
||||
<fc-navbar title="通知中心" theme="gradient" />
|
||||
|
||||
<!-- 分类 tab -->
|
||||
<view class="msg__tabs">
|
||||
<view v-for="t in tabs" :key="t.value" class="msg__tab"
|
||||
:class="{ 'msg__tab--active': type === t.value }" @click="changeType(t.value)">
|
||||
<text>{{ t.label }}</text>
|
||||
<view
|
||||
v-for="t in tabs"
|
||||
:key="t.value"
|
||||
class="msg__tab"
|
||||
:class="{ 'msg__tab--active': type === t.value }"
|
||||
@click="changeType(t.value)"
|
||||
>
|
||||
<text class="msg__tab-label">{{ t.label }}</text>
|
||||
<view v-if="type === t.value" class="msg__tab-line"></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -12,14 +20,19 @@
|
||||
<fc-empty v-if="!loading && !list.length" icon="inbox" text="暂无通知" />
|
||||
|
||||
<view v-else class="msg__list">
|
||||
<view v-for="m in list" :key="m.id" class="msg__item" :class="{ 'msg__item--unread': !m.read }"
|
||||
@click="openMsg(m)">
|
||||
<view
|
||||
v-for="m in list"
|
||||
:key="m.id"
|
||||
class="msg__item"
|
||||
:class="{ 'msg__item--unread': !m.read }"
|
||||
@click="openMsg(m)"
|
||||
>
|
||||
<view class="msg__icon">
|
||||
<image class="fc-icon--badge-sm" :src="iconUrl(meta(m.type).iconKey)" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="msg__body">
|
||||
<view class="msg__head">
|
||||
<text class="msg__title">{{ m.title }}</text>
|
||||
<text class="msg__title fc-ellipsis">{{ m.title }}</text>
|
||||
<text class="msg__time">{{ timeText(m.createdAt) }}</text>
|
||||
</view>
|
||||
<text class="msg__content fc-ellipsis-2">{{ m.content }}</text>
|
||||
@@ -35,6 +48,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||||
import FcTabbar from '@/components/fc-tabbar/fc-tabbar.vue'
|
||||
import messageApi from '@/common/api/message.js'
|
||||
@@ -43,7 +57,7 @@ import { fromNow } from '@/common/utils/format.js'
|
||||
import { iconUrl } from '@/common/store/ui.js'
|
||||
|
||||
export default {
|
||||
components: { FcEmpty, FcTabbar },
|
||||
components: { FcNavbar, FcEmpty, FcTabbar },
|
||||
data() {
|
||||
return {
|
||||
type: 'system',
|
||||
@@ -84,7 +98,7 @@ export default {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await messageApi.list({ type: this.type, page: 1, size: 20 })
|
||||
this.list = res.list
|
||||
this.list = res.list || []
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '通知加载失败', icon: 'none' })
|
||||
} finally {
|
||||
@@ -127,49 +141,64 @@ export default {
|
||||
.msg__tabs {
|
||||
display: flex;
|
||||
background: #ffffff;
|
||||
padding: 0 24rpx;
|
||||
padding: 0 32rpx;
|
||||
border-bottom: 2rpx solid $fc-border;
|
||||
box-shadow: $fc-shadow-sm;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
.msg__tab {
|
||||
flex: 1;
|
||||
height: 92rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: $fc-font;
|
||||
color: $fc-text-secondary;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
position: relative;
|
||||
&--active {
|
||||
color: $fc-primary-text;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.msg__tab-line {
|
||||
width: 48rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 56rpx;
|
||||
height: 6rpx;
|
||||
border-radius: 3rpx;
|
||||
border-radius: 4rpx;
|
||||
background: $fc-gradient-primary;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.msg__list {
|
||||
padding: 16rpx 0;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.msg__item {
|
||||
position: relative;
|
||||
margin: 16rpx 24rpx;
|
||||
margin: 0 24rpx 20rpx;
|
||||
padding: 24rpx;
|
||||
background: #ffffff;
|
||||
border-radius: $fc-radius-lg;
|
||||
display: flex;
|
||||
box-shadow: $fc-shadow;
|
||||
box-shadow: $fc-shadow-sm;
|
||||
border: 1rpx solid rgba(4, 48, 30, 0.05);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
&:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
&--unread {
|
||||
background: $fc-primary-lighter;
|
||||
background: #f7fffb;
|
||||
border-left: 6rpx solid $fc-primary;
|
||||
}
|
||||
}
|
||||
.msg__icon {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
flex: 0 0 84rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
flex: 0 0 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -185,18 +214,20 @@ export default {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.msg__title {
|
||||
font-size: $fc-font-lg;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $fc-text;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.msg__time {
|
||||
font-size: $fc-font-xs;
|
||||
font-size: 22rpx;
|
||||
color: $fc-text-placeholder;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.msg__content {
|
||||
display: block;
|
||||
margin-top: 10rpx;
|
||||
font-size: $fc-font-sm;
|
||||
font-size: 26rpx;
|
||||
color: $fc-text-regular;
|
||||
line-height: 1.5;
|
||||
}
|
||||
@@ -208,8 +239,9 @@ export default {
|
||||
height: 16rpx;
|
||||
border-radius: 50%;
|
||||
background: $fc-primary;
|
||||
box-shadow: 0 0 8rpx rgba(0, 224, 112, 0.6);
|
||||
}
|
||||
.msg__tabbar-space {
|
||||
height: 130rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -167,8 +167,21 @@ export default {
|
||||
await useUserStore().fetchProfile()
|
||||
} catch (e) {}
|
||||
},
|
||||
/**
|
||||
* 页面跳转助手
|
||||
* @param {string} url 目标路径
|
||||
*/
|
||||
go(url) {
|
||||
if (!url) return uni.showToast({ title: '功能建设中', icon: 'none' })
|
||||
if (!url) {
|
||||
uni.showModal({
|
||||
title: '关于我们',
|
||||
content: '同城分类信息平台致力于为广大同城居民提供真实、高效、便捷的本地生活服务与便民信息交互体验。',
|
||||
showCancel: false,
|
||||
confirmText: '我知道了',
|
||||
confirmColor: '#04874a',
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
goLogin() {
|
||||
@@ -318,7 +331,15 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
margin-bottom: 12rpx;
|
||||
padding: 8rpx 0;
|
||||
cursor: pointer;
|
||||
border-radius: $fc-radius;
|
||||
transition: all 0.15s ease;
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
background-color: #f1f5f9;
|
||||
}
|
||||
}
|
||||
.mine__entry-icon {
|
||||
width: 96rpx;
|
||||
@@ -340,6 +361,11 @@ export default {
|
||||
align-items: center;
|
||||
height: 96rpx;
|
||||
border-bottom: 2rpx solid $fc-border;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
&:active {
|
||||
background-color: #f8fafc;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<view class="create fc-page">
|
||||
<!-- 顶部导航 -->
|
||||
<fc-navbar title="发布信息" theme="gradient" :show-back="true" />
|
||||
<!-- 分类 -->
|
||||
<view class="fc-card create__section">
|
||||
<view class="create__label">选择分类<text class="create__required">*</text></view>
|
||||
@@ -134,6 +136,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import homeApi from '@/common/api/home.js'
|
||||
import postApi from '@/common/api/post.js'
|
||||
import memberApi from '@/common/api/member.js'
|
||||
@@ -144,6 +147,7 @@ import { assetUrl } from '@/common/utils/format.js'
|
||||
import config from '@/common/config/index.js'
|
||||
|
||||
export default {
|
||||
components: { FcNavbar },
|
||||
data() {
|
||||
return {
|
||||
categories: [],
|
||||
@@ -455,7 +459,17 @@ export default {
|
||||
if (typeof res.quotaLeft === 'number') this.publish.quotaLeft = res.quotaLeft
|
||||
uni.showToast({ title: '发布成功,等待审核', icon: 'none' })
|
||||
// 发布后直接进「我的发布」,可立刻看到审核状态(原先跳首页看不到自己的发布)
|
||||
setTimeout(() => uni.reLaunch({ url: '/pages/post/mine' }), 800)
|
||||
setTimeout(() => {
|
||||
// #ifdef H5
|
||||
uni.redirectTo({
|
||||
url: '/pages/post/mine',
|
||||
fail: () => uni.reLaunch({ url: '/pages/post/mine' }),
|
||||
})
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
uni.reLaunch({ url: '/pages/post/mine' })
|
||||
// #endif
|
||||
}, 800)
|
||||
} catch (e) {
|
||||
uni.showToast({ title: e.message || '发布失败', icon: 'none' })
|
||||
} finally {
|
||||
@@ -666,11 +680,12 @@ export default {
|
||||
color: $fc-text-placeholder;
|
||||
}
|
||||
.create__plans {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 16rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.create__plan {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
border: 2rpx solid $fc-border;
|
||||
border-radius: $fc-radius-lg;
|
||||
@@ -679,9 +694,9 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
&:not(:last-child) {
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
&--active {
|
||||
border-color: $fc-primary-text;
|
||||
background: $fc-primary-lighter;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<view class="list fc-page">
|
||||
<!-- 规范化顶部导航 -->
|
||||
<fc-navbar :title="pageTitle || '分类信息'" theme="gradient" :show-back="true" />
|
||||
<!-- 分类横滑 -->
|
||||
<scroll-view class="list__cats" scroll-x :show-scrollbar="false">
|
||||
<view class="list__cats-inner">
|
||||
@@ -56,17 +58,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import FcPostCard from '@/components/fc-post-card/fc-post-card.vue'
|
||||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||||
import homeApi from '@/common/api/home.js'
|
||||
import { iconUrl, categoryIconUrl, loadUiConfig } from '@/common/store/ui.js'
|
||||
|
||||
export default {
|
||||
components: { FcPostCard, FcEmpty },
|
||||
components: { FcNavbar, FcPostCard, FcEmpty },
|
||||
data() {
|
||||
return {
|
||||
categories: [],
|
||||
categoryId: 0,
|
||||
pageTitle: '',
|
||||
list: [],
|
||||
page: 1,
|
||||
size: 10,
|
||||
@@ -87,7 +91,9 @@ export default {
|
||||
onLoad(query) {
|
||||
this.categoryId = Number(query.categoryId || 0)
|
||||
if (query.name) {
|
||||
uni.setNavigationBarTitle({ title: decodeURIComponent(query.name) })
|
||||
const decoded = decodeURIComponent(query.name)
|
||||
this.pageTitle = decoded
|
||||
uni.setNavigationBarTitle({ title: decoded })
|
||||
}
|
||||
loadUiConfig()
|
||||
this.init()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<view class="mine-post fc-page">
|
||||
<!-- 规范化顶部导航 -->
|
||||
<fc-navbar title="我的发布" theme="gradient" :show-back="true" />
|
||||
<!-- 状态筛选 + 计数(后台审核/下架后状态一目了然) -->
|
||||
<scroll-view class="mine-post__tabs" scroll-x :show-scrollbar="false">
|
||||
<view class="mine-post__tabs-inner">
|
||||
@@ -64,12 +66,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||||
import postApi from '@/common/api/post.js'
|
||||
import { fromNow } from '@/common/utils/format.js'
|
||||
|
||||
export default {
|
||||
components: { FcEmpty },
|
||||
components: { FcNavbar, FcEmpty },
|
||||
data() {
|
||||
return {
|
||||
tabs: [
|
||||
|
||||
@@ -1,25 +1,47 @@
|
||||
<template>
|
||||
<view class="search fc-page">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search__bar">
|
||||
<view class="search__box">
|
||||
<image class="fc-icon fc-icon--sm" :src="iconUrl('search')" mode="aspectFit" />
|
||||
<input v-model="keyword" class="search__input" confirm-type="search" placeholder="搜索招聘、租房、二手…"
|
||||
placeholder-class="search__ph" @confirm="doSearch" focus />
|
||||
<image v-if="keyword" class="fc-icon fc-icon--sm" :src="iconUrl('close')" mode="aspectFit"
|
||||
@click="keyword = ''" />
|
||||
<!-- 规范化搜索顶栏 -->
|
||||
<view class="search__header">
|
||||
<view class="search__bar">
|
||||
<view class="search__back" @click="onBack">
|
||||
<text class="search__back-icon">‹</text>
|
||||
</view>
|
||||
<view class="search__box">
|
||||
<image class="fc-icon fc-icon--sm" :src="iconUrl('search')" mode="aspectFit" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="search__input"
|
||||
confirm-type="search"
|
||||
placeholder="搜索招聘、租房、二手…"
|
||||
placeholder-class="search__ph"
|
||||
@confirm="doSearch"
|
||||
focus
|
||||
/>
|
||||
<view v-if="keyword" class="search__clear-btn" @click="onClearInput">
|
||||
<text class="search__clear-txt">×</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="search__btn" @click="doSearch">
|
||||
<text class="search__btn-text">搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="search__cancel" @click="doSearch">搜索</text>
|
||||
</view>
|
||||
|
||||
<!-- 历史记录 -->
|
||||
<!-- 历史记录与热门搜索 -->
|
||||
<view v-if="!searched" class="search__block">
|
||||
<view class="search__block-head">
|
||||
<text class="search__block-title">搜索历史</text>
|
||||
<text class="search__block-clear" @click="clearHistory">清空</text>
|
||||
<text v-if="history.length" class="search__block-clear" @click="clearHistory">清空</text>
|
||||
</view>
|
||||
<view class="search__chips">
|
||||
<text v-for="(h, i) in history" :key="i" class="search__chip" @click="pickKeyword(h)">{{ h }}</text>
|
||||
<text
|
||||
v-for="(h, i) in history"
|
||||
:key="i"
|
||||
class="search__chip"
|
||||
@click="pickKeyword(h)"
|
||||
>
|
||||
{{ h }}
|
||||
</text>
|
||||
<text v-if="!history.length" class="search__empty-tip">暂无搜索历史</text>
|
||||
</view>
|
||||
|
||||
@@ -30,18 +52,26 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="search__chips">
|
||||
<text v-for="(h, i) in hotKeywords" :key="i" class="search__chip search__chip--hot"
|
||||
:class="{ 'search__chip--top': i < 3 }" @click="pickKeyword(h)">{{ h }}</text>
|
||||
<text
|
||||
v-for="(h, i) in hotKeywords"
|
||||
:key="i"
|
||||
class="search__chip search__chip--hot"
|
||||
:class="{ 'search__chip--top': i < 3 }"
|
||||
@click="pickKeyword(h)"
|
||||
>
|
||||
{{ h }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果 -->
|
||||
<view v-else class="search__result">
|
||||
<view class="search__result-head">
|
||||
<text>共找到 {{ total }} 条「{{ lastKeyword }}」相关信息</text>
|
||||
<text class="search__result-summary">共找到 {{ total }} 条「{{ lastKeyword }}」相关信息</text>
|
||||
<text class="search__result-reset" @click="searched = false">重新搜索</text>
|
||||
</view>
|
||||
<fc-empty v-if="!list.length" text="没有找到相关信息,换个关键词试试" />
|
||||
<view v-else>
|
||||
<view v-else class="search__list">
|
||||
<fc-post-card v-for="p in list" :key="p.id" :post="p" @click="goDetail" />
|
||||
</view>
|
||||
</view>
|
||||
@@ -74,16 +104,52 @@ export default {
|
||||
this.loadHot()
|
||||
},
|
||||
methods: {
|
||||
/** 暴露图标地址解析工具 */
|
||||
iconUrl,
|
||||
/**
|
||||
* 返回上一页或首页
|
||||
*/
|
||||
onBack() {
|
||||
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
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 清空当前输入的关键词
|
||||
*/
|
||||
onClearInput() {
|
||||
this.keyword = ''
|
||||
},
|
||||
/**
|
||||
* 加载推荐热门搜索词
|
||||
*/
|
||||
async loadHot() {
|
||||
try {
|
||||
this.hotKeywords = await homeApi.hotKeywords()
|
||||
} catch (e) {}
|
||||
},
|
||||
/**
|
||||
* 点击选择关键词并直接发起搜索
|
||||
* @param {string} k 选中的关键词
|
||||
*/
|
||||
pickKeyword(k) {
|
||||
this.keyword = k
|
||||
this.doSearch()
|
||||
},
|
||||
/**
|
||||
* 执行搜索
|
||||
*/
|
||||
async doSearch() {
|
||||
const kw = (this.keyword || '').trim()
|
||||
if (!kw) {
|
||||
@@ -94,24 +160,35 @@ export default {
|
||||
this.saveHistory(kw)
|
||||
try {
|
||||
const res = await homeApi.feed({ keyword: kw, page: 1, size: 20 })
|
||||
this.list = res.list
|
||||
this.total = res.total
|
||||
this.list = res.list || []
|
||||
this.total = res.total || 0
|
||||
this.searched = true
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '搜索失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 将关键词存入本地搜索历史
|
||||
* @param {string} kw 搜索词
|
||||
*/
|
||||
saveHistory(kw) {
|
||||
const list = (this.history || []).filter((x) => x !== kw)
|
||||
list.unshift(kw)
|
||||
this.history = list.slice(0, 10)
|
||||
storage.set(config.storageKeys.history, this.history)
|
||||
},
|
||||
/**
|
||||
* 清空搜索历史
|
||||
*/
|
||||
clearHistory() {
|
||||
this.history = []
|
||||
storage.remove(config.storageKeys.history)
|
||||
uni.showToast({ title: '已清空', icon: 'none' })
|
||||
},
|
||||
/**
|
||||
* 跳转到帖子详情
|
||||
* @param {Object} p 点击的帖子项
|
||||
*/
|
||||
goDetail(p) {
|
||||
uni.navigateTo({ url: `/pages/detail/detail?id=${p.id}` })
|
||||
},
|
||||
@@ -120,88 +197,164 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
min-height: 100vh;
|
||||
background: #f8fafc;
|
||||
}
|
||||
.search__header {
|
||||
background: #ffffff;
|
||||
border-bottom: 2rpx solid $fc-border;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
}
|
||||
.search__bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
background: #ffffff;
|
||||
padding: 16rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.search__back {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
margin-right: 8rpx;
|
||||
border-radius: 50%;
|
||||
transition: background-color 0.2s ease;
|
||||
&:active {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
.search__back-icon {
|
||||
font-size: 52rpx;
|
||||
line-height: 1;
|
||||
color: $fc-text;
|
||||
font-weight: 300;
|
||||
margin-top: -4rpx;
|
||||
}
|
||||
.search__box {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
height: 72rpx;
|
||||
border-radius: $fc-radius-pill;
|
||||
background: $fc-bg;
|
||||
background: #f1f5f9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
min-width: 0;
|
||||
}
|
||||
.search__input {
|
||||
flex: 1;
|
||||
font-size: $fc-font;
|
||||
font-size: 28rpx;
|
||||
margin-left: 12rpx;
|
||||
color: $fc-text;
|
||||
}
|
||||
.search__ph {
|
||||
color: $fc-text-placeholder;
|
||||
}
|
||||
.search__cancel {
|
||||
margin-left: 24rpx;
|
||||
font-size: $fc-font;
|
||||
.search__clear-btn {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 50%;
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.search__clear-txt {
|
||||
font-size: 26rpx;
|
||||
color: #ffffff;
|
||||
line-height: 1;
|
||||
margin-top: -2rpx;
|
||||
}
|
||||
.search__btn {
|
||||
margin-left: 20rpx;
|
||||
padding: 12rpx 16rpx;
|
||||
cursor: pointer;
|
||||
}
|
||||
.search__btn-text {
|
||||
font-size: 28rpx;
|
||||
color: $fc-primary-text;
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
}
|
||||
.search__block {
|
||||
padding: 24rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
}
|
||||
.search__block-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20rpx;
|
||||
&--mt {
|
||||
margin-top: 40rpx;
|
||||
margin-top: 36rpx;
|
||||
}
|
||||
}
|
||||
.search__block-title {
|
||||
font-size: $fc-font-lg;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: $fc-text;
|
||||
}
|
||||
.search__block-clear {
|
||||
font-size: $fc-font-sm;
|
||||
color: $fc-text-secondary;
|
||||
font-size: 24rpx;
|
||||
color: $fc-text-placeholder;
|
||||
cursor: pointer;
|
||||
}
|
||||
.search__chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 20rpx;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.search__chip {
|
||||
padding: 14rpx 28rpx;
|
||||
margin: 0 16rpx 16rpx 0;
|
||||
border-radius: $fc-radius-pill;
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #ffffff;
|
||||
font-size: $fc-font-sm;
|
||||
border: 1rpx solid $fc-border;
|
||||
font-size: 26rpx;
|
||||
color: $fc-text-regular;
|
||||
box-shadow: $fc-shadow;
|
||||
&--hot {
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
&:active {
|
||||
background: $fc-primary-lighter;
|
||||
border-color: $fc-primary;
|
||||
color: $fc-primary-text;
|
||||
}
|
||||
&--hot {
|
||||
background: #ffffff;
|
||||
}
|
||||
&--top {
|
||||
background: $fc-gradient-warm;
|
||||
color: #ffffff;
|
||||
color: $fc-primary-text;
|
||||
font-weight: 600;
|
||||
border-color: rgba(4, 135, 74, 0.3);
|
||||
background: #f7fffb;
|
||||
}
|
||||
}
|
||||
.search__empty-tip {
|
||||
font-size: $fc-font-sm;
|
||||
font-size: 24rpx;
|
||||
color: $fc-text-placeholder;
|
||||
}
|
||||
.search__result {
|
||||
padding-top: 20rpx;
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
.search__result-head {
|
||||
padding: 0 24rpx 20rpx;
|
||||
font-size: $fc-font-sm;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx 32rpx 12rpx;
|
||||
}
|
||||
.search__result-summary {
|
||||
font-size: 24rpx;
|
||||
color: $fc-text-secondary;
|
||||
}
|
||||
.search__result-reset {
|
||||
font-size: 24rpx;
|
||||
color: $fc-primary-text;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
.search__list {
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户