| | |
| | | }, |
| | | { |
| | | "pagePath": "pages/goods/category/index", |
| | | "text": "分类" |
| | | "text": "学习" |
| | | }, |
| | | { |
| | | "pagePath": "pages/cart/index", |
| | |
| | | }, |
| | | |
| | | 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", |
| | |
| | | }); |
| | | }, |
| | | |
| | | newJobWithApiNewEvent(data){ |
| | | newJobWithApiNewEvent(data) { |
| | | return request({ |
| | | url: "/job/api/NewJobWithApiNewEvent", |
| | | method: "post", |
| | |
| | | : sort |
| | | ? [sort] |
| | | : [ |
| | | { |
| | | LinkOrder: 'Desc' |
| | | } |
| | | ], |
| | | { |
| | | LinkOrder: 'Desc' |
| | | } |
| | | ], |
| | | CreateDate: [], |
| | | Description: [], |
| | | Name: [], |
| | |
| | | ] |
| | | }) |
| | | } |
| | | 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, |
| | |
| | | SortQuery: cmsSort |
| | | ? [cmsSort] |
| | | : [ |
| | | { |
| | | ProductLinkOrder: 'Asc' |
| | | } |
| | | ], |
| | | { |
| | | ProductLinkOrder: 'Asc' |
| | | } |
| | | ], |
| | | ProductLinkInfo: [], |
| | | ...itemFields |
| | | } |
| | |
| | | SortQuery: sort |
| | | ? [sort] |
| | | : [ |
| | | { |
| | | LinkOrder: 'Desc' |
| | | } |
| | | ], |
| | | { |
| | | LinkOrder: 'Desc' |
| | | } |
| | | ], |
| | | CreateDate: [], |
| | | Description: [], |
| | | Name: [], |
| | |
| | | ] |
| | | }) |
| | | } |
| | | 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, |
| | |
| | | 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", |
| | |
| | | // 获取商品评论Topic |
| | | getProductCommentTopic(data) { |
| | | return request({ |
| | | url: localStorage.getItem(tokenKey) |
| | | url: token |
| | | ? "/ugc/api/ApiAppUserGetProductCommentTopic" |
| | | : "/ugc/api/ApiGetProductCommentTopic", |
| | | method: "post", |
| | |
| | | // 获取MessageList |
| | | getTopicMessageList(data) { |
| | | return request({ |
| | | url: localStorage.getItem(tokenKey) |
| | | url: token |
| | | ? "/ugc/api/ApiAppUserGetTopicMessageList" |
| | | : "/ugc/api/ApiGetTopicMessageList", |
| | | method: "post", |
| | |
| | | // 更新message |
| | | updateTopicMessage(data) { |
| | | return request({ |
| | | url:'/ugc/api/ApiUpdateTopicMessage', |
| | | method:'post', |
| | | url: '/ugc/api/ApiUpdateTopicMessage', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | }, |
| | |
| | | datas, |
| | | fields, |
| | | path, |
| | | storeInfo, |
| | | storeInfo, |
| | | repositoryInfo, |
| | | coverSize, |
| | | handelEBooK, |
| | |
| | | if (md5) { |
| | | src = requestCtx + `/file/GetPreViewImage?md5=${md5}`; |
| | | } else { |
| | | return "" |
| | | // return defaultImg; |
| | | } |
| | | if (width) src += `&width=${width}`; |
| | |
| | | }, |
| | | { |
| | | icon: 'sort', |
| | | text: '分类', |
| | | text: '学习', |
| | | url: 'pages/goods/category/index', |
| | | }, |
| | | { |
| | |
| | | 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: { |
| | |
| | | |
| | | onShow() { |
| | | this.getTabBar().init(); |
| | | this.loadHomePage(); |
| | | this.getBannerList() |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | onReachBottom() { |
| | | if (this.data.goodsListLoadStatus === 0) { |
| | | this.loadGoodsList(); |
| | | } |
| | | }, |
| | | |
| | | onPullDownRefresh() { |
| | | this.init(); |
| | | }, |
| | | |
| | | init() { |
| | | this.loadHomePage(); |
| | | this.getSubjectList(); |
| | | this.getCourseList(); |
| | | }, |
| | | getBannerList() { |
| | | const list = [] |
| | |
| | | }) |
| | | 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 || {}; |
| | |
| | | // 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 |
| | | }) |
| | | }) |
| | | } |
| | | }); |
| | |
| | | "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" |
| | | } |
| | | } |
| | |
| | | <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> |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | "showES6CompileOption": false, |
| | | "useCompilerPlugins": false, |
| | | "ignoreUploadUnusedFiles": true, |
| | | "useStaticServer": true |
| | | "useStaticServer": true, |
| | | "condition": false |
| | | }, |
| | | "compileType": "miniprogram", |
| | | "libVersion": "2.23.1", |
| | |
| | | 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`, |
| | | }; |
| | | }); |
| | | } |