# Conflicts:
#	lib/constants/api.dart
#	lib/ui/home/answer_idle.dart
#	lib/ui/home/content_connect_page.dart
master
王亚玲 2 years ago
commit 2ffec297aa

@ -30,6 +30,7 @@ class API {
static _App app = _App(); static _App app = _App();
static _Pay pay = _Pay(); static _Pay pay = _Pay();
static _Exclude exclude = _Exclude(); static _Exclude exclude = _Exclude();
static _Content content=_Content();
} }
class _App { class _App {
@ -48,6 +49,14 @@ class _App {
/// ///
String get addTag => '/app/user/addTag'; String get addTag => '/app/user/addTag';
///VIP
String get updateVip => '/app/user/updateVip';
///
String get trialVip => '/app/user/trialVip';
}
class _Content{
/// ///
String get content => '/app/user/content'; String get content => '/app/user/content';
@ -57,7 +66,7 @@ class _App {
/// ///
String get checked => '/app/user/content/checked'; String get checked => '/app/user/content/checked';
/// ///
String get find => '/app/user/content/find'; String get find => '/app/user/content/find';
/// ///

@ -0,0 +1,24 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'sms_content_model.g.dart';
@JsonSerializable()
class SmsContentModel extends Equatable{
final int id;
final String content;
final int isChecked;
factory SmsContentModel.fromJson(Map<String, dynamic> json) =>_$SmsContentModelFromJson(json);
Map<String,dynamic> toJson()=> _$SmsContentModelToJson(this);
const SmsContentModel({
required this.id,
required this.content,
required this.isChecked,
});
@override
List<Object?> get props => [id, content, isChecked];
}

@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'sms_content_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
SmsContentModel _$SmsContentModelFromJson(Map<String, dynamic> json) => SmsContentModel(
id: json['id'] as int,
content: json['content'] as String,
isChecked: json['is_checked'] as int,
);
Map<String, dynamic> _$SmsContentModelToJson(SmsContentModel instance) => <String, dynamic>{
'id': instance.id,
'content': instance.content,
'is_checked':instance.isChecked,
};

@ -1,6 +1,5 @@
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:project_telephony/ui/user/content_details_page.dart';
part 'user_info_model.g.dart'; part 'user_info_model.g.dart';
@ -10,11 +9,11 @@ class UserInfoModel extends Equatable {
final String name; final String name;
final String phone; final String phone;
final int isVip; final int isVip;
final int isTrial;
final String tag; final String tag;
final int status; final int status;
final int start; final int start;
final int end; final int end;
final int isTrial;
final List<Content>? contentRef; final List<Content>? contentRef;
final List<Content>? contentCon; final List<Content>? contentCon;
@ -52,8 +51,19 @@ class UserInfoModel extends Equatable {
}); });
@override @override
List<Object?> get props => List<Object?> get props => [
[id, name, phone, isVip, tag, status, start, end, contentCon, contentRef]; id,
name,
phone,
isVip,
isTrial,
tag,
status,
start,
end,
contentCon,
contentRef
];
} }
@JsonSerializable() @JsonSerializable()

