mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 18:19:03 +08:00
feat: 开发环境提示目前没有isDev判断()
This commit is contained in:
+36
-11
@@ -139,22 +139,32 @@ function MainContent(): React.JSX.Element {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
{/* 开发中画面水印 */}
|
|
||||||
<p
|
<div style={{
|
||||||
style={{
|
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
|
display: 'flex',
|
||||||
bottom: '2px',
|
bottom: '2px',
|
||||||
left: '20px',
|
left: '20px',
|
||||||
opacity: 0.6,
|
opacity: 0.6,
|
||||||
|
zIndex: 9999
|
||||||
|
}}>
|
||||||
|
<p style={{
|
||||||
color: '#de2611',
|
color: '#de2611',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
fontSize: '13px',
|
fontSize: '13px',
|
||||||
pointerEvents: 'none', // 防止水印干扰页面交互
|
pointerEvents: 'none',
|
||||||
zIndex: 9999 // 确保水印在最顶层显示
|
}}>
|
||||||
}}
|
开发中画面,不代表最终品质
|
||||||
>
|
|
||||||
开发中画面,不代表真正品质 ({getArchitecture()})
|
|
||||||
</p>
|
</p>
|
||||||
|
<p style={{
|
||||||
|
color: '#44474b',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
fontSize: '13px',
|
||||||
|
paddingLeft: '5px',
|
||||||
|
}}>
|
||||||
|
SecScore Dev ({getPlatform()}-{getArchitecture()})
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -166,16 +176,31 @@ function getArchitecture(): string {
|
|||||||
|
|
||||||
if (userAgent.includes('arm64') || userAgent.includes('aarch64')) {
|
if (userAgent.includes('arm64') || userAgent.includes('aarch64')) {
|
||||||
return 'ARM64';
|
return 'ARM64';
|
||||||
} else if (userAgent.includes('x86_64') || userAgent.includes('amd64')) {
|
} else if (userAgent.includes('x64') || userAgent.includes('amd64')) {
|
||||||
return 'x86_64';
|
return 'x64';
|
||||||
} else if (userAgent.includes('i386') || userAgent.includes('i686')) {
|
} else if (userAgent.includes('i386') || userAgent.includes('i686')) {
|
||||||
return 'x86';
|
return 'x86';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认返回未知架构
|
// 默认返回未知架构
|
||||||
return 'Unknown';
|
return userAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPlatform(): string {
|
||||||
|
|
||||||
|
// 尝试从 userAgent 中获取平台信息
|
||||||
|
const userAgent = navigator.userAgent.toLowerCase();
|
||||||
|
|
||||||
|
if (userAgent.includes('windows')) {
|
||||||
|
return 'Windows';
|
||||||
|
} else if (userAgent.includes('mac')) {
|
||||||
|
return 'Mac';
|
||||||
|
} else if (userAgent.includes('linux')) {
|
||||||
|
return 'Linux';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Unknown';
|
||||||
|
}
|
||||||
function App(): React.JSX.Element {
|
function App(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { Dialog, Input, Button, Space, Tag, MessagePlugin } from 'tdesign-react'
|
import { Dialog, Input, Button, Space, Tag, MessagePlugin } from 'tdesign-react'
|
||||||
|
import { useTheme } from '../contexts/ThemeContext' // 导入主题上下文
|
||||||
|
|
||||||
interface Tag {
|
interface Tag {
|
||||||
id: number
|
id: number
|
||||||
@@ -25,6 +26,9 @@ export const TagEditorDialog: React.FC<TagEditorDialogProps> = ({
|
|||||||
const [allTags, setAllTags] = useState<Tag[]>([])
|
const [allTags, setAllTags] = useState<Tag[]>([])
|
||||||
const [selectedTagIds, setSelectedTagIds] = useState<Set<number>>(new Set(initialTagIds))
|
const [selectedTagIds, setSelectedTagIds] = useState<Set<number>>(new Set(initialTagIds))
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
const { currentTheme } = useTheme() // 获取当前主题
|
||||||
|
|
||||||
|
const themeMode = currentTheme?.mode || 'light'; // 默认为 light
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -54,8 +58,8 @@ export const TagEditorDialog: React.FC<TagEditorDialogProps> = ({
|
|||||||
const trimmed = inputValue.trim()
|
const trimmed = inputValue.trim()
|
||||||
if (!trimmed) return
|
if (!trimmed) return
|
||||||
|
|
||||||
if (trimmed.length > 50) {
|
if (trimmed.length > 30) {
|
||||||
MessagePlugin.error('标签名称不能超过 50 个字符')
|
MessagePlugin.error('标签名称不能超过 30 个字符')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +179,7 @@ export const TagEditorDialog: React.FC<TagEditorDialogProps> = ({
|
|||||||
<Tag
|
<Tag
|
||||||
key={tag.id}
|
key={tag.id}
|
||||||
theme="primary"
|
theme="primary"
|
||||||
variant="light"
|
variant={themeMode === 'dark' ? 'outline' : 'light'} // 根据主题模式动态设置变体
|
||||||
closable
|
closable
|
||||||
onClose={() => handleToggleTag(tag.id)}
|
onClose={() => handleToggleTag(tag.id)}
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
@@ -202,7 +206,7 @@ export const TagEditorDialog: React.FC<TagEditorDialogProps> = ({
|
|||||||
<Tag
|
<Tag
|
||||||
key={tag.id}
|
key={tag.id}
|
||||||
theme="default"
|
theme="default"
|
||||||
variant="outline"
|
variant={themeMode === 'dark' ? 'light' : 'outline'} // 根据主题模式动态设置变体
|
||||||
closable
|
closable
|
||||||
onClose={() => handleDeleteTag(tag.id)}
|
onClose={() => handleDeleteTag(tag.id)}
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user