This commit is contained in:
yehuozhili 2020-09-24 16:44:31 +08:00
parent 34df99df6f
commit f0fbca990d
9 changed files with 45 additions and 15 deletions

View File

@ -12,9 +12,11 @@ export default defineConfig({
antd: {}, antd: {},
title: '趣谈前端-h5-dooring', title: '趣谈前端-h5-dooring',
exportStatic: {}, exportStatic: {},
base: 'h5_plus', base: '/',
publicPath: '/h5_plus/', publicPath: './',
outputPath: '../server/static/h5_plus', outputPath: 'dist',
esbuild: {},
routes: [ routes: [
{ {

View File

@ -27,7 +27,8 @@
"postinstall": "umi generate tmp", "postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test", "test": "umi-test",
"test:coverage": "umi-test --coverage" "test:coverage": "umi-test --coverage",
"nocompress": "cross-env RM_TMPDIR=none COMPRESS=none umi build"
}, },
"gitHooks": { "gitHooks": {
"pre-commit": "lint-staged" "pre-commit": "lint-staged"
@ -51,6 +52,7 @@
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.2.1", "@ant-design/icons": "^4.2.1",
"@antv/f2": "^3.7.7", "@antv/f2": "^3.7.7",
"@umijs/plugin-esbuild": "^1.0.1",
"@umijs/plugin-sass": "^1.1.1", "@umijs/plugin-sass": "^1.1.1",
"@umijs/preset-react": "1.x", "@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.19", "@umijs/test": "^3.2.19",
@ -96,6 +98,7 @@
"@typescript-eslint/parser": "4.1.1", "@typescript-eslint/parser": "4.1.1",
"babel-eslint": "10.x", "babel-eslint": "10.x",
"babel-plugin-import": "^1.13.0", "babel-plugin-import": "^1.13.0",
"cross-env": "^7.0.2",
"eslint": "6.x", "eslint": "6.x",
"eslint-config-react-app": "^5.2.1", "eslint-config-react-app": "^5.2.1",
"eslint-plugin-flowtype": "4.x", "eslint-plugin-flowtype": "4.x",

View File

@ -1,12 +1,9 @@
import { createLogger } from 'redux-logger';
import { message } from 'antd'; import { message } from 'antd';
import undoable, { StateWithHistory } from 'redux-undo'; import undoable, { StateWithHistory } from 'redux-undo';
import { Reducer, AnyAction } from 'redux'; import { Reducer, AnyAction } from 'redux';
import { isDev } from './utils/tool';
export const dva = { export const dva = {
config: { config: {
onAction: isDev ? createLogger() : undefined,
onError(e: Error) { onError(e: Error) {
message.error(e.message, 3); message.error(e.message, 3);
}, },

View File

@ -79,12 +79,12 @@ export default function Calibration(props: CalibrationTypes) {
let height = calibrationLength.height let height = calibrationLength.height
? calibrationLength.height ? calibrationLength.height
: calibrationRef.current.getBoundingClientRect().height; : calibrationRef.current.getBoundingClientRect().height;
let arr = [...calibrationRef.current.querySelectorAll('.calibrationLine')]; let arr = [...Array.from(calibrationRef.current.querySelectorAll('.calibrationLine'))];
if (arr.length) { if (arr.length) {
if (direction === 'up') { if (direction === 'up') {
calibrationRef.current.style.width = parseFloat(multiple.toFixed(1)) * width + 'px'; calibrationRef.current.style.width = parseFloat(multiple.toFixed(1)) * width + 'px';
arr.forEach(el => { arr.forEach(el => {
let dom = [...el.querySelectorAll('.calibrationNumber')][0] as HTMLElement; let dom = [...Array.from(el.querySelectorAll('.calibrationNumber'))][0] as HTMLElement;
if (dom) { if (dom) {
dom.style.transform = `translate3d(-4px, 16px, 0px) scale(${(multiple + 0.1).toFixed( dom.style.transform = `translate3d(-4px, 16px, 0px) scale(${(multiple + 0.1).toFixed(
1, 1,
@ -94,7 +94,7 @@ export default function Calibration(props: CalibrationTypes) {
} else { } else {
calibrationRef.current.style.height = parseFloat(multiple.toFixed(1)) * height + 'px'; calibrationRef.current.style.height = parseFloat(multiple.toFixed(1)) * height + 'px';
arr.forEach(el => { arr.forEach(el => {
let dom = [...el.querySelectorAll('.calibrationNumber')][0] as HTMLElement; let dom = [...Array.from(el.querySelectorAll('.calibrationNumber'))][0] as HTMLElement;
if (dom) { if (dom) {
dom.style.transform = `translate3d(-4px, -8px, 0px) scale(${(multiple + 0.1).toFixed( dom.style.transform = `translate3d(-4px, -8px, 0px) scale(${(multiple + 0.1).toFixed(
1, 1,

View File

@ -6,7 +6,7 @@ import React from 'react';
export type componentsType = 'media' | 'base' | 'visible'; export type componentsType = 'media' | 'base' | 'visible';
const DynamicFunc = (type: any, componentsType: string) => const DynamicFunc = (type: string, componentsType: string) =>
dynamic({ dynamic({
loader: async function() { loader: async function() {
let Component: FC<{ isTpl: boolean }>; let Component: FC<{ isTpl: boolean }>;
@ -35,7 +35,7 @@ const DynamicFunc = (type: any, componentsType: string) =>
type DynamicType = { type DynamicType = {
isTpl: boolean; isTpl: boolean;
config: { [key: string]: any }; config: { [key: string]: any };
type: any; type: string;
componentsType: componentsType; componentsType: componentsType;
category: string; category: string;
}; };
@ -44,7 +44,7 @@ const DynamicEngine = memo((props: DynamicType) => {
const Dynamic = useMemo(() => { const Dynamic = useMemo(() => {
return (DynamicFunc(type, category) as unknown) as FC<DynamicType>; return (DynamicFunc(type, category) as unknown) as FC<DynamicType>;
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [type, config]); }, [config]);
return <Dynamic {...props} />; return <Dynamic {...props} />;
}); });

View File

@ -111,6 +111,7 @@ const Container = (props: { history?: any; location?: any; pstate?: any; dispatc
const [render] = useGetBall(setDragState, { const [render] = useGetBall(setDragState, {
innerStyle: { top: '10px', left: '10px', cursor: 'pointer' }, innerStyle: { top: '10px', left: '10px', cursor: 'pointer' },
ratioSpeed: { x: 1.2, y: 1.2 }, ratioSpeed: { x: 1.2, y: 1.2 },
intervalDelay: 5,
}); });
return ( return (

View File

@ -102,6 +102,7 @@ const SourceBox = memo((props: SourceBoxProps) => {
return ( return (
<Draggable <Draggable
position={dragState} position={dragState}
handle=".js_box"
onStop={(e: DraggableEvent, data: DraggableData) => { onStop={(e: DraggableEvent, data: DraggableData) => {
setDragState({ x: data.x, y: data.y }); setDragState({ x: data.x, y: data.y });
}} }}

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es5",
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "node",
"jsx": "react", "jsx": "react",

View File

@ -2716,6 +2716,13 @@
dva-immer "^0.4.19" dva-immer "^0.4.19"
dva-loading "^3.0.20" dva-loading "^3.0.20"
"@umijs/plugin-esbuild@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@umijs/plugin-esbuild/-/plugin-esbuild-1.0.1.tgz#7162a31d686340bd70dfe001bfb70e7d25afa192"
integrity sha512-YyxO33GFzy0s6HifHOjNqLkNxxxNJDaQ4tHKmYm5jO60LZ6A65R7O/ei1+EDKanudmpwU5Y+jevvVzzYbqmV4g==
dependencies:
esbuild-webpack-plugin "^1.0.0-beta.3"
"@umijs/plugin-helmet@1.1.1": "@umijs/plugin-helmet@1.1.1":
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/@umijs/plugin-helmet/-/plugin-helmet-1.1.1.tgz#841aea37b5076b51c2f332659bf9c671cf63794d" resolved "https://registry.yarnpkg.com/@umijs/plugin-helmet/-/plugin-helmet-1.1.1.tgz#841aea37b5076b51c2f332659bf9c671cf63794d"
@ -4953,7 +4960,14 @@ crequire@1.8.1:
resolved "https://registry.yarnpkg.com/crequire/-/crequire-1.8.1.tgz#ac81f204786b5f201194eb1698cf441b10a4b57d" resolved "https://registry.yarnpkg.com/crequire/-/crequire-1.8.1.tgz#ac81f204786b5f201194eb1698cf441b10a4b57d"
integrity sha1-rIHyBHhrXyARlOsWmM9EGxCktX0= integrity sha1-rIHyBHhrXyARlOsWmM9EGxCktX0=
cross-spawn@7.0.3, cross-spawn@^7.0.0: cross-env@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9"
integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==
dependencies:
cross-spawn "^7.0.1"
cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.1:
version "7.0.3" version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@ -5899,6 +5913,18 @@ es6-weak-map@^2.0.2:
es6-iterator "^2.0.3" es6-iterator "^2.0.3"
es6-symbol "^3.1.1" es6-symbol "^3.1.1"
esbuild-webpack-plugin@^1.0.0-beta.3:
version "1.0.5"
resolved "https://registry.yarnpkg.com/esbuild-webpack-plugin/-/esbuild-webpack-plugin-1.0.5.tgz#68a6a377a84c991da1a0fc302830f514c9d47472"
integrity sha512-X/ektio8dxHD/bYk1BhT7XZw7U1ZJDu8VRjhc81W12Mizw0Fti+Wp4W4u1e9PiMdeDz/SXAO3U0A37wV7XT0wA==
dependencies:
esbuild "^0.6.8"
esbuild@^0.6.8:
version "0.6.34"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.6.34.tgz#76565a60e006f45d5f273b6e59e61ed0816551f5"
integrity sha512-InRdL/Q96pUucPqovJzvuLhquZr6jOn81FDVwFjCKz1rYKIm9OdOC+7Fs4vr6x48vKBl5LzKgtjU39BUpO636A==
escalade@^3.0.2: escalade@^3.0.2:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e"