Commit f21a014dfcdf945965dbaf9c9e73f73a543143ef

Authored by wdn127929
1 parent c89a60e7

修改登陆方式

... ... @@ -42,6 +42,8 @@ PODS:
- Reachability (3.2)
- shared_preferences (0.0.1):
- Flutter
- sign_in_with_apple (0.0.1):
- Flutter
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
... ... @@ -74,6 +76,7 @@ DEPENDENCIES:
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- tpns_flutter_plugin (from `.symlinks/plugins/tpns_flutter_plugin/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
... ... @@ -124,6 +127,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/photo_manager/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
sign_in_with_apple:
:path: ".symlinks/plugins/sign_in_with_apple/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
tpns_flutter_plugin:
... ... @@ -155,6 +160,7 @@ SPEC CHECKSUMS:
photo_manager: f7c619c2cc8c2adb8d85c63363babac477de9c67
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
sign_in_with_apple: 34f3f5456a45fd7ac5fb42905e2ad31dae061b4a
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
TPNS-iOS: 9b35473a4a0d07f2c2730ea1e66c6749c2b98095
tpns_flutter_plugin: 8dbbee157aab91a878f64d056c1383726a6c5c4d
... ...
... ... @@ -295,6 +295,7 @@
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sign_in_with_apple/sign_in_with_apple.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
"${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework",
... ... @@ -318,6 +319,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sign_in_with_apple.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter.framework",
... ...
... ... @@ -5,7 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'route/navigate_service.dart';
class App{
class App {
static FluroRouter router;
static GlobalKey<NavigatorState> key = GlobalKey();
static SharedPreferences sp;
... ... @@ -14,13 +14,13 @@ class App{
static double statusBarHeight;
static double bottomBarHeight;
static GetIt getIt = GetIt.instance;
static bool isInstallWx = false;
static initSp() async{
static initSp() async {
sp = await SharedPreferences.getInstance();
}
static setupLocator(){
static setupLocator() {
getIt.registerSingleton(NavigateService());
}
}
... ...
... ... @@ -113,6 +113,11 @@ class MyAppState extends State<MyApp> {
doOnIOS: true,
universalLink: "https://xt04.colorcun.com/link/OneKey/");
var result = await isWeChatInstalled;
if (result != null && result) {
App.isInstallWx = true;
} else {
App.isInstallWx = false;
}
LogUtil.v("is installed $result");
}
... ...
... ... @@ -5,6 +5,7 @@ import 'package:dio/dio.dart';
import 'package:dio/dio.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:one_key/app.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/loading.dart';
... ... @@ -343,6 +344,10 @@ class DioUtil {
}
options.method = method;
options.contentType = Headers.formUrlEncodedContentType;
if (App.sp?.getString("unionid") != null &&
App.sp?.getString("unionid").isNotEmpty) {
options.headers = {"unionid": App.sp.getString("unionid")};
}
return options;
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
class CreateStorePage extends StatefulWidget {
CreateStorePage({Key key}) : super(key: key);
@override
_CreateStorePageState createState() => _CreateStorePageState();
}
class _CreateStorePageState extends State<CreateStorePage> {
ScrollController _controller;
List<Map> roomType = [];
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = ScrollController();
for (int i = 0; i < 8; i++) {
roomType.add({
'$i': {'name': '${i + 3}人间', 'check': true}
});
}
}
List<Widget> _roomTypeWidget() {
List<Widget> list = [];
for (int i = 0; i < roomType.length; i++) {
list.add(CheckboxListTile(
value: roomType[i]['$i']['check'],
title: Text(roomType[i]['$i']['name']),
onChanged: (value) {
setState(() {
roomType[i]['$i']['check'] = !roomType[i]['$i']['check'];
});
}));
}
return list;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: SystemAppBar(
'新建店铺',
onTap: () {
Navigator.pop(context);
},
),
body: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: SingleChildScrollView(
controller: _controller,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('1.您的店内有哪些包间类型?',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.bold)),
VEmptyView(30),
Column(children: _roomTypeWidget()),
]))),
RoundButton(
text: '下一步',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(20),
fontSize: 28,
isBold: false,
onPressed: () {
NavigatorUtil.goCreateStorePage(context);
},
)
]))));
}
}
... ...
... ... @@ -88,7 +88,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
_getIntent();
Future.delayed(Duration(milliseconds: 30000), () {
ContactModel.getInstance().uploadLocalContact(context);
UpdateModel updateModel = new UpdateModel();
UpdateModel updateModel = Provider.of<UpdateModel>(context);
updateModel.checkUpdate(context, showToast: false);
});
timer = Timer.periodic(Duration(minutes: 3), (_) {
... ...
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/app.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
class BindingPhone extends StatefulWidget {
BindingPhone({Key key}) : super(key: key);
@override
_BindingPhoneState createState() => _BindingPhoneState();
}
class _BindingPhoneState extends State<BindingPhone> {
ScrollController _controller;
FocusNode _phoneNode;
FocusNode _codeNode;
//定义变量
Timer _timer;
//倒计时数值
var countdownTime = 0;
@override
void initState() {
super.initState();
_controller = ScrollController();
_phoneNode = FocusNode();
_codeNode = FocusNode();
}
@override
void dispose() {
super.dispose();
_timer.cancel();
}
///倒计时方法
startCountdown() {
countdownTime = 60;
final call = (timer) {
setState(() {
if (countdownTime < 1) {
_timer.cancel();
} else {
countdownTime -= 1;
}
});
};
_timer = Timer.periodic(Duration(seconds: 1), call);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: SystemAppBar(
'绑定手机号',
onTap: () {
Navigator.pop(context);
},
),
body: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
controller: _controller,
child: Column(
children: [
TextField(
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
focusNode: _phoneNode,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(6),
horizontal: ScreenUtil().setWidth(20)),
border: OutlineInputBorder(),
hintText: '请输入手机号码',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: MyColours.color_199095)),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.number,
),
VEmptyView(30),
Container(
// height: ScreenUtil().setWidth(20),
child: Row(
children: [
Expanded(
child: TextField(
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
focusNode: _codeNode,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(6),
horizontal: ScreenUtil().setWidth(20)),
border: OutlineInputBorder(),
hintText: '请输入短信验证码',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: MyColours.color_199095)),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.number,
),
),
HEmptyView(20),
RoundButton(
height: ScreenUtil().setWidth(88),
width: ScreenUtil().setWidth(240),
text: countdownTime > 0
? "${countdownTime}s后重新获取"
: "获取验证码",
radius: ScreenUtil().setWidth(10),
textColor: MyColours.color_333333,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_999999,
fontSize: 28,
isBold: false,
onPressed: () {
if (countdownTime == 0) {
startCountdown();
}
},
)
],
)),
// Spacer(),
],
),
),
),
RoundButton(
text: '提交',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(20),
fontSize: 28,
isBold: false,
onPressed: () {
//真正登录成功标志
App.sp.setBool("isLogin", true);
NavigatorUtil.goIfNeedCreateStorePage(context);
},
)
],
))),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
class IfNeedCreateStore extends StatefulWidget {
IfNeedCreateStore({Key key}) : super(key: key);
@override
_IfNeedCreateStoreState createState() => _IfNeedCreateStoreState();
}
class _IfNeedCreateStoreState extends State<IfNeedCreateStore> {
ScrollController _controller = ScrollController();
bool noStore = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: SystemAppBar(
'xxx',
onTap: () {
Navigator.pop(context);
},
),
body: Container(
width: double.infinity,
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
noStore ? '您还没有绑定任何店铺' : '您已经是“xxxxx”的员工',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.bold),
),
VEmptyView(30),
InkWell(
onTap: () {
if (noStore) {
//跳转至新建店铺流程
NavigatorUtil.goCreateStorePage(context);
} else {
//进入店铺
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30),
vertical: ScreenUtil().setWidth(16)),
decoration: BoxDecoration(
color: MyColours.color_199095,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10))),
constraints: BoxConstraints(
minWidth: ScreenUtil().setWidth(260)),
child: Text(
noStore ? '创建店铺' : '进入xxxxx',
textAlign: TextAlign.center,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28)),
),
)),
noStore
? Container()
: Container(
margin:
EdgeInsets.only(top: ScreenUtil().setWidth(10)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30),
vertical: ScreenUtil().setWidth(16)),
child: InkWell(
onTap: () {
//跳转至新建店铺流程
NavigatorUtil.goCreateStorePage(context);
},
child: Text(
'不是我,我要重新建店',
textAlign: TextAlign.center,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(24)),
),
)),
])));
}
}
... ...
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart' as fluwx;
import 'package:fluwx/fluwx.dart';
import 'package:one_key/app.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
class LoginPage extends StatefulWidget {
@override
... ... @@ -16,46 +28,64 @@ class LoginPage extends StatefulWidget {
}
}
class LoginState extends State<LoginPage> with WidgetsBindingObserver{
TextEditingController _sellerCodeController=TextEditingController();
class LoginState extends State<LoginPage> with WidgetsBindingObserver {
TextEditingController _sellerCodeController = TextEditingController();
TextEditingController _accountController = TextEditingController();
final TextEditingController _pwdController = TextEditingController();
final ScrollController _scrollController=new ScrollController();
final ScrollController _scrollController = new ScrollController();
final FocusNode _sellerCodeFocusNode=new FocusNode();
final FocusNode _accountFocusNode=new FocusNode();
final FocusNode _pwdFocusNode=new FocusNode();
final FocusNode _sellerCodeFocusNode = new FocusNode();
final FocusNode _accountFocusNode = new FocusNode();
final FocusNode _pwdFocusNode = new FocusNode();
bool obscureText=true;//是否隐藏密码
bool isActivate=false;//是否激活登录
bool obscureText = true; //是否隐藏密码
bool isActivate = false; //是否激活登录
String errorText="";//错误提示
String errorText = ""; //错误提示
bool _check = true;
StreamSubscription<BaseWeChatResponse> _wxlogin;
@override
void initState(){
void initState() {
// TODO: implement initState
super.initState();
_initFluwx();
isLogin();
WidgetsBinding.instance.addObserver(this);
WidgetsBinding.instance.addPostFrameCallback((_){
final UserModel userModel=Provider.of<UserModel>(context,listen: false);
if(userModel!=null&&userModel.user!=null){
Future.delayed(Duration(milliseconds: 50),(){
_sellerCodeController.text=userModel.user.sellercode;
_accountController.text=userModel.user.account;
FocusScope.of(context).requestFocus(_pwdFocusNode);
WidgetsBinding.instance.addPostFrameCallback((_) {
final UserModel userModel =
Provider.of<UserModel>(context, listen: false);
if (userModel != null && userModel.user != null) {
Future.delayed(Duration(milliseconds: 50), () {
_sellerCodeController.text = userModel.user.sellercode;
_accountController.text = userModel.user.account;
// FocusScope.of(context).requestFocus(_pwdFocusNode);
});
}
});
}
handlePostFrame(_){
// _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
//初始化微信SDK
_initFluwx() async {
await registerWxApi(
appId: "wx85aa3cdd0f791e65",
doOnAndroid: true,
doOnIOS: true,
universalLink: "https://xt04.colorcun.com/link/OneKey/");
var result = await isWeChatInstalled;
if (result != null && result) {
App.isInstallWx = true;
} else {
App.isInstallWx = false;
}
setState(() {});
LogUtil.v("is installed $result");
}
handlePostFrame(_) {
// _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
}
@override
void didChangeMetrics() {
... ... @@ -72,279 +102,562 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver{
}
//监听输入框,设置登录按钮状态
setActivate(){
if(_sellerCodeController.text.isNotEmpty&&_accountController.text.isNotEmpty&&_pwdController.text.isNotEmpty){
setActivate() {
if (_sellerCodeController.text.isNotEmpty &&
_accountController.text.isNotEmpty &&
_pwdController.text.isNotEmpty) {
setState(() {
errorText="";
isActivate=true;
errorText = "";
isActivate = true;
});
}else{
} else {
setState(() {
errorText="";
isActivate=false;
errorText = "";
isActivate = false;
});
}
}
//判断是否登录
void isLogin()async{
void isLogin() async {
await App.initSp();
UserModel userModel=Provider.of<UserModel>(context,listen: false);
UserModel userModel = Provider.of<UserModel>(context, listen: false);
userModel.initUser();
if(App.sp.getBool("isLogin")??false){
Future.delayed(Duration(milliseconds: 200),(){
if (App.sp.getBool("isLogin") ?? false) {
Future.delayed(Duration(milliseconds: 200), () {
NavigatorUtil.goHomePage(context);
});
} else {
_getWxCode();
}
}
///微信登陆
_wxLogin() {
sendWeChatAuth(scope: "snsapi_userinfo");
}
///获取微信登录code
_getWxCode() {
_wxlogin = fluwx.weChatResponseEventHandler
.distinct((a, b) => a == b)
.listen((res) {
if (res is fluwx.WeChatAuthResponse && res.errCode == 0) {
LogUtil.v("code:" + res.code);
_getAccessToken(res.code);
} else {
// Utils.showToast(res.errStr??"登录失败,请稍后重试");
}
});
}
///获取微信登录access_token
_getAccessToken(String code) async {
Response response = await DioUtil.getInstance().getDio().get(
"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=87c9a23c2e6032b2da75af6b0efc5424&code=$code&grant_type=authorization_code");
LogUtil.v("access_token:${response.toString()}");
Map<String, dynamic> responseData = json.decode(response.data.toString());
if (responseData["errcode"] != null) {
// Utils.showToast(responseData["errmsg"]??"登录,请稍后重试");
} else {
App.sp.setString("openid", responseData["openid"]);
App.sp.setString("unionid", responseData["unionid"]);
//跳转至手机号绑定页面
//判断是否已经绑定手机号码 ******调用接口*******
//有,通过手机号吗或者opened查找店铺信息进行登陆
//没有,跳转至绑定手机号码页面
NavigatorUtil.goBindingPhonePage(context);
// _getUserInfo(responseData["access_token"], responseData["openid"]);
}
}
// //获取用户信息
// _getUserInfo(String access_token, String openid) async {
// Response response = await DioUtil.getInstance().getDio().get(
// "https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid");
// LogUtil.v('userinfo:' + response.data);
// Map<String, dynamic> responseData = json.decode(response.data.toString());
// if (responseData["errcode"] != null) {
// // Utils.showToast(responseData["errmsg"]??"登录,请稍后重试");
// } else {
// App.sp.setString("nickName", responseData["nickname"]);
// App.sp.setString("headImg", responseData["headimgurl"]);
// App.sp.setString("unionid", responseData["unionid"]);
// App.sp.setBool("isLogin", true);
// // _fromTypeGo();
// String unionId = App.sp.getString("unionid");
// _getMiniOpenid(unionId);
// }
// }
// //获取绑定小程序openid
// _getMiniOpenid(String unionId) async {
// UserModel userInfoProvider = UserModel();
// // Provider.of<UserInfoProvider>(context, listen: false);
// Map<String, String> params = {"unionid": unionId};
// String miniOpenid =
// await userInfoProvider.getMiniProgramOpenid(context, params);
// if (miniOpenid == null) {
// goMiniProgramMd(unionId);
// }
// }
/*
苹果登录获取用户信息
*/
_getUserInfoIOS() async {
// Map<String, String> params = {"openid": App.sp.getString("openid")};
// UserInfoProvider userInfoProvider =
// Provider.of<UserInfoProvider>(context, listen: false);
// UseInfoItemModel useInfoItemModel =
// await userInfoProvider.getUserInfo(context, params);
// if (ObjectUtil.isNotEmpty(useInfoItemModel.openid)) {
// _hideLoading(context);
// App.sp.setString("nickName", useInfoItemModel.nickname);
// App.sp.setString("headImg", '');
// App.sp.setString("unionid", '');
// App.sp.setBool("isLogin", true);
// UserInfoProvider userInfoProvider = new UserInfoProvider();
// userInfoProvider.initPlatformState(context);
// // Loading.hideLoading(context);
// _fromTypeGo();
// } else {
// // 已经授权,但是后台库里没有数据,版本差异,重新插入数据库
// Map param = {
// 'openid': App.sp.getString("openid"),
// 'avatar': 'ios_avatar',
// 'nickname': '',
// 'gender': '1'
// };
// LoginRespository().appleLogin(context, param, () {
// _getUserInfoIOS();
// });
// }
}
///苹果登陆
_iosLogin() async {
// String info = await Utils.getDeviceInfoSystem();
// int systemInfo = info.compareTo('13');
// if (systemInfo < 0) {
// Utils.showToast('该系统版本不支持苹果登录');
// return;
// }
// final credential = await SignInWithApple.getAppleIDCredential(
// scopes: [
// AppleIDAuthorizationScopes.email,
// AppleIDAuthorizationScopes.fullName,
// ],
// webAuthenticationOptions: WebAuthenticationOptions(
// // TODO: Set the `clientId` and `redirectUri` arguments to the values you entered in the Apple Developer portal during the setup
// clientId: 'com.naji.zdap',
// redirectUri: Uri.parse(
// 'https://flutter-sign-in-with-apple-example.glitch.me/callbacks/sign_in_with_apple',
// ),
// ),
// );
// _showLoading(context);
// String mdString = Utils.generateMd5(credential.userIdentifier);
// String temp = mdString.substring(8, mdString.length - 2);
// String openid = 'IOSID_$temp';
// App.sp.setString("openid", openid);
// App.sp.setString("unionid", '');
// print(openid.length);
// // 第一次授权
// if (ObjectUtil.isNotEmpty(credential.familyName)) {
// Map param = {
// 'openid': openid,
// 'avatar': 'ios_avatar',
// 'nickname': '${credential.familyName}${credential.givenName}',
// 'gender': '1'
// };
// LoginRespository().appleLogin(context, param, () {
// _getUserInfoIOS();
// });
// } else {
// if (ObjectUtil.isNotEmpty(App.sp.getString("newUserMsg"))) {
// Map newUserMsg = jsonDecode(App.sp.getString("newUserMsg"));
// //上次失败了,这次重新传
// LoginRespository().appleLogin(context, newUserMsg, () {
// _getUserInfoIOS();
// });
// } else {
// _getUserInfoIOS();
// }
// }
}
@override
Widget build(BuildContext context) {
// TODO: implement build
ScreenUtil.init(context,width: 750,height: 1334);
final Size size=MediaQuery.of(context).size;
App.screenWidth=size.width;
App.screenHeight=size.height;
App.statusBarHeight=MediaQuery.of(context).padding.top;
App.bottomBarHeight=MediaQuery.of(context).padding.bottom;
ScreenUtil.init(context, width: 750, height: 1334);
final Size size = MediaQuery.of(context).size;
App.screenWidth = size.width;
App.screenHeight = size.height;
App.statusBarHeight = MediaQuery.of(context).padding.top;
App.bottomBarHeight = MediaQuery.of(context).padding.bottom;
final double prefixIconWidth = ScreenUtil().setWidth(24);
final double prefixIconWidth=ScreenUtil().setWidth(24);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
body: Container(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
VEmptyView(218-App.statusBarHeight),
Image.asset("assets/logo.png",width: ScreenUtil().setWidth(217),height: ScreenUtil().setWidth(206),),
VEmptyView(121),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8))
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_sellercode.png",width: prefixIconWidth,),
HEmptyView(26),
Text("商户编号",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),),
Expanded(
child: TextField(
controller: _sellerCodeController,
focusNode: _sellerCodeFocusNode,
autofocus: _sellerCodeController.text.isEmpty,
style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28),textBaseline: TextBaseline.alphabetic),
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
backgroundColor: MyColours.color_ffffff,
body: Container(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
VEmptyView(218 - App.statusBarHeight),
Image.asset(
"assets/logo.png",
width: ScreenUtil().setWidth(217),
height: ScreenUtil().setWidth(206),
),
VEmptyView(121),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_bff6f7,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(8))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/icon_sellercode.png",
width: prefixIconWidth,
),
HEmptyView(26),
Text(
"商户编号",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
Expanded(
child: TextField(
controller: _sellerCodeController,
focusNode: _sellerCodeFocusNode,
// autofocus: _sellerCodeController.text.isEmpty,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28),
textBaseline: TextBaseline.alphabetic),
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: "请输入6位商户编码",
hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(28),),
hintStyle: TextStyle(
color: MyColours.color_c1c1c1,
fontSize: ScreenUtil().setSp(28),
),
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 14),
contentPadding: EdgeInsets.symmetric(
horizontal: 10, vertical: 14),
),
onChanged: (_) {
setActivate();
},
keyboardType: TextInputType.number,
),
onChanged: (_){
setActivate();
},
keyboardType: TextInputType.number,
)
],
)),
Container(
height: ScreenUtil().setHeight(84),
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(8))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/icon_account.png",
width: prefixIconWidth,
),
)
],
)
),
Container(
height: ScreenUtil().setHeight(84),
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(8))
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_account.png",width: prefixIconWidth,),
HEmptyView(26),
Text("工 号",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),),
Expanded(
child: TextField(
controller: _accountController,
focusNode: _accountFocusNode,
style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),
decoration: InputDecoration(
HEmptyView(26),
Text(
"工 号",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
Expanded(
child: TextField(
controller: _accountController,
focusNode: _accountFocusNode,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
decoration: InputDecoration(
hintText: "请输入4位工号",
hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(28)),
hintStyle: TextStyle(
color: MyColours.color_c1c1c1,
fontSize: ScreenUtil().setSp(28)),
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 14),
contentPadding: EdgeInsets.symmetric(
horizontal: 10, vertical: 14),
),
onChanged: (_) {
setActivate();
},
keyboardType: TextInputType.number,
),
onChanged: (_){
setActivate();
},
keyboardType: TextInputType.number,
)
],
)),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(27)),
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(8))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/icon_pwd.png",
width: prefixIconWidth,
),
)
],
)
),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20),right: ScreenUtil().setWidth(27)),
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(8))
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_pwd.png",width: prefixIconWidth,),
HEmptyView(26),
Text("密 码",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),),
Expanded(
child: TextField(
controller: _pwdController,
focusNode: _pwdFocusNode,
autofocus: _sellerCodeController.text.isNotEmpty&&_accountController.text.isNotEmpty&&_pwdController.text.isEmpty,
style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),
decoration: InputDecoration(
HEmptyView(26),
Text(
"密 码",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
Expanded(
child: TextField(
controller: _pwdController,
focusNode: _pwdFocusNode,
// autofocus: _sellerCodeController.text.isNotEmpty &&
// _accountController.text.isNotEmpty &&
// _pwdController.text.isEmpty,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
decoration: InputDecoration(
hintText: "请输入密码",
hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(28)),
hintStyle: TextStyle(
color: MyColours.color_c1c1c1,
fontSize: ScreenUtil().setSp(28)),
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 14),
contentPadding: EdgeInsets.symmetric(
horizontal: 10, vertical: 14),
),
onChanged: (_) {
setActivate();
},
obscureText: obscureText,
keyboardType: TextInputType.text,
),
onChanged: (_){
setActivate();
),
GestureDetector(
child: Padding(
padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
child: Image.asset(
obscureText
? "assets/icon_pwd_show.png"
: "assets/icon_pwd_hide.png",
width: ScreenUtil().setWidth(35),
height: ScreenUtil().setHeight(24),
),
),
onTap: () {
setState(() {
obscureText = !obscureText;
});
},
obscureText: obscureText,
keyboardType: TextInputType.text,
)
],
)),
Container(
width: ScreenUtil().setWidth(611),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)),
alignment: Alignment.centerLeft,
child: Text(
errorText,
style: TextStyle(
color: MyColours.color_d93535,
fontSize: ScreenUtil().setSp(16)),
),
),
Consumer<UserModel>(
builder:
(BuildContext context, UserModel value, Widget child) {
return GestureDetector(
onTap: () {
if (!isActivate) return;
if (App.sp.containsKey('unionid')) {
//微信登陆的时候,退出清空数据
App.sp.remove('openid');
App.sp.remove("unionid");
}
Map<String, String> params = {
"seller_code": "${_sellerCodeController.text}",
"alias": "ssahdahgdafgahjkhakjgh",
"account": "${_accountController.text}",
"password": "${_pwdController.text}"
};
value.login(context, params).then((value) {
setState(() {
errorText = value ?? "";
});
});
},
child: Container(
height: ScreenUtil().setHeight(80),
width: ScreenUtil().setWidth(611),
margin:
EdgeInsets.only(top: ScreenUtil().setHeight(56)),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isActivate
? MyColours.color_2bb5b7
: MyColours.color_2bb5b7,
boxShadow: [
BoxShadow(
color: MyColours.color_26000000,
offset: Offset(0, ScreenUtil().setWidth(4)),
)
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(8)))),
child: Text(
"登录",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(34)),
),
),
GestureDetector(
child: Padding(padding: EdgeInsets.all(ScreenUtil().setWidth(10)),child: Image.asset(obscureText?"assets/icon_pwd_show.png":"assets/icon_pwd_hide.png",width: ScreenUtil().setWidth(35),height: ScreenUtil().setHeight(24),),),
onTap: (){
);
},
),
VEmptyView(140),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Offstage(
offstage: !App.isInstallWx,
child: InkWell(
child: Image.asset(
Utils.getImgPath('icon_wechat_login'),
width: ScreenUtil().setWidth(56)),
onTap: () {
if (!_check) {
Utils.showToast('请仔细阅读协议');
return;
}
_wxLogin();
},
)),
Platform.isAndroid
? Text('')
: InkWell(
child: Container(
margin: EdgeInsets.only(
left: Platform.isAndroid
? ScreenUtil().setWidth(0)
: ScreenUtil().setWidth(50)),
child: Image.asset(Utils.getImgPath('apple'),
width: ScreenUtil().setWidth(46))),
onTap: () {
if (!_check) {
Utils.showToast('请仔细阅读协议');
return;
}
_iosLogin();
}),
],
),
VEmptyView(20),
Row(
// mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () {
setState(() {
obscureText=!obscureText;
_check = !_check;
});
},
)
],
)
),
Container(
width: ScreenUtil().setWidth(611),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)),
alignment: Alignment.centerLeft,
child: Text(errorText,style: TextStyle(color: MyColours.color_d93535,fontSize: ScreenUtil().setSp(16)),),
),
Consumer<UserModel>(
builder: (BuildContext context,UserModel value,Widget child){
return GestureDetector(
onTap: (){
if(!isActivate)return;
Map<String,String> params={
"seller_code":"${_sellerCodeController.text}",
"alias":"ssahdahgdafgahjkhakjgh",
"account":"${_accountController.text}",
"password":"${_pwdController.text}"
};
value.login(context, params).then((value){
setState(() {
errorText=value??"";
});
});
},
child: Container(
height: ScreenUtil().setHeight(80),
width: ScreenUtil().setWidth(611),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(56)),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isActivate?MyColours.color_2bb5b7:MyColours.color_2bb5b7,
boxShadow: [
BoxShadow(color: MyColours.color_26000000,offset: Offset(0,ScreenUtil().setWidth(4)),)
],
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text("登录",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(34)),),
child: Container(
// color: Colors.red,
// height: ScreenUtil().setWidth(34),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(102),
top: ScreenUtil().setWidth(10),
bottom: ScreenUtil().setWidth(10)),
child: Center(
child: Image.asset(
_check
? "assets/mine_radio_sel.png"
: "assets/mine_radio_nor.png",
width: ScreenUtil().setWidth(42),
height: ScreenUtil().setWidth(42)),
))),
HEmptyView(6),
Text(
'已阅读并同意',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_353535),
),
);
},
),
VEmptyView(20),
Row(
// mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
InkWell(
onTap: () {
setState(() {
_check = !_check;
});
NavigatorUtil.goWebPage(context, '软件服务协议', "xy");
},
child: Container(
// color: Colors.red,
// height: ScreenUtil().setWidth(34),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(102),
top: ScreenUtil().setWidth(10),
bottom: ScreenUtil().setWidth(10)),
child: Center(
child: Image.asset(
_check
? "assets/mine_radio_sel.png"
: "assets/mine_radio_nor.png",
width: ScreenUtil().setWidth(42),
height: ScreenUtil().setWidth(42)),
))),
HEmptyView(6),
Text(
'已阅读并同意',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_353535),
),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '软件服务协议', "xy");
},
child: Text(
'《软件服务协议》',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_2bb5b7),
child: Text(
'《软件服务协议》',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_2bb5b7),
),
),
),
Text('及',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_353535)),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '隐私政策', "zc");
},
child: Text('《隐私政策》',
Text('及',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_2bb5b7)),
)
],
),
],
color: MyColours.color_353535)),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '隐私政策', "zc");
},
child: Text('《隐私政策》',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_2bb5b7)),
)
],
),
],
),
),
),
)
);
));
}
}
... ...
... ... @@ -11,6 +11,7 @@ import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
... ... @@ -18,15 +19,14 @@ import '../app.dart';
class UserModel with ChangeNotifier {
User _user;
String _registrationId;//极光推送registrationId
String _token;//信鸽推送token
String _registrationId; //极光推送registrationId
String _token; //信鸽推送token
User get user => _user;
set registrationId(String registrationId)=>_registrationId=registrationId;
String get registrationId =>_registrationId;
set registrationId(String registrationId) => _registrationId = registrationId;
String get registrationId => _registrationId;
String get token => _token;
... ... @@ -109,16 +109,38 @@ class UserModel with ChangeNotifier {
}
}
// //判断微信登录成功APP用户是否绑定微信小程序,绑定返回绑定的微信小程序openid,否则返回null
// Future<String> getMiniProgramOpenid(BuildContext context, Map req) async {
// try {
// BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
// context, Method.get, HttpUrl.get_mini_openid,
// data: req, showLoading: true);
// if (baseResp == null) return null;
// if (baseResp.code == Constant.status_success) {
// App.sp.setString("mini-openid", baseResp.data?.toString() ?? "");
// App.sp.setString("openid", baseResp.data?.toString() ?? "");
// // initPlatformState(context); //注册信鸽推送,绑定openid,token关系
// return baseResp.data?.toString();
// } else {
// App.sp.setString("mini-openid", "");
// }
// } catch (e) {
// print(e);
// Loading.hideLoading(context);
// }
// return null;
// }
///初始化推送token
userTokenInit(BuildContext context, Map<String, String> params) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.user_token_init,showLoading: false,
data: params)
.request<dynamic>(context, Method.get, HttpUrl.user_token_init,
showLoading: false, data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp!=null&&baseResp.code == Constant.status_success) {
}
if (baseResp != null && baseResp.code == Constant.status_success) {}
}
//版本更新弹框
... ... @@ -164,12 +186,16 @@ class UserModel with ChangeNotifier {
),
),
),
MyDivider(ScreenUtil().setWidth(1),ScreenUtil().setWidth(94)),
MyDivider(
ScreenUtil().setWidth(1), ScreenUtil().setWidth(94)),
Expanded(
child: GestureDetector(
onTap: () {
Navigator.of(context).pop();
loginOut(pageContext, {"seller_code":user.sellercode,"account":user.account});
loginOut(pageContext, {
"seller_code": user.sellercode,
"account": user.account
});
},
child: Text(
"确定",
... ... @@ -186,16 +212,18 @@ class UserModel with ChangeNotifier {
],
),
);
return Center(child: UnconstrainedBox(
constrainedAxis: Axis.vertical,
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: ScreenUtil().setWidth(560)),
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: widget,
)
return Center(
child: UnconstrainedBox(
constrainedAxis: Axis.vertical,
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: ScreenUtil().setWidth(560)),
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: widget,
)),
),
),);
);
return AlertDialog(
content: widget,
contentPadding: EdgeInsets.zero,
... ... @@ -213,6 +241,11 @@ class UserModel with ChangeNotifier {
if (baseResp.code != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试");
} else {
if (App.sp.containsKey('unionid')) {
//微信登陆的时候,退出清空数据
App.sp.remove('openid');
App.sp.remove("unionid");
}
App.sp.setBool("isLogin", false);
XgFlutterPlugin().stopXg();
NavigatorUtil.goLoginPage(context);
... ...
... ... @@ -11,9 +11,12 @@ import 'package:one_key/pages/coupon/coupon_edit_page.dart';
import 'package:one_key/pages/coupon/coupon_history_page.dart';
import 'package:one_key/pages/coupon/coupon_page.dart';
import 'package:one_key/pages/coupon/coupon_selecet_page.dart';
import 'package:one_key/pages/create_store/create_store.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page.dart';
import 'package:one_key/pages/home/home_page.dart';
import 'package:one_key/pages/invicate/invitation_page.dart';
import 'package:one_key/pages/login/binding_phone.dart';
import 'package:one_key/pages/login/if_need_create_store.dart';
import 'package:one_key/pages/login/login_page.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
import 'package:one_key/pages/detail/notebook_detail_page.dart';
... ... @@ -269,3 +272,30 @@ var baseInfoPageHandler = new Handler(
return BaseInfoPage();
});
///绑定手机号码页面
var bindingPhonePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return BindingPhone();
});
///是否新建店铺页面
var ifNeedCreateStorePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return IfNeedCreateStore();
});
///新建店铺页面
var createStorePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return CreateStorePage();
});
... ...
... ... @@ -28,6 +28,9 @@ class Routes {
static String coupon_select = "/coupon_select"; //优惠券选择
static String coupon_detail = "/coupon_detail"; //优惠券详情页
static String base_info = "/base_info"; //个人资料页面
static String binding_phone = "/binding_phone"; //绑定手机号码页面
static String if_need_create_store = "/if_need_create_store"; //是否选择新建店铺页面
static String create_store = "/create_store"; //新建店铺
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -59,6 +62,12 @@ class Routes {
router.define(coupon_edit, handler: handleCouponEditPageHandler);
router.define(coupon_select, handler: handleCouponSelectPageHandler);
router.define(coupon_detail, handler: handleCouponDetailPageHandler);
router.define(base_info, handler: baseInfoPageHandler);
router.define(base_info, handler: baseInfoPageHandler);
router.define(binding_phone, handler: bindingPhonePageHandler);
router.define(if_need_create_store, handler: ifNeedCreateStorePageHandler);
router.define(create_store, handler: createStorePageHandler);
}
}
... ...
... ... @@ -192,4 +192,23 @@ class NavigatorUtil {
{replace = false}) {
return _navigateTo(context, "${Routes.base_info}", replace: replace);
}
/// 绑定手机号吗页面
static Future<dynamic> goBindingPhonePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.binding_phone}", replace: replace);
}
/// 是否新建店铺页面
static Future<dynamic> goIfNeedCreateStorePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.if_need_create_store}",
replace: replace);
}
/// 新建店铺页面
static Future<dynamic> goCreateStorePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.create_store}", replace: replace);
}
}
... ...
... ... @@ -27,6 +27,19 @@ import '../app.dart';
typedef BookTimeSetCallback = void Function(bool needChange);
class Utils {
static getDeviceInfoSystem() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isIOS) {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
print('Running on ${iosInfo.utsname.machine}');
return iosInfo.systemVersion;
} else if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
print('Running on ${androidInfo.model}');
return androidInfo;
}
}
///检测是否有相机或者相册权限
static getPickPermission(BuildContext context, VoidCallback callback,
PermissionGroup permissionGroup) async {
... ... @@ -258,8 +271,7 @@ class Utils {
}
//分享邀请函
static goShareInvicationToWeChat(
String rid, String uid) async {
static goShareInvicationToWeChat(String rid, String uid) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
// "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1";
... ...
... ... @@ -835,6 +835,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.3"
sign_in_with_apple:
dependency: "direct main"
description:
name: sign_in_with_apple
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.4"
simple_gesture_detector:
dependency: transitive
description:
... ...
... ... @@ -98,6 +98,8 @@ dependencies:
image_picker: ^0.6.7+21
#多图选择
photo: ^0.4.8
#苹果登陆
sign_in_with_apple: ^2.5.1
... ...