Merge branch 'master-xie'

This commit is contained in:
@fawn-nine
2023-09-22 13:48:35 +08:00
2 changed files with 453 additions and 308 deletions

View File

@@ -15,7 +15,8 @@
<view class="commodityContent"> <view class="commodityContent">
<view class="commodityPrice" v-if="productInfo.activityPrice && productInfo.activityPrice > 0"> <view class="commodityPrice" v-if="productInfo.activityPrice && productInfo.activityPrice > 0">
<span style="font-size: 28rpx;"></span><em>{{productInfo.activityPrice}}</em> <span style="font-size: 28rpx;"></span><em>{{productInfo.activityPrice}}</em>
<span class="oldPrice " >原价<span style="font-size: 20rpx;padding-left:10rpx;"></span>{{productInfo.price}}</span> <span class="oldPrice ">原价<span
style="font-size: 20rpx;padding-left:10rpx;"></span>{{productInfo.price}}</span>
</view> </view>
<view class="commodityPrice" v-else> <view class="commodityPrice" v-else>
<span style="font-size: 28rpx;"></span><em>{{productInfo.price}}</em> <span style="font-size: 28rpx;"></span><em>{{productInfo.price}}</em>
@@ -23,7 +24,8 @@
<view class="commodityyName"> <view class="commodityyName">
{{productInfo.productName}} {{productInfo.productName}}
<span v-if="productInfo.productStock==0" style="color: #aaa;font-size:26rpx;">无货</span> <span v-if="productInfo.productStock==0" style="color: #aaa;font-size:26rpx;">无货</span>
<view><text class="SoldNumber">已售<span style="padding-left:10rpx;">{{productInfo.sumSales}}</span></text></view> <view><text class="SoldNumber">已售<span
style="padding-left:10rpx;">{{productInfo.sumSales}}</span></text></view>
</view> </view>
<view class="pingjia" v-if="linkProducts && linkProducts.length > 0 && linkProducts[0]"> <view class="pingjia" v-if="linkProducts && linkProducts.length > 0 && linkProducts[0]">
<view class=""> <view class="">
@@ -38,7 +40,8 @@
<image :src="item.productImages" mode="aspectFit"></image> <image :src="item.productImages" mode="aspectFit"></image>
</view> </view>
<text class="username nowrap ">{{item.productName}}</text> <text class="username nowrap ">{{item.productName}}</text>
<text class="price" v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice}}</text> <text class="price"
v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice}}</text>
<text class="price" v-else>{{item.price}}</text> <text class="price" v-else>{{item.price}}</text>
</view> </view>
</view> </view>
@@ -49,13 +52,11 @@
</view> </view>
<view class="contentButton"> <view class="contentButton">
<u-tabs :scrollable="false" :list="contentButtonList" @click="contentButtonClick" <u-tabs :scrollable="false" :list="contentButtonList" @click="contentButtonClick" :activeStyle="{
:activeStyle="{
color: '#303133', color: '#303133',
fontWeight: 'bold', fontWeight: 'bold',
fontSize: '28rpx' fontSize: '28rpx'
}" }" :inactiveStyle="{
:inactiveStyle="{
color: '#606266', color: '#606266',
fontSize: '28rpx' fontSize: '28rpx'
}"></u-tabs> }"></u-tabs>
@@ -68,13 +69,16 @@
<view class=""> <view class="">
<view style="font-weight: 700;margin-bottom: 30rpx;color:#71d5a1;">赠送听书权益</view> <view style="font-weight: 700;margin-bottom: 30rpx;color:#71d5a1;">赠送听书权益</view>
</view> </view>
<view class="item flexbox aligncenter" v-for="item in listenList" :key="item.id" style="padding-bottom:10rpx;"> <view class="item flexbox aligncenter" v-for="item in listenList" :key="item.id"
style="padding-bottom:10rpx;">
<view class="spbhimg" @click="previewImage(item.images)"> <view class="spbhimg" @click="previewImage(item.images)">
<image :src="item.images" mode="aspectFit"></image> <image :src="item.images" mode="aspectFit"></image>
</view> </view>
<text style="padding-right: 10rpx;">{{item.name}}</text> <text style="padding-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.canListen == 'true'" name="volume" color="#71d5a1" size="24" @click="goToListen(item.id)"></u-icon> <u-icon v-if="item.canListen == 'true'" name="volume" color="#71d5a1" size="24"
<u-icon v-else name="volume" color="#71d5a1" size="24" @click="goToListenNone(item.id)"></u-icon> @click="goToListen(item.id)"></u-icon>
<u-icon v-else name="volume" color="#71d5a1" size="24"
@click="goToListenNone(item.id)"></u-icon>
</view> </view>
</view> </view>
<view class=""> <view class="">
@@ -88,23 +92,27 @@
<u-col v-if="productInfo.author"><span>作者{{productInfo.author}}</span></u-col> <u-col v-if="productInfo.author"><span>作者{{productInfo.author}}</span></u-col>
</u-row> </u-row>
<u-row customStyle="margin-bottom: 10px"> <u-row customStyle="margin-bottom: 10px">
<u-col span="12" v-if="productInfo.publisher"><span>出版社{{productInfo.publisher}}</span></u-col> <u-col span="12"
v-if="productInfo.publisher"><span>出版社{{productInfo.publisher}}</span></u-col>
</u-row> </u-row>
<u-row customStyle="margin-bottom: 10px"> <u-row customStyle="margin-bottom: 10px">
<u-col span="12" v-if="productInfo.pubDate"><span>出版时间{{ productInfo.pubDate | formatDate }}</span></u-col> <u-col span="12"
v-if="productInfo.pubDate"><span>出版时间{{ productInfo.pubDate | formatDate }}</span></u-col>
</u-row> </u-row>
<u-row customStyle="margin-bottom: 10px"> <u-row customStyle="margin-bottom: 10px">
<u-col span="6" v-if="productInfo.format"><span>开本{{productInfo.format}}</span></u-col> <u-col span="6" v-if="productInfo.format"><span>开本{{productInfo.format}}</span></u-col>
<u-col span="6" v-if="productInfo.pageNum"><span>页数{{productInfo.pageNum}}</span></u-col> <u-col span="6" v-if="productInfo.pageNum"><span>页数{{productInfo.pageNum}}</span></u-col>
</u-row> </u-row>
<u-row customStyle="margin-bottom: 10px"> <u-row customStyle="margin-bottom: 10px">
<u-col span="6" v-if="productInfo.quality"><span>内文用纸材质{{productInfo.quality}}</span></u-col> <u-col span="6"
v-if="productInfo.quality"><span>内文用纸材质{{productInfo.quality}}</span></u-col>
</u-row> </u-row>
</view> </view>
<!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> --> <!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> -->
<view class="commodityIntroduce"> <view class="commodityIntroduce">
<view v-if="productInfo.productDetails"> <view v-if="productInfo.productDetails">
<rich-text v-if="productInfo.productDetails" class="xiangqing" :nodes="productInfo.productDetails|formatRichText"></rich-text> <rich-text v-if="productInfo.productDetails" class="xiangqing"
:nodes="productInfo.productDetails|formatRichText"></rich-text>
</view> </view>
</view> </view>
</view> </view>
@@ -136,7 +144,8 @@
<view class="contentBox"> <view class="contentBox">
<div class="pjimgs flexbox"> <div class="pjimgs flexbox">
<view class="item" v-for="(item1,index) in item.images"> <view class="item" v-for="(item1,index) in item.images">
<image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1" mode="aspectFill" style="width:100%; height: 50px;"></image> <image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1"
mode="aspectFill" style="width:100%; height: 50px;"></image>
</view> </view>
</div> </div>
<view class="content" v-html="item.phtml"></view> <view class="content" v-html="item.phtml"></view>
@@ -165,25 +174,29 @@
<view class="tanchu"> <view class="tanchu">
<view class="list"> <view class="list">
<view class="imgBox"> <view class="imgBox">
<image v-if="linkimg == ''" src="../../static/icon/wufeng.jpg" mode="aspectFit" style="width: 100%; height: 100%;"></image> <image v-if="linkimg == ''" src="../../static/icon/wufeng.jpg" mode="aspectFit"
style="width: 100%; height: 100%;"></image>
<image v-else :src="linkimg" mode="aspectFit" style="width: 100%; height: 100%;"></image> <image v-else :src="linkimg" mode="aspectFit" style="width: 100%; height: 100%;"></image>
<view class="xiangxi" v-if="productId != linkProducts[linkCur].productId" @click="gotoDetail(linkProducts[linkCur])"> <view class="xiangxi" v-if="productId != linkProducts[linkCur].productId"
@click="gotoDetail(linkProducts[linkCur])">
<text>查看详情</text> <text>查看详情</text>
</view> </view>
</view> </view>
<view :class="['spbh', linkCur == index ? 'cur' :'']" v-for="(item, index) in linkProducts" :key="item.id"> <view :class="['spbh', linkCur == index ? 'cur' :'']" v-for="(item, index) in linkProducts"
:key="item.id">
<view class="flexbox aligncenter" @click="previewProduct(item,index)"> <view class="flexbox aligncenter" @click="previewProduct(item,index)">
<view class="spbhimg"> <view class="spbhimg">
<image :src="item.productImages" mode="aspectFit"></image> <image :src="item.productImages" mode="aspectFit"></image>
</view> </view>
<text class="username nowrap ">{{item.productName}}</text> <text class="username nowrap ">{{item.productName}}</text>
<text class="price" v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice}}</text> <text class="price"
v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice}}</text>
<text class="price" v-else>{{item.price}}</text> <text class="price" v-else>{{item.price}}</text>
</view> </view>
</view> </view>
</view> </view>
<uni-goods-nav style="left: 0;" class="goods_nav" :fill="true" :options="options" :buttonGroup="buttonGroup" @click="onClick" <uni-goods-nav style="left: 0;" class="goods_nav" :fill="true" :options="options"
@buttonClick="buttonClickLink" /> :buttonGroup="buttonGroup" @click="onClick" @buttonClick="buttonClickLink" />
</view> </view>
</u-popup> </u-popup>
</view> </view>
@@ -284,10 +297,12 @@
.then(res => { .then(res => {
console.log('关联商品', res) console.log('关联商品', res)
if (res.code == 0) { if (res.code == 0) {
if (res.result.length > 0) {
this.linkProducts = res.result this.linkProducts = res.result
if(this.linkProducts.length > 0){
this.linkimg = this.linkProducts[0].productImages this.linkimg = this.linkProducts[0].productImages
this.linkCur = 0 this.linkCur = 0
}else{
this.linkProducts = []
} }
} }
}) })
@@ -317,7 +332,8 @@
// console.log(item, index) // console.log(item, index)
var indexss = emojiList1.findIndex(item1 => item1.alt === item) var indexss = emojiList1.findIndex(item1 => item1.alt === item)
// console.log(indexss, 'indexss') // console.log(indexss, 'indexss')
return '<img src="https://www.nuttyreading.com/emojis/emojis/qq/' + emojiList1[indexss].url + '" width="18rpx">'; return '<img src="https://www.nuttyreading.com/emojis/emojis/qq/' + emojiList1[indexss].url +
'" width="18rpx">';
}); });
// console.log(replacedStr,'replacedStr') // console.log(replacedStr,'replacedStr')
return replacedStr.replace(/(\r\n)|(\n)/g, '<br>'); return replacedStr.replace(/(\r\n)|(\n)/g, '<br>');
@@ -355,7 +371,8 @@
var pjstr = '' var pjstr = ''
var zpstr = '' var zpstr = ''
pjstr = this.getHtmlComment(item1.content) pjstr = this.getHtmlComment(item1.content)
item1.followUpcontent == '' ? zpstr = '' : zpstr = this.getHtmlComment(item1.followUpcontent) item1.followUpcontent == '' ? zpstr = '' : zpstr = this.getHtmlComment(item1
.followUpcontent)
//console.log(pjstr,'99999999999----------') //console.log(pjstr,'99999999999----------')
item1.phtml = pjstr item1.phtml = pjstr
item1.zphtml = zpstr item1.zphtml = zpstr
@@ -457,18 +474,19 @@
// console.log(e) // console.log(e)
if (e.index == 0) { if (e.index == 0) {
// 点击的是加入购物车 // 点击的是加入购物车
if(this.linkProducts.length > 0){ // console.log('+.........',this.linkProducts,'this.linkProducts')
this.upoShow = true if (this.linkProducts.length == 0) {
}else{
this.addCart() this.addCart()
} else {
this.upoShow = true
} }
} else { } else {
// 点击的是立即购买 // 点击的是立即购买
if(this.linkProducts.length > 0){ if (this.linkProducts.length == 0) {
this.upoShow = true
}else{
this.goPurse() this.goPurse()
} else {
this.upoShow = true
} }
} }
}, },
@@ -672,11 +690,13 @@ formatRichText (html) { //控制小程序中图片大小
return match; return match;
}); });
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) { newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;'); match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match; return match;
}); });
newContent = newContent.replace(/<br[^>]*\/>/gi, ''); newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"'); newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent; return newContent;
}, },
// 去购物车 // 去购物车
@@ -687,7 +707,8 @@ formatRichText (html) { //控制小程序中图片大小
}, },
}, },
filters: {/** filters: {
/**
* 处理富文本里的图片宽度自适应 * 处理富文本里的图片宽度自适应
* 1.去掉img标签里的style、width、height属性 * 1.去掉img标签里的style、width、height属性
* 2.img标签添加style属性max-width:100%;height:auto * 2.img标签添加style属性max-width:100%;height:auto
@@ -704,11 +725,13 @@ formatRichText (html) { //控制小程序中图片大小
return match; return match;
}); });
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) { newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;'); match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match; return match;
}); });
newContent = newContent.replace(/<br[^>]*\/>/gi, ''); newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"'); newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent; return newContent;
}, },
// 时间格式化 // 时间格式化
@@ -724,52 +747,124 @@ formatRichText (html) { //控制小程序中图片大小
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tanchu { background: #fff;position: relative; .tanchu {
background: #fff;
position: relative;
padding: 40rpx 30rpx 40rpx 30rpx; padding: 40rpx 30rpx 40rpx 30rpx;
position: relative; position: relative;
.list{margin-bottom: 140rpx; .list {
.imgBox{height: 500rpx; width: 100%; margin-bottom: 10rpx; position: relative; margin-bottom: 140rpx;
.xiangxi{text-align: center; position: absolute; left: 0; bottom: 20rpx; width: 100%;
text{padding: 10rpx 20rpx; font-size: 32rpx; background-color: rgba(235, 160, 11, .9); color: #def0ea; border-radius: 10px;} .imgBox {
height: 500rpx;
width: 100%;
margin-bottom: 10rpx;
position: relative;
.xiangxi {
text-align: center;
position: absolute;
left: 0;
bottom: 20rpx;
width: 100%;
text {
padding: 10rpx 20rpx;
font-size: 32rpx;
background-color: rgba(235, 160, 11, .9);
color: #def0ea;
border-radius: 10px;
} }
} }
} }
.spbh{ border: 2rpx solid #fff; }
.spbh {
border: 2rpx solid #fff;
.spbhimg { .spbhimg {
image { image {
border: none !important; border: none !important;
} }
} }
} }
.spbh.cur { .spbh.cur {
border: 2rpx solid #eba00b; border: 2rpx solid #eba00b;
border-radius: 10rpx; border-radius: 10rpx;
overflow: hidden; overflow: hidden;
} }
} }
.tingshuList{margin-top: 20rpx; background-color: #fff; padding: 20rpx;
border-radius: 20rpx; margin-bottom: 20rpx; padding-top: 40rpx; .tingshuList {
margin-top: 20rpx;
background-color: #fff;
padding: 20rpx;
border-radius: 20rpx;
margin-bottom: 20rpx;
padding-top: 40rpx;
background-image: linear-gradient(0deg, #f7fffc 0%, #def0ea 100%); background-image: linear-gradient(0deg, #f7fffc 0%, #def0ea 100%);
.item{margin-bottom: 20rpx; vertical-align: middle; }
h4{color: #5fb386; font-size: 40rpx; margin-bottom: 20rpx;} .item {
text{color: #444; font-size: 32rpx; padding-left: 20rpx;} margin-bottom: 20rpx;
vertical-align: middle;
} }
.pjimgs{ margin: 0;flex-wrap: wrap; display: flex; justify-content: space-between;
h4 {
color: #5fb386;
font-size: 40rpx;
margin-bottom: 20rpx;
}
text {
color: #444;
font-size: 32rpx;
padding-left: 20rpx;
}
}
.pjimgs {
margin: 0;
flex-wrap: wrap;
display: flex;
justify-content: space-between;
.item { .item {
width: 23%; width: 23%;
padding-right: 20rpx; padding-right: 20rpx;
margin-top: 10rpx; margin-top: 10rpx;
image { image {
border-radius: 15rpx; border-radius: 15rpx;
} }
} }
} }
.star{display: inline-block; width: 15px; height: 15px; margin-right: 6rpx;}
.starGray{ background : url(../../static/icon/star_greey.png) no-repeat; background-size: contain; } .star {
.starLight{ background : url(../../static/icon/star_light.png) no-repeat; background-size: contain;} display: inline-block;
.quesheng{text-align: center; margin-top: 0rpx; color: #8b8a91;} width: 15px;
height: 15px;
margin-right: 6rpx;
}
.starGray {
background: url(../../static/icon/star_greey.png) no-repeat;
background-size: contain;
}
.starLight {
background: url(../../static/icon/star_light.png) no-repeat;
background-size: contain;
}
.quesheng {
text-align: center;
margin-top: 0rpx;
color: #8b8a91;
}
.pingjia { .pingjia {
background-color: #f5f5f5; background-color: #f5f5f5;
border-radius: 20rpx; border-radius: 20rpx;
@@ -777,18 +872,46 @@ formatRichText (html) { //控制小程序中图片大小
padding: 30rpx 30rpx 20rpx; padding: 30rpx 30rpx 20rpx;
} }
.pingjiaBox{color: #555; margin-bottom: 20rpx;}
.flexbox{display: flex;} .pingjiaBox {
.contentBox{width: 100%;box-sizing: border-box; padding: 0rpx 10rpx 30rpx 6rpx; color: #555;
.content{font-size: 28rpx; line-height: 40rpx;margin-top: 10rpx;} margin-bottom: 20rpx;
.time{font-size: 24rpx; color: #999; padding-top: 6rpx; float: right;}
} }
.flexbox {
display: flex;
}
.contentBox {
width: 100%;
box-sizing: border-box;
padding: 0rpx 10rpx 30rpx 6rpx;
.content {
font-size: 28rpx;
line-height: 40rpx;
margin-top: 10rpx;
}
.time {
font-size: 24rpx;
color: #999;
padding-top: 6rpx;
float: right;
}
}
.spbh { .spbh {
padding-bottom: 10rpx; padding-bottom: 10rpx;
font-size: 26rpx; padding: 0 10rpx; font-size: 26rpx;
padding: 0 10rpx;
} }
.spbhimg { .spbhimg {
width:40px; overflow: hidden; text-align: center; width: 40px;
overflow: hidden;
text-align: center;
image { image {
width: 40px !important; width: 40px !important;
padding: 3px; padding: 3px;
@@ -799,27 +922,63 @@ formatRichText (html) { //控制小程序中图片大小
} }
} }
.username{ margin-left: 10rpx; }
.price{margin-left: 5px; .username {
margin-left: 10rpx;
}
.price {
margin-left: 5px;
color: #ffa200; color: #ffa200;
font-weight: bold;} font-weight: bold;
}
.nowrap { .nowrap {
white-space: nowrap; white-space: nowrap;
overflow-x: hidden; overflow-x: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.touxiang{width:40px; overflow: hidden; text-align: center;
image{width:40px !important; padding: 3px; height: 40px !important; border: 1px solid #eee; border-radius: 64px; overflow: hidden;;} .touxiang {
.username{font-size: 24rpx; color: #999; margin-top: 6rpx; } width: 40px;
overflow: hidden;
text-align: center;
image {
width: 40px !important;
padding: 3px;
height: 40px !important;
border: 1px solid #eee;
border-radius: 64px;
overflow: hidden;
;
} }
.username {
font-size: 24rpx;
color: #999;
margin-top: 6rpx;
}
}
.aligncenter { .aligncenter {
align-items: center; align-items: center;
} }
.xiangqing { .xiangqing {
overflow: hidden; overflow-x: hidden; overflow: hidden;
img{display: block; max-width: 100%;} overflow-x: hidden;
p{max-width: 100%;}
img {
display: block;
max-width: 100%;
} }
p {
max-width: 100%;
}
}
.goods_nav { .goods_nav {
z-index: 1; z-index: 1;
position: fixed; position: fixed;
@@ -881,7 +1040,8 @@ formatRichText (html) { //控制小程序中图片大小
} }
.oldPrice { .oldPrice {
background-color: #ff000013;; background-color: #ff000013;
;
padding: 4rpx 14rpx; padding: 4rpx 14rpx;
border-radius: 20rpx; border-radius: 20rpx;
margin-left: 20rpx; margin-left: 20rpx;

View File

@@ -34,26 +34,13 @@
</view> </view>
<view class="wrap" v-if="contentShow == 1"> <view class="wrap" v-if="contentShow == 1">
<view v-if="1==1"> <u-row gutter="16" justify="flex-start" v-if="tjBookLIst.length > 0">
接口正在调试
</view>
<u-row gutter="16" justify="flex-start" v-if="tjBookLIst.length > 0 && 6==3">
<u-col span="4" v-for="(item,index) in tjBookLIst" :key="index"> <u-col span="4" v-for="(item,index) in tjBookLIst" :key="index">
<view class="videoBox demo-layout bg-purple" @click="goDetail(item)"> <view class="videoBox demo-layout bg-purple" @click="goDetail(item)">
<image :src="item.images" mode="scaleToFill"></image> <image :src="item.images" mode="scaleToFill"></image>
<!-- <u-icon class="playButton" name="play-circle" color="#54a966" size="40"></u-icon> --> <!-- <u-icon class="playButton" name="play-circle" color="#54a966" size="40"></u-icon> -->
</view> </view>
<text class="bookName">{{item.name}}</text> <text class="bookName">{{item.name}}</text>
<!-- <view class="btns flexbox">
<view class="item flexbox" @click="goToListen(item)">
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
<text> </text>
</view>
<view class="item flexbox" @click="wgGoPingshu(item)">
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
<text> </text>
</view>
</view> -->
</u-col> </u-col>
</u-row> </u-row>
<u-divider v-else text="暂无推荐书籍~"></u-divider> <u-divider v-else text="暂无推荐书籍~"></u-divider>
@@ -94,6 +81,7 @@
ygtotalPage: 1, ygtotalPage: 1,
tjPage: 1, tjPage: 1,
tjTotalPage: 1, tjTotalPage: 1,
tjPageSize:9,
tjBookLIst: [], tjBookLIst: [],
contentButtonList: [{ contentButtonList: [{
name: '已购图书' name: '已购图书'
@@ -112,16 +100,11 @@
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log('下拉刷新了') console.log('下拉刷新了')
uni.stopPullDownRefresh();
if (this.contentShow == 0) {
// this.page=1, // 页码
this.bookList = []
this.getfreeBook()
} else if (this.contentShow == 1) {
// this.tjPage=1, // 页码
this.tjBookLIst = [] this.tjBookLIst = []
this.getListDate() this.getListDate()
} this.bookList = []
this.getfreeBook()
uni.stopPullDownRefresh();
}, },
onReachBottom() { onReachBottom() {
this.loadingNow = true this.loadingNow = true
@@ -144,7 +127,7 @@
// } // }
if (this.contentShow == 1) { if (this.contentShow == 1) {
if (this.tjPage < this.tjTotalPage) { if (this.tjPage+1 < this.tjTotalPage) {
this.tjPage++ this.tjPage++
console.log('加载', this.tjPage) console.log('加载', this.tjPage)
this.status = 0 this.status = 0
@@ -233,21 +216,23 @@
.post('book/book/getUserNobuyBooks', { // 磊哥新写 .post('book/book/getUserNobuyBooks', { // 磊哥新写
// .post('book/shopproduct/booklist', { // 原接口 // .post('book/shopproduct/booklist', { // 原接口
'userId': this.userInfo.id, 'userId': this.userInfo.id,
'limit': 9, 'limit': this.tjPageSize,
'page': this.tjPage 'page': this.tjPage
}) })
.then(res => { .then(res => {
console.log(res)
if (res.code == 0 && res.books.length > 0) {
console.log(res,'推荐听书列表') console.log(res,'推荐听书列表')
this.tjBookLIst = res.books if (res.code == 0 && res.page.records.length > 0) {
var yu = res.count % 9 this.tjBookLIst = this.tjBookLIst.concat(res.page.records)
if(yu != 0){ // 计算总页数
this.tjTotalPage = parseInt(res.count / 9) + 1 var yu = res.page.total % this.tjPageSize
console.log(yu,'yu')
if(yu > 0){
this.tjTotalPage = parseInt(res.page.total / this.tjPageSize) +1
// console.log(this.tjTotalPage,'总页数this.tjTotalPage')
}else{ }else{
this.tjTotalPage = parseInt(res.count / 9) this.tjTotalPage = parseInt(res.page.total / this.tjPageSize)
// console.log(this.tjTotalPage,'总页数this.tjTotalPage')
} }
console.log(this.tjTotalPage,'tjTotalPage')
this.status = 3 this.status = 3
}else{ }else{
this.tjTotalPage = 0 this.tjTotalPage = 0