Merge pull request '新增搜索出的产品列表' (#33) from DJ into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/33
This commit is contained in:
odjbin
2022-12-25 08:50:33 +00:00
8 changed files with 87 additions and 19 deletions

View File

@@ -35,10 +35,6 @@
</template> </template>
<script> <script>
// import {
// simpleDateFormat,
// simpleDateFormatByMoreLine
// } from '@/utills/util.js'
export default { export default {
data() { data() {
return { return {
@@ -76,11 +72,7 @@
// time: '2022-12-04' // time: '2022-12-04'
// } // }
], ],
query: {
sortType: 1,
pageSize: 4,
pageNum: 1
}
} }
}, },
created() { created() {
@@ -91,7 +83,7 @@
//获取产品列表 //获取产品列表
getProducts() { getProducts() {
// console.log("子组件的获取产品列表方法===="); // console.log("子组件的获取产品列表方法====");
this.$apiServe.getProducts(this.query).then(res => { this.$apiServe.getProducts().then(res => {
// console.log(res.data.data) // console.log(res.data.data)
this.productList = res.data.data this.productList = res.data.data

View File

@@ -105,14 +105,14 @@
//修改我的需求 //修改我的需求
editNeeds() { editNeeds() {
console.log('修改需求'); console.log('修改需求');
uni.redirectTo({ uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?index=' + 0 url: '/pages/ideasAndNeeds/ideasAndNeeds?index=' + 0
}) })
}, },
//修改我的创意 //修改我的创意
editIdeas() { editIdeas() {
console.log('修改创意'); console.log('修改创意');
uni.redirectTo({ uni.reLaunch({
// id=' + ideaId + '& // id=' + ideaId + '&
url: '/pages/ideasAndNeeds/ideasAndNeeds?index=' + 1 url: '/pages/ideasAndNeeds/ideasAndNeeds?index=' + 1
}) })

View File

@@ -63,7 +63,7 @@
methods: { methods: {
//获取认证厂家详情 //获取认证厂家详情
getCertifiedCjDetail() { getCertifiedCjDetail() {
this.$apiServe.getCertifiedCjDetail().then(res => { this.$apiServe.getCertifiedCjDetail(this.id).then(res => {
console.log('认证厂家详情页', res) console.log('认证厂家详情页', res)
// this.detailList = res.data.data // this.detailList = res.data.data

View File

@@ -0,0 +1,59 @@
<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="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.tag" 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}}</text>
</view>
</view>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
</template>
<script>
export default {
data() {
return {
productList: [{
cover: '/static/products/zhanwei_dg.png',
name: '锅巴',
tag: '无添加剂',
cate_name: '零食铺子',
title: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
pub_time: '2022-12-04'
}, ]
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -32,7 +32,8 @@
</view> </view>
<view class="found-record"> <view class="found-record">
<view v-for="(item, index) in foundList" :key="index" class="tag-item"> <view v-for="(item, index) in foundList" :key="index" class="tag-item">
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item.name" @click="recentSearch(item.name)" /> <u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item.name"
@click="recentSearch(item.name)" />
</view> </view>
</view> </view>
</view> </view>
@@ -81,6 +82,9 @@
} catch (e) { } catch (e) {
// error // error
} }
uni.navigateTo({
url: '../search-products/search-products'
})
}, },
goBack() { goBack() {
uni.navigateBack() uni.navigateBack()

View File

@@ -122,6 +122,15 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "search-products/search-products",
"style": {
"navigationBarTitleText": "产品列表",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
}
} }
] ]
}, },

View File

@@ -139,7 +139,11 @@
}, },
onLoad(options) { onLoad(options) {
console.log(options) console.log(options)
this.tabCurrent = options.index if (options.index == 0) {
this.tabCurrent = 0
} else if (options.index == 1) {
this.tabCurrent = 1
}
}, },
methods: { methods: {
tabChange(data) { tabChange(data) {

View File

@@ -196,10 +196,10 @@ const apiService = {
}) })
}, },
// 获取产品列表 // 获取产品列表
getProducts(data) { getProducts() {
const url = `/home/product` const url = `/home/product?sortType=1&pageSize=4&pageNum=1`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.get(url, data)) resolve(service.get(url))
}) })
}, },
// 获取产品详情 // 获取产品详情
@@ -232,7 +232,7 @@ const apiService = {
}, },
// 获取认证厂家详情 // 获取认证厂家详情
getCertifiedCjDetail(id) { getCertifiedCjDetail(id) {
const url = `/news/fdetail?fId=1` const url = `/news/fdetail?fId=${id}`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.get(url, id)) resolve(service.get(url, id))
}) })