修改网络服务器地址

master
戴余标 2 years ago
parent 375cba91ec
commit 1071e60061

@ -1 +0,0 @@
/Users/datang/fvm/versions/2.8.0

@ -6,12 +6,20 @@ class API {
///HOST ///HOST
static String get host { static String get host {
if (DevEV.instance.dev) { if (DevEV.instance.dev) {
// return 'http://10.0.2.2:8088/';
return 'http://api.dxbs.vip'; return 'http://api.dxbs.vip';
} else { } else {
return 'https://api.yunyunwenche.com'; return 'http://api.dxbs.vip/';
} }
} }
static String get imageHost {
if (DevEV.instance.dev) {
return 'http://10.0.2.2:8088';
} else {
return 'http://api.dxbs.vip/';
}
}
static const int networkTimeOut = 10000; static const int networkTimeOut = 10000;
@ -21,15 +29,31 @@ class API {
static _Pay pay = _Pay(); static _Pay pay = _Pay();
} }
class _App { class _App {
///
String get login => '/app/login'; String get login => '/app/login';
///退
String get logout => '/app/login/logout'; String get logout => '/app/login/logout';
///
String get captcha => '/app/captcha'; String get captcha => '/app/captcha';
///
String get info => '/app/user/info'; String get info => '/app/user/info';
///
String get addTag => '/app/user/addTag';
///
String get content => '/app/user/content';
///
String get delete => '/app/user/content/delete';
///VIP
String get updateVip => '/app/user/updateVip';
} }
class _Pay { class _Pay {
///
String get wxpay => '/app/pay/wxpay'; String get wxpay => '/app/pay/wxpay';
///
String get alipay => '/app/pay/alipay'; String get alipay => '/app/pay/alipay';
///
String get wxCallback => '/callback/wxpay/notify'; String get wxCallback => '/callback/wxpay/notify';
///
String get aliCallback => '/callback/alipay/notify'; String get aliCallback => '/callback/alipay/notify';
} }

@ -1,5 +1,6 @@
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';
@ -8,8 +9,13 @@ class UserInfoModel extends Equatable {
final int id; final int id;
final String name; final String name;
final String phone; final String phone;
final int isVip;
final String tag;
final int status; final int status;
final Vip vip; final num start;
final num end;
final List<Content>? contentRef;
final List<Content>? contentCon;
factory UserInfoModel.fromJson(Map<String, dynamic> json) => factory UserInfoModel.fromJson(Map<String, dynamic> json) =>
_$UserInfoModelFromJson(json); _$UserInfoModelFromJson(json);
@ -20,36 +26,47 @@ class UserInfoModel extends Equatable {
id: 0, id: 0,
name: '', name: '',
phone: '', phone: '',
isVip: 0,
tag: '',
status: 0, status: 0,
vip: Vip(start: '', end: ''), start: 0,
end: 0,
contentCon: [],
contentRef: [],
); );
@override const UserInfoModel(
List<Object> get props => [id, name, phone, status, vip]; {required this.id,
const UserInfoModel({
required this.id,
required this.name, required this.name,
required this.phone, required this.phone,
required this.isVip,
required this.tag,
required this.status, required this.status,
required this.vip, required this.start,
required this.end,
required this.contentCon,
required this.contentRef,
}); });
@override
List<Object?> get props =>
[id, name, phone, isVip, tag, status, start, end, contentCon,contentRef];
} }
@JsonSerializable() @JsonSerializable()
class Vip extends Equatable { class Content extends Equatable {
final String start; final int id;
final String end; final String content;
const Vip({ const Content({
required this.start, required this.id,
required this.end, required this.content,
}); });
factory Vip.fromJson(Map<String, dynamic> json) => _$VipFromJson(json); factory Content.fromJson(Map<String, dynamic> json) =>
_$ContentFromJson(json);
Map<String, dynamic> toJson() => _$VipToJson(this); Map<String, dynamic> toJson() => _$ContentToJson(this);
@override @override
List<Object?> get props => [start, end]; List<Object?> get props => [id, content];
} }

