Merge branch 'dev' into chenxuelian

This commit is contained in:
”chenxuelian“
2023-01-17 23:36:28 +08:00
14 changed files with 282 additions and 85 deletions

View File

@@ -120,15 +120,15 @@
//收藏按钮
starTap() {
this.detailList.type = !this.detailList.type
this.$apiServe.collect(this.id).then(res => {
console.log('收藏成功', res.data)
if (res.data.code == 1) {
this.detailList.type = 1
this.$toast.warn('收藏成功')
} else {
this.$toast.warn('收藏失败')
}
}).finally(_ => {})
// this.$apiServe.collect(this.id).then(res => {
// console.log('收藏成功', res.data)
// if (res.data.code == 1) {
// this.detailList.type = 1
// this.$toast.warn('收藏成功')
// } else {
// this.$toast.warn('收藏失败')
// }
// }).finally(_ => {})
},
//点赞按钮
heartTap() {

View File

@@ -34,7 +34,10 @@
</u-tabs>
</view>
<!-- 产品 -->
<products ref="getProductsByTime"></products>
<productsByTime v-if="tabCurrent==0" ref="productsByTime" @getTimeLength="getTimeLength">
</productsByTime>
<productsByThumb v-if="tabCurrent==1" ref="productsByThumb" @getThumbLength="getThumbLength">
</productsByThumb>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-show="reachBottomLength===0">
没有更多数据了</view>
@@ -60,15 +63,16 @@
imgUrl: '',
swiperList: [],
reachBottomLength: '',
productList: [],
pageNum: 1,
sortType: ''
}
},
onReachBottom() {
this.pageNum += 1
if (this.reachBottomLength !== 0) {
this.getNewProducts()
if (this.tabCurrent == 0 && this.reachBottomLength !== 0) {
this.$refs.productsByTime.pageNum++
this.$refs.productsByTime.getProductsByTime()
}
if (this.tabCurrent == 1 && this.reachBottomLength !== 0) {
this.$refs.productsByThumb.pageNum++
this.$refs.productsByThumb.getProductsByThumb()
}
},
onLoad() {
@@ -78,36 +82,23 @@
this.imgUrl = uni.getStorageSync('img_url')
},
methods: {
//获取按上架时间排列的产品列表length
getTimeLength(e) {
this.reachBottomLength = e
},
//获取按点赞量排列的产品列表length
getThumbLength(e) {
this.reachBottomLength = e
},
//点击上架时间和点赞量切换页面
tabChange(data) {
this.tabCurrent = data.index
uni.$emit("getCurrent", data.index);
if (data.index == 0) {
this.sortType = 1
this.$refs.productsByTime.getProductsByTime()
} else if (data.index == 1) {
this.$refs.getProductsByTime.getProducts()
this.sortType = 2
this.$refs.productsByThumb.getProductsByThumb()
}
},
//下拉刷新获取新数据
getNewProducts() {
this.$apiServe.getProducts({
sortType: this.sortType,
pageSize: 4,
pageNum: this.pageNum
}).then(res => {
let tags = res.data.data
for (const item of tags) {
let tag = item.tags
this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0]
}
if (tags.length === 0) {
this.reachBottomLength = tags.length
}
this.$refs.getProductsByTime.productList.push(...res.data.data)
})
},
//获取一级分类
getCategories() {
this.$apiServe.getCategories().then(res => {

View File

@@ -28,7 +28,7 @@
</u--image>
<text class="xpfb_text text">新品发布</text>
</view>
<products></products>
<productsByTime></productsByTime>
</view>
<!-- 认证厂家 -->
@@ -69,7 +69,11 @@
//点击行内新闻时
if (listIndex == 0) {
uni.navigateTo({
url: '../../packageReport/news/news'
url: '../../packageReport/newsList/newsList'
})
} else if (listIndex == 1) {
uni.navigateTo({
url: '../../packageReport/newProductRelease/newProductRelease'
})
} else if (listIndex == 2) {
uni.navigateTo({