From eac43e49c050812879e7d3815b513a7b6b24690e Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Tue, 5 Nov 2024 16:46:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8window.getSelection()?= =?UTF-8?q?.addRange(range)=20=E6=96=B9=E5=BC=8F=E5=A4=8D=E5=88=B6=20HTML?= =?UTF-8?q?=EF=BC=9B=E6=B5=8B=E8=AF=95=E8=AE=BE=E7=BD=AE=E5=95=86=E4=B8=9A?= =?UTF-8?q?=E5=8F=B7=E8=BA=AB=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++- src/stores/AuthStore.js | 18 ++++++- src/views/accounts/HtmlPreview.jsx | 12 +++-- src/views/accounts/Profile.jsx | 85 ++++++++++-------------------- src/views/accounts/SnippetList.jsx | 9 +++- 5 files changed, 70 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index b09aa7f..19c1a0d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Global sales -销售平台 2.0 +销售平台:通过邮件、WhatsApp Business Account、WhatsApp 和客人沟通。 ## 开发设置 @@ -10,8 +10,15 @@ 2. 运行开发环境:dev.bat 3. 打包代码:build.bat + ## 版本设置 +遵循 [Semantic Versioning 2.0.0](http://semver.org/lang/zh-CN/) 语义化版本规范。 + +修订版本号:日常 bugfix 更新。(如果有紧急的 bugfix,则任何时候都可发布) +次版本号:有新特性的向下兼容的版本。 +主版本号:含有破坏性更新和新特性。 + npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] npm version premajor --no-git-tag-version diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index c93f20a..bee3593 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -1,6 +1,7 @@ import { create } from 'zustand' -import { fetchJSON } from '@/utils/request' +import { fetchJSON, postForm } from '@/utils/request' import { isEmpty, isNotEmpty } from '@/utils/commons' +import { API_HOST } from '@/config' export const PERM_MERGE_CONVERSATION = 'merge-conversation' export const PERM_ASSIGN_NEW_CONVERSATION = 'assign-new-conversation' @@ -142,6 +143,21 @@ const useAuthStore = create((set, get) => ({ navigator.clipboard.writeText(sessionData) } }, + + setWhatsAppBusiness: async (userId, whatsAppBusiness) => { + const postWABAUrl = `${API_HOST}/v2/set_whatsapp_info` + + const params = {opi_sn: userId, whatsapp_waba: whatsAppBusiness}; + + return fetchJSON(postWABAUrl, params) + .then(json => { + if (json.errcode === 0) { + console.info(json) + } else { + throw new Error(json?.errmsg + ': ' + json.errcode) + } + }) + }, })) export default useAuthStore diff --git a/src/views/accounts/HtmlPreview.jsx b/src/views/accounts/HtmlPreview.jsx index 880c139..81736d8 100644 --- a/src/views/accounts/HtmlPreview.jsx +++ b/src/views/accounts/HtmlPreview.jsx @@ -3,7 +3,7 @@ import { Conditional } from '@/components/Conditional' import { isNotEmpty } from '@/utils/commons' const HtmlPreview = (props) => { - const { loading = false, value, onEdit, onCopy, onDelete } = props + const { loading = false, value, onEdit, onCopied, onDelete } = props if (loading) { return @@ -14,7 +14,7 @@ const HtmlPreview = (props) => { +
           
} whenFalse={} @@ -27,7 +27,13 @@ const HtmlPreview = (props) => { diff --git a/src/views/accounts/Profile.jsx b/src/views/accounts/Profile.jsx index 7c2a116..177649b 100644 --- a/src/views/accounts/Profile.jsx +++ b/src/views/accounts/Profile.jsx @@ -1,33 +1,10 @@ import { useEffect } from 'react' -import { - Row, - Col, - Space, - Descriptions, - Avatar, - Tag, - Divider, - List, - Alert, - Button, - Flex, - Select, - Spin, - Form, - Typography, - QRCode, -} from 'antd' -import { - UserOutlined, - InfoCircleOutlined, - CloseCircleFilled, - ReloadOutlined, - CheckCircleFilled, -} from '@ant-design/icons' +import { Row, Col, Space, Descriptions, Avatar, Tag, Divider, List, Alert, Button, Flex, Select, Spin, Form, Typography, QRCode, Tooltip } from 'antd' +import { UserOutlined, InfoCircleOutlined, CloseCircleFilled, ReloadOutlined, CheckCircleFilled } from '@ant-design/icons' import useAuthStore from '@/stores/AuthStore' function Profile() { - const loginUser = useAuthStore((state) => state.loginUser) + const [loginUser, setWhatsAppBusiness] = useAuthStore((state) => [state.loginUser, state.setWhatsAppBusiness]) useEffect(() => { console.info(loginUser) @@ -41,12 +18,12 @@ function Profile() { case 'expired': return (
- {' '} - {info.locale?.expired} + 8618754124786 已登录