@ -78,7 +78,7 @@ class UserProvider extends ChangeNotifier {
Future updateConSms(int num ) async { Future updateConSms(int num ) async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
var base = await apiClient.request(API.app.find, data: {'status': 1}); var base = await apiClient.request(API.content.find, data: {'status': 1});
if (base.code == 0) { if (base.code == 0) {
await prefs.remove('conSms'); await prefs.remove('conSms');
await prefs.setString( await prefs.setString(
@ -101,7 +101,7 @@ class UserProvider extends ChangeNotifier {
Future updateRefSms() async { Future updateRefSms() async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
var base = await apiClient.request(API.app.find, data: {'status': 2}); var base = await apiClient.request(API.content.find, data: {'status': 2});
if (base.code == 0) { if (base.code == 0) {
await prefs.remove('refSms'); await prefs.remove('refSms');
await prefs.setString( await prefs.setString(

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:project_telephony/model/sms_content_model.dart';
import 'package:project_telephony/utils/user_tool.dart'; import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -8,6 +9,7 @@ import '../../base/base_style.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; import '../../model/network/base_model.dart';
import '../../model/user_info_model.dart';
import '../../providers/user_provider.dart'; import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../user/content_details_page.dart'; import '../user/content_details_page.dart';
@ -25,7 +27,6 @@ class AddSmsPage extends StatefulWidget {
class _AddSmsPageState extends State<AddSmsPage> { class _AddSmsPageState extends State<AddSmsPage> {
late TextEditingController _controller; late TextEditingController _controller;
String contant=""; String contant="";
@override @override
void initState() { void initState() {
@ -91,7 +92,7 @@ class _AddSmsPageState extends State<AddSmsPage> {
border: _controller.text.isEmpty, border: _controller.text.isEmpty,
opacity: contant.isEmpty ? 0.4 : 1, opacity: contant.isEmpty ? 0.4 : 1,
onTap: () async { onTap: () async {
BaseModel res = await apiClient.request(API.app.content, data: { BaseModel res = await apiClient.request(API.content.content, data: {
'content': _controller.text, 'content': _controller.text,
'status': widget.status, 'status': widget.status,
}); });

@ -11,6 +11,7 @@ import '../../constants/api.dart';
import '../../model/contant_list_model.dart'; import '../../model/contant_list_model.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; import '../../model/network/base_model.dart';
import '../../model/sms_content_model.dart';
import '../../providers/user_provider.dart'; import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../widget/centertipsalterwidget.dart'; import '../widget/centertipsalterwidget.dart';
@ -33,8 +34,9 @@ class AnswerIdleList extends StatefulWidget {
class _AnswerIdleListState extends State<AnswerIdleList> class _AnswerIdleListState extends State<AnswerIdleList>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
List<ContantListModel> answerList=[];
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<SmsContentModel> _model = [];
List<ContantListModel> answerList=[];
List<String> textListSMS = []; List<String> textListSMS = [];
List<int> smsIdList = []; List<int> smsIdList = [];
int isCheck = 0; int isCheck = 0;
@ -98,13 +100,6 @@ class _AnswerIdleListState extends State<AnswerIdleList>
])) ]))
], ],
); );
// ListView.builder(
// itemBuilder: (context, index) {
// return _getBox(textListSMS[index], index);
// },
// itemCount: textListSMS.length,
// ),
} }
updateList() async { updateList() async {
@ -113,16 +108,23 @@ class _AnswerIdleListState extends State<AnswerIdleList>
// smsIdList.clear(); // smsIdList.clear();
int i = 0; int i = 0;
// contentRef // contentRef
userProvider.userInfo.contentCon?.forEach((model) { var base = await apiClient.request(API.content.findByStatus, data: {'status': 1});
// textListSMS.add(model.content); if (base.code == 0) {
// smsIdList.add(model.id); _model=(base.data as List)
.map((e) => SmsContentModel.fromJson(e))
.toList();
} else {
CloudToast.show(base.msg);
}
for (var model in _model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if (model.isChecked == 1) { if (model.isChecked == 1) {
isCheck = i; isCheck = i;
} }
i++; i++;
}); }
// "自定义短信内容" textListSMS.add("自定义短信内容");
} else { } else {
textListSMS = textList; textListSMS = textList;
} }

@ -12,6 +12,7 @@ import '../../base/base_style.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; import '../../model/network/base_model.dart';
import '../../model/sms_content_model.dart';
import '../../providers/user_provider.dart'; import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../widget/centertipsalterwidget.dart'; import '../widget/centertipsalterwidget.dart';
@ -19,13 +20,19 @@ import 'add_sms_page.dart';
class CallingIdleList extends StatefulWidget { class CallingIdleList extends StatefulWidget {
final EasyRefreshController refreshController; final EasyRefreshController refreshController;
final bool isIdle; final String title;
final int status;
final bool? isIdle;
final Color themeColor;
// final List contant; const CallingIdleList({
Key? key,
const CallingIdleList( required this.title,
{Key? key, required this.refreshController, required this.isIdle}) required this.status,
: super(key: key); this.isIdle = false,
required this.themeColor,
required this.refreshController,
}) : super(key: key);
@override @override
_CallingIdleListState createState() => _CallingIdleListState(); _CallingIdleListState createState() => _CallingIdleListState();
@ -35,13 +42,17 @@ class _CallingIdleListState extends State<CallingIdleList>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<SmsContentModel> _model = [];
List<String> textListSMS = []; List<String> textListSMS = [];
List<int> smsIdList = []; List<int> smsIdList = [];
int isCheck = 0; int isCheck = 0;
bool val = false; bool val = false;
// final EasyRefreshController _easyRefreshController = EasyRefreshController(); @override
void initState() {
super.initState();
updateList();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -49,11 +60,9 @@ class _CallingIdleListState extends State<CallingIdleList>
children: [ children: [
_getText(), _getText(),
32.hb, 32.hb,
widget.isIdle widget.isIdle!
? val ? val
? Expanded( ? Expanded(
// width: 662.w,
// height: 800.w,
child: EasyRefresh.custom( child: EasyRefresh.custom(
firstRefresh: true, firstRefresh: true,
controller: widget.refreshController, controller: widget.refreshController,
@ -62,7 +71,7 @@ class _CallingIdleListState extends State<CallingIdleList>
onRefresh: () async { onRefresh: () async {
await userProvider.updateUserInfo(); await userProvider.updateUserInfo();
userProvider.updateRefSms(); userProvider.updateRefSms();
updateList(); await updateList();
setState(() {}); setState(() {});
}, },
slivers: [ slivers: [
@ -70,12 +79,13 @@ class _CallingIdleListState extends State<CallingIdleList>
delegate: delegate:
SliverChildBuilderDelegate((context, index) { SliverChildBuilderDelegate((context, index) {
return _getBox(textListSMS[index], index); return _getBox(textListSMS[index], index);
}, childCount: textListSMS.length)) }, childCount: textListSMS.length),
])) ),
],
),
)
: _getEmptyList() : _getEmptyList()
: Expanded( : Expanded(
// width: 662.w,
// height: 800.w,
child: EasyRefresh.custom( child: EasyRefresh.custom(
firstRefresh: true, firstRefresh: true,
controller: widget.refreshController, controller: widget.refreshController,
@ -84,24 +94,20 @@ class _CallingIdleListState extends State<CallingIdleList>
onRefresh: () async { onRefresh: () async {
await userProvider.updateUserInfo(); await userProvider.updateUserInfo();
userProvider.updateRefSms(); userProvider.updateRefSms();
updateList(); await updateList();
setState(() {}); setState(() {});
}, },
slivers: [ slivers: [
SliverList( SliverList(
delegate: SliverChildBuilderDelegate((context, index) { delegate: SliverChildBuilderDelegate((context, index) {
return _getBox(textListSMS[index], index); return _getBox(textListSMS[index], index);
}, childCount: textListSMS.length)) }, childCount: textListSMS.length),
])) ),
],
),
),
], ],
); );
// ListView.builder(
// itemBuilder: (context, index) {
// return _getBox(textListSMS[index], index);
// },
// itemCount: textListSMS.length,
// ),
} }
updateList() async { updateList() async {
@ -109,14 +115,23 @@ class _CallingIdleListState extends State<CallingIdleList>
textListSMS.clear(); textListSMS.clear();
smsIdList.clear(); smsIdList.clear();
int i = 0; int i = 0;
userProvider.userInfo.contentRef?.forEach((model) { var base = await apiClient
.request(API.content.findByStatus, data: {'status': widget.status});
if (base.code == 0) {
_model = (base.data as List)
.map((e) => SmsContentModel.fromJson(e))
.toList();
} else {
CloudToast.show(base.msg);
}
for (var model in _model) {
textListSMS.add(model.content); textListSMS.add(model.content);
smsIdList.add(model.id); smsIdList.add(model.id);
if (model.isChecked == 1) { if (model.isChecked == 1) {
isCheck = i; isCheck = i;
} }
i++; i++;
}); }
textListSMS.add("自定义短信内容"); textListSMS.add("自定义短信内容");
} else { } else {
textListSMS = textList; textListSMS = textList;
@ -126,7 +141,6 @@ class _CallingIdleListState extends State<CallingIdleList>
_getText() { _getText() {
return Container( return Container(
height: 128.w, height: 128.w,
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w), padding: EdgeInsets.only(left: 40.w, top: 45.w),
child: ListTile( child: ListTile(
title: Text( title: Text(
@ -134,19 +148,13 @@ class _CallingIdleListState extends State<CallingIdleList>
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
), ),
subtitle: Text( subtitle: Text(
widget.isIdle widget.title,
? "您给朋友去电拒接/未接后所发送的短信":"朋友给你来电接听后所发送的短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp), style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp),
), ),
trailing: widget.isIdle trailing: widget.isIdle!
? Switch( ? Switch(
value: val, value: val,
onChanged: (value) async { onChanged: (value) async {
// if(!value){
//
// }
// await prefs.setBool("kg", value);
// print("这是数据${prefs.getBool("kg")}");
setState(() { setState(() {
val = value; val = value;
}); });
@ -159,7 +167,7 @@ class _CallingIdleListState extends State<CallingIdleList>
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
if (content != "自定义短信内容") { if (content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.app.checked, BaseModel res = await apiClient.request(API.content.checked,
data: {'id': smsIdList[index], 'status': 2}); data: {'id': smsIdList[index], 'status': 2});
if (res.code == 0) { if (res.code == 0) {
setState(() {}); setState(() {});
@ -223,12 +231,8 @@ class _CallingIdleListState extends State<CallingIdleList>
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight, end: Alignment.centerRight,
colors: [ colors: [
index == isCheck index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9),
? const Color(0xFF13CA9D) index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9),
: const Color(0xFFF9F9F9),
index == isCheck
? const Color(0xFF72E4C8)
: const Color(0xFFF9F9F9),
]), ]),
), ),
child: Text( child: Text(

@ -10,7 +10,6 @@ import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import 'answer_idle.dart'; import 'answer_idle.dart';
class ContentConnectPage extends StatefulWidget { class ContentConnectPage extends StatefulWidget {
const ContentConnectPage({Key? key}) : super(key: key); const ContentConnectPage({Key? key}) : super(key: key);
@ -26,6 +25,8 @@ class _ContentConnectPageState extends State<ContentConnectPage>
final EasyRefreshController _wasAnswerRefreshController = final EasyRefreshController _wasAnswerRefreshController =
EasyRefreshController(); EasyRefreshController();
int state=1; int state=1;
@override @override
void initState() { void initState() {
_tabController = TabController(length: 2, initialIndex: 0, vsync: this); _tabController = TabController(length: 2, initialIndex: 0, vsync: this);
@ -114,22 +115,6 @@ class _ContentConnectPageState extends State<ContentConnectPage>
)); ));
} }
// _getBox() {
// return Container(
// color: Colors.red,
// width: 200.w,
// height: 200.w,
// );
// }
//
// _tab(int int, String string) {
// return Text(
// string,
// style: TextStyle(
// fontSize: BaseStyle.fontSize28, color:const Color(0xFF1890FF) ),
// );
// }
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
@ -58,14 +57,16 @@ class _ContentRefusePageState extends State<ContentRefusePage>
height: 88.w, height: 88.w,
margin: EdgeInsets.symmetric(horizontal: 66.w), margin: EdgeInsets.symmetric(horizontal: 66.w),
padding: EdgeInsets.all(8.w), padding: EdgeInsets.all(8.w),
decoration:BoxDecoration(color: const Color(0xFFF9F9F9),borderRadius: BorderRadius.all(Radius.circular(44.w))), decoration: BoxDecoration(
color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.all(Radius.circular(44.w))),
child: TabBar( child: TabBar(
// indicator: Decoration(), // indicator: Decoration(),
controller: _tabController, controller: _tabController,
labelColor: const Color(0xFF1890FF), labelColor: const Color(0xFF1890FF),
unselectedLabelColor: const Color(0xFF999999), unselectedLabelColor: const Color(0xFF999999),
unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold), unselectedLabelStyle:
const TextStyle(fontWeight: FontWeight.bold),
labelStyle: const TextStyle(fontWeight: FontWeight.bold), labelStyle: const TextStyle(fontWeight: FontWeight.bold),
onTap: (num) { onTap: (num) {
if (num == 0) { if (num == 0) {
@ -73,7 +74,6 @@ class _ContentRefusePageState extends State<ContentRefusePage>
} else { } else {
_wasCalledRefreshController.callRefresh(); _wasCalledRefreshController.callRefresh();
} }
//
}, },
indicator: RectangularIndicator( indicator: RectangularIndicator(
color: Colors.white, color: Colors.white,
@ -81,47 +81,38 @@ class _ContentRefusePageState extends State<ContentRefusePage>
bottomRightRadius: 44.w, bottomRightRadius: 44.w,
topLeftRadius: 44.w, topLeftRadius: 44.w,
topRightRadius: 44.w, topRightRadius: 44.w,
// paintingStyle: PaintingStyle.fill,
), ),
// indicatorSize: TabBarIndicatorSize.label,
// isScrollable: true,
tabs: const [ tabs: const [
// _tab(0, "被叫接听"),_tab(1, "主叫接听"), Tab(
Tab(text: "被叫拒接/未接",),Tab(text: "主叫拒接/未接",) text: "被叫拒接/未接",
]), ),
Tab(
text: "主叫拒接/未接",
),
],
),
), ),
Expanded( Expanded(
child: TabBarView(controller: _tabController, children: [ child: TabBarView(
// _getBox(), controller: _tabController,
children:[
CallingIdleList( CallingIdleList(
// contant: const [],
refreshController: _callingRefreshController,
isIdle: false, isIdle: false,
status: 2,
themeColor: const Color(0xFF13CA9D),
title: '朋友给你来电接听后所发送的短信', refreshController: _callingRefreshController,
), ),
CallingIdleList( CallingIdleList(
// contant: const [], isIdle: true,
refreshController: _wasCalledRefreshController, isIdle: true, status: 4,
) title: '您给朋友去电拒接/未接后所发送的短信',
])) themeColor: const Color(0xFF13CA9D), refreshController: _wasCalledRefreshController,
),
], ],
)); ),
} ),
],
_getBox() { ),
return Container(
color: Colors.red,
width: 200.w,
height: 200.w,
);
}
_tab(int int, String string) {
return Text(
string,
style: TextStyle(
fontSize: BaseStyle.fontSize28, color:const Color(0xFF1890FF) ),
); );
} }

@ -57,7 +57,7 @@ class _CentertipsalterwidgetState extends State<Centertipsalterwidget> {
CupertinoDialogAction( CupertinoDialogAction(
child: const Text('确定'), child: const Text('确定'),
onPressed: () async { onPressed: () async {
BaseModel res = await apiClient.request(API.app.delete, data: { BaseModel res = await apiClient.request(API.content.delete, data: {
'id': widget.id, 'id': widget.id,
}); });
if (res.code == 0) { if (res.code == 0) {

Loading…
Cancel
Save