diff --git a/src/main.jsx b/src/main.jsx
index 3680e42..6a963a6 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -24,6 +24,7 @@ import Unassign from '@/views/ChatUnassign';
import ChatAssign from '@/views/Conversations/ChatAssign';
import DingdingLogin from '@/views/dingding/Login'
+import DingdingQRCode from '@/views/dingding/QRCode'
import useAuthStore from '@/stores/AuthStore'
import '@/assets/index.css'
@@ -80,10 +81,12 @@ const router = createBrowserRouter([
{
path: '/p',
element: ,
+ errorElement: ,
children: [
{ path: 'dingding/login', element: },
{ path: 'dingding/logout', element: },
{ path: 'dingding/callback', element: },
+ { path: 'dingding/qr-code', element: },
],
},
]);
diff --git a/src/views/dingding/QRCode.jsx b/src/views/dingding/QRCode.jsx
index 6a6c77e..6687d65 100644
--- a/src/views/dingding/QRCode.jsx
+++ b/src/views/dingding/QRCode.jsx
@@ -1,6 +1,6 @@
import useAuthStore from '@/stores/AuthStore'
import { Flex, Result, Spin, Typography } from 'antd'
-import { useEffect } from 'react'
+import { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
const { Title } = Typography
@@ -10,16 +10,18 @@ const { Title } = Typography
function QRCode() {
const navigate = useNavigate()
-
- const loginStatus = useAuthStore((state) => state.loginStatus)
- const setLoginStatus = useAuthStore((state) => state.setLoginStatus)
- const loginUser = useAuthStore((state) => state.loginUser)
- const login = useAuthStore((state) => state.login)
+
+ const [result, setResult] = useState('')
+
+ // 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) {
- navigate('/')
- }
+ // if (loginUser.userId > 0) {
+ // navigate('/')
+ // }
}, [])
useEffect(() => {
@@ -40,49 +42,24 @@ function QRCode() {
},
(loginResult) => {
const { authCode } = loginResult
- login(authCode)
+ // login(authCode)
+ setResult(authCode)
},
(errorMsg) => {
- setLoginStatus(403)
+ // setLoginStatus(403)
console.error(`Login Error: ${errorMsg}`)
},
)
})
}, [])
- if (loginStatus === 200) {
- return (
-
-
- ]}
- />
-
- )
- } else if (loginStatus === 302) {
- navigate('/')
- } else if (loginStatus === 403) {
- return (
-
-
-
- )
- } else {
- return (
-
- 使用钉钉扫码
-
-
- )
- }
+ return (
+
+ 使用钉钉扫码
+
+ 钉钉 authCode: {result}
+
+ )
}
export default QRCode
\ No newline at end of file