当前位置:首页 > JS逆向 > 【小程序实战系列】电商平台源码及功能实现_import { fetchhome } from ‘(1)

【小程序实战系列】电商平台源码及功能实现_import { fetchhome } from ‘(1)

一叶知秋2024-05-13 18:34:09JS逆向5

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

},

onShow() {
this.getTabBar().init();
},

onLoad() {
this.init();
},

onReachBottom() {
if (this.data.goodsListLoadStatus === 0) {
this.loadGoodsList();
}
},

onPullDownRefresh() {
this.init();
},

init() {
this.loadHomePage();
},

loadHomePage() {
wx.stopPullDownRefresh();

this.setData({
  pageLoading: true,
});
fetchHome().then(({ swiper, tabList }) => {
  this.setData({
    tabList,
    imgSrcs: swiper,
    pageLoading: false,
  });
  this.loadGoodsList(true);
});

},

tabChangeHandle(e) {
this.privateData.tabIndex = e.detail;
this.loadGoodsList(true);
},

onReTry() {
this.loadGoodsList();
},

async loadGoodsList(fresh = false) {
if (fresh) {
wx.pageScrollTo({
scrollTop: 0,
});
}

this.setData({ goodsListLoadStatus: 1 });

const pageSize = this.goodListPagination.num;
let pageIndex =
  this.privateData.tabIndex \* pageSize + this.goodListPagination.index + 1;
if (fresh) {
  pageIndex = 0;
}

try {
  const nextList = await fetchGoodsList(pageIndex, pageSize);
  this.setData({
    goodsList: fresh ? nextList : this.data.goodsList.concat(nextList),
    goodsListLoadStatus: 0,
  });

  this.goodListPagination.index = pageIndex;
  this.goodListPagination.num = pageSize;
} catch (err) {
  this.setData({ goodsListLoadStatus: 3 });
}

},

goodListClickHandle(e) {
const { index } = e.detail;
const { spuId } = this.data.goodsList[index];
wx.navigateTo({
url: /pages/goods/details/index?spuId=${spuId},
});
},

goodListAddCartHandle() {
Toast({
context: this,
selector: ‘#t-toast’,
message: ‘点击加入购物车’,
});
},

navToSearchPage() {
wx.navigateTo({ url: ‘/pages/goods/search/index’ });
},

navToActivityDetail({ detail }) {
const { index: promotionID = 0 } = detail || {};
wx.navigateTo({
url: /pages/promotion-detail/index?promotion_id=${promotionID},
});
},
});



// home.json
{
“navigationBarTitleText”: “首页”,
“onReachBottomDistance”: 10,
“backgroundTextStyle”: “light”,
“enablePullDownRefresh”: true,
“usingComponents”: {
“t-search”: “tdesign-miniprogram/search/search”,
“t-loading”: “tdesign-miniprogram/loading/loading”,
“t-swiper”: “tdesign-miniprogram/swiper/swiper”,
“t-swiper-item”: “tdesign-miniprogram/swiper/swiper-item”,
“t-swiper-nav”: “tdesign-miniprogram/swiper/swiper-nav”,
“t-image”: “/components/webp-image/index”,
“t-icon”: “tdesign-miniprogram/icon/icon”,
“t-toast”: “tdesign-miniprogram/toast/toast”,
“t-tabs”: “tdesign-miniprogram/tabs/tabs”,
“t-tab-panel”: “tdesign-miniprogram/tabs/tab-panel”,
“goods-list”: “/components/goods-list/index”,
“load-more”: “/components/load-more/index”
}
}



加载中...


/* home.wxss */

page {
box-sizing: border-box;
padding-bottom: calc(env(safe-area-inset-bottom) + 96rpx);
}

.t-tabs.t-tabs–top .t-tabs__scroll {
border-bottom: none !important;
}

.home-page-header {
background: linear-gradient(#fff, #f5f5f5);
}

.home-page-container {
background: #f5f5f5;
}

.home-page-container,
.home-page-header {
display: block;
padding: 0 24rpx;
}

.home-page-header .t-search__input-container {
border-radius: 32rpx !important;
height: 64rpx !important;
}

.home-page-header .t-search__input {
font-size: 28rpx !important;
color: rgb(116, 116, 116) !important;
}

.home-page-header .swiper-wrap {
margin-top: 20rpx;
}

.home-page-header .t-image__swiper {
width: 100%;
height: 300rpx;
border-radius: 10rpx;
}

.home-page-container .t-tabs {
background: #f5f5f5;
}

.home-page-container .t-tabs .t-tabs-nav {
background-color: transparent;
line-height: 80rpx;
font-size: 28rpx;
color: #333;
}

.home-page-container .t-tabs .t-tabs-scroll {
border: none !important;
}

/* 半个字 */
.home-page-container .tab.order-nav .order-nav-item.scroll-width {
min-width: 165rpx;
}
.home-page-container .tab .order-nav-item.active {
color: #fa550f !important;
}

.home-page-container .tab .bottom-line {
border-radius: 4rpx;
}

.home-page-container .tab .order-nav-item.active .bottom-line {
background-color: #fa550f !important;
}

.home-page-container .t-class-item {
color: #333333 !important;
font-size: 32rpx;
}

.home-page-container .t-class-track {
background-color: #fa4126 !important;
height: 6rpx !important;
border-radius: 4rpx !important;
width: 48rpx !important;
}

.t-tabs.t-tabs–top .t-tabs__item,
.t-tabs.t-tabs–bottom .t-tabs__item {
height: 86rpx !important;
}

.home-page-container .goods-list-container {
background: #f5f5f5 !important;
margin-top: 24rpx;
}
.t-class-indicator,
.loading-text {
color: #b9b9b9 !important;
}


算了,直接[源码下载](https://bbs.csdn.net/topics/618545628)




![img](https://img-blog.csdnimg.cn/img_convert/634fae948e301e730eb33a2610d8a1be.png)
![img](https://img-blog.csdnimg.cn/img_convert/15849a8724542360f82fe269278499d5.png)
![img](https://img-blog.csdnimg.cn/img_convert/23b5a51ef5ae2178bfe01f7c414a6207.png)

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**





[外链图片转存中...(img-maPC2V9k-1715002182723)]
[外链图片转存中...(img-oUY5D3xc-1715002182723)]
[外链图片转存中...(img-QGv4pY7L-1715002182723)]

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**

扫描二维码推送至手机访问。

版权声明:本站部分文章来自互联网采集,请查看免责申明

本文链接:https://blog.yyzq.team/post/338538.html

标签: 小程序
分享给朋友:

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。