From cf54ddc9fc06acb4c56104d02dc2bc38937fb313 Mon Sep 17 00:00:00 2001 From: zhangmeng1334717033 Date: Thu, 11 Jun 2020 11:54:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E9=99=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/app_page.dart | 9 ++++++--- lib/chatting_api.dart | 13 ++++++++----- lib/chatting_api_result.dart | 23 ++++++++++++++++++++++- lib/chatting_build_page.dart | 3 ++- lib/personal_page.dart | 5 +++++ 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/lib/app_page.dart b/lib/app_page.dart index 4400533..8285fb4 100644 --- a/lib/app_page.dart +++ b/lib/app_page.dart @@ -26,7 +26,7 @@ class _AppState extends State { icon: Icon(IconData(0xe607,fontFamily: 'appIconFonts')), title: Text('我的')), ]; - final List tabBodies = [ + final List tabBodies = [ ChattingPage(), ChattinFriendPage(), DiscoverPage(), @@ -41,7 +41,6 @@ class _AppState extends State { void initState() { currentPage = tabBodies[currentIndex]; super.initState(); - chattingApi.getChattingList(); } @override @@ -59,7 +58,11 @@ class _AppState extends State { }); }, ), - body: currentPage, + //body: currentPage, + body: IndexedStack( + index: currentIndex, + children: tabBodies, + ), ); } } \ No newline at end of file diff --git a/lib/chatting_api.dart b/lib/chatting_api.dart index ea05f3a..08da38e 100644 --- a/lib/chatting_api.dart +++ b/lib/chatting_api.dart @@ -28,7 +28,7 @@ class ChattingApi { 'password':password, }); var result = await dio.post( - 'http://customer.dsd361.com/login', + 'http://192.168.55.141/login', data: formData, options: options ); @@ -36,7 +36,7 @@ class ChattingApi { token=result.data['token']; time=result.data['loginTime']; message=result.data['message']; - chattingApiResult= new ChattingApiResult(token,time,message,null,null,null); + chattingApiResult= new ChattingApiResult(null,token,time,message,null,null,null); print(chattingApiResult.runtimeType); return chattingApiResult ; } @@ -52,7 +52,7 @@ class ChattingApi { FormData formData = new FormData.from({ 'token':token }); - var response = await dio.post('http://customer.dsd361.com/newchattings/selectChattingeFriebdList',data: formData); + var response = await dio.post('http://192.168.55.141/newchattings/selectChattingeFriebdList',data: formData); List result=response.data; list = new List(); result.forEach((item) { @@ -69,8 +69,11 @@ class ChattingApi { } //获取当前用户信息 - getCurrentUserInfo(String id) async { - var result = await dio.get(''); + getCurrentUserInfo() async { + token = await dataManipulation_get('token'); + var response = await dio.get('http://192.168.55.141/iUsers/getuser?token='+token+'&source=app'); + var result=response.data; + print(result); return result.data; } diff --git a/lib/chatting_api_result.dart b/lib/chatting_api_result.dart index 3b96b21..ec60853 100644 --- a/lib/chatting_api_result.dart +++ b/lib/chatting_api_result.dart @@ -1,6 +1,8 @@ class ChattingApiResult extends Object{ + Uesr user; + String token; int time; @@ -13,10 +15,29 @@ class ChattingApiResult extends Object{ String content; - ChattingApiResult(this.token, this.time, this.message, this.sendId, this.receiveId, this.content); + + ChattingApiResult(this.user, this.token, this.time, this.message, this.sendId, this.receiveId, this.content); @override String toString() { return 'ChattingApiResult{token: $token, time: $time, message: $message, sendId: $sendId, receiveId: $receiveId, content: $content}'; } +} + +class Uesr{ + + int id ; + + String photo; + + String username; + + String telephone; + + Uesr(this.id, this.photo, this.username, this.telephone); + + @override + String toString() { + return 'Uesr{id: $id, photo: $photo, username: $username, telephone: $telephone}'; + } } \ No newline at end of file diff --git a/lib/chatting_build_page.dart b/lib/chatting_build_page.dart index 79123bc..ceb3223 100644 --- a/lib/chatting_build_page.dart +++ b/lib/chatting_build_page.dart @@ -42,8 +42,9 @@ class _ChattingDetailsPageState extends State { itemBuilder: (BuildContext context, int index) { //传入 messageData 返回 表项 return new ChattingItemPage(messageData[index]); - }, + }, ), ); } + } diff --git a/lib/personal_page.dart b/lib/personal_page.dart index ce89ef1..52f44e1 100644 --- a/lib/personal_page.dart +++ b/lib/personal_page.dart @@ -9,6 +9,11 @@ class PersonalPage extends StatefulWidget { } class _PersonalPageState extends State { + + + + + @override Widget build(BuildContext context) { return Scaffold(