소스 검색

修改bug

chenzubin 3 달 전
부모
커밋
db0427b1a8
11개의 변경된 파일141개의 추가작업 그리고 15개의 파일을 삭제
  1. 30 9
      lib/chat/chat_home.dart
  2. 1 1
      lib/doctor_detail.dart
  3. 4 2
      lib/home.dart
  4. 2 0
      lib/login.dart
  5. 1 1
      lib/patient_talk_list.dart
  6. 1 1
      lib/registration.dart
  7. 2 0
      lib/select_clinic.dart
  8. 1 1
      lib/utils/Constants.dart
  9. 2 0
      macos/Flutter/GeneratedPluginRegistrant.swift
  10. 96 0
      pubspec.lock
  11. 1 0
      pubspec.yaml

+ 30 - 9
lib/chat/chat_home.dart

@@ -1,6 +1,7 @@
1 1
 import 'dart:convert';
2 2
 import 'dart:io';
3 3
 
4
+import 'package:cached_network_image/cached_network_image.dart';
4 5
 import 'package:dio/dio.dart';
5 6
 import 'package:file_picker/file_picker.dart';
6 7
 import 'package:flutter/cupertino.dart';
@@ -43,7 +44,7 @@ class ChatHomeState extends State<ChatHome> {
43 44
   final TextEditingController _textEditingController = TextEditingController();
44 45
   final FocusNode _focusNode = FocusNode();
45 46
   WebSocketUtility socket = new WebSocketUtility();
46
-  String? userId = Global.user.data?.id;
47
+  String? userId = Global.userId;
47 48
   String? doctorId = Global.doctor.data?[Global.selectDoctor].userId.toString();
48 49
   bool sendEnable = true;
49 50
   late Future<ChatDisease?> _future;
@@ -323,14 +324,24 @@ class ChatHomeState extends State<ChatHome> {
323 324
                                                             "[image]", "")),
324 325
                                           ));
325 326
                                     },
326
-                                    child: Image.network(
327
-                                      _chatRecords[index]['content']
327
+                                    child: CachedNetworkImage(
328
+                                      imageUrl: _chatRecords[index]['content']
328 329
                                           .toString()
329 330
                                           .replaceAll("[image]", ""),
330 331
                                       width: 80,
331 332
                                       fit: BoxFit.fitWidth,
332
-                                      excludeFromSemantics: true,
333
-                                      errorBuilder:
333
+                                      /*loadingBuilder: (context, child, loadingProgress) {
334
+                                        if (loadingProgress == null) return child;
335
+                                        return Center(
336
+                                          child: CircularProgressIndicator(
337
+                                            value: loadingProgress.expectedTotalBytes != null
338
+                                                ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
339
+                                                : null,
340
+                                          ),
341
+                                        );
342
+                                      },*/
343
+                                      placeholder: (context, url) => CircularProgressIndicator(),
344
+                                      errorWidget:
334 345
                                           (context, error, stackTrace) {
335 346
                                         return const CircularProgressIndicator(); // 显示一个进度指示器作为错误占位
336 347
                                       },
@@ -478,14 +489,24 @@ class ChatHomeState extends State<ChatHome> {
478 489
                                                             "[image]", "")),
479 490
                                           ));
480 491
                                     },
