Commit 8e5424ed by CaryaLiu

feat: 修改昵称回调修改成promise

parent e074d974
ios @ 4c6dc36d
Subproject commit 52515a17713d3f4a76798790f902077d2b4f1e07 Subproject commit 4c6dc36d53d2b30b24ac6b0a0e7a1ce51a7dea63
...@@ -9,7 +9,7 @@ import { TextInput, Text, TouchableHighlight, View, NativeModules, StatusBar, Pl ...@@ -9,7 +9,7 @@ import { TextInput, Text, TouchableHighlight, View, NativeModules, StatusBar, Pl
import { user as userServices } from '../../services'; import { user as userServices } from '../../services';
import styles from './style'; import styles from './style';
const { BMCInfo: { getUserInfo }, BMCUI, BMCAction: { exit, setNiceName } } = NativeModules; const { BMCInfo: { getUserInfo }, BMCUI, BMCAction: { exit, updateNickname } } = NativeModules;
const Equipment = () => { const Equipment = () => {
const [nickname, setNickName] = useState(''); const [nickname, setNickName] = useState('');
...@@ -26,8 +26,8 @@ const Equipment = () => { ...@@ -26,8 +26,8 @@ const Equipment = () => {
const handleSave = async () => { const handleSave = async () => {
if (/^[a-zA-Z|0123456789|_\\-|\u4e00-\u9fa5]+$/.test(nickname)) { if (/^[a-zA-Z|0123456789|_\\-|\u4e00-\u9fa5]+$/.test(nickname)) {
const data = await userServices.setNickName({ nickname }); const data = await userServices.setNickName({ nickname });
setNiceName(nickname)
BMCUI.showToast('修改昵称成功!'); BMCUI.showToast('修改昵称成功!');
await updateNickname(nickname);
exit(); exit();
} else { } else {
BMCUI.showToast('请输入1-20个字符作为昵称'); BMCUI.showToast('请输入1-20个字符作为昵称');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment