x1ongzhu 6 жил өмнө
parent
commit
8a728fb7ba

+ 1 - 2
android/app/build.gradle

@@ -32,9 +32,8 @@ android {
     }
 
     defaultConfig {
-        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
         applicationId "com.izouma.mobilecybergames"
-        minSdkVersion 18
+        minSdkVersion 19
         targetSdkVersion 27
         versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName

+ 1 - 2
lib/main.dart

@@ -61,8 +61,7 @@ void main() async {
   ));
   final prefs = await SharedPreferences.getInstance();
   print(prefs.getString('token'));
-  HttpManager.token = prefs.getString('token') ??
-      "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI0NWY0OGY2NS1jODQxLTRjNDgtYmY0My1jYTAwYzlkZjk5OWQiLCJpc3MiOiJhZG1pbiIsImlhdCI6MTU1MTMxNzAzMCwic3ViIjoiODQ3MDIiLCJleHAiOjE1NTE1NzYyMzB9.ILhuOwvblQKqVxNaLk9CbYas6aoUQAlzlZrTk4VLqY8";
+  HttpManager.token = prefs.getString('token') ?? "";
   Result result = await HttpManager.get("userInfo/getUserInfo");
   AppState state = AppState.empty();
   if (result.success && result.data != null) {

+ 1 - 1
lib/pages/TipInfo.dart

@@ -45,7 +45,7 @@ class TipInfoState extends State<TipInfo> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     Future.delayed(Duration(milliseconds: 100), () => getInfo());
   }

+ 2 - 2
lib/pages/TipList.dart

@@ -50,7 +50,7 @@ class TipListState extends State<TipList> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     _mControll = new ScrollController();
 
@@ -67,7 +67,7 @@ class TipListState extends State<TipList> {
 
   @override
   void dispose() {
-    // TODO: implement dispose
+    
     super.dispose();
     _mControll.dispose();
   }

+ 10 - 32
lib/pages/changeUserInfo.dart

@@ -92,24 +92,15 @@ class ChangeUserInfoState extends State<ChangeUserInfo> {
                                   Toast.show(context, '修改内容不能为空', 1500, 'info');
                                   return;
                                 }
-                                //  Toast.show(context, '加载中', -1, 'loading');
-                                // FormData formdata = new FormData.from(
-                                //     {changekey: changeText, "id": userInfo['id']});
-                                // final response = await Dio().post(
-                                //     domain + 'userInfo/update',
-                                //     data: formdata,
-                                //     options: Options(headers: {
-                                //       "token": StoreProvider.of<CountState>(context)
-                                //           .state
-                                //           .usetoken
-                                //     }));
-                                // final res = json.decode(response.toString());
-                                // print(res);
-                                // if (res['success']) {
-                                //   Toast.hide();
-                                //   getUserInfo();
-                                //   Toast.show(context, '修改成功', 1500, 'success');
-                                // }
+                                Toast.show(context, '加载中', -1, 'loading');
+                                Result res = await HttpManager.post('userInfo/update', data: {'id': userInfo.id, changekey: changeText});
+                                Toast.hide();
+                                if (res.success) {
+                                  Navigator.pop(context, true);
+                                } else {
+                                  Toast.show(context, res.error, 1500, 'info');
+                                  Navigator.pop(context);
+                                }
                               }),
                         ),
                       ],
@@ -117,22 +108,9 @@ class ChangeUserInfoState extends State<ChangeUserInfo> {
                   )),
               onWillPop: () {
                 Toast.hide();
-                Navigator.pop(context);
+                Navigator.pop(context, false);
                 return Future.value(false);
               });
         });
   }
-
-  // void getUserInfo() async {
-  //   final response = await Dio().get(domain + 'userInfo/getUserInfo',
-  //       options: Options(headers: {
-  //         "token": StoreProvider.of<CountState>(context).state.usetoken
-  //       }));
-  //   final res = json.decode(response.toString());
-  //   if (res['success']) {
-  //     StoreProvider.of<CountState>(context)
-  //         .dispatch({"action": Actions.updateUser, "val": res['data']});
-  //     Navigator.pop(context);
-  //   }
-  // }
 }

+ 1 - 3
lib/pages/recharge.dart

