Browse Source

消息部分,社群头条更改;

ff_new
w-R 3 years ago
parent
commit
96295c5041
  1. BIN
      assets/image/2x/activity_hot.png
  2. BIN
      assets/image/3x/activity_hot.png
  3. BIN
      assets/image/activity_hot.png
  4. 3
      lib/community/community_view/class_details.dart
  5. 5
      lib/community/community_view/home_class.dart
  6. 165
      lib/community/headlines/activity_top_list.dart
  7. 30
      lib/community/headlines/article_page.dart
  8. 3
      lib/community/headlines/headlines_column_details.dart
  9. 6
      lib/home/home_page.dart
  10. 19
      lib/message/system_details.dart
  11. 8
      lib/message/system_message.dart
  12. 8
      lib/retrofit/retrofit_api.dart
  13. 2
      lib/retrofit/retrofit_api.g.dart

BIN
assets/image/2x/activity_hot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
assets/image/3x/activity_hot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
assets/image/activity_hot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

3
lib/community/community_view/class_details.dart

@ -200,7 +200,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
Row( Row(
children: [ children: [
Container( Container(
height: 22.h, // height: 22.h,
padding:EdgeInsets.only(left:2,right:2), padding:EdgeInsets.only(left:2,right:2),
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -216,6 +216,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
course.tags.length > 0) course.tags.length > 0)
? course.tags[0] ? course.tags[0]
: "", : "",
overflow:TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,

5
lib/community/community_view/home_class.dart

@ -220,7 +220,7 @@ class _HomeClass extends State<HomeClass> {
Container( Container(
margin: EdgeInsets.only(top: 8, right: 8), margin: EdgeInsets.only(top: 8, right: 8),
padding: EdgeInsets.only(left: 2, right: 2), padding: EdgeInsets.only(left: 2, right: 2),
height: 16.h, height: 20.h,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
@ -230,8 +230,9 @@ class _HomeClass extends State<HomeClass> {
(collect?.tags != null && collect.tags.length > 0) (collect?.tags != null && collect.tags.length > 0)
? collect.tags[0] ? collect.tags[0]
: "", : "",
overflow:TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 11.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
color: Color(0xFF634815), color: Color(0xFF634815),
), ),

165
lib/community/headlines/activity_top_list.dart

@ -0,0 +1,165 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/collect_class_list.dart';
import 'package:huixiang/retrofit/data/course_list.dart';
import 'package:huixiang/retrofit/data/headlines_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/new_people_reward.dart';
class ActivityTopList extends StatefulWidget {
final List<Article> articleTop;
ActivityTopList(this.articleTop);
@override
State<StatefulWidget> createState() {
return _ActivityTopList();
}
}
class _ActivityTopList extends State<ActivityTopList> {
ApiService apiService;
BMFCoordinate latLng;
final TextEditingController editingController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
height: 220.h,
margin: EdgeInsets.only(top: 10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10),
itemCount: widget.articleTop == null ? 0 : widget.articleTop.length,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(
'/router/headlines_column_details',
arguments: {"id": widget.articleTop[position].id});
},
child: headlinesCollectionItem(widget.articleTop[position], position),
);
},
),
);
}
Widget headlinesCollectionItem(Article articles, index) {
return Container(
width: 320.w,
height: 220.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
color: Colors.black,
),
margin: EdgeInsets.symmetric(
horizontal: 6,
),
child: Stack(
alignment: Alignment.bottomLeft,
children: [
Stack(
children: [
ClipRRect(
child: Opacity(
opacity: 0.8,
child: MImage(
widget?.articleTop[index]?.coverImg ?? "",
width: 320.w,
height: 220.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
bottom: Radius.circular(4),
),
),
Container(
padding: EdgeInsets.only(left: 12.w, right: 12.w, top: 8),
alignment: Alignment.topLeft,
child: Row(
children: [
Image.asset(
"assets/image/activity_hot.png",
width: 20,
height: 20,
fit: BoxFit.fill,
),
SizedBox(
width: 4.w,
),
Expanded(
child: Text(
"精选好文",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
),
],
)),
],
),
Positioned(
top:130,
left: 12,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget?.articleTop[index]?.mainTitle ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
Text(
widget?.articleTop[index]?.viceTitle ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
],
))
],
),
);
}
}

30
lib/community/headlines/article_page.dart

