feat(页面组件): 新增图片组件和页面顶部导航组件

- 新增 images.vue 图片组件,支持图片展示、链接跳转和二维码长按识别
- 新增 pageTopbar.vue 页面顶部导航组件,支持自定义标题、返回按钮和样式配置
- 在首页和专题页中注册并使用新增组件
- 优化 homeComb.vue 组件,添加选项卡轮播显示控制逻辑
- 添加 DIY 组件调试日志功能,便于开发调试
- 修复缓存读取空值时的默认值处理
This commit is contained in:
2026-04-16 19:51:08 +08:00
parent a5c5d753b6
commit 797724c01d
6 changed files with 545 additions and 7 deletions

View File

@@ -11,6 +11,7 @@
<userInfor v-if="item.name == 'userInfor'" :dataConfig="item" @changeLogin="changeLogin">
</userInfor>
<newVip v-if="item.name == 'newVip'" :dataConfig="item"></newVip>
<pageTopbar v-if="item.name == 'pageTopbar'" :dataConfig="item"></pageTopbar>
<!-- 文章列表 -->
<articleList v-if="item.name == 'articleList'" :dataConfig="item"></articleList>
<bargain v-if="item.name == 'bargain'" :dataConfig="item" @changeBarg="changeBarg"></bargain>
@@ -35,6 +36,8 @@
<!-- 图片库 -->
<pictureCube v-if="item.name == 'pictureCube'" :dataConfig="item">
</pictureCube>
<!-- 图片组件 -->
<images v-if="item.name == 'images'" :dataConfig="item"></images>
<!-- 促销列表 -->
<promotionList v-if="item.name == 'promotionList'" :dataConfig="item" @detail="goDetail"
:productVideoStatus='product_video_status'>
@@ -105,6 +108,7 @@
import userInfor from '@/pages/index/components/userInfor';
import homeComb from '@/pages/index/components/homeComb';
import newVip from '@/pages/index/components/newVip';
import pageTopbar from '@/pages/index/components/pageTopbar';
import headerSerch from '@/pages/index/components/headerSerch';
import swipers from '@/pages/index/components/swipers';
import coupon from '@/pages/index/components/coupon';
@@ -119,6 +123,7 @@
import menus from '@/pages/index/components/menus';
import news from '@/pages/index/components/news';
import pictureCube from '@/pages/index/components/pictureCube';
import images from '@/pages/index/components/images';
import promotionList from '@/pages/index/components/promotionList';
import richText from '@/pages/index/components/richText';
import seckill from '@/pages/index/components/seckill';
@@ -171,6 +176,7 @@
couponWindow,
homeComb,
newVip,
pageTopbar,
userInfor,
headerSerch,
swipers,
@@ -185,6 +191,7 @@
liveBroadcast,
menus,
pictureCube,
images,
news,
promotionList,
richText,
@@ -205,6 +212,7 @@
},
data() {
return {
__debugDiyRender: false,
styleConfig: [],
loading: false,
loadend: false,
@@ -246,6 +254,7 @@
},
onLoad(options) {
let that = this
this.__debugDiyRender = uni.getStorageSync('DEBUG_DIY_RENDER') === true
this.$nextTick(function() {
uni.getSystemInfo({
success: function(res) {
@@ -323,6 +332,11 @@
},
mounted() {},
methods: {
__logDiy(step, payload) {
if (!this.__debugDiyRender) return;
const safe = payload === undefined ? '' : payload
console.log('[DIY][special]', step, safe)
},
// 分类点击
changeSort(item, index) {
if (this.curSort == index) return;
@@ -355,6 +369,7 @@
*/
getMicroPage(id, type) {
let that = this;
that.__logDiy('micro_fetch_start', { id })
that.styleConfig = []
uni.showLoading({
title: '加载中...'
@@ -363,11 +378,15 @@
uni.hideLoading();
let data = res.data;
that.styleConfig = that.objToArr(res.data.value);
that.__logDiy('micro_fetch_ok', { title: data?.title, count: that.styleConfig.length, names: that.styleConfig.map(v => v?.name) })
that.styleConfig.forEach((item, index) => {
if (['headerSerch', 'homeComb'].includes(item.name)) {
that.styleConfig.splice(index, 1);
}
});
that.$nextTick(() => {
that.__logDiy('micro_render_nextTick', { count: that.styleConfig.length, names: that.styleConfig.map(v => v?.name) })
})
}).catch(err => {
return that.$util.Tips({
title: err
@@ -504,10 +523,12 @@
return m;
},
getDiyData() {
this.__logDiy('special_fetch_start', { id: this.pageId })
getDiy(this.pageId).then(res => {
// uni.setStorageSync('specialDiyData', JSON.stringify(res.data));
// this.setDiyData(res.data);
let data = res.data;
this.__logDiy('special_fetch_ok', { title: data?.title, keys: Object.keys(data?.value || {}).length })
if (data.is_bg_color) {
this.bgColor = data.color_picker
}
@@ -521,6 +542,7 @@
})
let temp = []
let lastArr = this.objToArr(data.value)
this.__logDiy('special_value_arr', { count: lastArr.length, names: lastArr.map(v => v?.name) })
lastArr.forEach((item, index, arr) => {
if (item.isHide !== '1') {
temp.push(item);
@@ -530,6 +552,10 @@
}
});
this.styleConfig = temp;
this.__logDiy('special_styleConfig_set', { count: this.styleConfig.length, names: this.styleConfig.map(v => v?.name) })
this.$nextTick(() => {
this.__logDiy('special_render_nextTick', { count: this.styleConfig.length, names: this.styleConfig.map(v => v?.name) })
})
});
},
changeBarg(item) {
@@ -730,4 +756,4 @@
.noRepeat {
background-repeat: no-repeat;
}
</style>
</style>