@ -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' ;
/ / i m p o r t S e a r c h I n p u t f r o m ' @ / c o m p o n e n t s / S e a r c h I n p u t 2 ' ;
import SearchInput from '@/components/SearchInput' ;
const { Sider , Content , Header , Footer } = Layout ;
const { Search } = Input ;
const { RangePicker } = DatePicker ;
/ / h t t p s : / / m e d i a - x s p 2 - 1 . c d n . w h a t s a p p . n e t / v / t 6 1 . 2 4 6 9 4 - 2 4 / 4 2 4 7 3 5 6 4 6 _ 3 8 0 5 6 3 0 2 1 2 8 5 0 2 9 _ 2 9 6 2 7 5 8 8 5 4 2 5 0 8 0 0 1 7 6 _ n . j p g ? c c b = 1 1 - 4 & o h = 0 1 _ A d T o g i V d U E - T o I 9 u H - V Q K T T L y D b P 7 b o c X U Q e 1 O E T O e C g c g & o e = 6 5 F 7 C 6 A B & _ n c _ s i d = e 6 e d 6 c & _ n c _ c a t = 1 0 4
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.' ,
} ,
] ;
/ / e s l i n t - d i s a b l e - n e x t - l i n e r e a c t / d i s p l a y - n a m e
const SearchForm = memo ( function ( { initialValues , onSubmit } ) {
@ -80,51 +33,8 @@ const SearchForm = memo(function ({ initialValues, onSubmit }) {
style = { {
maxWidth : 'none' ,
} } >
< Form.Item label = '顾问' name = 'travel' style = { { width : '200px' } } >
< Select
showSearch
placeholder = '请选择'
optionFilterProp = 'children'
filterOption = { ( input , option ) => ( option ? . label ? ? '' ) . toLowerCase ( ) . includes ( input . toLowerCase ( ) ) }
options = { [
{
value : 'null' ,
label : '未知' ,
} ,
{
value : '354' ,
label : '宁艳' ,
} ,
{
value : '487' ,
label : '杨新玲' ,
} ,
{
value : '495' ,
label : '黄雪荣' ,
} ,
{
value : '骆梅玉' ,
label : '骆梅玉' ,
} ,
{
value : '586' ,
label : '秦宇尘' ,
} ,
{
value : '606' ,
label : '莫梦瑶' ,
} ,
{
value : '603' ,
label : '秦雯萱' ,
} ,
{
value : '601' ,
label : '王露加' ,
} ,
] }
/ >
< Form.Item label = '顾问' name = 'agent' style = { { width : '200px' } } >
< SearchInput placeholder = '搜索顾问' fetchOptions = { fetchSalesAgent } / >
< / Form.Item >
< Form.Item label = '客人' name = 'orderLabel' style = { { width : '200px' } } >
< Select
@ -206,7 +116,7 @@ function ChatHistory() {
const getConversationsList = async ( ) => {
setLoading ( true ) ;
setChatItemMessages ( [ ] ) ;
const data = await fetchConversationsList ( { opisn : formValues . travel } ) ;
const data = await fetchConversationsList ( { opisn : formValues . agent? . value || - 1 } ) ;
setLoading ( false ) ;
setConversationsList ( data ) ;
if ( data . length === 1 ) {
@ -241,7 +151,7 @@ function ChatHistory() {
const parts = str . split ( /(https?:\/\/[^\s]+|\p{Emoji_Presentation})/gmu ) . filter ( ( s ) => s !== '' ) ;
const links = str . match ( /https?:\/\/[\S]+/gi ) || [ ] ;
const emojis = str . match ( /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g ) || [ ] ;
const extraClass = isEmpty ( emojis ) ? '' : ' text-base leading-5 emoji-text ';
const extraClass = isEmpty ( emojis ) ? '' : ' ';
const objArr = parts . reduce ( ( prev , curr , index ) => {
if ( links . includes ( curr ) ) {
prev . push ( { type : 'link' , key : curr } ) ;
@ -253,16 +163,15 @@ function ChatHistory() {
return prev ;
} , [ ] ) ;
return (
< span className = { extraClass } >
< span className = { ` text-base leading-5 emoji-text ${ extraClass } ` } >
{ ( objArr || [ ] ) . map ( ( part , index ) => {
if ( part . type === 'link' ) {
return (
< a href = { part . key } target = '_blank' key = { ` ${ part . key } ${ index } ` } rel = 'noreferrer' className = 'text- sm '>
< a href = { part . key } target = '_blank' key = { ` ${ part . key } ${ index } ` } rel = 'noreferrer' className = 'text- base '>
{ part . key }
< / a >
) ;
} else {
/ / i f ( p a r t . t y p e = = = ' e m o j i ' )
return part . key ;
}
} ) }
@ -292,7 +201,7 @@ function ChatHistory() {
} ;
/ / e s l i n t - d i s a b l e - n e x t - l i n e r e a c t / d i s p l a y - n a m e
const MessageBoxWithRef = forwardRef ( ( props , ref ) => (
< li ref = { ref } key = { props . key } >
< li ref = { ref } >
< MessageBox { ...props } / >
< / li >
) ) ;