修复bug

This commit is contained in:
weipengfei 2024-04-17 17:47:57 +08:00
parent f691bf6749
commit aa56cb2fad
3 changed files with 53 additions and 17 deletions

View File

@ -433,4 +433,24 @@ export function brigade(data) {
return request.get('v2/system/brigade', data, {
noAuth: true
});
}
/**
* 搜索历史记录
* @param {Object} data
*/
export function userLog(data) {
return request.get('user/log', data, {
noAuth: true
});
}
/**
* 删除搜索记录
* @param {Object} data
*/
export function userLogDelete(data) {
return request.get('user/log/delete', data, {
noAuth: true
});
}

View File

@ -12,7 +12,7 @@
<view class='title'>历史记录 <text class="iconfont icon-shanchu" @click="remove"></text></view>
<view class='list acea-row' :style="{'height':historyBox?'auto':'150rpx'}" v-if="historyList.length > 0">
<block v-for="(item,index) in historyList" :key="index">
<view class='item line1' @tap='setHotSearchValue(item,0)'>{{item}}</view>
<view class='item line1' @tap='setHotSearchValue(item.word,0)'>{{item.word}}</view>
</block>
</view>
<view>
@ -137,6 +137,10 @@
getTodayHotSearch,
getHotRanking
} from '@/api/store.js';
import {
userLog,
userLogDelete
} from '@/api/api.js';
import shareScence from '@/libs/spread';
import {
silenceBindingSpread
@ -207,22 +211,30 @@
}
},
onShow: function() {
try {
this.historyList = []
this.tempStorage = []
let arr = uni.getStorageSync('historyList')
if (arr.length > 0) {
this.historyList = arr
} else {
this.historyList = []
}
this.tempStorage = this.historyList
} catch (e) {}
this.getHistoryList();
this.getRoutineHotSearch();
this.getHotSearchList();
this.getHotRankingList();
},
methods: {
getHistoryList(){
userLog({
type: this.isShop ? 2 : 1, // 1, 2
}).then(res=>{
this.historyList = res.data;
})
// try {
// this.historyList = []
// this.tempStorage = []
// let arr = uni.getStorageSync('historyList')
// if (arr.length > 0) {
// this.historyList = arr
// } else {
// this.historyList = []
// }
// this.tempStorage = this.historyList
// } catch (e) {}
},
//
remove() {
let self = this
@ -233,7 +245,11 @@
if (res.confirm) {
self.tempStorage = []
try {
uni.setStorageSync('historyList', self.tempStorage)
userLogDelete({
type: this.isShop ? 2 : 1,
}).then(res=>{
console.log(res);
})
self.historyList = []
} catch (e) {}
} else if (res.cancel) {

View File

@ -2,10 +2,10 @@
<view class="" style="background-color: #fff;">
<u-sticky customNavHeight="0">
<view class="head_top">
<u-search placeholder="搜索小区、办公楼等" @custom="searchMap"></u-search>
<!-- <u-search placeholder="搜索小区、办公楼等" @custom="searchMap"></u-search> -->
<view style="height: 20rpx;"></view>
<u-tabs :list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;" :current="current"
@change="changeCurrent" lineColor="#FF6D20" lineWidth="105rpx" height="7rpx"></u-tabs>
@change="changeCurrent" lineColor="#40af37" lineWidth="105rpx" height="7rpx"></u-tabs>
</u-tabs>
</view>
</u-sticky>
@ -401,8 +401,8 @@
}
.area-item-on {
color: #ff6d20;
border: 2rpx solid #ff6d20;
color: #40af37;
border: 2rpx solid #40af37;
}
.street {