From 5a973ea1140f7fda2d63dea39fe047f0ed583b23 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Fri, 3 Jan 2025 09:41:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E4=B8=AA=E4=BA=BA=20?= =?UTF-8?q?WA=20=E6=9D=83=E9=99=90=E6=A0=B9=E6=8D=AE=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=9C=89=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9C=B0=E5=9D=80=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=9BWeb=20=E7=AB=AF=E6=94=B6=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=BA=E4=B8=A4=E5=88=86?= =?UTF-8?q?=E9=92=9F=EF=BC=9B=E4=BC=98=E5=8C=96=E6=94=B6=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E5=B0=8F=E8=99=AB=E5=AD=90=E5=A4=A7=E5=B0=8F=E3=80=81=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/AuthStore.js | 5 ++++- src/views/AuthApp.jsx | 15 ++++++++++++--- src/views/accounts/Profile.jsx | 13 ++++++++++--- src/workers/fetchEmailWorker.js | 8 +------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index 1c856db..06650d6 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -11,6 +11,8 @@ export const PERM_USE_EMAL = 'use-email' export const PERM_USE_WHATSAPP = 'use-whatsapp' export const PERM_IMPORT_EMAIL = 'import-email' +const WAI_SERVER_KEY = 'G-STR:WAI_SERVER' + const useAuthStore = create(devtools((set, get) => ({ loginUser: { userId: -1, @@ -29,10 +31,11 @@ const useAuthStore = create(devtools((set, get) => ({ loginStatus: 0, isPermitted: (perm) => { + const { waiServer } = usingStorage(WAI_SERVER_KEY) const { loginUser } = get() if (perm === PERM_USE_WHATSAPP) { - return ['370', '143', '495', '404', '383', '227'].includes(loginUser.userId) + return isNotEmpty(waiServer) // ['370', '143', '495', '404', '383', '227'].includes(loginUser.userId) } if (perm === PERM_USE_EMAL) { diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx index 666892c..997efc3 100644 --- a/src/views/AuthApp.jsx +++ b/src/views/AuthApp.jsx @@ -11,7 +11,7 @@ import { FloatButton, theme, } from 'antd' -import { BugOutlined } from '@ant-design/icons' +import { BugOutlined, CustomerServiceOutlined } from '@ant-design/icons' import zhLocale from 'antd/locale/zh_CN' import 'dayjs/locale/zh-cn' import { useEffect } from 'react' @@ -111,6 +111,13 @@ function AuthApp() { // 除了路由 /p...以外都需要登陆系统 const needToLogin = loginUser.userId === -1 && href.indexOf('/p/') === -1 + 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 + + const floatButtonLineEnd = isMobileApp ? 0 : 24 + useEffect(() => { if (needToLogin) { navigate('/p/dingding/login?origin_url=' + href) @@ -136,10 +143,12 @@ function AuthApp() { } > } tooltip={
上传日志给研发部
} onClick={() => uploadLog()} /> diff --git a/src/views/accounts/Profile.jsx b/src/views/accounts/Profile.jsx index 1e67b95..6e5d677 100644 --- a/src/views/accounts/Profile.jsx +++ b/src/views/accounts/Profile.jsx @@ -1,10 +1,12 @@ import { useEffect, useCallback } from 'react' -import { Row, Col, Space, Input, Descriptions, Avatar, Tag, Divider, List, App, Button, Flex, Select, Form, Typography, Tooltip } from 'antd' +import { Row, Col, Space, Input, Descriptions, Avatar, Tag, Divider, List, App, Button, Flex, Select, Form, Typography, Tooltip, Result } from 'antd' import { UserOutlined, InfoCircleOutlined } from '@ant-design/icons' import useAuthStore from '@/stores/AuthStore' import { Conditional } from '@/components/Conditional' import { PERM_USE_WHATSAPP } from '@/stores/AuthStore' import { usingStorage } from '@/utils/usingStorage'; + +import { isEmpty } from '@/utils/commons' import { WAI_SERVER_KEY } from '@/config'; import WAIQRCode from './WAIQRCode'; @@ -112,7 +114,7 @@ function Profile() { - +