ipanel-rnapp-ajb-base 1.0.0
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/app/.local_dev/DemoPage.js +46 -0
- package/app/.local_dev/env.js +1 -0
- package/app/.local_dev/polyfill.js +83 -0
- package/app/App.js +485 -0
- package/app/api/homedApi.js +42 -0
- package/app/api/index.js +2 -0
- package/app/api/ipanelCloudApi.js +796 -0
- package/app/assets/img/add.png +0 -0
- package/app/assets/img/add_img.png +0 -0
- package/app/assets/img/album.png +0 -0
- package/app/assets/img/album2.png +0 -0
- package/app/assets/img/album3.png +0 -0
- package/app/assets/img/album@2x.png +0 -0
- package/app/assets/img/album@3x.png +0 -0
- package/app/assets/img/audioRecordBar.png +0 -0
- package/app/assets/img/bootom_bar_bg.png +0 -0
- package/app/assets/img/close.png +0 -0
- package/app/assets/img/computer.png +0 -0
- package/app/assets/img/confirm.png +0 -0
- package/app/assets/img/delete_pic.png +0 -0
- package/app/assets/img/disabled.png +0 -0
- package/app/assets/img/goBack.png +0 -0
- package/app/assets/img/goBack2.png +0 -0
- package/app/assets/img/ischeck.png +0 -0
- package/app/assets/img/launch_bg.png +0 -0
- package/app/assets/img/launch_bg_panyu.png +0 -0
- package/app/assets/img/launch_logo.png +0 -0
- package/app/assets/img/launch_logo_panyu.png +0 -0
- package/app/assets/img/launch_text.png +0 -0
- package/app/assets/img/launch_text_panyu.png +0 -0
- package/app/assets/img/link.png +0 -0
- package/app/assets/img/login_bg.png +0 -0
- package/app/assets/img/login_bg_new.png +0 -0
- package/app/assets/img/login_left.png +0 -0
- package/app/assets/img/login_right.png +0 -0
- package/app/assets/img/nocheck.png +0 -0
- package/app/assets/img/personal.png +0 -0
- package/app/assets/img/photo.png +0 -0
- package/app/assets/img/photo@2x.png +0 -0
- package/app/assets/img/photo@3x.png +0 -0
- package/app/assets/img/protocol_checked.png +0 -0
- package/app/assets/img/qiehuan.png +0 -0
- package/app/assets/img/scan_border_bottom_left.png +0 -0
- package/app/assets/img/scan_border_bottom_right.png +0 -0
- package/app/assets/img/scan_border_top_left.png +0 -0
- package/app/assets/img/scan_border_top_right.png +0 -0
- package/app/assets/img/scan_move.png +0 -0
- package/app/assets/img/szjt.png +0 -0
- package/app/assets/img/tab.png +0 -0
- package/app/assets/img/tykz.png +0 -0
- package/app/assets/img/update_bg.png +0 -0
- package/app/assets/img/video.png +0 -0
- package/app/assets/img/video@2x.png +0 -0
- package/app/assets/img/video@3x.png +0 -0
- package/app/assets/img/worker.png +0 -0
- package/app/assets/img/wx.png +0 -0
- package/app/assets/img/ykq.png +0 -0
- package/app/assets/img/zfb.png +0 -0
- package/app/base.js +342 -0
- package/app/components/VersionUpdateConfirm.js +117 -0
- package/app/components/common/AccordionCell/index.js +67 -0
- package/app/components/common/ActionPicker/BasicPicker.js +136 -0
- package/app/components/common/ActionPicker/index.js +106 -0
- package/app/components/common/AddressPicker/index.js +211 -0
- package/app/components/common/Card/index.js +19 -0
- package/app/components/common/Cell/index.js +381 -0
- package/app/components/common/CustomDialog/index.js +120 -0
- package/app/components/common/CustomTabBar/index.js +157 -0
- package/app/components/common/CustomTabBar_bak/TabBarInput.js +210 -0
- package/app/components/common/CustomTabBar_bak/index.js +832 -0
- package/app/components/common/DateTimingPicker/index.js +254 -0
- package/app/components/common/Dialog/Notify.js +36 -0
- package/app/components/common/Dialog/baseDialog.js +146 -0
- package/app/components/common/Dialog/index.js +113 -0
- package/app/components/common/Dialog/prompt.js +145 -0
- package/app/components/common/Dialog/quickSelect.js +54 -0
- package/app/components/common/Dialog/select.js +125 -0
- package/app/components/common/Dialog/styles.js +167 -0
- package/app/components/common/Loading/index.js +71 -0
- package/app/components/common/LoginType/index.js +171 -0
- package/app/components/common/LoginType/protocol.js +160 -0
- package/app/components/common/Notify/index.js +68 -0
- package/app/components/common/OnceTouchable/index.js +33 -0
- package/app/components/common/PaymentPicker/index.js +264 -0
- package/app/components/common/ProductOrderPicker/index.js +524 -0
- package/app/components/common/ScreenBackHeader/index.js +144 -0
- package/app/components/common/ScrollPicker/index.js +232 -0
- package/app/components/common/SelectPicker/index.js +171 -0
- package/app/components/common/SmsCodeInput/index.js +93 -0
- package/app/components/common/SmsCodeInput/indexNew.js +101 -0
- package/app/components/common/Steps/index.js +126 -0
- package/app/components/common/Tag/index.js +17 -0
- package/app/components/common/Toast/index.js +103 -0
- package/app/components/common/WeekDaysPicker/index.js +196 -0
- package/app/components/index.js +8 -0
- package/app/components/iot/AddDeviceActionSheet/index.js +934 -0
- package/app/components/iot/AddressActionSheet/index.js +91 -0
- package/app/components/iot/RoomActionSheet/index.js +205 -0
- package/app/components/iot/ViewDeviceActionSheet/index.js +834 -0
- package/app/components/sheets.js +30 -0
- package/app/eventBus/index.js +54 -0
- package/app/hooks/checkLogin.js +30 -0
- package/app/hooks/shopMessageManager.js +308 -0
- package/app/hooks/useAddress.js +179 -0
- package/app/hooks/useAddress2.js +587 -0
- package/app/hooks/useDebounceFn.js +6 -0
- package/app/hooks/useDynamicPackages.js +22 -0
- package/app/hooks/useKeyboard.js +25 -0
- package/app/hooks/useLatest.js +10 -0
- package/app/hooks/useMessageManager.js +368 -0
- package/app/hooks/useNavigationFocus.js +19 -0
- package/app/hooks/useUser.js +56 -0
- package/app/screens/BaseScreen.js +389 -0
- package/app/screens/CommonScreens/BindPhoneScreen/index.js +179 -0
- package/app/screens/CommonScreens/BossScreen/index.js +138 -0
- package/app/screens/CommonScreens/DeviceAnswerDetailScreen/index.js +50 -0
- package/app/screens/CommonScreens/DeviceFeedbackScreen/index.js +365 -0
- package/app/screens/CommonScreens/EditInvoiceTitleScreen/index.js +279 -0
- package/app/screens/CommonScreens/FamilyDetailScreen/index.js +421 -0
- package/app/screens/CommonScreens/InvoiceTitleListScreen/index.js +118 -0
- package/app/screens/CommonScreens/OperatorSelectScreen/index.js +315 -0
- package/app/screens/CommonScreens/PersonalScreen/index.js +348 -0
- package/app/screens/CommonScreens/ScanQRCodeScreen/index.js +407 -0
- package/app/screens/CommonScreens/TvAlbumScreen/index.js +407 -0
- package/app/screens/LoginScreen/OpenLogSheet.js +241 -0
- package/app/screens/LoginScreen/index.js +920 -0
- package/app/screens/LoginScreen/indexNew.js +1354 -0
- package/app/screens/ResePassword/index.js +364 -0
- package/app/screens/SbkScreen.js +19 -0
- package/app/screens/WebviewScreen.js +41 -0
- package/app/storage/index.js +166 -0
- package/app/utils/EventEmitter.js +43 -0
- package/app/utils/RootNavigation.js +32 -0
- package/app/utils/SBK_plugin/convert.js +90 -0
- package/app/utils/SBK_plugin/convertStatus.js +250 -0
- package/app/utils/SBK_plugin/eventProcess.js +339 -0
- package/app/utils/SBK_plugin/index.js +32 -0
- package/app/utils/SBK_plugin/ipanelDeviceToSbkDevice.js +68 -0
- package/app/utils/SBK_plugin/sbk_defs.js +191 -0
- package/app/utils/StyleComposite.js +37 -0
- package/app/utils/applyPermissions.js +251 -0
- package/app/utils/bundleUpdater.js +46 -0
- package/app/utils/common.js +380 -0
- package/app/utils/config.js +47 -0
- package/app/utils/errCodes.js +3 -0
- package/app/utils/homedData.js +57 -0
- package/app/utils/http.js +178 -0
- package/app/utils/notice.js +15 -0
- package/app/utils/priceConversion.js +30 -0
- package/app/utils/registerDialog.js +90 -0
- package/app/utils/scaleSize.js +12 -0
- package/app/utils/soundPlayer.js +85 -0
- package/bin/local-dev.js +7 -0
- package/index.js +8 -0
- package/package.json +18 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import React, {useState, useEffect} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableHighlight,
|
|
7
|
+
ScrollView,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
import ScreenBackHeader from '../../../components/common/ScreenBackHeader';
|
|
12
|
+
import {Icon, Divider} from '@rneui/themed';
|
|
13
|
+
|
|
14
|
+
import {getTreeOptions, getTreeChildOptions, switchToken} from '../../../api';
|
|
15
|
+
|
|
16
|
+
import storage from '../../../storage';
|
|
17
|
+
import px from '../../../utils/scaleSize';
|
|
18
|
+
import {replace} from '../../../utils/RootNavigation';
|
|
19
|
+
|
|
20
|
+
const Index = ({route}) => {
|
|
21
|
+
const [selectedAreaPath, setSelectedAreaPath] = useState([]);
|
|
22
|
+
const [currentList, setCurrentList] = useState([]);
|
|
23
|
+
const [curViewIsOperatorView, setCurViewIsOperatorView] = useState(false);
|
|
24
|
+
const [selectedOperator, setSelectedOperator] = useState({});
|
|
25
|
+
|
|
26
|
+
// 目的 toggle目的 init初始化
|
|
27
|
+
const purpose = route.params?.purpose || 'toggle';
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
initProvices();
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
const initProvices = async () => {
|
|
34
|
+
setSelectedAreaPath([]);
|
|
35
|
+
setCurViewIsOperatorView(false);
|
|
36
|
+
const result = await getTreeOptions({
|
|
37
|
+
context_id: 10000,
|
|
38
|
+
});
|
|
39
|
+
if (result.code === 0) {
|
|
40
|
+
setCurrentList(result.option_list[0].children);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const login_apartment = async name => {
|
|
45
|
+
if (name === '内蒙古广电网络') {
|
|
46
|
+
const apartmentRes = await switchToken();
|
|
47
|
+
if (apartmentRes?.code === 200 && apartmentRes?.token) {
|
|
48
|
+
storage.set('apartmentToken', apartmentRes.token);
|
|
49
|
+
// 公寓人员信息接口暂时还没,假设role:1为房东
|
|
50
|
+
storage.set('apartmentData', {role: 1});
|
|
51
|
+
} else {
|
|
52
|
+
storage.set('apartmentData', {});
|
|
53
|
+
storage.set('apartmentToken', '');
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
storage.set('apartmentData', {});
|
|
57
|
+
storage.set('apartmentToken', '');
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleSave = () => {
|
|
62
|
+
console.log(selectedOperator);
|
|
63
|
+
const cb = async () => {
|
|
64
|
+
const accountData = await storage.get('accountData');
|
|
65
|
+
await storage.set(
|
|
66
|
+
`${accountData?.account?.account_id || ''}currentOperator`,
|
|
67
|
+
selectedOperator,
|
|
68
|
+
);
|
|
69
|
+
if (purpose === 'toggle') {
|
|
70
|
+
global.loading.showLoading('正在切换版本');
|
|
71
|
+
await login_apartment(selectedOperator.name);
|
|
72
|
+
await global.base.reload();
|
|
73
|
+
global.loading.hideLoading();
|
|
74
|
+
} else {
|
|
75
|
+
await login_apartment(selectedOperator.name);
|
|
76
|
+
replace('Home');
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
if (!selectedOperator.id) {
|
|
81
|
+
global.dialog.confirm({
|
|
82
|
+
title: `未选择运营商,将${
|
|
83
|
+
purpose === 'toggle' ? '切换到' : '加载'
|
|
84
|
+
}标准版`,
|
|
85
|
+
confirmButtonText: '确定',
|
|
86
|
+
confirmCallback: cb,
|
|
87
|
+
cancelButtonText: purpose === 'toggle' ? '取消' : '跳过',
|
|
88
|
+
cancelCallback: () => {},
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
global.dialog.confirm({
|
|
92
|
+
title: `您将${purpose === 'toggle' ? '切换' : '加载'}到${
|
|
93
|
+
selectedOperator.name
|
|
94
|
+
}版本`,
|
|
95
|
+
confirmButtonText: '确定',
|
|
96
|
+
confirmCallback: cb,
|
|
97
|
+
cancelButtonText: '取消',
|
|
98
|
+
cancelCallback: () => {},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const headerRight = () => {
|
|
104
|
+
const textStyle = {
|
|
105
|
+
fontSize: 16,
|
|
106
|
+
color: '#000',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<TouchableHighlight
|
|
111
|
+
activeOpacity={0.7}
|
|
112
|
+
underlayColor="#dfdfdf"
|
|
113
|
+
onPress={handleSave}>
|
|
114
|
+
<Text style={textStyle}>确定</Text>
|
|
115
|
+
</TouchableHighlight>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const is4thDepthNode = node => {
|
|
120
|
+
return (
|
|
121
|
+
node.id.length === 12 &&
|
|
122
|
+
node.id.substr(6, 3) !== '000' &&
|
|
123
|
+
node.id.endsWith('000')
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const loadChildNodes = async pNode => {
|
|
128
|
+
let result;
|
|
129
|
+
|
|
130
|
+
if (is4thDepthNode(pNode)) {
|
|
131
|
+
// 获取运营商列表
|
|
132
|
+
result = await getTreeChildOptions({
|
|
133
|
+
context_id: 10003,
|
|
134
|
+
option_id: pNode.id,
|
|
135
|
+
});
|
|
136
|
+
} else {
|
|
137
|
+
// 获取下一级区域
|
|
138
|
+
result = await getTreeChildOptions({
|
|
139
|
+
context_id: 10000,
|
|
140
|
+
option_id: pNode.id,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return result.option_list || [];
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// 选择区域或运营商
|
|
148
|
+
const handleSelectArea = async item => {
|
|
149
|
+
if (curViewIsOperatorView) {
|
|
150
|
+
// 选择运营商
|
|
151
|
+
if (selectedOperator.id === item.id) {
|
|
152
|
+
setSelectedOperator({});
|
|
153
|
+
} else {
|
|
154
|
+
setSelectedOperator(item);
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
setSelectedOperator({});
|
|
159
|
+
|
|
160
|
+
let operatorFlag = false;
|
|
161
|
+
|
|
162
|
+
const list = await loadChildNodes(item);
|
|
163
|
+
|
|
164
|
+
console.log(JSON.stringify(item));
|
|
165
|
+
|
|
166
|
+
if (is4thDepthNode(item)) {
|
|
167
|
+
// 获取运营商列表
|
|
168
|
+
operatorFlag = true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
setCurViewIsOperatorView(operatorFlag);
|
|
172
|
+
|
|
173
|
+
let arr = [...selectedAreaPath, item];
|
|
174
|
+
|
|
175
|
+
setSelectedAreaPath(arr);
|
|
176
|
+
|
|
177
|
+
setCurrentList(list);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// 点击区域路径
|
|
181
|
+
const handleAreaBackTo = async area => {
|
|
182
|
+
const index = selectedAreaPath.findIndex(item => item.id === area.id);
|
|
183
|
+
|
|
184
|
+
const arr = selectedAreaPath.slice(0, index);
|
|
185
|
+
setSelectedAreaPath(arr);
|
|
186
|
+
setSelectedOperator({});
|
|
187
|
+
|
|
188
|
+
if (!arr[arr.length - 1]) {
|
|
189
|
+
initProvices();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const list = await loadChildNodes(arr[arr.length - 1]);
|
|
194
|
+
|
|
195
|
+
setCurViewIsOperatorView(false);
|
|
196
|
+
setCurrentList(list);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<View style={styles.container}>
|
|
201
|
+
<ScreenBackHeader title="选择运营商" headerRight={headerRight} />
|
|
202
|
+
<Divider width={px(12)} color="#F5F5F5" />
|
|
203
|
+
<View style={styles.selectedAreaPath}>
|
|
204
|
+
<ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
|
|
205
|
+
{selectedAreaPath.length > 0 ? (
|
|
206
|
+
selectedAreaPath.map(area => {
|
|
207
|
+
return (
|
|
208
|
+
<TouchableOpacity
|
|
209
|
+
key={area.id}
|
|
210
|
+
activeOpacity={0.6}
|
|
211
|
+
onPress={() => handleAreaBackTo(area)}>
|
|
212
|
+
<View style={styles.areaPathTextItem}>
|
|
213
|
+
<Text style={styles.areaPathTextItemText}>{area.name}</Text>
|
|
214
|
+
</View>
|
|
215
|
+
</TouchableOpacity>
|
|
216
|
+
);
|
|
217
|
+
})
|
|
218
|
+
) : (
|
|
219
|
+
<View style={styles.areaPathTextItem}>
|
|
220
|
+
<Text style={styles.areaPathTextItemText}>请选择区域</Text>
|
|
221
|
+
</View>
|
|
222
|
+
)}
|
|
223
|
+
</ScrollView>
|
|
224
|
+
</View>
|
|
225
|
+
|
|
226
|
+
<View style={styles.content}>
|
|
227
|
+
<ScrollView>
|
|
228
|
+
{currentList.map(item => {
|
|
229
|
+
const isSelectingOperator =
|
|
230
|
+
selectedOperator.id === item.id && curViewIsOperatorView;
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<React.Fragment key={item.id}>
|
|
234
|
+
<TouchableOpacity
|
|
235
|
+
activeOpacity={0.7}
|
|
236
|
+
onPress={() => handleSelectArea(item)}>
|
|
237
|
+
<View
|
|
238
|
+
style={[
|
|
239
|
+
styles.item,
|
|
240
|
+
isSelectingOperator && styles.selectedOperator,
|
|
241
|
+
]}>
|
|
242
|
+
<Text
|
|
243
|
+
style={[
|
|
244
|
+
styles.itemText,
|
|
245
|
+
isSelectingOperator && styles.selectedOperatorText,
|
|
246
|
+
]}>
|
|
247
|
+
{item.name}
|
|
248
|
+
</Text>
|
|
249
|
+
{isSelectingOperator && (
|
|
250
|
+
<Icon
|
|
251
|
+
name="checkmark-sharp"
|
|
252
|
+
type="ionicon"
|
|
253
|
+
size={20}
|
|
254
|
+
color={styles.selectedOperatorText.color}
|
|
255
|
+
/>
|
|
256
|
+
)}
|
|
257
|
+
</View>
|
|
258
|
+
</TouchableOpacity>
|
|
259
|
+
<Divider color="#F5F5F5" />
|
|
260
|
+
</React.Fragment>
|
|
261
|
+
);
|
|
262
|
+
})}
|
|
263
|
+
</ScrollView>
|
|
264
|
+
</View>
|
|
265
|
+
</View>
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const styles = StyleSheet.create({
|
|
270
|
+
container: {
|
|
271
|
+
flex: 1,
|
|
272
|
+
backgroundColor: '#fff',
|
|
273
|
+
flexDirection: 'column',
|
|
274
|
+
},
|
|
275
|
+
selectedAreaPath: {
|
|
276
|
+
paddingHorizontal: 15,
|
|
277
|
+
marginBottom: 10,
|
|
278
|
+
backgroundColor: '#fefefe',
|
|
279
|
+
borderBottomWidth: 1,
|
|
280
|
+
borderBottomColor: '#f8f8f8',
|
|
281
|
+
},
|
|
282
|
+
areaPathTextItem: {
|
|
283
|
+
height: 60,
|
|
284
|
+
justifyContent: 'center',
|
|
285
|
+
paddingRight: 20,
|
|
286
|
+
},
|
|
287
|
+
areaPathTextItemText: {
|
|
288
|
+
fontSize: px(46),
|
|
289
|
+
color: '#333',
|
|
290
|
+
fontWeight: 'bold',
|
|
291
|
+
},
|
|
292
|
+
content: {
|
|
293
|
+
flex: 1,
|
|
294
|
+
},
|
|
295
|
+
item: {
|
|
296
|
+
height: 50,
|
|
297
|
+
flexDirection: 'row',
|
|
298
|
+
alignItems: 'center',
|
|
299
|
+
paddingHorizontal: 15,
|
|
300
|
+
},
|
|
301
|
+
itemText: {
|
|
302
|
+
fontSize: px(46),
|
|
303
|
+
color: '#333',
|
|
304
|
+
fontWeight: '400',
|
|
305
|
+
},
|
|
306
|
+
selectedOperator: {
|
|
307
|
+
justifyContent: 'space-between',
|
|
308
|
+
},
|
|
309
|
+
selectedOperatorText: {
|
|
310
|
+
color: '#E86003',
|
|
311
|
+
fontWeight: 'bold',
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
export default Index;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import React, {useEffect, useState} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
// StatusBar,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Platform,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
Alert,
|
|
9
|
+
NativeModules,
|
|
10
|
+
ImageBackground,
|
|
11
|
+
Image,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
// import {useSafeArea} from 'react-native-safe-area-context';
|
|
14
|
+
import {Button, Icon, Text} from '@rneui/themed';
|
|
15
|
+
import Cell from '../../../components/common/Cell';
|
|
16
|
+
import {adjustUser} from '../../../api';
|
|
17
|
+
import {showToast} from '../../../utils/notice';
|
|
18
|
+
import {merge} from 'lodash';
|
|
19
|
+
import ScreenBackHeader from '../../../components/common/ScreenBackHeader';
|
|
20
|
+
import useNavigationFocus from '../../../hooks/useNavigationFocus';
|
|
21
|
+
|
|
22
|
+
const {replace, popToTop, storage, scaleSize: px} = global.base;
|
|
23
|
+
|
|
24
|
+
const envVersion = NativeModules?.RNToNativeEmitter?.serverCluster;
|
|
25
|
+
const appVersion = NativeModules?.RNToNativeEmitter?.appVersion;
|
|
26
|
+
|
|
27
|
+
export default ({navigation}) => {
|
|
28
|
+
const [userInfo, setUserInfo] = useState({});
|
|
29
|
+
console.log(userInfo, 'userInfo');
|
|
30
|
+
const [bundleVersion, setBundleVersion] = useState();
|
|
31
|
+
const [isBindTv, setIsBindTv] = useState(false);
|
|
32
|
+
const [operatorName, setOperatorName] = useState('');
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
storage.get('bundleVersion').then(version => {
|
|
36
|
+
setBundleVersion(version);
|
|
37
|
+
});
|
|
38
|
+
storage.get('currentOperator').then(operator => {
|
|
39
|
+
setOperatorName(operator?.name || '标准版');
|
|
40
|
+
});
|
|
41
|
+
_getUserInfo();
|
|
42
|
+
}, []);
|
|
43
|
+
// const insets = useSafeArea();
|
|
44
|
+
|
|
45
|
+
useNavigationFocus(() => {
|
|
46
|
+
storage.get('bundleVersion').then(version => {
|
|
47
|
+
setBundleVersion(version);
|
|
48
|
+
});
|
|
49
|
+
_getUserInfo();
|
|
50
|
+
storage.get('homedAccessToken').then(token => {
|
|
51
|
+
console.log(token, 'token');
|
|
52
|
+
setIsBindTv(!!token);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const _getUserInfo = () => {
|
|
57
|
+
storage.get('accountData').then(res => {
|
|
58
|
+
console.log(res, 'accountData');
|
|
59
|
+
setUserInfo(res.user);
|
|
60
|
+
});
|
|
61
|
+
// storage.get('activeAddr').then(addrInfo => {
|
|
62
|
+
// const address_id = addrInfo.address_id;
|
|
63
|
+
// getUserInfo({
|
|
64
|
+
// address_id,
|
|
65
|
+
// }).then(res => {
|
|
66
|
+
// console.log(res, 'userInfo');
|
|
67
|
+
// setUserInfo(res?.result?.user_list[0] || {});
|
|
68
|
+
// });
|
|
69
|
+
// });
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleLogout = async () => {
|
|
73
|
+
await storage.set('accessToken', null);
|
|
74
|
+
await storage.set('homedAccessToken', null);
|
|
75
|
+
popToTop();
|
|
76
|
+
replace('Login');
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const adjustName = () => {
|
|
80
|
+
global.dialog.prompt({
|
|
81
|
+
title: '输入修改昵称',
|
|
82
|
+
input: userInfo?.nickname || '',
|
|
83
|
+
confirmButtonText: '确定',
|
|
84
|
+
confirmCallback: val => {
|
|
85
|
+
console.log(val);
|
|
86
|
+
adjustUser({
|
|
87
|
+
user_id: userInfo.user_id,
|
|
88
|
+
nickname: val,
|
|
89
|
+
}).then(async res => {
|
|
90
|
+
console.log(res);
|
|
91
|
+
if (res.code === 0) {
|
|
92
|
+
showToast('修改成功');
|
|
93
|
+
const accountData = await storage.get('accountData');
|
|
94
|
+
await storage.set(
|
|
95
|
+
'accountData',
|
|
96
|
+
merge(accountData, {
|
|
97
|
+
user: {
|
|
98
|
+
nickname: val,
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
102
|
+
_getUserInfo();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
cancelButtonText: '取消',
|
|
107
|
+
cancelCallback: () => {},
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const handleSelectOperator = () => {
|
|
112
|
+
navigation.navigate('OperatorSelectScreen');
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<ImageBackground
|
|
117
|
+
style={styles.container}
|
|
118
|
+
imageStyle={styles.bg}
|
|
119
|
+
source={require('../../../assets/img/bg.png')}>
|
|
120
|
+
<ScreenBackHeader title="" backgroundColor="transparent" />
|
|
121
|
+
{/*<ImageBackground*/}
|
|
122
|
+
{/* source={require('../../../assets/img/bg.png')}*/}
|
|
123
|
+
{/* style={styles.bg}>*/}
|
|
124
|
+
{/* <ScreenBackHeader title="" backgroundColor="transparent" />*/}
|
|
125
|
+
{/* <View>*/}
|
|
126
|
+
{/* <Icon name="person-outline" type="ionicon" size={px(99)} />*/}
|
|
127
|
+
{/* <Text>昵称</Text>*/}
|
|
128
|
+
{/* <Image source={require('../../../assets/img/edit.png')}></Image>*/}
|
|
129
|
+
{/* </View>*/}
|
|
130
|
+
{/*</ImageBackground>*/}
|
|
131
|
+
<View style={styles.content}>
|
|
132
|
+
<View style={styles.center}>
|
|
133
|
+
<View style={styles.userHeader}>
|
|
134
|
+
<Image source={require('../../../assets/img/personal.png')} />
|
|
135
|
+
<Text style={styles.userName}>{userInfo?.nickname}</Text>
|
|
136
|
+
<TouchableOpacity onPress={adjustName}>
|
|
137
|
+
<Image
|
|
138
|
+
source={require('../../../assets/img/edit.png')}
|
|
139
|
+
style={styles.editName}
|
|
140
|
+
/>
|
|
141
|
+
</TouchableOpacity>
|
|
142
|
+
</View>
|
|
143
|
+
<View style={styles.userCard}>
|
|
144
|
+
<Cell
|
|
145
|
+
label="账号"
|
|
146
|
+
type="link"
|
|
147
|
+
value={userInfo?.account_id}
|
|
148
|
+
style={styles.cellStyle}
|
|
149
|
+
labelStyle={styles.labelStyle}
|
|
150
|
+
labelTextStyle={styles.labelTextStyle}
|
|
151
|
+
onRightPress={() => {}}
|
|
152
|
+
/>
|
|
153
|
+
<Cell
|
|
154
|
+
label="绑定手机号"
|
|
155
|
+
type="link"
|
|
156
|
+
value={userInfo?.phone}
|
|
157
|
+
style={styles.cellStyle}
|
|
158
|
+
labelStyle={styles.labelStyle}
|
|
159
|
+
labelTextStyle={styles.labelTextStyle}
|
|
160
|
+
onRightPress={() => navigation.push('BindPhoneScreen')}
|
|
161
|
+
/>
|
|
162
|
+
<Cell
|
|
163
|
+
label="绑定电视账号"
|
|
164
|
+
type="text"
|
|
165
|
+
value={isBindTv ? '已绑定' : '未绑定'}
|
|
166
|
+
style={styles.cellStyle}
|
|
167
|
+
labelStyle={styles.labelStyle}
|
|
168
|
+
labelTextStyle={styles.labelTextStyle}
|
|
169
|
+
/>
|
|
170
|
+
<Cell
|
|
171
|
+
label="第三方账号"
|
|
172
|
+
type="link"
|
|
173
|
+
style={styles.cellStyle}
|
|
174
|
+
labelStyle={styles.labelStyle}
|
|
175
|
+
labelTextStyle={styles.labelTextStyle}
|
|
176
|
+
onRightPress={() => {}}
|
|
177
|
+
/>
|
|
178
|
+
<Cell
|
|
179
|
+
label="运营商版本"
|
|
180
|
+
type="link"
|
|
181
|
+
value={operatorName}
|
|
182
|
+
style={styles.cellStyle}
|
|
183
|
+
labelStyle={styles.labelStyle}
|
|
184
|
+
labelTextStyle={styles.labelTextStyle}
|
|
185
|
+
onRightPress={handleSelectOperator}
|
|
186
|
+
/>
|
|
187
|
+
<Cell
|
|
188
|
+
label="发票抬头"
|
|
189
|
+
type="link"
|
|
190
|
+
style={styles.cellStyle}
|
|
191
|
+
labelStyle={styles.labelStyle}
|
|
192
|
+
labelTextStyle={styles.labelTextStyle}
|
|
193
|
+
onRightPress={() => {}}
|
|
194
|
+
/>
|
|
195
|
+
<Cell
|
|
196
|
+
label="更改密码"
|
|
197
|
+
type="link"
|
|
198
|
+
style={styles.cellStyle}
|
|
199
|
+
labelStyle={styles.labelStyle}
|
|
200
|
+
labelTextStyle={styles.labelTextStyle}
|
|
201
|
+
onRightPress={() => {}}
|
|
202
|
+
/>
|
|
203
|
+
</View>
|
|
204
|
+
</View>
|
|
205
|
+
<View style={styles.bottom}>
|
|
206
|
+
<Button title="退出登录" onPress={handleLogout} />
|
|
207
|
+
<View style={styles.bottomVersion}>
|
|
208
|
+
<Text style={styles.versionText}>
|
|
209
|
+
version:
|
|
210
|
+
{/* {envVersion || 'release_'} */}
|
|
211
|
+
{appVersion || '1.0.0'}_
|
|
212
|
+
{bundleVersion ? bundleVersion.bundleVersion : 'v0.0.1'}
|
|
213
|
+
</Text>
|
|
214
|
+
</View>
|
|
215
|
+
</View>
|
|
216
|
+
</View>
|
|
217
|
+
{/*
|
|
218
|
+
<View style={styles.content}>
|
|
219
|
+
<View style={styles.userInfo}>
|
|
220
|
+
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
|
221
|
+
<Icon name="person-outline" type="ionicon" size={40} />
|
|
222
|
+
<View style={{marginLeft: 20}}>
|
|
223
|
+
<Text style={styles.userName}>{userInfo?.nickname}</Text>
|
|
224
|
+
<TouchableOpacity
|
|
225
|
+
onPress={() => navigation.push('BindPhoneScreen')}>
|
|
226
|
+
<Text style={styles.bindPhoneText}>更换绑定手机</Text>
|
|
227
|
+
</TouchableOpacity>
|
|
228
|
+
</View>
|
|
229
|
+
</View>
|
|
230
|
+
</View>
|
|
231
|
+
<Cell
|
|
232
|
+
type="link"
|
|
233
|
+
label="昵称"
|
|
234
|
+
value={userInfo?.nickname}
|
|
235
|
+
onRightPress={adjustName}
|
|
236
|
+
/>
|
|
237
|
+
<Button title="退出登录" onPress={handleLogout} />
|
|
238
|
+
</View>
|
|
239
|
+
*/}
|
|
240
|
+
</ImageBackground>
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const styles = StyleSheet.create({
|
|
245
|
+
container: {
|
|
246
|
+
flex: 1,
|
|
247
|
+
backgroundColor: '#fff',
|
|
248
|
+
},
|
|
249
|
+
bg: {
|
|
250
|
+
height: px(825),
|
|
251
|
+
},
|
|
252
|
+
content: {
|
|
253
|
+
flex: 1,
|
|
254
|
+
position: 'relative',
|
|
255
|
+
},
|
|
256
|
+
center: {},
|
|
257
|
+
userHeader: {
|
|
258
|
+
flexDirection: 'row',
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
paddingLeft: px(38),
|
|
261
|
+
},
|
|
262
|
+
userName: {
|
|
263
|
+
paddingLeft: 10,
|
|
264
|
+
fontSize: px(55),
|
|
265
|
+
marginLeft: px(58),
|
|
266
|
+
fontWeight: '500',
|
|
267
|
+
color: '#333',
|
|
268
|
+
marginRight: px(27),
|
|
269
|
+
},
|
|
270
|
+
editName: {
|
|
271
|
+
width: px(37),
|
|
272
|
+
height: px(37),
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
userCard: {
|
|
276
|
+
backgroundColor: '#fff',
|
|
277
|
+
borderRadius: px(22),
|
|
278
|
+
marginHorizontal: px(38),
|
|
279
|
+
marginTop: px(44),
|
|
280
|
+
borderWidth: 1,
|
|
281
|
+
borderColor: '#eee',
|
|
282
|
+
},
|
|
283
|
+
cellStyle: {
|
|
284
|
+
minHeight: px(147),
|
|
285
|
+
borderBottomWidth: 0,
|
|
286
|
+
},
|
|
287
|
+
labelStyle: {
|
|
288
|
+
paddingLeft: px(44) - 10,
|
|
289
|
+
},
|
|
290
|
+
labelTextStyle: {
|
|
291
|
+
fontWeight: '500',
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
bindPhoneText: {
|
|
295
|
+
color: '#ccc',
|
|
296
|
+
marginTop: 10,
|
|
297
|
+
},
|
|
298
|
+
myOrder: {
|
|
299
|
+
backgroundColor: '#fff',
|
|
300
|
+
paddingHorizontal: 30,
|
|
301
|
+
paddingVertical: 20,
|
|
302
|
+
marginBottom: 20,
|
|
303
|
+
},
|
|
304
|
+
orderHeader: {
|
|
305
|
+
flexDirection: 'row',
|
|
306
|
+
justifyContent: 'space-between',
|
|
307
|
+
marginBottom: 15,
|
|
308
|
+
},
|
|
309
|
+
orderList: {
|
|
310
|
+
flexDirection: 'row',
|
|
311
|
+
justifyContent: 'space-between',
|
|
312
|
+
},
|
|
313
|
+
orderItem: {
|
|
314
|
+
width: '25%',
|
|
315
|
+
alignItems: 'center',
|
|
316
|
+
},
|
|
317
|
+
services: {
|
|
318
|
+
backgroundColor: '#fff',
|
|
319
|
+
paddingHorizontal: 30,
|
|
320
|
+
paddingVertical: 20,
|
|
321
|
+
flex: 1,
|
|
322
|
+
},
|
|
323
|
+
serviceList: {
|
|
324
|
+
flex: 1,
|
|
325
|
+
},
|
|
326
|
+
serviceItem: {
|
|
327
|
+
flexDirection: 'row',
|
|
328
|
+
alignItems: 'center',
|
|
329
|
+
justifyContent: 'space-between',
|
|
330
|
+
borderBottomWidth: 1,
|
|
331
|
+
borderColor: '#ccc',
|
|
332
|
+
paddingVertical: 15,
|
|
333
|
+
},
|
|
334
|
+
bottom: {
|
|
335
|
+
position: 'absolute',
|
|
336
|
+
bottom: 0,
|
|
337
|
+
left: 0,
|
|
338
|
+
right: 0,
|
|
339
|
+
},
|
|
340
|
+
bottomVersion: {
|
|
341
|
+
height: 30,
|
|
342
|
+
backgroundColor: '#fff',
|
|
343
|
+
},
|
|
344
|
+
versionText: {
|
|
345
|
+
textAlign: 'center',
|
|
346
|
+
lineHeight: 30,
|
|
347
|
+
},
|
|
348
|
+
});
|