feat(页面组件): 新增图片组件和页面顶部导航组件
- 新增 images.vue 图片组件,支持图片展示、链接跳转和二维码长按识别 - 新增 pageTopbar.vue 页面顶部导航组件,支持自定义标题、返回按钮和样式配置 - 在首页和专题页中注册并使用新增组件 - 优化 homeComb.vue 组件,添加选项卡轮播显示控制逻辑 - 添加 DIY 组件调试日志功能,便于开发调试 - 修复缓存读取空值时的默认值处理
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
@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>
|
||||
@@ -46,6 +47,8 @@
|
||||
<news v-if="item.name == 'news'" :dataConfig="item"></news>
|
||||
<!-- 图片库 -->
|
||||
<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"
|
||||
:productVideoStatus='product_video_status' :showHomeComb="showHomeComb" :isHeaderSerch="isHeaderSerch">
|
||||
@@ -146,6 +149,7 @@
|
||||
import userInfor from './components/userInfor';
|
||||
import homeComb from './components/homeComb';
|
||||
import newVip from './components/newVip';
|
||||
import pageTopbar from './components/pageTopbar';
|
||||
// import shortVideo from './components/shortVideo';
|
||||
import community from './components/community'
|
||||
import headerSerch from './components/headerSerch';
|
||||
@@ -161,8 +165,9 @@
|
||||
import liveBroadcast from './components/liveBroadcast';
|
||||
import menus from './components/menus';
|
||||
import news from './components/news';
|
||||
import pictureCube from './components/pictureCube';
|
||||
import promotionList from './components/promotionList';
|
||||
import pictureCube from './components/pictureCube';
|
||||
import images from './components/images';
|
||||
import promotionList from './components/promotionList';
|
||||
import richText from './components/richText';
|
||||
import seckill from './components/seckill';
|
||||
import swiperBg from './components/swiperBg';
|
||||
@@ -221,6 +226,7 @@
|
||||
couponWindow,
|
||||
homeComb,
|
||||
newVip,
|
||||
pageTopbar,
|
||||
userInfor,
|
||||
community,
|
||||
headerSerch,
|
||||
@@ -235,6 +241,7 @@
|
||||
guide,
|
||||
menus,
|
||||
pictureCube,
|
||||
images,
|
||||
news,
|
||||
promotionList,
|
||||
richText,
|
||||
@@ -263,6 +270,7 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
__debugDiyRender: false,
|
||||
styleConfig: [],
|
||||
loading: false,
|
||||
loadend: false,
|
||||
@@ -309,11 +317,12 @@
|
||||
confirm_video_status: false,
|
||||
isFooter: false,
|
||||
pullReset: 0,
|
||||
configData: Cache.get('BASIC_CONFIG'),
|
||||
configData: Cache.get('BASIC_CONFIG') || {},
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
let that = this;
|
||||
this.__debugDiyRender = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
that.getOptions(options);
|
||||
this.$nextTick(function() {
|
||||
uni.getSystemInfo({
|
||||
@@ -360,6 +369,11 @@
|
||||
uni.removeStorageSync('form_type_cart')
|
||||
},
|
||||
methods: {
|
||||
__logDiy(step, payload) {
|
||||
if (!this.__debugDiyRender) return;
|
||||
const safe = payload === undefined ? '' : payload
|
||||
console.log('[DIY][home]', step, safe)
|
||||
},
|
||||
...mapMutations(['SET_AUTOPLAY']),
|
||||
getOptions(options) {
|
||||
let that = this;
|
||||
@@ -431,6 +445,7 @@
|
||||
*/
|
||||
getMicroPage(id, type) {
|
||||
let that = this;
|
||||
that.__logDiy('micro_fetch_start', { id })
|
||||
that.styleConfig = [];
|
||||
that.goodList = [];
|
||||
uni.showLoading({
|
||||
@@ -440,6 +455,7 @@
|
||||
uni.hideLoading();
|
||||
let data = res.data;
|
||||
let diyArr = that.objToArr(res.data.value);
|
||||
that.__logDiy('micro_fetch_ok', { title: data?.title, count: diyArr.length, names: diyArr.map(v => v?.name) })
|
||||
diyArr = diyArr.filter(item => item.isHide !== '1');
|
||||
diyArr.forEach((item,index) => {
|
||||
if(['headerSerch','homeComb'].includes(item.name)){
|
||||
@@ -447,6 +463,9 @@
|
||||
}
|
||||
});
|
||||
this.styleConfig = diyArr;
|
||||
this.$nextTick(() => {
|
||||
this.__logDiy('micro_render_nextTick', { count: this.styleConfig.length, names: this.styleConfig.map(v => v?.name) })
|
||||
})
|
||||
}).catch(err => {
|
||||
return that.$util.Tips({
|
||||
title: err
|
||||
@@ -525,6 +544,7 @@
|
||||
return m;
|
||||
},
|
||||
setDiyData(data) {
|
||||
this.__logDiy('home_setDiyData_start', { title: data?.title })
|
||||
this.errorNetwork = false
|
||||
if (data.is_bg_color) {
|
||||
this.bgColor = data.color_picker
|
||||
@@ -563,9 +583,15 @@
|
||||
}
|
||||
temp.sort(sortNumber)
|
||||
this.styleConfig = temp;
|
||||
this.__logDiy('home_setDiyData_done', { count: this.styleConfig.length, names: this.styleConfig.map(v => v?.name) })
|
||||
this.$nextTick(() => {
|
||||
this.__logDiy('home_render_nextTick', { count: this.styleConfig.length, names: this.styleConfig.map(v => v?.name) })
|
||||
})
|
||||
},
|
||||
getDiyData() {
|
||||
this.__logDiy('home_fetch_start', { id: 0 })
|
||||
getDiy(0).then(res => {
|
||||
this.__logDiy('home_fetch_ok', { title: res?.data?.title, keys: Object.keys(res?.data?.value || {}).length })
|
||||
uni.setStorageSync('diyData', JSON.stringify(res.data));
|
||||
this.setDiyData(res.data);
|
||||
}).catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user