This commit is contained in:
@fawn-nine
2023-09-22 13:42:32 +08:00
parent 8f970b3d0e
commit ce389485d6
2 changed files with 455 additions and 309 deletions

View File

@@ -14,16 +14,18 @@
</view>
<view class="commodityContent">
<view class="commodityPrice" v-if="productInfo.activityPrice && productInfo.activityPrice > 0">
<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 style="font-size: 28rpx;"></span><em>{{productInfo.activityPrice}}</em>
<span class="oldPrice ">原价<span
style="font-size: 20rpx;padding-left:10rpx;"></span>{{productInfo.price}}</span>
</view>
<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>
</view>
<view class="commodityyName">
{{productInfo.productName}}
<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 class="pingjia" v-if="linkProducts && linkProducts.length > 0 && linkProducts[0]">
<view class="">
@@ -38,7 +40,8 @@
<image :src="item.productImages" mode="aspectFit"></image>
</view>
<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>
</view>
</view>
@@ -49,13 +52,11 @@
</view>
<view class="contentButton">
<u-tabs :scrollable="false" :list="contentButtonList" @click="contentButtonClick"
:activeStyle="{
<u-tabs :scrollable="false" :list="contentButtonList" @click="contentButtonClick" :activeStyle="{
color: '#303133',
fontWeight: 'bold',
fontSize: '28rpx'
}"
:inactiveStyle="{
}" :inactiveStyle="{
color: '#606266',
fontSize: '28rpx'
}"></u-tabs>
@@ -64,47 +65,54 @@
<view v-if="contentShow == 0">
<view class="pingjia">
<!-- <h4></h4> -->
<view class="" v-if="listenList.length > 0 && listenList[0]" style="margin:0rpx 0rpx 30rpx;">
<view class="" v-if="listenList.length > 0 && listenList[0]" style="margin:0rpx 0rpx 30rpx;">
<view class="">
<view style="font-weight: 600;margin-bottom: 30rpx;color:#71d5a1;">赠送听书权益</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)">
<image :src="item.images" mode="aspectFit"></image>
</view>
<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-else name="volume" color="#71d5a1" size="24" @click="goToListenNone(item.id)"></u-icon>
<u-icon v-if="item.canListen == 'true'" name="volume" color="#71d5a1" size="24"
@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 class="">
<view style="font-weight: 600;margin:0rpx 0rpx 30rpx;">商品详情</view>
</view>
<view class="bookInfo" >
<view class="bookInfo">
<u-row customStyle="margin-bottom: 10px">
<u-col ><span>书名{{productInfo.productName}}</span></u-col>
<u-col><span>书名{{productInfo.productName}}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col v-if="productInfo.author"><span>作者{{productInfo.author}}</span></u-col>
</u-row>
<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 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 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.pageNum"><span>页数{{productInfo.pageNum}}</span></u-col>
</u-row>
<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>
</view>
<!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> -->
<view class="commodityIntroduce" >
<view v-if="productInfo.productDetails" >
<rich-text v-if="productInfo.productDetails" class="xiangqing" :nodes="productInfo.productDetails|formatRichText"></rich-text>
<view class="commodityIntroduce">
<view v-if="productInfo.productDetails">
<rich-text v-if="productInfo.productDetails" class="xiangqing"
:nodes="productInfo.productDetails|formatRichText"></rich-text>
</view>
</view>
</view>
@@ -114,7 +122,8 @@
</view>
<view class="pingjia" v-else>
<view class="">
<view style="font-weight: 600;margin-bottom: 30rpx;">评价({{commentsList?commentsList.length:0}})</view>
<view style="font-weight: 600;margin-bottom: 30rpx;">评价({{commentsList?commentsList.length:0}})
</view>
<!-- <view class="icon-del rotate"></view> -->
</view>
<!-- 商品评价 -->
@@ -136,7 +145,8 @@
<view class="contentBox">
<div class="pjimgs flexbox">
<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>
</div>
<view class="content" v-html="item.phtml"></view>
@@ -165,25 +175,29 @@
<view class="tanchu">
<view class="list">
<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>
<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>
</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="spbhimg">
<image :src="item.productImages" mode="aspectFit"></image>
</view>
<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>
</view>
</view>
</view>
<uni-goods-nav style="left: 0;" class="goods_nav" :fill="true" :options="options" :buttonGroup="buttonGroup" @click="onClick"
@buttonClick="buttonClickLink" />
<uni-goods-nav style="left: 0;" class="goods_nav" :fill="true" :options="options"
:buttonGroup="buttonGroup" @click="onClick" @buttonClick="buttonClickLink" />
</view>
</u-popup>
</view>
@@ -205,9 +219,9 @@
export default {
data() {
return {
linkimg:'', // 选中的关联商品图片
playData:{},
contentShow:0,
linkimg: '', // 选中的关联商品图片
playData: {},
contentShow: 0,
options: [{
icon: 'cart',
text: '购物车'
@@ -236,12 +250,12 @@
productInfo: {},
productAmount: 1, // 商品数量
cartList: [], // 购物车列表
commentsList:[], // 评论列表
productId:null, // 商品评论
listenList:[], // 关联得听书
linkProducts:[], // 关联的商品,
upoShow:false, // 显示底部购买选项
linkCur : 0, // 当前选中的关联项
commentsList: [], // 评论列表
productId: null, // 商品评论
listenList: [], // 关联得听书
linkProducts: [], // 关联的商品,
upoShow: false, // 显示底部购买选项
linkCur: 0, // 当前选中的关联项
}
},
onLoad(e) {
@@ -258,108 +272,112 @@
musicPlay
},
methods: {
gotoDetail(item){
// console.log(item,'gotoDetail')
gotoDetail(item) {
// console.log(item,'gotoDetail')
uni.navigateTo({
url: '../bookShop/commodityDetail?id=' + item.productId
});
},
closeUpo(){
closeUpo() {
console.log('关闭弹窗')
this.upoShow = false
},
// 点击其他套餐
previewProduct(item,index){
console.log(item,'item')
previewProduct(item, index) {
console.log(item, 'item')
this.linkimg = item.productImages
this.upoShow = true
this.linkCur = index
},
// 获取商品关联商品
getLinkPros(id){
getLinkPros(id) {
this.$http
.post('book/shopproduct/getGlProductList',{
.post('book/shopproduct/getGlProductList', {
'productId': id
})
.then(res => {
console.log('关联商品', res)
if(res.code == 0){
this.linkProducts = res.result
if(this.linkProducts.length > 0){
if (res.code == 0) {
if (res.result.length > 0) {
this.linkProducts = res.result
this.linkimg = this.linkProducts[0].productImages
this.linkCur = 0
}else{
this.linkProducts = []
}
}
})
.catch(e => {
console.log(e,'e')
console.log(e, 'e')
})
},
goToListen(id){
goToListen(id) {
// 跳转到听书
uni.navigateTo({
url: "../listen/listen?bookid="+ id
url: "../listen/listen?bookid=" + id
});
},
// 放大图片
previewImage(url){
previewImage(url) {
console.log(url)
uni.previewImage({
urls: [url]
});
},
// 获取html格式的评论1
getHtmlComment(comment){
// 格式化html
getHtmlComment(comment) {
// 格式化html
// console.log(comment,'comment')
// 这里处理 链接 换行符
let replacedStr = comment.replace(/\[([^(\]|\[)]*)\]/g, (item, index) => {
// console.log(item, index)
var indexss = emojiList1.findIndex(item1 => item1.alt === item)
// console.log(indexss, 'indexss')
return '<img src="https://www.nuttyreading.com/emojis/emojis/qq/' + emojiList1[indexss].url + '" width="18rpx">';
});
// console.log(replacedStr,'replacedStr')
return replacedStr.replace(/(\r\n)|(\n)/g, '<br>');
// 这里处理 链接 换行符
let replacedStr = comment.replace(/\[([^(\]|\[)]*)\]/g, (item, index) => {
// console.log(item, index)
var indexss = emojiList1.findIndex(item1 => item1.alt === item)
// console.log(indexss, 'indexss')
return '<img src="https://www.nuttyreading.com/emojis/emojis/qq/' + emojiList1[indexss].url +
'" width="18rpx">';
});
// console.log(replacedStr,'replacedStr')
return replacedStr.replace(/(\r\n)|(\n)/g, '<br>');
},
// 获取评价
getComments(){
$http.request({
getComments() {
$http.request({
url: "buy/record/All",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档1
data: {
'bookid': this.productId
},
'bookid': this.productId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.code == 0){
if (res.code == 0) {
console.log(res.list, 'res.list')
this.commentsList = res.list.map(item => {
var imgList = []
if(item.images !== null){
if (item.images !== null) {
imgList = item.images.split(',')
item.images = imgList
return item
}else {
} else {
return item
}
})
// 评论格式化
var newarr = []
this.commentsList.forEach((item1)=>{
var pjstr = ''
var zpstr = ''
pjstr = this.getHtmlComment(item1.content)
item1.followUpcontent == '' ? zpstr = '' : zpstr = this.getHtmlComment(item1.followUpcontent)
//console.log(pjstr,'99999999999----------')
item1.phtml = pjstr
item1.zphtml = zpstr
newarr.push(item1)
this.commentsList.forEach((item1) => {
var pjstr = ''
var zpstr = ''
pjstr = this.getHtmlComment(item1.content)
item1.followUpcontent == '' ? zpstr = '' : zpstr = this.getHtmlComment(item1
.followUpcontent)
//console.log(pjstr,'99999999999----------')
item1.phtml = pjstr
item1.zphtml = zpstr
newarr.push(item1)
})
this.commentsList = newarr
@@ -368,16 +386,16 @@
}
})
},
getProDetail(e){
getProDetail(e) {
// 获取商品详情
uni.showLoading({
title: '加载中'
});
console.log(e.id,'e.id')
console.log(e.id, 'e.id')
this.$http
.post('/book/shopproduct/info/' + e.id)
.then(res => {
console.log('shopproduct',res)
console.log('shopproduct', res)
this.productInfo = res.shopProduct
this.listenList = res.shopProduct.bookidsimages
if (this.productInfo.productImageList == null || this.productInfo.productImageList == '') {
@@ -394,21 +412,21 @@
}
uni.hideLoading();
}).catch(e => {
console.log(e,'e')
uni.hideLoading();
if(e.msg == '该商品不存在,看看其他商品吧'){
setTimeout(() => {
uni.navigateBack({
delta: 1
});
},2000)
}
console.log(e, 'e')
uni.hideLoading();
if (e.msg == '该商品不存在,看看其他商品吧') {
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 2000)
}
})
},
contentButtonClick(e){
contentButtonClick(e) {
this.contentShow = e.index
},
// 点击购物车
@@ -419,10 +437,10 @@
});
},
// 关联商品点击按钮组件
buttonClickLink(e){
buttonClickLink(e) {
console.log('点击的是关联商品的组件')
if(e.index == 0){
// 点击的是加入购物车
if (e.index == 0) {
// 点击的是加入购物车
if (this.linkProducts[this.linkCur].productStock == 0) {
uni.showToast({
title: '商品库存不足',
@@ -437,45 +455,46 @@
this.isAddLink(this.linkProducts[this.linkCur])
})
}
}else{
// 点击的是立即购买
if (this.linkProducts[this.linkCur].productStock == 0) {
uni.showToast({
title: '商品库存不足',
icon: "none",
duration: 1000,
});
} else {
uni.navigateTo({
url: '../bookShop/settlement?type=2&list=' + this.linkProducts[this.linkCur].productId
});
}
} else {
// 点击的是立即购买
if (this.linkProducts[this.linkCur].productStock == 0) {
uni.showToast({
title: '商品库存不足',
icon: "none",
duration: 1000,
});
} else {
uni.navigateTo({
url: '../bookShop/settlement?type=2&list=' + this.linkProducts[this.linkCur].productId
});
}
}
},
// 点击按钮组间
buttonClick(e) {
// console.log(e)
if(e.index == 0){
// 点击的是加入购物车
if(this.linkProducts.length > 0){
this.upoShow = true
}else{
this.addCart()
}
// console.log(e)
if (e.index == 0) {
// 点击的是加入购物车
console.log('+.........',this.linkProducts,'this.linkProducts')
if (this.linkProducts.length == 0) {
this.addCart()
} else {
this.upoShow = true
}
}else{
// 点击的是立即购买
if(this.linkProducts.length > 0){
this.upoShow = true
}else{
this.goPurse()
}
} else {
// 点击的是立即购买
if (this.linkProducts.length == 0) {
this.goPurse()
} else {
this.upoShow = true
}
}
},
goToListenNone(){
goToListenNone() {
uni.showToast({
title:'该书暂未生成音频内容,敬请期待!',
icon:'none'
title: '该书暂未生成音频内容,敬请期待!',
icon: 'none'
})
},
// 加入购物车
@@ -664,21 +683,23 @@
}
},
formatRichText (html) { //控制小程序中图片大小
let newContent= html.replace(/<img[^>]*>/gi,function(match,capture){
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi,function(match,capture){
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
formatRichText(html) { //控制小程序中图片大小
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
// 去购物车
goCard() {
uni.switchTab({
@@ -687,139 +708,278 @@ formatRichText (html) { //控制小程序中图片大小
},
},
filters: {/**
* 处理富文本里的图片宽度自适应
* 1.去掉img标签里的style、width、height属性
* 2.img标签添加style属性max-width:100%;height:auto
* 3.修改所有style里的width属性max-width:100%
* 4.去掉<br/>标签
* @param html
* @returns {void|string|*}
*/
formatRichText (html) { //控制小程序中图片大小
let newContent= html.replace(/<img[^>]*>/gi,function(match,capture){
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi,function(match,capture){
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
// 时间格式化
formatDate(date){
console.log(date)
let newDate = new Date(date);
let year = newDate.getFullYear();
let month = newDate.getMonth().toString().padStart(2,0);
let day = newDate.getDay().toString().padStart(2,0);
return year + '-' + month + '-' + day;
}
}
filters: {
/**
* 处理富文本里的图片宽度自适应
* 1.去掉img标签里的style、width、height属性
* 2.img标签添加style属性max-width:100%;height:auto
* 3.修改所有style里的width属性为max-width:100%
* 4.去掉<br/>标签
* @param html
* @returns {void|string|*}
*/
formatRichText(html) { //控制小程序中图片大小
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
// 时间格式化
formatDate(date) {
console.log(date)
let newDate = new Date(date);
let year = newDate.getFullYear();
let month = newDate.getMonth().toString().padStart(2, 0);
let day = newDate.getDay().toString().padStart(2, 0);
return year + '-' + month + '-' + day;
}
}
}
</script>
<style lang="scss" scoped>
.tanchu { background: #fff;position: relative;
.tanchu {
background: #fff;
position: relative;
padding: 40rpx 30rpx 40rpx 30rpx;
position: relative;
.list{margin-bottom: 140rpx;
.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;}
.list {
margin-bottom: 140rpx;
.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;
.spbhimg {
image{
border: none !important;
.spbh {
border: 2rpx solid #fff;
.spbhimg {
image {
border: none !important;
}
}
}
}
.spbh.cur{
.spbh.cur {
border: 2rpx solid #eba00b;
border-radius: 10rpx;
overflow: hidden;
}
border-radius: 10rpx;
overflow: hidden;
}
.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%);
.item{margin-bottom: 20rpx; vertical-align: middle; }
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{
.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%);
.item {
margin-bottom: 20rpx;
vertical-align: middle;
}
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 {
width: 23%;
padding-right: 20rpx;
margin-top: 10rpx;
image{
image {
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; }
.starLight{ background : url(../../static/icon/star_light.png) no-repeat; background-size: contain;}
.quesheng{text-align: center; margin-top: 0rpx; color: #8b8a91;}
.pingjia{
.star {
display: inline-block;
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 {
background-color: #f5f5f5;
border-radius: 20rpx;
// margin-top: 20rpx;
padding: 30rpx 30rpx 20rpx;
}
.pingjiaBox{color: #555; margin-bottom: 20rpx;}
.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;}
.pingjiaBox {
color: #555;
margin-bottom: 20rpx;
}
.spbh{
.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 {
padding-bottom: 10rpx;
font-size: 26rpx; padding: 0 10rpx;
font-size: 26rpx;
padding: 0 10rpx;
}
.spbhimg{
width:40px; overflow: hidden; text-align: center;
image{
width:40px !important;
.spbhimg {
width: 40px;
overflow: hidden;
text-align: center;
image {
width: 40px !important;
padding: 3px;
height: 40px !important;
border: 1px solid #eee;
border: 1px solid #eee;
border-radius: 6rpx;
overflow: hidden;
}
}
.username{ margin-left: 10rpx; }
.price{margin-left: 5px;
color: #ffa200;
font-weight: bold;}
.nowrap {
white-space: nowrap;
overflow-x: hidden;
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;;}
.username{font-size: 24rpx; color: #999; margin-top: 6rpx; }
.username {
margin-left: 10rpx;
}
.aligncenter{
.price {
margin-left: 5px;
color: #ffa200;
font-weight: bold;
}
.nowrap {
white-space: nowrap;
overflow-x: hidden;
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;
;
}
.username {
font-size: 24rpx;
color: #999;
margin-top: 6rpx;
}
}
.aligncenter {
align-items: center;
}
.xiangqing {
overflow: hidden; overflow-x: hidden;
img{display: block; max-width: 100%;}
p{max-width: 100%;}
overflow: hidden;
overflow-x: hidden;
img {
display: block;
max-width: 100%;
}
p {
max-width: 100%;
}
}
.goods_nav {
z-index: 1;
position: fixed;
@@ -881,7 +1041,8 @@ formatRichText (html) { //控制小程序中图片大小
}
.oldPrice {
background-color: #ff000013;;
background-color: #ff000013;
;
padding: 4rpx 14rpx;
border-radius: 20rpx;
margin-left: 20rpx;

View File

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