@ -11,8 +11,17 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
id: json['id'] as int, id: json['id'] as int,
name: json['name'] as String, name: json['name'] as String,
phone: json['phone'] as String, phone: json['phone'] as String,
isVip: json['is_vip'] as int,
tag: json['tag']as String,
status: json['status'] as int, status: json['status'] as int,
vip: Vip.fromJson(json['vip'] as Map<String, dynamic>), start: json['start']as num,
end: json['end']as num,
contentCon:(json['content_con'] as List<dynamic>?)
?.map((e) => Content.fromJson(e as Map<String, dynamic>))
.toList(),
contentRef:(json['content_ref'] as List<dynamic>?)
?.map((e) => Content.fromJson(e as Map<String, dynamic>))
.toList(),
); );
Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) => Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) =>
@ -20,16 +29,21 @@ Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) =>
'id': instance.id, 'id': instance.id,
'name': instance.name, 'name': instance.name,
'phone': instance.phone, 'phone': instance.phone,
'is_vip':instance.isVip,
'tag':instance.tag,
'status': instance.status, 'status': instance.status,
'vip': instance.vip, 'start':instance.start,
'end':instance.end,
'content_con':instance.contentCon,
'content_ref':instance.contentRef,
}; };
Vip _$VipFromJson(Map<String, dynamic> json) => Vip( Content _$ContentFromJson(Map<String, dynamic> json) => Content(
start: json['start'] as String, id: json['id'] as int,
end: json['end'] as String, content: json['content'] as String,
); );
Map<String, dynamic> _$VipToJson(Vip instance) => <String, dynamic>{ Map<String, dynamic> _$ContentToJson(Content instance) => <String, dynamic>{
'start': instance.start, 'id': instance.id,
'end': instance.end, 'content': instance.content,
}; };

@ -0,0 +1,106 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.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 '../user/content_details_page.dart';
import '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart';
class AddSmsPage extends StatefulWidget {
final int status;
final TextCallback ploneBack;
const AddSmsPage({Key? key, required this.status, required this.ploneBack}) : super(key: key);
@override
_AddSmsPageState createState() => _AddSmsPageState();
}
class _AddSmsPageState extends State<AddSmsPage> {
late TextEditingController _controller;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override
void initState() {
super.initState();
_controller = TextEditingController();
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
elevation: 0,
title: Text(
'编辑短信标签',
style: TextStyle(
fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: Align(
alignment: Alignment.topCenter,
child: Container(
height: 800.w,
decoration: BoxDecoration(
color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.circular(16.w),
),
padding: EdgeInsets.all(30.w),
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
child: TextField(
maxLines: 100,
keyboardType: TextInputType.text,
onEditingComplete: () {
setState(() {});
// _refreshController.callRefresh();
},
style: TextStyle(
color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28,
),
controller: _controller,
decoration: const InputDecoration(
fillColor: Colors.transparent,
contentPadding: EdgeInsets.zero,
filled: true,
isDense: true,
hintText: "请输入所需短信标签",
border: InputBorder.none,
),
),
),
),
bottomNavigationBar: PloneBottom(
border: _controller.text.isEmpty,
opacity: _controller.text.isNotEmpty ? 1 : 0.4,
onTap: () async {
BaseModel res = await apiClient.request(API.app.content, data: {
'content': _controller.text,
'status': widget.status,
});
if (res.code == 0) {
setState(() {});
widget.ploneBack(_controller.text);
userProvider.updateUserInfo();
} else {
CloudToast.show(res.msg);
}
Get.back();
},
text: "保存",
).paddingOnly(bottom: 30.w),
);
}
}

@ -0,0 +1,158 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/add_sms_page.dart';
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 '../../providers/user_provider.dart';
class ContentConnectPage extends StatefulWidget {
const ContentConnectPage({Key? key}) : super(key: key);
@override
_ContentConnectPageState createState() => _ContentConnectPageState();
}
class _ContentConnectPageState extends State<ContentConnectPage> {
int _select = 0;
List<String> textList = [
'欢迎您的来电,祝您生活愉快',
'祝您万事顺心',
'感谢您的来电,我们会尽快处理的',
"自定义短信内容"
];
List<int> smsIdList =[];
List<String> textListSMS = [];
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
void initState() {
super.initState();
updateList();
}
@override
void dispose() {
_easyRefreshController.dispose();
super.dispose();
}
updateList(){
if (userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
userProvider.userInfo.contentCon?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
});
textListSMS.add("自定义短信内容");
} else {
textListSMS = textList;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: Text(
'选择短信内容',
style: Theme.of(context).textTheme.headline6,
),
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor,
),
backgroundColor: Colors.white,
body: Column(children: [
Expanded(
child: _getList(),
),
]),
);
}
_getList() {
return EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
footer: MaterialFooter(),
controller: _easyRefreshController,
onRefresh: () async {
await userProvider.updateUserInfo();
updateList();
setState(() {});
},
child:ListView.builder(
itemBuilder: (context, index) {
return _getBox(textListSMS[index], index == _select, index);
},
itemCount: textListSMS.length,
),
);
}
_getBox(String content, bool pd, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
_select = index;
} else {
if(userProvider.isLogin){
if(textListSMS.length>5){
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
}else{
Get.to(AddSmsPage(
status: 1, ploneBack: (String textContent) {
_easyRefreshController.callRefresh();
},
));
}
}else{
BotToast.showText(text: '请先登录');
}
}
setState(() {});
},
onLongPress: () {
if(content != "自定义短信内容"){
if (textListSMS.length<2 ) {
BotToast.showText(text: '不能再删了');
}else{
showDialog(
context: context,
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板', id: smsIdList[index],
);
});
}
}
setState(() {});
},
child: Container(
// width: 686.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: pd ? Colors.blue : const Color(0xFFF9F9F9),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
);
}
}

