Showing
1 changed file
with
39 additions
and
6 deletions
| @@ -10,10 +10,41 @@ import { | @@ -10,10 +10,41 @@ import { | ||
| 10 | AlertIOS, | 10 | AlertIOS, |
| 11 | AsyncStorage, | 11 | AsyncStorage, |
| 12 | Button, | 12 | Button, |
| 13 | - ScrollView | 13 | + ScrollView, |
| 14 | + Linking | ||
| 14 | } from "react-native"; | 15 | } from "react-native"; |
| 15 | import { StackNavigator, TabNavigator } from "react-navigation"; | 16 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 16 | 17 | ||
| 18 | +const LaunchURL = function (url) { | ||
| 19 | + Linking.canOpenURL(url).then(supported => { | ||
| 20 | + if (!supported) { | ||
| 21 | + console.log('Can\'t handle url: ' + url); | ||
| 22 | + } else { | ||
| 23 | + Linking.openURL(url) | ||
| 24 | + .catch(err => { | ||
| 25 | + if (url.includes('telprompt')) { | ||
| 26 | + // telprompt was cancelled and Linking openURL method sees this as an error | ||
| 27 | + // it is not a true error so ignore it to prevent apps crashing | ||
| 28 | + // see https://github.com/anarchicknight/react-native-communications/issues/39 | ||
| 29 | + } else { | ||
| 30 | + console.warn('openURL error', err) | ||
| 31 | + } | ||
| 32 | + }); | ||
| 33 | + } | ||
| 34 | + }).catch(err => console.warn('An unexpected error happened', err)); | ||
| 35 | +}; | ||
| 36 | +const phonecall = function (phoneNumber, prompt) { | ||
| 37 | + let url; | ||
| 38 | + if (Platform.OS !== 'android') { | ||
| 39 | + url = prompt ? 'telprompt:' : 'tel:'; | ||
| 40 | + } | ||
| 41 | + else { | ||
| 42 | + url = 'tel:'; | ||
| 43 | + } | ||
| 44 | + url += phoneNumber; | ||
| 45 | + LaunchURL(url); | ||
| 46 | +} | ||
| 47 | + | ||
| 17 | export default class Mine extends Component { | 48 | export default class Mine extends Component { |
| 18 | constructor(props) { | 49 | constructor(props) { |
| 19 | super(props); | 50 | super(props); |
| @@ -171,7 +202,7 @@ export default class Mine extends Component { | @@ -171,7 +202,7 @@ export default class Mine extends Component { | ||
| 171 | )} | 202 | )} |
| 172 | </View> | 203 | </View> |
| 173 | 204 | ||
| 174 | - {/* 设置昵称和职业 */} | 205 | + {/* 设置个人信息 */} |
| 175 | {this.state.IS_LOGIN == "yes" ? ( | 206 | {this.state.IS_LOGIN == "yes" ? ( |
| 176 | <View style={styles.midContainer}> | 207 | <View style={styles.midContainer}> |
| 177 | {/* 更改昵称 */} | 208 | {/* 更改昵称 */} |
| @@ -281,6 +312,7 @@ export default class Mine extends Component { | @@ -281,6 +312,7 @@ export default class Mine extends Component { | ||
| 281 | </View> | 312 | </View> |
| 282 | ) : null} | 313 | ) : null} |
| 283 | 314 | ||
| 315 | + {/* 评价和客服 */} | ||
| 284 | <View style={styles.midContainer}> | 316 | <View style={styles.midContainer}> |
| 285 | <TouchableOpacity style={styles.itemContainer}> | 317 | <TouchableOpacity style={styles.itemContainer}> |
| 286 | <View style={styles.itemLeft}> | 318 | <View style={styles.itemLeft}> |
| @@ -293,7 +325,9 @@ export default class Mine extends Component { | @@ -293,7 +325,9 @@ export default class Mine extends Component { | ||
| 293 | /> | 325 | /> |
| 294 | </View> | 326 | </View> |
| 295 | </TouchableOpacity> | 327 | </TouchableOpacity> |
| 296 | - <TouchableOpacity style={styles.itemContainer}> | 328 | + <TouchableOpacity style={styles.itemContainer} onPress={() => { |
| 329 | + phonecall("4001-608876", true); | ||
| 330 | + }}> | ||
| 297 | <View style={styles.itemLeft}> | 331 | <View style={styles.itemLeft}> |
| 298 | <Text style={styles.leftTitle}>客服电话</Text> | 332 | <Text style={styles.leftTitle}>客服电话</Text> |
| 299 | </View> | 333 | </View> |
| @@ -307,15 +341,14 @@ export default class Mine extends Component { | @@ -307,15 +341,14 @@ export default class Mine extends Component { | ||
| 307 | </TouchableOpacity> | 341 | </TouchableOpacity> |
| 308 | </View> | 342 | </View> |
| 309 | 343 | ||
| 344 | + {/* 当前版本 */} | ||
| 310 | <View style={styles.midContainer}> | 345 | <View style={styles.midContainer}> |
| 311 | <TouchableOpacity style={styles.itemContainer}> | 346 | <TouchableOpacity style={styles.itemContainer}> |
| 312 | <View style={styles.itemLeft}> | 347 | <View style={styles.itemLeft}> |
| 313 | <Text style={styles.leftTitle}>当前版本</Text> | 348 | <Text style={styles.leftTitle}>当前版本</Text> |
| 314 | </View> | 349 | </View> |
| 315 | <View style={styles.itemRight}> | 350 | <View style={styles.itemRight}> |
| 316 | - <Text style={styles.itemRightContent}> | 351 | + <Text style={styles.itemRightContent}>V1.0.0</Text> |
| 317 | - V1.0.0 | ||
| 318 | - </Text> | ||
| 319 | </View> | 352 | </View> |
| 320 | </TouchableOpacity> | 353 | </TouchableOpacity> |
| 321 | </View> | 354 | </View> |
-
Please register or login to post a comment