Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-23 12:20:47 +08:00
parent f220db96ed
commit 07e34eb17b
6 changed files with 91 additions and 96 deletions

View File

@@ -23,7 +23,7 @@ class LoginPageController extends GetxController
final TextEditingController smsCodeTextController = TextEditingController();
final TextEditingController cookieTextController = TextEditingController();
Rx<Map<String, dynamic>> codeInfo = Rx<Map<String, dynamic>>({});
RxMap<String, dynamic> codeInfo = RxMap<String, dynamic>({});
late TabController tabController;
@@ -31,7 +31,7 @@ class LoginPageController extends GetxController
CaptchaDataModel captchaData = CaptchaDataModel();
RxInt qrCodeLeftTime = 180.obs;
Rx<String> statusQRCode = ''.obs;
RxString statusQRCode = ''.obs;
Map<String, dynamic> selectedCountryCodeId =
Constants.internationalDialingPrefix.first;
@@ -68,8 +68,7 @@ class LoginPageController extends GetxController
LoginHttp.getHDcode().then((res) {
if (res['status']) {
qrCodeTimer?.cancel();
codeInfo.value = res;
codeInfo.refresh();
codeInfo.addAll(res);
qrCodeTimer = Timer.periodic(const Duration(milliseconds: 1000), (t) {
qrCodeLeftTime.value = 180 - t.tick;
if (qrCodeLeftTime <= 0) {
@@ -79,8 +78,7 @@ class LoginPageController extends GetxController
return;
}
LoginHttp.codePoll(codeInfo.value['data']['auth_code'])
.then((value) async {
LoginHttp.codePoll(codeInfo['data']['auth_code']).then((value) async {
if (value['status']) {
t.cancel();
statusQRCode.value = '扫码成功';

View File

@@ -80,7 +80,7 @@ class _LoginPageState extends State<LoginPage> {
RepaintBoundary(
key: globalKey,
child: Obx(() {
if (_loginPageCtr.codeInfo.value['data']?['url'] == null) {
if (_loginPageCtr.codeInfo['data']?['url'] == null) {
return Container(
height: 200,
width: 200,
@@ -96,7 +96,7 @@ class _LoginPageState extends State<LoginPage> {
color: Colors.white,
padding: const EdgeInsets.all(8),
child: PrettyQrView.data(
data: _loginPageCtr.codeInfo.value['data']!['url']!,
data: _loginPageCtr.codeInfo['data']!['url']!,
decoration: PrettyQrDecoration(
shape: PrettyQrRoundedSymbol(
color: Colors.black87,
@@ -116,14 +116,13 @@ class _LoginPageState extends State<LoginPage> {
Obx(() => GestureDetector(
onTap: () {
// 复制到剪贴板
Utils.copyText(
_loginPageCtr.codeInfo.value['data']?['url'] ?? '',
Utils.copyText(_loginPageCtr.codeInfo['data']?['url'] ?? '',
toastText: '已复制到剪贴板可粘贴至已登录的app私信处发送然后点击已发送的链接打开');
},
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Text(_loginPageCtr.codeInfo.value['data']?['url'] ?? "",
child: Text(_loginPageCtr.codeInfo['data']?['url'] ?? "",
style: Theme.of(context).textTheme.labelSmall!.copyWith(
color: Theme.of(context)
.colorScheme