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-11 14:27:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4a585a58f59bf66daf7e509401837fb3d3c311f5
4a585a58
1 parent
d303607a
貌似全部OK了
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
12 deletions
src/pages/Mine/index.js
src/pages/Mine/index.js
View file @
4a585a5
...
...
@@ -70,14 +70,78 @@ export default class Mine extends Component {
);
}
saveResponse1
(
d
)
{
if
(
this
.
state
.
IS_LOGIN
==
"yes"
)
{
this
.
setState
({
NICKNAME
:
d
});
let
that
=
this
,
formData
=
new
FormData
();
if
(
that
.
state
.
IS_LOGIN
!=
"yes"
)
{
alert
(
"请先登录账号"
);
return
false
;
}
formData
.
append
(
"user"
,
this
.
state
.
USER_ID
);
formData
.
append
(
"profession"
,
""
);
formData
.
append
(
"nickname"
,
d
);
return
fetch
(
`https://devpay.brae.co/test/insurance/change`
,
{
method
:
"POST"
,
headers
:
{
Accept
:
"application/json"
,
"Content-Type"
:
"application/json"
},
body
:
formData
})
.
then
(
resp
=>
{
if
(
resp
.
status
===
200
)
{
return
resp
.
json
();
}
else
{
console
.
error
(
"something went wrong!"
);
}
})
.
then
(
respJson
=>
{
if
(
respJson
.
enmsg
!=
"ok"
)
{
alert
(
respJson
.
cnmsg
);
}
else
{
AsyncStorage
.
setItem
(
"NICKNAME"
,
d
).
then
(()
=>
{
console
.
log
(
"保存修改成功"
);
that
.
setState
({
NICKNAME
:
d
});
})
}
})
.
catch
(
err
=>
console
.
error
(
err
));
}
saveResponse2
(
d
)
{
if
(
this
.
state
.
IS_LOGIN
==
"yes"
)
{
this
.
setState
({
identity
:
d
});
let
that
=
this
,
formData
=
new
FormData
();
if
(
that
.
state
.
IS_LOGIN
!=
"yes"
)
{
alert
(
"请先登录账号"
);
return
false
;
}
formData
.
append
(
"user"
,
this
.
state
.
USER_ID
);
formData
.
append
(
"profession"
,
d
);
formData
.
append
(
"nickname"
,
""
);
return
fetch
(
`https://devpay.brae.co/test/insurance/change`
,
{
method
:
"POST"
,
headers
:
{
Accept
:
"application/json"
,
"Content-Type"
:
"application/json"
},
body
:
formData
})
.
then
(
resp
=>
{
if
(
resp
.
status
===
200
)
{
return
resp
.
json
();
}
else
{
console
.
error
(
"something went wrong!"
);
}
})
.
then
(
respJson
=>
{
if
(
respJson
.
enmsg
!=
"ok"
)
{
alert
(
respJson
.
cnmsg
);
}
else
{
AsyncStorage
.
setItem
(
"PROFESSION"
,
d
).
then
(()
=>
{
console
.
log
(
"保存修改成功"
);
that
.
setState
({
PROFESSION
:
d
});
})
}
})
.
catch
(
err
=>
console
.
error
(
err
));
}
render
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
...
...
@@ -96,15 +160,9 @@ export default class Mine extends Component {
style
=
{
styles
.
mineIcon
}
/
>
)}
{
/* <Image
source={require("../../assets/Mine/iconpic1.png")}
style={styles.mineIcon}
/>
<Image
source={require("../../assets/Mine/iconpic_gray.png")}
style={styles.mineIcon}
/> */
}
<
/View
>
{
/* 设置昵称和职业 */
}
<
View
style
=
{
styles
.
midContainer
}
>
{
/* 更改昵称 */
}
<
TouchableOpacity
...
...
Please
register
or
login
to post a comment