Skip to content

Commit

Permalink
# fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vapao committed Nov 15, 2023
1 parent 51da1cc commit 46ead28
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 49 deletions.
2 changes: 1 addition & 1 deletion spug_api/apps/alarm/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get(self, request):
if error is None:
response = []
if form.with_push or form.only_push:
push_key = AppSetting.get('spug_push_key')
push_key = AppSetting.get_default('spug_push_key')
if push_key:
response = get_contacts(push_key)
if form.only_push:
Expand Down
7 changes: 6 additions & 1 deletion spug_web/src/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import React from 'react'

function Link(props) {
return (
<a target="_blank" rel="noopener noreferrer" href={props.href}>{props.title}</a>
<a
target="_blank"
rel="noopener noreferrer"
href={props.href}
className={props.className}>
{props.title}</a>
)
}

Expand Down
7 changes: 4 additions & 3 deletions spug_web/src/pages/system/account/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ export default observer(function () {
</Form.Item>
<Form.Item
name="wx_token"
label="推送标识"
label="MFA标识"
extra={(
<span>
如果启用了MFA(两步验证)则该项为必填。
<a target="_blank" rel="noopener noreferrer" href="https://spug.cc/docs/wx-token/">什么是微信Token</a>
<a target="_blank" rel="noopener noreferrer" href="https://push.spug.cc/guide/spug">如何获取MFA标识</a>
</span>)}>
<Select showSearch filterOption={(i, o) => includes(o.children, i)} placeholder="请选择绑定推送标识">
<Select showSearch allowClear filterOption={(i, o) => includes(o.children, i)}
placeholder="请选择绑定推送标识">
{contacts.map(item => (
<Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>
))}
Expand Down
67 changes: 34 additions & 33 deletions spug_web/src/pages/system/setting/PushSetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export default observer(function () {
const isVip = balance.is_vip
const spugPushKey = store.settings.spug_push_key
return (
<React.Fragment>
<Spin spinning={fetching}>
<div className={css.title}>推送服务设置</div>
<div style={{maxWidth: 340}}>
<Form.Item label="推送助手账户绑定" labelCol={{span: 24}} style={{marginTop: 12}}
extra={<div>请登录 <Link href="https://push.spug.cc/login" title="推送助手"/>,至个人中心 /
extra={<div>请登录 <Link href="https://push.spug.cc/user/info" title="推送助手"/>,至个人中心 /
个人设置查看用户ID,注意保密该ID请勿泄漏给第三方。</div>}>

{spugPushKey ? (
Expand Down Expand Up @@ -93,44 +93,45 @@ export default observer(function () {
</Form.Item>
</div>

{spugPushKey ? (
{balance.vip_desc ? (
<Form.Item style={{marginTop: 24}}
extra={<div> 如需充值请至 <Link href="https://push.spug.cc/buy/sms" title="推送助手"/>,具体计费规则及说明请查看推送助手官网。
</div>}>
<div className={css.statistic}>
<Spin spinning={fetching}>
<div className={css.body}>
<div className={css.item}>
<div className={css.title}>短信余额</div>
<div className={css.value}>{balance.sms_balance}</div>
</div>
<div className={css.item}>
<div className={css.title}>语音余额</div>
<div className={css.value}>{balance.voice_balance}</div>
</div>
<div className={css.item}>
<div className={css.title}>邮件余额</div>
<div className={css.value}>{balance.mail_balance}</div>
{isVip ? (
<div className={clsNames(css.tips, css.active)}>+ 会员免费20封 / 天</div>
) : (
<div className={css.tips}>会员免费20封 / 天</div>
)}
</div>
<div className={css.item}>
<div className={css.title}>微信公众号余额</div>
<div className={css.value}>{balance.wx_mp_balance}</div>
{isVip ? (
<div className={clsNames(css.tips, css.active)}>+ 会员免费100条 / 天</div>
) : (
<div className={css.tips}>会员免费20封 / 天</div>
)}
</div>
<div className={css.body}>
<div className={css.item}>
<div className={css.title}>短信余额</div>
<div className={css.value}>{balance.sms_balance}</div>
</div>
</Spin>
<div className={css.item}>
<div className={css.title}>语音余额</div>
<div className={css.value}>{balance.voice_balance}</div>
</div>
<div className={css.item}>
<div className={css.title}>邮件余额</div>
<div className={css.value}>{balance.mail_balance}</div>
{isVip ? (
<div className={clsNames(css.tips, css.active)}>+ 会员赠送{balance.mail_free}封 / 天</div>
) : (
<Link href="https://push.spug.cc/buy/vip" title={`订阅会员每天赠送${balance.mail_free}封`}
className={css.tips}/>
)}
</div>
<div className={css.item}>
<div className={css.title}>微信公众号余额</div>
<div className={css.value}>{balance.wx_mp_balance}</div>
{isVip ? (
<div className={clsNames(css.tips, css.active)}>+ 会员赠送{balance.wx_mp_free}条 / 天</div>
) : (
<Link href="https://push.spug.cc/buy/vip" title={`订阅会员每天赠送${balance.wx_mp_free}条`}
className={css.tips}/>
)}
</div>
<Link href="https://push.spug.cc/buy/vip" className={css.badge} title={balance.vip_desc}/>
</div>
</div>
</Form.Item>
) : null}
</React.Fragment>
</Spin>
)
})
4 changes: 2 additions & 2 deletions spug_web/src/pages/system/setting/SecuritySetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export default observer(function () {
label="登录MFA(两步)认证"
style={{marginTop: 24}}
extra={visible ? '输入验证码,通过验证后开启。' :
<span>建议开启,登录时额外使用验证码进行身份验证。开启前至少要确保管理员账户配置了推送标识(账户管理/编辑),开启后未配置的账户将无法登录<a
<span>建议开启,登录时额外使用验证码进行身份验证。开启前至少要确保管理员账户配置了MFA标识(账户管理/编辑),开启后未配置的账户将无法登录<a
target="_blank" rel="noopener noreferrer"
href="https://spug.cc/docs/wx-token/">什么是微信Token?</a></span>}>
href="https://push.spug.cc/guide/spug">配置手册</a></span>}>
{visible ? (
<div style={{display: 'flex', width: 490}}>
<Form.Item noStyle extra="验证通过后开启MFA(两步验证)。">
Expand Down
21 changes: 17 additions & 4 deletions spug_web/src/pages/system/setting/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@
.body {
display: flex;
flex-direction: row;
position: relative;

.badge {
border-radius: 4px;
line-height: 20px;
height: 20px;
font-size: 12px;
padding: 0 8px;
background: #2563fc;
font-weight: bold;
color: #ffffff;
cursor: pointer;
position: absolute;
right: 0;
}

.item {
position: relative;
Expand Down Expand Up @@ -83,13 +98,11 @@
line-height: 20px;
text-align: center;
padding: 0 8px;
cursor: pointer;
}

.active {
cursor: initial;
background: #f7af40;
color: #ffffff;
color: #2563fc;
background: #ffffff;
}
}

Expand Down
3 changes: 0 additions & 3 deletions spug_web/src/pages/welcome/info/Basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ export default observer(function Basic(props) {
<Form.Item required name="nickname" label="昵称">
<Input placeholder="请输入"/>
</Form.Item>
<Form.Item name="wx_token" label="微信Token" extra={<a target="_blank" rel="noopener noreferrer" href="https://spug.cc/docs/wx-token/">什么是微信Token?</a>}>
<Input placeholder="请输入"/>
</Form.Item>
<Form.Item>
<Button type="primary" loading={loading} onClick={handleSubmit}>保存设置</Button>
</Form.Item>
Expand Down
4 changes: 2 additions & 2 deletions spug_web/src/pages/welcome/info/Reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export default function Reset(props) {
<Input.Password value={old_password} placeholder="请输入" onChange={e => setOldPassword(e.target.value)}/>
</Form.Item>
<Form.Item required label="新密码" extra="至少8位包含数字、小写和大写字母。">
<Input.Password value={new_password} placeholder="请输入" onChange={e => setNewPassword(e.target.value)}/>
<Input.Password value={new_password} placeholder="请输入新密码" onChange={e => setNewPassword(e.target.value)}/>
</Form.Item>
<Form.Item required label="再次确认">
<Input.Password value={new2_password} placeholder="请输入" onChange={e => setNew2Password(e.target.value)}/>
<Input.Password value={new2_password} placeholder="请再次输入新密码" onChange={e => setNew2Password(e.target.value)}/>
</Form.Item>
<Form.Item>
<Button type="primary" loading={loading} onClick={handleSubmit}>保存设置</Button>
Expand Down

0 comments on commit 46ead28

Please sign in to comment.