Toggle navigation
Toggle navigation
This project
Loading...
Sign in
罗广聪
/
ProtectGod
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
罗广聪
2017-09-28 15:56:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b4c8e4a122e87941bc379a338d18811580a2d776
b4c8e4a1
1 parent
ae94c396
引入打电话
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
6 deletions
src/pages/Mine/index.js
src/pages/Mine/index.js
View file @
b4c8e4a
...
...
@@ -10,10 +10,41 @@ import {
AlertIOS
,
AsyncStorage
,
Button
,
ScrollView
ScrollView
,
Linking
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
const
LaunchURL
=
function
(
url
)
{
Linking
.
canOpenURL
(
url
).
then
(
supported
=>
{
if
(
!
supported
)
{
console
.
log
(
'Can\'t handle url: '
+
url
);
}
else
{
Linking
.
openURL
(
url
)
.
catch
(
err
=>
{
if
(
url
.
includes
(
'telprompt'
))
{
// telprompt was cancelled and Linking openURL method sees this as an error
// it is not a true error so ignore it to prevent apps crashing
// see https://github.com/anarchicknight/react-native-communications/issues/39
}
else
{
console
.
warn
(
'openURL error'
,
err
)
}
});
}
}).
catch
(
err
=>
console
.
warn
(
'An unexpected error happened'
,
err
));
};
const
phonecall
=
function
(
phoneNumber
,
prompt
)
{
let
url
;
if
(
Platform
.
OS
!==
'android'
)
{
url
=
prompt
?
'telprompt:'
:
'tel:'
;
}
else
{
url
=
'tel:'
;
}
url
+=
phoneNumber
;
LaunchURL
(
url
);
}
export
default
class
Mine
extends
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -171,7 +202,7 @@ export default class Mine extends Component {
)}
<
/View
>
{
/* 设置
昵称和职业
*/
}
{
/* 设置
个人信息
*/
}
{
this
.
state
.
IS_LOGIN
==
"yes"
?
(
<
View
style
=
{
styles
.
midContainer
}
>
{
/* 更改昵称 */
}
...
...
@@ -281,6 +312,7 @@ export default class Mine extends Component {
<
/View
>
)
:
null
}
{
/* 评价和客服 */
}
<
View
style
=
{
styles
.
midContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
>
<
View
style
=
{
styles
.
itemLeft
}
>
...
...
@@ -293,7 +325,9 @@ export default class Mine extends Component {
/
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
phonecall
(
"4001-608876"
,
true
);
}}
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
Text
style
=
{
styles
.
leftTitle
}
>
客服电话
<
/Text
>
<
/View
>
...
...
@@ -307,15 +341,14 @@ export default class Mine extends Component {
<
/TouchableOpacity
>
<
/View
>
{
/* 当前版本 */
}
<
View
style
=
{
styles
.
midContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
Text
style
=
{
styles
.
leftTitle
}
>
当前版本
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
itemRight
}
>
<
Text
style
=
{
styles
.
itemRightContent
}
>
V1
.
0.0
<
/Text
>
<
Text
style
=
{
styles
.
itemRightContent
}
>
V1
.
0.0
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
...
...
Please
register
or
login
to post a comment