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