kn-cli 1.0.90 → 1.0.91
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/package.json +1 -1
- package/readme.md +4 -0
- package/src/create.js +22 -2
- package/src/utils/index.js +1 -1
- package/templates/template_admin/cli.config.js +1 -1
- package/templates/template_admin/jsconfig.json +5 -1
- package/templates/template_admin/package.json +1 -1
- package/templates/template_admin/public/index.html +2 -2
- package/templates/template_admin/public/src/components/{Auth → auth}/index.jsx +21 -3
- package/templates/template_admin/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
- package/templates/template_admin/public/src/components/{Layout/Basic → layout/basic}/index.jsx +13 -3
- package/templates/template_admin/public/src/components/layout/centerBody/index.jsx +25 -0
- package/templates/template_admin/public/src/components/{Layout → layout}/index.jsx +15 -6
- package/templates/{template_offcial/public/src/components/Layout/Provider → template_admin/public/src/components/layout/provider}/index.jsx +8 -1
- package/templates/{template_app/public/src/components/Link → template_admin/public/src/components/link}/index.jsx +15 -0
- package/templates/template_admin/public/src/components/{Menu → menu}/index.jsx +15 -8
- package/templates/template_admin/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +25 -4
- package/templates/template_admin/public/src/components/{Popup → popup}/index.jsx +13 -0
- package/templates/{template_app/public/src/components/Toast → template_admin/public/src/components/toast}/index.jsx +20 -1
- package/templates/template_admin/public/src/components/{TopMenu → topMenu}/index.jsx +13 -8
- package/templates/template_admin/public/src/dictionary/index.js +8 -3
- package/templates/template_admin/public/src/hooks/index.jsx +1 -0
- package/templates/template_admin/public/src/hooks/useDelay.jsx +5 -0
- package/templates/template_admin/public/src/hooks/useImageLoader.jsx +1 -2
- package/templates/template_admin/public/src/hooks/useLoading.jsx +5 -1
- package/templates/template_admin/public/src/hooks/usePreload.jsx +2 -1
- package/templates/template_admin/public/src/hooks/useScrollTop.jsx +12 -0
- package/templates/template_admin/public/src/hooks/useSearch.jsx +28 -2
- package/templates/template_admin/public/src/hooks/useUpdate.jsx +5 -0
- package/templates/template_admin/public/src/index.jsx +16 -2
- package/templates/template_admin/public/src/pages/material/index.jsx +2 -1
- package/templates/template_admin/public/src/pages/user/index.jsx +7 -2
- package/templates/template_admin/public/src/provider/app.jsx +39 -4
- package/templates/template_admin/public/src/provider/menu.jsx +4 -1
- package/templates/template_admin/public/src/route.jsx +8 -5
- package/templates/template_admin/public/src/services/index.js +38 -4
- package/templates/template_admin/public/src/services/user.js +3 -3
- package/templates/template_admin/public/src/type.js +48 -0
- package/templates/template_admin/public/src/utils/index.js +34 -18
- package/templates/template_app/cli.config.js +1 -1
- package/templates/template_app/jsconfig.json +5 -1
- package/templates/template_app/package.json +1 -1
- package/templates/template_app/public/src/components/{Auth → auth}/index.jsx +20 -2
- package/templates/template_app/public/src/components/{Header → header}/index.jsx +25 -1
- package/templates/template_app/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
- package/templates/template_app/public/src/components/{Layout/App → layout/app}/index.jsx +12 -2
- package/templates/template_app/public/src/components/layout/index.jsx +6 -0
- package/templates/{template_admin/public/src/components/Layout/Provider → template_app/public/src/components/layout/provider}/index.jsx +3 -0
- package/templates/template_app/public/src/components/link/index.jsx +39 -0
- package/templates/template_app/public/src/components/{Marquee → marquee}/index.jsx +11 -2
- package/templates/template_app/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +23 -3
- package/templates/template_app/public/src/components/{Popup → popup}/index.jsx +13 -0
- package/templates/{template_offcial/public/src/components/Toast → template_app/public/src/components/toast}/index.jsx +21 -1
- package/templates/template_app/public/src/dictionary/index.js +7 -3
- package/templates/template_app/public/src/hooks/index.jsx +1 -0
- package/templates/template_app/public/src/hooks/useDelay.jsx +5 -0
- package/templates/template_app/public/src/hooks/useImageLoader.jsx +1 -2
- package/templates/template_app/public/src/hooks/useLoading.jsx +5 -1
- package/templates/template_app/public/src/hooks/usePreload.jsx +2 -1
- package/templates/template_app/public/src/hooks/useScrollTop.jsx +12 -0
- package/templates/template_app/public/src/index.jsx +22 -5
- package/templates/template_app/public/src/pages/dictionary/index.jsx +9 -1
- package/templates/template_app/public/src/pages/index.jsx +16 -4
- package/templates/template_app/public/src/pages/list/index.jsx +7 -1
- package/templates/template_app/public/src/pages/login/index.jsx +10 -4
- package/templates/template_app/public/src/pages/user/index.jsx +7 -2
- package/templates/template_app/public/src/provider/app.jsx +5 -3
- package/templates/template_app/public/src/route.jsx +5 -2
- package/templates/template_app/public/src/services/index.js +10 -8
- package/templates/template_app/public/src/services/user.js +4 -4
- package/templates/template_app/public/src/type.js +27 -0
- package/templates/template_app/public/src/utils/index.js +6 -0
- package/templates/template_oa/cli.config.js +1 -1
- package/templates/template_oa/package.json +1 -1
- package/templates/template_oa_jwt/cli.config.js +1 -1
- package/templates/template_oa_jwt/package.json +1 -1
- package/templates/template_offcial/cli.config.js +1 -1
- package/templates/template_offcial/jsconfig.json +5 -1
- package/templates/template_offcial/package.json +1 -1
- package/templates/template_offcial/public/src/components/{Footer → footer}/index.jsx +15 -1
- package/templates/template_offcial/public/src/components/{Header → header}/index.jsx +14 -0
- package/templates/template_offcial/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
- package/templates/template_offcial/public/src/components/{Layout → layout}/index.jsx +10 -3
- package/templates/{template_app/public/src/components/Layout/Provider → template_offcial/public/src/components/layout/provider}/index.jsx +7 -0
- package/templates/template_offcial/public/src/components/link/index.jsx +39 -0
- package/templates/template_offcial/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +25 -4
- package/templates/template_offcial/public/src/components/{Popup → popup}/index.jsx +13 -0
- package/templates/{template_admin/public/src/components/Toast → template_offcial/public/src/components/toast}/index.jsx +20 -1
- package/templates/template_offcial/public/src/hooks/index.jsx +1 -0
- package/templates/template_offcial/public/src/hooks/useImageLoader.jsx +1 -0
- package/templates/template_offcial/public/src/hooks/useInToView.jsx +3 -0
- package/templates/template_offcial/public/src/hooks/usePreload.jsx +1 -0
- package/templates/template_offcial/public/src/hooks/useScroll.jsx +8 -0
- package/templates/template_offcial/public/src/index.jsx +15 -2
- package/templates/template_offcial/public/src/pages/index.jsx +8 -1
- package/templates/template_offcial/public/src/pages/pc/index.jsx +4 -2
- package/templates/template_offcial/public/src/provider/app.jsx +28 -2
- package/templates/template_offcial/public/src/route.jsx +4 -2
- package/templates/template_offcial/public/src/services/index.js +38 -2
- package/templates/template_offcial/public/src/services/user.js +3 -3
- package/templates/template_offcial/public/src/type.js +47 -0
- package/src/.DS_Store +0 -0
- package/templates/template_admin/.gitignore +0 -6
- package/templates/template_admin/public/src/components/Alert/index.jsx +0 -0
- package/templates/template_admin/public/src/components/Alert/index.less +0 -0
- package/templates/template_admin/public/src/components/Header/index.jsx +0 -57
- package/templates/template_admin/public/src/components/Layout/CenterBody/index.jsx +0 -15
- package/templates/template_admin/public/src/components/Link/index.jsx +0 -24
- package/templates/template_admin/public/src/components/Loading/index.jsx +0 -14
- package/templates/template_admin/public/src/components/Loading/index.less +0 -85
- package/templates/template_admin/public/src/components/mask/index.jsx +0 -47
- package/templates/template_admin/public/src/components/mask/index.less +0 -32
- package/templates/template_admin/public/src/hooks/useLogin.jsx +0 -33
- package/templates/template_app/.gitignore +0 -6
- package/templates/template_app/public/src/components/Header/index.less +0 -57
- package/templates/template_app/public/src/components/Layout/index.jsx +0 -4
- package/templates/template_app/public/src/hooks/useLogin.jsx +0 -33
- package/templates/template_oa/.gitignore +0 -6
- package/templates/template_oa_jwt/.gitignore +0 -6
- package/templates/template_offcial/.gitignore +0 -6
- package/templates/template_offcial/public/src/components/Alert/index.jsx +0 -0
- package/templates/template_offcial/public/src/components/Alert/index.less +0 -0
- package/templates/template_offcial/public/src/components/Link/index.jsx +0 -24
- /package/templates/template_admin/public/src/components/{IconFont → iconFont}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Layout → layout}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Link → link}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Menu → menu}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Popup → popup}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{Toast → toast}/index.less +0 -0
- /package/templates/template_admin/public/src/components/{TopMenu → topMenu}/index.less +0 -0
- /package/templates/{template_admin/public/src/components/Header → template_app/public/src/components/header}/index.less +0 -0
- /package/templates/template_app/public/src/components/{IconFont → iconFont}/index.less +0 -0
- /package/templates/template_app/public/src/components/{Layout/App → layout/app}/index.less +0 -0
- /package/templates/template_app/public/src/components/{Link → link}/index.less +0 -0
- /package/templates/template_app/public/src/components/{Marquee → marquee}/index.less +0 -0
- /package/templates/template_app/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
- /package/templates/template_app/public/src/components/{Popup → popup}/index.less +0 -0
- /package/templates/template_app/public/src/components/{Toast → toast}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Footer → footer}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Header → header}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{IconFont → iconFont}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Layout → layout}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Link → link}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Popup → popup}/index.less +0 -0
- /package/templates/template_offcial/public/src/components/{Toast → toast}/index.less +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { openLink } from '@/utils';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import styles from './index.less';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 超链接组件
|
|
11
|
+
* @param {object} [props]
|
|
12
|
+
* @param {JSX.Element|string} [props.children] - 子组件
|
|
13
|
+
* @param {string} [props.className] - 扩展类样式名称
|
|
14
|
+
* @param {Function} [props.onClick] - 点击链接的回调
|
|
15
|
+
* @param {string} [props.href] - 跳转链接
|
|
16
|
+
* @param {string} [props.target] - 当target='_blank'时代表新窗口打开
|
|
17
|
+
*
|
|
18
|
+
* @returns {JSX.Element}
|
|
19
|
+
*/
|
|
20
|
+
const Link=(props)=>{
|
|
21
|
+
const {children,className='',onClick,href='',target=''} = props;
|
|
22
|
+
|
|
23
|
+
const onLink=()=>{
|
|
24
|
+
if(href){
|
|
25
|
+
if(target=='_blank'){
|
|
26
|
+
openLink(href);
|
|
27
|
+
// window.open(href);
|
|
28
|
+
}else{
|
|
29
|
+
location.href=href;
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if(onClick)onClick();
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
36
|
+
<span onClick={onLink} className={`${styles.linkWrap} ${className}`}>{children}</span>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
export default React.memo(Link);
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useEffect, useRef } from "react";
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import styles from'./index.less';
|
|
3
5
|
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
8
|
+
* 跑马灯效果
|
|
9
|
+
* @param {object} [props]
|
|
10
|
+
* @param {JSX.Element|string} [props.children] - 需要跑动的内容
|
|
11
|
+
*
|
|
12
|
+
* @returns {JSX.Element}
|
|
7
13
|
*/
|
|
8
14
|
const Marquee=(props)=>{
|
|
15
|
+
/**
|
|
16
|
+
* @type RefDomElement
|
|
17
|
+
*/
|
|
9
18
|
const refText = useRef();
|
|
10
19
|
const refX = useRef(0);
|
|
11
20
|
const refPause = useRef(false);
|
package/templates/template_app/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx
RENAMED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React,{useEffect, useState} from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
3
|
-
|
|
4
|
-
import Popup from '@/components/
|
|
5
|
+
|
|
6
|
+
import Popup from '@/components/popup';
|
|
7
|
+
// @ts-ignore
|
|
5
8
|
import imgLoading from '@/assets/images/loading.svg';
|
|
6
9
|
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import CSS from './index.less';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 页面Loading状态
|
|
15
|
+
* @param {object} [props]
|
|
16
|
+
* @param {boolean} [props.visible=true] - 是否显示状态
|
|
17
|
+
*
|
|
18
|
+
* @returns {JSX.Element}
|
|
19
|
+
*/
|
|
7
20
|
const PageLoading = (props) => {
|
|
8
21
|
const {visible=true} = props;
|
|
9
22
|
if(!visible){
|
|
10
|
-
return
|
|
23
|
+
return <></>;
|
|
11
24
|
}
|
|
12
25
|
return (
|
|
13
26
|
<div className={CSS.wrap } >
|
|
@@ -18,6 +31,13 @@ const PageLoading = (props) => {
|
|
|
18
31
|
);
|
|
19
32
|
};
|
|
20
33
|
|
|
34
|
+
/**
|
|
35
|
+
* 全屏置顶显示一个页面loading组件
|
|
36
|
+
* @param {object} [props]
|
|
37
|
+
* @param {boolean} [props.canTouch=false] - 是否允许用户点击屏幕穿透到下面的组件
|
|
38
|
+
*
|
|
39
|
+
* @returns {(string)=>void}
|
|
40
|
+
*/
|
|
21
41
|
export const ShowPageLoading=(props={canTouch:false})=>{
|
|
22
42
|
let popup = Popup(()=>{},{cantouch:props.canTouch});
|
|
23
43
|
ReactDOM.render(
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
3
7
|
import styles from './index.less';
|
|
4
8
|
styles;
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 一个全屏置顶的遮罩层
|
|
12
|
+
* @param {(result)=>void} reslove - 遮罩层的关闭回调
|
|
13
|
+
* @param {Object} [options] - 参数
|
|
14
|
+
* @param {boolean} [options.cantouch=false] - 是否允许被点击穿透
|
|
15
|
+
* @param {boolean} [options.transparent=false] - 是否遮罩层完全透明
|
|
16
|
+
*
|
|
17
|
+
* @returns { {dom:HTMLElement,destory:()=>void} }
|
|
18
|
+
*/
|
|
6
19
|
const Popup = (reslove,options) => {
|
|
7
20
|
let rootDom = document.createElement('div');
|
|
8
21
|
rootDom.className='popup-box';
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React,{useEffect} from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import Popup from '@/components/popup';
|
|
8
|
+
|
|
9
|
+
// @ts-ignore
|
|
3
10
|
import styles from './index.less';
|
|
4
|
-
|
|
11
|
+
|
|
5
12
|
|
|
6
13
|
const toastList=[];
|
|
7
14
|
const runNext=()=>{
|
|
@@ -43,12 +50,25 @@ const Toast=props=>{
|
|
|
43
50
|
)
|
|
44
51
|
}
|
|
45
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {object} ToastOptions
|
|
55
|
+
* @property {string} message - 吐司文案内容
|
|
56
|
+
* @property {number} [delay=2000] - 持续时间,毫秒
|
|
57
|
+
* @property {string} [position] - 显示位置,center|top|bottom
|
|
58
|
+
* @property {Function} [resolve] - 显示完毕的回调
|
|
59
|
+
*/
|
|
46
60
|
|
|
61
|
+
/**
|
|
62
|
+
* 显示一个吐司信息
|
|
63
|
+
* @param {ToastOptions|string} [props] - 文案内容或一个配置参数
|
|
64
|
+
* @returns { Promise }
|
|
65
|
+
*/
|
|
47
66
|
const ShowToast=props=>{
|
|
48
67
|
if(typeof props === 'string'){
|
|
49
68
|
props = {message:props}
|
|
50
69
|
}
|
|
51
70
|
return new Promise((resolve) => {
|
|
71
|
+
// @ts-ignore
|
|
52
72
|
props.resolve = resolve;
|
|
53
73
|
toastList.push(props);
|
|
54
74
|
if(toastList.length===1){
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-ignore
|
|
2
2
|
import React, { useState, useEffect,useMemo} from 'react';
|
|
3
|
-
|
|
3
|
+
// @ts-ignore
|
|
4
4
|
import {useDictionary} from 'kn-hooks';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import {GET_USER_TYPE} from '@/services/user';
|
|
7
|
+
import ShowToast from '@/components/toast';
|
|
8
|
+
|
|
6
9
|
export const SelectOption=(props)=>{
|
|
7
10
|
const {value}=props;
|
|
8
11
|
const name = props['data-keyname'];
|
|
@@ -10,6 +13,7 @@ export const SelectOption=(props)=>{
|
|
|
10
13
|
ShowToast(`点击option name=${name},value=${value},label=${props.children}`)
|
|
11
14
|
if(props.onClick)props.onClick();
|
|
12
15
|
}
|
|
16
|
+
// @ts-ignore
|
|
13
17
|
return <hgroup onClick={onClick} key={value} name={name} value={value}>{props.children}</hgroup>
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { useRef,useState,useMemo, useEffect } from 'react';
|
|
2
3
|
|
|
3
4
|
const useDelay=()=>{
|
|
4
5
|
const [loading,setLoading] = useState(false);
|
|
5
6
|
const refSet = useRef();
|
|
7
|
+
// @ts-ignore
|
|
6
8
|
refSet.current = setLoading;
|
|
7
9
|
useEffect(()=>{
|
|
10
|
+
// @ts-ignore
|
|
8
11
|
refSet.current = setLoading;
|
|
9
12
|
},[setLoading]);
|
|
10
13
|
|
|
11
14
|
const actions=useMemo(()=>{
|
|
12
15
|
const wait=(ms)=>{
|
|
16
|
+
// @ts-ignore
|
|
13
17
|
refSet.current(true);
|
|
14
18
|
return new Promise(res=>{
|
|
15
19
|
setTimeout(()=>{
|
|
20
|
+
// @ts-ignore
|
|
16
21
|
refSet.current(false);
|
|
17
22
|
res();
|
|
18
23
|
}, ms);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { useRef,useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
+
|
|
4
|
+
import {ShowPageLoading} from '@/components/page/pageLoading';
|
|
3
5
|
|
|
4
6
|
const useLoading=(props={})=>{
|
|
5
7
|
const {canTouch=false} = props;
|
|
@@ -20,10 +22,12 @@ const useLoading=(props={})=>{
|
|
|
20
22
|
useEffect(()=>{
|
|
21
23
|
if(count > 0 ){
|
|
22
24
|
if(!refPageLoading.current){
|
|
25
|
+
// @ts-ignore
|
|
23
26
|
refPageLoading.current = ShowPageLoading({canTouch:canTouch});
|
|
24
27
|
}
|
|
25
28
|
}else{
|
|
26
29
|
if(refPageLoading.current){
|
|
30
|
+
// @ts-ignore
|
|
27
31
|
refPageLoading.current();//销毁
|
|
28
32
|
refPageLoading.current=null;
|
|
29
33
|
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { useState, useMemo, useEffect } from 'react'
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import { createContainer } from 'unstated-next'
|
|
3
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {[HTMLElement,Function]} UseStateElement
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
const useActivity = () => {
|
|
5
12
|
const [scrollTop, setScrollTop] = useState(0);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type UseStateElement
|
|
16
|
+
*/
|
|
6
17
|
const [containerNode, setContainerNode] = useState();
|
|
7
18
|
const [clientHeight, setClientHeight] = useState(0);
|
|
8
19
|
const [titleRefs, setTitleRefs] = useState({});
|
|
@@ -12,6 +23,7 @@ const useActivity = () => {
|
|
|
12
23
|
setContainerNode(node);
|
|
13
24
|
setClientHeight(node.clientHeight)
|
|
14
25
|
node.addEventListener('scroll', (e) => {
|
|
26
|
+
// @ts-ignore
|
|
15
27
|
setScrollTop(e.target.scrollTop);
|
|
16
28
|
})
|
|
17
29
|
}, [])
|
|
@@ -1,46 +1,62 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { Suspense } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { HashRouter } from 'react-router-dom';
|
|
7
|
+
// @ts-ignore
|
|
3
8
|
import * as antdMobile from 'antd-mobile';
|
|
4
9
|
antdMobile;
|
|
5
10
|
|
|
6
11
|
import './_reset.less';
|
|
7
12
|
import './_antd.less';
|
|
8
13
|
|
|
9
|
-
import
|
|
10
|
-
import PageLoading from '@/components/Page/PageLoading';
|
|
14
|
+
import PageLoading from '@/components/page/pageLoading';
|
|
11
15
|
import {RouteList} from './route';
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
// @ts-ignore
|
|
14
18
|
if(MOCK){
|
|
15
19
|
let mock = require('@/mock');
|
|
16
20
|
mock;
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
// @ts-ignore
|
|
19
24
|
window.appLog=(txt)=>{
|
|
20
25
|
console.log(txt);
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
/* eslint-disable */
|
|
24
28
|
|
|
29
|
+
/* eslint-disable */
|
|
30
|
+
// @ts-ignore
|
|
25
31
|
if(BUILD_ENV!='prod'){
|
|
32
|
+
// @ts-ignore
|
|
26
33
|
let VConsole = require('vconsole');
|
|
34
|
+
// @ts-ignore
|
|
27
35
|
const vConsole = new VConsole();
|
|
28
36
|
setTimeout(() => {
|
|
29
37
|
vConsole.setSwitchPosition(70, 10);
|
|
30
38
|
}, 2000);
|
|
31
39
|
}
|
|
32
40
|
|
|
41
|
+
// @ts-ignore
|
|
33
42
|
if(BUILD_ENV){
|
|
43
|
+
// @ts-ignore
|
|
34
44
|
window.appLog(`代码环境类型:${BUILD_ENV}`);
|
|
35
45
|
}
|
|
46
|
+
// @ts-ignore
|
|
36
47
|
if (VERSION_HASH) {
|
|
48
|
+
// @ts-ignore
|
|
37
49
|
window.appLog(`VERSION_HASH:${VERSION_HASH}`);
|
|
38
50
|
}
|
|
51
|
+
|
|
52
|
+
// @ts-ignore
|
|
39
53
|
window.appLog(`log init`);
|
|
54
|
+
// @ts-ignore
|
|
40
55
|
window.appLog(`${location.href}`);
|
|
56
|
+
// @ts-ignore
|
|
41
57
|
window.appLog(`ua:${navigator.userAgent}`);
|
|
58
|
+
// @ts-ignore
|
|
42
59
|
window.appLog(`safe top-bottom:${getComputedStyle(document.documentElement).getPropertyValue("--safeTop")}-${getComputedStyle(document.documentElement).getPropertyValue("--safeBottom")}`);
|
|
43
|
-
|
|
44
60
|
/* eslint-enable */
|
|
45
61
|
|
|
46
62
|
|
|
@@ -59,6 +75,7 @@ window.appLog(`safe top-bottom:${getComputedStyle(document.documentElement).getP
|
|
|
59
75
|
// }
|
|
60
76
|
// });
|
|
61
77
|
|
|
78
|
+
// @ts-ignore
|
|
62
79
|
window.onInputBlur=()=>{
|
|
63
80
|
setTimeout(() => {
|
|
64
81
|
const currentPosition = document.documentElement.scrollTop || document.body.scrollTop||0;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import {List} from 'antd-mobile';
|
|
5
|
+
|
|
3
6
|
import {useUserType,useTaskState} from '@/dictionary';
|
|
4
|
-
import styles from './index.less';
|
|
5
7
|
import ProviderApp from '@/provider/app';
|
|
6
8
|
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
import styles from './index.less';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @returns {JSX.Element}
|
|
14
|
+
*/
|
|
7
15
|
const Page = () => {
|
|
8
16
|
const providerApp = ProviderApp.useContainer();
|
|
9
17
|
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import {PullToRefresh ,List} from 'antd-mobile';
|
|
3
|
-
|
|
5
|
+
// @ts-ignore
|
|
4
6
|
import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import moment from 'moment';
|
|
5
9
|
|
|
10
|
+
import {useLoading} from '@/hooks';
|
|
6
11
|
import ProviderApp from '@/provider/app';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {AuthShow} from '@/components/Auth';
|
|
12
|
+
import ShowToast from '@/components/toast';
|
|
13
|
+
import {AuthShow} from '@/components/auth';
|
|
10
14
|
|
|
15
|
+
// @ts-ignore
|
|
11
16
|
import styles from './index.less';
|
|
12
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @returns {JSX.Element}
|
|
20
|
+
*/
|
|
13
21
|
const Page = () => {
|
|
14
22
|
const navigate= useNavigate();
|
|
15
23
|
const providerApp = ProviderApp.useContainer();
|
|
@@ -20,6 +28,10 @@ const Page = () => {
|
|
|
20
28
|
useEffect(()=>{
|
|
21
29
|
providerApp.setNav({title:'APP演示'})
|
|
22
30
|
},[])
|
|
31
|
+
const onReset=()=>{
|
|
32
|
+
console.log('下拉刷新')
|
|
33
|
+
return Promise.resolve(true);
|
|
34
|
+
}
|
|
23
35
|
return (
|
|
24
36
|
<section id="wall" className={styles.wall}>
|
|
25
37
|
<PullToRefresh className={styles.wrap}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useEffect, useState, useRef } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import {PullToRefresh ,InfiniteScroll,List} from 'antd-mobile';
|
|
5
|
+
|
|
3
6
|
import {usePagination,useLoading} from '@/hooks';
|
|
4
7
|
import {GET_USER_LIST} from '@/services/user';
|
|
5
8
|
import ProviderApp from '@/provider/app';
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
// @ts-ignore
|
|
8
11
|
import styles from './index.less';
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @returns {JSX.Element}
|
|
15
|
+
*/
|
|
10
16
|
const Page = () => {
|
|
11
17
|
const providerApp = ProviderApp.useContainer();
|
|
12
18
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { useSearchParams,useNavigate } from 'react-router-dom';
|
|
5
|
+
|
|
3
6
|
import ProviderApp from '@/provider/app';
|
|
7
|
+
import Link from '@/components/link';
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @returns {JSX.Element}
|
|
11
|
+
*/
|
|
6
12
|
const Page = () => {
|
|
7
13
|
const navigate= useNavigate();
|
|
8
14
|
const [search] = useSearchParams();
|
|
@@ -17,7 +23,7 @@ const Page = () => {
|
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
|
-
useEffect(kssoLogin,[])
|
|
26
|
+
useEffect(()=>{kssoLogin()},[])
|
|
21
27
|
return (
|
|
22
28
|
<div>
|
|
23
29
|
<p>您未登录,当前是登录页</p>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
3
|
|
|
4
|
+
import Link from '@/components/link';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @returns {JSX.Element}
|
|
8
|
+
*/
|
|
4
9
|
const Page = () => {
|
|
5
10
|
return (
|
|
6
11
|
<div>
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* @module ProviderApp
|
|
3
3
|
*/
|
|
4
4
|
import { useState,useMemo } from 'react';
|
|
5
|
+
// @ts-ignore
|
|
5
6
|
import { createContainer } from "unstated-next"
|
|
7
|
+
|
|
6
8
|
import {useDelay} from '@/hooks';
|
|
7
9
|
import {logout as apiLogout} from '@/services';
|
|
8
10
|
|
|
@@ -57,9 +59,9 @@ const useApp=() =>{
|
|
|
57
59
|
* @typedef UseAppResult
|
|
58
60
|
* @property {boolean} loading=true - loading状态
|
|
59
61
|
* @property {function} setLoading - 设置loading状态
|
|
60
|
-
* @property {Promise<boolean>} isLogin - 用户是否已登录
|
|
61
|
-
* @property {Promise<boolean>} login - 触发登录
|
|
62
|
-
* @property {Promise
|
|
62
|
+
* @property {()=>Promise<boolean>} isLogin - 用户是否已登录
|
|
63
|
+
* @property {(string)=>Promise<boolean>} login - 触发登录
|
|
64
|
+
* @property {()=>Promise} logout - 触发注销
|
|
63
65
|
* @property {Object} nav={visible:true} - 导航栏配置
|
|
64
66
|
* @property {function} setNav - 设置导航栏配置
|
|
65
67
|
* @property {function} setUser - 设置用户信息
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import { Routes, Route, Navigate} from 'react-router-dom';
|
|
5
|
+
|
|
3
6
|
import Home from '@/pages/index.jsx';
|
|
4
7
|
import Login from '@/pages/login';
|
|
5
8
|
import User from '@/pages/user';
|
|
6
9
|
import List from '@/pages/list';
|
|
7
10
|
import Dictionary from '@/pages/dictionary';
|
|
8
11
|
|
|
12
|
+
import {LayoutApp,LayoutProvider} from '@/components/layout';
|
|
13
|
+
import {AuthLogin} from '@/components/auth';
|
|
9
14
|
|
|
10
|
-
import {LayoutApp,LayoutProvider} from '@/components/Layout';
|
|
11
|
-
import {AuthLogin} from '@/components/Auth';
|
|
12
15
|
export const RouteList = (
|
|
13
16
|
<Routes>
|
|
14
17
|
<Route path='/' element={<LayoutProvider />}>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Services
|
|
3
3
|
*/
|
|
4
|
+
// @ts-ignore
|
|
4
5
|
import Axios from 'axios';
|
|
5
6
|
import qs from 'qs';
|
|
6
7
|
const axios = Axios.create();
|
|
8
|
+
// @ts-ignore
|
|
7
9
|
console.log(`========API_ROOT:${API_HOST}========`);
|
|
8
10
|
|
|
11
|
+
// @ts-ignore
|
|
9
12
|
export const API_ROOT = API_HOST;
|
|
10
13
|
const tokenMode='header';//header,cookie
|
|
11
14
|
const tokenName='token';
|
|
@@ -86,8 +89,7 @@ axios.interceptors.response.use(
|
|
|
86
89
|
|
|
87
90
|
|
|
88
91
|
/**
|
|
89
|
-
* @typedef RequestOptions
|
|
90
|
-
* @description 发送请求的扩展信息
|
|
92
|
+
* @typedef RequestOptions 发送请求的扩展信息
|
|
91
93
|
* @property {number|boolean} ttl=false - 接口缓存周期,开启后默认为2秒,ttl单位为毫秒
|
|
92
94
|
* @property {string|boolean} noInterceptors=false - 关闭拦截类型,'all'为关闭包括401、403在内的所有异常,默认情况下只拦截response.code不为0的情况
|
|
93
95
|
*
|
|
@@ -98,8 +100,8 @@ let buffer = {};
|
|
|
98
100
|
* @function
|
|
99
101
|
* @description 发送一个GET请求
|
|
100
102
|
* @param {string} url - 请求地址
|
|
101
|
-
* @param {Object} param - 请求的参数
|
|
102
|
-
* @param {RequestOptions} options - 扩展参数
|
|
103
|
+
* @param {Object} [param] - 请求的参数
|
|
104
|
+
* @param {RequestOptions} [options] - 扩展参数
|
|
103
105
|
* @returns {Promise<Object>}
|
|
104
106
|
*/
|
|
105
107
|
export async function GET_DEFAULT(url, param, options) {
|
|
@@ -152,11 +154,11 @@ export async function GET_DEFAULT_CROSS(url, param) {
|
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
/**
|
|
155
|
-
*
|
|
156
|
-
* @description 发送一个POST请求
|
|
157
|
+
* 发送一个POST请求
|
|
157
158
|
* @param {string} url - 请求地址
|
|
158
|
-
* @param {Object}
|
|
159
|
-
* @param {
|
|
159
|
+
* @param {Object} [params] - 请求的参数
|
|
160
|
+
* @param {string} [method] - 请求方式
|
|
161
|
+
* @param {RequestOptions} [options] - 扩展参数
|
|
160
162
|
* @returns {Promise<Object>}
|
|
161
163
|
*/
|
|
162
164
|
export async function POST_DEFAULT(url, params, method, options) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {GET_DEFAULT,POST_DEFAULT,API_ROOT} from './index.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export function GET_USER(){
|
|
6
|
-
return GET_DEFAULT(`${
|
|
6
|
+
return GET_DEFAULT(`${API_ROOT}/user`);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function SET_USER(params={
|
|
10
10
|
name:'',
|
|
11
11
|
age:''
|
|
12
12
|
}){
|
|
13
|
-
return POST_DEFAULT(`${
|
|
13
|
+
return POST_DEFAULT(`${API_ROOT}/user`,params)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* 可自行扩展任意数量的属性
|
|
4
|
+
* @typedef {Object<string, any>} OtherAny
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 指向DOM节点的ref
|
|
9
|
+
* @typedef {object} RefDomElement
|
|
10
|
+
* @property {HTMLElement} current - DOM节点
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} FormDataInfo
|
|
17
|
+
* @property {string} btnControl
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {[FormDataInfo,Function]} UseStateFormData
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {FormDataInfo & OtherAny} TableContentData
|
|
27
|
+
*/
|
|
@@ -4,7 +4,9 @@ export const openLink = (link, target = '_blank') => {
|
|
|
4
4
|
let domLink = document.createElement('a');
|
|
5
5
|
domLink.href = link;
|
|
6
6
|
domLink.setAttribute('target', target);
|
|
7
|
+
// @ts-ignore
|
|
7
8
|
domLink.style.opacity = 0;
|
|
9
|
+
// @ts-ignore
|
|
8
10
|
domLink.style.zIndex = -999;
|
|
9
11
|
document.body.appendChild(domLink);
|
|
10
12
|
domLink.click();
|
|
@@ -15,7 +17,9 @@ export const openLink = (link, target = '_blank') => {
|
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
export const toHref = (url, replace, newWindow) => {
|
|
20
|
+
// @ts-ignore
|
|
18
21
|
if(window.knFeishu){
|
|
22
|
+
// @ts-ignore
|
|
19
23
|
window.knFeishu.ToHref(url,replace,newWindow);
|
|
20
24
|
return;
|
|
21
25
|
}
|
|
@@ -38,7 +42,9 @@ export const isMobile = () => {
|
|
|
38
42
|
|
|
39
43
|
// 关闭页面
|
|
40
44
|
export const closeWindow = () => {
|
|
45
|
+
// @ts-ignore
|
|
41
46
|
if (window.knFeishu && window.knFeishu.closeWindow) {
|
|
47
|
+
// @ts-ignore
|
|
42
48
|
window.knFeishu.closeWindow();
|
|
43
49
|
} else {
|
|
44
50
|
if (window.close) {
|