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

@@ -39,16 +39,18 @@
getNews() { getNews() {
this.$apiServe.getNews().then(res => { this.$apiServe.getNews().then(res => {
// console.log('行业新闻', res.data.data) // 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) item.pub_time_str = dateFormat(item.pub_time_str)
} }
this.newsList = res.data.data newsData = newsData.slice(0, 3)
this.newsList = newsData
}).finally(_ => {}) }).finally(_ => {})
}, },
// 跳转到新闻详情页 // 跳转到新闻详情页
clickNews(item) { clickNews(item) {
uni.navigateTo({ uni.navigateTo({
url: '../../packageReport/xwDetail/xwDetail?id=' + item.id url: '../../packageReport/newsDetail/newsDetail?id=' + item.id
}) })
}, },
} }

View File

@@ -18,7 +18,7 @@
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag> <u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
</view> </view>
<view class="product_desc"> <view class="product_desc">
{{item.title}} {{item.desc}}
</view> </view>
<view class="releaseDate"> <view class="releaseDate">
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx" <u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"

View File

@@ -43,25 +43,24 @@
productList: [], productList: [],
pageNum: 1, // pageNum: 1, //
pageSize: 4, // pageSize: 4, //
sortType: ''
} }
}, },
created() { created() {
uni.$on("getCurrent", data => { // uni.$on("getCurrent", data => {
if (data == 0) { // if (data == 0) {
this.sortType = 1 // this.sortType = 1
} else if (data == 1) { // } else if (data == 1) {
this.sortType = 2 // this.sortType = 2
} // }
}) // })
this.getProducts() this.getProductsByThumb()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
// //
getProducts() { getProductsByThumb() {
this.$apiServe.getProducts({ this.$apiServe.getProducts({
sortType: this.sortType, sortType: 2,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum pageNum: this.pageNum
}).then(res => { }).then(res => {
@@ -71,11 +70,11 @@
this.tagsArray = tag.split(',') this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0] 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(_ => { }).finally(_ => {
}) })

View File

@@ -0,0 +1,95 @@
<template>
<view>
<view class="products_box">
<u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)">
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
</u-image>
<view class="bgContent">
<view>
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true">
</u-image>
<view class="img_tag">{{item.cate_name}}</view>
</view>
<view style="padding: 14rpx 22rpx;">
<view class="title_box">
<text class="title">{{item.name}}</text>
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
</view>
<view class="product_desc">
{{item.title}}
</view>
<view class="releaseDate">
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
:lazy-load="true">
</u-image>
<text class="release">发布日期</text>
<text>{{item.pub_time_str}}</text>
</view>
</view>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imgUrl: '',
tagsArray: [],
productList: [],
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
// sortType: ''
}
},
created() {
// uni.$on("getCurrent", data => {
// if (data == 0) {
// this.sortType = 1
// } else if (data == 1) {
// this.sortType = 2
// }
// })
this.getProductsByTime()
this.imgUrl = uni.getStorageSync('img_url')
},
methods: {
//获取按上架时间排列的产品列表
getProductsByTime() {
this.$apiServe.getProducts({
sortType: 1,
pageSize: this.pageSize,
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]
}
this.$emit("getTimeLength", tags.length);
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
this.productList = [...this.productList, ...res.data.data]
//这用于上架时间和点赞量的数据切换
// this.productList = res.data.data
}).finally(_ => {
})
},
//点击图片跳转到详情页
toDetailPage(item) {
uni.navigateTo({
url: '/pages/detail/productsDetail/productsDetail?id=' + item.id
})
}
}
}
</script>
<style lang="scss">
</style>

View File

@@ -5,11 +5,20 @@
<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm"> <u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
<rich-text :nodes="content"></rich-text> <rich-text :nodes="content"></rich-text>
</u-modal> </u-modal>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view> </view>
</template> </template>
<script> <script>
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
name: '', name: '',
@@ -17,8 +26,21 @@
showM: false, showM: false,
content: `您的申请已提交<br> content: `您的申请已提交<br>
请静待人工审核`, 请静待人工审核`,
isLoad: true,
} }
}, },
onLoad() {
this.getIdeasAndNeeds()
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: { methods: {
handleSureClick() { handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name let name = this.$refs.nameAndphone.model.userInfo.name
@@ -42,6 +64,22 @@
// uni.switchTab({ // uni.switchTab({
// url: '/pages/my/my' // url: '/pages/my/my'
// }) // })
},
reOnLoad() {
console.log('----------------true')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试')
} }
} }

