mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-24 15:43:24 +08:00
添加新版本提醒
This commit is contained in:
parent
ec529bfca6
commit
a3006af7b8
|
@ -15,7 +15,7 @@ import './index.less';
|
||||||
import vhCheck from 'vh-check';
|
import vhCheck from 'vh-check';
|
||||||
import { version, changeLog } from '../version';
|
import { version, changeLog } from '../version';
|
||||||
import { useCtx, useTheme } from '@/utils/hooks';
|
import { useCtx, useTheme } from '@/utils/hooks';
|
||||||
import { message } from 'antd';
|
import { message, Badge, Typography } from 'antd';
|
||||||
|
|
||||||
export default function (props: any) {
|
export default function (props: any) {
|
||||||
const ctx = useCtx();
|
const ctx = useCtx();
|
||||||
|
@ -32,35 +32,44 @@ export default function (props: any) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSystemInfo = () => {
|
const getSystemInfo = () => {
|
||||||
request.get(`${config.apiPrefix}system`).then(({ code, data }) => {
|
request
|
||||||
if (code === 200) {
|
.get(`${config.apiPrefix}system`)
|
||||||
setSystemInfo(data);
|
.then(({ code, data }) => {
|
||||||
if (!data.isInitialized) {
|
if (code === 200) {
|
||||||
history.push('/initialization');
|
setSystemInfo(data);
|
||||||
setLoading(false);
|
if (!data.isInitialized) {
|
||||||
|
history.push('/initialization');
|
||||||
|
setLoading(false);
|
||||||
|
} else {
|
||||||
|
getUser();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
getUser();
|
message.error(data);
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
message.error(data);
|
.catch((error) => {
|
||||||
}
|
console.log(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUser = (needLoading = true) => {
|
const getUser = (needLoading = true) => {
|
||||||
needLoading && setLoading(true);
|
needLoading && setLoading(true);
|
||||||
request.get(`${config.apiPrefix}user`).then(({ code, data }) => {
|
request
|
||||||
if (code === 200 && data.username) {
|
.get(`${config.apiPrefix}user`)
|
||||||
setUser(data);
|
.then(({ code, data }) => {
|
||||||
localStorage.setItem('isLogin', 'true');
|
if (code === 200 && data.username) {
|
||||||
if (props.location.pathname === '/') {
|
setUser(data);
|
||||||
history.push('/crontab');
|
if (props.location.pathname === '/') {
|
||||||
|
history.push('/crontab');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message.error(data);
|
||||||
}
|
}
|
||||||
} else {
|
needLoading && setLoading(false);
|
||||||
message.error(data);
|
})
|
||||||
}
|
.catch((error) => {
|
||||||
needLoading && setLoading(false);
|
console.log(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const reloadUser = () => {
|
const reloadUser = () => {
|
||||||
|
@ -135,19 +144,43 @@ export default function (props: any) {
|
||||||
title={
|
title={
|
||||||
<>
|
<>
|
||||||
控制面板
|
控制面板
|
||||||
<a href={changeLog} target="_blank" rel="noopener noreferrer">
|
<span
|
||||||
<span
|
onClick={() => {
|
||||||
|
alert('yes');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Badge
|
||||||
|
count={'new'}
|
||||||
|
size="small"
|
||||||
|
offset={[15, 0]}
|
||||||
style={{
|
style={{
|
||||||
fontSize: isFirefox ? 9 : 12,
|
fontSize: isFirefox ? 9 : 12,
|
||||||
color: '#666',
|
|
||||||
marginLeft: 2,
|
|
||||||
zoom: isSafari ? 0.66 : 0.8,
|
zoom: isSafari ? 0.66 : 0.8,
|
||||||
letterSpacing: isQQBrowser ? -2 : 0,
|
padding: '0 5px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{version}
|
<a
|
||||||
</span>
|
href={changeLog}
|
||||||
</a>
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
fontSize: isFirefox ? 9 : 12,
|
||||||
|
color: '#666',
|
||||||
|
marginLeft: 2,
|
||||||
|
zoom: isSafari ? 0.66 : 0.8,
|
||||||
|
letterSpacing: isQQBrowser ? -2 : 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{version}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</Badge>
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
menuItemRender={(menuItemProps: any, defaultDom: any) => {
|
menuItemRender={(menuItemProps: any, defaultDom: any) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user