From d5be9ce579347c31bbbc69b698cdf2ead351c502 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Wed, 28 Feb 2024 09:18:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=99=BB=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/AuthStore.js | 52 ++++++++++++++++++++++-------------- src/views/AuthApp.jsx | 20 ++++++-------- src/views/DingdingQRCode.jsx | 15 +++++------ src/views/Standlone.jsx | 20 +++++++++----- 4 files changed, 61 insertions(+), 46 deletions(-) diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index b111120..610855c 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -1,19 +1,27 @@ import { create } from 'zustand' -import { devtools } from 'zustand/middleware' -import { fetchJSON, postJSON } from '@/utils/request' +import { fetchJSON } from '@/utils/request' const useAuthStore = create((set, get) => ({ // GLOBAL_SALES_LOGIN_USER // {"userId":"383","username":"廖一军","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png","mobile":"+86-18777396951","email":"lyj@hainatravel.com","openId":"iioljiPmZ4RPoOYpkFiSn7IKAiEiE","accountList":[{"OPI_SN":383,"OPI_Code":"LYJ","OPI_NameCN":"廖一军","OPI_DEI_SN":7,"OPI_NameEN":"Jimmy Liow"},{"OPI_SN":609,"OPI_Code":"LYJAH","OPI_NameCN":"廖一军(ah)","OPI_DEI_SN":28,"OPI_NameEN":"Jimmy Liow"}]} - loginUser: {}, + loginUser: { + userId: -1, + username: '', + avatarUrl: '', + mobile: '', + email: '', + openId: '', + accountList: [], + permissionList: [], + }, loginStatus: 0, authenticate: async (authCode) => { const { saveUserSession, updateLoginStatus } = get() - + updateLoginStatus(200) const json = await fetchJSON(`https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/WhatsAppAuth`, { authCode }) @@ -44,26 +52,30 @@ const useAuthStore = create((set, get) => ({ })) }, + logout: () => { + window.sessionStorage.clear() + set(() => ({ + loginUser: { + userId: -1, + username: '', + avatarUrl: '', + mobile: '', + email: '', + openId: '', + accountList: [], + permissionList: [], + } + })) + + }, + loadUserSession: () => { const sessionData = window.sessionStorage.getItem('GLOBAL_SALES_LOGIN_USER') - let userData = { - userId: -1, - username: '', - avatarUrl: '', - mobile: '', - email: '', - openId: '', - accountList: [], - permissionList: [], - } if (sessionData !== null) { - userData = JSON.parse(sessionData) + set(() => ({ + loginUser: JSON.parse(sessionData) + })) } - set(() => ({ - loginUser: userData - })) - - return userData }, saveUserSession: () => { diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx index c11b43a..3112a5e 100644 --- a/src/views/AuthApp.jsx +++ b/src/views/AuthApp.jsx @@ -1,18 +1,17 @@ -import { useEffect } from 'react'; -import { Outlet, Link, useHref, useNavigate, NavLink } from 'react-router-dom' -import { Layout, Menu, ConfigProvider, theme, Empty, Row, Col, Avatar, Dropdown, Space, Typography, App as AntApp } from 'antd' -import { DownOutlined } from '@ant-design/icons' import ErrorBoundary from '@/components/ErrorBoundary' -import zhLocale from 'antd/locale/zh_CN' -import { useThemeContext } from '@/stores/ThemeContext' -import { useAuthContext } from '@/stores/AuthContext' -import useConversationStore from '@/stores/ConversationStore' import useAuthStore from '@/stores/AuthStore' +import useConversationStore from '@/stores/ConversationStore' +import { useThemeContext } from '@/stores/ThemeContext' +import { DownOutlined } from '@ant-design/icons' +import { App as AntApp, Avatar, Col, ConfigProvider, Dropdown, Empty, Layout, Menu, Row, Space, Typography, theme } from 'antd' +import zhLocale from 'antd/locale/zh_CN' import 'dayjs/locale/zh-cn' +import { useEffect } from 'react' +import { Link, NavLink, Outlet, useHref, useNavigate } from 'react-router-dom' -import 'react-chat-elements/dist/main.css' import '@/assets/App.css' import AppLogo from '@/assets/logo-gh.png' +import 'react-chat-elements/dist/main.css' const { Header, Footer, Content } = Layout const { Title } = Typography @@ -112,9 +111,6 @@ function AuthApp() { > e.preventDefault()} style={{ color: colorPrimary }}> {loginUser?.username?.substring(1)}{loginUser.username} diff --git a/src/views/DingdingQRCode.jsx b/src/views/DingdingQRCode.jsx index 92df5df..d4b86a4 100644 --- a/src/views/DingdingQRCode.jsx +++ b/src/views/DingdingQRCode.jsx @@ -1,8 +1,7 @@ -import { Result, Spin, Flex, Typography } from 'antd' -import React, { useEffect, useState } from 'react' -import { useNavigate } from 'react-router-dom' import useAuthStore from '@/stores/AuthStore' -import { fetchJSON } from '@/utils/request' +import { Flex, Result, Spin, Typography } from 'antd' +import { useEffect } from 'react' +import { useNavigate } from 'react-router-dom' const { Title } = Typography @@ -12,11 +11,11 @@ function DingdingQRCode() { const navigate = useNavigate() - const { loginStatus, authenticate } = useAuthStore() + const { loginStatus, authenticate, logout, updateLoginStatus } = useAuthStore() useEffect (() => { - if (location.search === '?out') { - window.sessionStorage.clear() + if (location.search === '?out') { + logout() navigate('/p/dingding/qrcode') } }, []) @@ -63,7 +62,7 @@ function DingdingQRCode() { ) } else if (loginStatus === 302) { - navigate('/account/profile') + navigate('/') } else if (loginStatus === 403) { return ( diff --git a/src/views/Standlone.jsx b/src/views/Standlone.jsx index 4efac98..765890c 100644 --- a/src/views/Standlone.jsx +++ b/src/views/Standlone.jsx @@ -1,18 +1,26 @@ -import { Outlet, Link, useHref, NavLink } from 'react-router-dom' -import { useRef, useEffect, useState } from 'react' -import { Layout, Menu, ConfigProvider, theme, Empty, Row, Col, Dropdown, Space, Typography, Result, App as AntApp } from 'antd' -import { DownOutlined } from "@ant-design/icons"; import '@/assets/App.css' import AppLogo from '@/assets/logo-gh.png' +import useAuthStore from '@/stores/AuthStore' import { useThemeContext } from '@/stores/ThemeContext' -import { isEmpty } from '@/utils/commons' - +import { App as AntApp, Col, ConfigProvider, Empty, Layout, Row, Typography, theme } from 'antd' +import { NavLink, Outlet, useHref, useNavigate } from 'react-router-dom' +import { useEffect } from 'react' const { Header, Footer, Content } = Layout const { Title } = Typography function Standlone() { const {colorPrimary, borderRadius} = useThemeContext() + const { loginUser } = useAuthStore() + const navigate = useNavigate() + const href = useHref() + + useEffect(() => { + // 除了路由 /p...以外都需要登陆系统 + if (loginUser.userId > 0) { + navigate('/'); + } + }, [href]) const { token: { colorBgContainer }, From b0c2e700c74fc418ef16e2e4ea871dd6d1586885 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Wed, 28 Feb 2024 09:46:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/AuthStore.js | 19 +++++++++++++------ src/views/DingdingQRCode.jsx | 6 +++--- src/views/OrderFollow.jsx | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index 610855c..eb7bf98 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -7,6 +7,7 @@ const useAuthStore = create((set, get) => ({ // {"userId":"383","username":"廖一军","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png","mobile":"+86-18777396951","email":"lyj@hainatravel.com","openId":"iioljiPmZ4RPoOYpkFiSn7IKAiEiE","accountList":[{"OPI_SN":383,"OPI_Code":"LYJ","OPI_NameCN":"廖一军","OPI_DEI_SN":7,"OPI_NameEN":"Jimmy Liow"},{"OPI_SN":609,"OPI_Code":"LYJAH","OPI_NameCN":"廖一军(ah)","OPI_DEI_SN":28,"OPI_NameEN":"Jimmy Liow"}]} loginUser: { userId: -1, + userIdStr: '-1', username: '', avatarUrl: '', mobile: '', @@ -18,18 +19,23 @@ const useAuthStore = create((set, get) => ({ loginStatus: 0, - authenticate: async (authCode) => { + login: async (authCode) => { - const { saveUserSession, updateLoginStatus } = get() + const { saveUserSession, setLoginStatus } = get() - updateLoginStatus(200) + setLoginStatus(200) const json = await fetchJSON(`https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/WhatsAppAuth`, { authCode }) if (json.errcode === 0) { + + set(() => ({ loginUser: { userId: json.result.opisn, + userIdStr: json.result?.accountlist.map(acc => { + return acc.OPI_SN + }).join(','), accountName: json.result.opicode, username: json.result.nick, avatarUrl: json.result.avatarUrl, @@ -40,13 +46,13 @@ const useAuthStore = create((set, get) => ({ } })) saveUserSession() - updateLoginStatus(302) + setLoginStatus(302) } else { - updateLoginStatus(403) + setLoginStatus(403) } }, - updateLoginStatus: (code) => { + setLoginStatus: (code) => { set(() => ({ loginStatus: code })) @@ -57,6 +63,7 @@ const useAuthStore = create((set, get) => ({ set(() => ({ loginUser: { userId: -1, + userIdStr: '-1', username: '', avatarUrl: '', mobile: '', diff --git a/src/views/DingdingQRCode.jsx b/src/views/DingdingQRCode.jsx index d4b86a4..f1edae1 100644 --- a/src/views/DingdingQRCode.jsx +++ b/src/views/DingdingQRCode.jsx @@ -11,7 +11,7 @@ function DingdingQRCode() { const navigate = useNavigate() - const { loginStatus, authenticate, logout, updateLoginStatus } = useAuthStore() + const { loginStatus, login, logout, setLoginStatus } = useAuthStore() useEffect (() => { if (location.search === '?out') { @@ -38,10 +38,10 @@ function DingdingQRCode() { }, (loginResult) => { const { authCode } = loginResult - authenticate(authCode) + login(authCode) }, (errorMsg) => { - updateLoginStatus(403) + setLoginStatus(403) console.error(`Login Error: ${errorMsg}`) }, ) diff --git a/src/views/OrderFollow.jsx b/src/views/OrderFollow.jsx index 45996e2..595b822 100644 --- a/src/views/OrderFollow.jsx +++ b/src/views/OrderFollow.jsx @@ -206,7 +206,7 @@ function OrderList({ formValues }) { const [orderData, setOrderData] = useState([]) const [loading, setLoading] = useState(false) const { loginUser } = useAuthStore() - let fetchOrderUrl = `${API_HOST}/getwlorder?opisn=${loginUser.userId}&otype=${formValues.type}` + let fetchOrderUrl = `${API_HOST}/getwlorder?opisn=${loginUser.userIdStr}&otype=${formValues.type}` if (formValues.type === 'advance') { const fromDate = formValues.startDateRange[0].format('YYYY-MM-DD') @@ -219,7 +219,7 @@ function OrderList({ formValues }) { confirmThruDate = formValues.confirmDateRange[1].format('YYYY-MM-DD') } fetchOrderUrl = prepareUrl('https://p9axztuwd7x8a7.mycht.cn/whatsapp_server/getdvancedwlorder') - .append('opisn', loginUser.userId) + .append('opisn', loginUser.userIdStr) .append('startdate', fromDate) .append('enddate', thruDate) .append('tag', formValues.orderLabel) From 8e0751fe260c3ff44f3748379f68c5e28df12d42 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 28 Feb 2024 09:54:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?config;=20=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E9=80=89=E9=A1=B9;=20=E5=9B=BE=E7=89=87=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=A0=B7=E5=BC=8F;=20=E5=8F=91=E9=80=81=E8=A1=A8?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- import saleSmartly contacts.sql | 50 +++++++++++++++++++ package.json | 1 + src/actions/ConversationActions.js | 3 +- src/config.js | 1 + src/lib/msgUtils.js | 9 ++-- src/stores/ConversationStore.js | 2 +- .../Components/ConversationsList.jsx | 2 +- .../Conversations/Components/Input/Emoji.jsx | 31 ++++++++++++ .../Components/Input/ImageUpload.jsx | 4 +- .../Components/Input/Template.jsx | 4 +- .../Components/InputComposer.jsx | 6 ++- .../Conversations/Components/Messages.jsx | 2 +- src/views/Conversations/Conversations.css | 6 +++ 13 files changed, 105 insertions(+), 16 deletions(-) create mode 100644 import saleSmartly contacts.sql create mode 100644 src/views/Conversations/Components/Input/Emoji.jsx diff --git a/import saleSmartly contacts.sql b/import saleSmartly contacts.sql new file mode 100644 index 0000000..387ebb8 --- /dev/null +++ b/import saleSmartly contacts.sql @@ -0,0 +1,50 @@ + +-- 601 王露加(AH) Ann Wang +UPDATE WhatsApp_Session +SET opi_sn =601 +WHERE opi_sn is null and whatsapp_phone_number IN ('600123021806', '919421671750', '61438817779', '393406100983', '12032531996', '60197799795', '447788271298', '6598239020', '4407788271298', '6584686731', '60123075151', '60194903126', '13238286927', '6596966465', '6598267067', '14048496022', '6598809877', '628111663399', '60166268901', '19376202088', '62811907069', '61402445619', '393343998897', '6589475894', '41768308393', '1919324583030', '6598410895', '6593838816', '610402445619', '6592707262', '610431280050', '62811265987', '447702101254', '4407702101254', '85295012200', '10438012756', '15127570944', '13038837142', '6594890344', '13053353222'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =601 +WHERE froms IN ('600123021806', '919421671750', '61438817779', '393406100983', '12032531996', '60197799795', '447788271298', '6598239020', '4407788271298', '6584686731', '60123075151', '60194903126', '13238286927', '6596966465', '6598267067', '14048496022', '6598809877', '628111663399', '60166268901', '19376202088', '62811907069', '61402445619', '393343998897', '6589475894', '41768308393', '1919324583030', '6598410895', '6593838816', '610402445619', '6592707262', '610431280050', '62811265987', '447702101254', '4407702101254', '85295012200', '10438012756', '15127570944', '13038837142', '6594890344', '13053353222'); + + +-- 487 杨新玲(AH) COCO +UPDATE WhatsApp_Session +SET opi_sn =487 +WHERE opi_sn is null and whatsapp_phone_number IN ( +'12103817205','17758484963','60149483183','6281510103434','628119782869','447752219225','12084122282','15083266574','14402632632','918178744977','12106891804','573206915405','12035084239','6591793713','6596303740','16507507777','13146235967','610402933421','19738008090','16025109980','14156139002','85569570025','23052514484','16135487944','18052166879','972522554653','270824611177','34651307209','41796154103','393421384738','19084563966','971568748804','84979380502','491785727904','4901785727904','6598227132','16179352409','4915122297678','15163772972','447539174554','447539174554','16025109980','19166276277','610415682199','447766318643','4407766318643','8201068091987','41796154103','918587901086','918587901086'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =487 +WHERE froms IN ( +'12103817205','17758484963','60149483183','6281510103434','628119782869','447752219225','12084122282','15083266574','14402632632','918178744977','12106891804','573206915405','12035084239','6591793713','6596303740','16507507777','13146235967','610402933421','19738008090','16025109980','14156139002','85569570025','23052514484','16135487944','18052166879','972522554653','270824611177','34651307209','41796154103','393421384738','19084563966','971568748804','84979380502','491785727904','4901785727904','6598227132','16179352409','4915122297678','15163772972','447539174554','447539174554','16025109980','19166276277','610415682199','447766318643','4407766318643','8201068091987','41796154103','918587901086','918587901086'); + +-- 603 秦雯萱(AH) Dora +UPDATE WhatsApp_Session +SET opi_sn =603 +WHERE opi_sn is null and whatsapp_phone_number IN ('19013561781','6285811111175','62889692159816','60162185779','6287888722293','60126518499','60126183248','17789950848','610455289205','60123152286','6060126518499','15185983270','6594319127','19013561781','14104266170','16174120590','6597969282','6591714969','18476483195','6592976545','6590095741','66818890118','447545084704','6596921770','447917350605','4407917350605'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =603 +WHERE froms IN ('19013561781','6285811111175','62889692159816','60162185779','6287888722293','60126518499','60126183248','17789950848','610455289205','60123152286','6060126518499','15185983270','6594319127','19013561781','14104266170','16174120590','6597969282','6591714969','18476483195','6592976545','6590095741','66818890118','447545084704','6596921770','447917350605','4407917350605'); + + +-- 606 莫梦瑶 Glory +UPDATE WhatsApp_Session +SET opi_sn =606 +WHERE opi_sn is null and whatsapp_phone_number IN ('6285762428379'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =606 +WHERE froms IN ('6285762428379'); + +-- 586 秦宇尘 Jimmy +UPDATE WhatsApp_Session +SET opi_sn =606 +WHERE opi_sn is null and whatsapp_phone_number IN ('17736215303'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =606 +WHERE froms IN ('17736215303'); + diff --git a/package.json b/package.json index f3ba594..795b872 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "antd": "^5.14.0", "crypto-js": "^4.2.0", "dayjs": "^1.11.10", + "emoji-picker-react": "^4.8.0", "react": "^18.2.0", "react-chat-elements": "^12.0.11", "react-dom": "^18.2.0", diff --git a/src/actions/ConversationActions.js b/src/actions/ConversationActions.js index 2550cd4..1b8bd66 100644 --- a/src/actions/ConversationActions.js +++ b/src/actions/ConversationActions.js @@ -2,8 +2,7 @@ import { groupBy } from '@/utils/utils'; import { fetchJSON, postJSON } from '@/utils/request' import { parseRenderMessageList } from '@/lib/msgUtils'; - -const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; +import { API_HOST } from '@/config'; export const fetchTemplates = async () => { const data = await fetchJSON(`${API_HOST}/listtemplates`); diff --git a/src/config.js b/src/config.js index 0648149..cfb8723 100644 --- a/src/config.js +++ b/src/config.js @@ -1,2 +1,3 @@ export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server' +export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod: export const DATE_FORMAT = 'YYYY-MM-DD' diff --git a/src/lib/msgUtils.js b/src/lib/msgUtils.js index fa200dd..bde7998 100644 --- a/src/lib/msgUtils.js +++ b/src/lib/msgUtils.js @@ -14,7 +14,7 @@ export const replaceTemplateString = (str, replacements) => { return result; } -const autoLinkText = (text) => { +export const autoLinkText = (text) => { let regex = /(https?:\/\/[^\s]+)/g; let newText = text.replace(regex, '$1'); @@ -85,7 +85,6 @@ export const sentMsgTypeMapped = { whatsappTemplate: { contentToSend: (msg) => ({ action: 'message', actionId: msg.id, renderId: msg.id, to: msg.to, msgtype: 'template', msgcontent: msg.template }), contentToRender: (msg) => { - console.log(msg); const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({ ...r, [v.type]: v }), {}) : null; // const templateParam = (templateDataMapped?.body?.parameters || []).map(e => e.text); // const fillTemplate = templateParam.length ? replaceTemplateString(msg.template_origin.components.body?.[0]?.text || '', templateParam) : (msg.template_origin.components.body?.[0]?.text || ''); @@ -186,20 +185,20 @@ export const whatsappMsgTypeMapped = { data: (msg) => ({ id: msg.wamid, text: msg.image.caption, - data: { id: msg.wamid, uri: msg.image.link, width: 200, height: 200, alt: msg.image.caption, }, + data: { id: msg.wamid, uri: msg.image.link, width: '100%', height: 200, alt: msg.image.caption, }, onOpen: () => { console.log('Open image', msg.image.link); }, }), renderForReply: (msg) => ({ - id: msg.wamid, photoURL: msg.image.link, width: 200, height: 200, alt: '', + id: msg.wamid, photoURL: msg.image.link, width: '100%', height: 200, alt: '', }), }, sticker: { type: 'photo', data: (msg) => ({ id: msg.wamid, - data: { id: msg.wamid, uri: msg.sticker.link, width: 150, height: 120, alt: '' }, + data: { id: msg.wamid, uri: msg.sticker.link, width: '100%', height: 120, alt: '' }, }), }, video: { diff --git a/src/stores/ConversationStore.js b/src/stores/ConversationStore.js index aca1503..4bf89be 100644 --- a/src/stores/ConversationStore.js +++ b/src/stores/ConversationStore.js @@ -4,10 +4,10 @@ import { olog, isEmpty } from '@/utils/utils'; import { receivedMsgTypeMapped } from '@/lib/msgUtils'; import { fetchConversationsList, fetchTemplates } from '@/actions/ConversationActions'; import { devtools } from 'zustand/middleware'; +import { WS_URL } from '@/config'; // const WS_URL = 'ws://202.103.68.144:8888/whatever/'; // const WS_URL = 'ws://120.79.9.217:10022/whatever/'; -const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod: const initialConversationState = { // websocket: null, diff --git a/src/views/Conversations/Components/ConversationsList.jsx b/src/views/Conversations/Components/ConversationsList.jsx index 12ca846..ea345e8 100644 --- a/src/views/Conversations/Components/ConversationsList.jsx +++ b/src/views/Conversations/Components/ConversationsList.jsx @@ -118,7 +118,7 @@ const Conversations = () => { title={item.whatsapp_name.trim() || item.whatsapp_phone_number} date={item.last_received_time} unread={item.unread_msg_count} - className={String(item.sn) === String(currentConversation.sn) ? '__active text-primary border-y-0 border-e-0 border-s-2 border-solid border-whatsapp-me ' : ''} + className={String(item.sn) === String(currentConversation.sn) ? '__active text-primary border-y-0 border-e-0 border-s-4 border-solid border-whatsapp-bg bg-whatsapp-bg' : ''} onClick={() => onSwitchConversation(item)} /> diff --git a/src/views/Conversations/Components/Input/Emoji.jsx b/src/views/Conversations/Components/Input/Emoji.jsx new file mode 100644 index 0000000..d1a5842 --- /dev/null +++ b/src/views/Conversations/Components/Input/Emoji.jsx @@ -0,0 +1,31 @@ +import { useState } from 'react'; +import { Popover, Button } from 'antd'; +import EmojiPicker from 'emoji-picker-react'; + +const InputTemplate = ({ disabled = false, inputEmoji }) => { + const [openPopup, setOpenPopup] = useState(false); + + const handlePickEmoji = (emojiData) => { + inputEmoji(emojiData.emoji); + }; + + return ( + <> + } + // title='😀' + trigger='click' + open={openPopup} + onOpenChange={setOpenPopup}> + + + + ); +}; +export default InputTemplate; diff --git a/src/views/Conversations/Components/Input/ImageUpload.jsx b/src/views/Conversations/Components/Input/ImageUpload.jsx index 357ca40..fd4a0e4 100644 --- a/src/views/Conversations/Components/Input/ImageUpload.jsx +++ b/src/views/Conversations/Components/Input/ImageUpload.jsx @@ -32,7 +32,7 @@ const ImageUpload = ({ disabled, invokeSendMessage }) => { const handleSendImage = (src) => { const msgObj = { type: 'photo', - data: { uri: src, }, + data: { uri: src, width: '100%', height: 150, }, id: uuid(), }; setComplexMsg(msgObj); @@ -55,7 +55,7 @@ const ImageUpload = ({ disabled, invokeSendMessage }) => { message.error(`图片添加失败`); } }}> -