|
@@ -9,7 +9,7 @@ import history from '@/utils/history'
|
|
|
import { Button, Form, Input, Modal } from 'antd'
|
|
|
import { Base64 } from 'js-base64'
|
|
|
import encodeStr from '@/utils/pass'
|
|
|
-import { API_getRoleArr, passWordEditAPI } from '@/store/action/layout'
|
|
|
+import { API_ddLogin, API_getRoleArr, passWordEditAPI } from '@/store/action/layout'
|
|
|
import { changSetFu, getTokenInfo, removeTokenInfo, setTokenInfo } from '@/utils/storage'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
|
import logoImg from '@/assets/img/logo2.png'
|
|
@@ -27,8 +27,35 @@ import baseTouXiangImg from '@/assets/img/user.png'
|
|
|
import { Z5_APIgetInfo } from '@/store/action/Z5role'
|
|
|
import { getUserInfoByIdAPI } from '@/store/action/Z6user'
|
|
|
import { maiDianFu } from '@/components/ZmaiDian'
|
|
|
+import dd from 'gdt-jsapi'
|
|
|
|
|
|
function Layout() {
|
|
|
+ useEffect(() => {
|
|
|
+ if (isDing) {
|
|
|
+ const userInfo = getTokenInfo().user
|
|
|
+ if (userInfo && userInfo.id) {
|
|
|
+ dd.ready(function () {
|
|
|
+ dd.getAuthCode({
|
|
|
+ corpId: ''
|
|
|
+ })
|
|
|
+ .then(async res1 => {
|
|
|
+ const code = res1.auth_code
|
|
|
+ const res = await API_ddLogin(code!)
|
|
|
+ if (res.code === 0) {
|
|
|
+ if (res.data.user.id !== userInfo.id) {
|
|
|
+ removeTokenInfo()
|
|
|
+ history.replace('/login')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ MessageFu.error(err)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
+
|
|
|
// 字典加载完毕才加载别的
|
|
|
const [isLoding, setIsLoding] = useState(false)
|
|
|
|