Merge remote-tracking branch 'origin/main' into dev/chat

# Conflicts:
#	src/views/Conversations/Components/Input/MediaUpload.jsx
dev/chat
Lei OT 2 years ago
commit 88a5d3c43c

@ -6,18 +6,18 @@ import AuthApp from '@/views/AuthApp'
import DesktopApp from '@/views/DesktopApp' import DesktopApp from '@/views/DesktopApp'
import MobileApp from '@/views/MobileApp' import MobileApp from '@/views/MobileApp'
import Standlone from '@/views/Standlone' import Standlone from '@/views/Standlone'
import OrderFollow from '@/views/OrderFollow' import OrderFollow from '@/views/orders/Follow'
import ChatHistory from '@/views/ChatHistory' import ChatHistory from '@/views/ChatHistory'
import SalesManagement from '@/views/SalesManagement' import SalesManagement from '@/views/SalesManagement'
import DingdingQRCode from '@/views/dingding/QRCode' import DingdingQRCode from '@/views/dingding/QRCode'
import DingdingCallback from '@/views/dingding/Callback' import DingdingCallback from '@/views/dingding/Callback'
import DingdingLogout from '@/views/dingding/Logout' import DingdingLogout from '@/views/dingding/Logout'
import AccountProfile from '@/views/AccountProfile' import AccountProfile from '@/views/accounts/Profile'
import ErrorPage from '@/components/ErrorPage' import ErrorPage from '@/components/ErrorPage'
import Conversations from '@/views/Conversations/ChatWindow' import Conversations from '@/views/Conversations/ChatWindow'
import MobileConversation from '@/views/mobile/Conversation' import MobileConversation from '@/views/mobile/Conversation'
import MobileChat from '@/views/mobile/Chat' import MobileChat from '@/views/mobile/Chat'
import MobileLogin from '@/views/mobile/Login' import DingdingLogin from '@/views/dingding/Login'
import useAuthStore from '@/stores/AuthStore' import useAuthStore from '@/stores/AuthStore'
import '@/assets/index.css' import '@/assets/index.css'
@ -61,10 +61,11 @@ const router = createBrowserRouter([
path: '/p', path: '/p',
element: <Standlone />, element: <Standlone />,
children: [ children: [
{ path: 'dingding/qrcode', element: isMobileApp ? <MobileLogin /> : <DingdingQRCode /> }, { path: 'dingding/login', element: <DingdingLogin /> },
{ path: 'dingding/callback', element: <DingdingCallback /> },
{ path: 'dingding/logout', element: <DingdingLogout /> }, { path: 'dingding/logout', element: <DingdingLogout /> },
{ path: 'mobile-login', element: <MobileLogin /> }, { path: 'dingding/qrcode', element: isMobileApp ? <DingdingLogin /> : <DingdingQRCode /> },
{ path: 'dingding/callback', element: <DingdingCallback /> },
{ path: 'mobile-login', element: <DingdingLogin /> },
], ],
}, },
]); ]);

