unknown
2024-02-27 7edbade4d2b1c74360d0cf40cdaa2eb0de379132
中台
12个文件已修改
5个文件已添加
453 ■■■■ 已修改文件
app.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/middleGround/api/job.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/middleGround/api/store.js 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/middleGround/api/ugc.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/middleGround/tool.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
custom-tab-bar/data.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.js 185 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.wxml 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.wxss 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.config.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
services/home/home.js 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/images/home/1.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/home/jingxuankecheng.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/home/shuzijiaocai.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/home/tushufuwu.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/home/zhuantitaolun.png 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -48,7 +48,7 @@
      },
      {
        "pagePath": "pages/goods/category/index",
        "text": "分类"
        "text": "学习"
      },
      {
        "pagePath": "pages/cart/index",
assets/js/middleGround/api/job.js
@@ -14,7 +14,7 @@
  },
  newSession(data) {
    let token = toolClass.getCookie(tokenKey);
    let token = wx.getStorageSync(config.tokenKey) ? wx.getStorageSync(config.tokenKey) : ''
    return request({
      url: token ? "/job/api/AppUserNewSession" : "/job/api/NewSession",
      method: "post",
@@ -22,7 +22,7 @@
    });
  },
  newJobWithApiNewEvent(data){
  newJobWithApiNewEvent(data) {
    return request({
      url: "/job/api/NewJobWithApiNewEvent",
      method: "post",
assets/js/middleGround/api/store.js
@@ -48,10 +48,10 @@
          : sort
            ? [sort]
            : [
                {
                  LinkOrder: 'Desc'
                }
              ],
              {
                LinkOrder: 'Desc'
              }
            ],
      CreateDate: [],
      Description: [],
      Name: [],
@@ -110,7 +110,7 @@
        ]
      })
    }
    let token = localStorage.getItem(tokenKey)
    let token = wx.getStorageSync(tokenKey) ? wx.getStorageSync(tokenKey) : '';
    let url = token ? '/store/api/ApiQueryProductByAppUser' : '/store/api/ApiQueryProduct'
    return request({
      url: url,
@@ -192,10 +192,10 @@
        SortQuery: cmsSort
          ? [cmsSort]
          : [
              {
                ProductLinkOrder: 'Asc'
              }
            ],
            {
              ProductLinkOrder: 'Asc'
            }
          ],
        ProductLinkInfo: [],
        ...itemFields
      }
@@ -264,10 +264,10 @@
      SortQuery: sort
        ? [sort]
        : [
            {
              LinkOrder: 'Desc'
            }
          ],
          {
            LinkOrder: 'Desc'
          }
        ],
      CreateDate: [],
      Description: [],
      Name: [],
