temp
This commit is contained in:
parent
1d3c2b0645
commit
90126beb35
26
src/App.tsx
26
src/App.tsx
@ -9,6 +9,13 @@ import { CodeDescModal } from './modules/CodeDescModal';
|
|||||||
import { query } from './modules/query.ts';
|
import { query } from './modules/query.ts';
|
||||||
import { toastSuccess, toastWeChat } from './modules/RedirectSuccess.tsx';
|
import { toastSuccess, toastWeChat } from './modules/RedirectSuccess.tsx';
|
||||||
import { WeChat } from './components/Icon.tsx';
|
import { WeChat } from './components/Icon.tsx';
|
||||||
|
const getOrigin = () => {
|
||||||
|
let origin = window.location.origin;
|
||||||
|
if (origin.includes('www.kevisual.cn')) {
|
||||||
|
origin = origin.replace('www.kevisual.cn', 'kevisual.cn');
|
||||||
|
}
|
||||||
|
return origin;
|
||||||
|
};
|
||||||
export const Main = () => {
|
export const Main = () => {
|
||||||
const [showPreview, setShowPreview] = useState(false);
|
const [showPreview, setShowPreview] = useState(false);
|
||||||
const [html, setHtml] = useState<string>('');
|
const [html, setHtml] = useState<string>('');
|
||||||
@ -30,10 +37,7 @@ export const Main = () => {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const url = res.data?.url;
|
const url = res.data?.url;
|
||||||
if (url) {
|
if (url) {
|
||||||
let origin = window.location.origin;
|
let origin = getOrigin();
|
||||||
if (origin.includes('www.kevisual.cn')) {
|
|
||||||
origin = origin.replace('www.kevisual.cn', 'kevisual.cn');
|
|
||||||
}
|
|
||||||
const newUrl = new URL(url, origin);
|
const newUrl = new URL(url, origin);
|
||||||
// toast.success('创建成功, 访问地址' + newUrl.toString(), { autoClose: 3000 });
|
// toast.success('创建成功, 访问地址' + newUrl.toString(), { autoClose: 3000 });
|
||||||
toastSuccess(newUrl.toString());
|
toastSuccess(newUrl.toString());
|
||||||
@ -54,10 +58,19 @@ export const Main = () => {
|
|||||||
<img src={Logo} alt='可视化助手 Logo' className='h-10 w-30 ' />
|
<img src={Logo} alt='可视化助手 Logo' className='h-10 w-30 ' />
|
||||||
</div>
|
</div>
|
||||||
<div className='hidden md:flex space-x-6'>
|
<div className='hidden md:flex space-x-6'>
|
||||||
<a href='#features' className='hover:text-gray-400'>
|
<a
|
||||||
|
className='hover:text-gray-400 cursor-pointer'
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const url = new URL('/root/center/', getOrigin());
|
||||||
|
window.open(url.toString(), '_blank');
|
||||||
|
}}>
|
||||||
|
管理中心
|
||||||
|
</a>
|
||||||
|
<a href='#features' className='hover:text-gray-400 cursor-pointer'>
|
||||||
功能
|
功能
|
||||||
</a>
|
</a>
|
||||||
<a href='#contact' className='hover:text-gray-400'>
|
<a href='#contact' className='hover:text-gray-400 cursor-pointer'>
|
||||||
联系方式
|
联系方式
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -106,6 +119,7 @@ export const Main = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<footer className='h-12'>
|
<footer className='h-12'>
|
||||||
|
{!resultUrl && <div className='flex items-center h-full text-gray-500 px-2 italic'>粘贴您的 HTML 内容到编辑器中,点击“创建”按钮生成链接。</div>}
|
||||||
{resultUrl && (
|
{resultUrl && (
|
||||||
<div className='flex items-center gap-2 px-4 h-full bg-white border-t border-t-gray-200'>
|
<div className='flex items-center gap-2 px-4 h-full bg-white border-t border-t-gray-200'>
|
||||||
<span className='text-gray-700'>生成的链接:</span>
|
<span className='text-gray-700'>生成的链接:</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user