提交更改

master
王亚玲 3 years ago
parent c7bc4a35fb
commit e7e2163692

@ -43,7 +43,6 @@ void main() async {
// LoggerData.addData(details); // LoggerData.addData(details);
// FlutterError.presentError(details); // FlutterError.presentError(details);
// }; // };
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
// await initializeService(); // await initializeService();

@ -91,7 +91,6 @@ 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.app.content, data: {
'content': _controller.text, 'content': _controller.text,
'status': widget.status, 'status': widget.status,

@ -22,7 +22,7 @@ class ContentConnectPage extends StatefulWidget {
} }
class _ContentConnectPageState extends State<ContentConnectPage> { class _ContentConnectPageState extends State<ContentConnectPage> {
List<String> textList = ['欢迎您的来电,祝您生活愉快', '自定义短信内容']; List<String> textList = ['欢迎您的来电,祝您生活愉快','自定义短信内容'];
List<int> smsIdList = []; List<int> smsIdList = [];
List<String> textListSMS = []; List<String> textListSMS = [];
int isCheck=0; int isCheck=0;
@ -74,16 +74,20 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
backgroundColor: kForeGroundColor, backgroundColor: kForeGroundColor,
), ),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Column(children: [ body: _getList()
Expanded(
child: _getList(), // Column(children: [
), // // _getEditContent(),
]), // Expanded(child: _getList()),
//
//
// ]),
); );
} }
_getList() { _getList() {
return EasyRefresh( return
EasyRefresh(
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
footer: MaterialFooter(), footer: MaterialFooter(),
@ -94,6 +98,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
setState(() {}); setState(() {});
}, },
child: ListView.builder( child: ListView.builder(
shrinkWrap:true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _getBox(textListSMS[index], index); return _getBox(textListSMS[index], index);
}, },
@ -136,8 +141,12 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
}, },
onLongPress: () { onLongPress: () {
if (content != "自定义短信内容") { if (content != "自定义短信内容") {
if (textListSMS.length == 1) { if (textListSMS.length == 2 || isCheck == index) {
BotToast.showText(text: '不能再删了'); if(textListSMS.length == 2){
BotToast.showText(text: '最后一条内容不可删除');
}else if(isCheck == index){
BotToast.showText(text: '当前为选中内容,不可删除');
}
} else { } else {
showDialog( showDialog(
context: context, context: context,
@ -160,8 +169,14 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.all(40.w), padding: EdgeInsets.all(40.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16.w),
color: index==isCheck?Colors.blue:const Color(0xFFF9F9F9), gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
index==isCheck? const Color(0xFF74BCFF):const Color(0xFFF9F9F9),
index==isCheck? const Color(0xFF1890FF):const Color(0xFFF9F9F9),
]),
), ),
child: Text( child: Text(
content, content,
@ -173,4 +188,40 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
), ),
); );
} }
// _getEditContent(){
// return GestureDetector(
// onTap: (){
// if (UserTool.userProvider.userInfo.isVip==1) {
// if (textListSMS.length > 5) {
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
// } else {
// Get.to(AddSmsPage(
// status: 2,
// ploneBack: (String textContent) {
// _easyRefreshController.callRefresh();
// },
// ));
// }
// } else {
// BotToast.showText(text: '请先开通会员');
// }
// }
// ,child: Container(
// width: double.infinity,
// height: 128.w,
// margin: EdgeInsets.symmetric(horizontal: 64.w),
// padding: EdgeInsets.only(left: 40.w,top: 45.w),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(16),
// color: const Color(0xFFF9F9F9),
// ),
// child: Text(
// "定义短信内容",
// style: TextStyle(
// fontSize: BaseStyle.fontSize28,
// color: BaseStyle.color333333,
// fontWeight: FontWeight.bold),
// ),
// ),);
// }
} }

@ -6,6 +6,7 @@ import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/widget/centertipsalterwidget.dart'; import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
@ -26,8 +27,6 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
List<String> textListSMS = []; List<String> textListSMS = [];
List<int> smsIdList = []; List<int> smsIdList = [];
int isCheck=0; int isCheck=0;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController(); final EasyRefreshController _easyRefreshController = EasyRefreshController();
@ -75,11 +74,15 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
backgroundColor: kForeGroundColor, backgroundColor: kForeGroundColor,
), ),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Column(children: [ body: _getList()
Expanded( // Column(children: [
child: _getList(), // _getEditContent(),
), // Expanded(
]), // child: _getList(),
// ),
//
// ]),
// bottomNavigationBar: _getEditContent(),
); );
} }
@ -136,9 +139,14 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
setState(() {}); setState(() {});
}, },
onLongPress: () { onLongPress: () {
if (content != "自定义短信内容") { if (content != "自定义短信内容") {
if (textListSMS.length == 2) { if (textListSMS.length == 2 || isCheck == index) {
BotToast.showText(text: '不能再删了'); if(textListSMS.length == 2){
BotToast.showText(text: '最后一条内容不可删除');
}else if(isCheck == index){
BotToast.showText(text: '当前为选中内容,不可删除');
}
} else { } else {
showDialog( showDialog(
context: context, context: context,
@ -153,16 +161,25 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
); );
}); });
} }
} }
setState(() {}); setState(() {});
}, },
child: Container( child:
Container(
// width: 686.w, // width: 686.w,
height: 128.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.all(40.w), padding: EdgeInsets.only(left: 40.w,top: 45.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
color: index==isCheck?const Color(0xFF72E4C8) :const Color(0xFFF9F9F9), gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
index==isCheck? const Color(0xFF13CA9D):const Color(0xFFF9F9F9),
index==isCheck? const Color(0xFF72E4C8):const Color(0xFFF9F9F9),
]),
), ),
child: Text( child: Text(
content, content,
@ -174,4 +191,43 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
), ),
); );
} }
// int _getEasyRefresh(){
// return EasyRefresh(onRefresh: ,child: ,);
// }
// _getEditContent(){
// return GestureDetector(
// onTap: (){
// if (userProvider.userInfo.isVip==1) {
// if (textListSMS.length > 5) {
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
// } else {
// Get.to(AddSmsPage(
// status: 2,
// ploneBack: (String textContent) {
// _easyRefreshController.callRefresh();
// },
// ));
// }
// } else {
// BotToast.showText(text: '请先开通会员');
// }
// }
// ,child: Container(
// width: double.infinity,
// height: 128.w,
// margin: EdgeInsets.symmetric(horizontal: 64.w),
// padding: EdgeInsets.only(left: 40.w,top: 45.w),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(16),
// color: const Color(0xFFF9F9F9),
// ),
// child: Text(
// "定义短信内容",
// style: TextStyle(
// fontSize: BaseStyle.fontSize28,
// color: BaseStyle.color333333,
// fontWeight: FontWeight.bold),
// ),
// ),);
// }
} }