@@ -301,7 +301,7 @@
        ]
      })
    }
    let token = localStorage.getItem(tokenKey)
    let token = wx.getStorageSync(tokenKey) ? wx.getStorageSync(tokenKey) : '';
    let url = token ? '/store/api/ApiQueryProductByAppUser' : '/store/api/ApiQueryProduct'
    return request({
      url: url,
assets/js/middleGround/api/ugc.js
@@ -1,11 +1,12 @@
import request from "../../../request/index";
import { tokenKey } from "../../config";
import toolClass from "../../toolClass";
let token = wx.getStorageSync(tokenKey) ? wx.getStorageSync(tokenKey) : ''
const ugcApi = {
  // 获取商品点赞Topic
  getProductLikesTopic(data) {
    return request({
      url: localStorage.getItem(tokenKey)
      url: token
        ? "/ugc/api/ApiAppUserGetProductLikesTopic"
        : "/ugc/api/ApiGetProductLikesTopic",
      method: "post",
@@ -16,7 +17,7 @@
  // 获取商品评论Topic
  getProductCommentTopic(data) {
    return request({
      url: localStorage.getItem(tokenKey)
      url: token
        ? "/ugc/api/ApiAppUserGetProductCommentTopic"
        : "/ugc/api/ApiGetProductCommentTopic",
      method: "post",
@@ -27,7 +28,7 @@
  // 获取MessageList
  getTopicMessageList(data) {
    return request({
      url: localStorage.getItem(tokenKey)
      url: token
        ? "/ugc/api/ApiAppUserGetTopicMessageList"
        : "/ugc/api/ApiGetTopicMessageList",
      method: "post",
@@ -63,8 +64,8 @@
  // 更新message
  updateTopicMessage(data) {
    return request({
      url:'/ugc/api/ApiUpdateTopicMessage',
      method:'post',
      url: '/ugc/api/ApiUpdateTopicMessage',
      method: 'post',
      data
    })
  },
assets/js/middleGround/tool.js
@@ -6,7 +6,7 @@
  datas,
  fields,
  path,
  storeInfo,
  storeInfo,
  repositoryInfo,
  coverSize,
  handelEBooK,
@@ -419,6 +419,7 @@
  if (md5) {
    src = requestCtx + `/file/GetPreViewImage?md5=${md5}`;
  } else {
    return ""
    // return defaultImg;
  }
  if (width) src += `&width=${width}`;
custom-tab-bar/data.js
@@ -11,7 +11,7 @@
  },
  {
    icon: 'sort',
    text: '分类',
    text: '学习',
    url: 'pages/goods/category/index',
  },
  {
pages/home/home.js
@@ -1,21 +1,19 @@
import { fetchHome } from '../../services/home/home';
import { fetchGoodsList } from '../../services/good/fetchGoods';
import Toast from 'tdesign-miniprogram/toast/index';
const app = getApp()
Page({
  data: {
    imgSrcs: [],
    tabList: [],
    goodsList: [],
    goodsListLoadStatus: 0,
    tabList: [], //目录
    pageLoading: false,
    current: 1,
    autoplay: true,
    duration: '500',
    interval: 5000,
    navigation: { type: 'dots' },
    swiperImageProps: { mode: 'scaleToFill' },
    bannerList: [],
    current: 1,//轮播图参数
    autoplay: true, //轮播图参数
    duration: '500',//轮播图参数
    interval: 5000,//轮播图参数
    navigation: { type: 'dots' },//轮播图参数
    bannerList: [], //轮播图列表
    specialSubjectList: [],//专题讨论
    courseList: [],
    booksList: [],
    textbookList: []
  },
  goodListPagination: {
@@ -29,6 +27,7 @@
  onShow() {
    this.getTabBar().init();
    this.loadHomePage();
    this.getBannerList()
  },
@@ -37,17 +36,13 @@
  },
  onReachBottom() {
    if (this.data.goodsListLoadStatus === 0) {
      this.loadGoodsList();
    }
  },
  onPullDownRefresh() {
    this.init();
  },
  init() {
    this.loadHomePage();
    this.getSubjectList();
    this.getCourseList();
  },
  getBannerList() {
    const list = []
@@ -69,82 +64,12 @@
    })
    console.log('轮播图', this.data.bannerList);
  },
  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 data = this.data.bannerList[detail.index]
    console.log('跳转', data.link);
    // const { index: promotionID = 0 } = detail || {};
@@ -152,4 +77,82 @@
    //   url: `/pages/promotion-detail/index?promotion_id=${promotionID}`,
    // });
  },
  //获取目录
  loadHomePage() {
    wx.stopPullDownRefresh();
    this.setData({
      pageLoading: true,
    });
    fetchHome().then(({ tabList }) => {
      this.setData({
        tabList,
        pageLoading: false,
      });
    });
  },
  //点击目录
  toPages(item) {
    let info = item.target.dataset.info
    if (info.url) {
      wx.navigateTo({
        url: info.url
      })
    } else {
      wx.showToast({
        title: "建设中",
        icon: 'none',
        duration: 2000
      })
    }
  },
  //专题讨论
  getSubjectList() {
    const obj = {
      storeInfo: "jsek_seminar",
      path: 'jsek_homepageSeminar',
      coverSize: {
        width: 400
      },
      paging: {
        start: 0,
        size: 3
      },
      fields: {
        liveTime: [],
        lecturer: [],
        startTime: [],
        jsek_link: []
      }
    }
    app.MG.store.getProductList(obj).then((res) => {
      this.setData({
        specialSubjectList: res.datas
      })
    })
  },
  //精选课程列表
  getCourseList(item) {
    const obj = {
      storeInfo: "app.config.goodsStore",
      path: 'jsek_homepageDigitalTextbooks',
      coverSize: {
        width: 260
      },
      paging: {
        start: 0,
        size: 4
      },
      fields: {
        courseLeader: [],
        affiliatedUnit: [],
        publishingUnit: [],
        classHours: []
      }
    }
    app.MG.store.getProductList(obj).then((res) => {
      this.setData({
        courseList: res.datas
      })
    })
  }
});
pages/home/home.json
@@ -14,6 +14,8 @@
    "t-tabs": "tdesign-miniprogram/tabs/tabs",
    "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
    "goods-list": "/components/goods-list/index",
    "load-more": "/components/load-more/index"
    "load-more": "/components/load-more/index",
    "t-grid": "tdesign-miniprogram/grid/grid",
    "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
  }
}
pages/home/home.wxml
@@ -2,35 +2,43 @@
  <t-loading theme="circular" size="40rpx" text="加载中..." inherit-color />
</view>
<view class="home-page-header">
  <view class="search" bind:tap="navToSearchPage">
    <t-search t-class-input="t-search__input" t-class-input-container="t-search__input-container" placeholder="请输入关键词/书名/ISBN/作者" leftIcon="" disabled>
      <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" />
  <view class="search">
    <t-search t-class-input="t-search__input" t-class-input-container="t-search__input-container" placeholder="请输入关键词/书名/ISBN/作者" leftIcon="">
      <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" bind:tap="navToSearchPage" />
    </t-search>
  </view>
  <view class="swiper-wrap">
    <t-swiper
    wx:if="{{bannerList.length > 0}}"
    list="{{bannerList}}"
    current="{{current}}"
    autoplay="{{autoplay}}"
    duration="{{duration}}"
    interval="{{interval}}"
    navigation="{{navigation}}"
    bind:click="navToActivityDetail"
    />
  </view>
  <view class="headerList">
    <t-swiper wx:if="{{bannerList.length > 0}}" list="{{bannerList}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" bind:click="navToActivityDetail" />
  </view>
</view>
<view class="home-page-menu">
  <t-grid class="t-grid-block" theme="card" border="{{border}}" column="{{5}}">
    <t-grid-item wx:for="{{tabList}}" wx:for-index="index" wx:key="index" text="{{item.text}}" image="{{item.icon}}" data-info="{{item}}" bindtap="toPages" />
  </t-grid>
</view>
<view class="home-page-container">
  <view class="home-page-tabs">
    <t-tabs t-class="t-tabs" t-class-active="tabs-external__active" t-class-item="tabs-external__item" defaultValue="{{0}}" space-evenly="{{false}}" bind:change="tabChangeHandle">
      <t-tab-panel wx:for="{{tabList}}" wx:for-index="index" wx:key="index" label="{{item.text}}" value="{{item.key}}" />
    </t-tabs>
  </view>
  <view class="home-page-list">
    <view class="tabCardPublic">
      <view class="icon">
        <t-image src="/static/images/home/zhuantitaolun.png" mode="heightFix" class="iconImage" />
      </view>
      <view bindtap="onMoreGuide">
        <text class="more">更多</text>
      </view>
    </view>
    <view>
      <view wx:for="{{specialSubjectList}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="toList" data-info="{{item}}">
        <view class="specialSubject-img">
          <t-image src="{{item.icon}}" mode="aspectFill" width="50" height="50" />
        </view>
        <view class="body-info">
          <view>{{item.name}}</view>
        </view>
      </view>
    </view>
  <goods-list wr-class="goods-list-container" goodsList="{{goodsList}}" bind:click="goodListClickHandle" bind:addcart="goodListAddCartHandle" />
  </view>
  <load-more list-is-empty="{{!goodsList.length}}" status="{{goodsListLoadStatus}}" bind:retry="onReTry" />
  <t-toast id="t-toast" />
</view>
pages/home/home.wxss
@@ -3,30 +3,21 @@
  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);
  position: relative;
}
.home-page-container {
  background: #f5f5f5;
}
.home-page-header {
  display: block;
}
.home-page-container {
  display: block;
  padding: 0 24rpx;
.home-page-header .search {
  position: absolute;
  top: 20rpx;
  left: 0;
  width: 100%;
  z-index: 99;
}
.home-page-header .t-search__input-container {
  border-radius: 32rpx !important;
  border-radius: 15rpx !important;
  margin: 0 24rpx;
  height: 64rpx !important;
}
@@ -35,78 +26,40 @@
  color: rgb(116, 116, 116) !important;
}
.home-page-header .swiper-wrap {
  margin-top: 20rpx;
.home-page-header .swiper-wrap .t-swiper-host {
  border-radius: 0;
}
.home-page-header .t-image__swiper {
  width: 100%;
  height: 300rpx;
  /* border-radius: 10rpx; */
}
.home-page-container .t-tabs {
  background: #f5f5f5 !important;
.home-page-container {
  display: block;
  padding: 0 24rpx;
}
.home-page-container .t-tabs .t-tabs-nav {
  background-color: transparent;
  line-height: 80rpx;
  font-size: 28rpx;
  color: #333;
.tabCardPublic {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx 5rpx;
  box-sizing: border-box;
}
.home-page-container .t-tabs .t-tabs-scroll {
  border: none !important;
.tabCardPublic .icon {
  width: 246rpx;
  height: 72rpx;
}
/* 半个字 */
.home-page-container .tab.order-nav .order-nav-item.scroll-width {
  min-width: 165rpx;
.tabCardPublic .icon .t-image {
  width: 100%;
  height: 100%
}
.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 .tabs-external__item {
  /* color: #666 !important; */
  font-size: 28rpx;
}
.home-page-container .tabs-external__active {
  color: #333333 !important;
  font-size: 32rpx;
}
.home-page-container .tabs-external__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: 16rpx;
}
.home-page-tabs {
  --td-tab-nav-bg-color: transparent;
  --td-tab-border-color: transparent;
  --td-tab-item-color: #666;
  --td-tab-track-color: red;
.tabCardPublic .more {
  font-size: 24rpx;
  color: #999;
}
project.config.json
@@ -43,7 +43,8 @@
    "showES6CompileOption": false,
    "useCompilerPlugins": false,
    "ignoreUploadUnusedFiles": true,
    "useStaticServer": true
    "useStaticServer": true,
    "condition": false
  },
  "compileType": "miniprogram",
  "libVersion": "2.23.1",
services/home/home.js
@@ -1,43 +1,71 @@
import { config, cdnBase } from '../../config/index';
import { config } from '../../config/index';
/** 获取首页数据 */
function mockFetchHome() {
  const { delay } = require('../_utils/delay');
  const { genSwiperImageList } = require('../../model/swiper');
  return delay().then(() => {
    return {
      swiper: genSwiperImageList(),
      tabList: [
        {
          text: '精选推荐',
          text: '图书服务',
          key: 0,
          icon: '/static/images/home/1.png',
          url: '/pages/bookServices/index',
        },
        {
          text: '夏日防晒',
          text: '数字阅读',
          key: 1,
          icon: '',
          url: '',
        },
        {
          text: '二胎大作战',
          text: '数字课程',
          key: 2,
          icon: "",
          url: '',
        },
        {
          text: '人气榜',
          text: '数字教材',
          key: 3,
          icon: "",
          url: '',
        },
        {
          text: '好评榜',
          text: '专题讨论',
          key: 4,
          icon: "",
          url: '',
        },
        {
          text: 'RTX 30',
          text: '线上书展',
          key: 5,
          icon: "",
          url: '',
        },
        {
          text: '手机也疯狂',
          text: '书目下载',
          key: 6,
          icon: "",
          url: '',
        },
        {
          text: '教师认证',
          key: 7,
          icon: "",
          url: '',
        },
        {
          text: '样书申请',
          key: 8,
          icon: "",
          url: '',
        },
        {
          text: '我要出书',
          key: 9,
          icon: "",
          url: '',
        }
      ],
      activityImg: `${cdnBase}/activity/banner.png`,
    };
  });
}
static/images/home/1.png
static/images/home/jingxuankecheng.png
static/images/home/shuzijiaocai.png
static/images/home/tushufuwu.png
static/images/home/zhuantitaolun.png