diff --git a/src/api/history/index.ts b/src/api/history/index.ts new file mode 100644 index 0000000..504d7cb --- /dev/null +++ b/src/api/history/index.ts @@ -0,0 +1,38 @@ +import request from '@/utils/request'; + +/** + * 获取历史记录 + * @returns + */ +export function fetchHistory() { + return request({ + url: `/console/hot_search_history/list`, + method: 'get' + }); +} + +/** + * 增加历史记录 + * @param keyword {string} + * @returns + */ +export function addHistory(keyword: string) { + return request({ + url: `/console/hot_search_history/add`, + method: 'post', + data: { + keyword: keyword + } + }); +} + +/** + * 删除所有的历史记录 + * @returns + */ +export function clearHistory() { + return request({ + url: `/console/hot_search_history/clear`, + method: 'post' + }); +} diff --git a/src/components/Search/Index.vue b/src/components/Search/Index.vue index 090fb8c..071ba51 100644 --- a/src/components/Search/Index.vue +++ b/src/components/Search/Index.vue @@ -1,6 +1,7 @@