Skip to content

Commit 24a00e0

Browse files
committed
feat: rm home input
1 parent 904bca7 commit 24a00e0

File tree

5 files changed

+35
-52
lines changed

5 files changed

+35
-52
lines changed

src/pages/apis/pages/device/network/index.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@
77
*/
88
import Taro from "@tarojs/taro-rn";
99
import { Button, View } from "@tarojs/components";
10+
import { useState } from "react";
11+
import JSONTree from '../../../../components/jsontree';
1012

1113
import "./index.scss";
1214

1315
const Index = () => {
16+
const [networkStatus1, setNetworkStatus1] = useState({});
17+
const [networkStatus2, setNetworkStatus2] = useState({});
1418

15-
const _handleCallback1 = (...res) => {
19+
const _handleCallback1 = (res) => {
1620
console.log("回调函数 C1", res);
21+
setNetworkStatus1(res);
1722
}
1823

19-
const _handleCallback2 = (...res) => {
24+
const _handleCallback2 = (res) => {
2025
console.log("回调函数 C2", res);
26+
setNetworkStatus2(res)
2127
}
2228

2329
return (
@@ -32,6 +38,7 @@ const Index = () => {
3238
>
3339
Taro.onNetworkStatusChange(C1)
3440
</Button>
41+
<JSONTree data={networkStatus1} />
3542
<Button
3643
type="primary"
3744
className="api-page-btn-success"
@@ -41,6 +48,7 @@ const Index = () => {
4148
>
4249
Taro.onNetworkStatusChange(C2)
4350
</Button>
51+
<JSONTree data={networkStatus2} />
4452
<Button
4553
type="primary"
4654
className="api-page-btn-warning"

src/pages/apis/pages/network/request/index.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.api-page {
44
padding: 32px;
55
&-btns {
6+
padding-bottom: 20px;
67
&-btn1 {
78
background-color: $color-success;
89
color: #fff;
@@ -12,4 +13,4 @@
1213
background-color: $color-error;
1314
}
1415
}
15-
}
16+
}

src/pages/apis/pages/network/request/index.tsx

+15-8
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@
66
* @FilePath: /taro-react-native/src/pages/apis/pages/network/request/index.tsx
77
*/
88
import Taro from '@tarojs/taro';
9-
import { View, Text, Button } from '@tarojs/components';
9+
import { View, Button } from '@tarojs/components';
10+
import { useState } from "react";
11+
import JSONTree from '../../../../components/jsontree';
1012

1113
import './index.scss'
1214

1315
const PageView = () => {
16+
const [data, setData] = useState({});
17+
1418
const _onRequest = () => {
1519
Taro.request({
16-
url: '',
20+
url: 'https://gitee.com/o2team/Taro/raw/next/package.json',
1721
data: {},
1822
header: {
1923
'content-type': 'application/json',
2024
},
21-
// success: res => {
22-
// console.log(res);
23-
// },
24-
// fail: err => {
25-
// console.log(err)
26-
// }
25+
success: res => {
26+
console.log(res);
27+
setData(res);
28+
},
29+
fail: err => {
30+
console.log(err);
31+
setData(err);
32+
}
2733
})
2834
}
2935

@@ -36,6 +42,7 @@ const PageView = () => {
3642
className="api-page-btns-btn1"
3743
>Taro.request</Button>
3844
</View>
45+
<JSONTree data={data} />
3946
</View>
4047
)
4148
}

src/pages/home/index.scss

+6-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.index {
44
flex: 1;
5-
padding-top: 120px;
5+
padding-top: 200px;
66
padding-bottom: 200px;
77
}
88

@@ -39,19 +39,13 @@
3939
.load {
4040
padding: 32px;
4141
&-header {
42-
flex-direction: row;
43-
align-items: center;
42+
flex-direction: column;
43+
align-items: flex-end;
4444
padding-left: 20px;
4545
padding-right: 20px;
46-
background-color: #ffffff;
47-
&-input {
48-
flex: 1;
49-
margin-right: 50px;
50-
font-size: $font-size-xl;
51-
}
5246
&-icon {
53-
height: 40px;
54-
width: 40px;
47+
height: 60px;
48+
width: 60px;
5549
/* #ifdef rn */
5650
tint-color: $color-brand;
5751
/* #endif */
@@ -71,7 +65,7 @@
7165
justify-content: space-between;
7266
padding: 32px;
7367
}
74-
68+
7569
&-item {
7670
padding: 28px 32px;
7771
background-color: #ffffff;

src/pages/home/index.tsx

+2-29
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { Component, Fragment } from 'react';
99
import Taro from '@tarojs/taro';
1010
import { NativeModules } from 'react-native';
11-
import { View, Text, Image, Input, Button } from '@tarojs/components'
11+
import { View, Text, Image } from '@tarojs/components'
1212
import './index.scss'
1313

1414
const DevManager = NativeModules.RNDevManager;
@@ -18,7 +18,6 @@ export default class Index extends Component<any, any> {
1818
constructor(props: any) {
1919
super(props);
2020
this.state = {
21-
inputValue: 'localhost:8081',
2221
list: [],
2322
};
2423
}
@@ -88,19 +87,6 @@ export default class Index extends Component<any, any> {
8887
})
8988
}
9089

91-
_onInputChange = e => {
92-
const value = e.detail.value;
93-
this.setState({
94-
inputValue: value
95-
});
96-
}
97-
98-
_onPressLoad = e => {
99-
const { inputValue } = this.state;
100-
this._loadBundleByUrl(inputValue);
101-
this._saveUrlToStorage(inputValue);
102-
}
103-
10490
_clearBundles = async () => {
10591
try {
10692
const res = await Taro.showModal({ title: '确定清空吗?', content: '清空后历史数据将不再保存', confirmColor: '#6190E8' });
@@ -118,7 +104,7 @@ export default class Index extends Component<any, any> {
118104
}
119105

120106
render() {
121-
const { list = [], inputValue } = this.state;
107+
const { list = [] } = this.state;
122108
return (
123109
<View className='index'>
124110
<View className='info'>
@@ -130,25 +116,12 @@ export default class Index extends Component<any, any> {
130116
</View>
131117
<View className='load'>
132118
<View className='load-header'>
133-
<Input
134-
name='input'
135-
type='text'
136-
placeholder='请输入IP:8081'
137-
value={inputValue}
138-
onInput={this._onInputChange}
139-
className='load-header-input'
140-
></Input>
141119
<Image
142120
src={require('../../assets/common/icon_scan.png')}
143121
className='load-header-icon'
144122
onClick={this._onPressScan}
145123
/>
146124
</View>
147-
<Button
148-
type='primary'
149-
className='load-btn'
150-
onClick={this._onPressLoad}
151-
>加载</Button>
152125
</View>
153126
{list.length > 0 && (
154127
<View className='bundle'>

0 commit comments

Comments
 (0)