闫增涛
2024-03-26 9e5a84a4e41d7ab2cb820c7f77122f69a9d036dd
图书列表、详情代码修改
9个文件已修改
2个文件已添加
383 ■■■■ 已修改文件
assets/js/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.wxml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.wxss 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxml 290 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/list/index.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/list/index.wxss 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/down.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/up.png 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/config.js
@@ -1,7 +1,7 @@
// export const requestCtx = "http://182.92.203.7:3001"; // 请求地址
export const requestCtx = "http://182.92.203.7:3001"; // 请求地址
export const appId = 27;
// export const requestCtx = "http://jsysf.bnuic.com"; // 请求地址
export const requestCtx = "https://jsek.bnuic.com"  // 请求地址
// export const requestCtx = "https://jsek.bnuic.com"  // 请求地址
// export const appId = 3;
// export const epubUrl = "http://182.92.203.7:3007/epubReadMobile/"; 
export const epubUrl = "http://jsysf.bnuic.com/epubReadMobile/#/";
packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -37,20 +37,32 @@
    }
  },
  data: {
    activeValues: [1, 2],
    webpageSrc: '',
    cloudShoppingCart: []
  },
  ready() {
    this.setData({
    })
    console.log('准备');
  },
  onShow() {
  },
  observers: {
    'treeList': function (newValue) {
    'openIds': function (newValue) {
      var myEventDetail = {
      }
      var myEventOption = {
        bubbles: true,
        composed: true
      }
      this.triggerEvent('handleTree', myEventDetail, myEventOption)
    }
  },
  methods: {
    handleList(tree) {
      for (let index = 0; index < tree.length; index++) {
        const item = tree[index];
@@ -64,11 +76,9 @@
    },
    // 节点展开
    handleChange(e) {
      // console.log(this.properties.treeList, 'this.properties.treeList');
      this.setData({
        activeValues: e.detail.value,
        openIds: e.detail.value,
      });
      // console.log('传递', this.properties.buyIds);
    },
    handleCheck(data) {
      for (let index = 0; index < data.length; index++) {
packageBookService/pages/bookServices/detail/components/tree/index.wxml
@@ -1,26 +1,35 @@
<view class="tree">
  <t-collapse default-value="{{openIds}}" bind:change="handleChange">
  <t-collapse
    default-value="{{openIds}}"
    expandIcon="{{false}}"
    bind:change="handleChange"
  >
    <t-collapse-panel
      wx:for="{{treeList}}"
      wx:for-item="item"
      wx:for-index="index"
      wx:key="id"
      value="{{item.id}}"
      expandIcon
      disabled="{{!item.children.length}}"
    >
      <view slot="header" class="header-title">
        <view wx:if="{{isShowCheck}}">
        <view>
          <t-checkbox
            icon="rectangle"
            checked="{{item.checked}}"
            data-item="{{item}}"
            bind:change="checkResourceTitle"
            wx:if="{{isShowCheck}}"
          />
          <!-- <t-checkbox icon="rectangle" checked="{{true}}" data-item="{{item}}" bind:change="checkResourceTitle" /> -->
        </view>
        <text>{{item.name}}</text>
      </view>
        <image
          src="{{item.open ? '/static/images/bookService/detail/up.png' : '/static/images/bookService/detail/down.png'}}"
          class="list-icon"
          wx:if="{{item.children.length}}"
        />
      </view>
      <view
        class="list"
        wx:for="{{item.children}}"
packageBookService/pages/bookServices/detail/components/tree/index.wxss
@@ -5,7 +5,9 @@
}
.header-title {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  --td-checkbox-vertical-padding: 0
}
@@ -76,3 +78,8 @@
.shopCar {
  margin-right: 20rpx;
}
.list-icon {
  width: 32rpx;
  height: 18rpx;
}
packageBookService/pages/bookServices/detail/index.js
@@ -599,7 +599,7 @@
                loading: false,
                openTeachids: result
              })
              console.log('教学资源', this.data.teach);
              console.log('教学资源', this.data.teach, this.data.applyState);
            } else if (type.refCode == 'jsek_cloudLearning') {
              // res.datas.cmsDatas[0].datas.forEach(item => {
              //   item.checked = false
@@ -1722,5 +1722,29 @@
      url: "/packageDomain/pages/sampleBookList/applicationForm/index",
    });
  },
  handleTree() {
    // const child = this.selectComponent('#teach-tree')
    let tree
    // let openIds = child.data.openIds
    if (this.data.tabValue == 'jsek_teachingResources') {
      tree = this.data.teach
    } else {
      tree = this.data.learn
    }
    for (let index = 0; index < tree.length; index++) {
      const item = tree[index];
      if (item.children && item.children.length > 0) {
        const num = this.data.openTeachids.findIndex(citem => item.id == citem)
        if (num >= 0) {
          item.open = true
        } else {
          item.open = false
        }
        this.handleTree(item.children)
      }
    }
    this.setData({
      teach: tree
    })
  },
})
packageBookService/pages/bookServices/detail/index.wxml
@@ -4,30 +4,55 @@
  <view style="width: 100%; height: {{barHeight}}px; "></view>
  <view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;">
    <view>
      <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" />
      <t-icon
        name="chevron-left"
        size="30"
        data-name="{{item}}"
        bind:click="goBack"
      />
    </view>
    <view class="navbar-title">{{options.name}}</view>
  </view>
  <t-toast id="t-toast" />
  <scroll-view scroll-y="{{true}}" class="book" bindscrolltolower="onReachBottom">
  <scroll-view
    scroll-y="{{true}}"
    class="book"
    bindscrolltolower="onReachBottom"
  >
    <!-- 图书详情 -->
    <view class="book-box">
      <view class="book-detail">
        <view class="detail-left">
          <view class="book-img">
            <image loading="" src="{{bookDetail.icon ? bookDetail.icon : '/static/images/default-book-img.png'}}" mode="aspectFill" aria-label="{{bookDetail.name}}" />
            <image
              loading=""
              src="{{bookDetail.icon ? bookDetail.icon : '/static/images/default-book-img.png'}}"
              mode="aspectFill"
              aria-label="{{bookDetail.name}}"
            />
          </view>
          <view class="book-use">
            <view class="collect" bind:tap="setCollect">
              <view>
                <image loading="" src="/static/images/bookService/detail/collect.png" wx:if="{{!bookDetail.isFavourite}}" />
                <image loading="" src="/static/images/bookService/detail/collecting.png" wx:if="{{bookDetail.isFavourite}}" />
                <image
                  loading=""
                  src="/static/images/bookService/detail/collect.png"
                  wx:if="{{!bookDetail.isFavourite}}"
                />
                <image
                  loading=""
                  src="/static/images/bookService/detail/collecting.png"
                  wx:if="{{bookDetail.isFavourite}}"
                />
              </view>
              <view class="use-title">收藏</view>
            </view>
            <view class="suggest" bind:tap="suggestBtn">
              <view>
                <image loading="" src="/static/images/bookService/detail/suggest.png" />
                <image
                  loading=""
                  src="/static/images/bookService/detail/suggest.png"
                />
              </view>
              <view class="use-title">我要建议</view>
            </view>
