首页初次对接口

This commit is contained in:
clay
2022-12-25 16:05:39 +08:00
parent 4050e638f0
commit fd6f5b5390
7 changed files with 305 additions and 191 deletions

View File

@@ -1,16 +1,17 @@
<template>
<view>
<view class="xw_content" v-for="(item,index) in cjsList" :key="index" @click="clickCj(index)">
<u--image :src="item.src" width="112rpx" height="112rpx" :lazy-load="true">
<view class="xw_content" v-for="(item,index) in cjsList" :key="index" @click="clickCj(item)">
<u--image :src="item.cover" width="112rpx" height="112rpx" :lazy-load="true">
</u--image>
<view class="xw_right">
<view class="xw_title">
{{item.title}}
{{item.name}}
</view>
<view style="display: flex;">
<text class="cj_tags" v-for="(tagsItem,tagsIndex) in item.tags" :key="tagsIndex">
<!-- <text class="cj_tags" v-for="(tagsItem,tagsIndex) in item.tags" :key="tagsIndex">
{{tagsItem.tag}}
</text>
</text> -->
<text class="cj_tags">{{item.tag}}</text>
</view>
</view>
</view>
@@ -21,48 +22,56 @@
export default {
data() {
return {
cjsList: [
cjsList: [{
src: '/static/report/zhanwei_xf(1).png',
title: '西安兴沃丰餐饮管理有限责任公司',
tags: [{
tag: '咖啡'
},
{
tag: '饮品'
}
]
},
{
src: '/static/report/zhanwei_xf(1).png',
title: '福建省海纳川食品有限公司',
tags: [{
tag: '活冻鲍鱼'
},
{
tag: '鲍鱼罐头'
},
{
tag: '佛跳墙'
},
{
tag: '海螺片'
}
// {
// src: '/static/report/zhanwei_xf(1).png',
// title: '西安兴沃丰餐饮管理有限责任公司',
// tags: [{
// tag: '咖啡'
// },
// {
// tag: '饮品'
// }
// ]
// },
// {
// src: '/static/report/zhanwei_xf(1).png',
// title: '福建省海纳川食品有限公司',
// tags: [{
// tag: '活冻鲍鱼'
// },
// {
// tag: '鲍鱼罐头'
// },
// {
// tag: '佛跳墙'
// },
// {
// tag: '海螺片'
// }
]
},
// ]
// },
]
}
},
created() {
this.getCertifiedCj()
},
methods: {
// 获取认证厂家列表
getCertifiedCj() {
this.$apiServe.getCertifiedCj().then(res => {
// console.log('认证厂家', res.data.data)
this.cjsList = res.data.data
}).finally(_ => {})
},
// 跳转到认证厂家详情页
clickCj(index) {
if (index == 0) {
uni.navigateTo({
url: '../../packageReport/certifiedCjDetail/certifiedCjDetail'
})
}
clickCj(item) {
uni.navigateTo({
url: '../../packageReport/certifiedCjDetail/certifiedCjDetail?id=' + item.id
})
}
}
}

View File

@@ -1,7 +1,7 @@
<template>
<view>
<view class="xw_content" v-for="(item,index) in newsList" :key="index" @click="clickNews(index)">
<u--image :src="item.src" width="192rpx" height="122rpx" :lazy-load="true">
<view class="xw_content" v-for="(item,index) in newsList" :key="index" @click="clickNews(item)">
<u--image :src="item.cover" width="192rpx" height="122rpx" :lazy-load="true">
</u--image>
<view class="xw_right">
<view class="xw_title">
@@ -9,10 +9,10 @@
</view>
<view style="display: flex;">
<text class="xw_time">
{{item.time}}
{{item.pub_time}}
</text>
<text class="xw_time xw_place">
{{item.place}}
{{item.pub_name}}
</text>
</view>
</view>
@@ -24,35 +24,43 @@
export default {
data() {
return {
newsList: [{
src: '/static/report/zhanwei_xf.png',
title: '2022近50款食品饮料新品创新的方向都在这里',
time: '2022-12-03 09:59',
place: '第一食品资讯官方账号'
},
{
src: '/static/report/zhanwei_xf.png',
title: '食品企业如何开发新产品?创新思维又发挥着怎样的效应呢?',
time: '2022-10-18 14:43',
place: '腾讯新闻 '
},
{
src: '/static/report/zhanwei_xf.png',
title: '食品企业如何开发新产品?创新思维又发挥着怎样的效应呢?',
time: '2022-10-18 14:43',
place: '腾讯新闻'
},
newsList: [
// {
// src: '/static/report/zhanwei_xf.png',
// title: '2022近50款食品饮料新品创新的方向都在这里',
// time: '2022-12-03 09:59',
// place: '第一食品资讯官方账号'
// },
// {
// src: '/static/report/zhanwei_xf.png',
// title: '食品企业如何开发新产品?创新思维又发挥着怎样的效应呢?',
// time: '2022-10-18 14:43',
// place: '腾讯新闻 '
// },
],
}
},
created() {
this.getNews()
},
methods: {
//获取行业新闻
// {
// pageSize: 2,
// pageNum: 1
// }
getNews() {
this.$apiServe.getNews().then(res => {
// console.log('行业新闻', res.data.data)
this.newsList = res.data.data
}).finally(_ => {})
},
// 跳转到新闻详情页
clickNews(index) {
if (index == 0) {
uni.navigateTo({
url: '../../packageReport/xwDetail/xwDetail'
})
}
clickNews(item) {
uni.navigateTo({
url: '../../packageReport/xwDetail/xwDetail?id=' + item.id
})
},
}
}

View File

@@ -2,31 +2,29 @@
<view>
<view class="products_box">
<u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index">
<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="item.src" width="346rpx" height="320rpx" :lazy-load="true"
@click="toDetailPage()">
<u-image :src="item.cover" width="346rpx" height="320rpx" :lazy-load="true">
</u-image>
<view class="img_tag">{{item.img_tag}}</view>
<view class="img_tag">{{item.cate_name}}</view>
</view>
<view style="padding: 14rpx 22rpx;">
<view class="title_box">
<text class="title">{{item.title}}</text>
<text class="title">{{item.name}}</text>
<u-tag :text="item.tag" type="warning" shape="circle"></u-tag>
</view>
<view class="product_desc">
{{item.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.time}}</text>
<text>{{item.pub_time}}</text>
</view>
</view>
</view>
@@ -37,49 +35,72 @@
</template>
<script>
// import {
// simpleDateFormat,
// simpleDateFormatByMoreLine
// } from '@/utills/util.js'
export default {
data() {
return {
productList: [{
src: '/static/products/zhanwei_dg.png',
title: '锅巴',
tag: '无添加剂',
img_tag: '零食铺子',
desc: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg.png',
title: '干吃汤圆',
tag: '天然原料',
img_tag: '糕点卷酥',
desc: '休闲食品厂家甜品糯米食品零食闽南特产宵夜好吃糍粑',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg.png',
title: '紫薯魔芋人参魔芋人参魔芋人参…',
tag: '天然原料',
img_tag: '健康创新',
desc: '紫薯魔芋人参代餐粉 冲调饮品贴牌加工 五谷杂粮粉代餐',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg.png',
title: '焦糖饼干',
tag: '无防腐剂',
img_tag: '饼干曲奇',
desc: '比利时风味焦糖饼干代餐小吃零食品',
time: '2022-12-04'
}
]
productList: [
// {
// src: '/static/products/zhanwei_dg.png',
// title: '锅巴',
// tag: '无添加剂',
// img_tag: '零食铺子',
// desc: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
// time: '2022-12-04'
// },
// {
// src: '/static/products/zhanwei_dg.png',
// title: '干吃汤圆',
// tag: '天然原料',
// img_tag: '糕点卷酥',
// desc: '休闲食品厂家甜品糯米食品零食闽南特产宵夜好吃糍粑',
// time: '2022-12-04'
// },
// {
// src: '/static/products/zhanwei_dg.png',
// title: '紫薯魔芋人参魔芋人参魔芋人参…',
// tag: '天然原料',
// img_tag: '健康创新',
// desc: '紫薯魔芋人参代餐粉 冲调饮品贴牌加工 五谷杂粮粉代餐',
// time: '2022-12-04'
// },
// {
// src: '/static/products/zhanwei_dg.png',
// title: '焦糖饼干',
// tag: '无防腐剂',
// img_tag: '饼干曲奇',
// desc: '比利时风味焦糖饼干代餐小吃零食品',
// time: '2022-12-04'
// }
],
query: {
sortType: 1,
pageSize: 4,
pageNum: 1
}
}
},
created() {
this.getProducts()
},
methods: {
//获取产品列表
getProducts() {
// console.log("子组件的获取产品列表方法====");
this.$apiServe.getProducts(this.query).then(res => {
// console.log(res.data.data)
this.productList = res.data.data
}).finally(_ => {})
},
//点击图片跳转到详情页
toDetailPage() {
toDetailPage(item) {
uni.navigateTo({
url: '/pages/detail/productsDetail/productsDetail'
url: '/pages/detail/productsDetail/productsDetail?id=' + item.id
})
}
}