diff --git a/web/src/components/ChannelsTable.js b/web/src/components/ChannelsTable.js index 0459619a..072f5b90 100644 --- a/web/src/components/ChannelsTable.js +++ b/web/src/components/ChannelsTable.js @@ -447,8 +447,8 @@ const ChannelsTable = () => { 测试所有已启用通道 - 更新所有已启用通道余额 + {/* 更新所有已启用通道余额 */} { > 复制 - { - manageRedemption(redemption.id, 'delete', idx); - }} + + 删除 + + } + on='click' + flowing + hoverable > - 删除 - + { + manageRedemption(redemption.id, 'delete', idx); + }} + > + 确认删除 + + { @@ -33,6 +33,7 @@ const SystemSetting = () => { let [loading, setLoading] = useState(false); const [EmailDomainWhitelist, setEmailDomainWhitelist] = useState([]); const [restrictedDomainInput, setRestrictedDomainInput] = useState(''); + const [showModal, setShowModal] = useState(false); const getOptions = async () => { const res = await API.get('/api/option/'); @@ -95,6 +96,10 @@ const SystemSetting = () => { }; const handleInputChange = async (e, { name, value }) => { + if (name === 'PasswordLoginEnabled' && inputs[name] === 'true') { + setShowModal(true); + return; // 早些返回,暂时不更新状态 + } if ( name === 'Notice' || name.startsWith('SMTP') || @@ -243,6 +248,32 @@ const SystemSetting = () => { name='PasswordLoginEnabled' onChange={handleInputChange} /> + { + showModal && + setShowModal(false)} + size={'tiny'} + style={{ maxWidth: '450px' }} + > + 提示 + + 取消密码登录将导致未绑定其他登录方式的用户(含Root管理员)无法通过密码登录,确认取消? + + + setShowModal(false)}>取消 + { + setShowModal(false); + await updateOption('PasswordLoginEnabled', 'false'); + }} + > + 确定 + + + + } { + return ; +}; +export default HTMLToastContent; export function isAdmin() { let user = localStorage.getItem('user'); if (!user) return false; @@ -107,8 +112,12 @@ export function showInfo(message) { toast.info(message, showInfoOptions); } -export function showNotice(message) { - toast.info(message, showNoticeOptions); +export function showNotice(message, isHTML = false) { + if (isHTML) { + toast(, showNoticeOptions); + } else { + toast.info(message, showNoticeOptions); + } } export function openPage(url) { diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index 4cfec018..8d25d80c 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { Button, Form, Header, Input, Message, Segment } from 'semantic-ui-react'; -import { useParams } from 'react-router-dom'; +import { useParams, useNavigate } from 'react-router-dom'; import { API, showError, showInfo, showSuccess, verifyJSON } from '../../helpers'; import { CHANNEL_OPTIONS } from '../../constants'; @@ -12,9 +12,14 @@ const MODEL_MAPPING_EXAMPLE = { const EditChannel = () => { const params = useParams(); + const navigate = useNavigate(); const channelId = params.id; const isEdit = channelId !== undefined; const [loading, setLoading] = useState(isEdit); + const handleCancel = () => { + navigate('/channel'); + }; + const originInputs = { name: '', type: 1, @@ -382,6 +387,7 @@ const EditChannel = () => { ) } 提交 + 取消 > diff --git a/web/src/pages/Home/index.js b/web/src/pages/Home/index.js index 20d42104..c9f4d445 100644 --- a/web/src/pages/Home/index.js +++ b/web/src/pages/Home/index.js @@ -14,10 +14,11 @@ const Home = () => { const { success, message, data } = res.data; if (success) { let oldNotice = localStorage.getItem('notice'); - if (data !== oldNotice && data !== '') { - showNotice(data); - localStorage.setItem('notice', data); - } + if (data !== oldNotice && data !== '') { + const htmlNotice = marked(data); + showNotice(htmlNotice, true); + localStorage.setItem('notice', data); + } } else { showError(message); } diff --git a/web/src/pages/Redemption/EditRedemption.js b/web/src/pages/Redemption/EditRedemption.js index df614ab5..7a33f770 100644 --- a/web/src/pages/Redemption/EditRedemption.js +++ b/web/src/pages/Redemption/EditRedemption.js @@ -1,11 +1,12 @@ import React, { useEffect, useState } from 'react'; import { Button, Form, Header, Segment } from 'semantic-ui-react'; -import { useParams } from 'react-router-dom'; +import { useParams, useNavigate } from 'react-router-dom'; import { API, downloadTextAsFile, showError, showSuccess } from '../../helpers'; import { renderQuota, renderQuotaWithPrompt } from '../../helpers/render'; const EditRedemption = () => { const params = useParams(); + const navigate = useNavigate(); const redemptionId = params.id; const isEdit = redemptionId !== undefined; const [loading, setLoading] = useState(isEdit); @@ -17,6 +18,10 @@ const EditRedemption = () => { const [inputs, setInputs] = useState(originInputs); const { name, quota, count } = inputs; + const handleCancel = () => { + navigate('/redemption'); + }; + const handleInputChange = (e, { name, value }) => { setInputs((inputs) => ({ ...inputs, [name]: value })); }; @@ -113,6 +118,7 @@ const EditRedemption = () => { > } 提交 + 取消 >
取消密码登录将导致未绑定其他登录方式的用户(含Root管理员)无法通过密码登录,确认取消?