@@ -49,15 +74,24 @@
              <view class="li-content">{{bookDetail.isbn}}</view>
            </view>
            <view class="message-li">
              <view class="li-title" wx:if="{{bookDetail.publicationDate}}">出版时间:</view>
              <view class="li-title" wx:if="{{bookDetail.publicationDate}}"
                >出版时间:</view
              >
              <view class="li-content">{{bookDetail.publicationDate}}</view>
            </view>
            <view class="message-li" wx:if="{{bookDetail.class}}" style="height: 80rpx">
            <view
              class="message-li"
              wx:if="{{bookDetail.class}}"
              style="height: 80rpx"
            >
              <view class="li-title">图书分类:</view>
              <view class="class-name showTow">{{bookDetail.class}}</view>
            </view>
          </view>
          <image src="/static/images/bookService/detail/square.png" class="right-background" />
          <image
            src="/static/images/bookService/detail/square.png"
            class="right-background"
          />
        </view>
      </view>
      <!-- 销售信息 -->
@@ -66,12 +100,17 @@
          <!-- 电子书售价 -->
          <view class="electron-price">
            <view>
              <image src="/static/images/bookService/detail/electon-price.png" />
              <image
                src="/static/images/bookService/detail/electon-price.png"
              />
            </view>
            <view class="price">
              <view class="price-text">{{bookDetail.price == '0.00' ? '免费' : '¥'+
                bookDetail.price}}</view>
              <view class="price-old" wx:if="{{bookDetail.oldPrice != '0.00'}}">¥{{bookDetail.oldPrice}}
              <view class="price-text"
                >{{bookDetail.price == '0.00' ? '免费' : '¥'+
                bookDetail.price}}</view
              >
              <view class="price-old" wx:if="{{bookDetail.oldPrice != '0.00'}}"
                >¥{{bookDetail.oldPrice}}
              </view>
            </view>
            <view> </view>
