调整了template中的内容

This commit is contained in:
Xu Chang 2025-04-12 18:00:01 +08:00
parent 1d4c5af807
commit 7d465f87c3
46 changed files with 338 additions and 71 deletions

View File

@ -27,12 +27,6 @@ export async function renameProject(dir: string, name: string, title: string, pl
const newHtmlContent = htmlContent.replace(new RegExp(placeholderTitle, 'g'), title).replace(new RegExp(placeholderTitle.toLowerCase(), 'g'), title.toLowerCase());
writeFileSync(htmlFilePath, newHtmlContent, 'utf-8');
// index.tsx下的title
const indexTsxPath = join(dir, 'web', 'src/index.tsx');
const tsxContent = readFileSync(indexTsxPath, 'utf-8');
const newTsxlContent = tsxContent.replace(new RegExp(placeholderName, 'g'), name).replace(new RegExp(placeholderName.toLowerCase(), 'g'), name.toLowerCase());
writeFileSync(indexTsxPath, newTsxlContent, 'utf-8');
// replace wechatMp下project.config.json中的projectname
// todo现在这个是在wechatMp/src目录下的可能是搞错了待修正
const pcjFilePath = join(dir, 'wechatMp', 'src', 'project.config.json');

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
export default OakComponent({});

View File

@ -0,0 +1 @@
edit components/login/index.xml

View File

@ -0,0 +1,6 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,6 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,13 @@
import React from 'react';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '@project/oak-app-domain';
import Styles from './web.pc.module.less';
export default function render(props: WebComponentProps<EntityDict, 'user', false>) {
const { t, navigateTo } = props.methods;
return (
<div className={Styles.container}>
edit src/components/login/web.pc.tsx
</div>
);
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import { ErrorBlock, Space } from 'antd-mobile';
import Styles from './web.module.less';
export default function render() {
return (
<div className={Styles.container}>
edit src/components/login/web.tsx
</div>
);
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
export default OakComponent({});

View File

@ -0,0 +1,5 @@
{
"notFound": "页面不存在",
"desc": "本页面路由并不存在,请合法访问",
"back": "回首页"
}

View File

@ -0,0 +1,6 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,6 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,13 @@
import React from 'react';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '@project/oak-app-domain';
import Styles from './web.pc.module.less';
export default function render(props: WebComponentProps<EntityDict, 'user', false>) {
const { t, navigateTo } = props.methods;
return (
<div className={Styles.container}>
edit src/pages/home/web.pc.tsx
</div>
);
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import { ErrorBlock, Space } from 'antd-mobile';
import Styles from './web.module.less';
export default function render() {
return (
<div className={Styles.container}>
edit src/pages/home/web.tsx
</div>
);
}

View File

@ -0,0 +1,6 @@
{
"enablePullDownRefresh": false,
"usingComponents": {
"login": "@project/components/login/index"
}
}

View File

@ -0,0 +1,7 @@
.container {
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,2 @@
export default OakComponent({
});

View File

@ -0,0 +1,3 @@
<login
oakPath="$$login"
/>

View File

@ -0,0 +1,3 @@
{
"pageTitle": "登录"
}

View File

@ -0,0 +1,7 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}

View File

@ -0,0 +1,7 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 22px;
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import Login from '@project/components/login';
import Styles from './pc.module.less';
export default function Render() {
return (
<div className={Styles.container}>
<Login />
</div>
)
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import Login from '@project/components/login';
import Styles from './pc.module.less';
export default function Render() {
return (
<div className={Styles.container}>
<Login />
</div>
)
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
export default OakComponent({});

View File

@ -0,0 +1,5 @@
{
"notFound": "页面不存在",
"desc": "本页面路由并不存在,请合法访问",
"back": "回首页"
}

View File

@ -0,0 +1,6 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,6 @@
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -0,0 +1,28 @@
import React from 'react';
import { Button, Result } from 'antd';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '@project/oak-app-domain';
import Styles from './web.pc.module.less';
export default function render(props: WebComponentProps<EntityDict, 'user', false>) {
const { t, navigateTo } = props.methods;
return (
<div className={Styles.container}>
<Result
status="404"
title={t('notFound')}
subTitle={t('desc')}
extra={
<Button
type="primary"
onClick={() => navigateTo({
url: '/',
})}
>
{t('back')}
</Button>
}
/>
</div>
);
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import { ErrorBlock, Space } from 'antd-mobile';
import Styles from './web.module.less';
export default function render() {
return (
<div className={Styles.container}>
<ErrorBlock status='empty' />
</div>
);
}

View File

@ -29,18 +29,15 @@ export default function render() {
className={Styles.logo}
onClick={() => {
features.navigator.namespace = "";
features.navigator.navigateTo({
url: "/home",
});
features.navigator.navigateTo(
{
url: "/",
},
undefined,
true
);
}}
>
{/* <img
src={
require("../../../../assets/logos/whistler.svg")
.default
}
className={Styles.img}
/> */}
<div className={Styles.name}>
{features.locales.t('common::name')}
</div>
@ -72,27 +69,27 @@ export default function render() {
</Button>
<ConsoleAvatar />
</div>
<Modal
open={open}
onCancel={() => setOpen(false)}
destroyOnClose={true}
footer={
<Button
type='primary'
onClick={() => setOpen(false)}
>
{features.locales.t('close')}
</Button>
}
closeIcon={null}
>
<ConsoleSwitch
oakPath="$consoleSwitch"
onClose={() => {
setOpen(false)
}}
/>
</Modal>
<Modal
open={open}
onCancel={() => setOpen(false)}
destroyOnClose={true}
footer={
<Button
type='primary'
onClick={() => setOpen(false)}
>
{features.locales.t('close')}
</Button>
}
closeIcon={null}
>
<ConsoleSwitch
oakPath="$consoleSwitch"
onClose={() => {
setOpen(false)
}}
/>
</Modal>
</div>
);
}

View File

@ -5,7 +5,6 @@
flex-direction: row;
align-items: center;
.logo {
width: 160px;
display: flex;
cursor: pointer;
align-items: center;

View File

@ -1,22 +1,18 @@
import React from 'react';
import { Layout } from 'antd';
import Style from './index.module.less';
import useFeatures from '@project/hooks/useFeatures';
const { Footer } = Layout;
export default function Render() {
const features = useFeatures();
return (
<Footer className={Style.footer}>
<div className={Style.panel}>
<span>
Copyright © {new Date().getFullYear()}{' '}
{features.locales.t('copyright')}
</span>
</div>
</Footer>
<div className={Style.panel}>
<span>
Copyright © {new Date().getFullYear()}{' '}
{features.locales.t('copyright')}
</span>
</div>
);
}

View File

@ -1,11 +1,4 @@
export default OakComponent({
isList: false,
formData({ features }) {
return {
loggedIn: '',
avatar: '',
modeTitle: '控制台',
};
},
features: ['console'],
})

View File

@ -1 +1,3 @@
{"name":"Oak模板项目", "close": "关闭","modeUnset": "取消设置"}
{
"console": "控制台"
}

View File

@ -9,7 +9,10 @@
.home {
font-size: 22px;
font-weight: bold;
font-weight: bolder;
color: var(--oak-color-primary);
margin-left: 15px;
font-family: 中文黑体;
}
.right{

View File

@ -16,10 +16,7 @@ export default function Render(props: WebComponentProps<
modeTitle?: string;
}
>) {
const { modeTitle, avatar } = props.data;
const { t, navigateTo } = props.methods;
const location = useLocation();
const [open, setOpen] = useState(false);
return (
<Row className={Styles.header}>
@ -31,26 +28,27 @@ export default function Render(props: WebComponentProps<
{
url: '/',
},
undefined,
true
);
}}
>
<div className={Styles.home}>
{t('name')}
{t('common::name')}
</div>
</Button>
<div className={Styles.right}>
<Button
icon={<DownOutlined />}
type="text"
onClick={() => {
setOpen(true);
}}
style={{
marginRight: 8,
navigateTo(
{
url: '/console',
},
undefined,
true
);
}}
>
{modeTitle || t('modeUnset')}
{t('console')}
</Button>
</div>
</Row>

View File

@ -1,4 +1,5 @@
{
"path": "/",
"first": "/"
"first": "/home",
"notFound": "/result/notFound"
}

View File

@ -0,0 +1 @@
export default OakComponent({});

View File

@ -0,0 +1,3 @@
{
"console": "控制台"
}

View File

@ -0,0 +1,14 @@
.container {
height: 100%;
display: flex;
flex-direction: column;
.content {
flex: 1;
}
.footer {
padding: 22px;
background-color: var(--oak-bg-color-component);
}
}

View File

@ -0,0 +1,22 @@
.container {
height: 100%;
.header {
background-color: var(--oak-bg-color-container);
padding: 0;
}
.content {
background-color: var(--oak-bg-color-page);
padding: 2px 140px;
.page {
background-color: var(--oak-bg-color-container);
height: 100%;
}
}
.footer {
background-color: var(--oak-bg-color-container);
}
}

View File

@ -0,0 +1,27 @@
import React from 'react';
import { Flex, Layout } from 'antd';
import Styles from './web.pc.module.less';
const { Header, Footer, Content } = Layout;
import { Outlet, Route } from 'react-router-dom';
import FrontHeader from '../../components/header';
import FrontFooter from '../../components/footer';
export default function render() {
return (
<Layout className={Styles.container}>
<Header className={Styles.header}>
<FrontHeader />
</Header>
<Content className={Styles.content}>
<div className={Styles.page}>
<Outlet />
</div>
</Content>
<Footer className={Styles.footer}>
<FrontFooter />
</Footer>
</Layout>
);
}

View File

@ -0,0 +1,20 @@
import React from 'react';
import { Outlet, Route } from 'react-router-dom';
import FrontHeader from '../../components/header';
import FrontFooter from '../../components/footer';
import Styles from './web.module.less';
export default function render() {
return (
<div className={Styles.container}>
<FrontHeader />
<div className={Styles.content}>
<Outlet />
</div>
<div className={Styles.footer}>
<FrontFooter />
</div>
</div>
);
}

View File

@ -34,7 +34,7 @@ const init = async () => {
error = err;
}
initialize<EntityDict>(features, 'oak_template', routers, undefined, error);
initialize<EntityDict>(features, 'bm-smart', routers, undefined, error);
};
init();