build: 更新正式环境后端域名并删除无用公钥文件

删除了不再使用的公钥文件 pub_key.pem,同时将生产环境的后端域名从原地址更新为新的正式域名,确保项目配置与线上环境匹配。
这个提交包含在:
2026-10-30 15:23:27 +08:00
父节点 aab5f7ae41
当前提交 d812e54f8e
共有 6 个文件被更改,包括 700 次插入 和 138 次删除

查看文件

@@ -85,6 +85,13 @@
.fc-img-wrap .fc-img-zoom img { width: 100%; height: 100%; object-fit: cover; display: block; } .fc-img-wrap .fc-img-zoom img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-img-wrap:hover .fc-img-zoom { opacity: 1; transform: translateX(-50%) scale(1); } .fc-img-wrap:hover .fc-img-zoom { opacity: 1; transform: translateX(-50%) scale(1); }
/* 快捷筛选按钮组 */
.fc-quick-filters { display: inline-flex; vertical-align: middle; margin-left: 8px; border-radius: 8px; overflow: hidden; border: 1px solid #d9f5e6; background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.fc-quick-filters .btn { border: none !important; border-radius: 0 !important; margin: 0 !important; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: #475569; background: #ffffff; transition: all 0.15s ease; }
.fc-quick-filters .btn + .btn { border-left: 1px solid #eef7f2 !important; }
.fc-quick-filters .btn:hover { background: #f2fef7; color: #00a854; }
.fc-quick-filters .btn.active { background: linear-gradient(135deg, #00e070, #00c860) !important; color: #04301e !important; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08); }
/* 分页与信息区 */ /* 分页与信息区 */
.fixed-table-pagination .pagination-detail, .fixed-table-pagination .page-list { color: #64748b; } .fixed-table-pagination .pagination-detail, .fixed-table-pagination .page-list { color: #64748b; }
.fixed-table-pagination .pagination > li > a { border-radius: 8px !important; margin: 0 2px; border: 1px solid #e2e8f0; } .fixed-table-pagination .pagination > li > a { border-radius: 8px !important; margin: 0 2px; border: 1px solid #e2e8f0; }
@@ -108,10 +115,12 @@
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/category/add')?'':'hide'}" title="{:__('Add')}"><i class="fa fa-plus"></i> 添加分类</a> <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/category/add')?'':'hide'}" title="{:__('Add')}"><i class="fa fa-plus"></i> 添加分类</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/category/edit')?'':'hide'}" title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a> <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/category/edit')?'':'hide'}" title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/category/del')?'':'hide'}" title="{:__('Delete')}"><i class="fa fa-trash"></i> {:__('Delete')}</a> <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/category/del')?'':'hide'}" title="{:__('Delete')}"><i class="fa fa-trash"></i> {:__('Delete')}</a>
<span class="btn" style="background:#f0fdf4;color:#16a34a;border:1px solid #bbf7d0;border-radius:8px;font-weight:600;padding:6px 12px;cursor:default;"> <div class="btn-group fc-quick-filters" role="group" aria-label="分类层级快捷筛选">
<i class="fa fa-star text-warning"></i> 金刚区已推荐:<b id="fc-home-count">{$homeCount|default='8'}</b> / 8 个 <a href="javascript:;" class="btn btn-filter-all active" title="显示全部一级与二级分类"><i class="fa fa-list"></i> 全部</a>
</span> <a href="javascript:;" class="btn btn-filter-top" title="仅查看顶级一级大类"><i class="fa fa-folder-open-o"></i> 一级大类</a>
<a href="javascript:;" class="btn btn-default btn-filter-home" style="border:1px solid #dbe6ee;" title="只查看已推荐至首页金刚区的二级品类"><i class="fa fa-star text-warning"></i> 只看金刚区</a> <a href="javascript:;" class="btn btn-filter-sub" title="仅查看二级细分品类"><i class="fa fa-tags"></i> 二级品类</a>
<a href="javascript:;" class="btn btn-filter-home" title="只查看已推荐至首页金刚区的二级品类"><i class="fa fa-star text-warning"></i> 首页金刚区 (<b id="fc-home-count">{$homeCount|default='8'}</b>/8)</a>
</div>
</div> </div>
<table id="table" class="table table-hover table-nowrap fc-cat-table" <table id="table" class="table table-hover table-nowrap fc-cat-table"
data-operate-edit="{:$auth->check('fc/category/edit')}" data-operate-edit="{:$auth->check('fc/category/edit')}"

二进制
online_cb17.jpg 普通文件

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 12 KiB

查看文件

@@ -110,28 +110,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
} }
}, },
// 2.5 所属大类 // 2.5 所属大类(关联实际 pid 字段,支持普通搜索按大类下拉过滤)
{ {
field: 'parent_name', field: 'pid',
title: '上级分类', title: '所属分类',
operate: false,
align: 'center', align: 'center',
width: '120px', width: '130px',
searchList: (Config && Config.parentList) ? Config.parentList : {},
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (!row.pid || Number(row.pid) === 0) { if (!row.pid || Number(row.pid) === 0) {
return '<span class="label" style="background:#ecfdf5;color:#059669;border:1px solid #a7f3d0;border-radius:6px;padding:3px 8px;font-weight:600;">一级大类</span>'; return '<span class="label" style="background:#ecfdf5;color:#059669;border:1px solid #a7f3d0;border-radius:6px;padding:3px 8px;font-weight:600;">一级大类</span>';
} }
return '<span class="label" style="background:#f1f5f9;color:#475569;border-radius:6px;padding:3px 8px;">' + (value || ('#' + row.pid)) + '</span>'; return '<span class="label" style="background:#f1f5f9;color:#475569;border-radius:6px;padding:3px 8px;">' + (row.parent_name || ('#' + row.pid)) + '</span>';
} }
}, },
// 2.6 分类类型(决定发布页是否显示产地规格字段) // 2.6 分类类型(决定发布页是否显示产地规格字段,支持下拉筛选)
{ {
field: 'kind', field: 'kind',
title: '类型', title: '类型',
operate: false,
align: 'center', align: 'center',
width: '100px', width: '100px',
searchList: {'farm': '农产品', 'general': '通用信息'},
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value === 'farm') { if (value === 'farm') {
return '<span class="label" style="background:#ecfdf5;color:#059669;border:1px solid #a7f3d0;border-radius:6px;padding:3px 8px;font-weight:600;">农产品</span>'; return '<span class="label" style="background:#ecfdf5;color:#059669;border:1px solid #a7f3d0;border-radius:6px;padding:3px 8px;font-weight:600;">农产品</span>';
@@ -221,8 +221,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
// 为表格绑定事件 // 为表格绑定事件
Table.api.bindevent(table); Table.api.bindevent(table);
// 快捷筛选:只看首页金刚区推荐分类 /**
$(document).on("click", ".btn-filter-home", function () { * 快捷层级与状态筛选(全部/一级大类/二级品类/首页金刚区推荐)
* @param {Object} filterObj 过滤参数键值对
* @param {Object} opObj 操作符参数键值对
* @param {HTMLElement} activeBtn 触发按钮
*/
function applyQuickFilter(filterObj, opObj, activeBtn) {
$('.fc-quick-filters .btn').removeClass('active');
if (activeBtn) {
$(activeBtn).addClass('active');
}
var options = table.bootstrapTable('getOptions'); var options = table.bootstrapTable('getOptions');
var queryParams = options.queryParams; var queryParams = options.queryParams;
options.pageNumber = 1; options.pageNumber = 1;
@@ -230,13 +239,42 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
var p = typeof queryParams === 'function' ? queryParams(params) : params; var p = typeof queryParams === 'function' ? queryParams(params) : params;
var filter = p.filter ? JSON.parse(p.filter) : {}; var filter = p.filter ? JSON.parse(p.filter) : {};
var op = p.op ? JSON.parse(p.op) : {}; var op = p.op ? JSON.parse(p.op) : {};
filter.is_home = 1;
op.is_home = '='; // 清理快捷筛选旧字段,避免状态叠加冲突
delete filter.pid;
delete op.pid;
delete filter.is_home;
delete op.is_home;
// 合并新条件
$.extend(filter, filterObj);
$.extend(op, opObj);
p.filter = JSON.stringify(filter); p.filter = JSON.stringify(filter);
p.op = JSON.stringify(op); p.op = JSON.stringify(op);
return p; return p;
}; };
table.bootstrapTable('refresh', {}); table.bootstrapTable('refresh', {});
}
// 全部
$(document).on("click", ".btn-filter-all", function () {
applyQuickFilter({}, {}, this);
});
// 仅看一级大类 (pid = 0)
$(document).on("click", ".btn-filter-top", function () {
applyQuickFilter({pid: 0}, {pid: '='}, this);
});
// 仅看二级品类 (pid > 0)
$(document).on("click", ".btn-filter-sub", function () {
applyQuickFilter({pid: 0}, {pid: '>'}, this);
});
// 快捷筛选:只看首页金刚区推荐分类 (is_home = 1)
$(document).on("click", ".btn-filter-home", function () {
applyQuickFilter({is_home: 1}, {is_home: '='}, this);
}); });
}, },