@@ -81,52 +120,151 @@
            <view>
              <image src="/static/images/bookService/detail/paper-price.png" />
            </view>
            <view class="price">{{bookDetail.paperPrice == '0.00' ? '免费' :
              '¥'+bookDetail.paperPrice}}</view>
            <view class="price"
              >{{bookDetail.paperPrice == '0.00' ? '免费' :
              '¥'+bookDetail.paperPrice}}</view
            >
          </view>
        </view>
        <!-- 网店 -->
        <view class="book-web">
          <image src="/static/images/bookService/detail/jd.png" wx:if="{{bookDetail.JDLink}}" bind:tap="goShop" data-link="{{bookDetail.JDLink}}" data-type="jd" />
          <image class="tmall-image" src="/static/images/bookService/detail/tmall.png" bind:tap="goShop" data-link="{{bookDetail.tmallLink}}" wx:if="{{bookDetail.tmallLink}}" />
          <image src="/static/images/bookService/detail/dangdang.png" bind:tap="goShop" data-link="{{bookDetail.dangdangLink}}" wx:if="{{bookDetail.dangdangLink}}" />
          <image src="/static/images/bookService/detail/weidian.png" bind:tap="goShop" data-link="{{bookDetail.weidianLink}}" wx:if="{{bookDetail.weidianLink}}" />
          <image
            src="/static/images/bookService/detail/jd.png"
            wx:if="{{bookDetail.JDLink}}"
            bind:tap="goShop"
            data-link="{{bookDetail.JDLink}}"
            data-type="jd"
          />
          <image
            class="tmall-image"
            src="/static/images/bookService/detail/tmall.png"
            bind:tap="goShop"
            data-link="{{bookDetail.tmallLink}}"
            wx:if="{{bookDetail.tmallLink}}"
          />
          <image
            src="/static/images/bookService/detail/dangdang.png"
            bind:tap="goShop"
            data-link="{{bookDetail.dangdangLink}}"
            wx:if="{{bookDetail.dangdangLink}}"
          />
          <image
            src="/static/images/bookService/detail/weidian.png"
            bind:tap="goShop"
            data-link="{{bookDetail.weidianLink}}"
            wx:if="{{bookDetail.weidianLink}}"
          />
        </view>
      </view>
    </view>
    <view class="book-resource">
      <t-tabs defaultValue="{{tabValue}}" bind:change="onTabsChange" t-class="custom-tabs" t-class-content="custom-panel" class="tab-class">
      <t-tabs
        defaultValue="{{tabValue}}"
        bind:change="onTabsChange"
        t-class="custom-tabs"
        t-class-content="custom-panel"
        class="tab-class"
      >
        <t-tab-panel label="图书简介" value="brief" style="{{tabPanelstyle}}">
          <book-brief content="{{bookDetail.content}}" authorIntroduction="{{bookDetail.authorIntroduction}}" wx:if="{{bookDetail.content || bookDetail.authorIntroduction}}"></book-brief>
          <view wx:if="{{!bookDetail.content && !bookDetail.authorIntroduction}}" class="noData">
          <book-brief
            content="{{bookDetail.content}}"
            authorIntroduction="{{bookDetail.authorIntroduction}}"
            wx:if="{{bookDetail.content || bookDetail.authorIntroduction}}"
          ></book-brief>
          <view
            wx:if="{{!bookDetail.content && !bookDetail.authorIntroduction}}"
            class="noData"
          >
            <t-empty icon="folder-open" description="暂无数据" />
          </view>
        </t-tab-panel>
        <t-tab-panel label="电子书" value="jsek_eBook" style="{{tabPanelstyle}}">
          <epub-view fileInfo="{{fileInfo}}" id="eBook" class="webView"></epub-view>
        <t-tab-panel
          label="电子书"
          value="jsek_eBook"
          style="{{tabPanelstyle}}"
        >
          <epub-view
            fileInfo="{{fileInfo}}"
            id="eBook"
            class="webView"
          ></epub-view>
        </t-tab-panel>
        <t-tab-panel label="教学资源" value="jsek_teachingResources" class="{{loading ? 'loading': ''}}">
          <view wx:if="{{!loading && teach.length && !noResources}}">
            <teach-resource applyState="{{applyState}}" rejectCause="{{rejectCause}}" deadline="{{deadline}}" bind:applyResource="applyResource" applyResourceLoading="{{applyResourceLoading}}"></teach-resource>
            <tree openIds="{{openTeachids}}" bookInfo="{{bookDetail}}" treeList="{{teach}}" tab="{{tabValue}}" applyState="{{applyState}}" bind:downloadTeach="downloadTeach" openTeachids="{{openTeachids}}" wx:if="{{teach.length}}"></tree>
        <t-tab-panel
          label="教学资源"
          value="jsek_teachingResources"
          class="{{loading ? 'loading': ''}}"
        >
          <view
            wx:if="{{!loading && teach.length && !noResources && applyState}}"
          >
            <teach-resource
              applyState="{{applyState}}"
              rejectCause="{{rejectCause}}"
              deadline="{{deadline}}"
              bind:applyResource="applyResource"
              applyResourceLoading="{{applyResourceLoading}}"
            ></teach-resource>
            <tree
              id="teach-tree"
              openIds="{{openTeachids}}"
              bookInfo="{{bookDetail}}"
              treeList="{{teach}}"
              tab="{{tabValue}}"
              applyState="{{applyState}}"
              bind:downloadTeach="downloadTeach"
              bind:handleTree="handleTree"
              openTeachids="{{openTeachids}}"
              wx:if="{{teach.length}}"
            ></tree>
          </view>
          <t-loading theme="circular" size="60rpx" class="loading" loading="{{loading }}" />
          <t-loading
            theme="circular"
            size="60rpx"
            class="loading"
            loading="{{loading }}"
          />
          <view wx:if="{{noResources}}" class="noData">
            <t-empty icon="folder-open" description="暂无数据" />
          </view>
        </t-tab-panel>
        <t-tab-panel label="云学习" value="jsek_cloudLearning" style="{{tabPanelstyle}}">
        <t-tab-panel
          label="云学习"
          value="jsek_cloudLearning"
          style="{{tabPanelstyle}}"
        >
          <view wx:if="{{!loading && learn.length}}">
            <learn-resource bind:getFreeResource="getFreeResource" bind:allAddShoppiingCar="allAddShoppiingCar" id="learn-resource" buyResourceData="{{buyResourceData}}" bookId="{{bookDetail.id}}"></learn-resource>
            <tree id="tree" openIds="{{openLearnids}}" bookInfo="{{bookDetail}}" tab="{{tabValue}}" treeList="{{learn}}" buyIds="{{buyIdList}}" openLearnids="{{openLearnids}}"></tree>
            <learn-resource
              bind:getFreeResource="getFreeResource"
              bind:allAddShoppiingCar="allAddShoppiingCar"
              id="learn-resource"
              buyResourceData="{{buyResourceData}}"
              bookId="{{bookDetail.id}}"
            ></learn-resource>
            <tree
              id="tree"
              openIds="{{openLearnids}}"
              bookInfo="{{bookDetail}}"
              tab="{{tabValue}}"
              treeList="{{learn}}"
              buyIds="{{buyIdList}}"
              openLearnids="{{openLearnids}}"
            ></tree>
          </view>
          <view wx:if="{{noResources}}" class="noData">
            <t-empty icon="folder-open" description="暂无数据" />
          </view>
        </t-tab-panel>
        <t-tab-panel label="云测试" value="questionBank" style="{{tabPanelstyle}}">
        <t-tab-panel
          label="云测试"
          value="questionBank"
          style="{{tabPanelstyle}}"
        >
          <view wx:if="{{!loading && test.length}}">
            <test-resource list="{{test}}" bookInfo="{{bookDetail}}" mockData="{{mockData}}"></test-resource>
            <test-resource
              list="{{test}}"
              bookInfo="{{bookDetail}}"
              mockData="{{mockData}}"
            ></test-resource>
          </view>
          <view wx:if="{{noResources}}" class="noData">
            <t-empty icon="folder-open" description="暂无数据" />
