mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 11:49:02 +08:00
fix: 手机端首页隐藏搜索小键盘及相关设置
This commit is contained in:
@@ -113,6 +113,7 @@ export const Home: React.FC<HomeProps> = ({
|
|||||||
const [showPinyinKeyboard, setShowPinyinKeyboard] = useState(false)
|
const [showPinyinKeyboard, setShowPinyinKeyboard] = useState(false)
|
||||||
const [searchKeyboardLayout, setSearchKeyboardLayout] = useState<SearchKeyboardLayout>("qwerty26")
|
const [searchKeyboardLayout, setSearchKeyboardLayout] = useState<SearchKeyboardLayout>("qwerty26")
|
||||||
const [disableSearchKeyboard, setDisableSearchKeyboard] = useState(false)
|
const [disableSearchKeyboard, setDisableSearchKeyboard] = useState(false)
|
||||||
|
const canShowSearchKeyboard = !isMobile && !disableSearchKeyboard
|
||||||
|
|
||||||
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
||||||
const groupRefs = useRef<Record<string, HTMLDivElement | null>>({})
|
const groupRefs = useRef<Record<string, HTMLDivElement | null>>({})
|
||||||
@@ -301,10 +302,10 @@ export const Home: React.FC<HomeProps> = ({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (disableSearchKeyboard && showPinyinKeyboard) {
|
if (!canShowSearchKeyboard && showPinyinKeyboard) {
|
||||||
setShowPinyinKeyboard(false)
|
setShowPinyinKeyboard(false)
|
||||||
}
|
}
|
||||||
}, [disableSearchKeyboard, showPinyinKeyboard])
|
}, [canShowSearchKeyboard, showPinyinKeyboard])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onDocumentClick = (e: MouseEvent) => {
|
const onDocumentClick = (e: MouseEvent) => {
|
||||||
@@ -2269,10 +2270,10 @@ export const Home: React.FC<HomeProps> = ({
|
|||||||
value={searchKeyword}
|
value={searchKeyword}
|
||||||
onChange={(e) => setSearchKeyword(e.target.value)}
|
onChange={(e) => setSearchKeyword(e.target.value)}
|
||||||
onFocus={() => {
|
onFocus={() => {
|
||||||
if (!disableSearchKeyboard) setShowPinyinKeyboard(true)
|
if (canShowSearchKeyboard) setShowPinyinKeyboard(true)
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!disableSearchKeyboard) setShowPinyinKeyboard(true)
|
if (canShowSearchKeyboard) setShowPinyinKeyboard(true)
|
||||||
}}
|
}}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Escape") setShowPinyinKeyboard(false)
|
if (e.key === "Escape") setShowPinyinKeyboard(false)
|
||||||
@@ -2282,7 +2283,7 @@ export const Home: React.FC<HomeProps> = ({
|
|||||||
allowClear
|
allowClear
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
/>
|
/>
|
||||||
{!disableSearchKeyboard && showPinyinKeyboard && (
|
{canShowSearchKeyboard && showPinyinKeyboard && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
@@ -2545,10 +2546,10 @@ export const Home: React.FC<HomeProps> = ({
|
|||||||
value={searchKeyword}
|
value={searchKeyword}
|
||||||
onChange={(e) => setSearchKeyword(e.target.value)}
|
onChange={(e) => setSearchKeyword(e.target.value)}
|
||||||
onFocus={() => {
|
onFocus={() => {
|
||||||
if (!disableSearchKeyboard) setShowPinyinKeyboard(true)
|
if (canShowSearchKeyboard) setShowPinyinKeyboard(true)
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!disableSearchKeyboard) setShowPinyinKeyboard(true)
|
if (canShowSearchKeyboard) setShowPinyinKeyboard(true)
|
||||||
}}
|
}}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Escape") setShowPinyinKeyboard(false)
|
if (e.key === "Escape") setShowPinyinKeyboard(false)
|
||||||
@@ -2606,7 +2607,7 @@ export const Home: React.FC<HomeProps> = ({
|
|||||||
{rewardMode ? t("rewardExchange.exitMode") : t("rewardExchange.enterMode")}
|
{rewardMode ? t("rewardExchange.exitMode") : t("rewardExchange.enterMode")}
|
||||||
</Button>
|
</Button>
|
||||||
<div style={{ flexShrink: 0 }}>{batchToolbar}</div>
|
<div style={{ flexShrink: 0 }}>{batchToolbar}</div>
|
||||||
{!disableSearchKeyboard && showPinyinKeyboard && (
|
{canShowSearchKeyboard && showPinyinKeyboard && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
|
|||||||
@@ -655,6 +655,8 @@ export const Settings: React.FC<{
|
|||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<Form layout="horizontal" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
<Form layout="horizontal" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
||||||
|
{!isMobile && (
|
||||||
|
<>
|
||||||
<Form.Item label={t("settings.searchKeyboard.title")}>
|
<Form.Item label={t("settings.searchKeyboard.title")}>
|
||||||
<Select
|
<Select
|
||||||
value={settings.search_keyboard_layout || "qwerty26"}
|
value={settings.search_keyboard_layout || "qwerty26"}
|
||||||
@@ -707,6 +709,8 @@ export const Settings: React.FC<{
|
|||||||
{t("settings.searchKeyboard.disableHint")}
|
{t("settings.searchKeyboard.disableHint")}
|
||||||
</div>
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<Form.Item label={t("settings.interfaceZoom")}>
|
<Form.Item label={t("settings.interfaceZoom")}>
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
Reference in New Issue
Block a user