@@ -48,7 +48,6 @@ class RechrageState extends State<Rechrage> {
 
   Future<Null> _focusNodeListener() async {
     if (_focusNode.hasFocus) {
-      print('获取焦点');
       setState(() {
         if (!autoChoose) {
           autoChoose = true;
@@ -57,7 +56,6 @@ class RechrageState extends State<Rechrage> {
         isInput = true;
       });
     } else {
-      print('失去焦点');
       setState(() {
         isInput = false;
       });
@@ -67,7 +65,7 @@ class RechrageState extends State<Rechrage> {
   @override
   Widget build(BuildContext context) {
     ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
-    // TODO: implement build
+    
     return new Scaffold(
         appBar: AppBar(
           backgroundColor: PRIMARY_COLOR,

+ 4 - 4
lib/pages/roomInfo.dart

@@ -258,7 +258,7 @@ class RoomInfoState extends State<RoomInfo>
     if (houseInfo != null) {
       status = houseInfo.statusFlag;
     }
-    // TODO: implement build
+    
     return new WillPopScope(
       child: Scaffold(
         appBar: AppBar(
@@ -628,7 +628,7 @@ class RankContentState extends State<RankContent> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     getTopList();
   }
@@ -783,7 +783,7 @@ class SecondPageState extends State<SecondPage> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     _perController = ScrollController();
     currentPage = 1;
@@ -801,7 +801,7 @@ class SecondPageState extends State<SecondPage> {
 
   @override
   void dispose() {
-    // TODO: implement dispose
+    
     super.dispose();
     _perController.dispose();
   }

+ 1 - 1
lib/pages/roomList.dart

@@ -94,7 +94,7 @@ class RoomListState extends State<RoomList> {
   Widget build(BuildContext context) {
     ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
 
-    // TODO: implement build
+    
     return new Scaffold(
         appBar: AppBar(
           backgroundColor: PRIMARY_COLOR,

+ 18 - 7
lib/pages/setting.dart

@@ -74,12 +74,23 @@ class SettingState extends State<Setting> {
                               _sectionDivier(),
                               _section([
                                 _cell(
-                                  '头像',
-                                  ClipOval(child: Image.network(userInfo.icon, width: 36, height: 36)),
-                                ),
-                                _cell('昵称', userInfo.nickname, placeholder: '请填写昵称', onTap: () {
-                                  Navigator.push(
+                                    '头像',
+                                    ClipOval(
+                                      child: Image.network(
+                                        userInfo.icon,
+                                        width: 36,
+                                        height: 36,
+                                        fit: BoxFit.cover,
+                                      ),
+                                    ), onTap: () {
+                                  _chooseImage(context);
+                                }),
+                                _cell('昵称', userInfo.nickname, placeholder: '请填写昵称', onTap: () async {
+                                  bool success = await Navigator.push<bool>(
                                       context, new CupertinoPageRoute(builder: (context) => new ChangeUserInfo(title: '昵称', val: userInfo.nickname)));
+                                  if (success) {
+                                    Toast.show(context, '修改成功', 1500, 'success');
+                                  }
                                 }),
                                 _cell('性别', userInfo.sex, placeholder: '请添加性别信息', onTap: () {
                                   _chooseSex(context);
@@ -94,8 +105,8 @@ class SettingState extends State<Setting> {
                                     _chooseBirthday(context);
                                   },
                                 ),
-                                _cell('手机', userInfo.phone, showBorder: false, onTap: () {
-                                  Navigator.push(context, new CupertinoPageRoute(builder: (context) => new ChangeUserInfo(title: '手机号', val: userInfo.phone)));
+                                _cell('手机', userInfo.phone, showBorder: false, onTap: () async {
+                                  // Navigator.push(context, new CupertinoPageRoute(builder: (context) => new ChangeUserInfo(title: '手机号', val: userInfo.phone)));
                                 })
                               ]),
                               _sectionDivier(),

+ 0 - 3
lib/widget/ITextInput.dart

@@ -99,17 +99,14 @@ class _ITextFieldState extends State<ITextField> {
 
   @override
   void initState() {
-    // TODO: implement initState
     super.initState();
     _inputText = widget.inputText != null ? widget.inputText : '';
     _focusNode.addListener(() {
       if (!_focusNode.hasFocus) {
-        print('失去焦点');
         setState(() {
           _hasdeleteIcon = false;
         });
       } else {
-        print('获取焦点');
         setState(() {
           _hasdeleteIcon = (_inputText.isNotEmpty);
         });