@@ -137,36 +275,82 @@
        </t-tab-panel>
      </t-tabs>
    </view>
  </scroll-view>
  <!-- 我要建议弹窗 -->
  <suggest
    class="suggest-component"
    id="suggest-component"
    bookIcon="{{bookDetail.icon}}"
    bookName="{{bookDetail.name}}"
  ></suggest>
  <!-- 教学资源下载提示弹窗 -->
  <t-dialog
    class="teachDownloadDialog"
    visible="{{isShowTeachDownload}}"
    title="提示"
    content="请前往PC端下载"
    confirm-btn="{{ confirmBtn }}"
    bind:confirm="closeTeachDownload"
  />
  <view class="applyBox" bindtap="goApply">
    <view class="box">
      <t-image
        src="/static/images/home/yangshuForm1.png"
        mode="heightFix"
        class="img"
      />
      <view class="num" wx:if="{{num > 0}}">{{num}}</view>
    </view>
  </view>
    <!-- 购买按钮 -->
    <view class="box-bottom">
      <view class="bottom-btn" bind:tap="appplyElectronicBook">
        <view>
          <t-image loading="" src="/static/images/bookService/detail/ebook.png"></t-image>
        <t-image
          loading=""
          src="/static/images/bookService/detail/ebook.png"
        ></t-image>
        </view>
        <view class="btn-text">电子样书申请</view>
      </view>
      <view class="bottom-btn" bind:tap="appplyPaperBook">
        <view>
          <t-image src="/static/images/bookService/detail/paper-book.png"></t-image>
        <t-image
          src="/static/images/bookService/detail/paper-book.png"
        ></t-image>
        </view>
        <view class="btn-text">纸质样书申请</view>
      </view>
      <view class="shopCar {{(tabValue == 'jsek_teachingResources' || tabValue == 'jsek_note') ? 'disabledColor' : 'shopCarColor' }}" bind:tap="addBookShopcCar" wx:if="{{tabValue != 'jsek_eBook'}}">加入购物车</view>
      <view class="buy  {{(tabValue == 'jsek_teachingResources' || tabValue == 'jsek_note') ? 'disabledColor' : 'buyColor' }}" bind:tap="buyBtn" wx:if="{{tabValue != 'jsek_eBook'}}">立即购买</view>
      <view class="shopCar shopCarColor" bind:tap="addBookShopcCar" wx:if="{{tabValue == 'jsek_eBook' && !bookBuy}}">加入购物车</view>
      <view class="buy buyColor" bind:tap="buyBtn" wx:if="{{tabValue == 'jsek_eBook' && !bookBuy}}">立即购买</view>
      <view class="read buyColor" bind:tap="goRead" wx:if="{{tabValue == 'jsek_eBook' && bookBuy}}">立即查看</view>
    </view>
  </scroll-view>
  <!-- 我要建议弹窗 -->
  <suggest class="suggest-component" id="suggest-component" bookIcon="{{bookDetail.icon}}" bookName="{{bookDetail.name}}"></suggest>
  <!-- 教学资源下载提示弹窗 -->
  <t-dialog class="teachDownloadDialog" visible="{{isShowTeachDownload}}" title="提示" content="请前往PC端下载" confirm-btn="{{ confirmBtn }}" bind:confirm="closeTeachDownload" />
  <view class="applyBox" bindtap="goApply">
    <view class="box">
      <t-image src="/static/images/home/yangshuForm1.png" mode="heightFix" class="img" />
      <view class="num" wx:if="{{num > 0}}">{{num}}</view>
    </view>
    <view
      class="shopCar {{(tabValue == 'jsek_teachingResources' || tabValue == 'jsek_note') ? 'disabledColor' : 'shopCarColor' }}"
      bind:tap="addBookShopcCar"
      wx:if="{{tabValue != 'jsek_eBook'}}"
      >加入购物车</view
    >
    <view
      class="buy  {{(tabValue == 'jsek_teachingResources' || tabValue == 'jsek_note') ? 'disabledColor' : 'buyColor' }}"
      bind:tap="buyBtn"
      wx:if="{{tabValue != 'jsek_eBook'}}"
      >立即购买</view
    >
    <view
      class="shopCar shopCarColor"
      bind:tap="addBookShopcCar"
      wx:if="{{tabValue == 'jsek_eBook' && !bookBuy}}"
      >加入购物车</view
    >
    <view
      class="buy buyColor"
      bind:tap="buyBtn"
      wx:if="{{tabValue == 'jsek_eBook' && !bookBuy}}"
      >立即购买</view
    >
    <view
      class="read buyColor"
      bind:tap="goRead"
      wx:if="{{tabValue == 'jsek_eBook' && bookBuy}}"
      >立即查看</view
    >
  </view>