@ -1,114 +0,0 @@
import 'package:flutter/material.dart';
import 'package:project_telephony/utils/headers.dart';
import '../../base/base_style.dart';
import '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart';
typedef TextCallback = Function(String textContent);
class ContentDetailsPage extends StatefulWidget {
final TextCallback ploneBack;
final String content;
const ContentDetailsPage(
{Key? key, required this.content, required this.ploneBack})
: super(key: key);
@override
_ContentDetailsPageState createState() => _ContentDetailsPageState();
}
String content = "";
class _ContentDetailsPageState extends State<ContentDetailsPage> {
late TextEditingController _controller;
@override
void initState() {
super.initState();
_controller = TextEditingController(text: widget.content);
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
elevation: 0,
title: Text(
'编辑短信内容',
style: TextStyle(
fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: _getBox(),
);
}
_getBox() {
return Column(children: [
Container(
width: 622.w,
height: 960.w,
decoration: BoxDecoration(
color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.circular(16.w)),
margin: EdgeInsets.only(top: 32.w, bottom: 298.w),
child: Container(
// color: kForeGroundColor,
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
child: TextField(
maxLines: 100,
keyboardType: TextInputType.text,
onEditingComplete: () {
setState(() {});
// _refreshController.callRefresh();
},
onChanged: (text) {
content = text;
// print(content);
setState(() {});
},
style: TextStyle(
color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28,
),
controller: _controller,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
filled: true,
isDense: true,
fillColor: Colors.white,
hintText: widget.content != "" ? "" : "请输入短信内容",
hintStyle: TextStyle(
color: widget.content != ""
? const Color(0xFF333333)
: Colors.grey.shade500,
fontSize: 28.sp,
fontWeight: FontWeight.bold),
border: InputBorder.none,
),
),
),
// Text(widget.content,),
),
PloneBottom(
border: !content.isNotEmpty,
opacity: content.isNotEmpty ? 1 : 0.4,
onTap: () {
setState(() {});
widget.ploneBack(content);
Get.back();
// print(content);
},
text: "保存",
)
]);
}
}

