|
16 | 16 | } = React; |
17 | 17 |
|
18 | 18 | var DeleteUser = React.createClass({ |
19 | | - |
| 19 | + getInitialState: function () { |
| 20 | + return { |
| 21 | + email: '' |
| 22 | + } |
| 23 | + }, |
20 | 24 | render: function(){ |
21 | 25 | return ( |
22 | 26 | <ScrollView> |
@@ -44,29 +48,33 @@ var DeleteUser = React.createClass({ |
44 | 48 |
|
45 | 49 | _deleteUser: function(){ |
46 | 50 | var that = this; |
47 | | - AlertIOS.alert('提示', '确认删除该用户?', [ |
48 | | - {text: '删除', onPress: function(){ |
49 | | - var path = Service.host + Service.deleteUser; |
50 | | - AsyncStorage.getItem('token', function(err, data){ |
51 | | - if(!err){ |
52 | | - Util.post(path,{ |
53 | | - token: data, |
54 | | - email: that.state.email |
55 | | - }, function(data){ |
56 | | - if(data.status){ |
57 | | - AlertIOS.alert('成功', '删除成功'); |
| 51 | + this.state.email == '' ? |
| 52 | + AlertIOS.alert('提示', '请输入要删除的用户邮箱') : |
| 53 | + AlertIOS.alert('提示', '确认删除该用户?', [ |
| 54 | + { |
| 55 | + text: '删除', |
| 56 | + onPress: function(){ |
| 57 | + var path = Service.host + Service.deleteUser; |
| 58 | + AsyncStorage.getItem('token', function(err, data){ |
| 59 | + if(!err){ |
| 60 | + Util.post(path,{ |
| 61 | + token: data, |
| 62 | + email: that.state.email |
| 63 | + }, function(data){ |
| 64 | + if(data.status){ |
| 65 | + AlertIOS.alert('成功', '删除成功'); |
| 66 | + }else{ |
| 67 | + AlertIOS.alert('失败', '删除失败'); |
| 68 | + } |
| 69 | + }); |
58 | 70 | }else{ |
59 | | - AlertIOS.alert('失败', '删除失败'); |
| 71 | + AlertIOS.alert('提示', '没有权限'); |
60 | 72 | } |
61 | 73 | }); |
62 | | - }else{ |
63 | | - AlertIOS.alert('提示', '没有权限'); |
64 | 74 | } |
65 | | - }); |
66 | | - } |
67 | | - }, |
68 | | - {text: '取消', onPress: ()=>null}, |
69 | | - ]); |
| 75 | + }, |
| 76 | + {text: '取消', onPress: ()=>null}, |
| 77 | + ]); |
70 | 78 | } |
71 | 79 |
|
72 | 80 | }); |
|
0 commit comments