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

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view>
<view class="search-box">
<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">
</u-input>
</view>
@@ -39,7 +39,8 @@
customQuery: {},
shopListLength: '',
showNull: false,
refresh: false
refresh: false,
keyword: ''
}
},
onPullDownRefresh() {
@@ -59,6 +60,7 @@
},
onReachBottom() {
if (this.shopListLength !== 0) {
this.keyword=''
this.pageNum++
this.getShopList()
console.log("触底加载");

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view>
<view class="search-box">
<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">
</u-input>
</view>
@@ -39,7 +39,8 @@
customQuery: {},
shopListLength: '',
showNull: false,
refresh: false
refresh: false,
keyword: ''
}
},
onPullDownRefresh() {
@@ -59,6 +60,7 @@
},
onReachBottom() {
if (!this.refresh && this.shopListLength !== 0) {
this.keyword = ''
this.pageNum++
this.getShopList()
console.log("触底加载");
@@ -70,16 +72,16 @@
this.getShopList()
},
methods: {
getInput(val){
console.log('搜索值',val);
if(this.pageNum!==1){
this.pageNum=1
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
}
const q = this.$u.queryParams({
type: 4,
pageSize: this.pageSize,
pageNum: this.pageNum,
kw:val
kw: val
})
this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view>
<view class="search-box">
<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">
</u-input>
</view>
@@ -38,7 +38,8 @@
customQuery: {},
searchListLength: '',
showNull: false,
refresh: false
refresh: false,
keyword: ''
}
},
onPullDownRefresh() {
@@ -58,6 +59,7 @@
},
onReachBottom() {
if (!this.refresh && this.searchListLength !== 0) {
this.keyword=''
this.pageNum++
this.getShopList()
console.log("触底加载");

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view>
<view class="search-box">
<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">
</u-input>
</view>
@@ -33,12 +33,13 @@
data() {
return {
shopInfoList: [],
pageSize: 5,
pageSize: 3,
pageNum: 1,
customQuery: {},
shopListLength: '',
showNull: false,
refresh: false
refresh: false,
keyword: ''
}
},
onPullDownRefresh() {
@@ -58,6 +59,7 @@
},
onReachBottom() {
if (!this.refresh && this.shopListLength !== 0) {
this.keyword=''
this.pageNum++
this.getShopList()
console.log("触底加载");
@@ -69,16 +71,16 @@
this.getShopList()
},
methods: {
getInput(val){
console.log('搜索值',val);
if(this.pageNum!==1){
this.pageNum=1
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
}
const q = this.$u.queryParams({
type: 1,
pageSize: this.pageSize,
pageNum: this.pageNum,
kw:val
kw: val
})
this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length

View File

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

View File

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

View File

@@ -1,4 +1,17 @@
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 = {
get(url, data) {
const header = {}
@@ -12,8 +25,11 @@ const service = {
header: header,
success: res => {
resolve(res)
console.log('res===',res);
isOutTime(res);
},
fail: err => {
console.log('错误',err);
reject(err)
}
})
@@ -31,6 +47,7 @@ const service = {
header: header,
success: res => {
resolve(res)
isOutTime(res);
},
fail: err => {
try {
@@ -55,6 +72,7 @@ const service = {
header: header,
success: res => {
resolve(res)
isOutTime(res);
},
fail: err => {
reject(err)
@@ -74,6 +92,7 @@ const service = {
header: header,
success: res => {
resolve(res)
isOutTime(res);
},
fail: err => {
reject(err)
@@ -93,6 +112,7 @@ const service = {
header: header,
success: res => {
resolve(res)
isOutTime(res);
},
fail: err => {
reject(err)