</view>
packageBookService/pages/bookServices/detail/index.wxss
@@ -2,7 +2,8 @@
.page-bookService {
  width: 100vw;
  height: 100vh;
  height: 100%;
  position: relative;
}
.nacigationBar {
@@ -221,10 +222,9 @@
/* 底部 */
.box-bottom {
  position: fixed;
  position: absolute;
  left: 0;
  bottom: constant(safe-area-inset-bottom);
  bottom: env(safe-area-inset-bottom);
  bottom: 0;
  width: 100%;
  height: 110rpx;
}
@@ -323,7 +323,7 @@
.applyBox {
  width: 184rpx;
  height: 184rpx;
  position: fixed;
  position: absolute;
  bottom: 20%;
  right: 0;
}
packageBookService/pages/bookServices/list/index.wxml
@@ -59,7 +59,7 @@
      </t-dropdown-menu>
    </scroll-view>
    <view class="header-sort" bind:tap="sortClick">
      <view class="sort-name">排序</view>
      <text class="sort-name">排序</text>
      <!-- <view class="sort-icon"> -->
      <t-icon
        name="swap-left"
packageBookService/pages/bookServices/list/index.wxss
@@ -12,6 +12,7 @@
.list-header {
  display: flex;
  height: 96rpx;
}
.list-header .t-button--primary {
@@ -39,7 +40,7 @@
  position: relative;
  background-color: #fff;
  line-height: 90rpx;
  height: 90rpx;
  height: 100%;
  width: 15vw;
  font-size: 28rpx;
  color: #999;
static/images/bookService/detail/down.png
static/images/bookService/detail/up.png