From e2063d83d5ca10420e69449c38405b2e2a0758c7 Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Wed, 21 Sep 2022 17:34:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/providers/user_provider.dart | 5 +++ lib/ui/TextMe/call_list_page.dart | 14 ------ lib/ui/TextMe/text_me_page.dart | 75 ++++++++++++++++++------------- lib/ui/TextMe/text_template.dart | 1 + lib/ui/home/add_sms_page.dart | 1 - lib/ui/loading.dart | 11 +---- 6 files changed, 53 insertions(+), 54 deletions(-) diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index a54992f..c7e34b0 100644 --- a/lib/providers/user_provider.dart +++ b/lib/providers/user_provider.dart @@ -58,6 +58,11 @@ class UserProvider extends ChangeNotifier { prefs.setInt("numIndex", 0); _viewLoading(); UserTool.phoneNumProvider.init(); + prefs.setStringList("dxText", [ + "祝你万事顺心", + "欢迎你的来电,祝你生活愉快", + "感谢您的来电,我们会尽快处理", + ]); // prefs.setStringList("dxText",["祝你万事顺心","欢迎你的来电,祝你生活愉快","感谢您的来电,我们会尽快处理",]); updateConSms(); updateRefSms(); diff --git a/lib/ui/TextMe/call_list_page.dart b/lib/ui/TextMe/call_list_page.dart index 8874df2..895dc75 100644 --- a/lib/ui/TextMe/call_list_page.dart +++ b/lib/ui/TextMe/call_list_page.dart @@ -33,20 +33,6 @@ class _CallListPageState extends State { super.dispose(); } - @override - void initState() { - if (UserTool.userProvider.isLogin) { - if (UserTool.userProvider.userInfo.isVip != 1) { - //service.isRunning() as bool; - // endDate = DateUtil.formatDateMs( - // UserTool.userProvider.userInfo.end * 1000, - // format: DateFormats.y_mo_d); - } else { - Get.to(() => const LoginPage()); - } - super.initState(); - } - } @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/ui/TextMe/text_me_page.dart b/lib/ui/TextMe/text_me_page.dart index 0f6b331..0c37086 100644 --- a/lib/ui/TextMe/text_me_page.dart +++ b/lib/ui/TextMe/text_me_page.dart @@ -8,6 +8,8 @@ import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/toast/cloud_toast.dart'; import 'package:velocity_x/velocity_x.dart'; +import '../../utils/user_tool.dart'; +import '../login/login_page.dart'; import '../widget/plone_back_button.dart'; import 'address_book.dart'; @@ -32,6 +34,16 @@ class _TextMePageState extends State { _phoneController = TextEditingController(); _controller.text = ""; _phoneController.text = ""; +/* Future.delayed(const Duration(seconds: 0),(){ + if (UserTool.userProvider.isLogin) { + _controller = TextEditingController(); + _phoneController = TextEditingController(); + _controller.text = ""; + _phoneController.text = ""; + } else { + Get.to(() => const LoginPage()); + } + });*/ super.initState(); } @@ -58,8 +70,7 @@ class _TextMePageState extends State { body: ListView( children: [ _getBox('短信内容', "选择短信模版", () { - Get.to(() => - TextTemplate( + Get.to(() => TextTemplate( callback: (String content) { _controller.text = content; }, @@ -67,12 +78,13 @@ class _TextMePageState extends State { }, "请输入短信内容...", _controller), 32.hb, _getBox('收信号码', "通讯录中选择", () { - Get.to(() => - AddressBook(number: (List content) { - for(int i=0;i AddressBook( + number: (List content) { + for (int i = 0; i < content.length; i++) { + _phoneController.text += "${content[i]},"; + } + }, + )); }, "请输入收信号码,多个号码请用逗号隔开
例如:136xxxx6666,132xxxx8888", _phoneController), 32.hb, _getBox2(), @@ -80,33 +92,37 @@ class _TextMePageState extends State { PloneBottom( onTap: () async { // final Telephony telephony = Telephony.instance; - if (_controller.text.isEmpty && - _phoneController.text.isEmpty && - signatureText.isEmpty) { - CloudToast.show("内容不可为空"); - } else { - print(_controller.text); - print(_phoneController.text); - print(signatureText); - await sendSMS( - message: "【$signatureText】${_controller.text}", - recipients: _phoneController.text.split(","), - sendDirect: true); - // print("asd${_phoneController.text.split(",")}"); - // await telephony.sendSms( - // to: "13486828191;13395740386;18815060992;18294841148", - // message: "【$signatureText】${_controller.text}" - // ); - CloudToast.show("发送成功"); - // Telephony.sendSms(to: phoneNum!, message: idle); + if(UserTool.userProvider.userInfo.isVip ==1){ + if (_controller.text.isEmpty && + _phoneController.text.isEmpty && + signatureText.isEmpty) { + CloudToast.show("内容不可为空"); + } else { + print(_controller.text); + print(_phoneController.text); + print(signatureText); + await sendSMS( + message: "【$signatureText】${_controller.text}", + recipients: _phoneController.text.split(","), + sendDirect: true); + // print("asd${_phoneController.text.split(",")}"); + // await telephony.sendSms( + // to: "13486828191;13395740386;18815060992;18294841148", + // message: "【$signatureText】${_controller.text}" + // ); + CloudToast.show("发送成功"); + // Telephony.sendSms(to: phoneNum!, message: idle); + } + }else{ + CloudToast.show(""); } }, border: _controller.text.isEmpty || _phoneController.text.isEmpty || signatureText.isEmpty, opacity: _controller.text.isEmpty || - _phoneController.text.isEmpty || - signatureText.isEmpty + _phoneController.text.isEmpty || + signatureText.isEmpty ? 0.4 : 1, text: "发送", @@ -176,7 +192,6 @@ class _TextMePageState extends State { _controller.text = text; } else { _phoneController.text = text; - } setState(() {}); }, diff --git a/lib/ui/TextMe/text_template.dart b/lib/ui/TextMe/text_template.dart index dcd08af..c40d18a 100644 --- a/lib/ui/TextMe/text_template.dart +++ b/lib/ui/TextMe/text_template.dart @@ -26,6 +26,7 @@ class _TextTemplateState extends State { List textList = []; + @override void initState() { addText(); super.initState(); diff --git a/lib/ui/home/add_sms_page.dart b/lib/ui/home/add_sms_page.dart index c151dca..c083b51 100644 --- a/lib/ui/home/add_sms_page.dart +++ b/lib/ui/home/add_sms_page.dart @@ -96,7 +96,6 @@ class _AddSmsPageState extends State { border: _controller.text.isEmpty, opacity: contant.isEmpty ? 0.4 : 1, onTap: () async { - final prefs = await SharedPreferences.getInstance(); List? contentList=prefs.getStringList("dxText"); if(widget.qfBool){ diff --git a/lib/ui/loading.dart b/lib/ui/loading.dart index 353affa..5397724 100644 --- a/lib/ui/loading.dart +++ b/lib/ui/loading.dart @@ -1,5 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:project_telephony/ui/login/login_page.dart'; import 'package:project_telephony/ui/tab_navigator.dart'; import 'dart:async'; @@ -25,18 +26,10 @@ class _LoadingState extends State { void initState() { super.initState(); final userProvider = Provider.of(context, listen: false); - // var env = const String.fromEnvironment('ENV', defaultValue: 'dev'); - // if (kDebugMode) { - // print('env :$env'); - // } - // DevEV.instance.setEnvironment( - // context, - // environment: env == 'dev', - // ); Future.delayed(const Duration(milliseconds: 1000), () async { // await initialAll(); if (!await userProvider.init()) { - await Get.offAll(() => const TabNavigator()); + await Get.offAll(() => const LoginPage()); // await Get.offAll(() => const LoginPage()); } else { Navigator.of(context).pushReplacementNamed("/TabNavigator");