@ -25,6 +25,7 @@ import 'package:huixiang/view_widget/store_title_tab.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'activity_top_list.dart';
import 'article_list.dart'; import 'article_list.dart';
class ArticlePage extends StatefulWidget { class ArticlePage extends StatefulWidget {
@ -44,6 +45,7 @@ class _ArticlePage extends State<ArticlePage>
List<Brand> brands = []; List<Brand> brands = [];
List<BannerData> bannerData = []; List<BannerData> bannerData = [];
List<Article> articles = []; List<Article> articles = [];
List<Article> articleTop = [];
List<HeadlinesList> headlines = []; List<HeadlinesList> headlines = [];
int pageNum = 1; int pageNum = 1;
@ -57,7 +59,8 @@ class _ArticlePage extends State<ArticlePage>
setState(() {}); setState(() {});
} }
}); });
queryArticleList(); queryArticleList(false);
queryArticleList(true);
queryHeadlinesBanner(); queryHeadlinesBanner();
queryHeadlinesList(); queryHeadlinesList();
} }
@ -95,7 +98,7 @@ class _ArticlePage extends State<ArticlePage>
} }
/// ///
queryArticleList() async { queryArticleList(bool isHot) async {
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
@ -109,7 +112,9 @@ class _ArticlePage extends State<ArticlePage>
"pageSize": 10, "pageSize": 10,
"searchKey": "", "searchKey": "",
"state": 1, "state": 1,
"type": 2 "type": 2,
"storeId":"",
"isHot":isHot
}).catchError((onError) { }).catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
@ -118,9 +123,15 @@ class _ArticlePage extends State<ArticlePage>
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
if (pageNum == 1) { if (pageNum == 1) {
if(!isHot)
articles.clear(); articles.clear();
else
articleTop.clear();
} }
if(!isHot)
articles.addAll(baseData.data.list); articles.addAll(baseData.data.list);
else
articleTop.addAll(baseData.data.list);
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data.pageNum == baseData.data.pages) {
refreshController.loadNoData(); refreshController.loadNoData();
} else { } else {
@ -160,7 +171,8 @@ class _ArticlePage extends State<ArticlePage>
_onRefresh() { _onRefresh() {
queryHeadlinesBanner(); queryHeadlinesBanner();
queryHeadlinesList(); // queryHeadlinesList(); //
queryArticleList(); queryArticleList(false);
queryArticleList(true);
} }
@override @override
@ -182,7 +194,7 @@ class _ArticlePage extends State<ArticlePage>
), ),
onRefresh: _onRefresh, onRefresh: _onRefresh,
onLoading: () { onLoading: () {
queryArticleList(); queryArticleList(false);
}, },
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
scrollController: scrollController, scrollController: scrollController,
@ -227,9 +239,11 @@ class _ArticlePage extends State<ArticlePage>
List<Widget> classChildItem() { List<Widget> classChildItem() {
var widgets = <Widget>[ var widgets = <Widget>[
///banner ///banner
HeadlinesBanner( // HeadlinesBanner(
bannerData, // bannerData,
), // ),
ActivityTopList(articleTop),
SizedBox(height: 28), SizedBox(height: 28),

3
lib/community/headlines/headlines_column_details.dart

@ -78,7 +78,8 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
"searchKey": "", "searchKey": "",
"state": 1, "state": 1,
"type": 2, "type": 2,
"categoryId": categoryId "categoryId": categoryId,
"isHot":"",
}).catchError((onError) { }).catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();

6
lib/home/home_page.dart

@ -66,6 +66,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
setState(() {}); setState(() {});
} }
}); });
queryMsgStats();
if ((widget.invite ?? "") != "" || if ((widget.invite ?? "") != "" ||
widget.interviewCouponList != null && widget.interviewCouponList != null &&
@ -259,12 +260,13 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {}); BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
totalMsg = 0;
baseData.data.forEach((element) { baseData.data.forEach((element) {
totalMsg += element.number; totalMsg += element.number;
}); });
}); });
refreshController.loadComplete(); // refreshController.loadComplete();
refreshController.refreshCompleted(); // refreshController.refreshCompleted();
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
} }

19
lib/message/system_details.dart

