kn-cli 1.0.47 → 1.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/build/cli.config.js +3 -0
  2. package/build/webpack.config.js +61 -74
  3. package/package.json +1 -1
  4. package/readme.md +10 -0
  5. package/templates/template_admin/cli.config.js +3 -0
  6. package/templates/template_admin/package.json +1 -0
  7. package/templates/template_admin/public/src/components/Auth/index.jsx +1 -1
  8. package/templates/template_admin/public/src/components/TopMenu/index.jsx +1 -1
  9. package/templates/template_admin/public/src/dictionary/index.js +26 -90
  10. package/templates/template_admin/public/src/hooks/index.jsx +4 -2
  11. package/templates/template_admin/public/src/pages/material/index.jsx +74 -3
  12. package/templates/template_admin/public/src/pages/video/index.jsx +56 -3
  13. package/templates/template_admin/public/src/provider/app.jsx +1 -1
  14. package/templates/template_admin/public/src/route.jsx +0 -10
  15. package/templates/template_admin/public/src/services/video.js +33 -0
  16. package/templates/template_app/cli.config.js +3 -0
  17. package/templates/template_app/package.json +1 -0
  18. package/templates/template_app/public/src/_reset.less +1 -1
  19. package/templates/template_app/public/src/dictionary/index.js +26 -90
  20. package/templates/template_app/public/src/hooks/index.jsx +4 -7
  21. package/templates/template_app/public/src/mock/user.js +5 -7
  22. package/templates/template_app/public/src/pages/dictionary/index.jsx +33 -0
  23. package/templates/template_app/public/src/pages/index.jsx +9 -70
  24. package/templates/template_app/public/src/pages/list/index.jsx +88 -0
  25. package/templates/template_app/public/src/pages/list/index.less +22 -0
  26. package/templates/template_app/public/src/pages/login/index.jsx +0 -1
  27. package/templates/template_app/public/src/provider/app.jsx +22 -0
  28. package/templates/template_app/public/src/route.jsx +8 -0
  29. package/templates/template_app/public/src/services/index.js +34 -1
  30. package/templates/template_admin/public/src/hooks/useNextPage.jsx +0 -89
  31. package/templates/template_admin/public/src/pages/checkLogin/index.jsx +0 -13
  32. package/templates/template_admin/public/src/pages/index.jsx +0 -23
  33. package/templates/template_admin/public/src/pages/subHome/index.jsx +0 -12
  34. package/templates/template_admin/public/src/pages/subHome2/index.jsx +0 -12
  35. package/templates/template_admin/public/src/pages/subHome3/index.jsx +0 -12
  36. package/templates/template_app/public/src/hooks/useNextPage.jsx +0 -89
  37. package/templates/template_app/public/src/hooks/useSearch.jsx +0 -137
  38. package/templates/template_app/public/src/hooks/useUpdate.jsx +0 -11
  39. /package/templates/{template_admin/public/src/pages → template_app/public/src/pages/dictionary}/index.less +0 -0
@@ -1,103 +1,39 @@
1
1
 
2
2
  import React, { useState, useEffect,useMemo} from 'react';
3
3
  import {GET_USER_TYPE} from '@/services/user';
4
+ import {useDictionary} from 'kn-hooks';
5
+ import ShowToast from '@/components/Toast';
6
+ export const SelectOption=(props)=>{
7
+ const {value}=props;
8
+ const name = props['data-keyname'];
9
+ const onClick=(e)=>{
10
+ ShowToast(`点击option name=${name},value=${value},label=${props.children}`)
11
+ if(props.onClick)props.onClick();
12
+ }
13
+ return <hgroup onClick={onClick} key={value} name={name} value={value}>{props.children}</hgroup>
14
+ }
4
15
 
