kn-cli 1.0.43 → 1.0.45

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 (118) hide show
  1. package/package.json +2 -1
  2. package/readme.md +6 -0
  3. package/src/utils/index.js +1 -1
  4. package/templates/template_admin/.gitignore +6 -0
  5. package/templates/template_admin/build.sh +2 -0
  6. package/templates/template_admin/cli.config.js +21 -0
  7. package/templates/template_admin/dev.sh +89 -0
  8. package/templates/template_admin/frontend_build.sh +83 -0
  9. package/templates/template_admin/init/prepare-commit-msg +5 -0
  10. package/templates/template_admin/init.sh +33 -0
  11. package/templates/template_admin/package.json +23 -0
  12. package/templates/template_admin/public/404.html +26 -0
  13. package/templates/template_admin/public/favicon.ico +0 -0
  14. package/templates/template_admin/public/favicon.png +0 -0
  15. package/templates/template_admin/public/index.html +43 -0
  16. package/templates/template_admin/public/src/_antd.less +4 -0
  17. package/templates/template_admin/public/src/_reset.less +128 -0
  18. package/templates/template_admin/public/src/_variable.less +80 -0
  19. package/templates/template_admin/public/src/assets/iconfont/iconfont.eot +0 -0
  20. package/templates/template_admin/public/src/assets/iconfont/iconfont.less +57 -0
  21. package/templates/template_admin/public/src/assets/iconfont/iconfont.svg +36 -0
  22. package/templates/template_admin/public/src/assets/iconfont/iconfont.ttf +0 -0
  23. package/templates/template_admin/public/src/assets/iconfont/iconfont.woff +0 -0
  24. package/templates/template_admin/public/src/assets/iconfont/iconfont.woff2 +0 -0
  25. package/templates/template_admin/public/src/assets/images/avatar.png +0 -0
  26. package/templates/template_admin/public/src/assets/images/loading.svg +40 -0
  27. package/templates/template_admin/public/src/components/Alert/index.jsx +0 -0
  28. package/templates/template_admin/public/src/components/Alert/index.less +0 -0
  29. package/templates/template_admin/public/src/components/Auth/index.jsx +44 -0
  30. package/templates/template_admin/public/src/components/Header/index.jsx +57 -0
  31. package/templates/template_admin/public/src/components/Header/index.less +57 -0
  32. package/templates/template_admin/public/src/components/IconFont/index.jsx +10 -0
  33. package/templates/template_admin/public/src/components/IconFont/index.less +5 -0
  34. package/templates/template_admin/public/src/components/Layout/Basic/index.jsx +26 -0
  35. package/templates/template_admin/public/src/components/Layout/Basic/index.less +37 -0
  36. package/templates/template_admin/public/src/components/Layout/CenterBody/index.jsx +15 -0
  37. package/templates/template_admin/public/src/components/Layout/CenterBody/index.less +30 -0
  38. package/templates/template_admin/public/src/components/Layout/Provider/index.jsx +12 -0
  39. package/templates/template_admin/public/src/components/Layout/index.jsx +27 -0
  40. package/templates/template_admin/public/src/components/Layout/index.less +63 -0
  41. package/templates/template_admin/public/src/components/Link/index.jsx +24 -0
  42. package/templates/template_admin/public/src/components/Link/index.less +11 -0
  43. package/templates/template_admin/public/src/components/Loading/index.jsx +14 -0
  44. package/templates/template_admin/public/src/components/Loading/index.less +85 -0
  45. package/templates/template_admin/public/src/components/Menu/index.jsx +126 -0
  46. package/templates/template_admin/public/src/components/Menu/index.less +19 -0
  47. package/templates/template_admin/public/src/components/Page/PageLoading/index.jsx +30 -0
  48. package/templates/template_admin/public/src/components/Page/PageLoading/index.less +29 -0
  49. package/templates/template_admin/public/src/components/Popup/index.jsx +22 -0
  50. package/templates/template_admin/public/src/components/Popup/index.less +18 -0
  51. package/templates/template_admin/public/src/components/Toast/index.jsx +60 -0
  52. package/templates/template_admin/public/src/components/Toast/index.less +43 -0
  53. package/templates/template_admin/public/src/components/TopMenu/index.jsx +228 -0
  54. package/templates/template_admin/public/src/components/TopMenu/index.less +105 -0
  55. package/templates/template_admin/public/src/components/mask/index.jsx +47 -0
  56. package/templates/template_admin/public/src/components/mask/index.less +32 -0
  57. package/templates/template_admin/public/src/dictionary/index.js +103 -0
  58. package/templates/template_admin/public/src/hooks/index.jsx +18 -0
  59. package/templates/template_admin/public/src/hooks/useDelay.jsx +29 -0
  60. package/templates/template_admin/public/src/hooks/useImageLoader.jsx +27 -0
  61. package/templates/template_admin/public/src/hooks/useLoading.jsx +42 -0
  62. package/templates/template_admin/public/src/hooks/useLogin.jsx +33 -0
  63. package/templates/template_admin/public/src/hooks/useNextPage.jsx +89 -0
  64. package/templates/template_admin/public/src/hooks/usePreload.jsx +66 -0
  65. package/templates/template_admin/public/src/hooks/useScrollTop.jsx +32 -0
  66. package/templates/template_admin/public/src/hooks/useSearch.jsx +137 -0
  67. package/templates/template_admin/public/src/hooks/useUpdate.jsx +11 -0
  68. package/templates/template_admin/public/src/index.jsx +50 -0
  69. package/templates/template_admin/public/src/mock/auth.js +91 -0
  70. package/templates/template_admin/public/src/mock/index.js +63 -0
  71. package/templates/template_admin/public/src/mock/user.js +70 -0
  72. package/templates/template_admin/public/src/mock/utils.js +33 -0
  73. package/templates/template_admin/public/src/pages/checkLogin/index.jsx +13 -0
  74. package/templates/template_admin/public/src/pages/index.jsx +23 -0
  75. package/templates/template_admin/public/src/pages/index.less +22 -0
  76. package/templates/template_admin/public/src/pages/login/index.jsx +27 -0
  77. package/templates/template_admin/public/src/pages/login/index.less +44 -0
  78. package/templates/template_admin/public/src/pages/material/index.jsx +12 -0
  79. package/templates/template_admin/public/src/pages/order/index.jsx +12 -0
  80. package/templates/template_admin/public/src/pages/permission/index.jsx +12 -0
  81. package/templates/template_admin/public/src/pages/subHome/index.jsx +12 -0
  82. package/templates/template_admin/public/src/pages/subHome2/index.jsx +12 -0
  83. package/templates/template_admin/public/src/pages/subHome3/index.jsx +12 -0
  84. package/templates/template_admin/public/src/pages/suggest/index.jsx +12 -0
  85. package/templates/template_admin/public/src/pages/superAdminLogin/index.jsx +57 -0
  86. package/templates/template_admin/public/src/pages/superAdminLogin/index.less +44 -0
  87. package/templates/template_admin/public/src/pages/user/index.jsx +13 -0
  88. package/templates/template_admin/public/src/pages/userData/index.jsx +12 -0
  89. package/templates/template_admin/public/src/pages/video/index.jsx +12 -0
  90. package/templates/template_admin/public/src/provider/app.jsx +119 -0
  91. package/templates/template_admin/public/src/provider/menu.jsx +20 -0
  92. package/templates/template_admin/public/src/route.jsx +77 -0
  93. package/templates/template_admin/public/src/services/auth.js +28 -0
  94. package/templates/template_admin/public/src/services/index.js +181 -0
  95. package/templates/template_admin/public/src/services/user.js +26 -0
  96. package/templates/template_admin/public/src/utils/index.js +38 -0
  97. package/templates/template_admin/public/static/about.html +1 -0
  98. package/templates/template_admin/public/static/kssoLogin.html +22 -0
  99. package/templates/template_admin/readme.md +55 -0
  100. package/templates/template_admin/report.sh +68 -0
  101. package/templates/template_admin/tools/iconfont/gulpfile.js +70 -0
  102. package/templates/template_admin/tools/iconfont/package.json +20 -0
  103. package/templates/template_admin/tools/iconfont/run.sh +39 -0
  104. package/templates/template_admin/tools/iconfont/svg/arrowBack.svg +1 -0
  105. package/templates/template_admin/tools/iconfont/svg/check.svg +1 -0
  106. package/templates/template_admin/tools/iconfont/svg/close.svg +1 -0
  107. package/templates/template_admin/tools/iconfont/svg/down.svg +1 -0
  108. package/templates/template_admin/tools/iconfont/svg/image.svg +1 -0
  109. package/templates/template_admin/tools/iconfont/svg/play.svg +1 -0
  110. package/templates/template_admin/tools/iconfont/svg/refresh.svg +1 -0
  111. package/templates/template_admin/tools/iconfont/svg/warn.svg +1 -0
  112. package/templates/template_admin/tools/iconfont/templates/_icons.css +26 -0
  113. package/templates/template_admin/tools/iconfont/templates/_icons.less +29 -0
  114. package/templates/template_admin/tools/iconfont/templates/index.html +56 -0
  115. package/templates/template_admin/tools/tinypng/package.json +11 -0
  116. package/templates/template_admin/tools/tinypng/run.sh +15 -0
  117. package/templates/template_admin/webpack.api.js +33 -0
  118. package/templates/template_app/.gitignore +6 -0
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import {HashRouter} from 'react-router-dom';
4
+ // import {createRoot} from 'react-dom/client';
5
+ // import { createHashRouter,RouterProvider } from 'react-router-dom';
6
+ import './_antd.less';
7
+ import './_reset.less';
8
+ import {RouteList} from './route';
9
+
10
+
11
+ if(MOCK){
12
+ let mock = require('@/mock');
13
+ mock;
14
+ }
15
+
16
+ window.appLog=(txt)=>{
17
+ console.log(txt);
18
+ }
19
+
20
+ /* eslint-disable */
21
+ if(BUILD_ENV!='prod'){
22
+ let VConsole = require('vconsole');
23
+ const vConsole = new VConsole();
24
+ setTimeout(() => {
25
+ vConsole.setSwitchPosition(70, 10);
26
+ }, 2000);
27
+ }
28
+
29
+ if(BUILD_ENV){
30
+ window.appLog(`代码环境类型:${BUILD_ENV}`);
31
+ }
32
+ if (VERSION_HASH) {
33
+ window.appLog(`VERSION_HASH:${VERSION_HASH}`);
34
+ }
35
+ window.appLog(`log init`);
36
+ window.appLog(`${location.href}`);
37
+ window.appLog(`ua:${navigator.userAgent}`);
38
+ /* eslint-enable */
39
+
40
+ const BasicRoute = () => {
41
+ return (
42
+ <HashRouter>
43
+ {RouteList}
44
+ </HashRouter>
45
+ );
46
+ }
47
+
48
+ ReactDOM.render(<BasicRoute />, document.getElementById('main-view'));
49
+
50
+ // createRoot(document.getElementById('main-view')).render(<RouterProvider router={createHashRouter(router)} />);
@@ -0,0 +1,91 @@
1
+ import {waitTime,REP_SUCCESS} from './utils.js';
2
+ import qs from 'qs';
3
+ import {GET_REQUEST} from './utils';
4
+
5
+ async function GET_MENU(req,res){
6
+ await waitTime();
7
+ const MenuRoute=[
8
+ {
9
+ name:'顶部菜单',
10
+ url:'/video',
11
+ children:[
12
+ {
13
+ name:'内容管理',
14
+ icon:'AppstoreOutlined',
15
+ children:[
16
+ {name:'剧集管理',url:'/video'},
17
+ {name:'素材管理',url:'/material'},
18
+ ]
19
+
20
+ },
21
+ {
22
+ name:'数据管理',
23
+ icon:'AppstoreOutlined',
24
+ children:[
25
+ {name:'订单数据',url:'/order'},
26
+ {name:'用户数据',url:'/userData'},
27
+ ]
28
+ },
29
+ {
30
+ name:'用户管理',
31
+ icon:'UserOutlined',
32
+ url:'/user'
33
+ },
34
+ {
35
+ name:'客诉管理',
36
+ icon:'CustomerServiceOutlined',
37
+ url:'/suggest'
38
+ },
39
+ {
40
+ name:'权限配置',
41
+ icon:'CrownOutlined',
42
+ url:'/permission'
43
+ },
44
+ ]
45
+ }
46
+ ]
47
+ return {code:0,data:MenuRoute}
48
+ }
49
+
50
+ async function LOGIN(req,res){
51
+ await waitTime();
52
+ return {code:0,data:{
53
+ authorities:['admin'],
54
+ token:'token',
55
+ userId:'1',
56
+ username:'cx',
57
+ realName:'cx',
58
+ name:'cx'
59
+
60
+ }}
61
+ }
62
+
63
+ async function KSSOLOGIN(req,res){
64
+ await waitTime();
65
+ return {code:0,data:{
66
+ authorities:['admin'],
67
+ token:'token',
68
+ userId:'1',
69
+ username:'cx',
70
+ realName:'cx',
71
+ name:'cx'
72
+
73
+ }}
74
+ }
75
+
76
+
77
+ async function LOGOUT(req,res){
78
+ await waitTime();
79
+ return {code:0}
80
+ }
81
+
82
+
83
+ LOGOUT
84
+ export default {
85
+ '/api/menu/nav':{get:GET_MENU},
86
+ '/api/login':{post:LOGIN},
87
+ '/api/ksso/auth':{post:KSSOLOGIN},
88
+ '/api/logout':{post:LOGOUT},
89
+
90
+
91
+ }
@@ -0,0 +1,63 @@
1
+ import mock from 'mockjs-async';
2
+
3
+ import auth from './auth.js';
4
+ function regMock(list){
5
+ if(list){
6
+ let keys = Object.keys(list)
7
+ keys.map(key=>{
8
+ let pattern;
9
+ if(typeof key === 'string'){
10
+ pattern = new RegExp(key)
11
+ }else{
12
+ pattern=key;
13
+ }
14
+ let config = list[key];
15
+ if(typeof config == 'function'){
16
+ console.log(`[mock]注册 ()${pattern}`)
17
+ mock.mock(pattern,(options)=>{
18
+ return new Promise(reslove=>{
19
+ if(config){
20
+ config(options).then(ret=>{
21
+ console.log(`[mock]response ()${pattern}`,options,ret)
22
+ reslove(ret);
23
+ });
24
+ }else{
25
+ reslove();
26
+ }
27
+ })
28
+ i
29
+ });
30
+ }else{
31
+ let methods = Object.keys(config);
32
+ methods.forEach(method=>{
33
+ console.log(`[mock]注册 (${method})${pattern}`)
34
+ mock.mock(pattern,method,(options)=>{
35
+ return new Promise(reslove=>{
36
+ if(config[method]){
37
+ config[method](options).then(ret=>{
38
+ console.log(`[mock]response (${method})${pattern}`,options,ret)
39
+ reslove(ret);
40
+ });
41
+ }else{
42
+ reslove();
43
+ }
44
+ })
45
+ i
46
+ });
47
+ })
48
+
49
+ }
50
+ })
51
+ }
52
+ }
53
+ /* eslint-disable */
54
+ if(MOCK){
55
+ console.log(`=========MOCK OPEN=======`)
56
+ regMock(auth);
57
+ }else{
58
+ console.log(`=========MOCK CLOSE=======`)
59
+ }
60
+ /* eslint-enable */
61
+
62
+
63
+ export default {};
@@ -0,0 +1,70 @@
1
+ import {waitTime,REP_SUCCESS} from './utils.js';
2
+ import qs from 'qs';
3
+ import {GET_REQUEST} from './utils';
4
+ async function GET_USER(req,res){
5
+ const query = qs.parse(req.url.split('?')[1]);
6
+ const {name} = query;
7
+ await waitTime();
8
+ return {code:0,data:{name}}
9
+ }
10
+
11
+ async function SET_USER(req,res){
12
+ const query = JSON.parse(req.body);
13
+ const {name,age}= query;
14
+ await waitTime();
15
+
16
+ return {
17
+ "code": 0,
18
+ "data":{name,age}
19
+ }
20
+ }
21
+
22
+ async function GET_USER_LIST(req,res){
23
+ const {current,pageSize} = GET_REQUEST(req,res);
24
+ const MAX_TOTAL=98;
25
+ let data=[];
26
+ let idx=(current-1)*pageSize;
27
+
28
+ for(let i=0;i<pageSize;i++){
29
+ if(idx>=MAX_TOTAL)break;
30
+ data.push({
31
+ name:`${idx++}小朋友`
32
+ })
33
+ }
34
+ return {
35
+ code:0,
36
+ data:{
37
+ list:data,
38
+ page:{
39
+ pageNum:current,
40
+ pageSize:pageSize,
41
+ total:MAX_TOTAL
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ async function GET_USER_TYPE(req,res){
48
+ let data=[];
49
+ for(let i=0;i<10;i++){
50
+ data.push({
51
+ label:`标题${i}`,
52
+ value:i,
53
+ key:`title${i}`
54
+ })
55
+ }
56
+ return {
57
+ code:0,
58
+ data:data
59
+ }
60
+ }
61
+
62
+
63
+
64
+
65
+ export default {
66
+ '/userType':{get:GET_USER_TYPE},
67
+ '/userList':{get:GET_USER_LIST},
68
+ '/user':{get:GET_USER,post:SET_USER},
69
+
70
+ }
@@ -0,0 +1,33 @@
1
+ import qs from 'qs';
2
+
3
+ export const waitTime = (time = 500) => {
4
+ return new Promise((resolve) => {
5
+ setTimeout(() => {
6
+ resolve(true);
7
+ }, time);
8
+ });
9
+ };
10
+
11
+
12
+ export const REP_SUCCESS=async (req,res)=>{
13
+ await waitTime();
14
+ return res.json({code:0,data:{}})
15
+ }
16
+ export const REP_FAIL=async (req,res)=>{
17
+ await waitTime();
18
+ return res.json({code:1,message:'mock失败',data:{}})
19
+ }
20
+
21
+ export const REP_500=async (req,res)=>{
22
+ await waitTime();
23
+ // console.log(res);
24
+ return res.status(500).send({})
25
+ }
26
+
27
+
28
+ export const GET_REQUEST=(req)=>{
29
+ if(req.type=='GET'){
30
+ return qs.parse(req.url.split('?')[1]);
31
+ }
32
+ return JSON.parse(req.body);
33
+ }
@@ -0,0 +1,13 @@
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;
@@ -0,0 +1,23 @@
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;
@@ -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
+ }
@@ -0,0 +1,27 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+ import ProviderApp from '@/provider/app';
4
+
5
+
6
+ import styles from './index.less';
7
+
8
+ const Page = () => {
9
+ const [search] = useSearchParams();
10
+ const providerApp = ProviderApp.useContainer();
11
+
12
+ const kssoLogin=async ()=>{
13
+ const req= await providerApp.kssoLogin();
14
+ if(!req){
15
+ return;
16
+ }
17
+ }
18
+ useEffect(kssoLogin,[])
19
+
20
+ return (
21
+ <section className={styles.body}>
22
+ 登录跳转中...
23
+ </section>
24
+ )
25
+ }
26
+
27
+ export default Page;
@@ -0,0 +1,44 @@
1
+
2
+ .link{
3
+ display: block;
4
+ }
5
+
6
+ .body{
7
+ width: 100%;
8
+ height:100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ flex-direction: column;
13
+
14
+ }
15
+ .wrap{
16
+ padding:26px 32px;
17
+ background-color: #ccc;
18
+ .title{
19
+ font-size: 24px;
20
+ font-weight: var(--weight-Medium);
21
+ margin-bottom: 24px;
22
+ }
23
+
24
+ hgroup{
25
+ margin-bottom: 16px;
26
+ display: block;
27
+ .inputLabel{
28
+ display: block;
29
+ font-size: 13px;
30
+ font-weight: var(--weight-Medium);
31
+ color: #86909C;
32
+ line-height: 22px;
33
+ }
34
+ }
35
+ .input{
36
+ width: 336px;
37
+ border-radius: 4px;
38
+ border: 1px solid #E5E6EB;
39
+ }
40
+ .btn{
41
+ width: 336px;
42
+ margin-top: 18px;
43
+ }
44
+ }
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>material</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>order</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>permission</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>subHome1 {JSON.stringify(query)}</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>subHome2 {JSON.stringify(query)}</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>subHome3 {JSON.stringify(query)}</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>suggest</p>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,57 @@
1
+ import React, { useState, useRef } from 'react';
2
+ import ProviderApp from '@/provider/app';
3
+
4
+ import {Input,Button} from 'antd';
5
+
6
+ import styles from './index.less';
7
+
8
+ const Page = () => {
9
+ const providerApp = ProviderApp.useContainer();
10
+ const [username,setUsername]=useState('');
11
+ const [password,setPassword]=useState('');
12
+ const refPassword = useRef();
13
+
14
+ const onInput=(type,e)=>{
15
+ const {target:{value}} = e
16
+ switch(type){
17
+ case 'username':{setUsername(value);}break;
18
+ case 'password':{setPassword(value);}break;
19
+ }
20
+ }
21
+
22
+ const onAccountLogin= async ()=>{
23
+ providerApp.login(username,password)
24
+ }
25
+
26
+ const onKeyUp=(type,e)=>{
27
+ console.log('onkeyup',e);
28
+ const {key:code}= e;
29
+ if(code.toLocaleLowerCase()=='enter'){
30
+ if(type=='id'){
31
+ refPassword.current.focus();
32
+ }else{
33
+ onAccountLogin();
34
+ }
35
+ }
36
+ }
37
+ return (
38
+ <section className={styles.body}>
39
+ <section className={styles.wrap}>
40
+ <p className={styles.title}>登录</p>
41
+ <hgroup>
42
+ <span className={styles.inputLabel}>用户名</span>
43
+ <Input onKeyUp={onKeyUp.bind(this,'id')} autoComplete='new-password' id='skitoon-id' placeholder="请输入OA域账号" size='large' className={styles.input} value={username} onInput={onInput.bind(this,'username')} />
44
+ </hgroup>
45
+
46
+ <hgroup>
47
+ <span className={styles.inputLabel}>密码</span>
48
+ <Input.Password ref={refPassword} onKeyUp={onKeyUp.bind(this,'password')} autoComplete='new-password' id='skitoon-password' placeholder="请输入密码" size='large' className={styles.input} value={password} onInput={onInput.bind(this,'password')} />
49
+ </hgroup>
50
+ <Button type='primary' size='large' className={styles.btn} onClick={onAccountLogin}
51
+ >登录</Button>
52
+ </section>
53
+ </section>
54
+ )
55
+ }
56
+
57
+ export default Page;
@@ -0,0 +1,44 @@
1
+
2
+ .link{
3
+ display: block;
4
+ }
5
+ .body{
6
+ width: 100%;
7
+ height:100%;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ flex-direction: column;
12
+ background-color: var(--color-primary-dark);
13
+
14
+ }
15
+ .wrap{
16
+ padding:26px 32px;
17
+ background-color: white;
18
+ .title{
19
+ font-size: 24px;
20
+ font-weight: var(--weight-Medium);
21
+ margin-bottom: 24px;
22
+ }
23
+
24
+ hgroup{
25
+ margin-bottom: 16px;
26
+ display: block;
27
+ .inputLabel{
28
+ display: block;
29
+ font-size: 13px;
30
+ font-weight: var(--weight-Medium);
31
+ color: #86909C;
32
+ line-height: 22px;
33
+ }
34
+ }
35
+ .input{
36
+ width: 336px;
37
+ border-radius: 4px;
38
+ border: 1px solid #E5E6EB;
39
+ }
40
+ .btn{
41
+ width: 336px;
42
+ margin-top: 18px;
43
+ }
44
+ }
@@ -0,0 +1,13 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import Link from '@/components/Link';
3
+
4
+ const Page = () => {
5
+ return (
6
+ <div>
7
+ <p>用户信息页:用户已登录才可以看到本页,不然会跳转登录页面</p>
8
+ <Link href={'/'}>点击返回首页</Link>
9
+ </div>
10
+ )
11
+ }
12
+
13
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import Link from '@/components/Link';
3
+
4
+ const Page = () => {
5
+ return (
6
+ <div>
7
+ userData
8
+ </div>
9
+ )
10
+ }
11
+
12
+ export default Page;
@@ -0,0 +1,12 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
3
+
4
+ const Page = () => {
5
+ const query = useParams();
6
+
7
+ return (
8
+ <p>video</p>
9
+ )
10
+ }
11
+
12
+ export default Page;