我的姓名电话
parent
3fd86e7ca2
commit
5057830481
|
@ -3196,7 +3196,19 @@ U6Hzm1ninpWeE+awIDAQAB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 获取头像
|
||||||
|
static Future<Map<String, dynamic>> getUserHeadPhoto(String phone) {
|
||||||
|
return HttpManager().request(
|
||||||
|
basePath,
|
||||||
|
'/app/user/getUserPhoto',
|
||||||
|
method: Method.post,
|
||||||
|
data: {
|
||||||
|
"USERNAME": SessionService.instance.loginUser?["USERNAME"]??"",
|
||||||
|
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||||
|
"USER_ID":SessionService.instance.loginUserId,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qhd_prevention/http/ApiService.dart';
|
||||||
import 'package:qhd_prevention/pages/mine/mine_feedback_page.dart';
|
import 'package:qhd_prevention/pages/mine/mine_feedback_page.dart';
|
||||||
import 'package:qhd_prevention/pages/mine/webViewPage.dart';
|
import 'package:qhd_prevention/pages/mine/webViewPage.dart';
|
||||||
import 'package:qhd_prevention/pages/mine/mine_about_page.dart';
|
import 'package:qhd_prevention/pages/mine/mine_about_page.dart';
|
||||||
|
@ -15,6 +16,48 @@ class MinePage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MinePageState extends State<MinePage> {
|
class _MinePageState extends State<MinePage> {
|
||||||
|
|
||||||
|
String name="";
|
||||||
|
String phone="";
|
||||||
|
String headPath="assets/images/avatar.png";
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
|
||||||
|
name=SessionService.instance.username!;
|
||||||
|
phone=SessionService.instance.loginUser?["USERNAME"]??""!;
|
||||||
|
_getUserPhoto(phone);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _getUserPhoto(String phone )async {
|
||||||
|
try {
|
||||||
|
final raw = await ApiService.getUserHeadPhoto(phone);
|
||||||
|
// final hidCount = raw['hidCount'] as Map<String, dynamic>;
|
||||||
|
// print(hidCount);
|
||||||
|
if (raw['result'] == 'success') {
|
||||||
|
headPath=raw['userPhoto'];
|
||||||
|
setState(() {
|
||||||
|
if("assets/images/user/avatar-2.jpg"==headPath){
|
||||||
|
headPath="assets/images/avatar.png";
|
||||||
|
}else{
|
||||||
|
headPath=ApiService.baseImgPath +headPath;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||||
|
print('加载头像数据失败:$e');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -33,7 +76,7 @@ class _MinePageState extends State<MinePage> {
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"assets/images/avatar.png",
|
headPath,
|
||||||
height: 60,
|
height: 60,
|
||||||
width: 60,
|
width: 60,
|
||||||
),
|
),
|
||||||
|
@ -44,8 +87,8 @@ class _MinePageState extends State<MinePage> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
children: [
|
children: [
|
||||||
Text("珊瑚撒", style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),),
|
Text(name, style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),),
|
||||||
Text("手机号:129378348949", style: TextStyle(color: Colors.black54),)],
|
Text("手机号:$phone", style: TextStyle(color: Colors.black54),)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
336
pubspec.lock
336
pubspec.lock
File diff suppressed because it is too large
Load Diff
|
@ -79,6 +79,7 @@ dependencies:
|
||||||
flutter_new_badger: ^1.1.1
|
flutter_new_badger: ^1.1.1
|
||||||
#loading
|
#loading
|
||||||
flutter_easyloading: ^3.0.5
|
flutter_easyloading: ^3.0.5
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
Loading…
Reference in New Issue