5
- const bookCreater=options=>{
6
- const {
7
- service,
8
- idKey='value',
9
- titleKey='label',
10
- keyName='key',
11
- defaultTypes=null
12
- }=options;
13
-
14
- return (props)=>{
15
- const [types,setTypes]=useState(defaultTypes||null);
16
-
17
- const init=async ()=>{
18
- let ret = await service();
19
- if(+ret?.code===0){
20
- setTypes(ret.data||[]);
21
- }
22
- }
23
- useEffect(()=>{
24
- if(defaultTypes)return;
25
- init();
26
- },[]);
27
-
28
- const getData=({id,title,key}={})=>{
29
- let name='';
30
- if(id){
31
- name=idKey
32
- }
33
- else if(title){
34
- name=titleKey
35
- }
36
- else if(key){
37
- name=keyName;
38
- }
39
-
40
- for(let i=0;i<types.length;i++){
41
- if(''+types[i][name]===''+id){
42
- return types[i];
43
- }
44
- }
45
- return null;
46
- }
16
+ useDictionary.SetConfig({SelectOption})
47
17
 
48
- const getTitle=(id)=>{
49
- if(types){
50
- for(let i=0;i<types.length;i++){
51
- if(''+types[i][idKey]===''+id){
52
- return types[i][titleKey];
53
- }
54
- }
55
- }
56
- return '';
57
- }
58
- const getId=(title)=>{
59
- if(types){
60
- for(let i=0;i<types.length;i++){
61
- if(''+types[i][titleKey]===''+title){
62
- return types[i][idKey];
63
- }
64
- }
65
- }
66
- return '';
67
- }
68
18
 
69
- const isReady=()=>{
70
- return types!==null;
71
- }
72
- const reload=()=>{
73
- if(defaultTypes)return;
74
- init();
75
- }
76
- const getList=()=>{
77
- let ret=[]
78
- for(let i=0;i<types.length;i++){
79
- let item = types[i];
80
- ret.push({
81
- label:item[titleKey],
82
- value:item[idKey],
83
- key:item[keyName]
84
- })
85
- }
86
- return ret;
19
+ export const useUserType = useDictionary.createDictionary({
20
+ api:GET_USER_TYPE,
21
+ afterApi:(response)=>{
22
+ if(response?.code==0){
23
+ let req= response.data.map(item=>{
24
+ const {label,value:id,key:name}=item;
25
+ return {label,id,name}
26
+ });
27
+ return req;
87
28
  }
88
-
89
-
90
- return {types,getTitle,getId,isReady,reload,getData,getList}
29
+ return [];
91
30
  }
92
- }
31
+ });
93
32
 
94
- export const useUserType = bookCreater({
95
- service:GET_USER_TYPE,
96
- })
97
- export const useTaskState=bookCreater({
33
+ export const useTaskState= useDictionary.createDictionary({
98
34
  defaultTypes:[
99
- {label:'进行中',value:'1',key:'run'},
100
- {label:'已完成',value:'5',key:'complete'},
35
+ {label:'进行中',id:'1',name:'run'},
36
+ {label:'已完成',id:'5',name:'complete'},
101
37
  ]
102
38
  });
103
39
 
@@ -3,16 +3,13 @@
3
3
  import useImageLoader from './useImageLoader';
4
4
  import useDelay from './useDelay';
5
5
  import usePreload from './usePreload';
6
- import useSearch from './useSearch';
7
- import useUpdate from './useUpdate';
8
- import useNextPage from './useNextPage';
9
6
  import useLoading from './useLoading';
7
+ import {usePagination} from 'kn-hooks';
8
+
10
9
  export {
10
+ usePagination,
11
11
  useImageLoader,
12
12
  useDelay,
13
13
  usePreload,
14
- useSearch,
15
- useUpdate,
16
- useNextPage,
17
- useLoading
14
+ useLoading,
18
15
  }
@@ -33,13 +33,11 @@ async function GET_USER_LIST(req,res){
33
33
  }
34
34
  return {
35
35
  code:0,
36
- data:{
37
- list:data,
38
- page:{
39
- pageNum:current,
40
- pageSize:pageSize,
41
- total:MAX_TOTAL
42
- }
36
+ data:data,
37
+ page:{
38
+ current:current,
39
+ pageSize:pageSize,
40
+ total:MAX_TOTAL
43
41
  }
44
42
  }
45
43
  }
@@ -0,0 +1,33 @@
1
+ import React, { useEffect } from 'react';
2
+ import {List} from 'antd-mobile';
3
+ import {useUserType,useTaskState} from '@/dictionary';
4
+ import styles from './index.less';
5
+ import ProviderApp from '@/provider/app';
6
+
7
+ const Page = () => {
8
+ const providerApp = ProviderApp.useContainer();
9
+
10
+ const emUserType= useUserType();
11
+ const emUseTaskState = useTaskState();
12
+
13
+ useEffect(()=>{
14
+ providerApp.setNav({title:'字典工具'})
15
+ },[])
16
+ return (
17
+ <section id="wall" className={styles.wall}>
18
+ <List header='emUseTaskState'>
19
+ {
20
+ emUseTaskState.isReady()&&emUseTaskState.selectOptions
21
+ }
22
+ </List>
23
+ <List header='emUserType'>
24
+ {
25
+ emUserType.isReady()&&emUserType.selectOptions
26
+ }
27
+ </List>
28
+
29
+ </section>
30
+ )
31
+ }
32
+
33
+ export default Page;
@@ -1,13 +1,11 @@
1
- import React, { useEffect, useState, useRef } from 'react';
2
- import {PullToRefresh ,InfiniteScroll,List} from 'antd-mobile';
3
- import {useNextPage,useLoading} from '@/hooks';
4
- import {GET_USER_LIST} from '@/services/user';
1
+ import React, { useEffect } from 'react';
2
+ import {PullToRefresh ,List} from 'antd-mobile';
3
+ import {useLoading} from '@/hooks';
5
4
  import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
6
5
 
7
6
  import ProviderApp from '@/provider/app';
8
7
  import moment from 'moment';
9
8
  import ShowToast from '@/components/Toast';
10
- import {useUserType} from '@/dictionary';
11
9
  import {AuthShow} from '@/components/Auth';
12
10
 
13
11
  import styles from './index.less';
@@ -17,54 +15,11 @@ const Page = () => {
17
15
  const providerApp = ProviderApp.useContainer();
18
16
  const query = useParams();
19
17
  const [search] = useSearchParams();
20
- const request = useNextPage({
21
- service:GET_USER_LIST,
22
- })
23
- const [list,setList]= useState([]);
24
18
  const loading = useLoading();
25
19
  const loadingCanTouch = useLoading({canTouch:true});
26
-
27
- const emUserType= useUserType();
28
-
29
- useEffect(()=>{
30
- let ret=[];
31
- request?.data?.forEach(page=>{
32
- try{
33
- ret = [...ret,...page];
34
- }catch(ex){
35
- console.error(ex)
36
- debugger;
37
- }
38
- })
39
- setList(ret);
40
-
41
- },[request.data])
42
-
43
-
44
- const onReset= async ()=>{
45
- return request.reset();
46
- }
47
-
48
- const onNextPage= async ()=>{
49
- if(loading.loading>0){
50
- return;
51
- }
52
- loading.setLoading(true)
53
- let dom = document.querySelector('#wall');
54
- dom.scrollTop-=200;
55
- await request.nextPage();
56
- loading.setLoading(false)
57
- return true;
58
- }
59
- const refresh=async ()=>{
60
- loading.setLoading(true)
61
- await request.refresh();
62
- loading.setLoading(false);
63
- }
64
20
  useEffect(()=>{
65
- refresh();
66
- },[]);
67
-
21
+ providerApp.setNav({title:'APP演示'})
22
+ },[])
68
23
  return (
69
24
  <section id="wall" className={styles.wall}>
70
25
  <PullToRefresh className={styles.wrap}
@@ -134,31 +89,15 @@ const Page = () => {
134
89
  loadingCanTouch.setLoading(false);
135
90
  }}>打开全局loading-持续3秒(不阻止交互)</List.Item>
136
91
  </List>
137
-
138
- <List header='字典'>
139
- {
140
- emUserType.isReady()&&emUserType.getList().map(item=>{
141
- return <List.Item key={item.key} data-value={item.value} onClick={ (e)=>{
142
- let value = e.currentTarget.getAttribute('data-value');
143
- let item = emUserType.getData({id:value});
144
- ShowToast(`${JSON.stringify(item)}`)
145
- }}>{item.label}</List.Item>
146
- })
147
- }
92
+ <List header='UI组件'>
93
+ <List.Item key='scrollList' onClick={()=>{navigate('/list')}}>下拉刷新及滚动加载</List.Item>
148
94
  </List>
149
95
 
150
- <List header='下拉刷新,滚动加载案例'>
151
- {
152
- list.map((item,idx)=>{
153
- return (
154
- <List.Item key={item.name}>{item.name}-{item.resetCount}</List.Item>
155
- )
156
- })
157
- }
96
+ <List header='其它'>
97
+ <List.Item key='dictionary' onClick={()=>{navigate('/dictionary')}}>字典工具</List.Item>
158
98
  </List>
159
99
 
160
100
  </PullToRefresh>
161
- <InfiniteScroll threshold={40} loadMore={onNextPage} hasMore={request.pagination.more} />
162
101
 
163
102
  </section>
164
103
  )
@@ -0,0 +1,88 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import {PullToRefresh ,InfiniteScroll,List} from 'antd-mobile';
3
+ import {usePagination,useLoading} from '@/hooks';
4
+ import {GET_USER_LIST} from '@/services/user';
5
+ import ProviderApp from '@/provider/app';
6
+
7
+
8
+ import styles from './index.less';
9
+
10
+ const Page = () => {
11
+ const providerApp = ProviderApp.useContainer();
12
+
13
+ const request = usePagination({
14
+ service:GET_USER_LIST,
15
+ })
16
+ const [list,setList]= useState([]);
17
+ const loading = useLoading();
18
+
19
+ useEffect(()=>{
20
+ providerApp.setNav({title:'下拉刷新和滚动加载'})
21
+ },[])
22
+
23
+
24
+ useEffect(()=>{
25
+ let ret=[];
26
+ request?.data?.forEach(page=>{
27
+ try{
28
+ ret = [...ret,...page];
29
+ }catch(ex){
30
+ console.error(ex)
31
+ debugger;
32
+ }
33
+ })
34
+ setList(ret);
35
+
36
+ },[request.data])
37
+
38
+
39
+ const onReset= async ()=>{
40
+ return request.reset();
41
+ }
42
+
43
+ const onNextPage= async ()=>{
44
+ if(loading.loading>0){
45
+ return;
46
+ }
47
+ loading.setLoading(true)
48
+ let dom = document.querySelector('#wall');
49
+ dom.scrollTop-=200;
50
+ await request.nextPage();
51
+ loading.setLoading(false)
52
+ return true;
53
+ }
54
+ const refresh=async ()=>{
55
+ loading.setLoading(true)
56
+ await request.update();
57
+ loading.setLoading(false);
58
+ }
59
+ useEffect(()=>{
60
+ refresh();
61
+ },[]);
62
+
63
+ return (
64
+ <section id="wall" className={styles.wall}>
65
+ <PullToRefresh className={styles.wrap}
66
+ onRefresh={async () => {
67
+ await onReset();
68
+ return true;
69
+ }}
70
+ >
71
+ <List header='下拉刷新,滚动加载案例'>
72
+ {
73
+ list.map((item,idx)=>{
74
+ return (
75
+ <List.Item key={item.name}>{item.name}-{item.resetCount}</List.Item>
76
+ )
77
+ })
78
+ }
79
+ </List>
80
+
81
+ </PullToRefresh>
82
+ <InfiniteScroll threshold={40} loadMore={onNextPage} hasMore={request.pagination.more} />
83
+
84
+ </section>
85
+ )
86
+ }
87
+
88
+ export default Page;
@@ -0,0 +1,22 @@
1
+
2
+ .wall{
3
+ width: 100%;
4
+ height: 100%;
5
+ overflow-y: auto;
6
+ }
7
+ .wrap{
8
+ height:100%;
9
+ width:100%;
10
+ }
11
+ .item{
12
+ font-size: 40px;
13
+ }
14
+ .tips{
15
+ font-size: 36px;
16
+ }
17
+
18
+ .btnGroup{
19
+ :global(.adm-button ){
20
+ margin-bottom: 24px;
21
+ }
22
+ }
@@ -7,7 +7,6 @@ const Page = () => {
7
7
  const navigate= useNavigate();
8
8
  const [search] = useSearchParams();
9
9
  const providerApp = ProviderApp.useContainer();
10
-
11
10
  const kssoLogin=async ()=>{
12
11
  let code = search.get('code');
13
12
  if(code){
@@ -1,7 +1,16 @@
1
+ /**
2
+ * @module ProviderApp
3
+ */
1
4
  import { useState,useMemo } from 'react';
2
5
  import { createContainer } from "unstated-next"
3
6
  import {useDelay} from '@/hooks';
4
7
  import {logout as apiLogout} from '@/services';
8
+
9
+ /**
10
+ * @function
11
+ * @description app状态管理的Provider
12
+ * @returns {UseAppResult}
13
+ */
5
14
  const useApp=() =>{
6
15
  const [loading,setLoading] = useState(true);
7
16
  const [nav,setNavConfig] = useState({visible:true,syncDocumentTitle:false});
@@ -44,6 +53,19 @@ const useApp=() =>{
44
53
  return action
45
54
  }
46
55
 
56
+ /**
57
+ * @typedef UseAppResult
58
+ * @property {boolean} loading=true - loading状态
59
+ * @property {function} setLoading - 设置loading状态
60
+ * @property {Promise<boolean>} isLogin - 用户是否已登录
61
+ * @property {Promise<boolean>} login - 触发登录
62
+ * @property {Promise<boolean>} logout - 触发注销
63
+ * @property {Object} nav={visible:true} - 导航栏配置
64
+ * @property {function} setNav - 设置导航栏配置
65
+ * @property {function} setUser - 设置用户信息
66
+ * @property {Object} user=null - 用户信息
67
+ */
68
+
47
69
  const App = createContainer(useApp);
48
70
 
49
71
  export default App;
@@ -3,6 +3,10 @@ import { Routes, Route, Navigate} from 'react-router-dom';
3
3
  import Home from '@/pages/index.jsx';
4
4
  import Login from '@/pages/login';
5
5
  import User from '@/pages/user';
6
+ import List from '@/pages/list';
7
+ import Dictionary from '@/pages/dictionary';
8
+
9
+
6
10
  import {LayoutApp,LayoutProvider} from '@/components/Layout';
7
11
  import {AuthLogin} from '@/components/Auth';
8
12
  export const RouteList = (
@@ -13,6 +17,10 @@ export const RouteList = (
13
17
  <Route path='/' element={<Navigate to='/demo/1001?type=test&name=demo' />} />
14
18
  <Route path='/demo/:id' element={<Home />} />
15
19
  <Route path='/user' element={<AuthLogin><User /></AuthLogin>} />
20
+ <Route path='/list' element={<List />} />
21
+ <Route path='/dictionary' element={<Dictionary />} />
22
+
23
+
16
24
  </Route>
17
25
  <Route path='/login' element={<Login />} />
18
26
  </Route>
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @module Services
3
+ */
1
4
  import Axios from 'axios';
2
5
  import qs from 'qs';
3
6
  const axios = Axios.create();
@@ -82,8 +85,23 @@ axios.interceptors.response.use(
82
85
 
83
86
 
84
87
 
88
+ /**
89
+ * @typedef RequestOptions
90
+ * @description 发送请求的扩展信息
91
+ * @property {number|boolean} ttl=false - 接口缓存周期,开启后默认为2秒,ttl单位为毫秒
92
+ * @property {string|boolean} noInterceptors=false - 关闭拦截类型,'all'为关闭包括401、403在内的所有异常,默认情况下只拦截response.code不为0的情况
93
+ *
94
+ */
85
95
 
86
96
  let buffer = {};
97
+ /**
98
+ * @function
99
+ * @description 发送一个GET请求
100
+ * @param {string} url - 请求地址
101
+ * @param {Object} param - 请求的参数
102
+ * @param {RequestOptions} options - 扩展参数
103
+ * @returns {Promise<Object>}
104
+ */
87
105
  export async function GET_DEFAULT(url, param, options) {
88
106
  if (param) param = qs.stringify(param, { arrayFormat: 'indices' });
89
107
  let now = Date.now();
@@ -116,6 +134,10 @@ export async function GET_DEFAULT(url, param, options) {
116
134
  return response && response.data ? response.data : null;
117
135
  }
118
136
 
137
+ /**
138
+ * @function
139
+ * @description 带允许cookie跨域的GET_DEFAULT
140
+ */
119
141
  export async function GET_DEFAULT_CROSS(url, param) {
120
142
  if (param) param = qs.stringify(param, { arrayFormat: 'indices' });
121
143
 
@@ -129,6 +151,14 @@ export async function GET_DEFAULT_CROSS(url, param) {
129
151
  return response && response.data ? response.data : null;
130
152
  }
131
153
 
154
+ /**
155
+ * @function
156
+ * @description 发送一个POST请求
157
+ * @param {string} url - 请求地址
158
+ * @param {Object} param - 请求的参数
159
+ * @param {RequestOptions} options - 扩展参数
160
+ * @returns {Promise<Object>}
161
+ */
132
162
  export async function POST_DEFAULT(url, params, method, options) {
133
163
  let data = params;
134
164
  // if (params) params = qs.stringify(params, { arrayFormat: 'indices' });
@@ -147,7 +177,10 @@ export async function POST_DEFAULT(url, params, method, options) {
147
177
  });
148
178
  return response && response.data ? response.data : null;
149
179
  }
150
-
180
+ /**
181
+ * @function
182
+ * @description 带cookie跨域的POST_DEFAULT
183
+ */
151
184
  export async function POST_DEFAULT_CROSS(url, params) {
152
185
  let data = {};
153
186
  // if (params) params = qs.stringify(params, { arrayFormat: 'indices' });
@@ -1,89 +0,0 @@
1
- import { useState,useRef } from 'react';
2
-
3
-
4
- const DEFAULT_PAGE_SIZE=20;
5
- const DEFAULT_PAGE_CURRENT=1;
6
-
7
- const useNextPage=(props)=>{
8
- const [search,setSearch] = useState(props.initSearch||{});
9
- const [service] = useState(()=>props.service);
10
- const [beforeService] = useState(()=>props.beforeService);
11
- const [pagination,setPagination] = useState(()=>{
12
- let temp = {
13
- current:DEFAULT_PAGE_CURRENT,
14
- pageSize:DEFAULT_PAGE_SIZE,
15
- total:0,
16
- startIdx:0,
17
- more:false,
18
- ...props.pagination
19
- };
20
- temp.startIdx = (temp.current-1)*temp.pageSize;
21
- return temp;
22
- });
23
- const resetCount = useRef(0);
24
- const [data,setData] = useState([]);
25
-
26
- const reset= async ()=>{
27
- resetCount.current++;
28
- let page = {...pagination};
29
- page.current =1;
30
- return refresh({pageValue:page})
31
- }
32
- const nextPage= async ()=>{
33
- if(!pagination.more){
34
- return false;
35
- }
36
- let page = {...pagination};
37
- page.current= +page.current+1;
38
- return refresh({pageValue:page})
39
- }
40
- const refresh= async ({searchValue,pageValue}={})=>{
41
- searchValue = searchValue || search;
42
- pageValue = pageValue || pagination;
43
- searchValue = {...search,...searchValue};
44
- pageValue = {...pagination,...pageValue};
45
-
46
- const {current,pageSize} = pageValue;
47
- let params = {...searchValue,current:current,pageSize:pageSize};
48
- if(beforeService)params=beforeService(params);
49
- if(!params)return;
50
-
51
- setSearch(searchValue);
52
-
53
- let ret = await service(params);
54
- if(ret?.code==0){
55
- const {page} = ret.data;
56
- const current= +(page.pageNum||DEFAULT_PAGE_CURRENT);
57
- const pageSize= +(page.pageSize||DEFAULT_PAGE_SIZE);
58
- const total= +page.total;
59
- const startIdx= (current-1)*pageSize;
60
- const more = current*pageSize<total;
61
- setPagination({
62
- current,pageSize,total,startIdx,more
63
- })
64
- if(ret.data.list){
65
- ret.data.list.map(item=>{
66
- item.resetCount = resetCount.current;
67
- })
68
- let newData = current==1?[]:data;
69
- newData[current-1] = ret.data.list;
70
- setData([...newData])
71
- }
72
- }
73
- return ret;
74
- }
75
-
76
-
77
- return {
78
- pagination,
79
- search,
80
- setSearch,
81
- refresh,
82
- reset,
83
- nextPage,
84
- data,
85
- };
86
-
87
- }
88
-
89
- export default useNextPage;
@@ -1,13 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import ProviderApp from '@/provider/app';
3
-
4
- const Page = () => {
5
- const providerApp = ProviderApp.useContainer();
6
- return (
7
- <div>
8
- <p>当前用户态:{JSON.stringify(providerApp.user)}</p>
9
- </div>
10
- )
11
- }
12
-
13
- export default Page;
@@ -1,23 +0,0 @@
1
- import React, { useEffect, useState, useRef } from 'react';
2
- import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
-
4
- import ProviderApp from '@/provider/app';
5
-
6
- import {Button} from 'antd';
7
-
8
- import styles from './index.less';
9
-
10
- const Page = () => {
11
- const navigate= useNavigate();
12
- const providerApp = ProviderApp.useContainer();
13
- const query = useParams();
14
- const [search] = useSearchParams();
15
-
16
- return (
17
- <section id="wall" className={styles.wall}>
18
- <Button type='primary'>i am home {JSON.stringify(query)}</Button>
19
- </section>
20
- )
21
- }
22
-
23
- export default Page;