王亚玲 2 years ago
commit d4eab235c9

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -1,15 +1,17 @@
import 'environment/environment.dart';
class API {
static const tokenKey = 'Telephony-Manage-Token';
static const tokenKey = 'Manage-Token';
///HOST
static String get host {
if (DevEV.instance.dev) {
// return 'http://10.0.2.2:8088/';
return 'http://api.dxbs.vip';
return 'http://10.0.2.2:8088/';
// return 'http://api.dxbs.vip';
} else {
return 'http://api.dxbs.vip/';
return 'http://10.0.2.2:8088/';
// return 'http://api.dxbs.vip/';
}
}
@ -43,6 +45,8 @@ class _App {
String get content => '/app/user/content';
///
String get delete => '/app/user/content/delete';
///
String get checked => '/app/user/content/checked';
///VIP
String get updateVip => '/app/user/updateVip';
}

@ -74,6 +74,10 @@ class $AssetsImagesGen {
AssetGenImage get portrait =>
const AssetGenImage('assets/images/portrait.png');
/// File path: assets/images/portrait_deep.png
AssetGenImage get portraitDeep =>
const AssetGenImage('assets/images/portrait_deep.png');
/// File path: assets/images/refused.png
AssetGenImage get refused => const AssetGenImage('assets/images/refused.png');

@ -12,8 +12,8 @@ class UserInfoModel extends Equatable {
final int isVip;
final String tag;
final int status;
final num start;
final num end;
final int start;
final int end;
final List<Content>? contentRef;
final List<Content>? contentCon;
@ -35,8 +35,8 @@ class UserInfoModel extends Equatable {
contentRef: [],
);
const UserInfoModel(
{required this.id,
const UserInfoModel({
required this.id,
required this.name,
required this.phone,
required this.isVip,
@ -47,6 +47,7 @@ class UserInfoModel extends Equatable {
required this.contentCon,
required this.contentRef,
});
@override
List<Object?> get props =>
[id, name, phone, isVip, tag, status, start, end, contentCon, contentRef];
@ -56,10 +57,12 @@ class UserInfoModel extends Equatable {
class Content extends Equatable {
final int id;
final String content;
final int isChecked;
const Content({
required this.id,
required this.content,
required this.isChecked,
});
factory Content.fromJson(Map<String, dynamic> json) =>
@ -68,5 +71,5 @@ class Content extends Equatable {
Map<String, dynamic> toJson() => _$ContentToJson(this);
@override
List<Object?> get props => [id, content];
List<Object?> get props => [id, content, isChecked];
}

@ -14,8 +14,8 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
isVip: json['is_vip'] as int,
tag: json['tag']as String,
status: json['status'] as int,
start: json['start']as num,
end: json['end']as num,
start: json['start']as int,
end: json['end']as int,
contentCon:(json['content_con'] as List<dynamic>?)
?.map((e) => Content.fromJson(e as Map<String, dynamic>))
.toList(),
@ -41,9 +41,11 @@ Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) =>
Content _$ContentFromJson(Map<String, dynamic> json) => Content(
id: json['id'] as int,
content: json['content'] as String,
isChecked: json['is_checked'] as int,
);
Map<String, dynamic> _$ContentToJson(Content instance) => <String, dynamic>{
'id': instance.id,
'content': instance.content,
'is_checked':instance.isChecked,
};

@ -8,7 +8,11 @@ import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart';
import '../../constants/api.dart';
import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
class ContentConnectPage extends StatefulWidget {
const ContentConnectPage({Key? key}) : super(key: key);
@ -18,20 +22,14 @@ class ContentConnectPage extends StatefulWidget {
}
class _ContentConnectPageState extends State<ContentConnectPage> {
int _select = 0;
List<String> textList = [
// '欢迎您的来电,祝您生活愉快',
// '祝您万事顺心',
// '感谢您的来电,我们会尽快处理的',
// "自定义短信内容"
];
List<String> textList = ['欢迎您的来电,祝您生活愉快', '自定义短信内容'];
List<int> smsIdList = [];
List<String> textListSMS = [];
int isCheck=0;
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
void initState() {
super.initState();
@ -48,9 +46,14 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
if (UserTool.userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i=0;
UserTool.userProvider.userInfo.contentCon?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if(model.isChecked==1){
isCheck=i;
}
i++;
});
textListSMS.add("自定义短信内容");
} else {
@ -92,25 +95,34 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
},
child: ListView.builder(
itemBuilder: (context, index) {
return _getBox(textListSMS[index], index == _select, index);
return _getBox(textListSMS[index], index);
},
itemCount: textListSMS.length,
),
);
}
_getBox(String content, bool pd, int index) {
_getBox(String content, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
_select = index;
BaseModel res = await apiClient.request(API.app.checked,
data: {'id': smsIdList[index], 'status': 1});
if (res.code == 0) {
setState(() {});
UserTool.userProvider.updateUserInfo();
_easyRefreshController.callRefresh();
} else {
CloudToast.show(res.msg);
}
} else {
if (UserTool.userProvider.isLogin) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
Get.to(AddSmsPage(
status: 1, ploneBack: (String textContent) {
status: 1,
ploneBack: (String textContent) {
_easyRefreshController.callRefresh();
},
));
@ -123,7 +135,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
},
onLongPress: () {
if (content != "自定义短信内容") {
if (textListSMS.length<2 ) {
if (textListSMS.length == 1) {
BotToast.showText(text: '不能再删了');
} else {
showDialog(
@ -131,7 +143,11 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板', id: smsIdList[index],
title: '删除短信模板',
id: smsIdList[index],
callback: (bool status) {
_easyRefreshController.callRefresh();
},
);
});
}
@ -144,13 +160,13 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: pd ? Colors.blue : const Color(0xFFF9F9F9),
color: index==isCheck?Colors.blue:const Color(0xFFF9F9F9),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
color: index==isCheck?const Color(0xFFF9F9F9):BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),

@ -7,7 +7,11 @@ import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
import '../../constants/api.dart';
import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
import 'add_sms_page.dart';
class ContentRefusePage extends StatefulWidget {
@ -18,10 +22,11 @@ class ContentRefusePage extends StatefulWidget {
}
class _ContentRefusePageState extends State<ContentRefusePage> {
int _select = 0;
List<String> textList = ['现在无法接听。有什么事吗?', '我马上会打给你。', '我稍后会打给你。', "自定义短信内容"];
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<String> textListSMS = [];
List<int> smsIdList = [];
int isCheck=0;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@ -38,12 +43,18 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
super.dispose();
}
Future updateList() async{
updateList() async {
if (userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i=0;
userProvider.userInfo.contentRef?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if(model.isChecked==1){
isCheck=i;
}
i++;
});
textListSMS.add("自定义短信内容");
} else {
@ -79,29 +90,42 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
footer: MaterialFooter(),
controller: _easyRefreshController,
onRefresh: () async {
await updateList();
await userProvider.updateUserInfo();
updateList();
setState(() {});
},
child: ListView.builder(
itemBuilder: (context, index) {
return _getBox(textListSMS[index], index == _select, index);
return _getBox(textListSMS[index], index);
},
itemCount: textListSMS.length,
),
);
}
_getBox(String content, bool pd, int index) {
_getBox(String content, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
_select = index;
BaseModel res = await apiClient.request(API.app.checked,
data: {'id': smsIdList[index], 'status': 2});
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
_easyRefreshController.callRefresh();
} else {
CloudToast.show(res.msg);
}
} else {
if (userProvider.isLogin) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
Get.to(AddSmsPage(
status: 2, ploneBack: (String textContent) { },
status: 2,
ploneBack: (String textContent) {
_easyRefreshController.callRefresh();
},
));
}
} else {
@ -112,7 +136,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
},
onLongPress: () {
if (content != "自定义短信内容") {
if (textListSMS.length<2 ) {
if (textListSMS.length == 1) {
BotToast.showText(text: '不能再删了');
} else {
showDialog(
@ -120,14 +144,16 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板', id: smsIdList[index],
title: '删除短信模板',
id: smsIdList[index],
callback: (bool status) {
_easyRefreshController.callRefresh();
},
);
});
}
}
setState(() {
_easyRefreshController.callRefresh();
});
setState(() {});
},
child: Container(
// width: 686.w,
@ -135,13 +161,13 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: pd ? const Color(0xFF72E4C8) : const Color(0xFFF9F9F9),
color: index==isCheck?const Color(0xFF72E4C8) :const Color(0xFFF9F9F9),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
color: index==isCheck?const Color(0xFFF9F9F9):BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),

@ -131,6 +131,7 @@ class _LoginPageState extends State<LoginPage> {
var base = await apiClient.request(API.app.login,
data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
if (base.code == 0) {
print(base.data['token']);
await UserTool.userProvider.setToken(base.data['token']);
Get.offAll(() => const TabNavigator());
} else {
@ -293,7 +294,6 @@ class _LoginPageState extends State<LoginPage> {
if (kDebugMode) {
print("点击协议了");
}
///
};
return recognizer;

@ -1,29 +1,20 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/login/login_page.dart';
import 'package:project_telephony/ui/tab_navigator.dart';
import 'package:project_telephony/ui/user/content_authority_page.dart';
import 'package:project_telephony/ui/user/members_page.dart';
import 'package:project_telephony/ui/user/privacy_rights_page.dart';
import 'package:project_telephony/ui/widget/image_scaffold.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/ui/widget/plone_image_picker.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/permissionutils.dart';
import 'package:provider/provider.dart';
import 'package:telephony/telephony.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../constants/api.dart';
import '../../model/network/api_client.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart';
@ -46,6 +37,7 @@ class _UserPageState extends State<UserPage> {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool vle = false;
bool isVip = false;
String? endDate;
@override
void initState() {
@ -56,6 +48,7 @@ class _UserPageState extends State<UserPage> {
} else {
isVip = false;
}
endDate=DateUtil.formatDateMs(userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d);
}
}
@ -136,15 +129,15 @@ class _UserPageState extends State<UserPage> {
const Spacer(),
GestureDetector(
onTap: () async {
var value = await CloudImagePicker.pickSingleImage(title: '选择图片');
if (value != null) {
BotToast.showText(text: '头像成功');
setState(() {});
}
// var value = await CloudImagePicker.pickSingleImage(title: '选择图片');
// if (value != null) {
// BotToast.showText(text: '头像成功');
// setState(() {});
// }//
},
child: ClipOval(
child: Image.asset(
Assets.images.portrait.path,
userProvider.isLogin?Assets.images.portraitDeep.path:Assets.images.portrait.path,
height: 128.w,
width: 128.w,
fit: BoxFit.cover,
@ -152,7 +145,6 @@ class _UserPageState extends State<UserPage> {
),
)
],
),
);
}
@ -215,7 +207,7 @@ class _UserPageState extends State<UserPage> {
_getVip(),
16.hb,
Text(
isVip?"{$userProvider.userInfo.end}到期":"解锁全部功能",
isVip ? "$endDate到期" : "解锁全部功能",
style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24),
)
],
@ -258,7 +250,6 @@ class _UserPageState extends State<UserPage> {
_getSwitch(String url, String name, bool pd) {
return GestureDetector(
onTap: () async {
if (!pd) {
switch (name) {
case "短信标签":
@ -321,8 +312,7 @@ class _UserPageState extends State<UserPage> {
// setState(() {
// vle = value;
// });
}
)
})
: const Icon(Icons.keyboard_arrow_right)),
),
);

@ -9,12 +9,17 @@ import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
typedef Callback = Function(bool status);
class Centertipsalterwidget extends StatefulWidget {
final String title;
final String desText;
final int id;
final Callback callback;
const Centertipsalterwidget(
{Key? key, required this.desText, required this.title, required this.id})
{Key? key, required this.desText, required this.title, required this.id, required this.callback})
: super(key: key);
@override
@ -45,6 +50,7 @@ class _CentertipsalterwidgetState extends State<Centertipsalterwidget> {
style: TextStyle(color: Color(0xFF999999)),
),
onPressed: () {
widget.callback(false);
Navigator.pop(context);
},
),
@ -60,6 +66,7 @@ class _CentertipsalterwidgetState extends State<Centertipsalterwidget> {
} else {
CloudToast.show(res.msg);
}
widget.callback(true);
Navigator.pop(context);
},
)

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "40.0.0"
version: "46.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.6.0"
archive:
dependency: transitive
description:
@ -112,7 +112,7 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.4.0"
version: "8.4.1"
call_log:
dependency: "direct main"
description:
@ -161,7 +161,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.2.0"
collection:
dependency: transitive
description:
@ -287,7 +287,7 @@ packages:
name: equatable
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.5"
fake_async:
dependency: transitive
description:
@ -308,7 +308,7 @@ packages:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
version: "6.1.4"
fixnum:
dependency: transitive
description:
@ -397,7 +397,7 @@ packages:
name: flutter_native_splash
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2"
version: "1.3.3"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@ -470,7 +470,7 @@ packages:
name: grinder
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1"
version: "0.9.2"
highlight:
dependency: transitive
description:
@ -743,7 +743,7 @@ packages:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.12"
version: "2.0.19"
path_provider_ios:
dependency: transitive
description:
@ -820,7 +820,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
version: "5.0.0"
platform:
dependency: transitive
description:
@ -876,7 +876,7 @@ packages:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
rational:
dependency: transitive
description:
@ -946,7 +946,7 @@ packages:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.2"
shelf_web_socket:
dependency: transitive
description:
@ -1079,7 +1079,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
universal_io:
dependency: transitive
description:
@ -1128,7 +1128,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.2"
version: "2.6.1"
xdg_directories:
dependency: transitive
description:
@ -1142,7 +1142,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.1"
version: "5.4.1"
yaml:
dependency: "direct dev"
description:
@ -1151,5 +1151,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.17.0-206.0.dev <3.0.0"
flutter: ">=2.8.0"
dart: ">=2.17.0 <3.0.0"
flutter: ">=2.8.1"

Loading…
Cancel
Save