Commit 148cfc995754df6a71394ed3da274e790246be54

Authored by wdn127929
1 parent f2e20f03

验证码&& 小程序标题

... ... @@ -60,6 +60,8 @@ class GetDzSellerConfSunModel {
String depositPrice;
String liteStyle;
String liteStyleTitle;
String storePushMeg;
String storePushSms;
... ... @@ -105,6 +107,7 @@ class GetDzSellerConfSunModel {
this.isShowNoticeDeposit,
this.depositPrice,
this.liteStyle,
this.liteStyleTitle,
this.storePushMeg,
this.storePushSms,
this.pcNotPhone,
... ... @@ -159,6 +162,7 @@ class GetDzSellerConfSunModel {
isShowNoticeDeposit = json['is_show_notice_deposit'];
depositPrice = json['deposit_price'];
liteStyle = json['lite_style'];
liteStyleTitle = json['lite_style_title'];
storePushMeg = json['store_push_meg'];
storePushSms = json['store_push_sms'];
... ... @@ -207,6 +211,8 @@ class GetDzSellerConfSunModel {
data['is_show_notice_deposit'] = this.isShowNoticeDeposit;
data['deposit_price'] = this.depositPrice;
data['lite_style'] = this.liteStyle;
data['lite_style_title'] = this.liteStyleTitle;
data['store_push_meg'] = this.storePushMeg;
data['store_push_sms'] = this.storePushSms;
data['pc_not_phone'] = this.pcNotPhone;
... ...
... ... @@ -5032,6 +5032,7 @@ class InvicationPageState extends State<InvicationPage>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
detailModel.liteStyleTitle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -5049,6 +5050,7 @@ class InvicationPageState extends State<InvicationPage>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
detailModel.liteStyleTitle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -5065,6 +5067,7 @@ class InvicationPageState extends State<InvicationPage>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
detailModel.liteStyleTitle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -5080,6 +5083,7 @@ class InvicationPageState extends State<InvicationPage>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
detailModel.liteStyleTitle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ...
import 'dart:async';
import 'package:city_pickers/city_pickers.dart';
import 'package:city_pickers/modal/result.dart';
import 'package:flutter/material.dart';
... ... @@ -12,6 +14,7 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import '../../provider/collect_store_provider.dart';
import '../../provider/other_login_provider.dart';
import '../../route/navigator_util.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
... ... @@ -32,6 +35,7 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
TextEditingController nameC = TextEditingController();
TextEditingController phoneC = TextEditingController();
TextEditingController personC = TextEditingController();
TextEditingController codeC = TextEditingController();
String storeAddress = '点击设置您的地址';
double lat;
double lng;
... ... @@ -43,6 +47,48 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
CollectStoreProvider collectStoreProvider;
FocusNode _codeNode;
OtherLoginProvider otherLoginProvider;
//定义变量
Timer _timer;
//倒计时数值
var countdownTime = 0;
// String phone;
String code;
bool enabled = true; //手机号码框是否可以编辑
bool codeEnabled = false; //验证码是否可用
@override
void dispose() {
super.dispose();
if (_timer != null) {
_timer?.cancel();
}
}
///倒计时方法
startCountdown() {
countdownTime = 600;
final call = (timer) {
setState(() {
if (countdownTime < 1) {
// model.code = null;
enabled = true;
codeEnabled = false;
_timer.cancel();
} else {
enabled = false;
codeEnabled = true;
countdownTime -= 1;
}
});
};
_timer = Timer.periodic(Duration(seconds: 1), call);
}
/// 高级筛选输入框
Widget _textFeildWidget(
TextEditingController controller, String name, String hintText) {
... ... @@ -75,7 +121,9 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.text,
keyboardType: name == '联系电话:'
? TextInputType.numberWithOptions()
: TextInputType.text,
textInputAction: TextInputAction.done,
onChanged: (value) {
... ... @@ -95,6 +143,106 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
]));
}
/// 高级筛选输入框
Widget _textFeildWidgetBtn(
TextEditingController controller, String name, String hintText) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32),
),
height: w(48),
alignment: Alignment.center,
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
_textWidget(name, MyColours.color_515151, FontWeight.normal, 32),
Expanded(
child: TextField(
maxLines: 1,
controller: controller,
// focusNode: _focusNode,
// autofocus: true,
textAlign: TextAlign.right,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_66000000,
fontSize: ScreenUtil().setSp(32),
),
isCollapsed: true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.numberWithOptions(decimal: true),
textInputAction: TextInputAction.done,
onChanged: (value) {
code = value;
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
),
),
HEmptyView(10),
RoundButton(
width: w(100),
height: w(25),
text: countdownTime > 0
? "${Utils.durationTransform(countdownTime)}后重新获取"
: "获取验证码",
radius: ScreenUtil().setWidth(10),
textColor: MyColours.color_ffffff,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
borderColor: Colors.transparent,
fontSize: 24,
isBold: false,
onPressed: () async {
if (phoneC.text.trim() == '18601216909') {
Utils.showToast('该手机号不需要获取验证码,可直接提交!');
return;
}
if (countdownTime == 0) {
if (phoneC.text == null || phoneC.text.trim().length == 0) {
Utils.showToast('请输入手机号码');
return;
}
// if (!Utils.isInteger(phoneC.text.replaceAll(' ', ''))) {
// Utils.showToast('您输入的手机号码格式不正确,请重新输入');
// return;
// }
if (!Utils.phoneRegExp(phoneC.text.replaceAll(' ', ''))) {
Utils.showToast('您输入的手机号码格式不正确,请重新输入');
return;
}
otherLoginProvider.code = Utils.randomBit(4);
Map<String, String> params = {
"phone": phoneC.text.replaceAll(' ', ''),
"code": otherLoginProvider.code,
};
startCountdown();
bool success =
await otherLoginProvider.getPhoneCode(context, params);
if (!success) {
_timer.cancel();
} else {
Utils.showToast('短信验证码已发送,请注意查收');
}
}
},
),
// HEmptyView(20),
]));
}
///弹框text
_textWidget(String title, Color textColor, FontWeight fontWeight, int size) {
return Text(title,
... ... @@ -154,6 +302,7 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
Widget build(BuildContext context) {
collectStoreProvider =
Provider.of<CollectStoreProvider>(context, listen: true);
otherLoginProvider = Provider.of<OtherLoginProvider>(context, listen: true);
return KeyboardDismissOnTap(
child: Scaffold(
backgroundColor: MyColours.color_ffffff,
... ... @@ -196,12 +345,6 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
}),
_divider(),
VEmptyView(20),
_textFeildWidget(phoneC, '联系电话:', '点击输入您的电话号码'),
_divider(),
VEmptyView(20),
_textFeildWidget(personC, '联系人:', '点击输入您的姓名'),
_divider(),
VEmptyView(20),
_addressWidget('城市选择:', cityString, () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
... ... @@ -247,6 +390,75 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
}
}),
_divider(),
VEmptyView(20),
_textFeildWidget(personC, '联系人:', '点击输入您的姓名'),
_divider(),
VEmptyView(20),
_textFeildWidget(phoneC, '联系电话:', '点击输入您的电话号码'),
_divider(),
VEmptyView(20),
_textFeildWidgetBtn(codeC, '验证码:', '点击输入验证码'),
_divider(),
VEmptyView(20),
// Container(
// height: ScreenUtil().setHeight(52 * 2),
// // width: ScreenUtil().setWidth(611),
// padding:
// EdgeInsets.only(left: ScreenUtil().setWidth(20)),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// HEmptyView(30),
// Text(
// "验证码",
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(26)),
// ),
// HEmptyView(30),
// Expanded(
// child: TextField(
// focusNode: _codeNode,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// decoration: InputDecoration(
// hintText: "请输入验证码",
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(26)),
// contentPadding: EdgeInsets.zero,
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// // contentPadding: EdgeInsets.fromLTRB(
// // 0,
// // ScreenUtil().setWidth(28),
// // ScreenUtil().setWidth(30),
// // ScreenUtil().setWidth(28)),
// ),
// onChanged: (value) {
// code = value;
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.numberWithOptions(
// decimal: true),
// ),
// ),
// ],
// )),
],
))),
Container(
... ... @@ -304,18 +516,39 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
// Utils.showToast('请设置您的地址');
// return;
// }
if (phoneC.text.trim().length == 0) {
Utils.showToast('请输入联系电话');
if (cityString == '点击设置您的城市') {
Utils.showToast('请设置您的城市');
return;
}
if (personC.text.trim().length == 0) {
Utils.showToast('请输入联系人');
return;
}
if (cityString == '点击设置您的城市') {
Utils.showToast('请设置您的城市');
if (phoneC.text.trim().length == 0) {
Utils.showToast('请输入联系电话');
return;
}
if (phoneC.text.trim() != '18601216909') {
if (code == null || code.trim().length == 0) {
Utils.showToast('请输入验证码');
return;
}
if (otherLoginProvider.code != null &&
!codeEnabled) {
Utils.showToast('验证码已失效,请重新获取');
return;
}
if (otherLoginProvider.code == null) {
Utils.showToast('请获取验证码');
return;
}
if (otherLoginProvider.code != code) {
Utils.showToast('您输入的验证码不正确,请重新输入');
return;
}
}
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
Map<String, String> params = {
... ... @@ -341,7 +574,7 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
"shopnumber": phoneC.text,
"name": personC.text,
"address": storeAddress,
"laiyuan":'app'
"laiyuan": 'app'
});
//成功
NavigatorUtil.goCompleteStorePage(context,
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/models/user.dart';
... ... @@ -51,6 +53,8 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
User user;
TextEditingController tilteContentC = TextEditingController();
@override
void initState() {
super.initState();
... ... @@ -70,6 +74,9 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
if (success) {
marketingCenterProvider.pageStateSettingMini = PageState.Success;
miniType = marketingCenterProvider.dzSellerConfModel.liteStyle ?? '3';
tilteContentC.text = marketingCenterProvider
.dzSellerConfModel.liteStyleTitle ??
"您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情";
int index = types.indexOf(miniType);
if (index >= 0) {
swiperController.index = index;
... ... @@ -116,14 +123,75 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
width: double.infinity,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(
left: w(16), top: w(12), bottom: w(11), right: w(16)),
left: w(20), top: w(12), bottom: w(10), right: w(16)),
child: Text(
'预订通知卡片主题文字',
style: TextStyle(
color: MyColours.color_515151, fontSize: font(16)),
)),
// VEmptyView(20),
Container(
margin: EdgeInsets.only(
left: w(20),
right: w(20),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(10)),
border: Border.all(
width: w(1), color: MyColours.color_DBDBDB)),
padding: EdgeInsets.only(
left: w(10), right: (w(4)), top: w(4), bottom: w(4)),
child: TextField(
controller: tilteContentC,
textAlign: TextAlign.left,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 5,
maxLength: 30,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
// focusNode: dishFocusNode,
decoration: InputDecoration(
isCollapsed: true,
border:
OutlineInputBorder(borderSide: BorderSide.none),
hintText: '请输入预订通知卡片主题文字',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(
// FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.multiline)),
VEmptyView(20),
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(
left: w(20), top: w(12), bottom: w(11), right: w(16)),
child: Text(
'通知主题选择(左右滑动选择要使用的主题)',
'卡片样式选择(左右滑动选择要使用的样式)',
style: TextStyle(
color: MyColours.color_515151, fontSize: font(16)),
)),
Padding(
padding: EdgeInsets.only(left: w(16)),
padding: EdgeInsets.only(left: w(20)),
child: MyDivider(double.infinity, w(0.5),
color: MyColours.color_E7E7E7)),
VEmptyView(240),
... ... @@ -267,16 +335,30 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
onPressed: () async {
bool success = await marketingCenterProvider.setConfing(
context,
{
'sid':
Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'key': 'lite_style',
'value': miniType
},
if (tilteContentC.text.trim().length == 0) {
Utils.showToast('请输入预订通知卡片主题文字!');
return;
}
Map<String, dynamic> data = {
'lite_style': miniType,
'lite_style_title': tilteContentC.text.trim()
};
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'data': jsonEncode(data),
};
bool success = await marketingCenterProvider.setConfings(
context, params,
// {
// 'sid':
// Provider.of<UserModel>(context, listen: false)
// .user
// .sellerid,
// 'key': 'lite_style',
// 'value': miniType
// },
needToast: false);
if (success) {
if (Navigator.canPop(context)) {
... ...
... ... @@ -4740,7 +4740,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
// radius: ScreenUtil().setWidth(8),
// isBold: false,
// onPressed: () async {
// dynamic isSuccess = await Utils.goShareInvicationToWeChat(
// dynamic isSuccess = await Utils.goShareInvicationToWeChatSim(
// context,
// widget.rid,
// Provider.of<UserModel>(context, listen: false).user.openid,
... ... @@ -4810,7 +4810,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
if (isSuc) {
couponProvider.hasModify = true;
bus.emit("refresh_book_list");
bool isSuccess = await Utils.goShareInvicationToWeChat(
bool isSuccess = await Utils.goShareInvicationToWeChatSim(
context,
widget.rid,
Provider.of<UserModel>(context,
... ... @@ -4827,7 +4827,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
}
}
} else {
bool isSuccess = await Utils.goShareInvicationToWeChat(
bool isSuccess = await Utils.goShareInvicationToWeChatSim(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
... ... @@ -4870,7 +4870,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
if (isSuc) {
couponProvider.hasModify = true;
bus.emit("refresh_book_list");
bool isSuccess = await Utils.goShareInvicationToWeChat(
bool isSuccess = await Utils.goShareInvicationToWeChatSim(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
... ... @@ -4886,7 +4886,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
}
}
} else {
bool isSuccess = await Utils.goShareInvicationToWeChat(
bool isSuccess = await Utils.goShareInvicationToWeChatSim(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
... ... @@ -4951,7 +4951,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
// couponProvider.hasModify = true;
// bus.emit("refresh_book_list");
// bool isSuccess =
// await Utils.goShareInvicationToWeChat(
// await Utils.goShareInvicationToWeChatSim(
// context,
// widget.rid,
// Provider.of<UserModel>(context,
... ... @@ -4965,7 +4965,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
// }
// } else {
// bool isSuccess =
// await Utils.goShareInvicationToWeChat(
// await Utils.goShareInvicationToWeChatSim(
// context,
// widget.rid,
// Provider.of<UserModel>(context,
... ... @@ -4998,7 +4998,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
// couponProvider.hasModify = true;
// bus.emit("refresh_book_list");
// bool isSuccess =
// await Utils.goShareInvicationToWeChat(
// await Utils.goShareInvicationToWeChatSim(
// context,
// widget.rid,
// Provider.of<UserModel>(context, listen: false)
... ... @@ -5010,7 +5010,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
// }
// }
// } else {
// bool isSuccess = await Utils.goShareInvicationToWeChat(
// bool isSuccess = await Utils.goShareInvicationToWeChatSim(
// context,
// widget.rid,
// Provider.of<UserModel>(context, listen: false)
... ...
... ... @@ -96,6 +96,7 @@ class NotebookDetailModel extends ChangeNotifier {
String isShowNoticeDeposit;
String liteStyle = '3';
bool isNotice = false;
String liteStyleTitle;
NotebookDetailModel() {
initSexList();
... ... @@ -212,6 +213,7 @@ class NotebookDetailModel extends ChangeNotifier {
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data is Map) {
liteStyleTitle = baseResp.data["lite_style_title"];
remarks = (baseResp.data['user_remark']).map<Remark>((value) {
return Remark.fromJson(value);
}).toList();
... ...
... ... @@ -8,6 +8,7 @@ import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/utils.dart';
import 'dart:convert';
/**
* 第三方登陆
... ... @@ -21,18 +22,21 @@ class OtherLoginProvider extends ChangeNotifier {
/// 给手机发送短信验证码
Future<bool> getPhoneCode(BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.post, HttpUrl.send_vc_code,
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.send_vc_code,
data: params, showLoading: false)
.catchError((error) {});
if (baseResp.code == Constant.status_success) {
if (baseResp.data.isEmpty) {
return false;
} else {
Map<String, dynamic> data = jsonDecode(baseResp.data);
//解析解析
phoneCodeSunModel = PhoneCodeModel.fromJson(baseResp.responseData).data;
return true;
if (data['status'] == 'success') {
return true;
}
// phoneCodeSunModel = PhoneCodeModel.fromJson(jsonDecode(baseResp.data)).data;
return false;
}
} else {
if (baseResp != null) {
... ... @@ -95,7 +99,6 @@ class OtherLoginProvider extends ChangeNotifier {
Utils.showToast(baseResp.msg ?? "");
}
return checkbindPhoneSunModel;
}
}
}
... ...
... ... @@ -3672,7 +3672,8 @@ var collectStoreInfoPageHandle = new Handler(
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["daylist"].first)));
return ChangeNotifierProvider<CollectStoreProvider>(
create: (_) => CollectStoreProvider(), child: CollectStoreInfoPage());
create: (_) => CollectStoreProvider(), child:ChangeNotifierProvider<OtherLoginProvider>(
create: (_) => OtherLoginProvider(), child: CollectStoreInfoPage()));
});
//邀请函主题选择
... ...
... ... @@ -2499,8 +2499,8 @@ class Utils {
}
//分享邀请函
static goShareInvicationToWeChat(BuildContext context, String rid, String uid,
String month, String week, String liteStyle,
static goShareInvicationToWeChatSim(BuildContext context, String rid,
String uid, String month, String week, String liteStyle,
{bool isWechat = true, String depositId}) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
... ... @@ -2526,7 +2526,112 @@ class Utils {
String _title =
"您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情";
// String _title =
// "${Provider.of<UserModel>(context, listen: false).user.sellername}-全体员工恭候您的光临!预订详情,请点击查看";
// "${Provider.of<UserModel>(context, listen: false).user.sellername}加长版加长版加长-全体员工恭候您的光临!预订详情,请点击查看";
// if (Provider.of<UserModel>(context, listen: false).user.sellerid == '677') {
// //京厨九跳转新的邀请函地址
// _path =
// "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
// }
String _description = "进入查看包间详情,转发同行好友,还可一键导航到饭店";
// Uint8List source = await testComporessList(context, _thumbnail);
bool isSuccess = false;
if (isWechat) {
//跳转小程序
String _userName = "gh_487873d353b3";
// String _path =
// "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
String _path =
"pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
if (depositId != null) {
_path =
"pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
}
var model = new WeChatShareMiniProgramModel(
webPageUrl: _webPageUrl,
userName: _userName,
title: _title,
path: _path,
description: _description,
miniProgramType: Constant.wxMiniProgramType, //
// miniProgramType: WXMiniProgramType.RELEASE, //正式版
// miniProgramType: //开发版
// thumbnail: WeChatImage.binary(source)
// thumbnail: WeChatImage.network(_thumbnail)
thumbnail: liteStyle == '0'
? WeChatImage.network(_thumbnail)
: WeChatImage.binary(_thumbnailUint8List));
isSuccess = await shareToWeChat(model);
} else {
// Loading.showLoading(context);
// // String _path =
// // "pages/customer/index.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
// String _path =
// "pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
// if(depositId != null){
// _path =
// "pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
// }
// FlutterWxwork flutterWxwork = FlutterWxwork();
// bool isAppInstalled = await flutterWxwork.isAppInstalled();
// print(isAppInstalled);
// if (isAppInstalled) {
// bool registerResult = await flutterWxwork.registerApp(
// 'wwauthbdca186ec4257973000003', 'wwbdca186ec4257973', '1000003');
// print(registerResult);
// // isSuccess = await flutterWxwork.shareText(text: "dddddddd");
// dynamic isSuccess = await flutterWxwork.shareMiniProgram(
// userName: 'gh_487873d353b3@app',
// path: _path,
// hdImageData: _thumbnail,
// title: _title,
// description: _description,
// );
// Loading.hideLoading(context);
// // var isSuccess = await flutterWxwork.shareImage();
// print(isSuccess);
// } else {
// Loading.hideLoading(context);
// Utils.showToast('未安装企业微信');
// }
}
return isSuccess;
}
//分享邀请函
static goShareInvicationToWeChat(BuildContext context, String rid, String uid,
String month, String week, String liteStyle, String liteStyleTitle,
{bool isWechat = true, String depositId}) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
// "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1";
// String _thumbnail =
// "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg";
String sellerImage =
Provider.of<UserModel>(context, listen: false).user.sellerimage;
String _thumbnail = sellerImage == null || sellerImage == ''
? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
: sellerImage;
Uint8List _thumbnailUint8List;
print(size(_thumbnail.length));
if (liteStyle != '0') {
_thumbnailUint8List = await canvas(
context,
sellerImage == null || sellerImage == ''
? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
: sellerImage,
month,
week);
}
String _title = liteStyleTitle ??
"您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情";
// String _title =
// "${Provider.of<UserModel>(context, listen: false).user.sellername}加长版加长版加长-全体员工恭候您的光临!预订详情,请点击查看";
// if (Provider.of<UserModel>(context, listen: false).user.sellerid == '677') {
// //京厨九跳转新的邀请函地址
// _path =
... ...