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() {
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
})
},
}

View File

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

View File

@@ -43,25 +43,24 @@
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.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(_ => {
})

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">
<rich-text :nodes="content"></rich-text>
</u-modal>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
<script>
import login from 'pages/my/login/login'
export default {
components: {
login
},
data() {
return {
name: '',
@@ -17,8 +26,21 @@
showM: false,
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: {
handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name
@@ -42,6 +64,22 @@
// uni.switchTab({
// 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"
@cancel="cancel">
</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>
</template>
@@ -36,9 +43,14 @@
import {
dateFormatXwDetail
} from '../../utills/date.js'
import login from 'pages/my/login/login'
export default {
components: {
login
},
data() {
return {
isLoad: true,
id: '',
showM: false,
content: '您确定删除吗?',
@@ -52,17 +64,19 @@
}, {
name: '创意发布'
}],
needsList: [{
id: 1,
desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
pname: '产品名称产品名称产品名称',
pub_time: '2022-12-03 09:59',
}, {
id: 2,
desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
pname: '产品名称产品名称产品名称',
pub_time: '2022-12-03 09:59',
}]
needsList: [
// {
// id: 1,
// desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
// pname: '产品名称产品名称产品名称',
// pub_time: '2022-12-03 09:59',
// }, {
// id: 2,
// desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
// pname: '产品名称产品名称产品名称',
// pub_time: '2022-12-03 09:59',
// },
]
}
},
onLoad() {
@@ -72,6 +86,15 @@
this.type = 1
}
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: {
//获取创意发布
@@ -114,6 +137,22 @@
},
cancel() {
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;
}
.no-data {
text-align: center;
margin-top: 29rpx;

View File

@@ -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
}
}
]
}

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({

View File

@@ -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) {