2025-07-11 11:03:21 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2025-07-16 18:07:10 +08:00
|
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
|
|
import 'package:qhd_prevention/pages/mine/webViewPage.dart';
|
2025-07-11 11:03:21 +08:00
|
|
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
2025-07-16 18:07:10 +08:00
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
2025-07-11 11:03:21 +08:00
|
|
|
|
2025-07-16 18:07:10 +08:00
|
|
|
import '../../http/ApiService.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class NotifDetailPage extends StatefulWidget {
|
|
|
|
const NotifDetailPage(this.item, this.selectedTab, {super.key,required this.onClose});
|
|
|
|
|
|
|
|
final Function(String) onClose; // 回调函数
|
|
|
|
final dynamic item;
|
|
|
|
final int selectedTab;
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<NotifDetailPage> createState() => _NotifDetailPageState(item,selectedTab,onClose);
|
|
|
|
}
|
|
|
|
|
|
|
|
class _NotifDetailPageState extends State<NotifDetailPage> {
|
|
|
|
_NotifDetailPageState(this.item, this.selectedTab,this.onClose);
|
|
|
|
|
|
|
|
final Function(String) onClose; // 回调函数
|
|
|
|
final dynamic item;
|
|
|
|
final int selectedTab;
|
|
|
|
String title="";
|
|
|
|
String time="";
|
|
|
|
String text="";
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
if(0==selectedTab){
|
|
|
|
_getNotifDetail();
|
|
|
|
}else{
|
|
|
|
_getNotifEnterpriseDetail();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _getNotifDetail() async {
|
|
|
|
// LoadingDialogHelper.show(context);
|
|
|
|
try {
|
|
|
|
final result = await ApiService.getNotifDetail(item['NOTICE_ID']);
|
|
|
|
if (result['result'] == 'success') {
|
|
|
|
final dynamic newList = result['pd'] ;
|
|
|
|
setState(() {
|
|
|
|
title= newList['SYNOPSIS'];
|
|
|
|
time= newList['CREATTIME'];
|
|
|
|
text= newList['CONTENT'];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
print('加载出错: $e');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _getNotifEnterpriseDetail() async {
|
|
|
|
// LoadingDialogHelper.show(context);
|
|
|
|
try {
|
|
|
|
final result = await ApiService.getNotifEnterpriseDetail(item['NOTICECORPUSERID_ID']);
|
|
|
|
if (result['result'] == 'success') {
|
|
|
|
final dynamic newList = result['pd'] ;
|
|
|
|
setState(() {
|
|
|
|
title= newList['SYNOPSIS'];
|
|
|
|
time= newList['CREATTIME'];
|
|
|
|
text= newList['CONTENT'];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
print('加载出错: $e');
|
|
|
|
}
|
|
|
|
}
|
2025-07-11 11:03:21 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: MyAppbar(title: "通知详情"),
|
|
|
|
body: SafeArea(
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity, // 铺满父容器
|
|
|
|
color: Colors.white,
|
|
|
|
padding: const EdgeInsets.all(15),
|
2025-07-16 18:07:10 +08:00
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, // 左对齐
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 10,right: 10),
|
|
|
|
child: Text(title,style: TextStyle(color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold),),
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 10,right: 10),
|
|
|
|
child: Text(time,),
|
|
|
|
),
|
|
|
|
SizedBox(height: 8),
|
|
|
|
Html(
|
|
|
|
data: text,
|
|
|
|
),
|
|
|
|
// Text(item['CONTENT'],),
|
|
|
|
],
|
|
|
|
),
|
2025-07-11 11:03:21 +08:00
|
|
|
),
|
2025-07-16 18:07:10 +08:00
|
|
|
|
2025-07-11 11:03:21 +08:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2025-07-16 18:07:10 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
// TODO: implement dispose
|
|
|
|
super.dispose();
|
|
|
|
onClose('关闭详情'); // 触发回调
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-07-11 11:03:21 +08:00
|
|
|
}
|