View File

@@ -29,6 +29,13 @@
<u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm" <u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
@cancel="cancel"> @cancel="cancel">
</u-modal> </u-modal>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;" v-if="needsList.length==0">
暂无更多记录</view>
</view> </view>
</template> </template>
@@ -36,9 +43,14 @@
import { import {
dateFormatXwDetail dateFormatXwDetail
} from '../../utills/date.js' } from '../../utills/date.js'
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
isLoad: true,
id: '', id: '',
showM: false, showM: false,
content: '您确定删除吗?', content: '您确定删除吗?',
@@ -52,17 +64,19 @@
}, { }, {
name: '创意发布' name: '创意发布'
}], }],
needsList: [{ needsList: [
id: 1, // {
desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...', // id: 1,
pname: '产品名称产品名称产品名称', // desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
pub_time: '2022-12-03 09:59', // pname: '产品名称产品名称产品名称',
}, { // pub_time: '2022-12-03 09:59',
id: 2, // }, {
desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...', // id: 2,
pname: '产品名称产品名称产品名称', // desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
pub_time: '2022-12-03 09:59', // pname: '产品名称产品名称产品名称',
}] // pub_time: '2022-12-03 09:59',
// },
]
} }
}, },
onLoad() { onLoad() {
@@ -72,6 +86,15 @@
this.type = 1 this.type = 1
} }
this.getIdeasAndNeeds() this.getIdeasAndNeeds()
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
}, },
methods: { methods: {
//获取创意发布 //获取创意发布
@@ -114,6 +137,22 @@
}, },
cancel() { cancel() {
this.showM = false this.showM = false
},
reOnLoad() {
console.log('----------------true')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试')
} }
} }
} }

View File

@@ -0,0 +1,22 @@
<template>
<view>
<productsByTime></productsByTime>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -26,8 +26,6 @@
background: #FFFFFF; background: #FFFFFF;
} }
.no-data { .no-data {
text-align: center; text-align: center;
margin-top: 29rpx; margin-top: 29rpx;

View File

@@ -155,7 +155,7 @@
{ {
"root": "packageReport", "root": "packageReport",
"pages": [{ "pages": [{
"path": "news/news", "path": "newsList/newsList",
"style": { "style": {
"navigationBarTitleText": "行内新闻", "navigationBarTitleText": "行内新闻",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
@@ -171,7 +171,7 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, { }, {
"path": "xwDetail/xwDetail", "path": "newsDetail/newsDetail",
"style": { "style": {
"navigationBarTitleText": "行业新闻详情", "navigationBarTitleText": "行业新闻详情",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
@@ -187,6 +187,15 @@
"navigationBarBackgroundColor": "#12CA64", "navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, {
"path": "newProductRelease/newProductRelease",
"style": {
"navigationBarTitleText": "新品发布",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
}
} }
] ]
} }

View File

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

View File

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

View File

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

View File

@@ -244,7 +244,7 @@ const apiService = {
}, },
// 获取行业新闻 // 获取行业新闻
getNews() { getNews() {
const url = `/news/nlists/?pageSize=3&pageNum=1` const url = `/news/nlists/?pageSize=50&pageNum=1`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.get(url)) resolve(service.get(url))
}) })
@@ -258,7 +258,7 @@ const apiService = {
}, },
// 获取认证厂家列表 // 获取认证厂家列表
getCertifiedCj() { getCertifiedCj() {
const url = `/news/flists?pageSize=3&pageNum=1` const url = `/news/flists?pageSize=50&pageNum=1`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.get(url)) resolve(service.get(url))
}) })
@@ -382,16 +382,16 @@ const apiService = {
}) })
}, },
postMobileByMnp(data) { postMobileByMnp(data) {
const url = `/user/getMobileByMnp` const url = `/user/getMobileByMnp`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.post(url, data)) resolve(service.post(url, data))
}) })
}, },
postImage(data) { postImage(data) {
const url = `/upload/image/` const url = `/upload/image/`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.post(url, data)) resolve(service.post(url, data))
}) })
}, },
// 解密 // 解密
decrypt(data) { decrypt(data) {