Browse Source

优化资讯中心搜索

master
wanghongjun 2 years ago
parent
commit
3aee3da3fc
  1. 89
      pages/category/consulting/detail.vue
  2. 30
      pages/category/consulting/list.vue

89
pages/category/consulting/detail.vue

@ -1,20 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<view class="secondary"> <view class="secondary">
<!-- 搜索 -->
<view class="search">
<view class="search-wrapper">
<view class="index-search">
<view class="index-cont-search t-c">
<text class="search-icon iconfont icon-search"></text>
<text class="search-text">
<input type="text" placeholder="请输入搜索关键字" v-model="searchValue">
</text>
<button class="search-text-bu" @click="onSearch">搜索</button>
</view>
</view>
</view>
</view>
<!-- 二级分类 20 --> <!-- 二级分类 20 -->
<view class="cate-content"> <view class="cate-content">
<!-- 左侧 一级分类 --> <!-- 左侧 一级分类 -->
@ -26,7 +12,7 @@
</view> </view>
</scroll-view> --> </scroll-view> -->
<!-- 右侧 二级分类 --> <!-- 右侧 二级分类 -->
<scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }" style="margin-top: 70rpx;"> <scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }">
<view v-if="list" class="cate-right-cont"> <view v-if="list" class="cate-right-cont">
<view class="cate-two-box"> <view class="cate-two-box">
<view class="cate-cont-box"> <view class="cate-cont-box">
@ -144,14 +130,6 @@ export default {
}, },
methods: { methods: {
// //
async onSearch() {
if (this.searchValue == '') {
this.$error('请输入搜索关键词');
} else {
await this.getGoodsList()
await this.getHomeListImage()
}
},
previewImage(){ previewImage(){
// //
let richText = this.list.context let richText = this.list.context
@ -236,7 +214,7 @@ page {
display: flex; display: flex;
z-index: 1; z-index: 1;
background: #fff; background: #fff;
padding-top: 6rpx; padding-top: 0rpx;
height: 100%; height: 100%;
} }
@ -260,7 +238,7 @@ page {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 16rpx; padding: 16rpx;
margin-top: 20rpx; margin-top: 0rpx;
margin-right: 60rpx; margin-right: 60rpx;
color: #8e908e; color: #8e908e;
background-color: #f7f7f7; background-color: #f7f7f7;
@ -329,65 +307,4 @@ page {
overflow: hidden; overflow: hidden;
} }
//
.search {
position: fixed;
float: top;
top: var(--window-top);
left: var(--window-left);
right: var(--window-right);
z-index: 19;
.search-wrapper {
background: #1c223b;
padding: 0rpx 20rpx 20rpx 20rpx;
}
.index-search {
border-bottom: 0;
background: #fff;
border-radius: 50rpx;
overflow: hidden;
font-size: 28rpx;
color: #6d6d6d;
box-sizing: border-box;
height: 74rpx;
line-height: 74rpx;
.index-cont-search {
width: 100%;
font-size: 28rpx;
background: #f7f7f7;
display: flex;
justify-content: center;
align-items: center;
.search-icon {
font-size: 34rpx;
margin-left: 50rpx;
}
.search-text {
text-align: left;
float: left;
margin-left: 20rpx;
width: 100%;
input {
font-size: 20rpx;
}
}
.search-text-bu {
margin-right: 20rpx;
color: #ffffff;
background-color: #1c223b;
font-size: 20rpx;
width: 120rpx;
height: 50rpx;
text-align: center;
border-radius: 50rpx;
}
}
}
}
</style> </style>

30
pages/category/consulting/list.vue

@ -102,7 +102,7 @@
informationList: [], informationList: [],
// informationList: information.data, // informationList: information.data,
// //
list: [], list: [],
// list: information.data.pageDataList, // list: information.data.pageDataList,
// //
setting: {}, setting: {},
@ -129,7 +129,7 @@
tip: '暂无记录' tip: '暂无记录'
} }
}, },
searchValue: '', searchValue: '',
} }
}, },
@ -143,9 +143,9 @@
this.getConsultingContextSelection() this.getConsultingContextSelection()
this.onRefreshPage() this.onRefreshPage()
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: options.name title: options.name
}); });
}, },
/** /**
@ -163,15 +163,11 @@
this.setListHeight() this.setListHeight()
}, },
methods: { methods: {
// //
async onSearch() { async onSearch() {
if (this.searchValue == '') { //
this.$error('请输入搜索关键词'); this.getCatList()
} else { },
await this.getGoodsList()
await this.getHomeListImage()
}
},
// //
setListHeight() { setListHeight() {
const { windowHeight } = uni.getSystemInfoSync() const { windowHeight } = uni.getSystemInfoSync()
@ -217,14 +213,14 @@
// //
getCatList(pageIndex = 1){ getCatList(pageIndex = 1){
const app = this const app = this
if (app.searchValue != '') {
param.goods_name = app.searchValue
}
let param = { let param = {
pageIndex : pageIndex, pageIndex : pageIndex,
pageRows : pageSize, pageRows : pageSize,
contextConsultingId : app.consultingId contextConsultingId : app.consultingId
} }
if (app.searchValue != '') {
param.contextTitle = app.searchValue
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
CategoryApi.consultingContextList(param).then(res => { CategoryApi.consultingContextList(param).then(res => {
if (res.resultCode === '00000000') { if (res.resultCode === '00000000') {

Loading…
Cancel
Save