@ -1,117 +0,0 @@
import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/content_details_page.dart';
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';
class ContentPage extends StatefulWidget {
final bool? isAnswer; //truefalse
const ContentPage({Key? key, required this.isAnswer}) : super(key: key);
@override
_ContentPageState createState() => _ContentPageState();
}
class _ContentPageState extends State<ContentPage> {
int _select = 0;
List<String> textList = ['欢迎你的来电', '祝您生活愉快', '感谢您的来电我们会尽快处理的', '自定义短信内容'];
List<String> textList1 = ['自定义短信内容'];
late String phoneNum;
late String callState;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: Text(
'选择短信内容',
style: Theme.of(context).textTheme.headline6,
),
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor,
),
backgroundColor: Colors.white,
body: Column(children: [
Expanded(
child: _getList(),
),
]),
);
}
_getList() {
return ListView.builder(
itemBuilder: (context, index) {
return _getBox(textList[index], index == _select, index);
},
itemCount: textList.length,
);
}
_getBox(String content, bool pd, int index) {
return GestureDetector(
onTap: () async {
_select = index;
if (index == textList.length - 1) {
await Get.to(() => ContentDetailsPage(
content: "",
ploneBack: (String textContent) {
// print("这是数据" + textContent);
textList.setAll(index, {textContent});
},
));
} else {
final Iterable<CallLogEntry> result = await CallLog.query();
phoneNum = result.first.number!;
}
setState(() {});
// print("这是数据" + textList[_s lect]);
// print(index);
},
onLongPress: () {
if (index != textList.length - 1) {
showDialog(
context: context,
builder: (context) {
return const Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板',
);
});
}
setState(() {});
},
child: Container(
// width: 686.w,
height: 135.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 50.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: pd
? widget.isAnswer!
? Colors.blue
: const Color(0xFF72E4C8)
: const Color(0xFFF9F9F9),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
);
}
}

@ -0,0 +1,150 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart';
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 '../../providers/user_provider.dart';
import 'add_sms_page.dart';
class ContentRefusePage extends StatefulWidget {
const ContentRefusePage({Key? key}) : super(key: key);
@override
_ContentRefusePageState createState() => _ContentRefusePageState();
}
class _ContentRefusePageState extends State<ContentRefusePage> {
int _select = 0;
List<String> textList = ['现在无法接听。有什么事吗?', '我马上会打给你。', '我稍后会打给你。', "自定义短信内容"];
List<String> textListSMS = [];
List<int> smsIdList =[];
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
void initState() {
super.initState();
updateList();
}
@override
void dispose() {
_easyRefreshController.dispose();
super.dispose();
}
Future updateList() async{
if (userProvider.isLogin) {
textListSMS.clear();
userProvider.userInfo.contentRef?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
});
textListSMS.add("自定义短信内容");
} else {
textListSMS = textList;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: Text(
'选择短信内容',
style: Theme.of(context).textTheme.headline6,
),
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor,
),
backgroundColor: Colors.white,
body: Column(children: [
Expanded(
child: _getList(),
),
]),
);
}
_getList() {
return EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
footer: MaterialFooter(),
controller: _easyRefreshController,
onRefresh: () async {
await updateList();
},
child:ListView.builder(
itemBuilder: (context, index) {
return _getBox(textListSMS[index], index == _select, index);
},
itemCount: textListSMS.length,
),
);
}
_getBox(String content, bool pd, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
_select = index;
} else {
if(userProvider.isLogin){
if(textListSMS.length>5){
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
}else{
Get.to(AddSmsPage(
status: 2, ploneBack: (String textContent) { },
));
}
}else{
BotToast.showText(text: '请先登录');
}
}
setState(() {});
},
onLongPress: () {
if(content != "自定义短信内容"){
if (textListSMS.length<2 ) {
BotToast.showText(text: '不能再删了');
}else{
showDialog(
context: context,
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板', id: smsIdList[index],
);
});
}
}
setState(() {
_easyRefreshController.callRefresh();
});
},
child: Container(
// width: 686.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: pd ? const Color(0xFF72E4C8) : const Color(0xFFF9F9F9),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
);
}
}

