Skip to content

Commit 2f57308

Browse files
committed
fix
1 parent e31adc2 commit 2f57308

File tree

22 files changed

+305
-63
lines changed

22 files changed

+305
-63
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = {
4545
'default-case': 2,
4646
'no-spaced-func': 2,
4747
'no-case-declarations': 0,
48+
'no-sparse-arrays': 0,
4849
// react jsx
4950
'react/display-name': 0,
5051
'react/jsx-filename-extension': 'off',
@@ -61,15 +62,14 @@ module.exports = {
6162
'@typescript-eslint/no-use-before-define': 0,
6263
'@typescript-eslint/member-delimiter-style': 0,
6364
'@typescript-eslint/no-unused-vars': 0,
64-
'@typescript-eslint/no-use-before-define': 0,
6565
'@typescript-eslint/no-explicit-any': 0,
6666
'@typescript-eslint/explicit-member-accessibility': 0,
6767
'@typescript-eslint/no-angle-bracket-type-assertion': 0,
6868
'@typescript-eslint/interface-name-prefix': 0,
6969
'@typescript-eslint/no-empty-function': 1,
7070
'@typescript-eslint/semi': 0,
7171
'@typescript-eslint/no-inferrable-types': 0,
72-
'@typescript-eslint/no-empty-interface': 1,
72+
'@typescript-eslint/no-empty-interface': 0,
7373
'@typescript-eslint/class-name-casing': 0,
7474
}
7575
};

build/donePlugin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
class DonePlugin {
3+
apply(compiler) {
4+
compiler.hooks.done.tap('DonePlugin', (stats) => {
5+
console.log('编译完成....')
6+
// console.log(stats)
7+
})
8+
}
9+
}
10+
11+
module.exports = DonePlugin

build/px2rem-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const loaderUtils = require('loader-utils')
22

3-
const pxReg = /\b(\d+(\.\d+)?)PX\b/g
3+
const pxReg = /\b(\d+(\.\d+)?)px\b/g
44

55
module.exports = function(content) {
66

build/webpack.base.conf.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const path = require('path'),
66
ManifestPlugin = require('webpack-manifest-plugin'),
77
SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
88

9+
const DonePlugin = require('./donePlugin')
910
const _PROD_ = process.env.NODE_ENV === 'production';
1011

1112
const resolve = (dir) => {
@@ -42,14 +43,14 @@ module.exports = {
4243
// transpileOnly: true
4344
// }
4445
// },
45-
{
46-
test: /\.(j|t)sx?$/,
47-
loader: 'px2rem-loader',
48-
options: {
49-
remRoot: 40,
50-
fixed: 6
51-
}
52-
},
46+
// {
47+
// test: /\.(j|t)sx?$/,
48+
// loader: 'px2rem-loader',
49+
// options: {
50+
// remRoot: 40,
51+
// fixed: 6
52+
// }
53+
// },
5354
{
5455
test: /\.(j|t)sx?$/,
5556
include: [
@@ -67,7 +68,7 @@ module.exports = {
6768
exclude: ['transform-typeof-symbol'],
6869
}],
6970
["@babel/preset-react", {
70-
"targets": "last 2 versions, ie 11", "modules": false
71+
targets: "last 2 versions, ie 11", modules: false
7172
}],
7273
["@babel/preset-typescript"]
7374
],
@@ -181,6 +182,8 @@ module.exports = {
181182
},
182183

183184
plugins: [
185+
// new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /zh-cn/),
186+
new DonePlugin(),
184187
// new webpack.DefinePlugin({
185188
// "process.env": {
186189
// NODE_ENV: JSON.stringify(_PROD_ ? "development" : "production")

build/webpack.prod.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const webpackConfig = merge(baseWebpackConfig, {
2121
new UglifyJsPlugin({
2222
uglifyOptions: {
2323
compress: {
24-
warnings: false,
24+
// warnings: false,
2525
drop_console: _PROD_ ? true : false,
2626
},
2727
output: {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"echarts": "^4.2.0-rc.2",
2626
"mobx": "^5.15.0",
2727
"mobx-react": "^6.1.4",
28-
"quill": "^1.3.6",
28+
"quill": "^1.3.7",
29+
"quill-image-resize-module": "^3.0.0",
2930
"react": "^16.11.0",
3031
"react-dom": "^16.11.0",
3132
"react-router-dom": "^5.1.2"

src/@types/global.d.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { MessageApi } from 'antd/lib/message'
22
import { NotificationApi } from 'antd/lib/notification'
33
import { RouteComponentProps } from 'react-router-dom'
4-
import { AxiosInstance } from 'axios'
4+
import { AxiosStatic } from 'axios'
5+
56

67
declare global {
7-
export const $http: AxiosInstance
88

99
export const $msg: MessageApi
1010

@@ -13,4 +13,31 @@ declare global {
1313
export interface IProps extends RouteComponentProps {
1414
[key: string]: any
1515
}
16+
17+
interface IResponseData<T = any> {
18+
data: T
19+
msg: string
20+
status: number
21+
}
22+
23+
interface IPageData<T = any> {
24+
data: T[]
25+
meta: {
26+
count?: number
27+
page: number
28+
pageSize: number
29+
total?: number
30+
totalPage?: number
31+
showTotal?: (total: number) => React.ReactNode
32+
}
33+
msg?: string
34+
status?: number
35+
}
36+
37+
type IPageParams = Pick<IPageData['meta'], 'page' | 'pageSize'>
38+
39+
interface IOption<V = any, L = string> {
40+
label: L
41+
value: V
42+
}
1643
}

src/components/editor/index.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import * as React from 'react'
22
import { QuillOptionsStatic } from 'quill'
33
import * as Q from 'quill'
4+
// const ImageResize = require('quill-image-resize-module/src/ImageResize.js');
5+
// console.log(ImageResize, 'imageresize')
6+
interface IQuillOptions extends QuillOptionsStatic {
7+
// imageResize: {
8+
// displaySize: boolean
9+
// }
10+
}
411

512
const Quill: any = Q
13+
// Quill.register('modules/imageResize', ImageResize)
614

715
const toolbarOptions = [
816
['bold', 'italic', 'underline', 'strike'], // toggled buttons
@@ -37,8 +45,11 @@ export default class QuillEditorComponent extends React.Component<IEditor> {
3745
oldVal: string = ''
3846

3947
quillEditor: any = null
40-
quillOptions: QuillOptionsStatic = {
48+
quillOptions: IQuillOptions = {
4149
// debug: false,
50+
imageResize: {
51+
displaySize: true // default false
52+
},
4253
modules: {
4354
toolbar: toolbarOptions,
4455
},

src/pages/dashboard/dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class Dashboard extends React.Component {
55
return <div>
66
<p>Welcome to Dashboard!</p>
77
<div>GraphQL Application. </div>
8-
<p style={{width: '400PX', height: 40, fontSize: '24px'}}>测试rem</p>
8+
{/* <p style={{width: '400px', height: '40PX', fontSize: '24px'}}>测试rem</p> */}
99
<div>66px</div>
1010
</div>
1111
}

src/pages/demo/demoRedux.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from 'react'
22
import { Row, Col, Button, Badge, Icon, Form, Input, Select } from 'antd'
33
import { ReduxProvider, connect } from '../../plugins/react-redux'
44
import { store, countActions } from './reducer'
5-
import { HookButton } from './demoHooks'
65

76
console.log(store.getState(), '---store')
87

@@ -62,7 +61,6 @@ class DemoRedux extends React.Component<any> {
6261
<Button onClick={ADD}>
6362
<Icon type="plus" />
6463
</Button>
65-
<HookButton></HookButton>
6664
</Col>
6765
</Row>
6866
</section>

0 commit comments

Comments
 (0)