Merge pull request '邓洁 : 修改搜索框bug' (#102) from dj into master

Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/102
This commit is contained in:
odjbin
2023-11-22 02:43:15 +00:00
8 changed files with 81 additions and 29 deletions

View File

@@ -2,8 +2,8 @@
<view class="input-and-swiper-root"> <view class="input-and-swiper-root">
<view class="search-box" v-if="type!=='0'"> <view class="search-box" v-if="type!=='0'">
<view class="search-box-input"> <view class="search-box-input">
<u-input placeholder="请输入店铺名称进行搜索" placeholder-style="color: #969696" prefixIcon="search" <u-input v-model="keyword" placeholder="请输入店铺名称进行搜索" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="changeInput"> prefixIconStyle="font-size: 24px;color: #909399;" border="true" @clear="handleClear" clearable @change="changeInput">
<template slot="suffix"> <template slot="suffix">
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<u-icon name="map-fill" color="#329866" size="22"></u-icon> <u-icon name="map-fill" color="#329866" size="22"></u-icon>
@@ -36,26 +36,46 @@
type: { type: {
type: String, type: String,
default: '1' default: '1'
},
refresh: {
type: Boolean,
default: false
} }
}, },
data() { data() {
return { return {
position: uni.getStorageSync('city') + uni.getStorageSync('district').slice(0, 2), position: uni.getStorageSync('city') + uni.getStorageSync('district').slice(0, 2),
currentNum: '' currentNum: '',
keyword:''
}; };
}, },
options: { options: {
styleIsolation: 'shared', // 解除样式隔离 styleIsolation: 'shared', // 解除样式隔离
}, },
watch: {
refresh(newVal, oldVal) {
console.log('newVal',newVal);
if(newVal){
this.keyword=''
}
}
},
onShow() { onShow() {
if (this.type !== '0') { if (this.type !== '0') {
this.open() this.open()
} }
},
created() {
}, },
methods: { methods: {
changeInput(e){ changeInput(e){
this.$emit('getQueryInfo',e) this.$emit('getQueryInfo',e)
}, },
handleClear(e){
console.log('handleClear',e);
},
open() { open() {
if (!uni.getStorageSync('city') && !uni.getStorageSync('district')) { if (!uni.getStorageSync('city') && !uni.getStorageSync('district')) {
uni.getSystemInfo({ uni.getSystemInfo({

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view> <view class="bug-fix"></view>
<view class="search-box"> <view class="search-box">
<view class="search-box-input"> <view class="search-box-input">
<u-input placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search" <u-input v-model="keyword" placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput"> prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput">
</u-input> </u-input>
</view> </view>
@@ -39,7 +39,8 @@
customQuery: {}, customQuery: {},
shopListLength: '', shopListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false,
keyword: ''
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -59,6 +60,7 @@
}, },
onReachBottom() { onReachBottom() {
if (this.shopListLength !== 0) { if (this.shopListLength !== 0) {
this.keyword=''
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view> <view class="bug-fix"></view>
<view class="search-box"> <view class="search-box">
<view class="search-box-input"> <view class="search-box-input">
<u-input placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search" <u-input v-model="keyword" placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput"> prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput">
</u-input> </u-input>
</view> </view>
@@ -39,7 +39,8 @@
customQuery: {}, customQuery: {},
shopListLength: '', shopListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false,
keyword: ''
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -59,6 +60,7 @@
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh && this.shopListLength !== 0) { if (!this.refresh && this.shopListLength !== 0) {
this.keyword = ''
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
@@ -70,16 +72,16 @@
this.getShopList() this.getShopList()
}, },
methods: { methods: {
getInput(val){ getInput(val) {
console.log('搜索值',val); console.log('搜索值', val);
if(this.pageNum!==1){ if (this.pageNum !== 1) {
this.pageNum=1 this.pageNum = 1
} }
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 4, type: 4,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum, pageNum: this.pageNum,
kw:val kw: val
}) })
this.$api.getShopList(q).then(res => { this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length this.shopListLength = res.data.data.length

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view> <view class="bug-fix"></view>
<view class="search-box"> <view class="search-box">
<view class="search-box-input"> <view class="search-box-input">
<u-input placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search" <u-input v-model="keyword" placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput"> prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput">
</u-input> </u-input>
</view> </view>
@@ -38,7 +38,8 @@
customQuery: {}, customQuery: {},
searchListLength: '', searchListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false,
keyword: ''
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -58,6 +59,7 @@
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh && this.searchListLength !== 0) { if (!this.refresh && this.searchListLength !== 0) {
this.keyword=''
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view> <view class="bug-fix"></view>
<view class="search-box"> <view class="search-box">
<view class="search-box-input"> <view class="search-box-input">
<u-input placeholder="请输入店铺名称进行搜索" placeholder-style="color: #969696" prefixIcon="search" <u-input v-model="keyword" placeholder="请输入店铺名称进行搜索" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput"> prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput">
</u-input> </u-input>
</view> </view>
@@ -33,12 +33,13 @@
data() { data() {
return { return {
shopInfoList: [], shopInfoList: [],
pageSize: 5, pageSize: 3,
pageNum: 1, pageNum: 1,
customQuery: {}, customQuery: {},
shopListLength: '', shopListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false,
keyword: ''
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -58,6 +59,7 @@
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh && this.shopListLength !== 0) { if (!this.refresh && this.shopListLength !== 0) {
this.keyword=''
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
@@ -69,16 +71,16 @@
this.getShopList() this.getShopList()
}, },
methods: { methods: {
getInput(val){ getInput(val) {
console.log('搜索值',val); console.log('搜索值', val);
if(this.pageNum!==1){ if (this.pageNum !== 1) {
this.pageNum=1 this.pageNum = 1
} }
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 1, type: 1,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum, pageNum: this.pageNum,
kw:val kw: val
}) })
this.$api.getShopList(q).then(res => { this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length this.shopListLength = res.data.data.length

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="root"> <view class="root">
<InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList"></InputAndSwiper> <InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList" :refresh="isRefresh"></InputAndSwiper>
<view> <view>
<view class="dropdown-bug"> <view class="dropdown-bug">
@@ -29,14 +29,15 @@
}, },
data() { data() {
return { return {
pageSize: 3, pageSize: 4,
pageNum: 1, pageNum: 1,
searchInfoList: [], searchInfoList: [],
swiperList: [], swiperList: [],
customQuery: {}, customQuery: {},
searchListLength: '', searchListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false,
isRefresh: false
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -56,6 +57,7 @@
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh && this.searchListLength !== 0) { if (!this.refresh && this.searchListLength !== 0) {
this.isRefresh = true
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");

View File

@@ -1,6 +1,7 @@
<template> <template>
<view class="root"> <view class="root">
<InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList"> </InputAndSwiper> <InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList" :refresh="isRefresh">
</InputAndSwiper>
<view> <view>
<view class="dropdown-bug"> <view class="dropdown-bug">
@@ -29,14 +30,15 @@
}, },
data() { data() {
return { return {
pageSize: 3, pageSize: 4,
pageNum: 1, pageNum: 1,
shopInfoList: [], shopInfoList: [],
customQuery: {}, customQuery: {},
swiperList: [], swiperList: [],
shopListLength: '', shopListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false,
isRefresh: false
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -56,9 +58,9 @@
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh && this.shopListLength !== 0) { if (!this.refresh && this.shopListLength !== 0) {
this.isRefresh = true
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
} else if (this.shopListLength == 0) { } else if (this.shopListLength == 0) {
this.pageNum = 1 this.pageNum = 1

View File

@@ -1,4 +1,17 @@
const serverHost = 'https://spsp.feashow.com/api' //http://xx.xxx.xx const serverHost = 'https://spsp.feashow.com/api' //http://xx.xxx.xx
function isOutTime(res) {
if (res.data.msg == '登录超时,请重新登录') {
uni.showToast('登录信息已过期,请重新登录')
// setTimeout(() => {
uni.redirectTo({
url: '/pages/login/login'
})
// }, 1000)
uni.removeStorageSync('loginToken')
} else {
// uni.showToast(res.data.message);
}
}
const service = { const service = {
get(url, data) { get(url, data) {
const header = {} const header = {}
@@ -12,8 +25,11 @@ const service = {
header: header, header: header,
success: res => { success: res => {
resolve(res) resolve(res)
console.log('res===',res);
isOutTime(res);
}, },
fail: err => { fail: err => {
console.log('错误',err);
reject(err) reject(err)
} }
}) })
@@ -31,6 +47,7 @@ const service = {
header: header, header: header,
success: res => { success: res => {
resolve(res) resolve(res)
isOutTime(res);
}, },
fail: err => { fail: err => {
try { try {
@@ -55,6 +72,7 @@ const service = {
header: header, header: header,
success: res => { success: res => {
resolve(res) resolve(res)
isOutTime(res);
}, },
fail: err => { fail: err => {
reject(err) reject(err)
@@ -74,6 +92,7 @@ const service = {
header: header, header: header,
success: res => { success: res => {
resolve(res) resolve(res)
isOutTime(res);
}, },
fail: err => { fail: err => {
reject(err) reject(err)
@@ -93,6 +112,7 @@ const service = {
header: header, header: header,
success: res => { success: res => {
resolve(res) resolve(res)
isOutTime(res);
}, },
fail: err => { fail: err => {
reject(err) reject(err)