mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-06-19 05:45:06 +08:00
🎨 为网页控制台设置项添加详情说明
This commit is contained in:
parent
3afc5074e0
commit
b37701418e
@ -52,7 +52,12 @@ def get_service(body: List[Dict]):
|
|||||||
|
|
||||||
|
|
||||||
def get_input_number(
|
def get_input_number(
|
||||||
label: str, name: str, value: int, max_value: Optional[int] = None
|
label: str,
|
||||||
|
name: str,
|
||||||
|
value: int,
|
||||||
|
max_value: Optional[int] = None,
|
||||||
|
hint_title: Optional[str] = None,
|
||||||
|
hint_body: Optional[str] = None,
|
||||||
):
|
):
|
||||||
data = {
|
data = {
|
||||||
'type': 'input-number',
|
'type': 'input-number',
|
||||||
@ -65,6 +70,9 @@ def get_input_number(
|
|||||||
}
|
}
|
||||||
if max_value is not None:
|
if max_value is not None:
|
||||||
data['max'] = max_value
|
data['max'] = max_value
|
||||||
|
if hint_title is not None and hint_body is not None:
|
||||||
|
data['labelRemark'] = get_remark(hint_title, hint_body)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
@ -120,8 +128,14 @@ def get_button(title: str, api: Optional[Dict] = None):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def get_switch_panel(label: str, name: str, value: bool):
|
def get_switch_panel(
|
||||||
return {
|
label: str,
|
||||||
|
name: str,
|
||||||
|
value: bool,
|
||||||
|
hint_title: Optional[str] = None,
|
||||||
|
hint_body: Optional[str] = None,
|
||||||
|
):
|
||||||
|
data = {
|
||||||
'type': 'switch',
|
'type': 'switch',
|
||||||
'label': label,
|
'label': label,
|
||||||
'option': '',
|
'option': '',
|
||||||
@ -132,9 +146,20 @@ def get_switch_panel(label: str, name: str, value: bool):
|
|||||||
'value': value,
|
'value': value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hint_title is not None and hint_body is not None:
|
||||||
|
data['labelRemark'] = get_remark(hint_title, hint_body)
|
||||||
|
|
||||||
def get_text_panel(label: str, name: str, value: str):
|
return data
|
||||||
return {
|
|
||||||
|
|
||||||
|
def get_text_panel(
|
||||||
|
label: str,
|
||||||
|
name: str,
|
||||||
|
value: str,
|
||||||
|
hint_title: Optional[str] = None,
|
||||||
|
hint_body: Optional[str] = None,
|
||||||
|
):
|
||||||
|
data: dict = {
|
||||||
'type': 'input-text',
|
'type': 'input-text',
|
||||||
'label': label,
|
'label': label,
|
||||||
'name': name,
|
'name': name,
|
||||||
@ -142,6 +167,22 @@ def get_text_panel(label: str, name: str, value: str):
|
|||||||
'value': value,
|
'value': value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hint_title is not None and hint_body is not None:
|
||||||
|
data['labelRemark'] = get_remark(hint_title, hint_body)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def get_remark(title: str, body: str):
|
||||||
|
return {
|
||||||
|
"icon": "fa fa-question-circle",
|
||||||
|
"trigger": ["hover"],
|
||||||
|
"className": "Remark--warning",
|
||||||
|
"placement": "top",
|
||||||
|
"title": title,
|
||||||
|
"content": body,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_alert(
|
def get_alert(
|
||||||
message: str,
|
message: str,
|
||||||
@ -157,8 +198,15 @@ def get_alert(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_select_panel(label: str, name: str, value: str, options: List[str]):
|
def get_select_panel(
|
||||||
return {
|
label: str,
|
||||||
|
name: str,
|
||||||
|
value: str,
|
||||||
|
options: List[str],
|
||||||
|
hint_title: Optional[str] = None,
|
||||||
|
hint_body: Optional[str] = None,
|
||||||
|
):
|
||||||
|
data = {
|
||||||
'type': 'input-text',
|
'type': 'input-text',
|
||||||
'label': label,
|
'label': label,
|
||||||
'name': name,
|
'name': name,
|
||||||
@ -166,9 +214,19 @@ def get_select_panel(label: str, name: str, value: str, options: List[str]):
|
|||||||
'id': 'u:8050095a7c1d',
|
'id': 'u:8050095a7c1d',
|
||||||
'value': value,
|
'value': value,
|
||||||
}
|
}
|
||||||
|
if hint_title is not None and hint_body is not None:
|
||||||
|
data['labelRemark'] = get_remark(hint_title, hint_body)
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
def get_input_tag(label: str, name: str, value: List[str], options: List[str]):
|
def get_input_tag(
|
||||||
|
label: str,
|
||||||
|
name: str,
|
||||||
|
value: List[str],
|
||||||
|
options: List[str],
|
||||||
|
hint_title: Optional[str] = None,
|
||||||
|
hint_body: Optional[str] = None,
|
||||||
|
):
|
||||||
values = []
|
values = []
|
||||||
for i in value:
|
for i in value:
|
||||||
if isinstance(i, int):
|
if isinstance(i, int):
|
||||||
@ -176,7 +234,7 @@ def get_input_tag(label: str, name: str, value: List[str], options: List[str]):
|
|||||||
else:
|
else:
|
||||||
_data = i
|
_data = i
|
||||||
values.append(_data)
|
values.append(_data)
|
||||||
return {
|
data = {
|
||||||
'type': 'input-tag',
|
'type': 'input-tag',
|
||||||
'label': label,
|
'label': label,
|
||||||
'name': name,
|
'name': name,
|
||||||
@ -186,6 +244,10 @@ def get_input_tag(label: str, name: str, value: List[str], options: List[str]):
|
|||||||
'autoFill': {},
|
'autoFill': {},
|
||||||
'value': ','.join(values),
|
'value': ','.join(values),
|
||||||
}
|
}
|
||||||
|
if hint_title is not None and hint_body is not None:
|
||||||
|
data['labelRemark'] = get_remark(hint_title, hint_body)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
def get_divider():
|
def get_divider():
|
||||||
|
@ -82,27 +82,60 @@ def get_config_page():
|
|||||||
if isinstance(gsc, GsStrConfig):
|
if isinstance(gsc, GsStrConfig):
|
||||||
if gsc.options:
|
if gsc.options:
|
||||||
_data = get_select_panel(
|
_data = get_select_panel(
|
||||||
gsc.title, config, gsc.data, gsc.options
|
gsc.title,
|
||||||
|
config,
|
||||||
|
gsc.data,
|
||||||
|
gsc.options,
|
||||||
|
gsc.title,
|
||||||
|
gsc.desc,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
_data = get_text_panel(gsc.title, config, gsc.data)
|
_data = get_text_panel(
|
||||||
|
gsc.title,
|
||||||
|
config,
|
||||||
|
gsc.data,
|
||||||
|
gsc.title,
|
||||||
|
gsc.desc,
|
||||||
|
)
|
||||||
solo_body.append(_data)
|
solo_body.append(_data)
|
||||||
elif isinstance(gsc, GsIntConfig):
|
elif isinstance(gsc, GsIntConfig):
|
||||||
solo_body.append(
|
solo_body.append(
|
||||||
get_input_number(
|
get_input_number(
|
||||||
gsc.title, config, gsc.data, gsc.max_value
|
gsc.title,
|
||||||
|
config,
|
||||||
|
gsc.data,
|
||||||
|
gsc.max_value,
|
||||||
|
gsc.title,
|
||||||
|
gsc.desc,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif isinstance(gsc, GsBoolConfig):
|
elif isinstance(gsc, GsBoolConfig):
|
||||||
solo_body.append(get_switch_panel(gsc.title, config, gsc.data))
|
solo_body.append(
|
||||||
|
get_switch_panel(
|
||||||
|
gsc.title,
|
||||||
|
config,
|
||||||
|
gsc.data,
|
||||||
|
gsc.title,
|
||||||
|
gsc.desc,
|
||||||
|
)
|
||||||
|
)
|
||||||
elif isinstance(gsc, GsListStrConfig):
|
elif isinstance(gsc, GsListStrConfig):
|
||||||
if not gsc.options:
|
if not gsc.options:
|
||||||
_data = get_text_panel(
|
_data = get_text_panel(
|
||||||
gsc.title, config, ':'.join(gsc.data)
|
gsc.title,
|
||||||
|
config,
|
||||||
|
':'.join(gsc.data),
|
||||||
|
gsc.title,
|
||||||
|
gsc.desc,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
_data = get_input_tag(
|
_data = get_input_tag(
|
||||||
gsc.title, config, gsc.data, gsc.options
|
gsc.title,
|
||||||
|
config,
|
||||||
|
gsc.data,
|
||||||
|
gsc.options,
|
||||||
|
gsc.title,
|
||||||
|
gsc.desc,
|
||||||
)
|
)
|
||||||
solo_body.append(_data)
|
solo_body.append(_data)
|
||||||
elif isinstance(gsc, GsImageConfig):
|
elif isinstance(gsc, GsImageConfig):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user