kn-cli 1.0.4 → 1.0.5
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.
- package/build/package.json +1 -1
- package/build/webpack.config.js +4 -3
- package/package.json +1 -1
- package/templates/template_app/frontend_build.sh +16 -3
- package/templates/template_app/package.json +9 -7
- package/templates/template_app/public/src/_reset.less +2 -7
- package/templates/template_app/public/src/_variable.less +5 -0
- package/templates/template_app/public/src/assets/images/loading.svg +22 -34
- package/templates/template_app/public/src/components/Auth/index.jsx +44 -0
- package/templates/template_app/public/src/components/Header/index.jsx +44 -10
- package/templates/template_app/public/src/components/Header/index.less +33 -7
- package/templates/template_app/public/src/components/Layout/App/index.jsx +4 -3
- package/templates/template_app/public/src/components/Layout/App/index.less +1 -5
- package/templates/template_app/public/src/components/Layout/Provider/index.jsx +12 -0
- package/templates/template_app/public/src/components/Layout/index.jsx +2 -1
- package/templates/template_app/public/src/components/Page/PageLoading/index.jsx +13 -3
- package/templates/template_app/public/src/components/Page/PageLoading/index.less +4 -4
- package/templates/template_app/public/src/dictionary/index.js +4 -1
- package/templates/template_app/public/src/hooks/index.jsx +4 -3
- package/templates/template_app/public/src/hooks/useLoading.jsx +42 -0
- package/templates/template_app/public/src/hooks/useNextPage.jsx +89 -0
- package/templates/template_app/public/src/index.jsx +2 -0
- package/templates/template_app/public/src/mock/index.js +1 -0
- package/templates/template_app/public/src/mock/user.js +47 -1
- package/templates/template_app/public/src/mock/utils.js +10 -0
- package/templates/template_app/public/src/pages/index.jsx +160 -1
- package/templates/template_app/public/src/pages/index.less +22 -0
- package/templates/template_app/public/src/pages/login/index.jsx +30 -0
- package/templates/template_app/public/src/pages/user/index.jsx +13 -0
- package/templates/template_app/public/src/provider/app.jsx +34 -3
- package/templates/template_app/public/src/route.jsx +13 -4
- package/templates/template_app/public/src/services/index.js +14 -34
- package/templates/template_app/public/src/services/user.js +13 -0
- package/templates/template_app/public/static/kssoLogin.html +22 -0
- package/templates/template_app/readme.md +2 -2
- package/templates/template_app/webpack.api.js +3 -3
- package/templates/template_app/public/pluginjs/swiper-bundle.min.css +0 -13
- package/templates/template_app/public/pluginjs/swiper-bundle.min.js +0 -14
package/build/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "cross-env webpack-dev-server
|
|
6
|
+
"dev": "cross-env webpack-dev-server",
|
|
7
7
|
"start": "cross-env webpack-dev-server -d",
|
|
8
8
|
"build": "cross-env webpack -p --progress --colors --mode production",
|
|
9
9
|
"build:dev": "cross-env webpack -p --progress --colors --mode production",
|
package/build/webpack.config.js
CHANGED
|
@@ -119,7 +119,7 @@ module.exports = {
|
|
|
119
119
|
'@babel/preset-env',
|
|
120
120
|
{
|
|
121
121
|
targets: devMode
|
|
122
|
-
? { chrome: '
|
|
122
|
+
? { chrome: '90' }
|
|
123
123
|
: {
|
|
124
124
|
chrome: '40',
|
|
125
125
|
ie: '11',
|
|
@@ -255,6 +255,7 @@ module.exports = {
|
|
|
255
255
|
minimizer: [
|
|
256
256
|
new TerserPlugin({
|
|
257
257
|
parallel: true,
|
|
258
|
+
sourceMap:true
|
|
258
259
|
// terserOptions:{
|
|
259
260
|
// compress:false,
|
|
260
261
|
// mangle:false
|
|
@@ -325,8 +326,8 @@ module.exports = {
|
|
|
325
326
|
}),
|
|
326
327
|
new webpack.SourceMapDevToolPlugin({
|
|
327
328
|
filename: 'sourcemap/[file].map',
|
|
328
|
-
publicPath: resource_path_relative,
|
|
329
|
-
fileContext: 'js',
|
|
329
|
+
// publicPath: resource_path_relative,
|
|
330
|
+
// fileContext: 'js',
|
|
330
331
|
})
|
|
331
332
|
],
|
|
332
333
|
};
|
package/package.json
CHANGED
|
@@ -29,6 +29,16 @@ checkNode(){
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
checkKnCli(){
|
|
33
|
+
if ! [ -x "$(command -v kn-cli)" ]
|
|
34
|
+
then
|
|
35
|
+
npm i kn-cli -g
|
|
36
|
+
return 0
|
|
37
|
+
fi
|
|
38
|
+
return 0
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
32
42
|
checkResult(){
|
|
33
43
|
ret=$?
|
|
34
44
|
if [ $ret != 0 ]
|
|
@@ -49,9 +59,11 @@ build(){
|
|
|
49
59
|
rm -rf release
|
|
50
60
|
checkResult "清理release"
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
checkKnCli
|
|
63
|
+
checkResult "检查kn-cli"
|
|
64
|
+
|
|
65
|
+
# npm i kn-cli@1.0.2 -g
|
|
66
|
+
# checkResult "npm kn-cli"
|
|
55
67
|
|
|
56
68
|
kn-cli --build
|
|
57
69
|
checkResult "kn-cli --build"
|
|
@@ -63,6 +75,7 @@ build(){
|
|
|
63
75
|
checkNode
|
|
64
76
|
checkResult "检查node"
|
|
65
77
|
|
|
78
|
+
|
|
66
79
|
build
|
|
67
80
|
checkResult "build"
|
|
68
81
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "app",
|
|
2
|
+
"name": "mobile-app",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"scripts": {
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
},
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"react
|
|
14
|
-
"react-
|
|
10
|
+
"antd-mobile": "~5.27.0",
|
|
11
|
+
"axios": "~1.1.3",
|
|
12
|
+
"moment": "~2.29.4",
|
|
13
|
+
"react": "~17.0.2",
|
|
14
|
+
"react-dom": "~17.0.2",
|
|
15
|
+
"react-router": "~6.3.0",
|
|
16
|
+
"react-router-dom": "~6.3.0",
|
|
15
17
|
"unstated-next": "~1.1.0",
|
|
16
|
-
"vconsole": "
|
|
18
|
+
"vconsole": "~3.9.5"
|
|
17
19
|
},
|
|
18
20
|
"engines": {
|
|
19
21
|
"node": "16.18.0"
|
|
@@ -9,12 +9,7 @@
|
|
|
9
9
|
width:100vw;
|
|
10
10
|
height: 100%;
|
|
11
11
|
// height:100vh;
|
|
12
|
-
|
|
13
|
-
padding:env(safe-area-inset-top)
|
|
14
|
-
env(safe-area-inset-right)
|
|
15
|
-
env(safe-area-inset-bottom)
|
|
16
|
-
env(safe-area-inset-left);
|
|
17
|
-
padding-bottom:0;
|
|
12
|
+
padding:var(--safeTop) var(--safeRight) var(--safeBottom) var(--safeLeft);
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
body,#main-view{
|
|
@@ -103,7 +98,7 @@ a,div,p,span,section,hgroup{
|
|
|
103
98
|
|
|
104
99
|
|
|
105
100
|
#__vconsole *{
|
|
106
|
-
font-size:
|
|
101
|
+
font-size:14PX;
|
|
107
102
|
}
|
|
108
103
|
|
|
109
104
|
body[data-debug-layout]{
|
|
@@ -4,8 +4,13 @@
|
|
|
4
4
|
:root{
|
|
5
5
|
--safeTop: constant(safe-area-inset-top);
|
|
6
6
|
--safeBottom: constant(safe-area-inset-bottom);
|
|
7
|
+
--safeLeft: constant(safe-area-inset-left);
|
|
8
|
+
--safeRight: constant(safe-area-inset-right);
|
|
9
|
+
|
|
7
10
|
--safeTop: env(safe-area-inset-top);
|
|
8
11
|
--safeBottom: env(safe-area-inset-bottom);
|
|
12
|
+
--safeLeft: env(safe-area-inset-left);
|
|
13
|
+
--safeRight: env(safe-area-inset-right);
|
|
9
14
|
|
|
10
15
|
--weight-Thin:100;
|
|
11
16
|
--weight-Ultralight:200;
|
|
@@ -1,51 +1,39 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background:
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
|
|
3
3
|
<g transform="rotate(0 50 50)">
|
|
4
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
5
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.
|
|
4
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
5
|
+
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8888888888888888s" repeatCount="indefinite"></animate>
|
|
6
6
|
</rect>
|
|
7
|
-
</g><g transform="rotate(
|
|
8
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
9
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.
|
|
7
|
+
</g><g transform="rotate(40 50 50)">
|
|
8
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
9
|
+
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.7777777777777778s" repeatCount="indefinite"></animate>
|
|
10
10
|
</rect>
|
|
11
|
-
</g><g transform="rotate(
|
|
12
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
13
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>
|
|
14
|
-
</rect>
|
|
15
|
-
</g><g transform="rotate(90 50 50)">
|
|
16
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#1d3f72">
|
|
11
|
+
</g><g transform="rotate(80 50 50)">
|
|
12
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
17
13
|
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
|
|
18
14
|
</rect>
|
|
19
15
|
</g><g transform="rotate(120 50 50)">
|
|
20
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
21
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.
|
|
22
|
-
</rect>
|
|
23
|
-
</g><g transform="rotate(150 50 50)">
|
|
24
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#1d3f72">
|
|
25
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>
|
|
16
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
17
|
+
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5555555555555556s" repeatCount="indefinite"></animate>
|
|
26
18
|
</rect>
|
|
27
|
-
</g><g transform="rotate(
|
|
28
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
29
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.
|
|
19
|
+
</g><g transform="rotate(160 50 50)">
|
|
20
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
21
|
+
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4444444444444444s" repeatCount="indefinite"></animate>
|
|
30
22
|
</rect>
|
|
31
|
-
</g><g transform="rotate(
|
|
32
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
23
|
+
</g><g transform="rotate(200 50 50)">
|
|
24
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
33
25
|
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
|
|
34
26
|
</rect>
|
|
35
27
|
</g><g transform="rotate(240 50 50)">
|
|
36
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
37
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.
|
|
38
|
-
</rect>
|
|
39
|
-
</g><g transform="rotate(270 50 50)">
|
|
40
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#1d3f72">
|
|
41
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
|
|
28
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
29
|
+
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.2222222222222222s" repeatCount="indefinite"></animate>
|
|
42
30
|
</rect>
|
|
43
|
-
</g><g transform="rotate(
|
|
44
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
45
|
-
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.
|
|
31
|
+
</g><g transform="rotate(280 50 50)">
|
|
32
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
33
|
+
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.1111111111111111s" repeatCount="indefinite"></animate>
|
|
46
34
|
</rect>
|
|
47
|
-
</g><g transform="rotate(
|
|
48
|
-
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#
|
|
35
|
+
</g><g transform="rotate(320 50 50)">
|
|
36
|
+
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
|
|
49
37
|
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
|
|
50
38
|
</rect>
|
|
51
39
|
</g>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import ProviderApp from '@/provider/app';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import {useLoading} from '@/hooks';
|
|
5
|
+
|
|
6
|
+
export const AuthShow=(props)=>{
|
|
7
|
+
const {name} = props;
|
|
8
|
+
const app = ProviderApp.useContainer();
|
|
9
|
+
if(app?.user?.auth?.includes(name)){
|
|
10
|
+
return props.children;
|
|
11
|
+
}
|
|
12
|
+
return <></>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const AuthLogin=(props)=>{
|
|
16
|
+
const navigate = useNavigate();
|
|
17
|
+
const [pass,setPass] = useState(false)
|
|
18
|
+
const app = ProviderApp.useContainer();
|
|
19
|
+
const loading = useLoading();
|
|
20
|
+
|
|
21
|
+
const check=async ()=>{
|
|
22
|
+
loading.setLoading(true);
|
|
23
|
+
console.log(`[Auth]检查用户登录态`)
|
|
24
|
+
const req =await app.isLogin();
|
|
25
|
+
loading.setLoading(false);
|
|
26
|
+
if(req){
|
|
27
|
+
console.log(`[Auth]检查用户登录态成功`)
|
|
28
|
+
setPass(true);
|
|
29
|
+
}else{
|
|
30
|
+
console.log(`[Auth]检查用户登录态失败`)
|
|
31
|
+
setPass(false);
|
|
32
|
+
navigate('/login');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
useEffect(check,[]);
|
|
36
|
+
|
|
37
|
+
if(pass){
|
|
38
|
+
return props.children;
|
|
39
|
+
}
|
|
40
|
+
return <>检查登录态中...</>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export default {AuthShow,AuthLogin};
|
|
@@ -1,22 +1,56 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import IconFont from '../IconFont';
|
|
3
3
|
import styles from './index.less';
|
|
4
4
|
|
|
5
5
|
const Header=(props)=>{
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const {
|
|
7
|
+
visible=true,
|
|
8
|
+
className='',
|
|
9
|
+
title='标题',
|
|
10
|
+
subTitle='',
|
|
11
|
+
leftLabel='',
|
|
12
|
+
rightLabel='',
|
|
13
|
+
left=<IconFont className={styles.leftIcon} icon='arrowBack' />,
|
|
14
|
+
right='',
|
|
15
|
+
syncDocumentTitle=false
|
|
16
|
+
} = props;
|
|
9
17
|
|
|
18
|
+
// 同步更新网页标题
|
|
19
|
+
useEffect(()=>{
|
|
20
|
+
if(syncDocumentTitle){
|
|
21
|
+
document.title= title;
|
|
22
|
+
}
|
|
23
|
+
},[title])
|
|
24
|
+
const onLeft=()=>{
|
|
25
|
+
window.history.back();
|
|
26
|
+
}
|
|
27
|
+
const onLeftLabel=()=>{
|
|
28
|
+
if(props.onLeftLabel){props.onLeftLabel()}
|
|
29
|
+
}
|
|
30
|
+
const onRight=()=>{
|
|
31
|
+
if(props.onRight){props.onRight()}
|
|
32
|
+
}
|
|
33
|
+
const onRightLabel=()=>{
|
|
34
|
+
if(props.onRightLabel){props.onRightLabel()}
|
|
35
|
+
}
|
|
36
|
+
const onTitle=()=>{
|
|
37
|
+
if(props.onTitle){props.onTitle()}
|
|
10
38
|
}
|
|
11
39
|
return (
|
|
12
|
-
<section className={styles.header}>
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
40
|
+
<section className={`${styles.header} ${className}`} data-visible={visible}>
|
|
41
|
+
<hgroup className={styles.group}>
|
|
42
|
+
{left&&(<section className={styles.left} onClick={onLeft}>{left}</section>)}
|
|
43
|
+
{leftLabel&&<span className={styles.leftLabel} onClick={onLeftLabel}>{leftLabel}</span>}
|
|
44
|
+
</hgroup>
|
|
16
45
|
<section className={styles.center}>
|
|
17
|
-
{title}
|
|
46
|
+
{title&&<span onClick={onTitle}>{title}</span>}
|
|
47
|
+
{subTitle&&<span>{subTitle}</span>}
|
|
18
48
|
</section>
|
|
19
|
-
<
|
|
49
|
+
<hgroup className={styles.group}>
|
|
50
|
+
{rightLabel&&<span className={styles.rightLabel} onClick={onRightLabel}>{rightLabel}</span>}
|
|
51
|
+
{right&&(<section className={styles.right} onClick={onRight}>{right}</section>)}
|
|
52
|
+
</hgroup>
|
|
53
|
+
|
|
20
54
|
</section>
|
|
21
55
|
)
|
|
22
56
|
}
|
|
@@ -2,30 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.header{
|
|
5
|
+
z-index: 1;
|
|
5
6
|
height:var(--height-header);
|
|
7
|
+
background-color: white;
|
|
6
8
|
width:100%;
|
|
7
9
|
display: flex;
|
|
8
10
|
align-items: center;
|
|
9
11
|
box-shadow: 0 0 2px 0 #ccc;
|
|
10
12
|
padding: 0 var(--padding-default);
|
|
11
|
-
|
|
13
|
+
&[data-visible='false']{
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
.group{
|
|
12
17
|
display: flex;
|
|
13
18
|
align-items: center;
|
|
14
19
|
height:100%;
|
|
20
|
+
min-width: 1px;
|
|
21
|
+
}
|
|
22
|
+
.right,
|
|
23
|
+
.left{
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
15
26
|
font-size: 24px;
|
|
16
|
-
|
|
27
|
+
.rightIcon,
|
|
28
|
+
.leftIcon{
|
|
29
|
+
margin-top: 6px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.rightLabel,
|
|
33
|
+
.leftLabel{
|
|
34
|
+
&:not(:first-child){
|
|
35
|
+
margin-left:var(--padding-small)
|
|
36
|
+
}
|
|
17
37
|
}
|
|
38
|
+
|
|
18
39
|
.center{
|
|
19
40
|
flex:1;
|
|
20
41
|
height:100%;
|
|
21
42
|
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
22
44
|
align-items: center;
|
|
23
45
|
justify-content: center;
|
|
24
|
-
color:var(--color-text)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
color:var(--color-text);
|
|
47
|
+
span:nth-child(1){
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
color:inherit;
|
|
50
|
+
}
|
|
51
|
+
span:nth-child(2){
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
color:inherit;
|
|
54
|
+
}
|
|
29
55
|
}
|
|
30
56
|
}
|
|
31
57
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Outlet} from 'react-router-dom';
|
|
3
3
|
import Header from '@/components/Header';
|
|
4
|
+
import ProviderApp from '@/provider/app';
|
|
4
5
|
import styles from './index.less';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
const LayoutApp=(props)=>{
|
|
9
|
+
const providerApp = ProviderApp.useContainer();
|
|
10
|
+
console.log('layoutApp.nav',providerApp.nav)
|
|
8
11
|
return (
|
|
9
12
|
<section className={styles.layoutAppWrap}>
|
|
10
|
-
<
|
|
11
|
-
<Header />
|
|
12
|
-
</section>
|
|
13
|
+
<Header {...providerApp.nav} />
|
|
13
14
|
<section className={styles.content}>
|
|
14
15
|
<Outlet />
|
|
15
16
|
</section>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Outlet} from 'react-router-dom';
|
|
3
|
+
import ProviderApp from '@/provider/app';
|
|
4
|
+
|
|
5
|
+
const LayoutProvider=(props)=>{
|
|
6
|
+
return (
|
|
7
|
+
<ProviderApp.Provider>
|
|
8
|
+
<Outlet />
|
|
9
|
+
</ProviderApp.Provider>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
export default LayoutProvider;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React,{useEffect, useState} from 'react';
|
|
2
|
-
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
3
|
import CSS from './index.less';
|
|
4
|
-
import
|
|
4
|
+
import Popup from '@/components/Popup';
|
|
5
|
+
import imgLoading from '@/assets/images/loading.svg';
|
|
5
6
|
|
|
6
7
|
const PageLoading = (props) => {
|
|
7
8
|
const {visible=true} = props;
|
|
@@ -11,10 +12,19 @@ const PageLoading = (props) => {
|
|
|
11
12
|
return (
|
|
12
13
|
<div className={CSS.wrap } >
|
|
13
14
|
<div className={CSS.box} data-show={visible}>
|
|
14
|
-
<
|
|
15
|
+
<img src={imgLoading} />
|
|
15
16
|
</div>
|
|
16
17
|
</div>
|
|
17
18
|
);
|
|
18
19
|
};
|
|
19
20
|
|
|
21
|
+
export const ShowPageLoading=(props={canTouch:false})=>{
|
|
22
|
+
let popup = Popup(()=>{},{cantouch:props.canTouch});
|
|
23
|
+
ReactDOM.render(
|
|
24
|
+
<PageLoading visible={true} />,
|
|
25
|
+
popup.dom
|
|
26
|
+
);
|
|
27
|
+
return popup.destory;
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
export default React.memo(PageLoading);
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
.box {
|
|
14
14
|
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
15
|
+
width: 80px;
|
|
16
|
+
height: 80px;
|
|
17
17
|
background: rgba(0,0,0,.3);
|
|
18
|
-
border-radius:
|
|
18
|
+
border-radius: 12px;
|
|
19
19
|
display: flex;
|
|
20
20
|
justify-content: center;
|
|
21
21
|
align-items: center;
|
|
22
22
|
img{
|
|
23
23
|
display: block;
|
|
24
|
-
width:
|
|
24
|
+
width:80%;
|
|
25
25
|
}
|
|
26
26
|
&[data-show=false]{
|
|
27
27
|
opacity: 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import React, { useState, useEffect,useMemo} from 'react';
|
|
3
|
-
|
|
3
|
+
import {GET_USER_TYPE} from '@/services/user';
|
|
4
4
|
|
|
5
5
|
const bookCreater=options=>{
|
|
6
6
|
const {
|
|
@@ -91,6 +91,9 @@ const bookCreater=options=>{
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
export const useUserType = bookCreater({
|
|
95
|
+
service:GET_USER_TYPE,
|
|
96
|
+
})
|
|
94
97
|
export const useTaskState=bookCreater({
|
|
95
98
|
defaultTypes:[
|
|
96
99
|
{label:'进行中',value:'1',key:'run'},
|
|
@@ -5,13 +5,14 @@ import useDelay from './useDelay';
|
|
|
5
5
|
import usePreload from './usePreload';
|
|
6
6
|
import useSearch from './useSearch';
|
|
7
7
|
import useUpdate from './useUpdate';
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import useNextPage from './useNextPage';
|
|
9
|
+
import useLoading from './useLoading';
|
|
10
10
|
export {
|
|
11
11
|
useImageLoader,
|
|
12
12
|
useDelay,
|
|
13
13
|
usePreload,
|
|
14
14
|
useSearch,
|
|
15
15
|
useUpdate,
|
|
16
|
-
|
|
16
|
+
useNextPage,
|
|
17
|
+
useLoading
|
|
17
18
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useRef,useState, useEffect } from 'react';
|
|
2
|
+
import {ShowPageLoading} from '@/components/Page/PageLoading';
|
|
3
|
+
|
|
4
|
+
const useLoading=(props={})=>{
|
|
5
|
+
const {canTouch=false} = props;
|
|
6
|
+
const [name] = useState(props?.name||'loading')
|
|
7
|
+
const [count,setCount] = useState(props?.loading?1:0);
|
|
8
|
+
const refPageLoading = useRef();
|
|
9
|
+
|
|
10
|
+
const setLoading=(state)=>{
|
|
11
|
+
if(state){
|
|
12
|
+
setCount(v=>v+1);
|
|
13
|
+
}else{
|
|
14
|
+
setCount(v=>v-1);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const reset=()=>{
|
|
18
|
+
setCount(v=>0);
|
|
19
|
+
}
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
if(count > 0 ){
|
|
22
|
+
if(!refPageLoading.current){
|
|
23
|
+
refPageLoading.current = ShowPageLoading({canTouch:canTouch});
|
|
24
|
+
}
|
|
25
|
+
}else{
|
|
26
|
+
if(refPageLoading.current){
|
|
27
|
+
refPageLoading.current();//销毁
|
|
28
|
+
refPageLoading.current=null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},[count])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
name,
|
|
36
|
+
reset,
|
|
37
|
+
setLoading,
|
|
38
|
+
loading:count
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default useLoading;
|