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 MobileApp from '@/views/MobileApp'
import Standlone from '@/views/Standlone'
import OrderFollow from '@/views/OrderFollow'
import OrderFollow from '@/views/orders/Follow'
import ChatHistory from '@/views/ChatHistory'
import SalesManagement from '@/views/SalesManagement'
import DingdingQRCode from '@/views/dingding/QRCode'
import DingdingCallback from '@/views/dingding/Callback'
import DingdingLogout from '@/views/dingding/Logout'
import AccountProfile from '@/views/AccountProfile'
import AccountProfile from '@/views/accounts/Profile'
import ErrorPage from '@/components/ErrorPage'
import Conversations from '@/views/Conversations/ChatWindow'
import MobileConversation from '@/views/mobile/Conversation'
import MobileChat from '@/views/mobile/Chat'
import MobileLogin from '@/views/mobile/Login'
import DingdingLogin from '@/views/dingding/Login'
import useAuthStore from '@/stores/AuthStore'
import '@/assets/index.css'
@ -61,10 +61,11 @@ const router = createBrowserRouter([
path: '/p',
element: <Standlone />,
children: [
{ path: 'dingding/qrcode', element: isMobileApp ? <MobileLogin /> : <DingdingQRCode /> },
{ path: 'dingding/callback', element: <DingdingCallback /> },
{ path: 'dingding/login', element: <DingdingLogin /> },
{ 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(() => {
// /p...
if ((loginUser.userId === -1) && (href.indexOf('/p/') === -1)) {
navigate('/p/dingding/qrcode')
navigate('/p/dingding/login')
}
}, [href])

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

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

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

@ -1,10 +1,8 @@
import useAuthStore from '@/stores/AuthStore'
import { isNotEmpty } from '@/utils/commons'
import { Flex, Result, Spin, Typography } from 'antd'
import { Flex, Result, Spin } from 'antd'
import { useEffect } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
const { Title } = Typography
import { useNavigate } from 'react-router-dom'
// https://open.dingtalk.com/document/orgapp/obtain-identity-credentials#title-4up-u8w-5ug
// OAuth
@ -13,7 +11,8 @@ function Callback() {
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 authCode = urlSearch.get('authCode')
@ -42,7 +41,12 @@ function Callback() {
</Flex>
)
} 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')
} else {
navigate('/')
}
} else if (loginStatus === 403) {
return (
<Flex justify='center' align='center' gap='middle' vertical>

@ -1,6 +1,6 @@
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'
@ -11,11 +11,11 @@ function Chat() {
title='欢迎使用'
subTitle='正在跳转到钉钉登录页面'
extra={[
<Spin key='mobile-login' size='small' />
<Spin key='dingding-login' size='small' />
]}
/>
</Flex>
)
}
export default Chat
export default Login

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

@ -11,7 +11,10 @@ function QRCode() {
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(() => {
if (loginUser.userId > 0) {

@ -2,7 +2,7 @@ import { Conditional } from '@/components/Conditional'
import useAuthStore from '@/stores/AuthStore'
import useFormStore from '@/stores/FormStore'
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 {
App, Badge, Button,
@ -228,7 +228,13 @@ function OrderGroupTable({ formValues }) {
title: '出发日期',
dataIndex: 'COLI_OrderStartDate',
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: '客人最后一次回复时间',
@ -249,8 +255,9 @@ function OrderGroupTable({ formValues }) {
const { notification } = App.useApp()
const [loading, setLoading] = useState(false)
const { orderList, fetchOrderList } = useOrderStore()
const { loginUser } = useAuthStore()
const orderList = useOrderStore((state) => state.orderList)
const fetchOrderList = useOrderStore((state) => state.fetchOrderList)
const loginUser = useAuthStore((state) => state.loginUser)
useEffect(() => {
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 [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked]))
@ -405,4 +412,4 @@ function OrderFollow() {
)
}
export default OrderFollow
export default Follow
Loading…
Cancel
Save