diff --git a/src/actions/CommonActions.js b/src/actions/CommonActions.js
index ce53d31..3ec4543 100644
--- a/src/actions/CommonActions.js
+++ b/src/actions/CommonActions.js
@@ -1,3 +1,10 @@
import { fetchJSON } from '@/utils/request';
import { API_HOST } from '@/config';
+/**
+ * 顾问列表
+ */
+export const fetchSalesAgent = async (q) => {
+ const { errcode, result } = await fetchJSON(`https://p9axztuwd7x8a7.mycht.cn/service-Analyse2/GetOperatorInfo`, { q });
+ return errcode !== 0 ? [] : result.map((ele) => ({ ...ele, label: ele.cn_name, value: ele.op_id }));
+};
diff --git a/src/components/SearchInput.jsx b/src/components/SearchInput.jsx
new file mode 100644
index 0000000..cf61f9d
--- /dev/null
+++ b/src/components/SearchInput.jsx
@@ -0,0 +1,46 @@
+import React, { useMemo, useRef, useState } from 'react';
+import { Select, Spin } from 'antd';
+import { debounce } from '@/utils/utils';
+
+function DebounceSelect({ fetchOptions, debounceTimeout = 800, ...props }) {
+ const [fetching, setFetching] = useState(false);
+ const [options, setOptions] = useState([]);
+ const fetchRef = useRef(0);
+ const debounceFetcher = useMemo(() => {
+ const loadOptions = (value) => {
+ fetchRef.current += 1;
+ const fetchId = fetchRef.current;
+ setOptions([]);
+ setFetching(true);
+ fetchOptions(value).then((newOptions) => {
+ if (fetchId !== fetchRef.current) {
+ // for fetch callback order
+ return;
+ }
+ setOptions(newOptions);
+ setFetching(false);
+ });
+ };
+ return debounce(loadOptions, debounceTimeout);
+ }, [fetchOptions, debounceTimeout]);
+ return (
+ : null}
+ optionFilterProp='label'
+ >
+ {options.map((d) => (
+
+ {d.label}
+
+ ))}
+
+ );
+}
+
+export default DebounceSelect;
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 5f87ef2..ca4784e 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -311,6 +311,20 @@ export const stringToColour = (str) => {
return color;
};
+export const debounce = (func, wait, immediate) => {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ clearTimeout(timeout);
+ if (immediate && !timeout) func.apply(context, args);
+ timeout = setTimeout(function () {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ }, wait);
+ };
+}
+
export const olog = (text, ...args) => {
console.log(
`%c ${text} `,
diff --git a/src/views/ChatHistory.jsx b/src/views/ChatHistory.jsx
index 08d7646..50fc561 100644
--- a/src/views/ChatHistory.jsx
+++ b/src/views/ChatHistory.jsx
@@ -8,62 +8,15 @@ import { isEmpty } from '@/utils/utils';
import useFormStore from '@/stores/FormStore';
import { useShallow } from 'zustand/react/shallow';
+import { fetchSalesAgent } from '@/actions/CommonActions';
+// import SearchInput from '@/components/SearchInput2';
+import SearchInput from '@/components/SearchInput';
+
const { Sider, Content, Header, Footer } = Layout;
const { Search } = Input;
const { RangePicker } = DatePicker;
// https://media-xsp2-1.cdn.whatsapp.net/v/t61.24694-24/424735646_380563021285029_2962758854250800176_n.jpg?ccb=11-4&oh=01_AdTogiVdUE-ToI9uH-VQKTTLyDbP7bocXUQe1OETOeCgcg&oe=65F7C6AB&_nc_sid=e6ed6c&_nc_cat=104
-const data = [
- {
- title: 'Ann',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
- msgTime: '03-04 13:45:29',
- content:
- 'Hi, this is Ann from China Highlights travel and it is my pleasure to help your Beijing trip. I have sent you an email with the general idea about you trip. Please check it and if any question or new idea just let me know. We are specailized in customizing tour and I would like to work with you to create a tour itinerary that you like. Look forward to your reply.',
- },
- {
- title: 'David Azhari',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
- msgTime: '03-04 16:33:08',
- content: 'Hi! I just replied to your email saying that I have a few questions and notes',
- },
- {
- title: 'David Azhari',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
- msgTime: '03-04 16:33:34',
- content: 'So first, is it possible for you guys to write a PU Invitation letter for visas or no?',
- },
- {
- title: 'Ann',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
- msgTime: '03-04 16:33:41',
- content: 'you prefer we discuss here or go on by mail ?',
- },
- {
- title: 'David Azhari',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
- msgTime: '03-04 16:34:03',
- content: 'I prefer by mail if it’s ok with you',
- },
- {
- title: 'Ann',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
- msgTime: '03-04 16:34:28',
- content: 'both is okay ,I am typing mail to you now lol and receive your message here.',
- },
- {
- title: 'David Azhari',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
- msgTime: '03-05 02:56:37',
- content: 'Ok thank you so much',
- },
- {
- title: 'Ann',
- avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
- msgTime: '03-04 16:44:03',
- content: 'you are welcome I have sent the mail to you ,please check.it is my pleasure to assist you with your tour.',
- },
-];
// eslint-disable-next-line react/display-name
const SearchForm = memo(function ({ initialValues, onSubmit }) {
@@ -80,51 +33,8 @@ const SearchForm = memo(function ({ initialValues, onSubmit }) {
style={{
maxWidth: 'none',
}}>
-
-