@ -138,9 +138,9 @@ class _LoginPageState extends State<LoginPage> {
data: {'phone': _phoneController.text, 'code': _smsCodeController.text}); data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
if (base.code == 0) { if (base.code == 0) {
print("123123${base.data['token']}"); print("123123${base.data['token']}");
var a= await UserTool.userProvider.setToken(base.data['token']); await UserTool.userProvider.setToken(base.data['token']);
print(a); // print(a);
print("4567899"); // print("4567899");
Get.offAll(const TabNavigator()); Get.offAll(const TabNavigator());
} }
else { else {
@ -222,12 +222,12 @@ class _LoginPageState extends State<LoginPage> {
await apiClient.request(API.app.captcha, data: { await apiClient.request(API.app.captcha, data: {
'phone': _phoneController.text, 'phone': _phoneController.text,
}); });
if((_phoneController.text).isEmpty ){ var res= RegExp( r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
BotToast.showText(text: "手机号不能为空"); if((_phoneController.text).isNotEmpty && res.hasMatch(_phoneController.text)){
}else{
_beginCountDown(); _beginCountDown();
}else{
BotToast.showText(text: "手机号不能为空且手机号格式错误");
} }
if (_cantSelected) return; if (_cantSelected) return;
_cantSelected = true; _cantSelected = true;
Future.delayed(const Duration(seconds: 1), () { Future.delayed(const Duration(seconds: 1), () {

@ -64,6 +64,7 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
await _launchUrl(); await _launchUrl();
// await launchUrlString("tel:13111111111"); // await launchUrlString("tel:13111111111");
} , } ,
// onTap: () async{ // onTap: () async{
// //
// }, // },

@ -44,31 +44,49 @@ class _UserPageState extends State<UserPage> {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool isVip = false; bool isVip = false;
String? endDate; String? endDate;
bool vle=false; final service = FlutterBackgroundService();
@override
late bool vle=false;
// bool vle=service.isRunning() as bool;
_load() async{
vle=await service.isRunning();
}
@override
void initState() { void initState() {
super.initState(); super.initState();
UserTool.userProvider.updateUserInfo(); UserTool.userProvider.updateUserInfo();
if ( UserTool.userProvider.isLogin) { Future.delayed(const Duration(milliseconds: 0), ()=>setState(() {
print(UserTool.userProvider.userInfo.end*1000); if ( UserTool.userProvider.isLogin) {
print(DateTime.now().millisecondsSinceEpoch); print(UserTool.userProvider.userInfo.end*1000);
if (UserTool.userProvider.userInfo.end*1000<=DateTime.now().millisecondsSinceEpoch ) { print(DateTime.now().millisecondsSinceEpoch);
isVip = false; if (UserTool.userProvider.userInfo.end*1000<=DateTime.now().millisecondsSinceEpoch ) {
vle =false; isVip = false;
} else { vle=false;
isVip = true; } else {
isVip = true;
_load();
// if( await service.isRunning()){
// vle=true;
// }else{
// vle=false;
// }
// vle=true;
}
//service.isRunning() as bool;
endDate=DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d);
}else{
vle = false;
} }
endDate=DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d); }));
}else{ // Future.delayed(const Duration(milliseconds: 0), () async {
vle = false; //
} // });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CloudScaffold( return CloudScaffold(
systemStyle: const SystemUiOverlayStyle( systemStyle: const SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark, statusBarIconBrightness: Brightness.dark,
// systemNavigationBarColor: Colors.white, // systemNavigationBarColor: Colors.white,
@ -289,7 +307,7 @@ class _UserPageState extends State<UserPage> {
trailing: Switch( trailing: Switch(
value: vle, value: vle,
onChanged: (value) async { onChanged: (value) async {
final service = FlutterBackgroundService();
final SharedPreferences prefs = await _prefs; final SharedPreferences prefs = await _prefs;
// if(!value){ // if(!value){
// //
@ -299,7 +317,6 @@ class _UserPageState extends State<UserPage> {
setState(() { setState(() {
if(isVip){ if(isVip){
vle=value; vle=value;
// prefs.setBool("kg", vle); // prefs.setBool("kg", vle);
// initializeService(); // initializeService();
if(vle){ if(vle){

Loading…
Cancel
Save