481
-                                    child: Image.network(
482
-                                      _chatRecords[index]['content']
492
+                                    child: CachedNetworkImage(
493
+                                      imageUrl: _chatRecords[index]['content']
483 494
                                           .toString()
484 495
                                           .replaceAll("[image]", ""),
485 496
                                       width: 80,
486 497
                                       fit: BoxFit.fitWidth,
487
-                                      excludeFromSemantics: true,
488
-                                      errorBuilder:
498
+                                      /*loadingBuilder: (context, child, loadingProgress) {
499
+                                        if (loadingProgress == null) return child;
500
+                                        return Center(
501
+                                          child: CircularProgressIndicator(
502
+                                            value: loadingProgress.expectedTotalBytes != null
503
+                                                ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
504
+                                                : null,
505
+                                          ),
506
+                                        );
507
+                                      },*/
508
+                                      placeholder: (context, url) => CircularProgressIndicator(),
509
+                                      errorWidget:
489 510
                                           (context, error, stackTrace) {
490 511
                                         return const CircularProgressIndicator(); // 显示一个进度指示器作为错误占位
491 512
                                       },

+ 1 - 1
lib/doctor_detail.dart

@@ -145,7 +145,7 @@ class DoctorDetailState extends State<DoctorDetail> {
145 145
                                     width: 10,
146 146
                                   ),
147 147
                                   Text(
148
-                                    '${mDoctorListEntity.data?[mWhich].postNames}',
148
+                                    '${mDoctorListEntity.data?[mWhich].postNames == null ? "" : mDoctorListEntity.data?[mWhich].postNames}',
149 149
                                     style: const TextStyle(
150 150
                                         fontSize: 15, color: Colors.brown),
151 151
                                   ),

+ 4 - 2
lib/home.dart

@@ -353,10 +353,12 @@ class BannerState extends State<Banner> {
353 353
           if (mHospitalDetail.data?.bannerPic1 != null) {
354 354
             list[0] =
355 355
                 Global.ImageUrl + mHospitalDetail.data!.bannerPic1.toString();
356
-          } else if (mHospitalDetail.data?.bannerPic1 != null) {
356
+          }
357
+          if (mHospitalDetail.data?.bannerPic2 != null) {
357 358
             list[1] =
358 359
                 Global.ImageUrl + mHospitalDetail.data!.bannerPic2.toString();
359
-          } else if (mHospitalDetail.data?.bannerPic1 != null) {
360
+          }
361
+          if (mHospitalDetail.data?.bannerPic3 != null) {
360 362
             list[2] =
361 363
                 Global.ImageUrl + mHospitalDetail.data!.bannerPic3.toString();
362 364
           }

+ 2 - 0
lib/login.dart

@@ -231,6 +231,7 @@ class _MyBodyState extends State<MyBody> {
231 231
                             //     : Colors.transparent,
232 232
                             // shape: StadiumBorder(side: BorderSide.none),
233 233
                             onPressed: () {
234
+                              if(isButtonEnable)
234 235
                               setState(() {
235 236
                                 _buttonClickListen();
236 237
                               });
@@ -438,6 +439,7 @@ class _MyBodyState extends State<MyBody> {
438 439
         }
439 440
         else {
440 441
           Utils.saveData("token", Global.token);
442
+          Utils.saveData("userId", Global.user.data!.id.toString());
441 443
           Navigator.pushReplacement(
442 444
             context,
443 445
             MaterialPageRoute(builder: (context) => BottomNavigationWidget()),

+ 1 - 1
lib/patient_talk_list.dart

@@ -25,7 +25,7 @@ class PatientTalkList extends StatelessWidget {
25 25
   late Future<ChatList?> _future = fetchData();
26 26
 
27 27
   Future<ChatList?> fetchData() async {
28
-    String url = '${Global.BaseUrl}chat/getChatList?userId=${Global.user.data?.id}';
28
+    String url = '${Global.BaseUrl}chat/getChatList?userId=${Global.userId}';
29 29
     final response = await http.get(
30 30
         Uri.parse(url),
31 31
         headers: {

+ 1 - 1
lib/registration.dart

@@ -649,7 +649,7 @@ class RegistrationState extends State<Registration> {
649 649
           HttpHeaders.contentTypeHeader: "application/json; charset=utf-8",
650 650
           'token': '${Global.token}',
651 651
         }).timeout(timeout);
652
-    print(Global.token);
652
+    print('${Global.BaseUrl}doctor/list?deptName=${searchDeptName}&selectDateStr=${selectDateStr}');
653 653
     if (response.statusCode == 200) {
654 654
       final jsonString = utf8.decode(response.bodyBytes);
655 655
       final jsonResponse = jsonDecode(jsonString);

+ 2 - 0
lib/select_clinic.dart

@@ -126,6 +126,8 @@ class SelectClinic extends StatelessWidget {
126 126
                             synchronizeData(context);
127 127
                           } else if (!(await Utils.readData("token")).isEmpty) {
128 128
                             Global.token = await Utils.readData("token");
129
+                            Global.userId = await Utils.readData("userId");
130
+                            print("2222 " + Global.userId);
129 131
                             Navigator.pushReplacementNamed(context, '/home');
130 132
                           } /*else if (!(await Utils.readData("doctorToken"))
131 133
                               .isEmpty) {

+ 1 - 1
lib/utils/Constants.dart

@@ -26,5 +26,5 @@ class Global{
26 26
   static DoctorListEntity doctor = new DoctorListEntity();
27 27
   static int selectDoctor = -1;
28 28
   static LoginEntity user = new LoginEntity();
29
-  static const String SocketUrl = 'ws://192.168.3.21:8002/ws';
29
+  static const String SocketUrl = 'ws://39.105.121.97:8002/ws';
30 30
 }

+ 2 - 0
macos/Flutter/GeneratedPluginRegistrant.swift

@@ -12,6 +12,7 @@ import macos_ui
12 12
 import macos_window_utils
13 13
 import path_provider_foundation
14 14
 import shared_preferences_foundation
15
+import sqflite
15 16
 import video_player_avfoundation
16 17
 
17 18
 func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
@@ -22,5 +23,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
22 23
   MacOSWindowUtilsPlugin.register(with: registry.registrar(forPlugin: "MacOSWindowUtilsPlugin"))
23 24
   PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
24 25
   SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
26
+  SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
25 27
   FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
26 28
 }

+ 96 - 0
pubspec.lock

@@ -41,6 +41,30 @@ packages:
41 41
       url: "https://pub.dev"
42 42
     source: hosted
43 43
     version: "2.1.1"
44
+  cached_network_image:
45
+    dependency: "direct main"
46
+    description:
47
+      name: cached_network_image
48
+      sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f"
49
+      url: "https://pub.dev"
50
+    source: hosted
51
+    version: "3.3.1"
52
+  cached_network_image_platform_interface:
53
+    dependency: transitive
54
+    description:
55
+      name: cached_network_image_platform_interface
56
+      sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f"
57
+      url: "https://pub.dev"
58
+    source: hosted
59
+    version: "4.0.0"
60
+  cached_network_image_web:
61
+    dependency: transitive
62
+    description:
63
+      name: cached_network_image_web
64
+      sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7"
65
+      url: "https://pub.dev"
66
+    source: hosted
67
+    version: "1.2.0"
44 68
   carousel_slider:
45 69
     dependency: "direct main"
46 70
     description:
@@ -201,11 +225,27 @@ packages:
201 225
       url: "https://pub.dev"
202 226
     source: hosted
203 227
     version: "0.9.3+2"
228
+  fixnum:
229
+    dependency: transitive
230
+    description:
231
+      name: fixnum
232
+      sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
233
+      url: "https://pub.dev"
234
+    source: hosted
235
+    version: "1.1.0"
204 236
   flutter:
205 237
     dependency: "direct main"
206 238
     description: flutter
207 239
     source: sdk
208 240
     version: "0.0.0"
241
+  flutter_cache_manager:
242
+    dependency: transitive
243
+    description:
244
+      name: flutter_cache_manager
245
+      sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
246
+      url: "https://pub.dev"
247
+    source: hosted
248
+    version: "3.3.1"
209 249
   flutter_html:
210 250
     dependency: "direct main"
211 251
     description:
@@ -493,6 +533,14 @@ packages:
493 533
       url: "https://pub.dev"
494 534
     source: hosted
495 535
     version: "1.0.5"
536
+  octo_image:
537
+    dependency: transitive
538
+    description:
539
+      name: octo_image
540
+      sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd"
541
+      url: "https://pub.dev"
542
+    source: hosted
543
+    version: "2.1.0"
496 544
   path:
497 545
     dependency: transitive
498 546
     description:
@@ -613,6 +661,14 @@ packages:
613 661
       url: "https://pub.dev"
614 662
     source: hosted
615 663
     version: "2.1.8"
664
+  rxdart:
665
+    dependency: transitive
666
+    description:
667
+      name: rxdart
668
+      sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb"
669
+      url: "https://pub.dev"
670
+    source: hosted
671
+    version: "0.27.7"
616 672
   shared_preferences:
617 673
     dependency: "direct main"
618 674
     description:
@@ -706,6 +762,30 @@ packages:
706 762
       url: "https://pub.dev"
707 763
     source: hosted
708 764
     version: "1.10.0"
765
+  sprintf:
766
+    dependency: transitive
767
+    description:
768
+      name: sprintf
769
+      sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
770
+      url: "https://pub.dev"
771
+    source: hosted
772
+    version: "7.0.0"
773
+  sqflite:
774
+    dependency: transitive
775
+    description:
776
+      name: sqflite
777
+      sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d
778
+      url: "https://pub.dev"
779
+    source: hosted
780
+    version: "2.3.3+1"
781
+  sqflite_common:
782
+    dependency: transitive
783
+    description:
784
+      name: sqflite_common
785
+      sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
786
+      url: "https://pub.dev"
787
+    source: hosted
788
+    version: "2.5.4"
709 789
   stack_trace:
710 790
     dependency: transitive
711 791
     description:
@@ -730,6 +810,14 @@ packages:
730 810
       url: "https://pub.dev"
731 811
     source: hosted
732 812
     version: "1.2.0"
813
+  synchronized:
814
+    dependency: transitive
815
+    description:
816
+      name: synchronized
817
+      sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
818
+      url: "https://pub.dev"
819
+    source: hosted
820
+    version: "3.1.0+1"
733 821
   table_calendar:
734 822
     dependency: "direct main"
735 823
     description:
@@ -762,6 +850,14 @@ packages:
762 850
       url: "https://pub.dev"
763 851
     source: hosted
764 852
     version: "1.3.2"
853
+  uuid:
854
+    dependency: transitive
855
+    description:
856
+      name: uuid
857
+      sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90"
858
+      url: "https://pub.dev"
859
+    source: hosted
860
+    version: "4.4.2"
765 861
   vector_math:
766 862
     dependency: transitive
767 863
     description:

+ 1 - 0
pubspec.yaml

@@ -54,6 +54,7 @@ dependencies:
54 54
   photo_view: ^0.15.0
55 55
   html: ^0.15.0
56 56
   flutter_html: ^3.0.0-beta.2
57
+  cached_network_image: ^3.1.0
57 58
   flutter_localizations:
58 59
     sdk: flutter
59 60
 dev_dependencies: