Commit 21027599 authored by 陈俊尹's avatar 陈俊尹

更新需求内容.

parent 55f7fbf5
Pipeline #10 failed with stages
## 测试项目 ## 测试项目
### 1. 需求实现 ### 需求实现
- App 组件内, 实现 Icon 跟随鼠标移动. - App 组件内, 在组件挂载完成后, 发起网络请求获取接口数据 并定义数据结构 url: '/public/res.json'
### 2. 函数修改 - 根据网络请求结果进行组件渲染.
- 改进 AppFunction.ts 内 foo 方法的实现. components
\ No newline at end of file
| type | 说明 |
| ---- | ---- |
| img | 渲染图片组件 |
| text | 渲染文本内容 |
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
-webkit-tap-highlight-color: rgba(255, 255, 255, 0); -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
} }
#react-test-project{
margin: 80px;
}
</style> </style>
</head> </head>
...@@ -31,4 +28,4 @@ ...@@ -31,4 +28,4 @@
<div id="react-test-project"></div> <div id="react-test-project"></div>
</body> </body>
</html> </html>
\ No newline at end of file
{ {
"title": "title" "title": "title",
"components": [
{
"type": "image",
"data": "/test-assets/fp100-raw/R0012129/thumb.jpg"
},
{
"type": "image",
"data": "/test-assets/fp100-raw/R0012133/thumb.jpg"
},
{
"type": "text",
"data": "hello world"
}
]
} }
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import * as React from 'react'; import * as React from 'react';
import {Icon} from 'antd';
import {ChildComponent} from './ChildComponent';
interface AppProps { interface AppProps {
} }
...@@ -23,13 +21,8 @@ export class App extends React.Component<AppProps, AppState> { ...@@ -23,13 +21,8 @@ export class App extends React.Component<AppProps, AppState> {
} }
render() { render() {
const children = [];
for (let i = 0; i < 5000; i++) {
children.push(<ChildComponent index={i} key={i}/>);
}
return <div> return <div>
<Icon type="fullscreen-exit" /> App
{children}
</div>; </div>;
} }
} }
/**
* 子组件
* @author uglyer
* @date 2020/1/7 9:45
*/
import * as React from 'react';
import {} from 'antd';
interface ChildComponentProps {
index: number;
}
interface ChildComponentState {
}
export class ChildComponent extends React.Component<ChildComponentProps, ChildComponentState> {
constructor(props: ChildComponentProps) {
super(props);
this.state = {};
}
render() {
return <div>ChildComponent:{this.props.index}</div>;
}
}
/**
* 常用方法
* @author uglyer
* @date 2020/1/7 9:24
*/
/**
* 一个需要被改进的方法
* @param test1 测试参数
* @param handler 函数被正常执行结束回调
*/
function foo(test1: { foo?: number, foo2?: (index: number, fooValue: number) => void }, handler: () => void) {
if (test1) {
if (test1.foo) {
if (test1.foo2) {
for (let i = 0; i < 10; i++) {
test1.foo2(i, test1.foo);
// do something A
}
if (handler) {
handler();
}
} else {
// do something B
}
} else {
// do something C
}
} else {
// do something D
}
}
...@@ -10,7 +10,7 @@ const babelOptions = { ...@@ -10,7 +10,7 @@ const babelOptions = {
['import', { ['import', {
'libraryName': 'antd', 'libraryName': 'antd',
'libraryDirectory': 'es', 'libraryDirectory': 'es',
'style': 'css' 'style': 'css'
}] }]
] ]
}; };
...@@ -71,7 +71,7 @@ module.exports = { ...@@ -71,7 +71,7 @@ module.exports = {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
importLoaders: 1, importLoaders: 1,
localsConvention: 'camelCase', localsConvention: 'camelCase',
modules: { modules: {
mode: 'local', mode: 'local',
localIdentName: '[name]__[local]--[hash:base64:5]', localIdentName: '[name]__[local]--[hash:base64:5]',
...@@ -108,7 +108,7 @@ module.exports = { ...@@ -108,7 +108,7 @@ module.exports = {
devServer: { devServer: {
contentBase: path.join(__dirname, './'), contentBase: path.join(__dirname, './'),
compress: true, compress: true,
port: 7799, port: 7798,
useLocalIp: true, useLocalIp: true,
host: '0.0.0.0', host: '0.0.0.0',
overlay: true, overlay: true,
...@@ -121,16 +121,8 @@ module.exports = { ...@@ -121,16 +121,8 @@ module.exports = {
] ]
}, },
proxy: { proxy: {
'/api': { '/test-assets': {
target: 'http://police.reality3d.cn', target: 'http://nas.reality3d.cn:30002',
changeOrigin: true
},
'/file': {
target: 'http://police.reality3d.cn',
changeOrigin: true
},
'/map': {
target: 'http://127.0.0.1:5000',
changeOrigin: true changeOrigin: true
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment