行业报告上方三个按钮的列表展示

This commit is contained in:
邓洁
2023-02-03 19:31:50 +08:00
parent ec3c5b8351
commit 4db15d21cf
6 changed files with 126 additions and 19 deletions

View File

@@ -33,7 +33,10 @@
methods: {
// 获取认证厂家列表
getCertifiedCj() {
this.$apiServe.getCertifiedCj().then(res => {
this.$apiServe.getCertifiedCj({
pageSize: 2,
pageNum: 1
}).then(res => {
// console.log('认证厂家', res.data.data)
this.cjsList = res.data.data
}).finally(_ => {})

View File

@@ -37,13 +37,16 @@
},
methods: {
getNews() {
this.$apiServe.getNews().then(res => {
this.$apiServe.getNews({
pageSize: 3,
pageNum: 1
}).then(res => {
// console.log('行业新闻', res.data.data)
let newsData = res.data.data
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
}
newsData = newsData.slice(0, 3)
// newsData = newsData.slice(0, 3)
this.newsList = newsData
}).finally(_ => {})
},

View File

@@ -1,6 +1,20 @@
<template>
<view>
<certifiedCj></certifiedCj>
<view class="xw_content" v-for="(item,index) in cjsList" :key="index" @click="clickCj(item)">
<u--image :src="imgUrl+item.cover" width="112rpx" height="112rpx" :lazy-load="true">
</u--image>
<view class="xw_right">
<view class="xw_title">
{{item.name}}
</view>
<view style="display: flex;">
<!-- <text class="cj_tags" v-for="(tagsItem,tagsIndex) in item.tags" :key="tagsIndex">
{{tagsItem.tag}}
</text> -->
<text class="cj_tags">{{item.tag}}</text>
</view>
</view>
</view>
<view v-if="cjsShow" class="no-data">已经到底啦</view>
</view>
</template>
@@ -9,11 +23,38 @@
export default {
data() {
return {
cjsShow: true
cjsShow: true,
cjsList: [],
imgUrl: '',
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
}
},
onLoad() {
this.getCertifiedCj()
this.imgUrl = uni.getStorageSync('img_url')
},
onReachBottom() {
this.pageNum++
this.getCertifiedCj()
},
methods: {
// this.cjsShow = this.list.length === 0 ? true : false
// 获取认证厂家列表
getCertifiedCj() {
this.$apiServe.getCertifiedCj({
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// console.log('认证厂家', res)
this.cjsList = [...this.cjsList, ...res.data.data]
}).finally(_ => {})
},
// 跳转到认证厂家详情页
clickCj(item) {
uni.navigateTo({
url: '../certifiedCjDetail/certifiedCjDetail?id=' + item.id
})
}
}
}
</script>

View File

@@ -1,6 +1,9 @@
<template>
<view>
<productsByTime></productsByTime>
<productsByTime ref="productsByTime" @getTimeLength="getTimeLength"></productsByTime>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-show="reachBottomLength===0">
没有更多数据了</view>
</view>
</template>
@@ -8,11 +11,22 @@
export default {
data() {
return {
reachBottomLength: ''
}
},
onReachBottom() {
this.$refs.productsByTime.pageNum++
this.$refs.productsByTime.getProductsByTime()
},
onLoad() {
this.$refs.productsByTime.pageSize = 2
this.$refs.productsByTime.getProductsByTime()
},
methods: {
//获取按上架时间排列的产品列表length
getTimeLength(e) {
this.reachBottomLength = e
}
}
}
</script>

View File

@@ -1,22 +1,68 @@
<template>
<view>
<news></news>
<view class="xw_content" v-for="(item,index) in newsList" :key="index" @click="clickNews(item)">
<u--image :src="imgUrl+item.cover" width="192rpx" height="122rpx" :lazy-load="true">
</u--image>
<view class="xw_right">
<view class="xw_title">
{{item.title}}
</view>
<view style="display: flex;">
<text class="xw_time">
{{item.pub_time_str}}
</text>
<text class="xw_time xw_place">
{{item.pub_name}}
</text>
</view>
</view>
</view>
<view v-if="newsShow" class="no-data">已经到底啦</view>
</view>
</template>
<script>
import {
dateFormat
} from '../../utills/date.js'
export default {
data() {
return {
newsShow: true,
imgUrl: '',
newsList: [],
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
}
},
onLoad() {
this.getNews()
this.imgUrl = uni.getStorageSync('img_url')
},
onReachBottom() {
this.pageNum++
this.getNews()
},
methods: {
// this.newsShow = this.list.length === 0 ? true : false
getNews() {
this.$apiServe.getNews({
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// console.log('行业新闻', res.data.data)
let newsData = res.data.data
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
}
this.newsList = [...this.newsList, ...newsData]
}).finally(_ => {})
},
// 跳转到新闻详情页
clickNews(item) {
uni.navigateTo({
url: '../newsDetail/newsDetail?id=' + item.id
})
},
}
}
</script>

View File

@@ -205,7 +205,7 @@ const toast = {
}
}
const apiService = {
uploadImgUrl: serverHost + `/upload/image/`,
uploadImgUrl: serverHost + `/upload/image/`,
imgUrl: serverHost,
// login: data => {
// data = Object.assign(data || {}, {})
@@ -243,10 +243,10 @@ const apiService = {
})
},
// 获取行业新闻
getNews() {
const url = `/news/nlists/?pageSize=50&pageNum=1`
getNews(data) {
const url = `/news/nlists`
return new Promise((resolve, reject) => {
resolve(service.get(url))
resolve(service.get(url, data))
})
},
// 获取行业新闻详情
@@ -257,10 +257,10 @@ const apiService = {
})
},
// 获取认证厂家列表
getCertifiedCj() {
const url = `/news/flists?pageSize=50&pageNum=1`
getCertifiedCj(data) {
const url = `/news/flists`
return new Promise((resolve, reject) => {
resolve(service.get(url))
resolve(service.get(url, data))
})
},
// 获取认证厂家详情