|
|
|
@ -1,9 +1,13 @@
|
|
|
|
|
import { useEffect } from 'react'
|
|
|
|
|
import { Row, Col, Space, Descriptions, Avatar, Tag, Divider, List, Alert, Button, Flex, Select, Spin, Form, Typography, QRCode, Tooltip } from 'antd'
|
|
|
|
|
import { useEffect, useCallback } from 'react'
|
|
|
|
|
import { Row, Col, Space, Descriptions, Avatar, Tag, Divider, List, App, 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 { notification } = App.useApp()
|
|
|
|
|
const [wabaForm] = Form.useForm()
|
|
|
|
|
|
|
|
|
|
const [loginUser, setWhatsAppBusiness] = useAuthStore((state) => [state.loginUser, state.setWhatsAppBusiness])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
@ -12,6 +16,26 @@ function Profile() {
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const handelUpdateWABA = useCallback(() => {
|
|
|
|
|
console.info('handelUpdateWABA: %o', wabaForm.getFieldsValue())
|
|
|
|
|
setWhatsAppBusiness(loginUser.userId, wabaForm.getFieldsValue().whatsAppBusiness)
|
|
|
|
|
.then(() => {
|
|
|
|
|
notification.info({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: '商业号身份设置成功',
|
|
|
|
|
placement: 'top',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(ex => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: ex.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 4,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const customStatusRender = (info) => {
|
|
|
|
|
switch (info.status) {
|
|
|
|
|
case 'expired':
|
|
|
|
@ -85,28 +109,27 @@ function Profile() {
|
|
|
|
|
}>
|
|
|
|
|
<Form
|
|
|
|
|
layout='vertical'
|
|
|
|
|
// form={form}
|
|
|
|
|
form={wabaForm}
|
|
|
|
|
initialValues={{whatsAppBusiness: loginUser.whatsAppBusiness}}
|
|
|
|
|
>
|
|
|
|
|
<Form.Item>
|
|
|
|
|
<Form.Item name='whatsAppBusiness'>
|
|
|
|
|
<Select
|
|
|
|
|
defaultValue='8617607730395'
|
|
|
|
|
options={[
|
|
|
|
|
{
|
|
|
|
|
value: '8618174165365',
|
|
|
|
|
label: 'GH 客服(8618174165365)',
|
|
|
|
|
value: '+8617607730395',
|
|
|
|
|
label: 'GH 顾问(+8617607730395)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '8617607730395',
|
|
|
|
|
label: 'GH 顾问(8617607730395)',
|
|
|
|
|
value: '+8618174165365',
|
|
|
|
|
label: '国际事业部(+8618174165365)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '191477856351',
|
|
|
|
|
label: 'GH 客运(191477856351)',
|
|
|
|
|
value: 'GH 客运',
|
|
|
|
|
label: 'GH 客运(无)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '国际事业部',
|
|
|
|
|
label: '国际事业部(无)',
|
|
|
|
|
disabled: true,
|
|
|
|
|
value: 'GH 客服',
|
|
|
|
|
label: 'GH 客服(无)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'CT 事业部',
|
|
|
|
@ -124,9 +147,7 @@ function Profile() {
|
|
|
|
|
<Form.Item>
|
|
|
|
|
<Button
|
|
|
|
|
type='primary'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setWhatsAppBusiness(383, 8617607730395)
|
|
|
|
|
}}>
|
|
|
|
|
onClick={handelUpdateWABA}>
|
|
|
|
|
保存
|
|
|
|
|
</Button>
|
|
|
|
|
</Form.Item>
|
|
|
|
|