diff --git a/components/news/news.vue b/components/news/news.vue
index 04c5dfe..f7b78c9 100644
--- a/components/news/news.vue
+++ b/components/news/news.vue
@@ -39,16 +39,18 @@
getNews() {
this.$apiServe.getNews().then(res => {
// console.log('行业新闻', res.data.data)
- for (const item of res.data.data) {
+ let newsData = res.data.data
+ for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
}
- this.newsList = res.data.data
+ newsData = newsData.slice(0, 3)
+ this.newsList = newsData
}).finally(_ => {})
},
// 跳转到新闻详情页
clickNews(item) {
uni.navigateTo({
- url: '../../packageReport/xwDetail/xwDetail?id=' + item.id
+ url: '../../packageReport/newsDetail/newsDetail?id=' + item.id
})
},
}
diff --git a/components/productsBtn/productsBtn.vue b/components/productsBtn/productsBtn.vue
index 7c27b6b..a05fb37 100644
--- a/components/productsBtn/productsBtn.vue
+++ b/components/productsBtn/productsBtn.vue
@@ -18,7 +18,7 @@
- {{item.title}}
+ {{item.desc}}
{
- if (data == 0) {
- this.sortType = 1
- } else if (data == 1) {
- this.sortType = 2
- }
- })
- this.getProducts()
+ // uni.$on("getCurrent", data => {
+ // if (data == 0) {
+ // this.sortType = 1
+ // } else if (data == 1) {
+ // this.sortType = 2
+ // }
+ // })
+ this.getProductsByThumb()
this.imgUrl = uni.getStorageSync('img_url')
},
methods: {
- //获取产品列表
- getProducts() {
+ //获取按点赞量排列的产品列表
+ getProductsByThumb() {
this.$apiServe.getProducts({
- sortType: this.sortType,
+ sortType: 2,
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
@@ -71,11 +70,11 @@
this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0]
}
- // this.$emit("getChild", tags.length);
+ this.$emit("getThumbLength", tags.length);
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
- // this.productList = [...this.productList, ...res.data.data]
+ this.productList = [...this.productList, ...res.data.data]
//这用于上架时间和点赞量的数据切换
- this.productList = res.data.data
+ // this.productList = res.data.data
}).finally(_ => {
})
diff --git a/components/productsByTime/productsByTime.vue b/components/productsByTime/productsByTime.vue
new file mode 100644
index 0000000..827eaea
--- /dev/null
+++ b/components/productsByTime/productsByTime.vue
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item.cate_name}}
+
+
+
+ {{item.name}}
+
+
+
+ {{item.title}}
+
+
+
+
+ 发布日期:
+ {{item.pub_time_str}}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packageMy/bindCompany/bindCompany.vue b/packageMy/bindCompany/bindCompany.vue
index 9020cf3..b754c6b 100644
--- a/packageMy/bindCompany/bindCompany.vue
+++ b/packageMy/bindCompany/bindCompany.vue
@@ -5,11 +5,20 @@
+
+
+
+
+
+
+
diff --git a/packageReport/xwDetail/xwDetail.vue b/packageReport/newsDetail/newsDetail.vue
similarity index 100%
rename from packageReport/xwDetail/xwDetail.vue
rename to packageReport/newsDetail/newsDetail.vue
diff --git a/packageReport/news/news.vue b/packageReport/newsList/newsList.vue
similarity index 99%
rename from packageReport/news/news.vue
rename to packageReport/newsList/newsList.vue
index 8c7fe62..da2f81b 100644
--- a/packageReport/news/news.vue
+++ b/packageReport/newsList/newsList.vue
@@ -26,8 +26,6 @@
background: #FFFFFF;
}
-
-
.no-data {
text-align: center;
margin-top: 29rpx;
diff --git a/pages.json b/pages.json
index 64e0298..44b9936 100644
--- a/pages.json
+++ b/pages.json
@@ -155,7 +155,7 @@
{
"root": "packageReport",
"pages": [{
- "path": "news/news",
+ "path": "newsList/newsList",
"style": {
"navigationBarTitleText": "行内新闻",
"navigationBarTextStyle": "white",
@@ -171,7 +171,7 @@
"enablePullDownRefresh": false
}
}, {
- "path": "xwDetail/xwDetail",
+ "path": "newsDetail/newsDetail",
"style": {
"navigationBarTitleText": "行业新闻详情",
"navigationBarTextStyle": "white",
@@ -187,6 +187,15 @@
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
}
+ }, {
+ "path": "newProductRelease/newProductRelease",
+ "style": {
+ "navigationBarTitleText": "新品发布",
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#12CA64",
+ "enablePullDownRefresh": false
+ }
+
}
]
}
diff --git a/pages/detail/productsDetail/productsDetail.vue b/pages/detail/productsDetail/productsDetail.vue
index fdc89d1..e2836f4 100644
--- a/pages/detail/productsDetail/productsDetail.vue
+++ b/pages/detail/productsDetail/productsDetail.vue
@@ -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() {
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 531fe7b..1dfb68d 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -34,7 +34,10 @@
-
+
+
+
+
没有更多数据了
@@ -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 => {
diff --git a/pages/report/report.vue b/pages/report/report.vue
index 4b1833f..f97c93f 100644
--- a/pages/report/report.vue
+++ b/pages/report/report.vue
@@ -28,7 +28,7 @@
新品发布
-
+
@@ -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({
diff --git a/service/request.js b/service/request.js
index b3450fc..8a1141d 100644
--- a/service/request.js
+++ b/service/request.js
@@ -244,7 +244,7 @@ const apiService = {
},
// 获取行业新闻
getNews() {
- const url = `/news/nlists/?pageSize=3&pageNum=1`
+ const url = `/news/nlists/?pageSize=50&pageNum=1`
return new Promise((resolve, reject) => {
resolve(service.get(url))
})
@@ -258,7 +258,7 @@ const apiService = {
},
// 获取认证厂家列表
getCertifiedCj() {
- const url = `/news/flists?pageSize=3&pageNum=1`
+ const url = `/news/flists?pageSize=50&pageNum=1`
return new Promise((resolve, reject) => {
resolve(service.get(url))
})
@@ -382,16 +382,16 @@ const apiService = {
})
},
postMobileByMnp(data) {
- const url = `/user/getMobileByMnp`
- return new Promise((resolve, reject) => {
- resolve(service.post(url, data))
- })
+ const url = `/user/getMobileByMnp`
+ return new Promise((resolve, reject) => {
+ resolve(service.post(url, data))
+ })
},
postImage(data) {
- const url = `/upload/image/`
- return new Promise((resolve, reject) => {
- resolve(service.post(url, data))
- })
+ const url = `/upload/image/`
+ return new Promise((resolve, reject) => {
+ resolve(service.post(url, data))
+ })
},
// 解密
decrypt(data) {