diff --git a/app/app.config.ts b/app/app.config.ts index 15c683b..0e1fc0b 100644 --- a/app/app.config.ts +++ b/app/app.config.ts @@ -6,6 +6,7 @@ export default defineAppConfig({ backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', - navigationBarTextStyle: 'black' + navigationBarTextStyle: 'black', + navigationStyle: 'custom', } }) diff --git a/app/components/layout/Layout.tsx b/app/components/layout/Layout.tsx new file mode 100644 index 0000000..5d0f659 --- /dev/null +++ b/app/components/layout/Layout.tsx @@ -0,0 +1,38 @@ +import { View, Text } from "@tarojs/components" +import { FC, memo, PropsWithChildren } from "react" + + +const PageLoader = memo(() => { + return ( + + Loading... + + ) +}) + +interface LayoutProps { + loadding?: boolean +} + +interface LayoutComponent extends FC> { + Header: FC, + Footer: FC, + Container: FC, +} + +const LayoutBase = ({ children, loadding = true }: PropsWithChildren) => { + if (loadding){ + return ( + + ); + } + return ( + + {children} + + ) +} + +const Layout = LayoutBase as unknown as LayoutComponent + +export default Layout; \ No newline at end of file diff --git a/app/components/layout/index.ts b/app/components/layout/index.ts new file mode 100644 index 0000000..a82a819 --- /dev/null +++ b/app/components/layout/index.ts @@ -0,0 +1,2 @@ + +export * from './Layout'; \ No newline at end of file diff --git a/app/pages/index/index.config.ts b/app/pages/index/index.config.ts index 12abc5f..8f24860 100644 --- a/app/pages/index/index.config.ts +++ b/app/pages/index/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '首页' + navigationBarTitleText: '首页', + disableScroll: true, }) diff --git a/app/pages/index/index.tsx b/app/pages/index/index.tsx index 3a02239..7bf43f4 100644 --- a/app/pages/index/index.tsx +++ b/app/pages/index/index.tsx @@ -1,3 +1,4 @@ +import Layout from '@/components/layout/Layout' import { View, Text } from '@tarojs/components' import { useLoad } from '@tarojs/taro' @@ -7,10 +8,10 @@ export default function Index () { }) return ( - - - Hello world! - - + + + Hello world! + + ) } diff --git a/mock/index.ts b/mock/index.ts index 14cd20f..b50efae 100644 --- a/mock/index.ts +++ b/mock/index.ts @@ -1,25 +1,35 @@ -import Mock from 'mockjs' - +import Mock from "mockjs"; export default { - "GET /api/hello": (req:any, res:any) => { - const result = Mock.mock({ - "code": 0, - "msg": "success", - "data": { - "name|1": ["张三", "李四", "王五"] - } - }) - return res.send(result); - }, - "GET /api/globalConfig": (req:any, res:any) => { - const result = Mock.mock({ - "code": 0, - "msg": "success", - "data": { - "appId": "123456", - } - }) - return res.send(result); - } -} \ No newline at end of file + "GET /api/hello": (req: any, res: any) => { + const result = Mock.mock({ + code: 0, + msg: "success", + data: { + "name|1": ["张三", "李四", "王五"], + }, + }); + return res.send(result); + }, + "GET /api/globalConfig": (req: any, res: any) => { + const result = Mock.mock({ + code: 0, + msg: "success", + data: { + appId: "123456", + }, + }); + return res.send(result); + }, + // 通过员工身份编码,获取该员工关联企业的页面内容数据,员工身份等 + "GET /api/content": (req: any, res: any) => { + console.log("员工身份编码:", req.query.employeeCode); + // 返回数据类型 + const result = Mock.mock({ + code: 0, + msg: "success", + data: [], + }); + return res.send(result); + }, +}; diff --git a/test/demo.http b/test/demo.http new file mode 100644 index 0000000..2add468 --- /dev/null +++ b/test/demo.http @@ -0,0 +1,8 @@ +@host=http://127.0.0.1:9527 + +### 测试请求接口 +GET {{host}}/api/hello HTTP/1.1 + + +### 通过员工编码获取员工信息及关联企业信息 +GET {{host}}/api/content?employeeCode=31213 HTTP/1.1