fix 修复搜索结果显示错误
This commit is contained in:
parent
a4e2dc786c
commit
5ee272fbdb
@ -1,7 +1,15 @@
|
|||||||
import { getHistorySearchList } from '~/services/home/getHistorySearchList';
|
import {
|
||||||
import { getHotSearchList } from '~/services/home/getHotSearchList';
|
getHistorySearchList
|
||||||
import { addHistorySearch } from '~/services/home/addHistorySearch';
|
} from '~/services/home/getHistorySearchList';
|
||||||
import { deleteHistorySearch } from '~/services/home/deleteHistorySearch';
|
import {
|
||||||
|
getHotSearchList
|
||||||
|
} from '~/services/home/getHotSearchList';
|
||||||
|
import {
|
||||||
|
addHistorySearch
|
||||||
|
} from '~/services/home/addHistorySearch';
|
||||||
|
import {
|
||||||
|
deleteHistorySearch
|
||||||
|
} from '~/services/home/deleteHistorySearch';
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
@ -56,8 +64,13 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
const { historyWords } = this.data;
|
const {
|
||||||
const { deleteType, deleteIndex } = this;
|
historyWords
|
||||||
|
} = this.data;
|
||||||
|
const {
|
||||||
|
deleteType,
|
||||||
|
deleteIndex
|
||||||
|
} = this;
|
||||||
// console.log('deleteType', deleteType, 'deleteIndex', deleteIndex);
|
// console.log('deleteType', deleteType, 'deleteIndex', deleteIndex);
|
||||||
// console.log(historyWords);
|
// console.log(historyWords);
|
||||||
if (deleteType === 0) {
|
if (deleteType === 0) {
|
||||||
@ -83,7 +96,9 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleClearHistory() {
|
handleClearHistory() {
|
||||||
const { dialog } = this.data;
|
const {
|
||||||
|
dialog
|
||||||
|
} = this.data;
|
||||||
this.deleteType = 1;
|
this.deleteType = 1;
|
||||||
this.setData({
|
this.setData({
|
||||||
dialog: {
|
dialog: {
|
||||||
@ -95,8 +110,12 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteCurr(e) {
|
deleteCurr(e) {
|
||||||
const { index } = e.currentTarget.dataset;
|
const {
|
||||||
const { dialog } = this.data;
|
index
|
||||||
|
} = e.currentTarget.dataset;
|
||||||
|
const {
|
||||||
|
dialog
|
||||||
|
} = this.data;
|
||||||
this.deleteIndex = index;
|
this.deleteIndex = index;
|
||||||
this.setData({
|
this.setData({
|
||||||
dialog: {
|
dialog: {
|
||||||
@ -109,9 +128,13 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleHistoryTap(e) {
|
handleHistoryTap(e) {
|
||||||
const { historyWords } = this.data;
|
const {
|
||||||
const { dataset } = e.currentTarget;
|
historyWords
|
||||||
const _searchValue = historyWords[dataset.index || 0] || '';
|
} = this.data;
|
||||||
|
const {
|
||||||
|
dataset
|
||||||
|
} = e.currentTarget;
|
||||||
|
const _searchValue = historyWords[dataset.index || 0].historySearchContent || '';
|
||||||
if (_searchValue) {
|
if (_searchValue) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: `/pages/goods/result/index?searchValue=${_searchValue}`,
|
url: `/pages/goods/result/index?searchValue=${_searchValue}`,
|
||||||
@ -121,10 +144,12 @@ Page({
|
|||||||
|
|
||||||
// TODO:提交搜索
|
// TODO:提交搜索
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
const { value } = e.detail.value;
|
const {
|
||||||
if (value?.length === 0) return;
|
value
|
||||||
|
} = e.detail;
|
||||||
|
if (value?.length === 0 || value == undefined) return;
|
||||||
const data = {
|
const data = {
|
||||||
HistorySearchContent: e.detail.value,
|
HistorySearchContent: value,
|
||||||
};
|
};
|
||||||
addHistorySearch(data).then((res) => {
|
addHistorySearch(data).then((res) => {
|
||||||
this.queryHistory();
|
this.queryHistory();
|
||||||
@ -133,4 +158,4 @@ Page({
|
|||||||
url: `/pages/goods/result/index?searchValue=${value}`,
|
url: `/pages/goods/result/index?searchValue=${value}`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user