戴余标 3 years ago
commit a643f4af06

@ -3,6 +3,8 @@
/// FlutterGen /// FlutterGen
/// ***************************************************** /// *****************************************************
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: directives_ordering,unnecessary_import // ignore_for_file: directives_ordering,unnecessary_import
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
@ -567,19 +569,23 @@ class Assets {
static const $AssetsUserGen user = $AssetsUserGen(); static const $AssetsUserGen user = $AssetsUserGen();
} }
class AssetGenImage extends AssetImage { class AssetGenImage {
const AssetGenImage(String assetName) : super(assetName); const AssetGenImage(this._assetName);
final String _assetName;
Image image({ Image image({
Key? key, Key? key,
AssetBundle? bundle,
ImageFrameBuilder? frameBuilder, ImageFrameBuilder? frameBuilder,
ImageLoadingBuilder? loadingBuilder,
ImageErrorWidgetBuilder? errorBuilder, ImageErrorWidgetBuilder? errorBuilder,
String? semanticLabel, String? semanticLabel,
bool excludeFromSemantics = false, bool excludeFromSemantics = false,
double? scale = 1.0,
double? width, double? width,
double? height, double? height,
Color? color, Color? color,
Animation<double>? opacity,
BlendMode? colorBlendMode, BlendMode? colorBlendMode,
BoxFit? fit, BoxFit? fit,
AlignmentGeometry alignment = Alignment.center, AlignmentGeometry alignment = Alignment.center,
@ -588,19 +594,24 @@ class AssetGenImage extends AssetImage {
bool matchTextDirection = false, bool matchTextDirection = false,
bool gaplessPlayback = false, bool gaplessPlayback = false,
bool isAntiAlias = false, bool isAntiAlias = false,
String? package,
FilterQuality filterQuality = FilterQuality.low, FilterQuality filterQuality = FilterQuality.low,
int? cacheWidth,
int? cacheHeight,
}) { }) {
return Image( return Image.asset(
_assetName,
key: key, key: key,
image: this, bundle: bundle,
frameBuilder: frameBuilder, frameBuilder: frameBuilder,
loadingBuilder: loadingBuilder,
errorBuilder: errorBuilder, errorBuilder: errorBuilder,
semanticLabel: semanticLabel, semanticLabel: semanticLabel,
excludeFromSemantics: excludeFromSemantics, excludeFromSemantics: excludeFromSemantics,
scale: scale,
width: width, width: width,
height: height, height: height,
color: color, color: color,
opacity: opacity,
colorBlendMode: colorBlendMode, colorBlendMode: colorBlendMode,
fit: fit, fit: fit,
alignment: alignment, alignment: alignment,
@ -609,9 +620,12 @@ class AssetGenImage extends AssetImage {
matchTextDirection: matchTextDirection, matchTextDirection: matchTextDirection,
gaplessPlayback: gaplessPlayback, gaplessPlayback: gaplessPlayback,
isAntiAlias: isAntiAlias, isAntiAlias: isAntiAlias,
package: package,
filterQuality: filterQuality, filterQuality: filterQuality,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
); );
} }
String get path => assetName; String get path => _assetName;
} }

@ -3,6 +3,8 @@
/// FlutterGen /// FlutterGen
/// ***************************************************** /// *****************************************************
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: directives_ordering,unnecessary_import // ignore_for_file: directives_ordering,unnecessary_import
class FontFamily { class FontFamily {

@ -2,9 +2,9 @@
// Project imports: // Project imports:
import 'package:aku_new_community_manager/provider/app_provider.dart'; import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/provider/data_provider.dart'; import 'package:aku_new_community_manager/provider/data_provider.dart';
import 'package:aku_new_community_manager/provider/message_provider.dart'; import 'package:aku_new_community_manager/provider/message_provider.dart';
import 'package:aku_new_community_manager/provider/timer_provider.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:aku_new_community_manager/style/apptheme.dart'; import 'package:aku_new_community_manager/style/apptheme.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart';

@ -1,4 +1,5 @@
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart'; import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -9,7 +10,6 @@ import 'package:provider/provider.dart';
import 'package:sms_autofill/sms_autofill.dart'; import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../../provider/timer_provider.dart';
class CodeMessagePage extends StatefulWidget { class CodeMessagePage extends StatefulWidget {
final String tel; final String tel;

@ -1,6 +1,7 @@
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart'; import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -11,7 +12,6 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../../provider/timer_provider.dart';
import 'forgot_set_psd_page.dart'; import 'forgot_set_psd_page.dart';
class ForgotPsdPage extends StatefulWidget { class ForgotPsdPage extends StatefulWidget {

@ -3,6 +3,7 @@ import 'package:aku_new_community_manager/new_ui/auth/psd_verify.dart';
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart'; import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/psd_textfield.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/psd_textfield.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -13,8 +14,6 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../../provider/timer_provider.dart';
class ForgotSetPsdPage extends StatefulWidget { class ForgotSetPsdPage extends StatefulWidget {
final String tel; final String tel;

@ -2,8 +2,7 @@ import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/psd_textfield.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/psd_textfield.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart';
import 'package:aku_new_community_manager/provider/app_provider.dart'; import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/provider/timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';

@ -391,7 +391,7 @@ class _NewHomePageState extends State<NewHomePage> {
padding: EdgeInsets.symmetric(horizontal: 40.w, vertical: 48.w), padding: EdgeInsets.symmetric(horizontal: 40.w, vertical: 48.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w), borderRadius: BorderRadius.circular(16.w),
image: DecorationImage(image: Assets.home.homeHead)), image: DecorationImage(image: AssetImage(Assets.home.homeHead.path))),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -433,7 +433,7 @@ class _NewHomePageState extends State<NewHomePage> {
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
), ),
child: child:
'${UserTool.userProvider.userInfoModel!.positionName??''}' '${UserTool.userProvider.userInfoModel!.positionName ?? ''}'
.text .text
.size(24.sp) .size(24.sp)
.color(Colors.black.withOpacity(0.85)) .color(Colors.black.withOpacity(0.85))

@ -147,30 +147,5 @@ class AppProvider extends ChangeNotifier {
_pickedCityAndCommunity = null; _pickedCityAndCommunity = null;
notifyListeners(); notifyListeners();
} }
///
/*int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}*/
notifyListeners(); notifyListeners();
} }

@ -2,7 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ClockTimerProvider extends ChangeNotifier{ class ClockTimerProvider extends ChangeNotifier {
/// ///
int second = 60; int second = 60;
bool timerStart = false; bool timerStart = false;
@ -10,6 +10,10 @@ class ClockTimerProvider extends ChangeNotifier{
void startTimer() { void startTimer() {
timerStart = true; timerStart = true;
print(timer==null);
if (timer != null) {
return;
}
timer = Timer.periodic(Duration(seconds: 1), (timer) { timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) { if (second > 0) {
second--; second--;
@ -27,4 +31,4 @@ class ClockTimerProvider extends ChangeNotifier{
timer = null; timer = null;
notifyListeners(); notifyListeners();
} }
} }

@ -1,30 +0,0 @@
import 'dart:async';
import 'package:flutter/material.dart';
class ClockTimerProvider extends ChangeNotifier{
///
int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}
}

@ -27,7 +27,6 @@ class UserProvider extends ChangeNotifier {
await HiveStore.appBox!.put('login', true); await HiveStore.appBox!.put('login', true);
if (isLogin) { if (isLogin) {
await updateUserInfo(); await updateUserInfo();
WebSocketUtil().setUser(_userInfoModel!.id.toString());
WebSocketUtil().startWebSocket(); WebSocketUtil().startWebSocket();
await SignFunc.checkNameAndAccount(); await SignFunc.checkNameAndAccount();
} }

@ -24,6 +24,7 @@ class UserInfoModel extends Equatable {
final String? entryDate; final String? entryDate;
final String? remake; final String? remake;
final List<ImgModel>? imgList; final List<ImgModel>? imgList;
final int communityCode;
final String communityName; final String communityName;
final String? positionName; final String? positionName;
final int? workOrderJurisdiction; final int? workOrderJurisdiction;
@ -86,11 +87,12 @@ class UserInfoModel extends Equatable {
this.lastLoginDate, this.lastLoginDate,
this.nickName, this.nickName,
this.address, this.address,
required this.entryDate, this.entryDate,
this.remake, this.remake,
this.imgList, this.imgList,
required this.communityCode,
required this.communityName, required this.communityName,
required this.positionName, this.positionName,
this.workOrderJurisdiction, this.workOrderJurisdiction,
}); });
} }

@ -27,6 +27,7 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
imgList: (json['imgList'] as List<dynamic>?) imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>)) ?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
communityCode: json['communityCode'] as int,
communityName: json['communityName'] as String, communityName: json['communityName'] as String,
positionName: json['positionName'] as String?, positionName: json['positionName'] as String?,
workOrderJurisdiction: json['workOrderJurisdiction'] as int?, workOrderJurisdiction: json['workOrderJurisdiction'] as int?,

@ -1,9 +1,9 @@
// Package imports: // Package imports:
// Project imports: // Project imports:
import 'package:aku_new_community_manager/provider/app_provider.dart'; import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/provider/data_provider.dart'; import 'package:aku_new_community_manager/provider/data_provider.dart';
import 'package:aku_new_community_manager/provider/message_provider.dart'; import 'package:aku_new_community_manager/provider/message_provider.dart';
import 'package:aku_new_community_manager/provider/timer_provider.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';

@ -1,11 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:web_socket_channel/io.dart'; import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:web_socket_channel/web_socket_channel.dart';
const String baseUri = 'wss://shop.kaidalai.cn/websocket/butlerApp';
enum SOCKETSTATUS { enum SOCKETSTATUS {
CONNECTED, // CONNECTED, //
BREAKOFF, // BREAKOFF, //
@ -17,13 +17,18 @@ class WebSocketUtil {
// //
WebSocketUtil._(); WebSocketUtil._();
// //
factory WebSocketUtil() => _socket; factory WebSocketUtil() => _socket;
IOWebSocketChannel? _webSocket; IOWebSocketChannel? _webSocket;
/// ///
String _user = 'admin';
static const String baseUri = 'wss://saas.kaidalai.cn/websocket/butlerApp';
String get urlAddress =>
'$baseUri/${UserTool.userProvider.userInfoModel?.communityCode}/${UserTool.userProvider.userInfoModel?.nickName}';
/// ///
SOCKETSTATUS _socketStatus = SOCKETSTATUS.CLOSED; SOCKETSTATUS _socketStatus = SOCKETSTATUS.CLOSED;
@ -79,26 +84,23 @@ class WebSocketUtil {
print('——————————webSocket init ——————————'); print('——————————webSocket init ——————————');
} }
///
void setUser(String user) {
this._user = user;
}
///websocket ///websocket
void startWebSocket() { void startWebSocket() {
closeWebSocket(); closeWebSocket();
try { try {
_webSocket = IOWebSocketChannel.connect(Uri.parse('$baseUri/$_user')); _webSocket = IOWebSocketChannel.connect(Uri.parse(urlAddress));
print('webSocket已连接服务器$baseUri/$_user'); print('webSocket已连接服务器$urlAddress');
_socketStatus = SOCKETSTATUS.CONNECTED; _socketStatus = SOCKETSTATUS.CONNECTED;
endReconnect(); endReconnect();
onStart?.call(); onStart?.call();
_webSocket!.stream.listen( _webSocket!.stream.listen(
(event) => webSocketReceiveMessage(event as String), (event) => webSocketReceiveMessage(event as String),
onError: webSocketOnError, ); onError: webSocketOnError,
);
initHeartBeat(); initHeartBeat();
} catch (e) { } catch (e) {
BotToast.showText(text: 'webSocket连接失败'); BotToast.showText(text: 'webSocket连接失败');
print('webSocket连接失败');
onError?.call(e); onError?.call(e);
LoggerData.addData(e); LoggerData.addData(e);
} }

Loading…
Cancel
Save