验证码重复点击bug

pull/1/head
张萌 3 years ago
parent adc538516f
commit f2e41b2e87

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

@ -30,9 +30,6 @@ class UserProvider extends ChangeNotifier {
Future init() async {
if (isLogin) {
await updateUserInfo();
WebSocketUtil().setUser(userInfoModel!.id.toString());
WebSocketUtil().setCommunityCode(userInfoModel!.communityCode);
WebSocketUtil().setNickName(userInfoModel!.nickName!);
WebSocketUtil().startWebSocket();
await updateMyHouseInfo();

@ -7,9 +7,6 @@ import 'package:web_socket_channel/web_socket_channel.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
// const String baseUri = 'wss://shop.kaidalai.cn/websocket/app';
const String baseUri = 'wss://saas.kaidalai.cn/websocket/app';
enum SOCKETSTATUS {
CONNECTED, //
BREAKOFF, //
@ -28,9 +25,10 @@ class WebSocketUtil {
IOWebSocketChannel? _webSocket;
///
String _user = 'admin';
String _communityCode = 'communityCode';
String _nickName = 'nickName';
static const String baseUri = 'wss://saas.kaidalai.cn/websocket/app';
String get urlAddress =>
'$baseUri/${UserTool.userProvider.userInfoModel?.communityCode}/${UserTool.userProvider.userInfoModel?.nickName}';
///
SOCKETSTATUS _socketStatus = SOCKETSTATUS.CLOSED;
@ -86,32 +84,19 @@ class WebSocketUtil {
print('——————————webSocket init ——————————');
}
///
void setUser(String user) {
this._user = user;
}
void setCommunityCode(String communityCode) {
this._communityCode = communityCode;
}
void setNickName(String nickName) {
this._nickName = nickName;
}
///websocket
void startWebSocket() {
closeWebSocket();
try {
_webSocket = IOWebSocketChannel.connect(
Uri.parse('$baseUri/$_communityCode/$_nickName'));
print('webSocket已连接服务器$baseUri/$_user');
_webSocket = IOWebSocketChannel.connect(Uri.parse(urlAddress));
print('webSocket已连接服务器$urlAddress');
_socketStatus = SOCKETSTATUS.CONNECTED;
endReconnect();
onStart?.call();
_webSocket!.stream.listen(
(event) => webSocketReceiveMessage(event as String),
onError: webSocketOnError,);
(event) => webSocketReceiveMessage(event as String),
onError: webSocketOnError,
);
initHeartBeat();
} catch (e) {
BotToast.showText(text: 'webSocket连接失败');

Loading…
Cancel
Save