@ -1,11 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:project_telephony/ui/home/content_page.dart'; import 'package:project_telephony/ui/home/content_connect_page.dart';
import 'package:project_telephony/ui/home/content_refuse_page.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'call.dart'; import 'call.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
@ -15,11 +14,9 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState(); _HomePageState createState() => _HomePageState();
} }
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
// initializeService(); // initializeService();
setState(() {}); setState(() {});
@ -32,15 +29,18 @@ class _HomePageState extends State<HomePage> {
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
extendBody: true, extendBody: true,
body: SafeArea( body: SafeArea(
child: Column( child: Stack(
fit: StackFit.expand,
children: [ children: [
Container( Positioned(
top: 10.w,
child: Image.asset( child: Image.asset(
Assets.images.homeBg.path, Assets.images.homeBg.path,
height: 722.w, height: 722.w,
width: 722.w, width: 722.w,
)), ),
_getBody(), ),
Positioned(bottom: 20.w, child: _getBody()),
], ],
), ),
)); ));
@ -59,7 +59,7 @@ class _HomePageState extends State<HomePage> {
color: const Color(0xFF333333), color: const Color(0xFF333333),
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
32.hb, 8.hb,
Text( Text(
"希望能成为您的短信小助手", "希望能成为您的短信小助手",
style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)), style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)),
@ -80,13 +80,9 @@ class _HomePageState extends State<HomePage> {
onTap: () { onTap: () {
print(title); print(title);
if (title == "接听后") { if (title == "接听后") {
Get.to(() => const ContentPage( Get.to(() => const ContentConnectPage());
isAnswer: true,
));
} else { } else {
Get.to(() => const ContentPage( Get.to(() => const ContentRefusePage());
isAnswer: false,
));
print("未接听"); print("未接听");
} }
}, },
@ -105,12 +101,14 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
Positioned( Positioned(
child: Row( // top: 0,
children: [ // left: 0,
Container( child: Container(
// height: 192.w,
// alignment: Alignment.centerLeft,
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 48.w, left: 48.w,
top: 35.w, top: 38.w,
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -120,7 +118,7 @@ class _HomePageState extends State<HomePage> {
fontSize: 36.sp, fontSize: 36.sp,
color: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
24.hb, 16.hb,
Text( Text(
text, text,
style: TextStyle( style: TextStyle(
@ -130,13 +128,6 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
), ),
// Padding(
// padding: EdgeInsets.only(top: 40.w),
// child:
// )
],
),
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,

@ -86,7 +86,7 @@ class _LoginPageState extends State<LoginPage> {
Padding( Padding(
padding: EdgeInsets.only(left: 186.w, top: 88.w), padding: EdgeInsets.only(left: 186.w, top: 88.w),
child: Text( child: Text(
"登录/注册", "",
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize34, fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, color: BaseStyle.color333333,

@ -0,0 +1,78 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../base/base_style.dart';
import '../widget/plone_back_button.dart';
class ContentAuthorityPage extends StatelessWidget {
const ContentAuthorityPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: Text(
'隐私权限',
style: TextStyle(
fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: SingleChildScrollView(
padding: EdgeInsets.all(16.sp),
child: RichText(
text: const TextSpan(
style: TextStyle(
fontSize: 16, //
color: Colors.black, //
),
children: <TextSpan>[
TextSpan(
text: '短信帮手隐私政策\n',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
)),
TextSpan(
text: '''
使 使使
1. (a) 使访 IP使访 (a) (b)
2. 使 (a) 访访 (b)
3. (a) (b) (c) (d) (e) 便 (f) (g)
4. 访
5. Cookie使 (a) cookiescookies 便使cookies (b) cookiescookiescookies使cookies (c) cookies
6. (a) (b) 使
7. (a)便使访 (b) 便
app/app/app
app
''',
),
TextSpan(text: '''
1.
2.
3.
/\n
''', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(
text: '短信帮手\n宁波沃尔斯软件有限公司',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
],
),
),
),
);
}
}

@ -0,0 +1,111 @@
import 'package:flutter/material.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.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 '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart';
typedef TextCallback = Function(String textContent);
class ContentDetailsPage extends StatefulWidget {
final TextCallback ploneBack;
final String content;
const ContentDetailsPage(
{Key? key, required this.content, required this.ploneBack})
: super(key: key);
@override
_ContentDetailsPageState createState() => _ContentDetailsPageState();
}
class _ContentDetailsPageState extends State<ContentDetailsPage> {
late TextEditingController _controller;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override
void initState() {
super.initState();
_controller = TextEditingController(text: widget.content);
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
elevation: 0,
title: Text(
'编辑短信标签',
style: TextStyle(
fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: Container(
height: 800.w,
decoration: BoxDecoration(
color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.circular(16.w),
),
padding: EdgeInsets.all(30.w),
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
child: TextField(
maxLines: 100,
keyboardType: TextInputType.text,
onEditingComplete: () {
setState(() {});
// _refreshController.callRefresh();
},
style: TextStyle(
color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28,
),
controller: _controller,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
filled: true,
isDense: true,
fillColor: Colors.transparent ,
hintText: widget.content.isNotEmpty ? "" : "请输入所需短信标签",
hintStyle: TextStyle(
color: widget.content != ""
? const Color(0xFF333333)
: Colors.grey.shade500,
fontSize: 28.sp,
fontWeight: FontWeight.bold),
border: InputBorder.none,
),
),
),
bottomNavigationBar: PloneBottom(
border: _controller.text.isEmpty,
opacity: _controller.text.isNotEmpty ? 1 : 0.4,
onTap: () async {
BaseModel res =
await apiClient.request(API.app.addTag, data: {'tag': _controller.text});
if (res.code == 0) {
setState(() {});
widget.ploneBack(_controller.text);
userProvider.updateUserInfo();
Get.back();
} else {
CloudToast.show(res.msg);
}
},
text: "保存",
).paddingOnly(bottom: 30.w),
);
}
}

@ -57,7 +57,7 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
leading: const CloudBackButton(isSpecial: true), leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor), backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: widget.name == "隐私政策" ? null : _getRights(), body: _getRights(),
); );
} }
// Color getPermissionColor() { // Color getPermissionColor() {

@ -2,19 +2,24 @@
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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/base/base_style.dart';
import 'package:project_telephony/ui/login/login_page.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/members_page.dart';
import 'package:project_telephony/ui/user/privacy_rights_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/image_scaffold.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/ui/widget/plone_image_picker.dart'; import 'package:project_telephony/ui/widget/plone_image_picker.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/permissionutils.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:telephony/telephony.dart'; import 'package:telephony/telephony.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
@ -22,8 +27,8 @@ import '../../model/network/api_client.dart';
import '../../providers/user_provider.dart'; import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart'; import '../../utils/user_tool.dart';
import 'content_details_page.dart';
import '../home/content_details_page.dart';
import '../home/home_page.dart'; import '../home/home_page.dart';
class UserPage extends StatefulWidget { class UserPage extends StatefulWidget {
@ -36,9 +41,23 @@ class UserPage extends StatefulWidget {
final Telephony telephony = Telephony.instance; final Telephony telephony = Telephony.instance;
class _UserPageState extends State<UserPage> { class _UserPageState extends State<UserPage> {
// bool vle =PermissionStatus.denied.isGranted; // bool vle = PermissionStatus.denied.isGranted;
//bool vle =PermissionStatus.denied.isGranted;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool vle=false; bool vle=false;
bool isVip=false;
@override
void initState() {
super.initState();
if(userProvider.isLogin){
if(userProvider.userInfo.isVip==1){
isVip=true;
}else{
isVip=false;
}
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -64,12 +83,13 @@ class _UserPageState extends State<UserPage> {
userProvider.isLogin userProvider.isLogin
? PloneBottom( ? PloneBottom(
border: false, border: false,
onTap: () async{ onTap: () async {
var cancel = CloudToast.loading; var cancel = CloudToast.loading;
var base = await apiClient.request(API.app.logout, showMessage: true); var base = await apiClient.request(API.app.logout,
showMessage: true);
if (base.code == 0) { if (base.code == 0) {
UserTool.userProvider.logout(); UserTool.userProvider.logout();
Get.offAll(const HomePage()); Get.offAll(const TabNavigator());
} }
cancel(); cancel();
}, },
@ -180,7 +200,7 @@ class _UserPageState extends State<UserPage> {
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight)), end: Alignment.centerRight)),
child: Text( child: Text(
"立即开通", isVip?"立即续费":"立即购买",
style: TextStyle( style: TextStyle(
color: const Color(0xFF001F3F), fontSize: BaseStyle.fontSize24), color: const Color(0xFF001F3F), fontSize: BaseStyle.fontSize24),
)), )),
@ -195,7 +215,7 @@ class _UserPageState extends State<UserPage> {
_getVip(), _getVip(),
16.hb, 16.hb,
Text( Text(
"解锁全部功能", isVip?"{$userProvider.userInfo.end}到期":"解锁全部功能",
style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24), style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24),
) )
], ],
@ -222,9 +242,9 @@ class _UserPageState extends State<UserPage> {
color: const Color(0xFFFFEAB0), color: const Color(0xFFFFEAB0),
), ),
), ),
const Text( Text(
"未开通会员", isVip?"已成为会员":"未开通会员",
style: TextStyle( style: const TextStyle(
color: Color( color: Color(
0xFFFFEAB0, 0xFFFFEAB0,
), ),
@ -238,18 +258,31 @@ class _UserPageState extends State<UserPage> {
_getSwitch(String url, String name, bool pd) { _getSwitch(String url, String name, bool pd) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
pd
? "" if(!pd){
: name=="短信标签"?Get.to(()=> ContentDetailsPage( switch(name){
content: "", case "短信标签":
Get.to(() => ContentDetailsPage(
content:
userProvider.isLogin ? userProvider.userInfo.tag : "",
ploneBack: (String textContent) { ploneBack: (String textContent) {
// print("这是数据" + textContent); // print("这是数据" + textContent);
// textList.setAll(index, {textContent}); // textList.setAll(index, {textContent});
}, },
)): ));
break;
case"隐私政策":
Get.to(() => const ContentAuthorityPage());
break;
case"权限说明":
Get.to(() => PrivacyRightsPage( Get.to(() => PrivacyRightsPage(
name: name, name: name,
)); ));
break;
default:
break;
}
}
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w),
@ -271,15 +304,25 @@ class _UserPageState extends State<UserPage> {
trailing: pd trailing: pd
? Switch( ? Switch(
value: vle, value: vle,
onChanged: (value) async{ onChanged: (value) async {
vle=value; await Permission.phone.request();
if(vle) { // List<Permission> permissions = [
// Telephony.backgroundInstance.sendSms(to: "13395740386", message: "啦啦啦啦啦"); // Permission.sms,
// Workmanager().registerOneOffTask("task-identifier", "simpleTask"); // Permission.phone,
// ];
// PermissionHelper.check(permissions, onSuccess: () {
// print('onSuccess');
// }, onFailed: () {
// print('onFailed');
// }, onOpenSetting: () {
// print('onOpenSetting');
// openAppSettings();
// });
// setState(() {
// vle = value;
// });
} }
setState((){}); )
})
: const Icon(Icons.keyboard_arrow_right)), : const Icon(Icons.keyboard_arrow_right)),
), ),
); );

@ -1,12 +1,20 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:project_telephony/utils/headers.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';
class Centertipsalterwidget extends StatefulWidget { class Centertipsalterwidget extends StatefulWidget {
final String title; final String title;
final String desText; final String desText;
final int id;
const Centertipsalterwidget( const Centertipsalterwidget(
{Key? key, required this.desText, required this.title}) {Key? key, required this.desText, required this.title, required this.id})
: super(key: key); : super(key: key);
@override @override
@ -14,6 +22,9 @@ class Centertipsalterwidget extends StatefulWidget {
} }
class _CentertipsalterwidgetState extends State<Centertipsalterwidget> { class _CentertipsalterwidgetState extends State<Centertipsalterwidget> {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoAlertDialog( return CupertinoAlertDialog(
@ -39,7 +50,16 @@ class _CentertipsalterwidgetState extends State<Centertipsalterwidget> {
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: const Text('确定'), child: const Text('确定'),
onPressed: () { onPressed: () async {
BaseModel res = await apiClient.request(API.app.delete, data: {
'id': widget.id,
});
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
} else {
CloudToast.show(res.msg);
}
Navigator.pop(context); Navigator.pop(context);
}, },
) )

@ -356,6 +356,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
flutter_easyrefresh:
dependency: "direct main"
description:
name: flutter_easyrefresh
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2"
flutter_gen_core: flutter_gen_core:
dependency: transitive dependency: transitive
description: description:

@ -79,6 +79,8 @@ dependencies:
get_phone_number: ^2.0.1 get_phone_number: ^2.0.1
# 存取数据 # 存取数据
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
#刷新组件
flutter_easyrefresh: ^2.2.1
# # jdk # # jdk

Loading…
Cancel
Save