@ -65,7 +65,7 @@ function AuthApp() {
useEffect(() => { useEffect(() => {
// /p... // /p...
if ((loginUser.userId === -1) && (href.indexOf('/p/') === -1)) { if ((loginUser.userId === -1) && (href.indexOf('/p/') === -1)) {
navigate('/p/dingding/qrcode') navigate('/p/dingding/login')
} }
}, [href]) }, [href])

@ -20,7 +20,7 @@ const ImageUpload = ({ disabled, invokeUploadFileMessage, invokeSendUploadMessag
const beforeUpload = async (file) => { const beforeUpload = async (file) => {
const fileTypeSupport = Object.keys(whatsappSupportFileTypes).find((msgType) => whatsappSupportFileTypes[msgType].types.includes(file.type)); const fileTypeSupport = Object.keys(whatsappSupportFileTypes).find((msgType) => whatsappSupportFileTypes[msgType].types.includes(file.type));
if (isEmpty(fileTypeSupport)) { if (isEmpty(fileTypeSupport)) {
appMessage.warning('不支持的粘贴内容'); appMessage.warning('不支持的文件格式');
return false; return false;
} }
const waFile = whatsappSupportFileTypes[fileTypeSupport]; const waFile = whatsappSupportFileTypes[fileTypeSupport];

@ -24,7 +24,7 @@ function Standlone() {
<img src={AppLogo} className='logo' alt='App logo' /> <img src={AppLogo} className='logo' alt='App logo' />
</NavLink> </NavLink>
<Title level={3}> <Title level={3}>
聊天式销售平台 销售平台
</Title> </Title>
</Col> </Col>
</Row> </Row>

@ -5,10 +5,11 @@ import {
import { UserOutlined, BugOutlined } from '@ant-design/icons' import { UserOutlined, BugOutlined } from '@ant-design/icons'
import useAuthStore from '@/stores/AuthStore' import useAuthStore from '@/stores/AuthStore'
function AccountProfile() { function Profile() {
const { message } = App.useApp() const { message } = App.useApp()
const { loginUser, copyUserSession } = useAuthStore() const loginUser = useAuthStore((state) => state.loginUser)
const copyUserSession = useAuthStore((state) => state.copyUserSession)
useEffect(() => { useEffect(() => {
// //
@ -37,4 +38,4 @@ function AccountProfile() {
) )
} }
export default AccountProfile export default Profile

@ -1,10 +1,8 @@
import useAuthStore from '@/stores/AuthStore' import useAuthStore from '@/stores/AuthStore'
import { isNotEmpty } from '@/utils/commons' import { isNotEmpty } from '@/utils/commons'
import { Flex, Result, Spin, Typography } from 'antd' import { Flex, Result, Spin } from 'antd'
import { useEffect } from 'react' import { useEffect } from 'react'
import { useNavigate, useParams } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
const { Title } = Typography
// https://open.dingtalk.com/document/orgapp/obtain-identity-credentials#title-4up-u8w-5ug // https://open.dingtalk.com/document/orgapp/obtain-identity-credentials#title-4up-u8w-5ug
// OAuth // OAuth
@ -13,7 +11,8 @@ function Callback() {
const navigate = useNavigate() const navigate = useNavigate()
const { loginStatus, login, logout, setLoginStatus } = useAuthStore() const login = useAuthStore((state) => state.login)
const loginStatus = useAuthStore((state) => state.loginStatus)
const urlSearch = new URLSearchParams(location.search) const urlSearch = new URLSearchParams(location.search)
const authCode = urlSearch.get('authCode') const authCode = urlSearch.get('authCode')
@ -42,7 +41,12 @@ function Callback() {
</Flex> </Flex>
) )
} else if (loginStatus === 302) { } else if (loginStatus === 302) {
const isMobileApp = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) !== null
if (isMobileApp) {
navigate('/m/conversation') navigate('/m/conversation')
} else {
navigate('/')
}
} else if (loginStatus === 403) { } else if (loginStatus === 403) {
return ( return (
<Flex justify='center' align='center' gap='middle' vertical> <Flex justify='center' align='center' gap='middle' vertical>

@ -1,6 +1,6 @@
import { Flex, Result, Spin } from 'antd' import { Flex, Result, Spin } from 'antd'
function Chat() { function Login() {
window.location = 'https://login.dingtalk.com/oauth2/auth?redirect_uri=https%3A%2F%2Fsales.mycht.cn%2Fp%2Fdingding%2Fcallback&response_type=code&client_id=dingwgdx6emlxr3fcrg8&scope=openid&state=global-saels&prompt=consent' window.location = 'https://login.dingtalk.com/oauth2/auth?redirect_uri=https%3A%2F%2Fsales.mycht.cn%2Fp%2Fdingding%2Fcallback&response_type=code&client_id=dingwgdx6emlxr3fcrg8&scope=openid&state=global-saels&prompt=consent'
@ -11,11 +11,11 @@ function Chat() {
title='欢迎使用' title='欢迎使用'
subTitle='正在跳转到钉钉登录页面' subTitle='正在跳转到钉钉登录页面'
extra={[ extra={[
<Spin key='mobile-login' size='small' /> <Spin key='dingding-login' size='small' />
]} ]}
/> />
</Flex> </Flex>
) )
} }
export default Chat export default Login

@ -14,7 +14,7 @@ function Logout() {
useEffect(() => { useEffect(() => {
logout() logout()
reset(); reset();
navigate('/p/dingding/qrcode') navigate('/p/dingding/login')
}, []) }, [])
return ( return (

@ -11,7 +11,10 @@ function QRCode() {
const navigate = useNavigate() const navigate = useNavigate()
const { loginStatus, loginUser, login, setLoginStatus } = useAuthStore() const loginStatus = useAuthStore((state) => state.loginStatus)
const setLoginStatus = useAuthStore((state) => state.setLoginStatus)
const loginUser = useAuthStore((state) => state.loginUser)
const login = useAuthStore((state) => state.login)
useEffect(() => { useEffect(() => {
if (loginUser.userId > 0) { if (loginUser.userId > 0) {

@ -2,7 +2,7 @@ import { Conditional } from '@/components/Conditional'
import useAuthStore from '@/stores/AuthStore' import useAuthStore from '@/stores/AuthStore'
import useFormStore from '@/stores/FormStore' import useFormStore from '@/stores/FormStore'
import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions, RemindStateDefaultOptions } from '@/stores/OrderStore' import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions, RemindStateDefaultOptions } from '@/stores/OrderStore'
import { copy, isNotEmpty } from '@/utils/commons' import { copy, isNotEmpty, isEmpty } from '@/utils/commons'
import { InfoCircleTwoTone, MailTwoTone, MessageTwoTone, PhoneTwoTone, WhatsAppOutlined } from '@ant-design/icons' import { InfoCircleTwoTone, MailTwoTone, MessageTwoTone, PhoneTwoTone, WhatsAppOutlined } from '@ant-design/icons'
import { import {
App, Badge, Button, App, Badge, Button,
@ -228,7 +228,13 @@ function OrderGroupTable({ formValues }) {
title: '出发日期', title: '出发日期',
dataIndex: 'COLI_OrderStartDate', dataIndex: 'COLI_OrderStartDate',
width: 120, width: 120,
hidden: false hidden: false,
sortDirections: ['ascend', 'descend'],
sorter: (a, b, sortOrder) => {
const datejsA = isEmpty(a.COLI_OrderStartDate) ? dayjs(0) : new dayjs(a.COLI_OrderStartDate)
const datejsB = isEmpty(b.COLI_OrderStartDate) ? dayjs(0) : new dayjs(b.COLI_OrderStartDate)
return datejsA.isAfter(datejsB)
}
}, },
{ {
title: '客人最后一次回复时间', title: '客人最后一次回复时间',
@ -249,8 +255,9 @@ function OrderGroupTable({ formValues }) {
const { notification } = App.useApp() const { notification } = App.useApp()
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const { orderList, fetchOrderList } = useOrderStore() const orderList = useOrderStore((state) => state.orderList)
const { loginUser } = useAuthStore() const fetchOrderList = useOrderStore((state) => state.fetchOrderList)
const loginUser = useAuthStore((state) => state.loginUser)
useEffect(() => { useEffect(() => {
let canSearch = true let canSearch = true
@ -360,7 +367,7 @@ function OrderGroupTable({ formValues }) {
) )
} }
function OrderFollow() { function Follow() {
const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.orderFollowForm, state.setOrderFollowForm])) const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.orderFollowForm, state.setOrderFollowForm]))
const [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked])) const [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked]))
@ -405,4 +412,4 @@ function OrderFollow() {
) )
} }
export default OrderFollow export default Follow
Loading…
Cancel
Save