@ -37,13 +37,14 @@ class _SystemDetails extends State<SystemDetails> {
int pageNum = 1; int pageNum = 1;
List<Message> messages = []; List<Message> messages = [];
int msgType = 0; int msgType = 0;
String parenId = "0"; // String parenId = "0";
var commentFocus = FocusNode(); var commentFocus = FocusNode();
String hintText = S.current.liuxianinjingcaidepinglunba; String hintText = S.current.liuxianinjingcaidepinglunba;
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
final GlobalKey commentKey = GlobalKey(); final GlobalKey commentKey = GlobalKey();
final GlobalKey inputKey = GlobalKey(); final GlobalKey inputKey = GlobalKey();
final TextEditingController commentTextController = TextEditingController(); final TextEditingController commentTextController = TextEditingController();
int indexMsg = 0;
@override @override
@ -108,17 +109,18 @@ class _SystemDetails extends State<SystemDetails> {
/// ///
_reply(messageRelational) { _reply(messageRelational) {
var messageRelational = jsonDecode(messages[0].relational), var messageRelational = jsonDecode(messages[indexMsg].relational);
parenId = messageRelational["mid"].toString(); messageRelational["mid"].toString();
hintText = S.of(context).huifu_("${messageRelational["nickname"]}"); hintText = S.of(context).huifu_("${messageRelational["nickname"]}");
} }
/// ///
_queryMemberComment(String content) async { _queryMemberComment(String content) async {
var messageRelational = jsonDecode(messages[indexMsg].relational);
BaseData baseData = await apiService.memberComment({ BaseData baseData = await apiService.memberComment({
"content": content, "content": content,
"parentId": parenId, "parentId": messageRelational["mid"].toString(),
"relationalId": messages[0].mid, "relationalId":messageRelational["businessId"].toString(),
"relationalType":4 "relationalType":4
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -130,7 +132,7 @@ class _SystemDetails extends State<SystemDetails> {
SmartDialog.showToast("发布成功", alignment: Alignment.center); SmartDialog.showToast("发布成功", alignment: Alignment.center);
} }
else{ else{
SmartDialog.showToast("发布失败", alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
} }
@ -627,14 +629,14 @@ class _SystemDetails extends State<SystemDetails> {
}, },
); );
}, },
child: commentMessageItem(messages[position]), child: commentMessageItem(messages[position],position),
); );
}), }),
], ],
) )
); );
} }
Widget commentMessageItem(Message message) { Widget commentMessageItem(Message message,index) {
var messageRelational = jsonDecode(message.relational); var messageRelational = jsonDecode(message.relational);
return Container( return Container(
child: child:
@ -697,6 +699,7 @@ class _SystemDetails extends State<SystemDetails> {
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
setState(() { setState(() {
indexMsg = index;
showDeleteDialog(); showDeleteDialog();
_reply(messageRelational); _reply(messageRelational);
}); });

8
lib/message/system_message.dart

@ -28,7 +28,6 @@ class _SystemMessagePage extends State<SystemMessagePage> {
ApiService apiService; ApiService apiService;
int pageNum = 1; int pageNum = 1;
List<Message> messages = []; List<Message> messages = [];
List<MsgStats> msgStats = [];
Map <String,int> msgNumber = { Map <String,int> msgNumber = {
"1":0, "1":0,
"2":0, "2":0,
@ -106,9 +105,10 @@ class _SystemMessagePage extends State<SystemMessagePage> {
BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {}); BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
msgStats.clear(); msgNumber.forEach((key, value) {
msgStats = baseData.data; msgNumber[key] = 0;
msgStats.forEach((element) { });
baseData.data.forEach((element) {
if(msgNumber.containsKey(element.name)){ if(msgNumber.containsKey(element.name)){
msgNumber[element.name] = element.number; msgNumber[element.name] = element.number;
} }

8
lib/retrofit/retrofit_api.dart

@ -54,14 +54,14 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
const base_url = "https://pos.platform.lotus-wallet.com/app/"; /// // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; /// // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
// const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
// const base_url = "http://192.168.10.236:8766/app/"; /// const base_url = "http://192.168.10.236:8766/app/"; ///
// const baseUrl = "http://192.168.10.236:8766/app/"; /// const baseUrl = "http://192.168.10.236:8766/app/"; ///
// const base_url = "http://192.168.10.159:8766/app/"; /// // const base_url = "http://192.168.10.159:8766/app/"; ///
// const baseUrl = "http://192.168.10.159:8766/app/"; /// // const baseUrl = "http://192.168.10.159:8766/app/"; ///

2
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService { class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) { _ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; baseUrl ??= 'http://192.168.10.236:8766/app/';
} }
final Dio _dio; final Dio _dio;

Loading…
Cancel
Save