查看文件

@@ -49,7 +49,7 @@ const ENV = IS_PROD ? 'production' : 'development'
// 各环境后端域名(dev=运行 / prod=发行) // 各环境后端域名(dev=运行 / prod=发行)
const HOSTS = { const HOSTS = {
dev: 'https://ff5e582.r9.cpolar.cn', // 本地后端(phpstudy 虚拟域名与端口 9980) dev: 'https://ff5e582.r9.cpolar.cn', // 本地后端(phpstudy 虚拟域名与端口 9980)
prod: 'https://fenleixinxi.gzyakj.com.cn', // 远程正式后端 prod: 'https://shanjianxiaocang.com', // 远程正式后端
} }
// 接口统一前缀 // 接口统一前缀
const API_PREFIX = '/api' const API_PREFIX = '/api'

查看文件

@@ -26,8 +26,9 @@
<!-- 经典双联主体区域 --> <!-- 经典双联主体区域 -->
<view class="cat-main"> <view class="cat-main">
<!-- 左侧一级分类垂直菜单 --> <!-- 左侧一级分类垂直菜单(支持骨架微光占位) -->
<scroll-view class="cat-sidebar" scroll-y :show-scrollbar="false"> <scroll-view class="cat-sidebar" scroll-y :show-scrollbar="false">
<template v-if="categories.length">
<view <view
v-for="c in categories" v-for="c in categories"
:key="c.id" :key="c.id"
@@ -39,51 +40,96 @@
<image class="cat-sidebar__icon" :src="catIcon(c)" mode="aspectFit" /> <image class="cat-sidebar__icon" :src="catIcon(c)" mode="aspectFit" />
<text class="cat-sidebar__name">{{ c.name }}</text> <text class="cat-sidebar__name">{{ c.name }}</text>
</view> </view>
</template>
<template v-else>
<view v-for="n in 5" :key="n" class="cat-sidebar__item cat-sidebar__item--skel">
<view class="cat-sidebar__skel-icon pulse-shimmer"></view>
<view class="cat-sidebar__skel-name pulse-shimmer"></view>
</view>
</template>
</scroll-view> </scroll-view>
<!-- 右侧内容区域(二级分类实拍宫格 + 排序 + 信息流) --> <!-- 右侧内容区域(支持下拉刷新、骨架屏微光缓冲、平滑切换) -->
<scroll-view <scroll-view
class="cat-content" class="cat-content"
scroll-y scroll-y
:show-scrollbar="false" :show-scrollbar="false"
refresher-enabled
:refresher-triggered="isRefreshing"
refresher-background="#f2fef7"
@refresherrefresh="onPullDownRefresh"
@scrolltolower="loadMore" @scrolltolower="loadMore"
> >
<!-- 二级分类图文宫格(3×3 固定展示:超出在该区域内上下滚动,高度不随分类数变化,杜绝页面跳动) --> <!-- 二级分类图文宫格(3×3 固定展示:超出在该区域内上下滚动,高度不随分类数变化,杜绝页面跳动) -->
<view v-if="currentSubCategories.length" class="cat-subcard"> <view v-if="currentSubCategories.length" class="cat-subcard">
<view class="cat-subcard__head"> <view class="cat-subcard__head">
<text class="cat-subcard__title">{{ currentCategory ? currentCategory.name : '精选' }}品类</text> <view class="cat-subcard__head-left">
<text v-if="currentSubCategory" class="cat-subcard__reset" @click="selectSubCategory(null)">查看全部 ›</text> <text class="cat-subcard__title">{{ categorySectionTitle }}</text>
<view v-if="currentSubCategory" class="cat-subcard__active-pill" @click="selectSubCategory(null)">
<text class="cat-subcard__active-pill-txt">{{ currentSubCategory.name }}</text>
<text class="cat-subcard__active-pill-close">✕</text>
</view>
</view>
<!-- 右上角二级品类微搜索 -->
<view class="cat-subcard__search">
<image class="cat-subcard__search-icon" :src="iconUrl('search')" mode="aspectFit" />
<input
v-model="subKeyword"
class="cat-subcard__search-input"
placeholder="找品类…"
placeholder-class="cat-subcard__search-ph"
/>
<view v-if="subKeyword" class="cat-subcard__search-clear" @click.stop="subKeyword = ''">
<text class="cat-subcard__search-clear-txt">×</text>
</view>
</view>
</view> </view>
<scroll-view <scroll-view
class="cat-subgrid-scroll" class="cat-subgrid-scroll"
scroll-y scroll-y
:show-scrollbar="false" :show-scrollbar="false"
:style="currentSubCategories.length + 1 > 9 ? 'height: 474rpx' : ''" :style="(displaySubCategories.length + (subKeyword ? 0 : 1)) > 9 ? 'height: 474rpx' : ''"
> >
<view class="cat-subgrid"> <view v-if="displaySubCategories.length > 0 || !subKeyword" class="cat-subgrid">
<view <view
v-if="!subKeyword"
class="cat-subgrid__item" class="cat-subgrid__item"
:class="{ 'cat-subgrid__item--active': !currentSubCategory }" :class="{ 'cat-subgrid__item--active': !currentSubCategory }"
@click="selectSubCategory(null)" @click="selectSubCategory(null)"
> >
<view class="cat-subgrid__thumb"> <view class="cat-subgrid__thumb">
<image class="cat-subgrid__img" :src="catIcon(currentCategory)" mode="aspectFill" /> <image class="cat-subgrid__img" :src="catIcon(currentCategory)" mode="aspectFill" />
<view v-if="!currentSubCategory" class="cat-subgrid__badge">✓</view>
</view> </view>
<text class="cat-subgrid__name">全部</text> <text class="cat-subgrid__name">全部</text>
</view> </view>
<view <view
v-for="sub in currentSubCategories" v-for="sub in displaySubCategories"
:key="sub.id" :key="sub.id"
class="cat-subgrid__item" class="cat-subgrid__item"
:class="{ 'cat-subgrid__item--active': currentSubCategory && Number(currentSubCategory.id) === Number(sub.id) }" :class="{ 'cat-subgrid__item--active': currentSubCategory && Number(currentSubCategory.id) === Number(sub.id) }"
@click="selectSubCategory(sub)" @click="selectSubCategory(sub)"
> >
<view class="cat-subgrid__thumb"> <view class="cat-subgrid__thumb">
<image class="cat-subgrid__img" :src="catIcon(sub)" mode="aspectFill" /> <image
class="cat-subgrid__img"
:src="catSubThumb(sub)"
mode="aspectFill"
@error="handleSubImgError(sub)"
/>
<view
v-if="currentSubCategory && Number(currentSubCategory.id) === Number(sub.id)"
class="cat-subgrid__badge"
>✓</view>
</view> </view>
<text class="cat-subgrid__name">{{ sub.name }}</text> <text class="cat-subgrid__name">{{ sub.name }}</text>
</view> </view>
</view> </view>
<!-- 搜索品类无匹配结果提示 -->
<view v-else class="cat-subgrid-empty">
<text class="cat-subgrid-empty__txt">未找到“{{ subKeyword }}”相关品类</text>
<text class="cat-subgrid-empty__clear" @click="subKeyword = ''">清空搜索</text>
</view>
</scroll-view> </scroll-view>
</view> </view>
@@ -110,8 +156,23 @@
</view> </view>
</view> </view>
<!-- 信息流列表:使用 compact 紧凑模式,适配窄容器,杜绝任何文字折行 --> <!-- 骨架屏:首屏无缓存或初次加载且列表为空时展示,微光呼吸,杜绝大片白屏空白 -->
<view v-if="list.length" class="cat-list"> <view v-if="loading && (!list.length || isInitialLoading)" class="cat-skeleton-wrap">
<view v-for="n in 3" :key="n" class="cat-skeleton-card">
<view class="cat-skeleton-thumb pulse-shimmer"></view>
<view class="cat-skeleton-info">
<view class="cat-skeleton-line cat-skeleton-line--title pulse-shimmer"></view>
<view class="cat-skeleton-line cat-skeleton-line--sub pulse-shimmer"></view>
<view class="cat-skeleton-row">
<view class="cat-skeleton-pill pulse-shimmer"></view>
<view class="cat-skeleton-price pulse-shimmer"></view>
</view>
</view>
</view>
</view>
<!-- 信息流列表:使用 compact 紧凑模式,平滑过渡防闪烁 -->
<view v-else-if="list.length" class="cat-list" :class="{ 'cat-list--switching': isSwitching }">
<fc-post-card <fc-post-card
v-for="item in list" v-for="item in list"
:key="item.id" :key="item.id"
@@ -119,20 +180,33 @@
:compact="true" :compact="true"
@click="goDetail" @click="goDetail"
/> />
<view v-if="loading" class="cat-loading">正在加载中...</view> <view v-if="loading" class="cat-loading-bar">
<view v-else-if="!hasMore" class="cat-nomore">— 没有更多信息了 —</view> <view class="cat-loading-spinner"></view>
<text class="cat-loading-txt">正在为您寻找好物…</text>
</view>
<view v-else-if="!hasMore" class="cat-nomore-bar">
<text class="cat-nomore-txt">— 已呈现全部同城信息 —</text>
</view>
</view> </view>
<!-- 空状态 --> <!-- 空状态:紧凑微质感卡片,融入右侧信息流,首屏完整可视 -->
<view v-else-if="!loading" class="cat-empty-wrap"> <view v-else-if="!loading" class="cat-empty-card">
<template v-if="keyword && keyword.trim()"> <image class="cat-empty-card__icon" :src="iconUrl(keyword ? 'search' : 'inbox')" mode="aspectFit" />
<fc-empty icon="search" :text="'在当前分类未找到「' + keyword + '」相关信息'" /> <text class="cat-empty-card__title">
<button class="cat-empty-btn" @click="handleClear">清空搜索条件</button> {{ keyword ? '未找到「' + keyword + '」相关信息' : (currentSubCategory ? '暂无「' + currentSubCategory.name + '」相关发布' : '该品类下暂无发布信息') }}
</template> </text>
<template v-else> <text class="cat-empty-card__desc">抢先发布此分类,让同城人脉第一眼发现</text>
<fc-empty icon="inbox" text="该分类下暂无信息,快来抢先发布吧!" /> <view class="cat-empty-card__actions">
<button class="cat-empty-btn" @click="goPublish">立即发布此分类</button> <button v-if="keyword" class="cat-empty-card__btn cat-empty-card__btn--sub" @click="handleClear">
</template> 清空搜索
</button>
<button v-if="currentSubCategory" class="cat-empty-card__btn cat-empty-card__btn--sub" @click="selectSubCategory(null)">
查看全部
</button>
<button class="cat-empty-card__btn cat-empty-card__btn--primary" @click="goPublish">
立即发布
</button>
</view>
</view> </view>
<!-- 底部留白防止遮挡 --> <!-- 底部留白防止遮挡 -->
@@ -248,6 +322,8 @@ import { groupAreaTree } from '@/common/utils/area.js'
// 与首页共享的区域选择缓存(两端区域筛选状态互通) // 与首页共享的区域选择缓存(两端区域筛选状态互通)
const STORAGE_KEY_SELECTED_AREA = 'fc_user_selected_area' const STORAGE_KEY_SELECTED_AREA = 'fc_user_selected_area'
// 分类数据快照缓存(实现 0ms 秒开无白屏)
const STORAGE_KEY_CATEGORIES = 'fc_cached_categories_v2'
/** /**
* 安全读取本地缓存 * 安全读取本地缓存
@@ -282,6 +358,10 @@ export default {
navBarHeight: 44, navBarHeight: 44,
capsulePadding: 0, capsulePadding: 0,
keyword: '', keyword: '',
// 二级品类过滤搜索关键词
subKeyword: '',
// 图片加载失败映射表(防止宫格出现浅灰空块,支持降级为精美微插画)
failedSubImgIds: {},
categories: [], categories: [],
currentCategory: null, currentCategory: null,
currentSubCategory: null, currentSubCategory: null,
@@ -310,6 +390,12 @@ export default {
total: 0, total: 0,
hasMore: true, hasMore: true,
loading: false, loading: false,
// 页面首次初始化加载骨架状态
isInitialLoading: true,
// 分类切换平滑过渡状态(防止旧列表瞬间销毁导致的猛烈闪屏抖动)
isSwitching: false,
// 下拉刷新触发状态
isRefreshing: false,
// 请求序号:切换分类/排序/搜索时丢弃过期响应,避免「点了筛选但列表没变」 // 请求序号:切换分类/排序/搜索时丢弃过期响应,避免「点了筛选但列表没变」
reqSeq: 0, reqSeq: 0,
lat: null, lat: null,
@@ -321,8 +407,18 @@ export default {
* 输入框占位文案,动态根据当前选中一级/二级分类切换 * 输入框占位文案,动态根据当前选中一级/二级分类切换
*/ */
searchPlaceholder() { searchPlaceholder() {
const name = (this.currentSubCategory && this.currentSubCategory.name) || (this.currentCategory ? this.currentCategory.name : '农产品') const name = (this.currentSubCategory && this.currentSubCategory.name) || (this.currentCategory ? this.currentCategory.name : '全部分类')
return '在“' + name + '”中搜索…' return '搜索“' + name + '”信息…'
},
/**
* 二级品类区域标题(例如:“招聘品类”、“水果品类”、“精选品类”)
* 消除冗长复杂的“专区品类”字样,提升右上角区域呼吸感
* @returns {string} 优化后的分类标题
*/
categorySectionTitle() {
if (!this.currentCategory || !this.currentCategory.name) return '精选品类'
const raw = this.currentCategory.name.trim()
return raw.replace(/专区$/, '') + '品类'
}, },
/** /**
* 当前一级分类下的二级分类列表 * 当前一级分类下的二级分类列表
@@ -331,6 +427,18 @@ export default {
if (!this.currentCategory || !Array.isArray(this.currentCategory.children)) return [] if (!this.currentCategory || !Array.isArray(this.currentCategory.children)) return []
return this.currentCategory.children return this.currentCategory.children
}, },
/**
* 经过二级分类搜索关键词过滤后的展示品类列表
* @returns {Array} 过滤后的二级分类数组
*/
displaySubCategories() {
const list = this.currentSubCategories
if (!this.subKeyword || !this.subKeyword.trim()) {
return list
}
const kw = this.subKeyword.trim().toLowerCase()
return list.filter((item) => item && item.name && item.name.toLowerCase().includes(kw))
},
/** /**
* 区域筛选按钮文案(市 > 省 > 全国) * 区域筛选按钮文案(市 > 省 > 全国)
*/ */
@@ -377,6 +485,43 @@ export default {
iconUrl, iconUrl,
/** 暴露给模板:分类图标解析 */ /** 暴露给模板:分类图标解析 */
categoryIconUrl, categoryIconUrl,
/**
* 解析二级分类图标(含加载失败自动降级与预设行业插画兜底,彻底解决空白浅灰块)
* @param {Object} sub 二级分类对象
* @returns {string} 可靠的图片或图标真实地址
*/
catSubThumb(sub) {
if (!sub) return catIcon(this.currentCategory)
if (this.failedSubImgIds && this.failedSubImgIds[sub.id]) {
return this.fallbackSubIcon(sub)
}
return catIcon(sub)
},
/**
* 根据分类名称回退到包内最贴合的高清矢量微插画
* @param {Object} sub 二级分类对象
* @returns {string} 兜底矢量图标地址
*/
fallbackSubIcon(sub) {
const name = (sub && sub.name) || ''
if (/技工|普工|制造|工厂/i.test(name)) return iconUrl('cat-job')
if (/餐饮|服务|厨师|服务员/i.test(name)) return iconUrl('cat-service')
if (/保洁|家政|清洁/i.test(name)) return iconUrl('cat-clean')
if (/教育|培训|老师|辅导/i.test(name)) return iconUrl('cat-education')
if (/司机|出行|货运|代驾/i.test(name)) return iconUrl('cat-car')
if (/兼职|短工/i.test(name)) return iconUrl('cat-job')
return catIcon(this.currentCategory)
},
/**
* 二级分类图片加载失败容错处理
* @param {Object} sub 二级分类对象
* @returns {void}
*/
handleSubImgError(sub) {
if (!sub || !sub.id) return
if (!this.failedSubImgIds) this.failedSubImgIds = {}
this.$set(this.failedSubImgIds, sub.id, true)
},
/** /**
* 初始化设备导航栏与胶囊避让度量 * 初始化设备导航栏与胶囊避让度量
*/ */
@@ -434,14 +579,41 @@ export default {
} catch (e) {} } catch (e) {}
}, },
/** /**
* 拉取全部分类数据(支持默认选中一级或二级分类) * 拉取全部分类数据(快照缓存秒开 + 后台静默对齐)
* @param {string|number} defaultCatId 默认选中的分类 ID * @param {string|number} defaultCatId 默认选中的分类 ID
* @returns {Promise<void>}
*/ */
async fetchCategories(defaultCatId) { async fetchCategories(defaultCatId) {
// 1. 优先读取本地持久化快照,0ms 立即挂载大类与二级品类
const cached = safeGetStorage(STORAGE_KEY_CATEGORIES, null)
if (Array.isArray(cached) && cached.length) {
this.applyCategoriesTree(cached, defaultCatId, !this.list.length)
}
try { try {
const cats = await homeApi.categories() const cats = await homeApi.categories()
this.categories = Array.isArray(cats) ? cats : [] const list = Array.isArray(cats) ? cats : []
if (this.categories.length) { if (list.length) {
safeSetStorage(STORAGE_KEY_CATEGORIES, list)
this.applyCategoriesTree(list, defaultCatId, true)
}
} catch (e) {
if (!this.categories || !this.categories.length) {
uni.showToast({ title: '分类加载失败', icon: 'none' })
}
} finally {
this.isInitialLoading = false
}
},
/**
* 统一解析并挂载分类树结构
* @param {Array} cats 分类原始数据列表
* @param {string|number} defaultCatId 默认选中的分类ID
* @param {boolean} shouldFetchPosts 是否自动触发信息流拉取
* @returns {void}
*/
applyCategoriesTree(cats, defaultCatId, shouldFetchPosts = true) {
this.categories = cats
if (!this.categories.length) return
let targetParent = null let targetParent = null
let targetSub = null let targetSub = null
if (defaultCatId) { if (defaultCatId) {
@@ -457,34 +629,38 @@ export default {
} }
} }
} }
if (this.currentCategory) {
const exist = this.categories.find((c) => c.id === this.currentCategory.id)
this.currentCategory = exist || this.categories[0]
} else {
this.currentCategory = targetParent || this.categories[0] this.currentCategory = targetParent || this.categories[0]
this.currentSubCategory = targetSub || null this.currentSubCategory = targetSub || null
this.page = 1
this.list = []
this.hasMore = true
this.fetchPosts()
} }
} catch (e) { if (shouldFetchPosts) {
uni.showToast({ title: '分类加载失败', icon: 'none' }) this.fetchPosts(false)
} }
}, },
/** /**
* 切换当前选中的左侧一级大类 * 切换当前选中的左侧一级大类(平滑过渡防闪烁)
* @param {Object} cat 选中的一级分类对象 * @param {Object} cat 选中的一级分类对象
* @returns {void}
*/ */
selectCategory(cat) { selectCategory(cat) {
if (!cat) return if (!cat) return
if (this.currentCategory && this.currentCategory.id === cat.id && !this.currentSubCategory) return if (this.currentCategory && this.currentCategory.id === cat.id && !this.currentSubCategory) return
this.currentCategory = cat this.currentCategory = cat
this.currentSubCategory = null this.currentSubCategory = null
this.subKeyword = '' // 切换一级大类时重置二级品类搜索
this.page = 1 this.page = 1
this.list = []
this.hasMore = true this.hasMore = true
this.fetchPosts() // 开启平滑过渡,不先置空旧列表,杜绝视口高度剧烈塌陷与白屏闪烁
this.isSwitching = true
this.fetchPosts(false)
}, },
/** /**
* 切换右侧二级分类(如:花菜、白菜、紫甘蓝、青甘蓝、青菜等) * 切换右侧二级分类(如:花菜、白菜、紫甘蓝、青甘蓝、青菜等)
* @param {Object|null} sub 二级分类对象(null代表当前大类全部) * @param {Object|null} sub 二级分类对象(null代表当前大类全部)
* @returns {void}
*/ */
selectSubCategory(sub) { selectSubCategory(sub) {
const nextId = sub ? Number(sub.id) : 0 const nextId = sub ? Number(sub.id) : 0
@@ -492,13 +668,14 @@ export default {
if (nextId === curId) return if (nextId === curId) return
this.currentSubCategory = sub || null this.currentSubCategory = sub || null
this.page = 1 this.page = 1
this.list = []
this.hasMore = true this.hasMore = true
this.fetchPosts() this.isSwitching = true
this.fetchPosts(false)
}, },
/** /**
* 切换排序规则(价格项:首次点击升序,再次点击升降序来回切换) * 切换排序规则(价格项:首次点击升序,再次点击升降序来回切换)
* @param {string} s 排序值 new|hot|nearby|price * @param {string} s 排序值 new|hot|nearby|price
* @returns {void}
*/ */
changeSort(s) { changeSort(s) {
if (s === 'price') { if (s === 'price') {
@@ -512,9 +689,9 @@ export default {
} }
this.sort = s this.sort = s
this.page = 1 this.page = 1
this.list = []
this.hasMore = true this.hasMore = true
this.fetchPosts() this.isSwitching = true
this.fetchPosts(false)
// 「附近」依赖坐标:无坐标时补取一次定位(成功后自动重排) // 「附近」依赖坐标:无坐标时补取一次定位(成功后自动重排)
if (s === 'nearby' && (!this.lat || !this.lng)) { if (s === 'nearby' && (!this.lat || !this.lng)) {
uni.showToast({ title: '正在获取定位…', icon: 'none' }) uni.showToast({ title: '正在获取定位…', icon: 'none' })
@@ -688,12 +865,34 @@ export default {
}) })
}, },
/** /**
* 获取当前分类下的信息列表(支持关键字在当前页面直接检索) * 下拉刷新:重新获取分类与当前列表数据(支持下拉动画指示)
* @returns {Promise<void>}
*/ */
async fetchPosts() { async onPullDownRefresh() {
this.isRefreshing = true
this.page = 1
try {
await Promise.all([
this.fetchCategories(this.currentCategory ? this.currentCategory.id : null),
this.fetchPosts(false)
])
} finally {
this.isRefreshing = false
uni.stopPullDownRefresh()
}
},
/**
* 获取当前分类下的信息列表(支持关键字在当前页面直接检索)
* @param {boolean} isLoadMore 是否为触底加载下一页数据
* @returns {Promise<void>}
*/
async fetchPosts(isLoadMore = false) {
if (!this.currentCategory) return if (!this.currentCategory) return
const seq = ++this.reqSeq const seq = ++this.reqSeq
this.loading = true this.loading = true
if (!isLoadMore) {
this.isSwitching = true
}
try { try {
const params = { const params = {
categoryId: this.currentCategory.id, categoryId: this.currentCategory.id,
@@ -724,16 +923,22 @@ export default {
if (seq !== this.reqSeq) return if (seq !== this.reqSeq) return
uni.showToast({ title: '加载信息失败', icon: 'none' }) uni.showToast({ title: '加载信息失败', icon: 'none' })
} finally { } finally {
if (seq === this.reqSeq) this.loading = false if (seq === this.reqSeq) {
this.loading = false
this.isSwitching = false
this.isInitialLoading = false
this.isRefreshing = false
}
} }
}, },
/** /**
* 触底加载下一页数据 * 触底加载下一页数据
* @returns {void}
*/ */
loadMore() { loadMore() {
if (this.hasMore && !this.loading) { if (this.hasMore && !this.loading) {
this.page += 1 this.page += 1
this.fetchPosts() this.fetchPosts(true)
} }
}, },
/** /**
@@ -904,6 +1109,22 @@ export default {
transform: scale(1.06); transform: scale(1.06);
} }
} }
&--skel {
pointer-events: none;
}
}
.cat-sidebar__skel-icon {
width: 34rpx;
height: 34rpx;
border-radius: 8rpx;
flex-shrink: 0;
background: #edf2f0;
}
.cat-sidebar__skel-name {
width: 100rpx;
height: 24rpx;
border-radius: 6rpx;
background: #edf2f0;
} }
.cat-sidebar__bar { .cat-sidebar__bar {
position: absolute; position: absolute;
@@ -955,16 +1176,123 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0 6rpx 14rpx; padding: 0 4rpx 14rpx;
gap: 12rpx;
}
.cat-subcard__head-left {
display: flex;
align-items: center;
gap: 10rpx;
min-width: 0;
flex: 1;
} }
.cat-subcard__title { .cat-subcard__title {
font-size: 26rpx; font-size: 26rpx;
font-weight: 700; font-weight: 700;
color: #1e293b; color: #1e293b;
white-space: nowrap;
} }
.cat-subcard__reset { /* 当前选中的二级品类微胶囊标签 */
.cat-subcard__active-pill {
display: inline-flex;
align-items: center;
gap: 6rpx;
background: #ecfdf5;
border: 1rpx solid #a7f3d0;
padding: 2rpx 12rpx;
border-radius: 999rpx;
max-width: 170rpx;
cursor: pointer;
transition: opacity 0.15s ease;
&:active {
opacity: 0.8;
}
}
.cat-subcard__active-pill-txt {
font-size: 21rpx;
color: #00a854;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cat-subcard__active-pill-close {
font-size: 18rpx;
color: #00a854;
opacity: 0.75;
line-height: 1;
}
/* 右上角二级品类微搜索条 */
.cat-subcard__search {
display: flex;
align-items: center;
background: #f4fbf7;
border: 1rpx solid #d1fae5;
border-radius: 999rpx;
height: 52rpx;
padding: 0 14rpx;
box-sizing: border-box;
width: 200rpx;
flex-shrink: 0;
transition: all 0.2s ease;
&:focus-within {
background: #ffffff;
border-color: #00d26a;
box-shadow: 0 0 0 2rpx rgba(0, 210, 106, 0.15);
}
}
.cat-subcard__search-icon {
width: 24rpx;
height: 24rpx;
flex-shrink: 0;
opacity: 0.6;
}
.cat-subcard__search-input {
flex: 1;
height: 100%;
font-size: 21rpx;
color: #1e293b;
padding: 0 6rpx;
min-width: 0;
}
.cat-subcard__search-ph {
font-size: 21rpx;
color: #94a3b8;
}
.cat-subcard__search-clear {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
background: #cbd5e1;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.cat-subcard__search-clear-txt {
font-size: 19rpx;
color: #ffffff;
line-height: 1;
margin-top: -2rpx;
}
.cat-subgrid-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 36rpx 16rpx;
gap: 12rpx;
}
.cat-subgrid-empty__txt {
font-size: 23rpx;
color: #94a3b8;
}
.cat-subgrid-empty__clear {
font-size: 22rpx; font-size: 22rpx;
color: #00a854; color: #00a854;
background: #ecfdf5;
padding: 6rpx 20rpx;
border-radius: 999rpx;
font-weight: 600; font-weight: 600;
} }
/* 二级品类宫格:≤9 个自适应高度不滚动;>9 个锁 3 行高度(474rpx)区域内上下滚动 */ /* 二级品类宫格:≤9 个自适应高度不滚动;>9 个锁 3 行高度(474rpx)区域内上下滚动 */
@@ -980,13 +1308,17 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 8rpx 6rpx 16rpx; padding: 10rpx 6rpx 14rpx;
box-sizing: border-box; box-sizing: border-box;
position: relative;
transition: all 0.15s ease;
&--active { &--active {
.cat-subgrid__thumb { .cat-subgrid__thumb {
border-color: #00d26a; border-color: #00d26a;
background: #ecfdf5; background: #ecfdf5;
box-shadow: 0 4rpx 12rpx rgba(0, 210, 106, 0.22); box-shadow: 0 6rpx 16rpx rgba(0, 210, 106, 0.26);
transform: scale(1.03);
} }
.cat-subgrid__name { .cat-subgrid__name {
color: #00a854; color: #00a854;
@@ -995,29 +1327,53 @@ export default {
} }
} }
.cat-subgrid__thumb { .cat-subgrid__thumb {
width: 96rpx; width: 98rpx;
height: 96rpx; height: 98rpx;
border-radius: 24rpx; border-radius: 22rpx;
background: #f8fafc; background: #f8fafc;
border: 2rpx solid transparent; border: 2.5rpx solid transparent;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 8rpx;
box-sizing: border-box; box-sizing: border-box;
transition: all 0.15s ease; position: relative;
overflow: hidden;
transition: all 0.18s ease;
} }
.cat-subgrid__img { .cat-subgrid__img {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 16rpx; display: block;
}
/* 选中态右上角微质感小圆勾 */
.cat-subgrid__badge {
position: absolute;
right: 4rpx;
top: 4rpx;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
background: #00d26a;
color: #ffffff;
font-size: 18rpx;
font-weight: 800;
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
box-shadow: 0 2rpx 6rpx rgba(0, 210, 106, 0.4);
z-index: 2;
} }
.cat-subgrid__name { .cat-subgrid__name {
margin-top: 8rpx; margin-top: 10rpx;
font-size: 23rpx; font-size: 23rpx;
color: #334155; color: #334155;
text-align: center; text-align: center;
line-height: 1.25; line-height: 1.25;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
/* 排序切换:轻巧微胶囊风格(价格项带升/降序双三角,右侧为区域筛选) */ /* 排序切换:轻巧微胶囊风格(价格项带升/降序双三角,右侧为区域筛选) */
@@ -1025,26 +1381,26 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
background: #ffffff; background: #ffffff;
border-radius: $fc-radius; border-radius: 20rpx;
padding: 6rpx 10rpx; padding: 8rpx 12rpx;
margin-bottom: 14rpx; margin-bottom: 14rpx;
box-shadow: 0 2rpx 8rpx rgba(4, 48, 30, 0.04); box-shadow: 0 2rpx 10rpx rgba(4, 48, 30, 0.04);
} }
.cat-sort__item { .cat-sort__item {
cursor: pointer; cursor: pointer;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
flex-shrink: 0; flex-shrink: 0;
font-size: 23rpx; font-size: 24rpx;
color: $fc-text-secondary; color: #64748b;
padding: 8rpx 10rpx; padding: 8rpx 14rpx;
border-radius: 999rpx; border-radius: 999rpx;
transition: all 0.15s ease; transition: all 0.15s ease;
&--active { &--active {
color: $fc-primary-text; color: #00a854;
font-weight: 700; font-weight: 700;
background: $fc-primary-lighter; background: #ecfdf5;
} }
} }
/* 价格排序双三角指示器(未选中灰、选中主题绿) */ /* 价格排序双三角指示器(未选中灰、选中主题绿) */
@@ -1085,6 +1441,11 @@ export default {
background: #f2fef7; background: #f2fef7;
border: 1rpx solid rgba(0, 168, 84, 0.2); border: 1rpx solid rgba(0, 168, 84, 0.2);
border-radius: 999rpx; border-radius: 999rpx;
cursor: pointer;
transition: opacity 0.15s ease;
&:active {
opacity: 0.8;
}
} }
.cat-sort__area-icon { .cat-sort__area-icon {
width: 24rpx; width: 24rpx;
@@ -1096,7 +1457,7 @@ export default {
font-size: 22rpx; font-size: 22rpx;
color: #00a854; color: #00a854;
font-weight: 600; font-weight: 600;
max-width: 96rpx; max-width: 120rpx;
} }
.cat-sort__area-arrow { .cat-sort__area-arrow {
font-size: 18rpx; font-size: 18rpx;
@@ -1104,37 +1465,200 @@ export default {
margin-left: 2rpx; margin-left: 2rpx;
} }
/* 信息流列表 */ /* 骨架屏微光流卡片 */
.cat-skeleton-wrap {
display: flex;
flex-direction: column;
gap: 14rpx;
margin-top: 4rpx;
}
.cat-skeleton-card {
background: #ffffff;
border-radius: 20rpx;
padding: 16rpx;
display: flex;
gap: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(4, 48, 30, 0.03);
}
.cat-skeleton-thumb {
width: 140rpx;
height: 140rpx;
border-radius: 16rpx;
flex-shrink: 0;
background: #edf3f0;
}
.cat-skeleton-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 4rpx 0;
}
.cat-skeleton-line {
height: 26rpx;
border-radius: 8rpx;
background: #edf3f0;
&--title {
width: 85%;
}
&--sub {
width: 55%;
height: 22rpx;
}
}
.cat-skeleton-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.cat-skeleton-pill {
width: 90rpx;
height: 28rpx;
border-radius: 8rpx;
background: #edf3f0;
}
.cat-skeleton-price {
width: 110rpx;
height: 32rpx;
border-radius: 8rpx;
background: #edf3f0;
}
/* 呼吸微光动效 */
.pulse-shimmer {
animation: pulseShimmer 1.4s ease-in-out infinite;
}
@keyframes pulseShimmer {
0% {
opacity: 0.55;
background: #edf5f0;
}
50% {
opacity: 1;
background: #d8eee1;
}
100% {
opacity: 0.55;
background: #edf5f0;
}
}
/* 信息流列表:支持平滑遮罩切换防闪烁 */
.cat-list { .cat-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} transition: opacity 0.18s ease;
.cat-loading,
.cat-nomore { &--switching {
text-align: center; opacity: 0.55;
padding: 24rpx 0; pointer-events: none;
font-size: 22rpx; }
color: $fc-text-placeholder;
} }
/* 空状态卡片 */ /* 底部加载中指示条 */
.cat-empty-wrap { .cat-loading-bar {
padding: 60rpx 0; display: flex;
align-items: center;
justify-content: center;
padding: 24rpx 0;
gap: 12rpx;
}
.cat-loading-spinner {
width: 28rpx;
height: 28rpx;
border: 3rpx solid #d1fae5;
border-top-color: #00d26a;
border-radius: 50%;
animation: catSpin 0.7s linear infinite;
}
@keyframes catSpin {
to {
transform: rotate(360deg);
}
}
.cat-loading-txt {
font-size: 22rpx;
color: #64748b;
}
/* 触底提示条 */
.cat-nomore-bar {
display: flex;
align-items: center;
justify-content: center;
padding: 28rpx 0;
}
.cat-nomore-txt {
font-size: 22rpx;
color: #94a3b8;
letter-spacing: 0.5rpx;
}
/* 紧凑微质感空状态卡片:首屏完整呈现,双引导操作 */
.cat-empty-card {
background: #ffffff;
border-radius: 20rpx;
padding: 44rpx 20rpx 40rpx;
margin-top: 4rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
box-shadow: 0 2rpx 10rpx rgba(4, 48, 30, 0.04);
} }
.cat-empty-btn { .cat-empty-card__icon {
margin-top: 30rpx; width: 90rpx;
height: 68rpx; height: 90rpx;
line-height: 68rpx; margin-bottom: 14rpx;
padding: 0 44rpx; opacity: 0.85;
background: $fc-gradient-primary; }
color: $fc-primary-ink; .cat-empty-card__title {
font-size: 26rpx; font-size: 26rpx;
font-weight: 700; font-weight: 700;
border-radius: 34rpx; color: #1e293b;
box-shadow: 0 6rpx 18rpx rgba(0, 224, 112, 0.4); text-align: center;
line-height: 1.4;
max-width: 92%;
}
.cat-empty-card__desc {
margin-top: 8rpx;
font-size: 22rpx;
color: #94a3b8;
text-align: center;
}
.cat-empty-card__actions {
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
margin-top: 26rpx;
flex-wrap: wrap;
}
.cat-empty-card__btn {
height: 64rpx;
line-height: 64rpx;
padding: 0 32rpx;
border-radius: 999rpx;
font-size: 24rpx;
font-weight: 600;
margin: 0;
border: none;
&::after {
border: none;
}
&--primary {
background: $fc-gradient-primary;
color: $fc-primary-ink;
box-shadow: 0 4rpx 14rpx rgba(0, 224, 112, 0.32);
}
&--sub {
background: #f1f5f9;
color: #475569;
border: 1rpx solid #e2e8f0;
}
&:active {
transform: scale(0.97);
opacity: 0.9;
}
} }
.cat-content__space { .cat-content__space {

查看文件

@@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7QW1+UaVd76VUmnEWZ8Z
pkUFQcK3QElxwKhb8fuY6i+DZR/i6MNI9GEW2N/4qWa/WRHHx9jwOas8ORyp1f8/
CgY1aGhC9h/m9B7IJHGb9zJXxQnkJOLaOYk8g5p2wGG1THVLNryy/8KKRwCdZJ/P
gy5MB3hteK/5rp1/HMnVMdHrCHgt9L+diyNGb7FW6d2RT5vM2+jRrdbpiFwIuQYT
+uGMQyE9qKdnAlTvqr4J/T0dtdBd6vidEktEDb+UnPsufa5LWk2MbF66diw6TE8w
lcsX7EvSJEd1tVBHn6MOeHoEs1iqfKI557fCTlLitGk4SszlKusR0OmbrEVhBigV
uQIDAQAB
-----END PUBLIC KEY-----