commit 593b22626d04782ce78a6e2a5efbcdcca58f788c Author: History <2596007731@qq.com> Date: Mon Jun 30 09:33:34 2025 +0800 新疆框架 diff --git a/XinjiangProject/PodFile b/XinjiangProject/PodFile new file mode 100644 index 0000000..813e750 --- /dev/null +++ b/XinjiangProject/PodFile @@ -0,0 +1,50 @@ + +platform :ios, '12.0' +# 忽略引入库的所有警告 +inhibit_all_warnings! + +# 防止 TUIKit 组件里的 *.xcassets 与您项目里面冲突。 +install! 'cocoapods', :disable_input_output_paths => true +# 通过指定use_frameworks!要求生成的是framework而不是静态库。 +target 'XinjiangProject' do + pod 'MJRefresh' + pod 'MBProgressHUD' + pod 'Masonry' + pod 'YYKit' + pod 'IQKeyboardManager' #iOS8 and later + pod 'SDCycleScrollView' + pod 'TZImagePickerController' + # 列表控制 + # 集成聊天功能 + pod 'TUIChat/UI_Classic','~> 7.3.4358' + # 集成会话功能 + pod 'TUIConversation/UI_Classic','~> 7.3.4358' + # 集成关系链功能 + pod 'TUIContact/UI_Classic','~> 7.3.4358' + # 集成群组功能 + pod 'TUIGroup/UI_Classic','~> 7.3.4358' + # 集成搜索功能(需要购买旗舰版套餐) + pod 'TUISearch/UI_Classic','~> 7.3.4358' + # 集成离线推送 + pod 'TUIOfflinePush','~> 7.3.4358' + # 集成音视频通话功能 + pod 'TUICallKit','~> 1.7.0.460' + pod 'TUICallKit/TRTC','~> 1.7.0.460' + pod 'TXIMSDK_Plus_iOS','~> 7.3.4358' + pod 'TXLiteAVSDK_TRTC/TRTC','~> 11.2.14217' + pod 'TUICore','~> 7.3.4358' + + # 高德地图相关 + pod 'SJVideoPlayer' + pod 'SJUIKit' + pod 'AFNetworking' + pod 'AMap3DMap','~>10.0.600' + pod 'AMapSearch','~>9.5.0' + pod 'AMapLocation','~>2.9.0' + pod 'SDWebImageWebPCoder' + pod 'SDWebImage' + pod 'FMDB' + pod 'FMDB/SQLCipher' +end + + diff --git a/XinjiangProject/Podfile.lock b/XinjiangProject/Podfile.lock new file mode 100644 index 0000000..d33993d --- /dev/null +++ b/XinjiangProject/Podfile.lock @@ -0,0 +1,516 @@ +PODS: + - AFNetworking (4.0.1): + - AFNetworking/NSURLSession (= 4.0.1) + - AFNetworking/Reachability (= 4.0.1) + - AFNetworking/Security (= 4.0.1) + - AFNetworking/Serialization (= 4.0.1) + - AFNetworking/UIKit (= 4.0.1) + - AFNetworking/NSURLSession (4.0.1): + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/Reachability (4.0.1) + - AFNetworking/Security (4.0.1) + - AFNetworking/Serialization (4.0.1) + - AFNetworking/UIKit (4.0.1): + - AFNetworking/NSURLSession + - AMap3DMap (10.0.1000): + - AMapFoundation (>= 1.8.0) + - AMapFoundation (1.8.2) + - AMapLocation (2.9.0): + - AMapFoundation (>= 1.7.0) + - AMapSearch (9.5.0): + - AMapFoundation (>= 1.8.0) + - FMDB (2.7.12): + - FMDB/standard (= 2.7.12) + - FMDB/Core (2.7.12) + - FMDB/SQLCipher (2.7.12): + - FMDB/Core + - SQLCipher (~> 4.6) + - FMDB/standard (2.7.12): + - FMDB/Core + - IQKeyboardManager (6.5.19) + - libwebp (1.5.0): + - libwebp/demux (= 1.5.0) + - libwebp/mux (= 1.5.0) + - libwebp/sharpyuv (= 1.5.0) + - libwebp/webp (= 1.5.0) + - libwebp/demux (1.5.0): + - libwebp/webp + - libwebp/mux (1.5.0): + - libwebp/demux + - libwebp/sharpyuv (1.5.0) + - libwebp/webp (1.5.0): + - libwebp/sharpyuv + - Masonry (1.1.0) + - MBProgressHUD (1.2.0) + - MJRefresh (3.7.9) + - ReactiveObjC (3.1.1) + - SDCycleScrollView (1.82): + - SDWebImage (>= 5.0.0) + - SDWebImage (5.21.0): + - SDWebImage/Core (= 5.21.0) + - SDWebImage/Core (5.21.0) + - SDWebImageWebPCoder (0.14.6): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.17) + - SJBaseVideoPlayer (3.7.7.1): + - Masonry + - SJBaseVideoPlayer/AVPlayer (= 3.7.7.1) + - SJBaseVideoPlayer/Common (= 3.7.7.1) + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJBaseVideoPlayer/AVPlayer (3.7.7.1): + - Masonry + - SJBaseVideoPlayer/Common + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJBaseVideoPlayer/Common (3.7.7.1): + - Masonry + - SJBaseVideoPlayer/ResourceLoader + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJBaseVideoPlayer/ResourceLoader (3.7.7.1): + - Masonry + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJUIKit (0.0.0.59): + - SJUIKit/AsyncLoad (= 0.0.0.59) + - SJUIKit/AttributesFactory (= 0.0.0.59) + - SJUIKit/Base (= 0.0.0.59) + - SJUIKit/CornerMask (= 0.0.0.59) + - SJUIKit/Date (= 0.0.0.59) + - SJUIKit/ObserverHelper (= 0.0.0.59) + - SJUIKit/Other (= 0.0.0.59) + - SJUIKit/PageViewController (= 0.0.0.59) + - SJUIKit/Photo (= 0.0.0.59) + - SJUIKit/PlaybackListController (= 0.0.0.59) + - SJUIKit/Queues (= 0.0.0.59) + - SJUIKit/Refresh (= 0.0.0.59) + - SJUIKit/SQLite3 (= 0.0.0.59) + - SJUIKit/Thread (= 0.0.0.59) + - SJUIKit/UIMaker (= 0.0.0.59) + - SJUIKit/AsyncLoad (0.0.0.59): + - SJUIKit/CornerMask + - SJUIKit/AttributesFactory (0.0.0.59): + - SJUIKit/AttributesFactory/Deprecated (= 0.0.0.59) + - SJUIKit/AttributesFactory/UIKitText (= 0.0.0.59) + - SJUIKit/AttributesFactory/Deprecated (0.0.0.59) + - SJUIKit/AttributesFactory/UIKitText (0.0.0.59) + - SJUIKit/Base (0.0.0.59): + - SJUIKit/Base/Core (= 0.0.0.59) + - SJUIKit/ObserverHelper + - SJUIKit/Base/Core (0.0.0.59): + - SJUIKit/ObserverHelper + - SJUIKit/CornerMask (0.0.0.59): + - SJUIKit/ObserverHelper + - SJUIKit/Date (0.0.0.59) + - SJUIKit/ObserverHelper (0.0.0.59) + - SJUIKit/Other (0.0.0.59): + - SJUIKit/Date + - SJUIKit/PageViewController (0.0.0.59): + - SJUIKit/PageViewController/Core (= 0.0.0.59) + - SJUIKit/PageViewController/Core (0.0.0.59) + - SJUIKit/Photo (0.0.0.59) + - SJUIKit/PlaybackListController (0.0.0.59) + - SJUIKit/Queues (0.0.0.59) + - SJUIKit/Refresh (0.0.0.59): + - MJRefresh + - SJUIKit/SQLite3 (0.0.0.59): + - SJUIKit/SQLite3/Core (= 0.0.0.59) + - SJUIKit/SQLite3/Protocol (= 0.0.0.59) + - YYModel + - SJUIKit/SQLite3/Core (0.0.0.59): + - SJUIKit/SQLite3/Protocol + - YYModel + - SJUIKit/SQLite3/Protocol (0.0.0.59): + - YYModel + - SJUIKit/Thread (0.0.0.59) + - SJUIKit/UIMaker (0.0.0.59): + - SJUIKit/UIMaker/Core (= 0.0.0.59) + - SJUIKit/UIMaker/Core (0.0.0.59) + - SJVideoPlayer (3.4.3): + - SJBaseVideoPlayer (>= 3.7.5) + - SJVideoPlayer/Common (= 3.4.3) + - SJVideoPlayer/ControlLayers (= 3.4.3) + - SJVideoPlayer/ResourceLoader (= 3.4.3) + - SJVideoPlayer/Common (3.4.3): + - Masonry + - SJBaseVideoPlayer (>= 3.7.5) + - SJUIKit/AttributesFactory + - SJVideoPlayer/ResourceLoader + - SJVideoPlayer/ControlLayers (3.4.3): + - SJBaseVideoPlayer (>= 3.7.5) + - SJVideoPlayer/Common + - SJVideoPlayer/ResourceLoader (3.4.3): + - SJBaseVideoPlayer (>= 3.7.5) + - SQLCipher (4.8.0): + - SQLCipher/standard (= 4.8.0) + - SQLCipher/common (4.8.0) + - SQLCipher/standard (4.8.0): + - SQLCipher/common + - TIMCommon (7.3.4358): + - TIMCommon/BaseCell (= 7.3.4358) + - TIMCommon/CommonModel (= 7.3.4358) + - TIMCommon/UI_Classic (= 7.3.4358) + - TIMCommon/UI_Minimalist (= 7.3.4358) + - TIMCommon/BaseCell (7.3.4358): + - TIMCommon/BaseCell/CellData (= 7.3.4358) + - TIMCommon/BaseCell/CellUI (= 7.3.4358) + - TIMCommon/BaseCell/CellData (7.3.4358): + - TIMCommon/CommonModel + - TIMCommon/BaseCell/CellUI (7.3.4358): + - TIMCommon/BaseCell/CellData + - TIMCommon/CommonModel (7.3.4358): + - ReactiveObjC + - SDWebImage + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TIMCommon/UI_Classic (7.3.4358): + - TIMCommon/UI_Classic/Cell (= 7.3.4358) + - TIMCommon/UI_Classic/Cell (7.3.4358): + - TIMCommon/UI_Classic/Cell/CellData (= 7.3.4358) + - TIMCommon/UI_Classic/Cell/CellUI (= 7.3.4358) + - TIMCommon/UI_Classic/Cell/CellData (7.3.4358): + - TIMCommon/BaseCell + - TIMCommon/UI_Classic/Cell/CellUI (7.3.4358): + - TIMCommon/UI_Classic/Cell/CellData + - TIMCommon/UI_Minimalist (7.3.4358): + - TIMCommon/UI_Minimalist/Cell (= 7.3.4358) + - TIMCommon/UI_Minimalist/Cell (7.3.4358): + - TIMCommon/UI_Minimalist/Cell/CellData (= 7.3.4358) + - TIMCommon/UI_Minimalist/Cell/CellUI (= 7.3.4358) + - TIMCommon/UI_Minimalist/Cell/CellData (7.3.4358): + - TIMCommon/BaseCell + - TIMCommon/UI_Minimalist/Cell/CellUI (7.3.4358): + - TIMCommon/UI_Minimalist/Cell/CellData + - TUICallEngine/TRTC (1.7.0.465): + - TXIMSDK_Plus_iOS (~> 7.3.4358) + - TXLiteAVSDK_TRTC (>= 11.0.14028) + - TUICallKit (1.7.0.460): + - Masonry + - TUICallKit/TRTC (= 1.7.0.460) + - TUICore (~> 7.3.4358) + - TUICallKit/TRTC (1.7.0.460): + - Masonry + - TUICallEngine/TRTC (~> 1.7.0.460) + - TUICore (~> 7.3.4358) + - TXLiteAVSDK_TRTC + - TUIChat/BaseCell (7.3.4358): + - TUIChat/BaseCell/CellData (= 7.3.4358) + - TUIChat/BaseCell/CellUI (= 7.3.4358) + - TUIChat/BaseCell/CellData (7.3.4358): + - TUIChat/CommonModel + - TUIChat/BaseCell/CellUI (7.3.4358): + - TUIChat/BaseCell/CellData + - TUIChat/BaseDataProvider (7.3.4358): + - TUIChat/BaseCell + - TUIChat/CommonModel (7.3.4358): + - ReactiveObjC + - SDWebImage + - TIMCommon (= 7.3.4358) + - TUIChat/VoiceConvert + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUIChat/CommonUI (7.3.4358): + - TUIChat/CommonUI/Camera (= 7.3.4358) + - TUIChat/CommonUI/Pendency (= 7.3.4358) + - TUIChat/CommonUI/Pop (= 7.3.4358) + - TUIChat/CommonUI/Camera (7.3.4358): + - TUIChat/BaseDataProvider + - TUIChat/CommonUI/Pendency (7.3.4358): + - TUIChat/BaseDataProvider + - TUIChat/CommonUI/Pop (7.3.4358): + - TUIChat/BaseDataProvider + - TUIChat/UI_Classic (7.3.4358): + - TUIChat/UI_Classic/Cell (= 7.3.4358) + - TUIChat/UI_Classic/Chat (= 7.3.4358) + - TUIChat/UI_Classic/DataProvider (= 7.3.4358) + - TUIChat/UI_Classic/Header (= 7.3.4358) + - TUIChat/UI_Classic/Input (= 7.3.4358) + - TUIChat/UI_Classic/Service (= 7.3.4358) + - TUIChat/UI_Classic/Cell (7.3.4358): + - TUIChat/UI_Classic/Cell/CellData (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellUI (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellData (7.3.4358): + - TUIChat/UI_Classic/Cell/CellData/Base (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellData/Chat (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellData/Custom (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellData/Reply (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellData/Base (7.3.4358): + - TUIChat/CommonUI + - TUIChat/UI_Classic/Cell/CellData/Chat (7.3.4358): + - TUIChat/UI_Classic/Cell/CellData/Base + - TUIChat/UI_Classic/Cell/CellData/Custom (7.3.4358): + - TUIChat/UI_Classic/Cell/CellData/Chat + - TUIChat/UI_Classic/Cell/CellData/Reply (7.3.4358): + - TUIChat/UI_Classic/Cell/CellData/Custom + - TUIChat/UI_Classic/Cell/CellUI (7.3.4358): + - TUIChat/UI_Classic/Cell/CellUI/Base (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellUI/Chat (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellUI/Custom (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellUI/Reply (= 7.3.4358) + - TUIChat/UI_Classic/Cell/CellUI/Base (7.3.4358): + - TUIChat/UI_Classic/Cell/CellData + - TUIChat/UI_Classic/Cell/CellUI/Chat (7.3.4358): + - TUIChat/UI_Classic/Cell/CellUI/Base + - TUIChat/UI_Classic/Cell/CellUI/Custom (7.3.4358): + - TUIChat/UI_Classic/Cell/CellUI/Chat + - TUIChat/UI_Classic/Cell/CellUI/Reply (7.3.4358): + - TUIChat/UI_Classic/Cell/CellUI/Custom + - TUIChat/UI_Classic/Chat (7.3.4358): + - TUIChat/UI_Classic/Input + - TUIChat/UI_Classic/DataProvider (7.3.4358): + - TUIChat/UI_Classic/Cell + - TUIChat/UI_Classic/Header (7.3.4358): + - TUIChat/UI_Classic/Service + - TUIChat/UI_Classic/Input (7.3.4358): + - TUIChat/UI_Classic/DataProvider + - TUIChat/UI_Classic/Service (7.3.4358): + - TUIChat/UI_Classic/Chat + - TUIChat/VoiceConvert (7.3.4358) + - TUIContact/BaseCell (7.3.4358): + - TUIContact/BaseCell/CellData (= 7.3.4358) + - TUIContact/BaseCell/CellUI (= 7.3.4358) + - TUIContact/BaseCell/CellData (7.3.4358): + - ReactiveObjC + - TIMCommon (= 7.3.4358) + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUIContact/BaseCell/CellUI (7.3.4358): + - TUIContact/BaseCell/CellData + - TUIContact/BaseDataProvider (7.3.4358): + - TUIContact/BaseCell + - TUIContact/CommonUI (7.3.4358): + - TUIContact/BaseDataProvider + - TUIContact/UI_Classic (7.3.4358): + - TUIContact/UI_Classic/Header (= 7.3.4358) + - TUIContact/UI_Classic/Service (= 7.3.4358) + - TUIContact/UI_Classic/UI (= 7.3.4358) + - TUIContact/UI_Classic/Header (7.3.4358): + - TUIContact/UI_Classic/Service + - TUIContact/UI_Classic/Service (7.3.4358): + - TUIContact/UI_Classic/UI + - TUIContact/UI_Classic/UI (7.3.4358): + - TUIContact/CommonUI + - TUIConversation/BaseCell (7.3.4358): + - TUIConversation/BaseCell/CellData (= 7.3.4358) + - TUIConversation/BaseCell/CellUI (= 7.3.4358) + - TUIConversation/BaseCell/CellData (7.3.4358): + - TUIConversation/CommonModel + - TUIConversation/BaseCell/CellUI (7.3.4358): + - TUIConversation/BaseCell/CellData + - TUIConversation/BaseDataProvider (7.3.4358): + - TUIConversation/BaseCell + - TUIConversation/CommonModel (7.3.4358): + - ReactiveObjC + - TIMCommon (= 7.3.4358) + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUIConversation/UI_Classic (7.3.4358): + - TUIConversation/UI_Classic/DataProvider (= 7.3.4358) + - TUIConversation/UI_Classic/Header (= 7.3.4358) + - TUIConversation/UI_Classic/Service (= 7.3.4358) + - TUIConversation/UI_Classic/UI (= 7.3.4358) + - TUIConversation/UI_Classic/DataProvider (7.3.4358): + - TUIConversation/BaseDataProvider + - TUIConversation/UI_Classic/Header (7.3.4358): + - TUIConversation/UI_Classic/Service + - TUIConversation/UI_Classic/Service (7.3.4358): + - TUIConversation/UI_Classic/UI + - TUIConversation/UI_Classic/UI (7.3.4358): + - TUIConversation/UI_Classic/DataProvider + - TUICore (7.3.4358): + - ReactiveObjC + - SDWebImage + - TUICore/ImSDK_Plus (= 7.3.4358) + - TUICore/Base (7.3.4358): + - ReactiveObjC + - SDWebImage + - TUICore/ImSDK_Plus (7.3.4358): + - ReactiveObjC + - SDWebImage + - TUICore/Base + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUIGroup/BaseCell (7.3.4358): + - TUIGroup/BaseCell/CellData (= 7.3.4358) + - TUIGroup/BaseCell/CellUI (= 7.3.4358) + - TUIGroup/BaseCell/CellData (7.3.4358): + - TUIGroup/CommonModel + - TUIGroup/BaseCell/CellUI (7.3.4358): + - TUIGroup/BaseCell/CellData + - TUIGroup/BaseDataProvider (7.3.4358): + - TUIGroup/BaseCell + - TUIGroup/CommonModel (7.3.4358): + - ReactiveObjC + - TIMCommon (= 7.3.4358) + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUIGroup/CommonUI (7.3.4358): + - TUIGroup/BaseDataProvider + - TUIGroup/UI_Classic (7.3.4358): + - TUIGroup/UI_Classic/Header (= 7.3.4358) + - TUIGroup/UI_Classic/Service (= 7.3.4358) + - TUIGroup/UI_Classic/UI (= 7.3.4358) + - TUIGroup/UI_Classic/Header (7.3.4358): + - TUIGroup/UI_Classic/Service + - TUIGroup/UI_Classic/Service (7.3.4358): + - TUIGroup/UI_Classic/UI + - TUIGroup/UI_Classic/UI (7.3.4358): + - TUIGroup/CommonUI + - TUIOfflinePush (7.3.4358): + - TUIOfflinePush/APNS (= 7.3.4358) + - TUIOfflinePush/APNS (7.3.4358): + - TUIOfflinePush/Base + - TUIOfflinePush/Base (7.3.4358): + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUISearch/BaseCell (7.3.4358): + - TUISearch/BaseCell/CellData (= 7.3.4358) + - TUISearch/BaseCell/CellUI (= 7.3.4358) + - TUISearch/BaseCell/CellData (7.3.4358): + - TIMCommon (= 7.3.4358) + - TUICore (= 7.3.4358) + - TXIMSDK_Plus_iOS (= 7.3.4358) + - TUISearch/BaseCell/CellUI (7.3.4358): + - TUISearch/BaseCell/CellData + - TUISearch/BaseDataProvider (7.3.4358): + - TUISearch/BaseCell + - TUISearch/UI_Classic (7.3.4358): + - TUISearch/UI_Classic/Header (= 7.3.4358) + - TUISearch/UI_Classic/Service (= 7.3.4358) + - TUISearch/UI_Classic/UI (= 7.3.4358) + - TUISearch/UI_Classic/Header (7.3.4358): + - TUISearch/UI_Classic/Service + - TUISearch/UI_Classic/Service (7.3.4358): + - TUISearch/UI_Classic/UI + - TUISearch/UI_Classic/UI (7.3.4358): + - TUISearch/BaseDataProvider + - TXIMSDK_Plus_iOS (7.3.4358) + - TXLiteAVSDK_TRTC (11.2.14217): + - TXLiteAVSDK_TRTC/TRTC (= 11.2.14217) + - TXLiteAVSDK_TRTC/TRTC (11.2.14217) + - TZImagePickerController (3.8.8): + - TZImagePickerController/Basic (= 3.8.8) + - TZImagePickerController/Location (= 3.8.8) + - TZImagePickerController/Basic (3.8.8) + - TZImagePickerController/Location (3.8.8) + - YYKit (1.0.9): + - YYKit/no-arc (= 1.0.9) + - YYKit/no-arc (1.0.9) + - YYModel (1.0.4) + +DEPENDENCIES: + - AFNetworking + - AMap3DMap (~> 10.0.600) + - AMapLocation (~> 2.9.0) + - AMapSearch (~> 9.5.0) + - FMDB + - FMDB/SQLCipher + - IQKeyboardManager + - Masonry + - MBProgressHUD + - MJRefresh + - SDCycleScrollView + - SDWebImage + - SDWebImageWebPCoder + - SJUIKit + - SJVideoPlayer + - TUICallKit (~> 1.7.0.460) + - TUICallKit/TRTC (~> 1.7.0.460) + - TUIChat/UI_Classic (~> 7.3.4358) + - TUIContact/UI_Classic (~> 7.3.4358) + - TUIConversation/UI_Classic (~> 7.3.4358) + - TUICore (~> 7.3.4358) + - TUIGroup/UI_Classic (~> 7.3.4358) + - TUIOfflinePush (~> 7.3.4358) + - TUISearch/UI_Classic (~> 7.3.4358) + - TXIMSDK_Plus_iOS (~> 7.3.4358) + - TXLiteAVSDK_TRTC/TRTC (~> 11.2.14217) + - TZImagePickerController + - YYKit + +SPEC REPOS: + trunk: + - AFNetworking + - AMap3DMap + - AMapFoundation + - AMapLocation + - AMapSearch + - FMDB + - IQKeyboardManager + - libwebp + - Masonry + - MBProgressHUD + - MJRefresh + - ReactiveObjC + - SDCycleScrollView + - SDWebImage + - SDWebImageWebPCoder + - SJBaseVideoPlayer + - SJUIKit + - SJVideoPlayer + - SQLCipher + - TIMCommon + - TUICallEngine + - TUICallKit + - TUIChat + - TUIContact + - TUIConversation + - TUICore + - TUIGroup + - TUIOfflinePush + - TUISearch + - TXIMSDK_Plus_iOS + - TXLiteAVSDK_TRTC + - TZImagePickerController + - YYKit + - YYModel + +SPEC CHECKSUMS: + AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58 + AMap3DMap: 2896b8d63034aaf79720a402573362ca2fef0dec + AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec + AMapLocation: f5eb11e11c62f0f599f80b578eec8a1f70deb985 + AMapSearch: e0c81206b8ac1d27ef349095a96ea6398e3a0da3 + FMDB: 728731dd336af3936ce00f91d9d8495f5718a0e6 + IQKeyboardManager: c8665b3396bd0b79402b4c573eac345a31c7d485 + libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8 + Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 + MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 + MJRefresh: ff9e531227924c84ce459338414550a05d2aea78 + ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040 + SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf + SDWebImage: f84b0feeb08d2d11e6a9b843cb06d75ebf5b8868 + SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 + SJBaseVideoPlayer: b3122de12225b27b71bd9a8a1f08f4dcf2f4e5ec + SJUIKit: a40111941e408cc17d4c1c23495aa92999e814b0 + SJVideoPlayer: 4f09814f58522e0975cb2dccfda925f6c8643467 + SQLCipher: 908f846ca79d74be4e1776b3b86c6ad9e6c0b04f + TIMCommon: 2adea2895422a640e100125f6fccc0dc2aeff44b + TUICallEngine: 01b8f82535f0c01284740a9b7c3a5cf823aa7feb + TUICallKit: fc30ed879d2a92e24ffaa194e8df1087dfbedd33 + TUIChat: 557dd6872606d9da7f36913af92ee95c8e651795 + TUIContact: 0079dd736935a77e6c14c864e516232cb70466bd + TUIConversation: 643823f80f0958b7263ac24411e397fcd5f37e78 + TUICore: b0e525287eb03f95fe648a696c9ffb253fc87098 + TUIGroup: 6a4133f356bd240997ac11bb94f89648899096f7 + TUIOfflinePush: e5787da66713361da4ed64b90ca196c094f483de + TUISearch: 18a208d0ef13eb7bf7f44eae01ffefb26803aaf3 + TXIMSDK_Plus_iOS: bc72c7cec1b5e975c3cc6629692c849513a932f5 + TXLiteAVSDK_TRTC: cdab9adefc42a5e0a4fea4035e624af441ba3e83 + TZImagePickerController: d084a7b97c82d387e7669dd86dc9a9057500aacf + YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7 + YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30 + +PODFILE CHECKSUM: c63ef0a5edf68dd395621c435af5c0063b38442a + +COCOAPODS: 1.16.2 diff --git a/XinjiangProject/XinjiangProject.xcodeproj/project.pbxproj b/XinjiangProject/XinjiangProject.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4983310 --- /dev/null +++ b/XinjiangProject/XinjiangProject.xcodeproj/project.pbxproj @@ -0,0 +1,687 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 2A9D6F4901C83B23A09A207B /* libPods-XinjiangProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5380821CF956D8001EF91CA7 /* libPods-XinjiangProject.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1809E47E2E092C740034C8FC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1809E45A2E092C710034C8FC /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1809E4612E092C710034C8FC; + remoteInfo = XinjiangProject; + }; + 1809E4882E092C740034C8FC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1809E45A2E092C710034C8FC /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1809E4612E092C710034C8FC; + remoteInfo = XinjiangProject; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1809E4622E092C710034C8FC /* XinjiangProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XinjiangProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1809E47D2E092C740034C8FC /* XinjiangProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XinjiangProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1809E4872E092C740034C8FC /* XinjiangProjectUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XinjiangProjectUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5380821CF956D8001EF91CA7 /* libPods-XinjiangProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XinjiangProject.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + D5F062871D7E5499A760A0A9 /* Pods-XinjiangProject.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XinjiangProject.release.xcconfig"; path = "Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject.release.xcconfig"; sourceTree = ""; }; + F4F935FBD1765B37B37D212D /* Pods-XinjiangProject.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XinjiangProject.debug.xcconfig"; path = "Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 1809E48F2E092C740034C8FC /* Exceptions for "XinjiangProject" folder in "XinjiangProject" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + "Supporting Files/Info.plist", + ); + target = 1809E4612E092C710034C8FC /* XinjiangProject */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 1809E4642E092C710034C8FC /* XinjiangProject */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 1809E48F2E092C740034C8FC /* Exceptions for "XinjiangProject" folder in "XinjiangProject" target */, + ); + path = XinjiangProject; + sourceTree = ""; + }; + 1809E4802E092C740034C8FC /* XinjiangProjectTests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = XinjiangProjectTests; + sourceTree = ""; + }; + 1809E48A2E092C740034C8FC /* XinjiangProjectUITests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = XinjiangProjectUITests; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1809E45F2E092C710034C8FC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A9D6F4901C83B23A09A207B /* libPods-XinjiangProject.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1809E47A2E092C740034C8FC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1809E4842E092C740034C8FC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1809E4592E092C710034C8FC = { + isa = PBXGroup; + children = ( + 1809E4642E092C710034C8FC /* XinjiangProject */, + 1809E4802E092C740034C8FC /* XinjiangProjectTests */, + 1809E48A2E092C740034C8FC /* XinjiangProjectUITests */, + 1809E4632E092C710034C8FC /* Products */, + AF58E7BBA422572602E63ED7 /* Pods */, + 5E0194FB12246C95B3FA5215 /* Frameworks */, + ); + sourceTree = ""; + }; + 1809E4632E092C710034C8FC /* Products */ = { + isa = PBXGroup; + children = ( + 1809E4622E092C710034C8FC /* XinjiangProject.app */, + 1809E47D2E092C740034C8FC /* XinjiangProjectTests.xctest */, + 1809E4872E092C740034C8FC /* XinjiangProjectUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 5E0194FB12246C95B3FA5215 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5380821CF956D8001EF91CA7 /* libPods-XinjiangProject.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + AF58E7BBA422572602E63ED7 /* Pods */ = { + isa = PBXGroup; + children = ( + F4F935FBD1765B37B37D212D /* Pods-XinjiangProject.debug.xcconfig */, + D5F062871D7E5499A760A0A9 /* Pods-XinjiangProject.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1809E4612E092C710034C8FC /* XinjiangProject */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1809E4902E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProject" */; + buildPhases = ( + E4291FE3C5BA9A5AD560484A /* [CP] Check Pods Manifest.lock */, + 1809E45E2E092C710034C8FC /* Sources */, + 1809E45F2E092C710034C8FC /* Frameworks */, + 1809E4602E092C710034C8FC /* Resources */, + FCFFDBE5429B0BC3E8B22A74 /* [CP] Embed Pods Frameworks */, + 492BA72AF1480CCB968A855C /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 1809E4642E092C710034C8FC /* XinjiangProject */, + ); + name = XinjiangProject; + productName = XinjiangProject; + productReference = 1809E4622E092C710034C8FC /* XinjiangProject.app */; + productType = "com.apple.product-type.application"; + }; + 1809E47C2E092C740034C8FC /* XinjiangProjectTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1809E4952E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectTests" */; + buildPhases = ( + 1809E4792E092C740034C8FC /* Sources */, + 1809E47A2E092C740034C8FC /* Frameworks */, + 1809E47B2E092C740034C8FC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1809E47F2E092C740034C8FC /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 1809E4802E092C740034C8FC /* XinjiangProjectTests */, + ); + name = XinjiangProjectTests; + productName = XinjiangProjectTests; + productReference = 1809E47D2E092C740034C8FC /* XinjiangProjectTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 1809E4862E092C740034C8FC /* XinjiangProjectUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1809E4982E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectUITests" */; + buildPhases = ( + 1809E4832E092C740034C8FC /* Sources */, + 1809E4842E092C740034C8FC /* Frameworks */, + 1809E4852E092C740034C8FC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1809E4892E092C740034C8FC /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 1809E48A2E092C740034C8FC /* XinjiangProjectUITests */, + ); + name = XinjiangProjectUITests; + productName = XinjiangProjectUITests; + productReference = 1809E4872E092C740034C8FC /* XinjiangProjectUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1809E45A2E092C710034C8FC /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1630; + TargetAttributes = { + 1809E4612E092C710034C8FC = { + CreatedOnToolsVersion = 16.3; + }; + 1809E47C2E092C740034C8FC = { + CreatedOnToolsVersion = 16.3; + TestTargetID = 1809E4612E092C710034C8FC; + }; + 1809E4862E092C740034C8FC = { + CreatedOnToolsVersion = 16.3; + TestTargetID = 1809E4612E092C710034C8FC; + }; + }; + }; + buildConfigurationList = 1809E45D2E092C710034C8FC /* Build configuration list for PBXProject "XinjiangProject" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 1809E4592E092C710034C8FC; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 1809E4632E092C710034C8FC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1809E4612E092C710034C8FC /* XinjiangProject */, + 1809E47C2E092C740034C8FC /* XinjiangProjectTests */, + 1809E4862E092C740034C8FC /* XinjiangProjectUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1809E4602E092C710034C8FC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1809E47B2E092C740034C8FC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1809E4852E092C740034C8FC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 492BA72AF1480CCB968A855C /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + E4291FE3C5BA9A5AD560484A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-XinjiangProject-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + FCFFDBE5429B0BC3E8B22A74 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1809E45E2E092C710034C8FC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1809E4792E092C740034C8FC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1809E4832E092C740034C8FC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1809E47F2E092C740034C8FC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1809E4612E092C710034C8FC /* XinjiangProject */; + targetProxy = 1809E47E2E092C740034C8FC /* PBXContainerItemProxy */; + }; + 1809E4892E092C740034C8FC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1809E4612E092C710034C8FC /* XinjiangProject */; + targetProxy = 1809E4882E092C740034C8FC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1809E4912E092C740034C8FC /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F4F935FBD1765B37B37D212D /* Pods-XinjiangProject.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7CC5LW224; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_PREFIX_HEADER = "$(SRCROOT)/XinjiangProject/Supporting Files/PrefixHeader.pch"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/XinjiangProject/Supporting Files/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "新疆亚克西"; + INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; + INFOPLIST_KEY_NSCameraUsageDescription = "健康咨询员工端需要访问您的相机用来档案功能,是否同意?"; + INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。"; + INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "APP需要您的定位服务,否则可能无法使用。"; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。"; + INFOPLIST_KEY_NSMicrophoneUsageDescription = "健康咨询员工端需要访问您的麦克风用来视频录制,是否同意?"; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "新疆员工端需要访问您的相册上传图片,方便您的使用,是否同意?"; + INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "健康咨询想使用您的相册功能 是否同意?"; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UIUserInterfaceStyle = Light; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject; + PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 1809E4922E092C740034C8FC /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D5F062871D7E5499A760A0A9 /* Pods-XinjiangProject.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7CC5LW224; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_PREFIX_HEADER = "$(SRCROOT)/XinjiangProject/Supporting Files/PrefixHeader.pch"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/XinjiangProject/Supporting Files/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "新疆亚克西"; + INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; + INFOPLIST_KEY_NSCameraUsageDescription = "健康咨询员工端需要访问您的相机用来档案功能,是否同意?"; + INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。"; + INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "APP需要您的定位服务,否则可能无法使用。"; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。"; + INFOPLIST_KEY_NSMicrophoneUsageDescription = "健康咨询员工端需要访问您的麦克风用来视频录制,是否同意?"; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "新疆员工端需要访问您的相册上传图片,方便您的使用,是否同意?"; + INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "健康咨询想使用您的相册功能 是否同意?"; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UIUserInterfaceStyle = Light; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject; + PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; + 1809E4932E092C740034C8FC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = A7CC5LW224; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1809E4942E092C740034C8FC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = A7CC5LW224; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 1809E4962E092C740034C8FC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7CC5LW224; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XinjiangProject.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/XinjiangProject"; + }; + name = Debug; + }; + 1809E4972E092C740034C8FC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7CC5LW224; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XinjiangProject.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/XinjiangProject"; + }; + name = Release; + }; + 1809E4992E092C740034C8FC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7CC5LW224; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = XinjiangProject; + }; + name = Debug; + }; + 1809E49A2E092C740034C8FC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7CC5LW224; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = XinjiangProject; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1809E45D2E092C710034C8FC /* Build configuration list for PBXProject "XinjiangProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1809E4932E092C740034C8FC /* Debug */, + 1809E4942E092C740034C8FC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1809E4902E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1809E4912E092C740034C8FC /* Debug */, + 1809E4922E092C740034C8FC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1809E4952E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1809E4962E092C740034C8FC /* Debug */, + 1809E4972E092C740034C8FC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1809E4982E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1809E4992E092C740034C8FC /* Debug */, + 1809E49A2E092C740034C8FC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1809E45A2E092C710034C8FC /* Project object */; +} diff --git a/XinjiangProject/XinjiangProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/XinjiangProject/XinjiangProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/XinjiangProject/XinjiangProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/XinjiangProject/XinjiangProject.xcworkspace/contents.xcworkspacedata b/XinjiangProject/XinjiangProject.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..8355baf --- /dev/null +++ b/XinjiangProject/XinjiangProject.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/XinjiangProject/XinjiangProject/Categorys/NSArray/NSArray+Sudoku.h b/XinjiangProject/XinjiangProject/Categorys/NSArray/NSArray+Sudoku.h new file mode 100644 index 0000000..3ed771f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSArray/NSArray+Sudoku.h @@ -0,0 +1,90 @@ +// +// NSArray+Sudoku.h +// EscortProject +// +// Created by Apple on 2024/3/4. +// + + +#import "MASUtilities.h" +#import "MASConstraintMaker.h" +#import "MASViewAttribute.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSArray (Sudoku) + +/** +* 九宫格布局 固定ItemSize 可变ItemSpacing +* +* @param fixedItemWidth 固定宽度 +* @param fixedItemHeight 固定高度 +* @param warpCount 折行点 +* @param topSpacing 顶间距 +* @param bottomSpacing 底间距 +* @param leadSpacing 左间距 +* @param tailSpacing 右间距 +*/ +- (void)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth + fixedItemHeight:(CGFloat)fixedItemHeight + warpCount:(NSInteger)warpCount + topSpacing:(CGFloat)topSpacing + bottomSpacing:(CGFloat)bottomSpacing + leadSpacing:(CGFloat)leadSpacing + tailSpacing:(CGFloat)tailSpacing; + + +/** +* 九宫格布局 可变ItemSize 固定ItemSpacing +* +* @param fixedLineSpacing 行间距 +* @param fixedInteritemSpacing 列间距 +* @param warpCount 折行点 +* @param topSpacing 顶间距 +* @param bottomSpacing 底间距 +* @param leadSpacing 左间距 +* @param tailSpacing 右间距 +*/ +- (void)mas_distributeSudokuViewsWithFixedLineSpacing:(CGFloat)fixedLineSpacing + fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing + warpCount:(NSInteger)warpCount + topSpacing:(CGFloat)topSpacing + bottomSpacing:(CGFloat)bottomSpacing + leadSpacing:(CGFloat)leadSpacing + tailSpacing:(CGFloat)tailSpacing; + + +/** +* 九宫格布局 固定ItemSize 固定ItemSpacing +* 可由九宫格的内容控制SuperView的大小 +* 如果warpCount大于[self count],该方法将会用空白的View填充到superview中 +* +* Sudoku Layout, has fixed item size, and fix item space +* If warp count greater than self.count, It's fill empty view to superview +* +* @param fixedItemWidth 固定宽度,如果设置成0,则表示自适应,If set it to zero, indicates the adaptive. +* @param fixedItemHeight 固定高度,如果设置成0,则表示自适应,If set it to zero, indicates the adaptive. +* @param fixedLineSpacing 行间距 +* @param fixedInteritemSpacing 列间距 +* @param warpCount 折行点 +* @param topSpacing 顶间距 +* @param bottomSpacing 底间距 +* @param leadSpacing 左间距 +* @param tailSpacing 右间距 +* +* @return 一般情况下会返回[self copy], 如果warpCount大于[self count],则会返回一个被空白view填充过的数组,可以让你循环调用removeFromSuperview或者干一些其他的事情; +* @return Normal will return [self copy], If warpCount bigger than [self count] , It will return a empty views filled array, you could enumerate [subview removeFromSuperview] or do other things; +*/ +- (NSArray *)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth + fixedItemHeight:(CGFloat)fixedItemHeight + fixedLineSpacing:(CGFloat)fixedLineSpacing + fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing + warpCount:(NSInteger)warpCount + topSpacing:(CGFloat)topSpacing + bottomSpacing:(CGFloat)bottomSpacing + leadSpacing:(CGFloat)leadSpacing + tailSpacing:(CGFloat)tailSpacing; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/NSArray/NSArray+Sudoku.m b/XinjiangProject/XinjiangProject/Categorys/NSArray/NSArray+Sudoku.m new file mode 100644 index 0000000..7fe295c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSArray/NSArray+Sudoku.m @@ -0,0 +1,209 @@ +// +// NSArray+Sudoku.m +// EscortProject +// +// Created by Apple on 2024/3/4. +// + + +#import "NSArray+Sudoku.h" +#import "View+MASAdditions.h" + + +@implementation NSArray (Sudoku) +- (MAS_VIEW *)star_commonSuperviewOfViews { + + if (self.count == 1) { + return ((MAS_VIEW *)self.firstObject).superview; + } + + MAS_VIEW *commonSuperview = nil; + MAS_VIEW *previousView = nil; + for (id object in self) { + if ([object isKindOfClass:[MAS_VIEW class]]) { + MAS_VIEW *view = (MAS_VIEW *)object; + if (previousView) { + commonSuperview = [view mas_closestCommonSuperview:commonSuperview]; + } else { + commonSuperview = view; + } + previousView = view; + } + } + NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy."); + return commonSuperview; +} + + + +- (void)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth + fixedItemHeight:(CGFloat)fixedItemHeight + warpCount:(NSInteger)warpCount + topSpacing:(CGFloat)topSpacing + bottomSpacing:(CGFloat)bottomSpacing + leadSpacing:(CGFloat)leadSpacing + tailSpacing:(CGFloat)tailSpacing { + if (self.count < 2) { + NSAssert(self.count>1,@"views to distribute need to bigger than one"); + return; + } + if (warpCount < 1) { + NSAssert(false, @"warp count need to bigger than zero"); + return; + } + + MAS_VIEW *tempSuperView = [self star_commonSuperviewOfViews]; + + NSInteger rowCount = self.count % warpCount == 0 ? self.count / warpCount : self.count / warpCount + 1; + + MAS_VIEW *prev; + for (int i = 0; i < self.count; i++) { + + MAS_VIEW *v = self[i]; + + // 当前行 + NSInteger currentRow = i / warpCount; + // 当前列 + NSInteger currentColumn = i % warpCount; + + [v mas_makeConstraints:^(MASConstraintMaker *make) { + // 固定宽度 + make.width.equalTo(@(fixedItemWidth)); + make.height.equalTo(@(fixedItemHeight)); + + // 第一行 + if (currentRow == 0) { + make.top.equalTo(tempSuperView).offset(topSpacing); + } + // 最后一行 + if (currentRow == rowCount - 1) { + make.bottom.equalTo(tempSuperView).offset(-bottomSpacing); + } + // 中间的若干行 + if (currentRow != 0 && currentRow != rowCount - 1){ + CGFloat offset = (1-(currentRow/((CGFloat)rowCount-1)))*(fixedItemHeight+topSpacing)-currentRow*bottomSpacing/(((CGFloat)rowCount-1)); + make.bottom.equalTo(tempSuperView).multipliedBy(currentRow/((CGFloat)rowCount-1)).offset(offset); + } + + // 第一列 + if (currentColumn == 0) { + make.left.equalTo(tempSuperView).offset(leadSpacing); + } + // 最后一列 + if (currentColumn == warpCount - 1) { + make.right.equalTo(tempSuperView).offset(-tailSpacing); + } + // 中间若干列 + if (currentColumn != 0 && currentColumn != warpCount - 1) { + CGFloat offset = (1-(currentColumn/((CGFloat)warpCount-1)))*(fixedItemWidth+leadSpacing)-currentColumn*tailSpacing/(((CGFloat)warpCount-1)); + make.right.equalTo(tempSuperView).multipliedBy(currentColumn/((CGFloat)warpCount-1)).offset(offset); + } + }]; + prev = v; + } +} + +- (void)mas_distributeSudokuViewsWithFixedLineSpacing:(CGFloat)fixedLineSpacing + fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing + warpCount:(NSInteger)warpCount + topSpacing:(CGFloat)topSpacing + bottomSpacing:(CGFloat)bottomSpacing + leadSpacing:(CGFloat)leadSpacing + tailSpacing:(CGFloat)tailSpacing { + + [self mas_distributeSudokuViewsWithFixedItemWidth:0 fixedItemHeight:0 fixedLineSpacing:fixedLineSpacing fixedInteritemSpacing:fixedInteritemSpacing warpCount:warpCount topSpacing:topSpacing bottomSpacing:bottomSpacing leadSpacing:leadSpacing tailSpacing:tailSpacing]; +} + +- (NSArray *)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth + fixedItemHeight:(CGFloat)fixedItemHeight + fixedLineSpacing:(CGFloat)fixedLineSpacing + fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing + warpCount:(NSInteger)warpCount + topSpacing:(CGFloat)topSpacing + bottomSpacing:(CGFloat)bottomSpacing + leadSpacing:(CGFloat)leadSpacing + tailSpacing:(CGFloat)tailSpacing { + if (self.count < 1) { + return self.copy; + } + if (warpCount < 1) { + NSAssert(false, @"warp count need to bigger than zero"); + return self.copy; + } + + MAS_VIEW *tempSuperView = [self star_commonSuperviewOfViews]; + + NSArray *tempViews = self.copy; + if (warpCount > self.count) { + for (int i = 0; i < warpCount - self.count; i++) { + MAS_VIEW *tempView = [[MAS_VIEW alloc] init]; + [tempSuperView addSubview:tempView]; + tempViews = [tempViews arrayByAddingObject:tempView]; + } + } + + NSInteger columnCount = warpCount; + NSInteger rowCount = tempViews.count % columnCount == 0 ? tempViews.count / columnCount : tempViews.count / columnCount + 1; + + MAS_VIEW *prev; + for (int i = 0; i < tempViews.count; i++) { + + MAS_VIEW *v = tempViews[i]; + NSInteger currentRow = i / columnCount; + NSInteger currentColumn = i % columnCount; + + [v mas_makeConstraints:^(MASConstraintMaker *make) { + if (prev) { + // 固定宽度 + make.width.equalTo(prev); + make.height.equalTo(prev); + } + else { + // 如果写的item高宽分别是0,则表示自适应 + if (fixedItemWidth) { + make.width.equalTo(@(fixedItemWidth)); + } + if (fixedItemHeight) { + make.height.equalTo(@(fixedItemHeight)); + } + } + + // 第一行 + if (currentRow == 0) { + make.top.equalTo(tempSuperView).offset(topSpacing); + } + // 最后一行 + if (currentRow == rowCount - 1) { + // 如果只有一行 + if (currentRow != 0 && i-columnCount >= 0) { + make.top.equalTo(((MAS_VIEW *)tempViews[i-columnCount]).mas_bottom).offset(fixedLineSpacing); + } + make.bottom.equalTo(tempSuperView).offset(-bottomSpacing); + } + // 中间的若干行 + if (currentRow != 0 && currentRow != rowCount - 1) { + make.top.equalTo(((MAS_VIEW *)tempViews[i-columnCount]).mas_bottom).offset(fixedLineSpacing); + } + + // 第一列 + if (currentColumn == 0) { + make.left.equalTo(tempSuperView).offset(leadSpacing); + } + // 最后一列 + if (currentColumn == columnCount - 1) { + // 如果只有一列 + if (currentColumn != 0) { + make.left.equalTo(prev.mas_right).offset(fixedInteritemSpacing); + } + make.right.equalTo(tempSuperView).offset(-tailSpacing); + } + // 中间若干列 + if (currentColumn != 0 && currentColumn != warpCount - 1) { + make.left.equalTo(prev.mas_right).offset(fixedInteritemSpacing); + } + }]; + prev = v; + } + return tempViews; +} +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/NSAttributedString+Extension.h b/XinjiangProject/XinjiangProject/Categorys/NSAttributedString+Extension.h new file mode 100644 index 0000000..b270fcc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSAttributedString+Extension.h @@ -0,0 +1,16 @@ +// +// NSAttributedString+Extension.h +// EscortProject +// +// Created by 仁康信息 on 2023/3/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSAttributedString (Extension) + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/NSAttributedString+Extension.m b/XinjiangProject/XinjiangProject/Categorys/NSAttributedString+Extension.m new file mode 100644 index 0000000..b8c4ce7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSAttributedString+Extension.m @@ -0,0 +1,12 @@ +// +// NSAttributedString+Extension.m +// EscortProject +// +// Created by 仁康信息 on 2023/3/14. +// + +#import "NSAttributedString+Extension.h" + +@implementation NSAttributedString (Extension) + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/NSDate/NSDate+IH.h b/XinjiangProject/XinjiangProject/Categorys/NSDate/NSDate+IH.h new file mode 100755 index 0000000..1b04c00 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSDate/NSDate+IH.h @@ -0,0 +1,239 @@ +// +// NSDate+IH.h +// IHKit +// +// Created by yl on 16/10/24. +// Copyright © 2016年 39hospital. All rights reserved. +// +// +// Learning to YYKit url https://github.com/ibireme/YYKit/blob/master/YYKit/ + + + +#import + +NS_ASSUME_NONNULL_BEGIN + +static NSString *ih_default_date_format = @"yyyy-MM-dd HH:mm:ss"; //!<常用的时间格式 + +@interface NSDate (Property) + +@property (nonatomic, readonly) NSInteger year; // Year component +@property (nonatomic, readonly) NSInteger month; // Month component (1~12) +@property (nonatomic, readonly) NSInteger day; // Day component (1~31) + +@property (nonatomic, readonly) NSInteger hour; // Hour component (0~23) +@property (nonatomic, readonly) NSInteger minute; // Minute component (0~59) +@property (nonatomic, readonly) NSInteger second; // Second component (0~59) +@property (nonatomic, readonly) NSInteger nanosecond; // Nanosecond component + +@property (nonatomic, readonly) NSInteger weekday; // Weekday component (1~7, first day is based on user setting) +@property (nonatomic, readonly) NSInteger weekdayOrdinal; // WeekdayOrdinal component +@property (nonatomic, readonly) NSInteger weekOfMonth; // WeekOfMonth component (1~5) +@property (nonatomic, readonly) NSInteger weekOfYear; // WeekOfYear component (1~53) +@property (nonatomic, readonly) NSInteger yearForWeekOfYear; // YearForWeekOfYear component +@property (nonatomic, readonly) NSInteger quarter; // Quarter component + +@property (nonatomic, readonly) BOOL isLeapMonth; // whether the month is leap month +@property (nonatomic, readonly) BOOL isLeapYear; // whether the year is leap year +@property (nonatomic, readonly) BOOL isToday; // whether date is today (based on current locale) +@property (nonatomic, readonly) BOOL isYesterday; // whether date is yesterday (based on current locale) + ++ (NSArray *)toGetDatesWithStartDate:(NSString *)startDate endDate:(NSString *)endDate; ++ (NSString *)toGetWeekDayString:(NSInteger )weekDay; + + +@end + + +@interface NSDate (Format) + +/** + 获取对应format的时间字符串 + + @param format 时间构造format e.g. @"yyyy-MM-dd HH:mm:ss" + + @return 时间字符串 nilable + + */ +- (nullable NSString *)ih_stringWithFormat:(nullable NSString *)format; + +/** + 获取对应format的时间字符串 + + @param format 时间构造format e.g. @"yyyy-MM-dd HH:mm:ss" + @param timeZone 时区 + @param locale 当地环境 + + @return 时间字符串 nilable + */ +- (nullable NSString *)ih_stringWithFormat:(nullable NSString *)format timeZone:(nullable NSTimeZone *)timeZone locale:(nullable NSLocale *)locale; + +/** + 标准ISO8601 format e.g. @"2016-10-24T16:40:16+12:00" + + @return 时间字符串(ISO标准) nilable + */ +- (nullable NSString *)ih_stringWithISOFormat; + +/** + 通过时间字符串获取nsdate对象 + + @param dateString 时间字符串 + @param format 时间字符串的format + + @return nsdate对象 nilable + */ ++ (nullable NSDate *)ih_dateWithString:(nullable NSString *)dateString format:(nullable NSString *)format; + +/** + 通过时间字符串获取nsdate对象 + + @param dateString 时间字符串 + @param format 时间字符串的format + @param timeZone 时区 + @param locale 当地环境 + + @return nsdate对象 nilable + */ ++ (nullable NSDate *)ih_dateWithString:(nullable NSString *)dateString format:(nullable NSString *)format timeZone:(nullable NSTimeZone *)timeZone locale:(nullable NSLocale *)locale; + +/** + 通过时间字符串获取一个依据 ISO format 的nsdate对象 + + @param dateString 时间字符串 + + @return nsdate对象 nilable + */ ++ (nullable NSDate *)ih_dateWithISOFormatString:(nullable NSString *)dateString; + +@end + + +@interface NSDate (Modify) + +/** + 获取自己增加添加some years之后的nsdate + + @param years 年数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingYears:(NSInteger)years; + +/** + 获取自己增加添加some months之后的nsdate + + @param months 月数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingMonths:(NSInteger)months; + +/** + 获取自己增加添加some months之后的nsdate + + @param weeks 周数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingWeeks:(NSInteger)weeks; + +/** + 获取自己增加添加some days之后的nsdate + + @param days 天数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingDays:(NSInteger)days; + +/** + 获取自己增加添加some hours之后的nsdate + + @param hours 小时数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingHours:(NSInteger)hours; + +/** + 获取自己增加添加some mins之后的nsdate + + @param minutes 分钟数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingMinutes:(NSInteger)minutes; + +/** + 获取自己增加添加some secs之后的nsdate + + @param seconds 秒数 + + @return nsdate增加之后 nilable + */ +- (nullable NSDate *)ih_dateByAddingSeconds:(NSInteger)seconds; + +@end + +@interface NSDate (Compare) + +/** + 比较两个时间的大小 使用默认的date格式:yyyy-MM-dd HH:mm:ss + + @param dateString 比较时间 + + @return 比较结果 + */ +- (NSComparisonResult)ih_compareDateString:(nullable NSString *)dateString; + +/** + 比较两个时间的大小 使用的dateformat + + @param dateString 时间字符串 + @param format 时间字符串的构造格式 + + @return 比较结果 (比较结果为通过相应的format来构造自身(因为nsdate的format不一定和外部传入的一样,那样比较的话会出现明显误差),再进行比较) + */ +- (NSComparisonResult)ih_compareDateString:(nullable NSString *)dateString format:(nullable NSString *)format; + +/** + 两个时间之间相距多少秒 + + @param date 比较时间 + + @return 秒数 + */ +- (NSTimeInterval)ih_secondTimeAwayFromDate:(nullable NSDate *)date; + +/** + 两个时间之间相距多少分钟 + + @param date 比较时间 + + @return 分钟数 + */ +- (double)ih_minuteTimeAwayFromDate:(nullable NSDate *)date; + +/** + 两个时间之间相距多少小时 + + @param date 比较时间 + + @return 小时数 + */ +- (double)ih_hourTimeAwayFromDate:(nullable NSDate *)date; + +/** + 两个时间之间相距多少小天 + + @param date 比较时间 + + @return 天数 + */ +- (double)ih_dayTimeAwayFromDate:(nullable NSDate *)date; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/NSDate/NSDate+IH.m b/XinjiangProject/XinjiangProject/Categorys/NSDate/NSDate+IH.m new file mode 100755 index 0000000..ce77af0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSDate/NSDate+IH.m @@ -0,0 +1,264 @@ +// +// NSDate+IH.m +// IHKit +// +// Created by yl on 16/10/24. +// Copyright © 2016年 39hospital. All rights reserved. +// + +#import "NSDate+IH.h" + +@implementation NSDate (Property) + +- (NSInteger)year { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitYear fromDate:self] year]; +} + +- (NSInteger)month { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitMonth fromDate:self] month]; +} + +- (NSInteger)day { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitDay fromDate:self] day]; +} + +- (NSInteger)hour { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitHour fromDate:self] hour]; +} + +- (NSInteger)minute { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitMinute fromDate:self] minute]; +} + +- (NSInteger)second { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitSecond fromDate:self] second]; +} + +- (NSInteger)nanosecond { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitSecond fromDate:self] nanosecond]; +} + +- (NSInteger)weekday { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekday fromDate:self] weekday]; +} + +- (NSInteger)weekdayOrdinal { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekdayOrdinal fromDate:self] weekdayOrdinal]; +} + +- (NSInteger)weekOfMonth { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekOfMonth fromDate:self] weekOfMonth]; +} + +- (NSInteger)weekOfYear { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekOfYear fromDate:self] weekOfYear]; +} + +- (NSInteger)yearForWeekOfYear { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitYearForWeekOfYear fromDate:self] yearForWeekOfYear]; +} + +- (NSInteger)quarter { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitQuarter fromDate:self] quarter]; +} + +- (BOOL)isLeapMonth { + return [[[NSCalendar currentCalendar] components:NSCalendarUnitQuarter fromDate:self] isLeapMonth]; +} + +- (BOOL)isLeapYear { + NSUInteger year = self.year; + return ((year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0))); +} + +- (BOOL)isToday { + if (fabs(self.timeIntervalSinceNow) >= 60 * 60 * 24) return NO; + return [NSDate new].day == self.day; +} + +- (BOOL)isYesterday { + NSDate *added = [self ih_dateByAddingDays:1]; + return [added isToday]; +} + ++ (NSArray *)toGetDatesWithStartDate:(NSString *)startDate endDate:(NSString *)endDate { + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSCalendarIdentifierGregorian]; + NSDateFormatter *matter = [[NSDateFormatter alloc] init]; + matter.dateFormat = @"yyyy-MM-dd"; + NSDate *start = [matter dateFromString:startDate]; + NSDate *end = [matter dateFromString:endDate]; + NSMutableArray *componentAarray = [NSMutableArray array]; + NSComparisonResult result = [start compare:end]; + NSDateComponents *comps; + while (result != NSOrderedDescending) { + comps = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday fromDate:start]; + [componentAarray addObject:start]; + [comps setDay:([comps day]+1)]; + start = [calendar dateFromComponents:comps]; + result = [start compare:end]; + }return componentAarray; +} ++ (NSString *)toGetWeekDayString:(NSInteger )weekDay { + switch (weekDay) { + case 1: + return @"星期日"; + break; + case 2: + return @"星期一"; + break; + case 3: + return @"星期二"; + break; + case 4: + return @"星期三"; + break; + case 5: + return @"星期四"; + break; + case 6: + return @"星期五"; + break; + case 7: + return @"星期六"; + break; + + default: + return @""; + break; + } +} + + + + +@end + +@implementation NSDate (Format) + +- (NSString *)ih_stringWithFormat:(NSString *)format { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + [formatter setLocale:[NSLocale currentLocale]]; + return [formatter stringFromDate:self]; +} + +- (NSString *)ih_stringWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + if (timeZone) [formatter setTimeZone:timeZone]; + if (locale) [formatter setLocale:locale]; + return [formatter stringFromDate:self]; +} + +- (NSString *)ih_stringWithISOFormat { + static NSDateFormatter *formatter = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + formatter = [[NSDateFormatter alloc] init]; + formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; + formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ"; + }); + return [formatter stringFromDate:self]; +} + ++ (NSDate *)ih_dateWithString:(NSString *)dateString format:(NSString *)format { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + return [formatter dateFromString:dateString]; +} + ++ (NSDate *)ih_dateWithString:(NSString *)dateString format:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + if (timeZone) [formatter setTimeZone:timeZone]; + if (locale) [formatter setLocale:locale]; + return [formatter dateFromString:dateString]; +} + ++ (NSDate *)ih_dateWithISOFormatString:(nullable NSString *)dateString { + static NSDateFormatter *formatter = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + formatter = [[NSDateFormatter alloc] init]; + formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; + formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ"; + }); + return [formatter dateFromString:dateString]; +} + +@end + +@implementation NSDate (Modify) + +- (NSDate *)ih_dateByAddingYears:(NSInteger)years { + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDateComponents *components = [[NSDateComponents alloc] init]; + [components setYear:years]; + return [calendar dateByAddingComponents:components toDate:self options:0]; +} + +- (NSDate *)ih_dateByAddingMonths:(NSInteger)months { + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDateComponents *components = [[NSDateComponents alloc] init]; + [components setMonth:months]; + return [calendar dateByAddingComponents:components toDate:self options:0]; +} + +- (NSDate *)ih_dateByAddingWeeks:(NSInteger)weeks { + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDateComponents *components = [[NSDateComponents alloc] init]; + [components setWeekOfYear:weeks]; + return [calendar dateByAddingComponents:components toDate:self options:0]; +} + +- (NSDate *)ih_dateByAddingDays:(NSInteger)days { + return [self ih_dateByAddingHours:(24 * days)]; +} + +- (NSDate *)ih_dateByAddingHours:(NSInteger)hours { + return [self ih_dateByAddingMinutes:(60 * hours)]; +} + +- (NSDate *)ih_dateByAddingMinutes:(NSInteger)minutes { + return [self ih_dateByAddingSeconds:(60 * minutes)]; +} + +- (NSDate *)ih_dateByAddingSeconds:(NSInteger)seconds { + NSTimeInterval aTimeInterval = [self timeIntervalSinceReferenceDate] + seconds; + NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; + return newDate; +} + +@end + +@implementation NSDate (Compare) + +- (NSComparisonResult)ih_compareDateString:(NSString *)dateString{ + return [self ih_compareDateString:dateString format:@"yyyy-MM-dd HH:mm:ss"]; +} + +- (NSComparisonResult)ih_compareDateString:(NSString *)dateString format:(NSString *)format{ + NSDate *selfCompareDate = [NSDate ih_dateWithString:[self ih_stringWithFormat:format] format:format]; + return [selfCompareDate compare:[NSDate ih_dateWithString:dateString format:format]]; +} + +- (NSTimeInterval)ih_secondTimeAwayFromDate:(NSDate *)date{ + return [self timeIntervalSinceDate:date]; +} + +- (double)ih_minuteTimeAwayFromDate:(NSDate *)date{ + return ([self ih_secondTimeAwayFromDate:date]/60); +} + +- (double)ih_hourTimeAwayFromDate:(NSDate *)date{ + return ([self ih_minuteTimeAwayFromDate:date]/60); +} + +- (double)ih_dayTimeAwayFromDate:(NSDate *)date{ + return ([self ih_hourTimeAwayFromDate:date]/24); +} +- (double)ih_monthTimeAwayFromDate:(NSDate *)date{ + return ([self ih_dayTimeAwayFromDate:date]/30); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+Log.h b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+Log.h new file mode 100644 index 0000000..c65416f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+Log.h @@ -0,0 +1,20 @@ +// +// NSDictionary+Log.h +// wbiaoServer +// +// Created by boai on 2020/4/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSDictionary (Log) + +@end + +@interface NSArray (Log) + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+Log.m b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+Log.m new file mode 100644 index 0000000..8901e1f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+Log.m @@ -0,0 +1,74 @@ +// +// NSDictionary+Log.m +// wbiaoServer +// +// Created by boai on 2020/4/13. +// + +#import "NSDictionary+Log.h" + +@implementation NSDictionary (Log) + +- (NSString *)jsonString{ + if (self == nil) { + return nil; + } + NSError *error; + NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error]; + NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + return jsonString; +} + +- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level +{ + NSMutableString *mStr = [NSMutableString string]; + NSMutableString *tab = [NSMutableString stringWithString:@""]; + for (int i = 0; i < level; i++) { + [tab appendString:@"\t"]; + } + [mStr appendString:@"{\n"]; + NSArray *allKey = self.allKeys; + for (int i = 0; i < allKey.count; i++) { + id value = self[allKey[i]]; + NSString *lastSymbol = (allKey.count == i + 1) ? @"":@";"; + if ([value respondsToSelector:@selector(descriptionWithLocale:indent:)]) { + + [mStr appendFormat:@"\t%@%@ = %@%@\n",tab,allKey[i],[value descriptionWithLocale:locale indent:level + 1],lastSymbol]; + + } else { + + [mStr appendFormat:@"\t%@%@ = %@%@\n",tab,allKey[i],value,lastSymbol]; + + } + } + [mStr appendFormat:@"%@}",tab]; + return mStr; +} + +@end + +@implementation NSArray (Log) + +- (NSString *)descriptionWithLocale:(nullable id)locale indent:(NSUInteger)level{ + + NSMutableString *mStr = [NSMutableString string]; + NSMutableString *tab = [NSMutableString stringWithString:@""]; + for (int i = 0; i < level; i++) { + [tab appendString:@"\t"]; + } + [mStr appendString:@"(\n"]; + for (int i = 0; i < self.count; i++) { + NSString *lastSymbol = (self.count == i + 1) ? @"":@","; + id value = self[i]; + if ([value respondsToSelector:@selector(descriptionWithLocale:indent:)]) { + [mStr appendFormat:@"\t%@%@%@\n",tab,[value descriptionWithLocale:locale indent:level + 1],lastSymbol]; + } else { + [mStr appendFormat:@"\t%@%@%@\n",tab,value,lastSymbol]; + } + } + [mStr appendFormat:@"%@)",tab]; + return mStr; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+NilSafe.h b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+NilSafe.h new file mode 100644 index 0000000..8118376 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+NilSafe.h @@ -0,0 +1,17 @@ +// +// NSDictionary+NilSafe.h +// NSDictionary-NilSafe +// +// Created by Allen Hsu on 6/22/16. +// Copyright © 2016 Glow Inc. All rights reserved. +// + +#import + +@interface NSDictionary (NilSafe) + +@end + +@interface NSMutableDictionary (NilSafe) + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+NilSafe.m b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+NilSafe.m new file mode 100644 index 0000000..5060b59 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSDictionary/NSDictionary+NilSafe.m @@ -0,0 +1,113 @@ +// +// NSDictionary+NilSafe.m +// NSDictionary-NilSafe +// +// Created by Allen Hsu on 6/22/16. +// Copyright © 2016 Glow Inc. All rights reserved. +// + +#import +#import "NSDictionary+NilSafe.h" + +@implementation NSObject (Swizzling) + ++ (BOOL)gl_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel { + Method origMethod = class_getInstanceMethod(self, origSel); + Method altMethod = class_getInstanceMethod(self, altSel); + if (!origMethod || !altMethod) { + return NO; + } + class_addMethod(self, + origSel, + class_getMethodImplementation(self, origSel), + method_getTypeEncoding(origMethod)); + class_addMethod(self, + altSel, + class_getMethodImplementation(self, altSel), + method_getTypeEncoding(altMethod)); + method_exchangeImplementations(class_getInstanceMethod(self, origSel), + class_getInstanceMethod(self, altSel)); + return YES; +} + ++ (BOOL)gl_swizzleClassMethod:(SEL)origSel withMethod:(SEL)altSel { + return [object_getClass((id)self) gl_swizzleMethod:origSel withMethod:altSel]; +} + +@end + +@implementation NSDictionary (NilSafe) + ++ (void)load { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + [self gl_swizzleMethod:@selector(initWithObjects:forKeys:count:) withMethod:@selector(gl_initWithObjects:forKeys:count:)]; + [self gl_swizzleClassMethod:@selector(dictionaryWithObjects:forKeys:count:) withMethod:@selector(gl_dictionaryWithObjects:forKeys:count:)]; + }); +} + ++ (instancetype)gl_dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt { + id safeObjects[cnt]; + id safeKeys[cnt]; + NSUInteger j = 0; + for (NSUInteger i = 0; i < cnt; i++) { + id key = keys[i]; + id obj = objects[i]; + if (!key || !obj) { + continue; + } + safeKeys[j] = key; + safeObjects[j] = obj; + j++; + } + return [self gl_dictionaryWithObjects:safeObjects forKeys:safeKeys count:j]; +} + +- (instancetype)gl_initWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt { + id safeObjects[cnt]; + id safeKeys[cnt]; + NSUInteger j = 0; + for (NSUInteger i = 0; i < cnt; i++) { + id key = keys[i]; + id obj = objects[i]; + if (!key || !obj) { + continue; + } + if (!obj) { + obj = [NSNull null]; + } + safeKeys[j] = key; + safeObjects[j] = obj; + j++; + } + return [self gl_initWithObjects:safeObjects forKeys:safeKeys count:j]; +} + +@end + +@implementation NSMutableDictionary (NilSafe) + ++ (void)load { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + Class class = NSClassFromString(@"__NSDictionaryM"); + [class gl_swizzleMethod:@selector(setObject:forKey:) withMethod:@selector(gl_setObject:forKey:)]; + [class gl_swizzleMethod:@selector(setObject:forKeyedSubscript:) withMethod:@selector(gl_setObject:forKeyedSubscript:)]; + }); +} + +- (void)gl_setObject:(id)anObject forKey:(id)aKey { + if (!aKey || !anObject) { + return; + } + [self gl_setObject:anObject forKey:aKey]; +} + +- (void)gl_setObject:(id)obj forKeyedSubscript:(id)key { + if (!key || !obj) { + return; + } + [self gl_setObject:obj forKeyedSubscript:key]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/NSString/NSString+FKTools.h b/XinjiangProject/XinjiangProject/Categorys/NSString/NSString+FKTools.h new file mode 100755 index 0000000..849d87d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSString/NSString+FKTools.h @@ -0,0 +1,59 @@ +// +// NSString+FKTools.h +// Doctor +// +// Created by 张正梅 on 2019/5/30. +// Copyright © 2019 com.longmaster. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSString (FKTools) +/* 为适应iOS7写的一个是否包含某字符的方法 */ +- (BOOL)myContainsString:(NSString*)other; +//根据宽度确定字符串的高度 +- (CGFloat)heigthWithsysFont:(CGFloat)font + withWidth:(CGFloat)width; +- (CGFloat)heigthWithboldSystemFont:(CGFloat)font + withWidth:(CGFloat)width; ++ (CGFloat)toCalculateHeightWithContent:(NSString *)contentText Width:(CGFloat)width Font:(UIFont *)font; ++ (CGSize)boundingRectWithWidth:(CGFloat)maxWidth + withTextFont:(UIFont *)font + withLineSpacing:(CGFloat)lineSpacing + text:(NSString *)text; ++ (NSMutableAttributedString *)toGetAttributedStringWithFont:(UIFont *)font + withLineSpacing:(CGFloat)lineSpacing + text:(NSString *)text; +//一行字体的宽度 +- (CGFloat)widthWithsysFont:(CGFloat)font; +- (CGFloat)widthWithBordFont:(CGFloat)font; + ++ (CGFloat)HeightWithHtlm5Str:(NSString *)htlmStr width:(CGFloat)width; ++ (NSString*)newlineReplacingjson:(NSString*)strJson; + +- (NSMutableAttributedString *)setAttributeWithLab:(UILabel *)label LineSpacing:(CGFloat)lineSpacing; +/* 根据出生日期得到年龄 */ +-(NSString *)toGetAgeByBornDate; +/* 得到高度 */ +- (CGFloat)toGetRectLab:(UILabel *)lable WithWidth:(CGFloat)widthFloat; +- (BOOL)hasSubString:(NSString *)subString; + +- (void)toSetAttributeWithLable:(UILabel *)lable Title:(NSString *)title TitleColor:(UIColor *)titleColor TitleFont:(UIFont *)titleFont + ContentText:(NSString *)contentText ContentColor:(UIColor *)ContentColor ContentFont:(UIFont *)ContentFont; ++ (NSAttributedString *)toGetStrWithHtmlStr:(NSString *)string; ++ (NSMutableAttributedString *)setEquipmentAttributedString:(NSString *)str; ++ (CGFloat )getHTMLHeightByStr:(NSString *)str; + ++ (NSString *)toGetTimeText:(NSString *)timeText; + ++ (NSString *)UIImageToBase64Str:(UIImage *) image; + ++ (NSString *)toGetTimeTextByEndOfTheMinute:(NSString *)time; + +- (NSString *)MD5_32BI; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/NSString/NSString+FKTools.m b/XinjiangProject/XinjiangProject/Categorys/NSString/NSString+FKTools.m new file mode 100755 index 0000000..272a978 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/NSString/NSString+FKTools.m @@ -0,0 +1,230 @@ +// +// NSString+FKTools.m +// Doctor +// +// Created by 张正梅 on 2019/5/30. +// Copyright © 2019 com.longmaster. All rights reserved. +// + +#import "NSString+FKTools.h" +#import "NSDate+IH.h" +#import + +@implementation NSString (FKTools) +- (BOOL)myContainsString:(NSString*)other{ + NSRange range = [self rangeOfString:other]; + return range.length != 0; +} +- (CGFloat)heigthWithsysFont:(CGFloat)font + withWidth:(CGFloat)width{ + NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:font], NSFontAttributeName, nil]; + CGRect rect = [self boundingRectWithSize:CGSizeMake(width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil]; + return rect.size.height; +} +- (CGFloat)heigthWithboldSystemFont:(CGFloat)font + withWidth:(CGFloat)width{ + NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:font], NSFontAttributeName, nil]; + CGRect rect = [self boundingRectWithSize:CGSizeMake(width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil]; + return rect.size.height; +} ++ (CGFloat)toCalculateHeightWithContent:(NSString *)contentText Width:(CGFloat)width Font:(UIFont *)font{ + CGFloat textHeight = [NSString boundingRectWithWidth:width withTextFont:font withLineSpacing:LineSpace text:contentText].height; + return textHeight; +} + +/** + * 根据文字内容动态计算UILabel宽高 + * @param maxWidth label宽度 + * @param font 字体 + * @param lineSpacing 行间距 + * @param text 内容 + */ ++ (CGSize)boundingRectWithWidth:(CGFloat)maxWidth + withTextFont:(UIFont *)font + withLineSpacing:(CGFloat)lineSpacing + text:(NSString *)text{ + CGSize maxSize = CGSizeMake(maxWidth, CGFLOAT_MAX); + //段落样式 + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + //设置行间距 + [paragraphStyle setLineSpacing:lineSpacing]; +#warning 此处设置NSLineBreakByTruncatingTail会导致计算文字高度方法失效 +// [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; + //计算文字尺寸 + CGSize size = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font, NSParagraphStyleAttributeName:paragraphStyle} context:nil].size; + return size; +} ++ (NSMutableAttributedString *)toGetAttributedStringWithFont:(UIFont *)font withLineSpacing:(CGFloat)lineSpacing text:(NSString *)text{ + NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:font}]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:lineSpacing]; + [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; + [attr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])]; + return attr; +} + + +- (CGFloat)widthWithsysFont:(CGFloat)font{ + NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:font], NSFontAttributeName, nil]; + CGRect rect = [self boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil]; + return rect.size.width; +} +- (CGFloat)widthWithBordFont:(CGFloat)font{ + NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:font], NSFontAttributeName, nil]; + CGRect rect = [self boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil]; + return rect.size.width; +} ++ (CGFloat)HeightWithHtlm5Str:(NSString *)htlmStr width:(CGFloat)width{ + UILabel *lab= [[UILabel alloc]init]; + NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htlmStr dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil]; + lab.attributedText = attrStr; + return [lab sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height; +} ++ (NSString*)newlineReplacingjson:(NSString*)strJson{ + NSString *strDoctorBrief = [strJson stringByReplacingOccurrencesOfString:@"
" withString:@"\r\n"]; + strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"
" withString:@"\n\r"]; + strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"
" withString:@"\n"]; + strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"
" withString:@"\r"]; + strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"}" withString:@"}
"]; + strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"{" withString:@"{
"]; + return strDoctorBrief; +} + +- (NSMutableAttributedString *)setAttributeWithLab:(UILabel *)label LineSpacing:(CGFloat)lineSpacing{ + NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:self]; + NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; + paragraphStyle.alignment = NSTextAlignmentJustified; + paragraphStyle.lineSpacing = lineSpacing - (label.font.lineHeight - label.font.pointSize); + NSRange range = NSMakeRange(0, attrStr.length); + [attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; + return attrStr; +} + +-(NSString *)toGetAgeByBornDate{ + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDate *nowDate = [NSDate date]; + NSString *date_format = @"yyyy-MM-dd"; + NSDate *bornDate = [NSDate ih_dateWithString:self format:date_format]; + unsigned int unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; + NSDateComponents *date = [calendar components:unitFlags fromDate:bornDate toDate:nowDate options:0]; + if([date year] >0){ + return [NSString stringWithFormat:(@"%ld岁"), (long)[date year]]; + }else { + return @"0岁"; + } +} +- (CGFloat)toGetRectLab:(UILabel *)lable WithWidth:(CGFloat)widthFloat{ + return [lable.attributedText boundingRectWithSize:CGSizeMake(widthFloat, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size.height; +} +- (BOOL)hasSubString:(NSString *)subString{ + if (!subString) { + return NO; + } + return [self rangeOfString:subString].location!=NSNotFound; +} + + + +- (void)toSetAttributeWithLable:(UILabel *)lable Title:(NSString *)title TitleColor:(UIColor *)titleColor TitleFont:(UIFont *)titleFont + ContentText:(NSString *)contentText ContentColor:(UIColor *)ContentColor ContentFont:(UIFont *)ContentFont +{ + title = title ? title : @""; + contentText = contentText ? contentText : @""; + titleColor = titleColor ? titleColor : [UIColor blackColor]; + ContentColor = ContentColor ? ContentColor : [UIColor blackColor]; + titleFont = titleFont ? titleFont : SYSTEMFONT(14); + ContentFont = ContentFont ? ContentFont : SYSTEMFONT(14); + + NSString *muText = [NSString stringWithFormat:@"%@%@", title, contentText]; + NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:muText]; + [attrStr addAttribute:NSFontAttributeName value:titleFont range:NSMakeRange(0, title.length)]; + [attrStr addAttribute:NSFontAttributeName value:ContentFont range:NSMakeRange(attrStr.length - contentText.length, contentText.length)]; + [attrStr addAttribute:NSForegroundColorAttributeName value:titleColor range:NSMakeRange(0, title.length)]; + [attrStr addAttribute:NSForegroundColorAttributeName value:ContentColor range:NSMakeRange(attrStr.length - contentText.length, contentText.length)]; + lable.attributedText = attrStr; +} + ++ (NSAttributedString *)toGetStrWithHtmlStr:(NSString *)string{ + NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithData:[string dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:[NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:nil error:nil]; + [attrStr addAttribute:NSFontAttributeName value:SYSTEMFONT(14) range:NSMakeRange(0, attrStr.length)]; + [attrStr addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x666666) range:NSMakeRange(0, attrStr.length)]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:5]; + [attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attrStr.length)]; + return attrStr; +} + ++ (NSMutableAttributedString *)setEquipmentAttributedString:(NSString *)str{ + str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@"
"]; + str = [NSString stringWithFormat:@"%@", WIDTH - 30, str]; + NSMutableAttributedString *htmlString =[[NSMutableAttributedString alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:[NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:NULL error:nil]; + [htmlString addAttributes:@{NSFontAttributeName:SYSTEMFONT(14)} range:NSMakeRange(0, htmlString.length)]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:5]; + [htmlString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [htmlString length])]; + return htmlString; +} + ++ (CGFloat )getHTMLHeightByStr:(NSString *)str{ + str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@"
"]; + str = [NSString stringWithFormat:@"%@", [UIScreen mainScreen].bounds.size.width, str]; + NSMutableAttributedString *htmlString =[[NSMutableAttributedString alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:[NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:NULL error:nil]; + [htmlString addAttributes:@{NSFontAttributeName:SYSTEMFONT(14)} range:NSMakeRange(0, htmlString.length)]; + //设置行间距 + NSMutableParagraphStyle *paragraphStyle1 = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle1 setLineSpacing:5]; + [htmlString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [htmlString length])]; + CGSize textSize = [htmlString boundingRectWithSize:(CGSize){WIDTH - 30, CGFLOAT_MAX} options:NSStringDrawingUsesLineFragmentOrigin context:nil].size; + return textSize.height ; +} + ++ (NSString *)toGetTimeText:(NSString *)timeText{ + NSDate *date = [NSDate ih_dateWithString:timeText format:ih_default_date_format]; + NSDate *curDate = [NSDate date]; + if (date) { + if ([curDate ih_secondTimeAwayFromDate:date] < 1) { + return @"刚刚"; + } + if ([curDate ih_minuteTimeAwayFromDate:date] < 1) { + int second = [curDate ih_secondTimeAwayFromDate:date]; + return [NSString stringWithFormat:@"%d秒前", second]; + } + if ([curDate ih_hourTimeAwayFromDate:date] < 1) { + int minute = [curDate ih_minuteTimeAwayFromDate:date]; + return [NSString stringWithFormat:@"%d分钟前", minute]; + } + if ([date isToday]){ + return [NSString stringWithFormat:@"今天%02zd:%02zd", date.hour, date.minute]; + } + if ([date isYesterday]) { + return [NSString stringWithFormat:@"昨天%02zd:%02zd", date.hour, date.minute]; + } + return [NSString stringWithFormat:@"%02zd.%02zd.%02zd", date.year, date.month, date.day]; + } return @" "; +} + ++ (NSString *)UIImageToBase64Str:(UIImage *) image{ + NSData *data = UIImageJPEGRepresentation(image, 1.0f); + NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; + return encodedImageStr; +} + + ++ (NSString *)toGetTimeTextByEndOfTheMinute:(NSString *)time{ + NSDate *date = [NSDate ih_dateWithString:time format:ih_default_date_format]; + NSDateFormatter *format = [[NSDateFormatter alloc] init]; + [format setDateFormat:@"YYYY-MM-dd HH:mm"]; + NSString *currentTimeString = [format stringFromDate:date]; + return currentTimeString; +} + +- (NSString *)MD5_32BIT { + const char *cStr = [self UTF8String]; + unsigned char digest[CC_MD5_DIGEST_LENGTH]; + CC_MD5( cStr, (CC_LONG)self.length, digest ); + NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; + for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) + [result appendFormat:@"%02X", digest[i]]; + return result; +} +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+HXExtension.h b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+HXExtension.h new file mode 100644 index 0000000..a94783e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+HXExtension.h @@ -0,0 +1,14 @@ +// +// UIButton+HXExtension.h +// HXPhotoPickerExample +// +// Created by Silence on 17/2/16. +// Copyright © 2017年 Silence. All rights reserved. +// + +#import + +@interface UIButton (HXExtension) +/** 扩大buuton点击范围 */ +- (void)hx_setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left; +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+HXExtension.m b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+HXExtension.m new file mode 100644 index 0000000..15691a5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+HXExtension.m @@ -0,0 +1,53 @@ +// +// UIButton+HXExtension.m +// HXPhotoPickerExample +// +// Created by Silence on 17/2/16. +// Copyright © 2017年 Silence. All rights reserved. +// + +#import "UIButton+HXExtension.h" +#import + +@implementation UIButton (HXExtension) + +static char topNameKey; +static char rightNameKey; +static char bottomNameKey; +static char leftNameKey; + +- (void)hx_setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left +{ + objc_setAssociatedObject(self, &topNameKey, [NSNumber numberWithFloat:top], OBJC_ASSOCIATION_COPY_NONATOMIC); + objc_setAssociatedObject(self, &rightNameKey, [NSNumber numberWithFloat:right], OBJC_ASSOCIATION_COPY_NONATOMIC); + objc_setAssociatedObject(self, &bottomNameKey, [NSNumber numberWithFloat:bottom], OBJC_ASSOCIATION_COPY_NONATOMIC); + objc_setAssociatedObject(self, &leftNameKey, [NSNumber numberWithFloat:left], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + + +- (CGRect)enlargedRect{ + NSNumber* topEdge = objc_getAssociatedObject(self, &topNameKey); + NSNumber* rightEdge = objc_getAssociatedObject(self, &rightNameKey); + NSNumber* bottomEdge = objc_getAssociatedObject(self, &bottomNameKey); + NSNumber* leftEdge = objc_getAssociatedObject(self, &leftNameKey); + + if (topEdge && rightEdge && bottomEdge && leftEdge){ + return CGRectMake(self.bounds.origin.x - leftEdge.floatValue, + self.bounds.origin.y - topEdge.floatValue, + self.bounds.size.width + leftEdge.floatValue + rightEdge.floatValue, + self.bounds.size.height + topEdge.floatValue + bottomEdge.floatValue); + } else{ + return self.bounds; + } +} + +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{ + CGRect rect = [self enlargedRect]; + + if (CGRectEqualToRect(rect, self.bounds)){ + return [super pointInside:point withEvent:event]; + }else{ + return CGRectContainsPoint(rect, point); + } +} +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+NYS.h b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+NYS.h new file mode 100644 index 0000000..3cc7d33 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+NYS.h @@ -0,0 +1,41 @@ +// +// UIButton+NYS.h +// NewAnju_IOS +// +// Created by 倪永胜 on 2020/5/26. +// Copyright © 2020 NiYongsheng. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +typedef NS_ENUM(NSInteger, DIYStyle) { + DIYStyleDefault = 0, // 左图右文,整体居中,默认状态 + DIYStyleImgLeft = 1, // 左图右文,整体居中,设置间隙 + DIYStyleImgRight = 2, // 左文右图,整体居中,设置间隙 + DIYStyleImgTop = 3, // 上图下文,整体居中,设置间隙 + DIYStyleImgBottom = 4, // 下图上文,整体居中,设置间隙 +}; + + + +@interface UIButton (NYS) +- (void)enlargeTouchEdge:(UIEdgeInsets)edge; + +/** style:图文样式 padding:图文间隙 */ +- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding; +- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding; + +/** style:图文样式 padding:图文间隙 size:设置图片的宽高 */ +- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size; + +- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding titleWidth:(CGFloat)titleWidth; + +- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size titleWidth:(CGFloat)titleWidth; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+NYS.m b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+NYS.m new file mode 100644 index 0000000..51b8e48 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIButton/UIButton+NYS.m @@ -0,0 +1,309 @@ +// +// UIButton+NYS.m +// NewAnju_IOS +// +// Created by 倪永胜 on 2020/5/26. +// Copyright © 2020 NiYongsheng. All rights reserved. +// + +#import "UIButton+NYS.h" +#import + +@interface UIButton () + +@property(nonatomic,strong)UILabel *badgeLabel; + +@end + +@implementation UIButton (NYS) + +static char edgeKey; + +- (NSString *)enlargeEdge { + return objc_getAssociatedObject(self, &edgeKey); +} + +- (void)enlargeTouchEdge:(UIEdgeInsets)edge { + NSString *edgeStr = NSStringFromUIEdgeInsets(edge); + objc_setAssociatedObject(self, &edgeKey, edgeStr, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { + UIEdgeInsets changeInsets = UIEdgeInsetsFromString([self enlargeEdge]); + CGFloat x = self.bounds.origin.x + changeInsets.left; + CGFloat y = self.bounds.origin.y + changeInsets.top; + CGFloat width = self.bounds.size.width - changeInsets.left - changeInsets.right; + CGFloat height = self.bounds.size.height - changeInsets.top - changeInsets.bottom; + CGRect rect = CGRectMake(x, y, width, height); + + if (CGRectEqualToRect(rect, self.bounds)) { + return [super hitTest:point withEvent:event]; + } + return CGRectContainsPoint(rect, point) ? self : nil; +} + + +- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size titleWidth:(CGFloat)titleWidth +{ + if (self.imageView.image != nil && self.titleLabel.text != nil) + { + // 先还原 + self.titleEdgeInsets = UIEdgeInsetsZero; + self.imageEdgeInsets = UIEdgeInsetsZero; + [self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; + + self.imageView.width=size.width; + self.imageView.height=size.height; + // 上图下文或者上文下图情况重新计算高 + CGFloat imageX = self.imageView.mj_x; + CGFloat titleX = self.titleLabel.mj_x; + CGFloat imageY = self.imageView.mj_y; + CGFloat titleY = self.titleLabel.mj_y; + CGFloat imageW = self.imageView.width; + CGFloat titleW = titleWidth; + CGFloat imageH = self.imageView.height; + CGFloat titleH = self.titleLabel.height; + CGFloat totalH = imageH + titleH + padding; + CGFloat selfH = self.height; + CGFloat selfW = self.width; + + switch (style) + { + case DIYStyleImgLeft: + self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0); + self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0); + break; + + case DIYStyleImgRight: + self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0)); + break; + + case DIYStyleImgTop: + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY), + -(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 + imageH + padding - titleY), + (titleX + titleW/2.0 - selfW/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + case DIYStyleImgBottom: + NSLog(@"%f",titleX); + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY), + -(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 - titleY), + (titleX + titleW/2.0 - selfW/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 + titleH + padding - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + default: + break; + } + } +} +//设置图片的宽高 +- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size +{ + if (self.imageView.image != nil && self.titleLabel.text != nil) + { + // 先还原 + self.titleEdgeInsets = UIEdgeInsetsZero; + self.imageEdgeInsets = UIEdgeInsetsZero; + [self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; + self.contentMode = UIViewContentModeCenter; + self.imageView.width=size.width; + self.imageView.height=size.height; + // 上图下文或者上文下图情况重新计算高 + CGFloat imageX = self.imageView.mj_x; + CGFloat titleX = self.titleLabel.mj_x; + CGFloat imageY = self.imageView.mj_y; + CGFloat titleY = self.titleLabel.mj_y; + CGFloat imageW = self.imageView.width; + CGFloat titleW = self.titleLabel.width; + CGFloat imageH = self.imageView.height; + CGFloat titleH = self.titleLabel.height; + CGFloat totalH = imageH + titleH + padding; + CGFloat selfH = self.height; + CGFloat selfW = self.width; + + switch (style) + { + case DIYStyleImgLeft: + self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0); + self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0); + break; + + case DIYStyleImgRight: + self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0)); + break; + + case DIYStyleImgTop: + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY), + -2*(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 + imageH + padding - titleY), + 0); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY), + (selfW/2.0 - imageX - imageW/2.0) + kRealValue(6), + -((selfH - totalH)/2.0 - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + case DIYStyleImgBottom: + NSLog(@"%f",titleX); + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY), + -(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 - titleY), + (titleX + titleW/2.0 - selfW/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 + titleH + padding - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + default: + break; + } + } + +} + +- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding +{ + if (self.imageView.image != nil && self.titleLabel.text != nil) + { + // 先还原 + self.titleEdgeInsets = UIEdgeInsetsZero; + self.imageEdgeInsets = UIEdgeInsetsZero; + [self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; + + // 上图下文或者上文下图情况重新计算高 + CGFloat imageX = self.imageView.mj_x; + CGFloat titleX = self.titleLabel.mj_x; + CGFloat imageY = self.imageView.mj_y; + CGFloat titleY = self.titleLabel.mj_y; + CGFloat imageW = self.imageView.width; + CGFloat titleW = self.titleLabel.width; + CGFloat imageH = self.imageView.height; + CGFloat titleH = self.titleLabel.height; + CGFloat totalH = imageH + titleH + padding; + CGFloat selfH = self.height; + CGFloat selfW = self.width; + + switch (style) + { + case DIYStyleImgLeft: + self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0); + self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0); + break; + + case DIYStyleImgRight: + self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0)); + break; + + case DIYStyleImgTop: + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY), + -2*(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 + imageH + padding - titleY), + 0); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + case DIYStyleImgBottom: + NSLog(@"%f",titleX); + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY), + -(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 - titleY), + (titleX + titleW/2.0 - selfW/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 + titleH + padding - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + default: + break; + } + } +} + + +- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding { + [self setDIYStyle:style padding:padding]; +} + +- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding titleWidth:(CGFloat)titleWidth +{ + if (self.imageView.image != nil && self.titleLabel.text != nil) + { + // 先还原 + self.titleEdgeInsets = UIEdgeInsetsZero; + self.imageEdgeInsets = UIEdgeInsetsZero; + [self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; + self.contentMode=UIViewContentModeCenter; + // 上图下文或者上文下图情况重新计算高 + CGFloat imageX = self.imageView.mj_x; + CGFloat titleX = self.titleLabel.mj_x; + CGFloat imageY = self.imageView.mj_y; + CGFloat titleY = self.titleLabel.mj_y; + CGFloat imageW = self.imageView.width; + CGFloat titleW = titleWidth; + CGFloat imageH = self.imageView.height; + CGFloat titleH = self.titleLabel.height; + CGFloat totalH = imageH + titleH + padding; + CGFloat selfH = self.height; + CGFloat selfW = self.width; + + switch (style) + { + case DIYStyleImgLeft: + self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0); + self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0); + break; + + case DIYStyleImgRight: + self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0)); + break; + + case DIYStyleImgTop: + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY), + -(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 + imageH + padding - titleY), + (titleX + titleW/2.0 - selfW/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + case DIYStyleImgBottom: + NSLog(@"%f",titleX); + self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY), + -(titleX + titleW/2.0 - selfW/2.0), + -((selfH - totalH)/2.0 - titleY), + (titleX + titleW/2.0 - selfW/2.0)); + self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY), + (selfW/2.0 - imageX - imageW/2.0), + -((selfH - totalH)/2.0 + titleH + padding - imageY), + -(selfW/2.0 - imageX - imageW/2.0)); + break; + + default: + break; + } + } +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UIDevice/UIDevice+model.h b/XinjiangProject/XinjiangProject/Categorys/UIDevice/UIDevice+model.h new file mode 100644 index 0000000..e481868 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIDevice/UIDevice+model.h @@ -0,0 +1,18 @@ +// +// UIDevice+model.h +// EscortProject +// +// Created by Apple on 2024/3/29. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UIDevice (model) + +- (NSString *)getCurrentDeviceModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/UIDevice/UIDevice+model.m b/XinjiangProject/XinjiangProject/Categorys/UIDevice/UIDevice+model.m new file mode 100644 index 0000000..487561f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIDevice/UIDevice+model.m @@ -0,0 +1,115 @@ +// +// UIDevice+model.m +// EscortProject +// +// Created by Apple on 2024/3/29. +// + +#import "UIDevice+model.h" +#import + +//有新的产品上线,我没有更新,可以自行去查阅https://www.theiphonewiki.com/wiki/Models +@implementation UIDevice (model) + +- (NSString *)getCurrentDeviceModel{ + struct utsname systemInfo; + uname(&systemInfo); + + NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding]; + + +if ([deviceModel isEqualToString:@"iPhone3,1"]) return @"iPhone 4"; +if ([deviceModel isEqualToString:@"iPhone3,2"]) return @"iPhone 4"; +if ([deviceModel isEqualToString:@"iPhone3,3"]) return @"iPhone 4"; +if ([deviceModel isEqualToString:@"iPhone4,1"]) return @"iPhone 4S"; +if ([deviceModel isEqualToString:@"iPhone5,1"]) return @"iPhone 5"; +if ([deviceModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)"; +if ([deviceModel isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)"; +if ([deviceModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)"; +if ([deviceModel isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)"; +if ([deviceModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)"; +if ([deviceModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus"; +if ([deviceModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6"; +if ([deviceModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s"; +if ([deviceModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus"; +if ([deviceModel isEqualToString:@"iPhone8,4"]) return @"iPhone SE"; +// 日行两款手机型号均为日本独占,可能使用索尼FeliCa支付方案而不是苹果支付 +if ([deviceModel isEqualToString:@"iPhone9,1"]) return @"iPhone 7"; +if ([deviceModel isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus"; +if ([deviceModel isEqualToString:@"iPhone9,3"]) return @"iPhone 7"; +if ([deviceModel isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus"; +if ([deviceModel isEqualToString:@"iPhone10,1"]) return @"iPhone_8"; +if ([deviceModel isEqualToString:@"iPhone10,4"]) return @"iPhone_8"; +if ([deviceModel isEqualToString:@"iPhone10,2"]) return @"iPhone_8_Plus"; +if ([deviceModel isEqualToString:@"iPhone10,5"]) return @"iPhone_8_Plus"; +if ([deviceModel isEqualToString:@"iPhone10,3"]) return @"iPhone X"; +if ([deviceModel isEqualToString:@"iPhone10,6"]) return @"iPhone X"; +if ([deviceModel isEqualToString:@"iPhone11,8"]) return @"iPhone XR"; +if ([deviceModel isEqualToString:@"iPhone11,2"]) return @"iPhone XS"; +if ([deviceModel isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max"; +if ([deviceModel isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max"; +if ([deviceModel isEqualToString:@"iPhone12,1"]) return @"iPhone 11"; +if ([deviceModel isEqualToString:@"iPhone12,3"]) return @"iPhone 11 Pro"; +if ([deviceModel isEqualToString:@"iPhone12,5"]) return @"iPhone 11 Pro Max"; +if ([deviceModel isEqualToString:@"iPhone12,8"]) return @"iPhone SE2"; +if ([deviceModel isEqualToString:@"iPhone13,1"]) return @"iPhone 12 mini"; +if ([deviceModel isEqualToString:@"iPhone13,2"]) return @"iPhone 12"; +if ([deviceModel isEqualToString:@"iPhone13,3"]) return @"iPhone 12 Pro"; +if ([deviceModel isEqualToString:@"iPhone13,4"]) return @"iPhone 12 Pro Max"; +if ([deviceModel isEqualToString:@"iPhone14,4"]) return @"iPhone 13 mini"; +if ([deviceModel isEqualToString:@"iPhone14,5"]) return @"iPhone 13"; +if ([deviceModel isEqualToString:@"iPhone14,2"]) return @"iPhone 13 Pro"; +if ([deviceModel isEqualToString:@"iPhone14,3"]) return @"iPhone 13 Pro Max"; +if ([deviceModel isEqualToString:@"iPhone14,7"]) return @"iPhone 14"; +if ([deviceModel isEqualToString:@"iPhone14,8"]) return @"iPhone 14 Plus"; +if ([deviceModel isEqualToString:@"iPhone15,2"]) return @"iPhone 14 Pro"; +if ([deviceModel isEqualToString:@"iPhone15,3"]) return @"iPhone 14 Pro Max"; +if ([deviceModel isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G"; +if ([deviceModel isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G"; +if ([deviceModel isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G"; +if ([deviceModel isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G"; +if ([deviceModel isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)"; +if ([deviceModel isEqualToString:@"iPad1,1"]) return @"iPad"; +if ([deviceModel isEqualToString:@"iPad1,2"]) return @"iPad 3G"; +if ([deviceModel isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)"; +if ([deviceModel isEqualToString:@"iPad2,2"]) return @"iPad 2"; +if ([deviceModel isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)"; +if ([deviceModel isEqualToString:@"iPad2,4"]) return @"iPad 2"; +if ([deviceModel isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)"; +if ([deviceModel isEqualToString:@"iPad2,6"]) return @"iPad Mini"; +if ([deviceModel isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)"; +if ([deviceModel isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)"; +if ([deviceModel isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)"; +if ([deviceModel isEqualToString:@"iPad3,3"]) return @"iPad 3"; +if ([deviceModel isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)"; +if ([deviceModel isEqualToString:@"iPad3,5"]) return @"iPad 4"; +if ([deviceModel isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)"; +if ([deviceModel isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)"; +if ([deviceModel isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)"; +if ([deviceModel isEqualToString:@"iPad4,4"]) return @"iPad Mini 2 (WiFi)"; +if ([deviceModel isEqualToString:@"iPad4,5"]) return @"iPad Mini 2 (Cellular)"; +if ([deviceModel isEqualToString:@"iPad4,6"]) return @"iPad Mini 2"; +if ([deviceModel isEqualToString:@"iPad4,7"]) return @"iPad Mini 3"; +if ([deviceModel isEqualToString:@"iPad4,8"]) return @"iPad Mini 3"; +if ([deviceModel isEqualToString:@"iPad4,9"]) return @"iPad Mini 3"; +if ([deviceModel isEqualToString:@"iPad5,1"]) return @"iPad Mini 4 (WiFi)"; +if ([deviceModel isEqualToString:@"iPad5,2"]) return @"iPad Mini 4 (LTE)"; +if ([deviceModel isEqualToString:@"iPad5,3"]) return @"iPad Air 2"; +if ([deviceModel isEqualToString:@"iPad5,4"]) return @"iPad Air 2"; +if ([deviceModel isEqualToString:@"iPad6,3"]) return @"iPad Pro 9.7"; +if ([deviceModel isEqualToString:@"iPad6,4"]) return @"iPad Pro 9.7"; +if ([deviceModel isEqualToString:@"iPad6,7"]) return @"iPad Pro 12.9"; +if ([deviceModel isEqualToString:@"iPad6,8"]) return @"iPad Pro 12.9"; + +if ([deviceModel isEqualToString:@"AppleTV2,1"]) return @"Apple TV 2"; +if ([deviceModel isEqualToString:@"AppleTV3,1"]) return @"Apple TV 3"; +if ([deviceModel isEqualToString:@"AppleTV3,2"]) return @"Apple TV 3"; +if ([deviceModel isEqualToString:@"AppleTV5,3"]) return @"Apple TV 4"; + +if ([deviceModel isEqualToString:@"i386"]) return @"Simulator"; +if ([deviceModel isEqualToString:@"x86_64"]) return @"Simulator"; + return deviceModel; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UIImage+RoundedCorner.h b/XinjiangProject/XinjiangProject/Categorys/UIImage+RoundedCorner.h new file mode 100644 index 0000000..bb23801 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIImage+RoundedCorner.h @@ -0,0 +1,16 @@ +// +// UIImage+RoundedCorner.h +// EscortProject +// +// Created by Apple on 2024/4/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UIImage (RoundedCorner) +- (UIImage *)roundCornersWithRadius:(NSInteger)radius; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/UIImage+RoundedCorner.m b/XinjiangProject/XinjiangProject/Categorys/UIImage+RoundedCorner.m new file mode 100644 index 0000000..ade1a26 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIImage+RoundedCorner.m @@ -0,0 +1,34 @@ +// +// UIImage+RoundedCorner.m +// EscortProject +// +// Created by Apple on 2024/4/24. +// + +#import "UIImage+RoundedCorner.h" + +@implementation UIImage (RoundedCorner) + +- (UIImage *)roundCornersWithRadius:(NSInteger)radius { + UIImage *inputImage = self; + CGImageRef image = inputImage.CGImage; + + CGRect imageRect = CGRectMake(0, 0, inputImage.size.width, inputImage.size.height); + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:imageRect cornerRadius:radius]; + + CGContextRef context = CGBitmapContextCreate(NULL, inputImage.size.width, inputImage.size.height, 8, 0, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast); + CGContextBeginPath(context); + CGContextAddPath(context, path.CGPath); + CGContextClip(context); + + CGContextDrawImage(context, imageRect, image); + CGImageRef ref = CGBitmapContextCreateImage(context); + UIImage *outputImage = [UIImage imageWithCGImage:ref]; + + CGContextRelease(context); + CGImageRelease(ref); + + return outputImage; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.h b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.h new file mode 100644 index 0000000..dcf3821 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.h @@ -0,0 +1,31 @@ +// +// UILabel+ChangeLineSpaceAndWordSpace.h +// healthQuestion +// +// Created by 仁康信息 on 2022/10/11. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UILabel (ChangeLineSpaceAndWordSpace) + +/** + * 改变行间距 + */ ++ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space; + +/** + * 改变字间距 + */ ++ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space; + +/** + * 改变行间距和字间距 + */ ++ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.m b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.m new file mode 100644 index 0000000..b19a5d1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.m @@ -0,0 +1,42 @@ +// +// UILabel+ChangeLineSpaceAndWordSpace.m +// healthQuestion +// +// Created by 仁康信息 on 2022/10/11. +// + +#import "UILabel+ChangeLineSpaceAndWordSpace.h" + + +@implementation UILabel (ChangeLineSpaceAndWordSpace) + ++ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space { + NSString *labelText = label.text; + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:space]; + [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])]; + label.attributedText = attributedString; + [label sizeToFit]; +} + ++ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space { + NSString *labelText = label.text; + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(space)}]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])]; + label.attributedText = attributedString; + [label sizeToFit]; +} + ++ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace { + NSString *labelText = label.text; + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(wordSpace)}]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:lineSpace]; + [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])]; + label.attributedText = attributedString; + [label sizeToFit]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+Extension.h b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+Extension.h new file mode 100644 index 0000000..54087ad --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+Extension.h @@ -0,0 +1,16 @@ +// +// UILabel+Extension.h +// WDYAdjustFontSize +// +// Created by wdyzmx on 2022/1/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UILabel (Extension) +@property (nonatomic) NSString *verticalText; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+Extension.m b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+Extension.m new file mode 100644 index 0000000..4a87362 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UILabel/UILabel+Extension.m @@ -0,0 +1,62 @@ +// +// UILabel+Extension.m +// WDYAdjustFontSize +// +// Created by wdyzmx on 2022/1/19. +// + +#import "UILabel+Extension.h" +#import "SwapMethodManager.h" +#import + +@implementation UILabel (Extension) + ++ (void)load { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + [SwapMethodManager swapMethodInClass:[self class] originalMethod:@selector(didMoveToSuperview) swizzledMethod:@selector(hooked_didMoveToSuperview)]; + + [SwapMethodManager swapMethodInClass:[self class] originalMethod:@selector(removeFromSuperview) swizzledMethod:@selector(hooked_removeFromSuperview)]; + + [SwapMethodManager swapMethodInClass:[self class] originalMethod:@selector(setAttributedText:) swizzledMethod:@selector(hooked_setAttributedText:)]; + }); +} + +- (void)hooked_didMoveToSuperview { + [self hooked_didMoveToSuperview]; + // 添加控件 +} + +- (void)hooked_removeFromSuperview { + [self hooked_removeFromSuperview]; + // 删除控件 +} + +- (void)hooked_setAttributedText:(NSAttributedString *)attributedText { + [self hooked_setAttributedText:attributedText]; + // +} + + + +- (NSString *)verticalText +{ +// 利用runtime 添加属性- (void)setVerticalText:(NSString *)verticalText +return objc_getAssociatedObject(self, @selector(verticalText)); + +} + + +- (void)setVerticalText:(NSString *)verticalText +{ +objc_setAssociatedObject(self, &verticalText, verticalText, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +NSMutableString *mutableString = [[NSMutableString alloc] initWithString:verticalText]; +NSInteger count = mutableString.length; +for (int i = 1; i < count; i++) { +[mutableString insertString:@"\n" atIndex:i * 2 - 1]; +} +self.text = mutableString; +self.numberOfLines = 0; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Categorys/UIView/UIView+FK.h b/XinjiangProject/XinjiangProject/Categorys/UIView/UIView+FK.h new file mode 100755 index 0000000..1093f44 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIView/UIView+FK.h @@ -0,0 +1,25 @@ +// +// UIView+FK.h +// Doctor +// +// Created by 张正梅 on 2019/5/30. +// Copyright © 2019 com.longmaster. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UIView (FK) + +- (UIView *)clipCornerWithView:(UIView *)originView + andTopLeft:(BOOL)topLeft + andTopRight:(BOOL)topRight + andBottomLeft:(BOOL)bottomLeft + andBottomRight:(BOOL)bottomRight; +- (void)MaskLayerByRedius:(CGFloat)cornerRedius ByColor:(UIColor *)color ByWidth:(CGFloat)width; +- (void)MaskToBounds:(CGFloat)cornerRedius; +- (UIViewController *)viewController; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Categorys/UIView/UIView+FK.m b/XinjiangProject/XinjiangProject/Categorys/UIView/UIView+FK.m new file mode 100755 index 0000000..d46e18b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Categorys/UIView/UIView+FK.m @@ -0,0 +1,55 @@ +// +// UIView+FK.m +// Doctor +// +// Created by 张正梅 on 2019/5/30. +// Copyright © 2019 com.longmaster. All rights reserved. +// + +#import "UIView+FK.h" + +@implementation UIView (FK) + +- (UIView *)clipCornerWithView:(UIView *)originView + andTopLeft:(BOOL)topLeft + andTopRight:(BOOL)topRight + andBottomLeft:(BOOL)bottomLeft + andBottomRight:(BOOL)bottomRight +{ + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:originView.bounds + byRoundingCorners:(topLeft==YES ? UIRectCornerTopLeft : 0) | + (topRight==YES ? UIRectCornerTopRight : 0) | + (bottomLeft==YES ? UIRectCornerBottomLeft : 0) | + (bottomRight==YES ? UIRectCornerBottomRight : 0) + cornerRadii:CGSizeMake(20, 20)]; + // 创建遮罩层 + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = originView.bounds; + maskLayer.path = maskPath.CGPath; // 轨迹 + originView.layer.mask = maskLayer; + + return originView; +} + +- (void)MaskLayerByRedius:(CGFloat)cornerRedius ByColor:(UIColor *)color ByWidth:(CGFloat)width{ + [self MaskToBounds:cornerRedius]; + self.layer.borderColor = color.CGColor; + self.layer.borderWidth = width; +} +- (void)MaskToBounds:(CGFloat)cornerRedius{ + self.layer.masksToBounds = YES; + self.layer.cornerRadius = cornerRedius; +} + +- (UIViewController *)viewController{ + UIResponder *next = [self nextResponder]; + do { + if ([next isKindOfClass:[UIViewController class]]) { + return (UIViewController *)next; + }else{ + next = [next nextResponder]; + } + } while (next != nil); + return nil; +} +@end diff --git a/XinjiangProject/XinjiangProject/Define/FontAndColorMacros.h b/XinjiangProject/XinjiangProject/Define/FontAndColorMacros.h new file mode 100755 index 0000000..469c8dc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Define/FontAndColorMacros.h @@ -0,0 +1,58 @@ +// +// FontAndColorMacros.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +// + +#ifndef FontAndColorMacros_h +#define FontAndColorMacros_h + +#pragma mark - 间距区 + +//默认间距 +#define KNormalSpace 12.0f + +#pragma mark - 颜色区 +//主题色 导航栏颜色 +//#define CNavBgColor RGBA() +#define CNavBgColor [UIColor colorWithHexString:@"00AE68"] + + +//#define CNavBgColor [Ulor colorWithHexString:@"ffffff"] +#define CNavBgFontColor [UIColor colorWithHexString:@"ffffff"] + +//默认页面背景色 +#define CViewBgColor [UIColor colorWithHexString:@"#F3F4F6"] + +//分割线颜色 +#define CLineColor [UIColor colorWithHexString:@"ededed"] + +//次级字色 +#define CFontColor1 [UIColor colorWithHexString:@"1f1f1f"] + +//再次级字色 +#define CFontColor2 [UIColor colorWithHexString:@"5c5c5c"] +#define kRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0] + +#pragma mark - 第三方字体区 + + + +//十进制颜色转换 +#define QMRGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a] +//十六进制颜色转换(0xFFFFFF) +#define QMHEXRGB(hex) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16))/255.0 green:((float)((hex & 0xFF00) >> 8))/255.0 blue:((float)(hex & 0xFF))/255.0 alpha:1.0] + +#define QMHEXSRGB(hexStr) [UIColor colorWithRed:strtoul([[hexStr substringWithRange:NSMakeRange(hexStr.length - 6, 2)] UTF8String],0,16)/255.0 green:strtoul([[hexStr substringWithRange:NSMakeRange(hexStr.length - 4, 2)] UTF8String],0,16)/255.0 blue:strtoul([[hexStr substringWithRange:NSMakeRange(hexStr.length - 2, 2)] UTF8String],0,16)/255.0 alpha:1.0] + +#ifndef kScale6 + +#define kScale6 (UIScreen.mainScreen.bounds.size.width/375.0) + +#endif + +#define FFont1 [UIFont systemFontOfSize:12.0f] + +#endif /* FontAndColorMacros_h */ diff --git a/XinjiangProject/XinjiangProject/Define/StatusMacros.h b/XinjiangProject/XinjiangProject/Define/StatusMacros.h new file mode 100755 index 0000000..1fffed9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Define/StatusMacros.h @@ -0,0 +1,93 @@ +// +// StatusMacros.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +// + +#ifndef StatusMacros_h +#define StatusMacros_h +#pragma mark - ——————— 用户相关 ———————— +//登录状态改变通知 +#define KNotificationLoginStateChange @"loginStateChange" +//登录IM状态 +#define KNotificationLoginIMResult @"loginIMResult" + +//切换tabar +#define KNotificSelectHomePageTabbar @"SlectHomePageTabBar" + +#define KNotificSelectSoSTabbar @"SlectSoSTabBar" + +#define KNotificSelectPhysicalTabbar @"SlectPhysicalTabBar" + +#define KNotificSelectFileTabbar @"SlectFileTabBar" + +//同意协议 + +//切换字体 +#define KNotificChangeFontSize @"changeFontSize" +//经纬度 +#define USERDEFAULLONG @"USERDEFAULLONG" +#define USERDEFAULLATITUDE @"USERDEFAULLATITUDE" + + +//自动登录成功 +#define KNotificationAutoLoginSuccess @"KNotificationAutoLoginSuccess" + + +//用户信息缓存 名称 +#define KUserCacheName @"KUserCacheName" + + +//用户model缓存 +#define KUserModelCache @"KUserModelCache" + +//是否第一次进入 选用 +#define KUserFirstStar @"FirstStar" + +//健康信息token +#define KHEALTHTOKEN @"HEALTHTOKEN" + +#define User_ID [HQCommonUtils loginID] +#define User_Token [HQCommonUtils loginToken] +#pragma mark - ——————— 网络状态相关 ———————— + +//网络状态变化 +#define KNotificationNetWorkStateChange @"KNotificationNetWorkStateChange" + +#define KNotificAmapAgreeProtoocl @"AMAPDELEGATE" + +//取消支付 + +#pragma mark: 网络前缀 +#define ResourceAddress [NSString stringWithFormat:@"%@/file/show/",Http] + +//生产环境 +//#define Http @"https://api.cqygjk.com"// +//#define H5Http @"https://console.cqygjk.com/"/// +//#define H5DevHost @"cqyt.out.yg.icdat.cn"// +//#define IntervenH5 @"https://console.cqygjk.com" + +//#define Http UserDefaultObjectForKey(@"HTTPS")// +//#define H5DevHost UserDefaultObjectForKey(@"H5DevHost")// +//#define IntervenH5 UserDefaultObjectForKey(@"IntervenH5") + +//测试环境地址 +//四合一 +//正文斌 @"http://192.168.1.28"。青海项目:https://quarry-api.yg.icdat.cn 四合一://https://starry.test.icdat.cn + +//#define Http @"https://starry.test.icdat.cn" +//#define H5DevHost @"starry.test.icdat.cn"// +//#define IntervenH5 @"https://starry.out.icdat.cn" + +//开发环境地址 +#define Http @"http://cqyt.dev.yg.dt.io"// +#define H5DevHost @"cqyt.dev.yg.dt.io"// +#define IntervenH5 @"http://cms.dev.yg.dt.io" +#define BASEURL @"https://yyjk.cqygjk.com" //北边接口前缀 +#define SCHEME @"http" // + + + +#endif /* StatusMacros_h */ diff --git a/XinjiangProject/XinjiangProject/Define/ThirdMacros.h b/XinjiangProject/XinjiangProject/Define/ThirdMacros.h new file mode 100755 index 0000000..5323188 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Define/ThirdMacros.h @@ -0,0 +1,43 @@ +// +// ThirdMacros.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +// + +#ifndef ThirdMacros_h +#define ThirdMacros_h + +//微信 +#define kAppKey_Wechat @"" + +#define kSecret_Wechat @"" + +#define UMShareAppKey @"" + +#define JpushAppKey @"" + +#define AlipayAppKey @"" + +#define buglyAppid @"" + + + +//高德key +#define AMAPSDKKEY @"e5e5b1aa469fcf577c829165bae860dd" + +#define KNotificAgreeProtoocl @"AGREEPMAP" + +//友盟appster + +#define UMAppSecret @"" + +#define UMAppkey @"" + +#define UNiversalLink @"" + +//腾讯IM +#define TUISDKAPPID 1400792728 + +#endif /* ThirdMacros_h */ diff --git a/XinjiangProject/XinjiangProject/Define/YYUtilsMacros.h b/XinjiangProject/XinjiangProject/Define/YYUtilsMacros.h new file mode 100755 index 0000000..7faacde --- /dev/null +++ b/XinjiangProject/XinjiangProject/Define/YYUtilsMacros.h @@ -0,0 +1,217 @@ +// +// YYUtilsMacros.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +// + +#ifndef YYUtilsMacros_h +#define YYUtilsMacros_h + + + +//#define CQHttp @""//正式 + + + +//#define CQHttp @"https://cqyt.test.yg.icdat.cn"// + +//获取系统对象 + +#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) +#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) +#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f) + +#define kApplication [UIApplication sharedApplication] +#define kAppWindow [UIApplication sharedApplication].delegate.window +#define kAppDelegate [AppDelegate shareAppDelegate] +#define kRootViewController [UIApplication sharedApplication].delegate.window.rootViewController +#define kUserDefaults [NSUserDefaults standardUserDefaults] +#define kNotificationCenter [NSNotificationCenter defaultCenter] + +#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height +#define kNavBarHeight 44.0 +#define kTabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49) +#define kTopHeight (kStatusBarHeight + kNavBarHeight) +/* 系统版本和语言 */ +#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue] +#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion]) +#define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0]) +#define IPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + +#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) +#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) +#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f) +#define IPHONE4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) +//判断是否是IPHONE5的宏,用法是 if(IPHONE) xxxx else xxxxx +#define IPHONE5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO) + +/* 判断iphonex*/ +#define IPHONE_X \ +({BOOL isPhoneX = NO;\ +if (@available(iOS 11.0, *)) {\ +isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\ +}\ +(isPhoneX);}) + + + +/* 宽度*/ +#define SCREEN_BOUNDS [[UIScreen mainScreen]bounds] +#define WIDTH [[UIScreen mainScreen]bounds].size.width +#define HEIGHT [[UIScreen mainScreen]bounds].size.height +#define SCREEN_SIZE [[UIScreen mainScreen]bounds].size +#define STATUSBAR_HEIGHT [[UIApplication sharedApplication]statusBarFrame].size.height +#define STATUSBAR_WIDTH [[UIApplication sharedApplication]statusBarFrame].size.width +#define mykeyWindow [UIApplication sharedApplication].delegate.window +#define HEIGHT_6_SCALE HEIGHT/667 +#define IS_IPHONE_6P (WIDTH > 375) +#define myScale6 WIDTH/375 +#define HEIGHT_TABBAR (IPHONE_X ? 83 : 49) +#define HEIGHT_NAVIGATION (IPHONE_X ? 88 : 64) +#define SafetyAreaHeight (IPHONE_X ? 24 : 0) +#define HomeHEIGHT (HEIGHT - HEIGHT_NAVIGATION - HEIGHT_TABBAR) +#define MyViewHEIGHT (HEIGHT - HEIGHT_NAVIGATION) +#define KNavigationBarHeight (44.0) +#define KStatusBarHeight ([UIApplication sharedApplication].statusBarFrame.size.height) +#define KTopHeight (KNavigationBarHeight + KStatusBarHeight) +#define LineSpace 5 +//根据ip6的屏幕来拉伸 +#define kRealValue(with) ((with)*(WIDTH/375.0f)) + +//强弱引用 +#define kWeakSelf(type) __weak typeof(type) weak##type = type; +#define kStrongSelf(type) __strong typeof(type) type = weak##type; + +//View 圆角和加边框 +#define ViewBorderRadius(View, Radius, Width, Color)\ +\ +[View.layer setCornerRadius:(Radius)];\ +[View.layer setMasksToBounds:YES];\ +[View.layer setBorderWidth:(Width)];\ +[View.layer setBorderColor:[Color CGColor]] + +// View 圆角 +#define ViewRadius(View, Radius)\ +\ +[View.layer setCornerRadius:(Radius)];\ +[View.layer setMasksToBounds:YES] +//字体 +#define BOLDSYSTEMFONT(FONTSIZE)[UIFont boldSystemFontOfSize:FONTSIZE] +#define SYSTEMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE] +#define FONT(NAME, FONTSIZE) [UIFont fontWithName:(NAME) size:(FONTSIZE)] +#define MEDIUMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE weight:UIFontWeightMedium]; + +#define PLACEHOLD_IMG IMAGE_NAMED(@"placeholdIMG") + + +#define IMAGE_NAMED(name) [UIImage imageNamed:name] +/** +* the saving objects 存储对象 +* +* @param __VALUE__ V +* @param __KEY__ K +* +* @return +*/ +#define UserDefaultSetObjectForKey(__VALUE__,__KEY__) \ +{\ +[[NSUserDefaults standardUserDefaults] setObject:__VALUE__ forKey:__KEY__];\ +[[NSUserDefaults standardUserDefaults] synchronize];\ +} + +/** + * get the saved objects 获得存储的对象 + */ +#define UserDefaultObjectForKey(__KEY__) [[NSUserDefaults standardUserDefaults] objectForKey:__KEY__] + +/** + * delete objects 删除对象 + */ +#define UserDefaultRemoveObjectForKey(__KEY__) \ +{\ +[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__];\ +[[NSUserDefaults standardUserDefaults] synchronize];\ +} +///IOS 版本判断 +#define IOSAVAILABLEVERSION(version) ([[UIDevice currentDevice] availableVersion:version] < 0) +// 当前系统版本 +#define CurrentSystemVersion [[UIDevice currentDevice].systemVersion doubleValue] +//当前语言 +#define CurrentLanguage ([NSLocale preferredLanguages] objectAtIndex:0]) + +//-------------------打印日志------------------------- +//DEBUG 模式下打印日志,当前行 +#ifdef DEBUG +#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); +#else +#define DLog(...) +#endif +//颜色 +#define KClearColor [UIColor clearColor] +#define KWhiteColor [UIColor whiteColor] +#define KBlackColor [UIColor blackColor] +#define KGrayColor [UIColor grayColor] +#define KGray2Color [UIColor lightGrayColor] +#define KBlueColor [UIColor blueColor] +#define KRedColor [UIColor redColor] +#define RGBA(r,g,b,a) ([UIColor colorWithRed:r/255.0 \ +green:g/255.0 \ +blue:b/255.0 \ +alpha:a]) +#define RGB(r,g,b) (RGBA(r,g,b,1)) + +#define RGB_VALUE(value) ([UIColor colorWithRed:((float)((value&0xFF0000)>>16))/255.0f \ +green:((float)((value&0xFF00)>>8))/255.0f \ +blue:((float)(value&0xFF))/255.0f \ +alpha:1.0f]) +#define Kcustom_color(R,G,B) ([UIColor colorWithRed:(R)/255.0 \ +green:(G)/255.0 \ +blue:(B)/255.0 \ +alpha:1.0]) + +#define UIColorBackground (RGB(243,244,246)) +#define UIColorTitle1 (RGB_VALUE(0x333333)) +#define UIColorTitle2 (RGB_VALUE(0x666666)) +#define UIColorTitle3 (RGB_VALUE(0x999999)) +#define UITextBackColor (RGBA(169,169,169,1)) +#define UIWhiteColor ([UIColor whiteColor]) +#define UIColorLine (RGB_VALUE(0xE5E5E5)) +#define UIColorTheme (RGB(242,48,48)) +#define UIGreenColor (RGB(123,209,132)) +#define UIColorMain (RGB(189,19,11)) + +//数据验证 +#define StrValid(f) ([f isKindOfClass:[NSNull class]] || f == nil || [f length] < 1 || [f isEqualToString:@"(null)"] || [f isEqualToString:@""] || [f isEqualToString:@"null"]? YES : NO) +#define SafeStr(f) (StrValid(f) ? f:@"") +#define HasString(str,key) ([str rangeOfString:key].location!=NSNotFound) + +#define ValidStr(f) StrValid(f) +#define ValidDict(f) (f!=nil && [f isKindOfClass:[NSDictionary class]]) +#define ValidArray(f) (f!=nil && [f isKindOfClass:[NSArray class]] && [f count]>0) +#define ValidNum(f) (f!=nil && [f isKindOfClass:[NSNumber class]]) +#define ValidClass(f,cls) (f!=nil && [f isKindOfClass:[cls class]]) +#define ValidData(f) (f!=nil && [f isKindOfClass:[NSData class]]) +//拼接字符串 +#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__] +//发送通知 +#define KPostNotification(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj]; +//单例化一个类 +#define SINGLETON_FOR_HEADER(className) \ +\ ++ (className *)shared##className; + +#define SINGLETON_FOR_CLASS(className) \ +\ ++ (className *)shared##className { \ +static className *shared##className = nil; \ +static dispatch_once_t onceToken; \ +dispatch_once(&onceToken, ^{ \ +shared##className = [[self alloc] init]; \ +}); \ +return shared##className; \ +} + + +#endif /* YYUtilsMacros_h */ diff --git a/XinjiangProject/XinjiangProject/Manager/AudioManager/CQAudioPlayManager.h b/XinjiangProject/XinjiangProject/Manager/AudioManager/CQAudioPlayManager.h new file mode 100644 index 0000000..7579ab1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/AudioManager/CQAudioPlayManager.h @@ -0,0 +1,25 @@ +// +// CQAudioPlayManager.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/5. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CQAudioPlayManager : NSObject + ++ (AVPlayer *)initWhithUrl:(NSURL *)avUrl; + +//开始播放 ++ (void)avPlayIngAction:(AVPlayer *)avPlay; + +//暂停播放 ++ (void)avPauseAction:(AVPlayer *)avPlay; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Manager/AudioManager/CQAudioPlayManager.m b/XinjiangProject/XinjiangProject/Manager/AudioManager/CQAudioPlayManager.m new file mode 100644 index 0000000..7e56838 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/AudioManager/CQAudioPlayManager.m @@ -0,0 +1,34 @@ +// +// CQAudioPlayManager.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/5. +// + +#import "CQAudioPlayManager.h" + +@implementation CQAudioPlayManager + ++ (AVPlayer *)initWhithUrl:(NSURL *)avUrl { + + + AVPlayerItem * item = [AVPlayerItem playerItemWithURL:avUrl];// 2.创建AVPlayerItem + AVPlayer * avTools = [AVPlayer playerWithPlayerItem:item]; + avTools= [AVPlayer playerWithURL:avUrl]; + return avTools; + +} + +//开始播放 ++ (void)avPlayIngAction:(AVPlayer *)avPlay { + + [avPlay play]; +} + +//暂停播放 ++ (void)avPauseAction:(AVPlayer *)avPlay { + + [avPlay pause]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/DownToolsManager.h b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/DownToolsManager.h new file mode 100644 index 0000000..85533d9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/DownToolsManager.h @@ -0,0 +1,20 @@ +// +// DownToolsManager.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/1. +// + +#import +#import "ReaderViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DownToolsManager : NSObject + ++ (void)downLoadReportWithURL:(NSString *)PDFURL withFileName:(NSString *)fileName; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/DownToolsManager.m b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/DownToolsManager.m new file mode 100644 index 0000000..481c18b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/DownToolsManager.m @@ -0,0 +1,103 @@ +// +// DownToolsManager.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/1. +// + +#import "DownToolsManager.h" +@implementation DownToolsManager + ++ (void)downLoadReportWithURL:(NSString *)PDFURL withFileName:(NSString *)fileName +{ + + [self downLoadPdfFileByUrl:PDFURL fileName:[NSString stringWithFormat:@"%@.pdf",fileName]]; + +} + ++(__kindof NSURLSessionTask *)downloadWithURL:(NSString *)URL + fileDir:(NSString *)fileDir + progress:(void(^)(NSProgress *progress))progress + success:(void(^)(NSString *filePath))success + failure:(void(^)(NSError *error))failure{ + + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:URL]]; + NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) { + //下载进度 + progress ? progress(downloadProgress) : nil; + NSLog(@"下载进度:%.2f%%",100.0*downloadProgress.completedUnitCount/downloadProgress.totalUnitCount); + } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) { + + //拼接缓存目录 + NSString *downloadStr = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] ; + + //拼接文件路径 + NSString *filePath = [downloadStr stringByAppendingPathComponent:fileDir]; + + NSLog(@"downloadStr = %@",downloadStr); + return [NSURL fileURLWithPath:filePath]; + + } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) { + NSLog(@"%@---%@", filePath, filePath.absoluteString); + success ? success(filePath.absoluteString /** NSURL->NSString*/) : nil; + failure && error ? failure(error) : nil; + }]; + //开始下载 + [downloadTask resume]; + return downloadTask; + +} + +//下载pdf文件 ++(void)downLoadPdfFileByUrl:(NSString *)url fileName:(NSString *)fileName +{ + //如果存在直接打开 + if ([self isFileExist:fileName]) { + //获取路径 + NSString *documentsPath = [ReaderDocument documentsPath]; + //可根据路径command + shift + G查看该路径下的所有的pdf文件 + NSLog(@"%@", documentsPath); + NSString *filePath = [documentsPath stringByAppendingPathComponent:fileName]; + ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:nil]; + if (document != nil) + { + ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; + + readerViewController.delegate = self; + [[HQCommonUtils getCurrentVC] presentViewController:readerViewController animated:YES completion:nil]; + } + }else{ + + [self downloadWithURL:url fileDir:fileName progress:^(NSProgress *progress) { + + } success:^(NSString *filePath) { + NSLog(@"%@", filePath); + //下载完成直接打开 + [self downLoadPdfFileByUrl:url fileName:fileName]; + } failure:^(NSError *error) { + }]; + } + +} +#pragma mark ReaderViewControllerDelegate因为PDF阅读器可能是push出来的,也可能是present出来的,为了更好的效果,这个代理方法可以实现很好的退出 ++ (void)dismissReaderViewController:(ReaderViewController *)viewController{ + [[HQCommonUtils getCurrentVC] dismissViewControllerAnimated:YES completion:nil]; +} + +#pragma 判断文件是否存在 ++(BOOL)isFileExist:(NSString *)fileName +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *path = [paths objectAtIndex:0]; + NSString *filePath = [path stringByAppendingPathComponent:fileName]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + BOOL result = [fileManager fileExistsAtPath:filePath]; + NSLog(@"这个文件已经存在:%@",result?@"是的":@"不存在"); + return result; + +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQAPI.h b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQAPI.h new file mode 100755 index 0000000..0a0dac5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQAPI.h @@ -0,0 +1,126 @@ +// +// API.h +// XZYNetworking +// +// Created by 徐自由 on 2017/12/25. +// Copyright © 2017年 徐自由. All rights reserved. +// + +#import +#import "JKCQNetworkingWithCache.h" + +@interface JKCQAPI : NSObject + +@property (nonatomic,strong) JKCQNetworkingWithCache * httpRequest; + +#pragma mark - init方法 +//无需token +- (instancetype)init:(id)delegate tag:(NSString *)tag; +//携带token +- (instancetype)init:(id)delegate tag:(NSString *)tag NeedToken:(NSString *)NeedToken; + +#pragma mark:应急 +- (void)PostSoSPhoneEmergency:(NSMutableDictionary *)parmDic; +- (void)getSoSCreateGroupChat:(NSMutableDictionary *)parmDic; +- (void)getNearbyHomePageHospitalPoint:(NSMutableDictionary *)parmDic; +- (void)getNearbyAEDEquipmentqNumber:(NSMutableDictionary *)parmDic; +- (void)GetSoSHomePageResources:(NSMutableDictionary *)pamraDic; +- (void)PostEndSoSIMQuestion:(NSMutableDictionary *)pamraDic; +- (void)getSoSCarInfoLocationHome:(NSMutableDictionary *)parmDic; + + +//首页接口 +- (void)GetQuetsionRecordsList:(NSMutableDictionary *)parmDic; +- (void)GetAllDoctorRecordsList:(NSMutableDictionary *)parmDic; +- (void)GetDoctoresExpireTime:(NSMutableDictionary *)parmDic; +- (void)GetAllHistoryChatRecord:(NSMutableDictionary *)parmDic; +- (void)GetverifyToken:(NSMutableDictionary *)parmDic; + +#pragma mark:登录注册 +- (void)PostLogin:(NSMutableDictionary *)parmDic; +- (void)GetIMLoginAccount:(NSMutableDictionary *)pamraDic; +#pragma mark:健康咨询 +- (void)getQuestionRecommendDoctor:(NSMutableDictionary *)parmDic; +- (void)getSearchjibingListRightData:(NSMutableDictionary *)parmDic; +- (void)getFoundExpertHomeData:(NSMutableDictionary *)parmDic; +- (void)getSearchZongheData:(NSMutableDictionary *)parmDic; +- (void)getSearchDoctorData:(NSMutableDictionary *)parmDic; +- (void)getSearchHospatilData:(NSMutableDictionary *)parmDic; +- (void)getSearchSicksListData:(NSMutableDictionary *)parmDic; +- (void)getSearchRoomListData:(NSMutableDictionary *)parmDic; +- (void)getSearchRoomListLeftData:(NSMutableDictionary *)parmDic; +- (void)getAllHospatilData:(NSMutableDictionary *)parmDic; +- (void)getSearchConditionsData:(NSMutableDictionary *)parmDic; +- (void)getConnditionHospitalData:(NSMutableDictionary *)parmDic; +- (void)getHospatilDetail:(NSMutableDictionary *)parmDic; +- (void)getHospatilDetailRoomsDoctor:(NSMutableDictionary *)parmDic; +- (void)getHospatilEvaluate:(NSMutableDictionary *)parmDic; +- (void)getHospatilScore:(NSMutableDictionary *)parmDic; +- (void)getCollectHospatil:(NSMutableDictionary *)parmDic; +- (void)getCancelCollectHospatil:(NSMutableDictionary *)parmDic; +- (void)getDoctorExpertMainData:(NSMutableDictionary *)parmDic; +- (void)getCollectDoctorExpertData:(NSMutableDictionary *)parmDic; +- (void)getCancelCollectDoctorExpertData:(NSMutableDictionary *)parmDic; +- (void)getExpertDoctorEvluateData:(NSMutableDictionary *)parmDic; +- (void)getDoctorScore:(NSMutableDictionary *)parmDic; +- (void)getExpertDoctorHaveTimeData:(NSMutableDictionary *)parmDic; +- (void)postVideoQuestionAPI:(NSMutableDictionary *)parmDic; +- (void)postPictureQuestionAPI:(NSMutableDictionary *)parmDic; +- (void)getAppointmentReportDetailAPI:(NSMutableDictionary *)parmDic; +- (void)GetLookQuestionDetailFileData:(NSMutableDictionary *)parmaDic; +- (void)getCancelQuestion:(NSMutableDictionary *)parmDic; +- (void)getSearchjibingListLeftData:(NSMutableDictionary *)parmDic; +- (void)getOneKeyQuestionByID:(NSMutableDictionary *)parmDic; +- (void)postSearchOneKeyQuestionData:(NSMutableDictionary *)parmDic; +- (void)getHistoryReportById:(NSMutableDictionary *)parmDic; + +#pragma mark:咨询人管理 + +- (void)getQuestionManagerList:(NSMutableDictionary *)parmDic; +- (void)delectedQuestionManagerList:(NSMutableDictionary *)parmDic; +- (void)getAddQuestionFailyMembers:(NSMutableDictionary *)parmDic; +- (void)getQustionOptionsMembers:(NSMutableDictionary *)parmDic; +- (void)getMembersSicksList:(NSMutableDictionary *)parmDic; +- (void)PostMemberShipFileData:(NSMutableDictionary *)parmaDic; +- (void)GetLookModficalMemberShipFileData:(NSMutableDictionary *)parmaDic; +- (void)GetQuestionRecordList:(NSMutableDictionary *)parmaDic; +- (void)postBaseHealthInfoAPI:(NSMutableDictionary *)parmDic; +#pragma mark:IM + +- (void)GetloginIMUserSig:(NSMutableDictionary *)parmDic; +- (void)GetEndPictureEndIMQuestion:(NSMutableDictionary *)pamraDic; +- (void)PostQustionDoctorScore:(NSMutableDictionary *)pamraDic; +- (void)getsendHealthDataReportAPI:(NSMutableDictionary *)parmDic; +- (void)GetisSmallHelp:(NSMutableDictionary *)parmDic; +- (void)GetSmllHelpDetail:(NSMutableDictionary *)parmDic; +#pragma mark:查询 +- (void)postImageArrayUpload:(NSArray *)imageArray withParmDic:(NSMutableDictionary *)parmDic; +- (void)getCheckKeyResult:(NSMutableDictionary *)parmDic; +- (void)getFoundPopConnetResult:(NSMutableDictionary *)parmDic; +- (void)getSelectedShow:(NSMutableDictionary *)parmDic; +- (void)getBodyReportDeatil:(NSMutableDictionary *)parmDic; +- (void)PostGroupIDArray:(NSMutableDictionary *)parmDic; +- (void)postSmallHelpGroup:(NSMutableDictionary *)parmDic; + +#pragma mark:我的 +- (void)getMineCenterNumber:(NSMutableDictionary *)parmDic; +- (void)getMineQuestionRecord:(NSMutableDictionary *)parmDic; +- (void)getMineCenterUserInfo:(NSMutableDictionary *)parmDic; +- (void)getEmergencyContact:(NSMutableDictionary *)parmDic; +- (void)postAddEmergencyContact:(NSMutableDictionary *)parmDic; +- (void)getDelectedEmergencyContact:(NSMutableDictionary *)parmDic; +- (void)postSetUserPassword:(NSMutableDictionary *)parmDic; +- (void)postResetUserNewPassword:(NSMutableDictionary *)parmDic; +- (void)getVesionHideRegis:(NSMutableDictionary *)parmDic; +- (void)postUpdateQuestionFailyMembers:(NSMutableDictionary *)parmDic; + +#pragma mark:用户隐私协议 +- (void)getUserAgreementPrivacy:(NSMutableDictionary *)parmDic; +//更新 +- (void)getABMUpdate:(NSMutableDictionary *)parmDic; + +- (void)getMinitringFillQusetion:(NSMutableDictionary *)parmDic; + +- (void)getMinitringWatchData:(NSMutableDictionary *)parmDic; + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQAPI.m b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQAPI.m new file mode 100755 index 0000000..c7c6ad7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQAPI.m @@ -0,0 +1,751 @@ +// +// API.m +// XZYNetworking +// +// Created by 徐自由 on 2017/12/25. +// Copyright © 2017年 徐自由. All rights reserved. +// + +#import "JKCQAPI.h" + +#define needToken httpRequest.needToken +#define isLoginFlag httpRequest.isLoginFlag + + +@implementation JKCQAPI + +#pragma mark - init方法 +@synthesize httpRequest; + +//无需token +- (instancetype)init:(id)delegate tag:(NSString *)tag +{ + return [self init:delegate tag:tag NeedToken:0]; +} + +//携带token +- (instancetype)init:(id)delegate tag:(NSString *)tag NeedToken:(NSString *)NeedToken +{ + if (self=[super init]) { + + + if (![tag isEqualToString:@"LOGINGAPI"] || ![tag isEqualToString:@"CHANGEAPI"] || ![tag isEqualToString:@"verifyToken"]) { + + HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + httpRequest = [[JKCQNetworkingWithCache alloc] initWithDelegate:delegate bindTag:tag NeedToken:user.token]; + }else{ + httpRequest = [[JKCQNetworkingWithCache alloc] initWithDelegate:delegate bindTag:tag NeedToken:@""]; + + } + } + return self; +} + + + +#pragma mark:应急 + +- (void)PostSoSPhoneEmergency:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/call",Http] params:parmDic]; + +} + +- (void)getSoSCreateGroupChat:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/createGroupMag",Http] params:parmDic]; +} + +- (void)PostEndSoSIMQuestion:(NSMutableDictionary *)pamraDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/orderOver",Http] params:pamraDic]; + +} + +- (void)GetSoSHomePageResources:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/resource/home",Http] params:pamraDic]; +} + + +- (void)getSoSCarInfoLocationHome:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medical-center/api/ambulance/nearbyAmbulance",Http] params:parmDic]; + +} + +- (void)getNearbyHomePageHospitalPoint:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medical-center/api/resource/nearbyResource",Http] params:parmDic]; +} + +- (void)getNearbyAEDEquipmentqNumber:(NSMutableDictionary *)parmDic { + + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-intervene/intervene/v2/aedEquipmentManger/nearbyAed",Http] params:parmDic]; +} +//首页新接口 + + +- (void)GetQuetsionRecordsList:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByDoctorIdUnit",Http] params:parmDic]; + +} + +- (void)GetAllDoctorRecordsList:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByDoctorIdHelper",Http] params:parmDic]; + +} + +- (void)GetDoctoresExpireTime:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectDoctorCardExpireTime",Http] params:parmDic]; + +} + +- (void)GetAllHistoryChatRecord:(NSMutableDictionary *)parmDic { +//http://192.168.1.28/health-consultation/?groupId=1801087415104962560&pageNo=1&pageSize=10 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectImMessagePageListSession",Http] params:parmDic]; + +} + +- (void)GetverifyToken:(NSMutableDictionary *)parmDic { +//https://starry.test.icdat.cn/health-consultation/api/consult/msgRecord/selectTokenExpire?token= HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/msgRecord/selectTokenExpire",Http] params:parmDic]; + +} + +- (void)GetisSmallHelp:(NSMutableDictionary *)parmDic { +//https://starry.test.icdat.cn/health-consultation/api/consult/msgRecord/selectTokenExpire?token= HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHelper/selectTfHelper",Http] params:parmDic]; + +} +#pragma mark:登录 + +- (void)PostLogin:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/sys/mLogin",Http] params:parmDic]; + +} +/* + IM登录 + */ +- (void)GetIMLoginAccount:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-im/wnapp/userSigAndroid",Http] params:pamraDic]; +} + +- (void)GetSmllHelpDetail:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHelper/selectHelperInfoDesc",Http] params:parmDic]; + +} + +#pragma mark:健康咨询搜索 + +- (void)getQuestionRecommendDoctor:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorRecommend",Http] params:parmDic]; + +} + +- (void)getFoundExpertHomeData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchFirstpage",Http] params:parmDic]; + +} + +- (void)getSearchZongheData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchComprehensive",Http] params:parmDic]; + +} +//搜专家 +- (void)getSearchDoctorData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConDoctor",Http] params:parmDic]; + +} + +//搜医院 +- (void)getSearchHospatilData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConResource",Http] params:parmDic]; + +} +//全部医院 +- (void)getAllHospatilData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConResourceAll",Http] params:parmDic]; + +} + +//医院详情 +- (void)getHospatilDetail:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conResource/hospitalDetail",Http] params:parmDic]; + +} + +//医院科室 +- (void)getHospatilDetailRoomsDoctor:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorByHospitalId",Http] params:parmDic]; + +} +//医院评论 + +- (void)getHospatilEvaluate:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conEvaluate/selectConEvaluateListByHospitalId",Http] params:parmDic]; + +} + +//关注医院 +- (void)getCollectHospatil:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHospitalFollow/followHostital",Http] params:parmDic]; + +} + +//取消关注医院 +- (void)getCancelCollectHospatil:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHospitalFollow/cancelHostital",Http] params:parmDic]; + +} + +//医院评分 +- (void)getHospatilScore:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conResource/selectHostitalAverageScore",Http] params:parmDic]; + +} +//医生评分 +- (void)getDoctorScore:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorAverageScore",Http] params:parmDic]; + +} + +//带搜索条件 +- (void)getSearchConditionsData:(NSMutableDictionary *)parmDic { +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDoctor/selectDictListByNHDS?doctorName=&hospitalId=&departmentId=27424429373915145&sickId=&tfSort=1&pageNo=1&pageSize=100 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictListByNHDS",Http] params:parmDic]; + +} + +- (void)postSearchOneKeyQuestionData:(NSMutableDictionary *)parmDic { +// 查询关联疾病和科室的医生 +// POST http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDoctor/selectDictListBySickAndDepartment HTTP/1.1 +// 入参:{"departmentIds":[],"sickIds":["40289e15409841890115416524830065"],"pageNo":1,"pageSize":10} + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictListBySickAndDepartment",Http] params:(NSMutableDictionary *)parmDic]; + +} + + + + + +//搜疾病 +- (void)getSearchSicksListData:(NSMutableDictionary *)parmDic { + + //GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/es/searchconSicksList?search=%E5%A5%BD&pageNumber=1&pageSize=100 HTTP/1.1 + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchconSicksList",Http] params:parmDic]; + +} + +//搜科室 +- (void)getSearchRoomListData:(NSMutableDictionary *)parmDic { + + //老的 GET http://cqyt.dev.yg.dt.io//health-consultation/es/searchConDepartment?search=%E5%86%85%E7%A7%91&pageNumber=1&pageSize=100 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConDepartment",Http] params:parmDic]; + +} + +//搜科室:左边 +- (void)getSearchRoomListLeftData:(NSMutableDictionary *)parmDic { +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDepartment/selectDepartListVersionThree?parentId=0 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDepartment/selectDepartListVersionThree",Http] params:parmDic]; + +} +//搜疾病:左边边 +- (void)getSearchjibingListLeftData:(NSMutableDictionary *)parmDic { +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDepartment/selectDepartListVersionThree?parentId=27342921598501015 HTTP/1.1 + //http://192.168.1.23/health-consultation/api/consult/conDepartment/selectDepartListSickVersionTwo?parentId=0 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDepartment/selectDepartListSickVersionTwo",Http] params:parmDic]; +} + +//搜疾病:右边 +- (void)getSearchjibingListRightData:(NSMutableDictionary *)parmDic { +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDepartment/selectDepartListVersionThree?parentId=27342921598501015 HTTP/1.1 +// GET http://192.168.1.23/health-consultation/api/consult/conSicks/selectSickListByDepartmentId?departmentId=27342921598501114 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSicks/selectSickListByDepartmentId",Http] params:parmDic]; +} +//医院筛选 +- (void)getConnditionHospitalData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conResource/selectHospitalList",Http] params:parmDic]; +} + +//专家主页 +- (void)getDoctorExpertMainData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorInfo",Http] params:parmDic]; +} + +//关注专家 +- (void)getCollectDoctorExpertData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorFollow/followDoctor",Http] params:parmDic]; +} + +//取消专家 +- (void)getCancelCollectDoctorExpertData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorFollow/cancelDoctor",Http] params:parmDic]; +} + +//专家评论列表 +- (void)getExpertDoctorEvluateData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conEvaluate/selectConEvaluateList",Http] params:parmDic]; +} + +//专家预约时间 +- (void)getExpertDoctorHaveTimeData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorSchedulingDate/selectSchedulingDateListByDoctorId",Http] params:parmDic]; +} + + +- (void)postVideoQuestionAPI:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertTelephoneSession",Http] params:parmDic]; +} + +- (void)postPictureQuestionAPI:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertPictureTextSession",Http] params:parmDic]; + +} + +- (void)getABMUpdate:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:@"https://base.icdat.cn/v2/latest" params:parmDic]; + +} + + +//预约详情 +- (void)getAppointmentReportDetailAPI:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessionDetail",Http] params:parmDic]; + +} + +- (void)getOneKeyQuestionByID:(NSMutableDictionary *)parmDic { + NSString * ClassId = [parmDic objectForKey:@"ClassId"]; + // http://cqyt.dev.yg.dt.io/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByClassId?classId=28436350931828841 HTTP/1.1 + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByClassId?classId=%@",Http,ClassId] params:parmDic]; +} + + +#pragma mark:咨询人管理 + +- (void)getQuestionManagerList:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/selectMenberOnlyList",Http] params:parmDic]; +} + +- (void)delectedQuestionManagerList:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/removeMemberById",Http] params:parmDic]; +} + + +- (void)getAddQuestionFailyMembers:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/insertFamilyMembers",Http] params:parmDic]; +} + +- (void)postUpdateQuestionFailyMembers:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/updateFamilyMembers",Http] params:parmDic]; +} + + +- (void)getQustionOptionsMembers:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/healthInfo/selectHealthInfo",Http] params:parmDic]; +} + +- (void)getMembersSicksList:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/selectMenberList",Http] params:parmDic]; +} + +- (void)PostMemberShipFileData:(NSMutableDictionary *)parmaDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/insertConMedicalRecords",Http] params:parmaDic]; +} + +- (void)GetLookModficalMemberShipFileData:(NSMutableDictionary *)parmaDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsById",Http] params:parmaDic]; +} + +- (void)GetLookQuestionDetailFileData:(NSMutableDictionary *)parmaDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByIdDoctor",Http] params:parmaDic]; +} + + +- (void)GetQuestionRecordList:(NSMutableDictionary *)parmaDic { + +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conSession/selectSessionListByUserIdVersionTwo?type=2&status=5&pageNo=0&pageSize=10 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByUserIdVersionTwo",Http] params:parmaDic]; +} + + + + +#pragma mark:im +- (void)GetloginIMUserSig:(NSMutableDictionary *)parmDic { + + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-im/wnapp/userSigAndroid",Http] params:parmDic]; + +} +//结束图文咨询 +- (void)GetEndPictureEndIMQuestion:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/finishSession",Http] params:pamraDic]; + +} + +//医生评分 +- (void)PostQustionDoctorScore:(NSMutableDictionary *)pamraDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conEvaluate/insertConEvaluate",Http] params:pamraDic]; + +} +//发送健康档案 +- (void)getsendHealthDataReportAPI:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByMemberId",Http] params:parmDic]; + +} + +#pragma mark:tools +- (void)postImageArrayUpload:(NSArray *)imageArray withParmDic:(NSMutableDictionary *)parmDic { + + [httpRequest upLoadDataWithUrlStr:[NSString stringWithFormat:@"%@/sys/upload/uploadFileMany",Http] params:parmDic withDataArray:imageArray]; +} + +- (void)getCheckKeyResult:(NSMutableDictionary *)parmDic { + + // [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/upload/uploadFile",CQHttp] params:parmDic]; + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictList",Http] params:parmDic]; +} + +- (void)getFoundPopConnetResult:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/notice/selectUserNotice",Http] params:parmDic]; +} + + +- (void)getSelectedShow:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/notice/chooseToDontShowUp",Http] params:parmDic]; +} + + + +- (void)getBodyReportDeatil:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/cqyt/middleController/getCheckItemBySfzhNewNew",Http] params:parmDic]; + +} + + +- (void)PostGroupIDArray:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListPictureByUserId",Http] params:parmDic]; +} + +- (void)postSmallHelpGroup:(NSMutableDictionary *)parmDic { + + //insertUserAndHelperSession 以前是这样 + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertUserAndHelperSessionNew",Http] params:parmDic]; + +} +- (void)postBaseHealthInfoAPI:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/healthInfo/inserOrUpdatetHealthInfoAnswer",Http] params:parmDic]; +} + + +#pragma mark:我的 + +- (void)getMineCenterNumber:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessioningNum",Http] params:parmDic]; + +} + +- (void)getMineQuestionRecord:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByUserIdVersionThree",Http] params:parmDic]; + + +} + +- (void)getCancelQuestion:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/cancelSession",Http] params:parmDic]; + +} + +- (void)getMineCenterUserInfo:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/selectUserInfo",Http] params:parmDic]; + +} +- (void)postSetUserPassword:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/api/anon/sys/checkUser",Http] params:parmDic]; + +} +- (void)postResetUserNewPassword:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/api/anon/sys/resetUserPwd",Http] params:parmDic]; + +} +//紧急联系人 +- (void)getEmergencyContact:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/emergencyContact/selectEmergencyContactList",Http] params:parmDic]; + +} + +- (void)postAddEmergencyContact:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/sys/api/emergencyContact/updateAndInsertEmergencyContact",Http] params:parmDic]; + +} + +- (void)getDelectedEmergencyContact:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/emergencyContact/removeEmergencyContactList",Http] params:parmDic]; + +} + + +- (void)getUserAgreementPrivacy:(NSMutableDictionary *)parmDic { + + //GET https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conDoctor/selectDictList?dictKey=jump_url HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictList?dictKey=qh_ios_jump_url",Http] params:parmDic]; + + +} +#pragma mark:健康现状 + +- (void)gethealthCurrentStatus:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthQuo/info",Http] params:parmDic]; + +} + +- (void)getHistoryReportById:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getHistoryReportById",Http] params:parmDic]; + +} + +//获取体检语音 +- (void)getReportListAudioResource:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getVoiceUrl",Http] params:parmDic]; + +} + +//获取体检语音 +- (void)getReportListHistoryDoctorAudioResource:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/convertVoice2",Http] params:parmDic]; + +} + +- (void)getEnergyDemandData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/energyDemand",Http] params:parmDic]; + +} + +- (void)getidealWeightData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/idealBodyWeight",Http] params:parmDic]; + +} + +- (void)getAllSportData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/allExercise",Http] params:parmDic]; + +} + +- (void)getBodyScaleData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/waistHipRatio",Http] params:parmDic]; + +} + +- (void)getOneMinUnderstandData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/knowYourselfInMinute",Http] params:parmDic]; + +} + +- (void)getSubtractWeightData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/loseKilo",Http] params:parmDic]; + +} + +- (void)getHealthAnalyzeData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalDataAnalysis/selectMedicalDataAnalysisVOList",Http] params:parmDic]; + +} + +- (void)getHealthAnalyzeSubData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalDataAnalysis/selectMedicalUniItemClassList",Http] params:parmDic]; + +} + +- (void)getHealthAnalyzeDetailData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalUserResult",Http] params:parmDic]; + +} + +- (void)getHealthAnalyzeLineChareTableData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalUserResultInfoById",Http] params:parmDic]; + +} + +- (void)selectedTimeData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalUserResultInfoExDate",Http] params:parmDic]; + + +} + +- (void)getHealthAnanalyzeResultData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalMiddleResultExtVO",Http] params:parmDic]; + +} + +- (void)getHealthMonitorHomepageData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectHealthMonitoringInfo",Http] params:parmDic]; +} + +- (void)getHealthBMIData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectHeightAndWeightBmi",Http] params:parmDic]; +} + + +- (void)getHealthRecordsListData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectHeightAndWeightBmiList",Http] params:parmDic]; +} + +- (void)getHealthBloodPresureDetailData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodPresure",Http] params:parmDic]; +} + +- (void)getHealthBloodPresureRecordListData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodPresureList",Http] params:parmDic]; +} + +- (void)getHealthBloodlipidRecordListData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodFat",Http] params:parmDic]; +} + +- (void)getHealthBloodSugarDetailData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodSugarInfo",Http] params:parmDic]; +} + +- (void)getHealthBloodSugarRecordData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodSugarList",Http] params:parmDic]; +} + +- (void)getHealthStatusAbnomalData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthQuo/exceptionList",Http] params:parmDic]; +} + + +//获取报告列表 +- (void)getchangWeiJingReportList:(NSMutableDictionary *)parmDic { + + NSString * userId = [parmDic objectForKey:@"userId"]; + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medicalGi/phone/reportList/%@",Http,userId] params:parmDic]; +} + + +- (void)getchangWeiJingHaveYearsPaperList:(NSMutableDictionary *)parmDic { + + NSString * userId = [parmDic objectForKey:@"userId"]; + NSString * medicalYear = [parmDic objectForKey:@"medicalYear"]; + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medicalGi/phone/getPaper/%@/%@",Http,userId,medicalYear] params:parmDic]; +} + +//获取报告详情 +- (void)getchangWeiJingReportDetail:(NSMutableDictionary *)parmDic { + + NSString * urId = [parmDic objectForKey:@"urId"]; + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medicalGi/phone/report/%@",Http,urId] params:nil]; +} +// +//POST http://cqyt.dev.yg.dt.io/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByGiType?giType=1 HTTP/1.1 +//返回:{"success":true,"message":"","code":200,"result":{"officeIds":[],"sicksIds":[]},"timestamp":1701929792458} +-(void)postChangWeiJingDoctor:(NSMutableDictionary *)parmDic { + + NSString * giType = [parmDic objectForKey:@"giType"]; + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByGiType?giType=/%@",Http,giType] params:parmDic]; +} + +#pragma mark:监测 + +- (void)getMinitringFillQusetion:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-intervene/api/risk/riskMyocardialSuddenDeath/selectTfFillQuestion",Http] params:parmDic]; +} + +- (void)getMinitringWatchData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-watch/watchH5Api/indexDataNew",Http] params:parmDic]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQNetworkingWithCache.h b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQNetworkingWithCache.h new file mode 100755 index 0000000..22c78d3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQNetworkingWithCache.h @@ -0,0 +1,56 @@ +// +// JKCQNetworkingWithCache.h +// XZYNetworking +// +// Created by 徐自由 on 2017/12/22. +// Copyright © 2017年 徐自由. All rights reserved. +// + +#import +#import +//#import + +@protocol JKCQNetworkingWithCacheDelegate + +@optional +- (void)httpSuccess:(id)response bindTag:(NSString *)bindTag; + +- (void)httpError:(NSString *)error bindTag:(NSString *)bindTag; + +@end + +typedef void (^FileDownloadSucc)(void); +typedef void (^FileDownloadFail)(int code, NSString * desc); + +@interface JKCQNetworkingWithCache : NSObject + +@property (nonatomic,strong) id requestDelegate; +@property (nonatomic,copy) NSString *bindTag; +@property (nonatomic,copy) NSString * needToken; +@property (nonatomic,assign) NSInteger isLoginFlag;//1时如果token可传为空就不跳出登陆界面 +@property (nonatomic,copy) NSString *urlString; + +- (instancetype)initWithDelegate:(id)requestDelegate bindTag:(NSString *)bindTag NeedToken:(NSString *)NeedToken; + +#pragma mark - Get方法(默认方法) +//不带缓存 +- (void)httpGetRequest:(NSString *)api params:(NSMutableDictionary *)params; +- (void)httpGetCacheRequest:(NSString *)api params:(NSMutableDictionary *)params; + +#pragma mark - Post方法 +//不带缓存 +- (void)httpPostRequest:(NSString *)api params:(NSMutableDictionary *)params; +- (void)httpPostCacheRequest:(NSString *)api params:(NSMutableDictionary *)params; + +#pragma mark - 上传文件方法 +//上传单张图片 +- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params imageKey:(NSString *)name withData:(NSData *)data; +//上传多张图片 +- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray; + +- (void)upLoadVideoDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray; + +#pragma mark - 下载文件方法 +- (void)downLoadFileWithUrl:(NSString *)urlStr Path:(NSString*)path downloadProgress:(void (^)(NSProgress *downloadProgress))progress SuccessBlock:(FileDownloadSucc)success FileDownloadFail:(FileDownloadFail)failure; + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQNetworkingWithCache.m b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQNetworkingWithCache.m new file mode 100755 index 0000000..8dba942 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/JKCQNetworkingWithCache.m @@ -0,0 +1,508 @@ + +// +// XZYNetworkingWithCache.m +// XZYNetworking +// +// Created by 徐自由 on 2017/12/22. +// Copyright © 2017年 徐自由. All rights reserved. +// + +#import "JKCQNetworkingWithCache.h" + +#define DYLog(...) NSLog(__VA_ARGS__) //如果不需要打印数据, 注释掉NSLog + + +// 请求方式 +typedef NS_ENUM(NSInteger, RequestType) { + RequestTypeGet, + RequestTypePost, + RequestTypeUpLoad,//单个上传 + RequestTypeMultiUpload,//多个上传 + RequestTypeDownload, + RequestTypeUpLoadVideo,//上传视频 +}; + +@implementation JKCQNetworkingWithCache +{ + __weak JKCQNetworkingWithCache *weakSelf; +} + +- (instancetype)initWithDelegate:(id)requestDelegate bindTag:(NSString *)bindTag NeedToken:(NSString *)NeedToken +{ + if (self =[super init]) { + self.requestDelegate = requestDelegate; + self.bindTag = bindTag; + self.needToken = NeedToken; + weakSelf = self; + } + return self; +} + +#pragma mark - Get方法(默认方法) +//不带缓存 +- (void)httpGetRequest:(NSString *)api params:(NSMutableDictionary *)params +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypeGet isCache:NO cacheKey:nil imageKey:nil withData:nil withDataArray:nil]; +} + +- (void)httpGetCacheRequest:(NSString *)api params:(NSMutableDictionary *)params +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypeGet isCache:YES cacheKey:api imageKey:nil withData:nil withDataArray:nil]; + +} + +#pragma mark - Post方法 +//不带缓存 +- (void)httpPostRequest:(NSString *)api params:(NSMutableDictionary *)params +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypePost isCache:NO cacheKey:nil imageKey:nil withData:nil withDataArray:nil]; +} + +- (void)httpPostCacheRequest:(NSString *)api params:(NSMutableDictionary *)params +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypePost isCache:YES cacheKey:api imageKey:nil withData:nil withDataArray:nil]; +} + +#pragma mark - 上传文件方法 +//上传单张图片 +- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params imageKey:(NSString *)name withData:(NSData *)data +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypeUpLoad isCache:NO cacheKey:api imageKey:name withData:data withDataArray:nil]; + +} +//上传多张图片 +- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypeMultiUpload isCache:NO cacheKey:api imageKey:nil withData:nil withDataArray:dataArray]; +} + +- (void)upLoadVideoDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypeUpLoadVideo isCache:NO cacheKey:api imageKey:nil withData:nil withDataArray:dataArray]; +} + + + +/** 下载文件方法*/ +- (void)downLoadFileWithUrl:(NSString *)urlStr Path:(NSString*)path downloadProgress:(void (^)(NSProgress *downloadProgress))progress SuccessBlock:(FileDownloadSucc)success FileDownloadFail:(FileDownloadFail)failure; +{ + if (urlStr.length == 0) { + return; + } + //1.创建管理者对象 + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; + //2.确定请求的URL地址 + NSURL *url = [NSURL URLWithString:urlStr]; + //3.创建请求对象 + NSURLRequest *request = [NSURLRequest requestWithURL:url]; + //4.下载任务 + NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) { + //打印下下载进度 + progress(downloadProgress); + } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) { + //设置文件保存路径 + return [NSURL fileURLWithPath:path]; + } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) { + NSLog(@"完成cache:%@",filePath); + NSHTTPURLResponse *response1 = (NSHTTPURLResponse *)response; + NSInteger statusCode = [response1 statusCode]; + if (statusCode == 200) { + success(); + }else{ + failure(0,error.localizedFailureReason); + } + }]; + //5.开始启动下载任务 + [task resume]; +} +#pragma mark - 网络请求统一处理 +/** + + @param api 后台的接口名 + @param params 参数dict + @param requestType 请求类型 + @param isCache 是否缓存标志 + @param cacheKey 缓存的对应key值 + @param name 图片上传的名字(upload) + @param data 图片的二进制数据(upload) + @param dataArray 多图片上传时的imageDataArray + */ +- (void)httpRequestWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params requestType:(RequestType)requestType isCache:(BOOL)isCache cacheKey:(NSString *)cacheKey imageKey:(NSString *)name withData:(NSData *)data withDataArray:(NSArray *)dataArray +{ + NSString *url = api; + + if (params == nil) { + params = [NSMutableDictionary dictionary]; + } + + NSString *allUrl=[self urlDictToStringWithUrlStr:url WithDict:params]; + url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + + //进行网络检查 + if (![self requestBeforeJudgeConnect]) {//断网 + [self showError:@"请检查网络设置"]; + DYLog(@"\n\n----%@------\n\n",@"没有网络"); + return; + } + + AFHTTPSessionManager *session=[AFHTTPSessionManager manager]; +// AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; + + session.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain", nil]; + //超时时间 + + session.requestSerializer.timeoutInterval= 30.f; + session.responseSerializer = [AFHTTPResponseSerializer serializer]; + + session.requestSerializer = [AFJSONRequestSerializer serializer]; + + session.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + +// [session.requestSerializer setValue:self.needToken forHTTPHeaderField:@"X-Access-Token"]; +// [session.requestSerializer setValue:@"Quarry" forHTTPHeaderField:@"X-ClientSign"]; + + if (requestType == RequestTypeGet) {//Get请求 + + [session GET:url parameters:params headers:@{@"X-Access-Token":self.needToken} progress:^(NSProgress * _Nonnull downloadProgress) { + + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + [weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl]; + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"]; +// if (stringUrlOne.count >= 1) +// { + if ([statusCode containsString:@"401"]) { + DLog(@"%@",error.userInfo); + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + KPostNotification(KNotificationLoginStateChange, @NO); + + if (![HQCommonUtils isLogin]) { + [EasyTextView showErrorText:@"请您登录"]; + } + else{ + [EasyTextView showErrorText:@"身份信息已过期"]; + } + }else + { + NSLog(@"%@",url); + [self showError:@"网络服务出错"]; + } + +// } + + + }]; + } else if (requestType == RequestTypePost) {//post请求 + + [session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} progress:^(NSProgress * _Nonnull downloadProgress) { + + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + [weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl]; + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"]; + if ([statusCode containsString:@"401"]) { + DLog(@"%@",error.userInfo); + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + KPostNotification(KNotificationLoginStateChange, @NO); + if (![HQCommonUtils isLogin]) { + [EasyTextView showErrorText:@"请您登录"]; + } + else{ + [EasyTextView showErrorText:@"身份信息已过期"]; + } + } + else + { + [self showError:@"网络服务出错"]; + } + + }]; + + } else if (requestType == RequestTypeUpLoad) {//上传单张图片 + [session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} constructingBodyWithBlock:^(id _Nonnull formData) { + + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + // 设置时间格式 + [formatter setDateFormat:@"yyyyMMddHHmmss"]; + NSString *dateString = [formatter stringFromDate:[NSDate date]]; + NSString *fileName = [NSString stringWithFormat:@"%@.jpg", dateString]; + [formData appendPartWithFileData:data name:name fileName:fileName mimeType:@"image/png"]; + + } progress:^(NSProgress * _Nonnull uploadProgress) { + //(float)uploadProgress.completedUnitCount/(float)uploadProgress.totalUnitCount + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + [weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl]; + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + [weakSelf showError:@"上传文件出错"]; + + }]; + } else if (requestType == RequestTypeMultiUpload) {//上传多张图片 + [session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} constructingBodyWithBlock:^(id _Nonnull formData) { + + // formData = [self dataWith:formData dataArray:dataArray]; + for (int i = 0; i < dataArray.count; i++) { + UIImage *image = dataArray[i]; + NSData *imageData = UIImageJPEGRepresentation(image, 0.5); + // 在网络开发中,上传文件时,是文件不允许被覆盖,文件重名 + // 要解决此问题, + // 可以在上传时使用当前的系统事件作为文件名 + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + // 设置时间格式 + [formatter setDateFormat:@"yyyyMMddHHmmss"]; + NSString *dateString = [formatter stringFromDate:[NSDate date]]; + NSString *fileName = [NSString stringWithFormat:@"%@.jpg", dateString]; + /* + *该方法的参数 + 1. appendPartWithFileData:要上传的照片[二进制流] + 2. name:对应处理文件的字段(比如upload) + 3. fileName:要保存在服务器上的文件名 + 4. mimeType:上传的文件的类型 + */ + [formData appendPartWithFileData:imageData name:@"files" fileName:fileName mimeType:@"image/jpeg"]; // + } + + } progress:^(NSProgress * _Nonnull uploadProgress) { + //(float)uploadProgress.completedUnitCount/(float)uploadProgress.totalUnitCount + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + [weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl]; + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + [weakSelf showError:@"上传文件出错"]; + }]; + }else if (requestType == RequestTypeUpLoadVideo) {//上传视频 + [session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} constructingBodyWithBlock:^(id _Nonnull formData) { + + // video + [formData appendPartWithFileData:data name:@"video" fileName:@"video.mov" mimeType:@"video/quicktime"]; + + + } progress:^(NSProgress * _Nonnull uploadProgress) { + //(float)uploadProgress.completedUnitCount/(float)uploadProgress.totalUnitCount + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + [weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl]; + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + [weakSelf showError:@"上传文件出错"]; + + }]; + + + } + +} + + +- (NSString *)stringWithDict:(NSDictionary *)dict +{ + NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil]; + NSString *datastr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + datastr = [datastr stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + datastr = [datastr stringByReplacingOccurrencesOfString:@" " withString:@""]; + datastr = [datastr stringByReplacingOccurrencesOfString:@"\\" withString:@""]; + + return datastr; +} + + + +#pragma mark 统一处理请求到的数据 +-(void)dealWithResponseObject:(NSData *)responseData cacheUrl:(NSString *)cacheUrl +{ + + NSString * dataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; + //dataString = [self deleteSpecialCodeWithStr:dataString]; + DLog(@"response\n%@\n",dataString); + NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding]; + + [self returnDataWithRequestData:requestData withUrl:cacheUrl]; + +} + +#pragma mark - 根据返回的数据进行统一的格式处理-requestData 网络或者是缓存的数据- +- (void)returnDataWithRequestData:(NSData *)requestData withUrl:(NSString *)url +{ + id myResult = [NSJSONSerialization JSONObjectWithData:requestData options:NSJSONReadingMutableContainers error:nil]; + + //判断是否为字典 + if ([myResult isKindOfClass:[NSDictionary class]]) { + + NSDictionary *response = (NSDictionary *)myResult; + response = [self removeNullsFromDictionary:response]; + //根据返回的接口内容来变 + BOOL flag = false; + if ([response.allKeys containsObject:@"ok"]) { + + flag = [[response objectForKey:@"ok"] boolValue]; + } + if ([response.allKeys containsObject:@"code"]) { + + if ([[response objectForKey:@"code"] integerValue] == 200) + { + flag = true; + }else + { + flag = false; + } + + } + + if (flag == true) { + DLog(@" 返回Json\n%@\n %@", [HQCommonUtils DataTOjsonString:response],url); + if ([response.allKeys containsObject:@"result"]) { + [self showSuccess:[response objectForKey:@"result"]]; + } + if ([response.allKeys containsObject:@"data"]) { + [self showSuccess:[response objectForKey:@"data"]]; + } + } + NSString * codestring = [response objectForKey:@"message"]; + if (flag == false ) { + [self showError:[response objectForKey:@"message"]]; + return; + } + } + +} + +- (id)removeNullsFromDictionary:(id)json { + if ([json isKindOfClass:[NSDictionary class]]) { + NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary]; + for (NSString *key in [json allKeys]) { + id value = json[key]; + mutableDict[key] = [self removeNullsFromDictionary:value]; + } + return [mutableDict copy]; + } else if ([json isKindOfClass:[NSArray class]]) { + NSMutableArray *mutableArray = [NSMutableArray array]; + for (id value in json) { + [mutableArray addObject:[self removeNullsFromDictionary:value]]; + } + return [mutableArray copy]; + } else if ([json isKindOfClass:[NSNull class]]) { + return @""; // 或者替换成你想要的默认值 + } else { + return json; + } +} +#pragma mark - 拼接请求的网络地址 +- (NSString *)urlDictToStringWithUrlStr:(NSString *)urlString WithDict:(NSDictionary *)parameters +{ + if (!parameters) { + return urlString; + } + + NSMutableArray *parts = [NSMutableArray array]; + //enumerateKeysAndObjectsUsingBlock会遍历dictionary并把里面所有的key和value一组一组的展示给你,每组都会执行这个block 这其实就是传递一个block到另一个方法,在这个例子里它会带着特定参数被反复调用,直到找到一个ENOUGH的key,然后就会通过重新赋值那个BOOL *stop来停止运行,停止遍历同时停止调用block + [parameters enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { + //字符串处理 + key = [NSString stringWithFormat:@"%@",key]; + obj = [NSString stringWithFormat:@"%@",obj]; + + //接收key + NSString *finalKey = [key stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + //接收值 + NSString *finalValue = [obj stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + + + NSString *part = [NSString stringWithFormat:@"%@=%@",finalKey,finalValue]; + + [parts addObject:part]; + + }]; + + NSString *queryString = [parts componentsJoinedByString:@"&"]; + + queryString = queryString.length != 0 ? [NSString stringWithFormat:@"?%@",queryString] : @""; + + NSString *pathStr = [NSString stringWithFormat:@"%@%@",urlString,queryString]; + + return pathStr; + +} +#pragma mark -- 处理json格式的字符串中的换行符、回车符 +- (NSString *)deleteSpecialCodeWithStr:(NSString *)str { + NSString *string = [str stringByReplacingOccurrencesOfString:@"\r" withString:@""]; + string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + string = [string stringByReplacingOccurrencesOfString:@"\t" withString:@""]; + //string = [string stringByReplacingOccurrencesOfString:@" " withString:@""]; + string = [string stringByReplacingOccurrencesOfString:@"(" withString:@""]; + string = [string stringByReplacingOccurrencesOfString:@")" withString:@""]; + return string; +} + +#pragma mark 网络判断 +- (BOOL)requestBeforeJudgeConnect +{ + struct sockaddr zeroAddress; + bzero(&zeroAddress, sizeof(zeroAddress)); + zeroAddress.sa_len = sizeof(zeroAddress); + zeroAddress.sa_family = AF_INET; + SCNetworkReachabilityRef defaultRouteReachability = + SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress); + SCNetworkReachabilityFlags flags; + BOOL didRetrieveFlags = + SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags); + CFRelease(defaultRouteReachability); + if (!didRetrieveFlags) { + printf("Error. Count not recover network reachability flags\n"); + return NO; + } + BOOL isReachable = flags & kSCNetworkFlagsReachable; + BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired; + BOOL isNetworkEnable = (isReachable && !needsConnection) ? YES : NO; + dispatch_async(dispatch_get_main_queue(), ^{ + [UIApplication sharedApplication].networkActivityIndicatorVisible = isNetworkEnable;/* 网络指示器的状态: 有网络 : 开 没有网络: 关 */ + + }); + return isNetworkEnable; +} + +#pragma mark - 返回数据的调度显示 +- (void)showSuccess:(id)response +{ + if(!self.requestDelegate) return; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored"-Wundeclared-selector" + + if ([self.requestDelegate respondsToSelector:@selector(Sucess:tag:)]) + { + [self.requestDelegate performSelector:@selector(Sucess:tag:) withObject:response withObject:self.bindTag]; + return; + } + +#pragma clang diagnostic pop +} + +- (void)showError:(NSString *)error +{ + if(!self.requestDelegate) return; +#pragma clang diagnostic push +#pragma clang diagnostic ignored"-Wundeclared-selector" + + if ([self.requestDelegate respondsToSelector:@selector(Failed:tag:)]) + { + [self.requestDelegate performSelector:@selector(Failed:tag:) withObject:error withObject:self.bindTag]; + return; + } + +#pragma clang diagnostic pop +} + +- (void)dealloc +{ + self.requestDelegate=nil; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDGETHealthTokenManager.h b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDGETHealthTokenManager.h new file mode 100644 index 0000000..26b9806 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDGETHealthTokenManager.h @@ -0,0 +1,27 @@ +// +// SDGETHealthTokenManager.h +// EscortProject +// +// Created by 仁康信息 on 2024/1/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^successBlock)(NSDictionary *responseObject); +typedef void (^failedBlock)(NSError *error); + +@interface SDGETHealthTokenManager : NSObject + ++(SDGETHealthTokenManager *)getHealthTokenManager; + +- (void)getTokenSuccess:(successBlock)success + failed:(failedBlock)failed; + + +-(void)getUserJoinStatusSuccess:(successBlock)success + failed:(failedBlock)failed; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDGETHealthTokenManager.m b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDGETHealthTokenManager.m new file mode 100644 index 0000000..0dfab49 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDGETHealthTokenManager.m @@ -0,0 +1,195 @@ +// +// SDGETHealthTokenManager.m +// EscortProject +// +// Created by 仁康信息 on 2024/1/4. +// + +#import "SDGETHealthTokenManager.h" +#include +#import "RSAObjC.h" + +@interface SDGETHealthTokenManager () +@property (nonatomic,strong)AFHTTPSessionManager *session; +@end + +@implementation SDGETHealthTokenManager + + +#pragma mark - 初始化单例 ++(SDGETHealthTokenManager *)getHealthTokenManager +{ + static SDGETHealthTokenManager *manager = nil; + static dispatch_once_t pred; + dispatch_once(&pred, ^{ + manager = [[self alloc] init]; + }); + return manager; +} +-(id)init +{ + self = [super init]; + if (self) { + _session = [AFHTTPSessionManager manager]; + + /***********请求的序列化**********/ + //传Json 对象 + _session.requestSerializer = [AFJSONRequestSerializer serializer]; + //设置超时时间 + [_session.requestSerializer willChangeValueForKey:@"timeoutInterval"]; + _session.requestSerializer.timeoutInterval = 10.f; + [_session.requestSerializer didChangeValueForKey:@"timeoutInterval"]; + + /**********响应的序列化**************/ + _session.responseSerializer = [AFJSONResponseSerializer serializer]; + _session.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/plain" ,@"text/javascript",@"text/html",nil]; + } + return self; + + +} + +-(void)httpRequestWithURL:(NSString *)url + parameters:(NSDictionary*)paraDic + hearders:(NSDictionary *)hearder + success:(successBlock)success + failed:(failedBlock)failed +{ + + NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url]; + [_session POST:fullURL parameters:paraDic headers:hearder progress:^(NSProgress * _Nonnull uploadProgress) { + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + success(responseObject); + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + failed(error); + }]; +} + + + +-(void)httpRequestGetWithURL:(NSString *)url + parameters:(NSDictionary*)paraDic + hearders:(NSDictionary *)hearder + success:(successBlock)success + failed:(failedBlock)failed +{ + + NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url]; + + [_session GET:fullURL parameters:paraDic headers:hearder progress:nil success:^(NSURLSessionTask *task, NSDictionary * responseObject) { + + success(responseObject); + } failure:^(NSURLSessionTask *operation, NSError *error) { + failed(error); + }]; +} + +- (void)getTokenSuccess:(successBlock)success failed:(failedBlock)failed { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary * headerDic = [[NSMutableDictionary alloc] init]; + NSDate * date = [NSDate date]; + NSDateFormatter *matter = [[NSDateFormatter alloc] init]; + matter.dateFormat = @"yyyyMMddHHmmss"; + NSString * dateString = [matter stringFromDate:date]; + + [dic setObject:dateString forKey:@"timeSign"]; + NSMutableDictionary * sigDic = [[NSMutableDictionary alloc] init]; + [sigDic setObject:dateString forKey:@"timeSign"]; + NSString * needSersy = [sigDic modelToJSONString]; +// 时间戳 + NSError *parseError; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sigDic options:0 error:&parseError]; + if (parseError) { + //解析出错 + } + NSString * str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; +// 时间戳 + NSMutableString * str3 = [[NSMutableString alloc]initWithString:str]; + + [str3 replaceOccurrencesOfString:@"\\" withString:@"" options:1 range:NSMakeRange(0, str3.length)]; + + [str3 appendString:@"dd05f1c54d63749eda95f9fa6d49v442a"]; + + NSString * md5str = [self getMd5_32Bit_String:str3]; + + [headerDic setObject:dateString forKey:@"X-TIMESTAMP"]; + [headerDic setObject:md5str forKey:@"X-Sign"]; + + [self httpRequestGetWithURL:@"gateway/sys/getPublicKey" parameters:dic hearders:@{@"X-TIMESTAMP":dateString,@"X-Sign":md5str} success:^(NSDictionary * _Nonnull responseObject) { + + if ([responseObject.allKeys containsObject:@"code"]) { + + if ([[responseObject objectForKey:@"code"] integerValue] == 200) + { + NSString *pubkey ; + if ([responseObject.allKeys containsObject:@"result"]) { + pubkey = [NSString stringWithFormat:@"-----BEGIN PUBLIC KEY-----\n%@\n-----END PUBLIC KEY-----",responseObject[@"result"]]; + // 时间戳 + } + HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + NSString *ret = [RSAObjC encrypt:user.idCard PublicKey:pubkey]; + DLog(@"encrypted: %@", ret); + + if (ValidStr(ret)) { +// KPostNotification(KNotificationLoginStateChange, @NO); + return; + } + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:[NSString stringWithFormat:@"RSA_%@",ret] forKey: @"idcard"]; + + NSDate * date = [NSDate date]; + NSDateFormatter *matter = [[NSDateFormatter alloc] init]; + matter.dateFormat = @"yyyyMMddHHmmss"; + NSString * dateString = [matter stringFromDate:date]; + + NSError *parseError; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parmDic options:0 error:&parseError]; + if (parseError) { + //解析出错 + } + NSString * str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + // 时间戳 + NSMutableString * str3 = [[NSMutableString alloc]initWithString:str]; + + [str3 replaceOccurrencesOfString:@"\\" withString:@"" options:1 range:NSMakeRange(0, str3.length)]; + + [str3 appendString:@"dd05f1c54d63749eda95f9fa6d49v442a"]; + + NSString * md5str = [self getMd5_32Bit_String:str3]; + + + [self httpRequestWithURL:@"gateway/sys/thirdAppGetTokenByIdCard" parameters:parmDic hearders:@{@"X-TIMESTAMP":dateString,@"X-Sign":md5str} success:success failed:failed]; + } + else + { + success(responseObject); + + } + } + + + } failed:^(NSError * _Nonnull error) { + + }]; + +} + + + +- (NSString *)getMd5_32Bit_String:(NSString *)srcString { +// 参数 srcString 传进来的字符串 +// 参数 isUppercase 是否需要大小写 + const char *cStr = [srcString UTF8String]; + unsigned char digest[CC_MD5_DIGEST_LENGTH]; + CC_MD5( cStr, (CC_LONG)srcString.length, digest ); + NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; + for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) + [result appendFormat:@"%02X", digest[i]]; + return result; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDHttpRequest.h b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDHttpRequest.h new file mode 100644 index 0000000..3e45231 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDHttpRequest.h @@ -0,0 +1,33 @@ +// +// SDHttpRequest.h +// colorPrintingMaster +// +// Created by 青山小明 on 17/5/3. +// Copyright © 2017年 zhangming. All rights reserved. +// + +#import +typedef void (^successBlock)(NSDictionary *responseObject); +typedef void (^failedBlock)(NSError *error); + +@interface SDHttpRequest : NSObject ++(SDHttpRequest *)httpRequest; + +#pragma mark - 首页 +- (void)getInterWatchDataUrlWithParm:(NSMutableDictionary *)parmDic + Success:(successBlock)success + failed:(failedBlock)failed; + + +#pragma mark - + +-(void)postWithParameter:(NSDictionary *)para + images:(NSArray *)images + success:(successBlock)success + failed:(failedBlock)failed; + +//获取服务地址 +- (void)getChangeUrlSuccess:(successBlock)success + failed:(failedBlock)failed; + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDHttpRequest.m b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDHttpRequest.m new file mode 100644 index 0000000..5ee23a2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/SDHttpRequest.m @@ -0,0 +1,133 @@ +// +// SDHttpRequest.m +// colorPrintingMaster +// +// Created by 青山小明 on 17/5/3. +// Copyright © 2017年 zhangming. All rights reserved. +// + +#import "SDHttpRequest.h" +#import "AFNetworking.h" +#include +#import "RSAObjC.h" +//static SDHttpRequest *singleton = nil; + +@interface SDHttpRequest () +@property (nonatomic,strong)AFHTTPSessionManager *session; +@end + +@implementation SDHttpRequest +#pragma mark - 初始化单例 ++(SDHttpRequest *)httpRequest +{ + static SDHttpRequest *manager = nil; + static dispatch_once_t pred; + dispatch_once(&pred, ^{ + manager = [[self alloc] init]; + }); + return manager; +} +-(id)init +{ + self = [super init]; + if (self) { + _session = [AFHTTPSessionManager manager]; + + /***********请求的序列化**********/ + //传Json 对象 + _session.requestSerializer = [AFJSONRequestSerializer serializer]; + //设置超时时间 + [_session.requestSerializer willChangeValueForKey:@"timeoutInterval"]; + _session.requestSerializer.timeoutInterval = 30.f; + [_session.requestSerializer didChangeValueForKey:@"timeoutInterval"]; + + /**********响应的序列化**************/ + _session.responseSerializer = [AFJSONResponseSerializer serializer]; + _session.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/plain" ,@"text/javascript",@"text/html",nil]; + } + return self; +} +#pragma mark---请求调用的方法 +-(void)httpRequestWithURL:(NSString *)url + parameters:(NSDictionary*)paraDic + success:(successBlock)success + failed:(failedBlock)failed +{ + NSUserDefaults * tokenDefaul = [NSUserDefaults standardUserDefaults]; + + NSString * token = [tokenDefaul objectForKey:KHEALTHTOKEN]; + + + + NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url]; + [_session POST:fullURL parameters:paraDic headers: @{@"X-Access-Token":token} progress:^(NSProgress * _Nonnull uploadProgress) { + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + success(responseObject); + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + failed(error); + }]; +} + +- (void)uploadImagesWithURL:(NSString *)url + parameters:(NSDictionary *)paraDic + hearders:(NSDictionary *)hearder + imagesKey:(NSString *)imagesKey + images:(NSArray *)images + success:(successBlock)success + failed:(failedBlock)failed +{ + NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url]; + + [_session POST:fullURL parameters:paraDic headers:hearder constructingBodyWithBlock:^(id _Nonnull formData) { + for (UIImage *image in images) + { + [formData appendPartWithFileData:UIImageJPEGRepresentation(image, 0.5) + name:imagesKey + fileName:@"1.jpeg" + mimeType:@"image/jpeg"]; + } + + } progress:^(NSProgress * _Nonnull uploadProgress) { + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + success(responseObject); + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + failed(error); + }]; +} + +-(void)httpRequestGetWithURL:(NSString *)url + parameters:(NSDictionary*)paraDic + success:(successBlock)success + failed:(failedBlock)failed +{ + NSUserDefaults * tokenDefaul = [NSUserDefaults standardUserDefaults]; + + NSString * token = [tokenDefaul objectForKey:KHEALTHTOKEN]; + + NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url]; + + [_session GET:fullURL parameters:paraDic headers:@{@"X-Access-Token":token} progress:nil success:^(NSURLSessionTask *task, NSDictionary * responseObject) { + + success(responseObject); + } failure:^(NSURLSessionTask *operation, NSError *error) { + failed(error); + }]; +} + + +#pragma mark - 首页 +- (void)getInterWatchDataUrlWithParm:(NSMutableDictionary *)parmDic + Success:(successBlock)success + failed:(failedBlock)failed { + + //参数 + [self httpRequestGetWithURL:@"health-watch/watchH5Api/indexDataNew" + parameters:parmDic success:success failed:failed]; +} + + + + + + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/RuntimeManager/SwapMethodManager.h b/XinjiangProject/XinjiangProject/Manager/RuntimeManager/SwapMethodManager.h new file mode 100644 index 0000000..3a63f1c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/RuntimeManager/SwapMethodManager.h @@ -0,0 +1,20 @@ +// +// SwapMethodManager.h +// WDYAdjustFontSize +// +// Created by wdyzmx on 2022/1/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SwapMethodManager : NSObject +/// runtime方法交换 +/// @param class 对象的类 +/// @param originalSel 对象原方法 +/// @param swizzledSel 对象所要交换的方法 ++ (void)swapMethodInClass:(Class)class originalMethod:(SEL)originalSel swizzledMethod:(SEL)swizzledSel; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Manager/RuntimeManager/SwapMethodManager.m b/XinjiangProject/XinjiangProject/Manager/RuntimeManager/SwapMethodManager.m new file mode 100644 index 0000000..15dc29d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/RuntimeManager/SwapMethodManager.m @@ -0,0 +1,33 @@ +// +// SwapMethodManager.m +// WDYAdjustFontSize +// +// Created by wdyzmx on 2022/1/19. +// + +#import "SwapMethodManager.h" +#import + +@implementation SwapMethodManager + ++ (void)swapMethodInClass:(Class)class originalMethod:(SEL)originalSel swizzledMethod:(SEL)swizzledSel { + Method originalMethod = class_getInstanceMethod(class, originalSel); + Method swizzledMethod = class_getInstanceMethod(class, swizzledSel); + + BOOL willAddMethod = + class_addMethod(class, + originalSel, + method_getImplementation(swizzledMethod), + method_getTypeEncoding(swizzledMethod)); + + if (willAddMethod) { + class_replaceMethod(class, + swizzledSel, + method_getImplementation(originalMethod), + method_getTypeEncoding(originalMethod)); + } else { + method_exchangeImplementations(originalMethod, swizzledMethod); + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.h b/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.h new file mode 100644 index 0000000..7db5257 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.h @@ -0,0 +1,68 @@ +// +// ESCTUIManager.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface ESCTUIManager : NSObject + +/* + 是否已经登录 + */ ++ (BOOL)TUIUserStatus; + +/* + 登录腾讯IM + */ + ++ (void)loginInitTUISDKAppidWith:(int)sdkAppid UserID:(NSString *)userID userSig:(NSString *)userSig; + + +/* + 发起聊天 : + isUserID:是否为单聊 false:群聊 + chatConnetID:会话id + isAudio:语音是否开启 + isVideo:视频是否开启 + + */ + ++ (void)createUITUIChatViewControllerisGroup:(BOOL)isGroup + chatConnetID:(NSString *)chatConnetID + isAudio:(BOOL)isAudio + isVideo:(BOOL)isVideo; + + +/* + 发起1对1视频通话(假设 userId 为 mike) + */ + ++ (void)sendOneToOneVideo:(NSString *)userID; + +/* + 发起群组视频通话(假设 userId 为 mike) + */ + ++ (void)sendGroupVideo:(NSString *)groupID withUserIdList:(NSArray *)userList; + +/* + 发起1对1语音通话(假设 userId 为 mike) + */ + ++ (void)sendOneToOneAudio:(NSString *)userID; + + +/* + 退出登录腾讯Im + */ + ++ (void)outLoginTUISDK; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m b/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m new file mode 100644 index 0000000..b13398b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m @@ -0,0 +1,116 @@ +// +// ESCTUIManager.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/16. +// + +#import "ESCTUIManager.h" +#import "TUIC2CChatViewController.h" +#import "TUICallKit.h" + +@implementation ESCTUIManager + + ++ (BOOL)TUIUserStatus { + + return [TUILogin isUserLogined]; + +} + ++ (void)loginInitTUISDKAppidWith:(int)sdkAppid UserID:(NSString *)userID userSig:(NSString *)userSig{ + + [[TUICallEngine createInstance] init:sdkAppid userId:userID userSig:userSig succ:^{ + + } fail:^(int code, NSString * _Nullable errMsg) { + + }]; + + + [TUILogin login:sdkAppid userID:userID userSig:userSig succ:^{ + +// KPostNotification(KNotificationLoginIMResult, @YES); + + } fail:^(int code, NSString *msg) { + + [EasyTextView showErrorText:@"IM登录失败"]; + + }]; + + [[TUICallEngine createInstance] addObserver:self]; + +} + +/* + 发起聊天 : + isUserID:是否为单聊 false:群聊 + chatConnetID:会话id + isAudio:语音是否开启 + isVideo:视频是否开启 + + */ + ++ (void)createUITUIChatViewControllerisGroup:(BOOL)isGroup + chatConnetID:(NSString *)chatConnetID + isAudio:(BOOL)isAudio + isVideo:(BOOL)isVideo { + + TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init]; + //显示对方正在输入状态 + data.avatarImage = [UIImage imageNamed:@""]; + data.otherSideTyping = true; + if(isGroup == false) { + data.userID = chatConnetID; + } + else + { + data.groupID = chatConnetID; + } + // TUIC2CChatViewController + TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init]; + [vc setConversationData:data]; + // 显示翻译按钮 +// TUIChatConfig.defaultConfig.enableTextTranslation = YES; + //不显示视频和语音 + [TUIChatConfig defaultConfig].enableVideoCall = isVideo; // YES:开启,NO:关闭 + [TUIChatConfig defaultConfig].enableAudioCall = isAudio; // YES:开启,NO:关闭 + // 把 TUIC2CChatViewController 添加到自己的 ViewController + + HQBaseViewController * currentVc =(HQBaseViewController *)[HQCommonUtils getCurrentVC]; + if (!currentVc) { + + currentVc = [[HQBaseViewController alloc] init]; + } + [currentVc addChildViewController:vc]; + [currentVc.view addSubview:vc.view]; +} + ++ (void)outLoginTUISDK { + + [TUILogin logout:^{ + + + } fail:^(int code, NSString *msg) { + + + }]; + +} + ++ (void)sendOneToOneVideo:(NSString *)userID { + + [[TUICallKit createInstance] call:userID callMediaType:TUICallMediaTypeVideo]; +} + ++ (void)sendGroupVideo:(NSString *)groupID withUserIdList:(NSArray *)userList { + + [[TUICallKit createInstance] groupCall:groupID userIdList:userList callMediaType:TUICallMediaTypeVideo]; +} + + ++ (void)sendOneToOneAudio:(NSString *)userID{ + + [[TUICallKit createInstance] call:userID callMediaType:TUICallMediaTypeAudio]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/UserManager/HQUserInfo.h b/XinjiangProject/XinjiangProject/Manager/UserManager/HQUserInfo.h new file mode 100755 index 0000000..5be97fe --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/UserManager/HQUserInfo.h @@ -0,0 +1,40 @@ +// +// HQUserInfo.h +// idleBuy +// +// Created by ios on 2018/5/30. +// Copyright © 2018年 ios. All rights reserved. +// + +#import + +@interface HQUserInfo : NSObject + +@property (nonatomic, strong) NSDictionary *userInfo; + +@property (nonatomic, copy) NSString * user_id; +@property (nonatomic, copy) NSString * username; +@property (nonatomic, copy) NSString * realname; +@property (nonatomic, copy) NSString * avatar; +@property (nonatomic, copy) NSString * phone; +@property (nonatomic, copy) NSString * orgCode; +@property (nonatomic, copy) NSString * sex; +@property (nonatomic, copy) NSString * loginTenantId; +@property (nonatomic, copy) NSString * status_dictText; +@property (nonatomic, copy) NSString * delFlag; +@property (nonatomic, copy) NSString * workNo; +@property (nonatomic, copy) NSString * idCard; +@property (nonatomic, copy) NSString * sex_dictText; + +@property (nonatomic, copy) NSString * personType; + +@property (nonatomic, strong) NSDictionary * secondDepart; + +@property (nonatomic, copy) NSString * depart_id; +@property (nonatomic, copy) NSString * parentId; +@property (nonatomic, copy) NSString * departName; +@property (nonatomic, copy) NSString * departOrder; + +@property (nonatomic, copy) NSString * token; + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/UserManager/HQUserInfo.m b/XinjiangProject/XinjiangProject/Manager/UserManager/HQUserInfo.m new file mode 100755 index 0000000..cb080a3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/UserManager/HQUserInfo.m @@ -0,0 +1,77 @@ +// +// HQUserInfo.m +// idleBuy +// +// Created by ios on 2018/5/30. +// Copyright © 2018年 ios. All rights reserved. +// + +#import "HQUserInfo.h" + +@implementation HQUserInfo +- (void)encodeWithCoder:(NSCoder *)aCoder +{ + [aCoder encodeObject:self.userInfo forKey:@"userInfo"]; + [aCoder encodeObject:self.user_id forKey:@"user_id"]; + [aCoder encodeObject:self.avatar forKey:@"avatar"]; + [aCoder encodeObject:self.username forKey:@"username"]; + [aCoder encodeObject:self.realname forKey:@"realname"]; + [aCoder encodeObject:self.phone forKey:@"phone"]; + [aCoder encodeObject:self.idCard forKey:@"idCard"]; + [aCoder encodeObject:self.depart_id forKey:@"depart_id"]; + [aCoder encodeObject:self.parentId forKey:@"parentId"]; + [aCoder encodeObject:self.departName forKey:@"departName"]; + [aCoder encodeObject:self.token forKey:@"token"]; + [aCoder encodeObject:self.sex_dictText forKey:@"sex_dictText"]; + + + +} +- (id)initWithCoder:(NSCoder *)aDecoder +{ + self = [super init]; + if (self) + { + self.userInfo = [aDecoder decodeObjectForKey:@"userInfo"]; + self.user_id = [aDecoder decodeObjectForKey:@"user_id"]; + self.avatar = [aDecoder decodeObjectForKey:@"avatar"]; + self.username = [aDecoder decodeObjectForKey:@"username"]; + self.realname = [aDecoder decodeObjectForKey:@"realname"]; + self.phone = [aDecoder decodeObjectForKey:@"phone"]; + self.idCard = [aDecoder decodeObjectForKey:@"idCard"]; + self.depart_id = [aDecoder decodeObjectForKey:@"depart_id"]; + self.parentId = [aDecoder decodeObjectForKey:@"parentId"]; + self.departName = [aDecoder decodeObjectForKey:@"departName"]; + self.token = [aDecoder decodeObjectForKey:@"token"]; + self.sex_dictText = [aDecoder decodeObjectForKey:@"sex_dictText"]; + + } + return self; +} + + +- (void)setUserInfo:(NSDictionary *)userInfo { + + _userInfo = userInfo; + self.user_id = [_userInfo objectForKey:@"id"]; + self.avatar = [NSString stringWithFormat:@"%@%@",ResourceAddress,[_userInfo objectForKey:@"avatar"]]; + self.phone = [_userInfo objectForKey:@"phone"]; + self.realname = [_userInfo objectForKey:@"realname"]; + self.username = [_userInfo objectForKey:@"username"]; + self.sex = [_userInfo objectForKey:@"sex"]; + self.idCard = [_userInfo objectForKey:@"idCard"]; + self.personType = [_userInfo objectForKey:@"personType"]; + self.secondDepart = [_userInfo objectForKey:@"secondDepart"]; + self.sex_dictText = [_userInfo objectForKey:@"sex_dictText"]; + self.depart_id = [self.secondDepart objectForKey:@"id"]; + self.parentId = [self.secondDepart objectForKey:@"parentId"]; + self.departName = [self.secondDepart objectForKey:@"departName"]; +} + + +-(void)setToken:(NSString *)token { + _token = token; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Manager/UserManager/XMKeychainTool.h b/XinjiangProject/XinjiangProject/Manager/UserManager/XMKeychainTool.h new file mode 100755 index 0000000..cad3e97 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/UserManager/XMKeychainTool.h @@ -0,0 +1,36 @@ + +// XMKeychainTool.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +#import +#import + +@interface XMKeychainTool : NSObject +/** + * 储存字符串到🔑钥匙串 + * + * @param sValue 对应的Value + * @param sKey 对应的Key + */ ++ (void)saveKeychainValue:(NSString *)sValue key:(NSString *)sKey; + + +/** + * 从🔑钥匙串获取字符串 + * + * @param sKey 对应的Key + * + * @return 返回储存的Value + */ ++ (NSString *)readKeychainValue:(NSString *)sKey; + + +/** + * 从🔑钥匙串删除字符串 + * + * @param sKey 对应的Key + */ ++ (void)deleteKeychainValue:(NSString *)sKey; +@end diff --git a/XinjiangProject/XinjiangProject/Manager/UserManager/XMKeychainTool.m b/XinjiangProject/XinjiangProject/Manager/UserManager/XMKeychainTool.m new file mode 100755 index 0000000..3fd3154 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Manager/UserManager/XMKeychainTool.m @@ -0,0 +1,57 @@ +// +// SDKeychainTool.m +// NewLottery +// +// Created by 孙号斌 on 2017/2/14. +// Copyright © 2017年 孙号斌. All rights reserved. +// + +#import "XMKeychainTool.h" + +@implementation XMKeychainTool ++ (NSMutableDictionary *)getKeychainQuery:(NSString *)service{ + return [NSMutableDictionary dictionaryWithObjectsAndKeys: + (__bridge_transfer id)kSecClassGenericPassword, + (__bridge_transfer id)kSecClass,service, + (__bridge_transfer id)kSecAttrService,service, + (__bridge_transfer id)kSecAttrAccount, + (__bridge_transfer id)kSecAttrAccessibleAfterFirstUnlock, + (__bridge_transfer id)kSecAttrAccessible, + nil]; +} + ++ (void)saveKeychainValue:(NSString *)sValue key:(NSString *)sKey{ + NSMutableDictionary * keychainQuery = [self getKeychainQuery:sKey]; + SecItemDelete((__bridge_retained CFDictionaryRef)keychainQuery); + + [keychainQuery setObject:[NSKeyedArchiver archivedDataWithRootObject:sValue] forKey:(__bridge_transfer id)kSecValueData]; + + SecItemAdd((__bridge_retained CFDictionaryRef)keychainQuery, NULL); + +} + ++ (NSString *)readKeychainValue:(NSString *)sKey +{ + NSString *ret = nil; + NSMutableDictionary *keychainQuery = [self getKeychainQuery:sKey]; + [keychainQuery setObject:(id)kCFBooleanTrue forKey:(__bridge_transfer id)kSecReturnData]; + [keychainQuery setObject:(__bridge_transfer id)kSecMatchLimitOne forKey:(__bridge_transfer id)kSecMatchLimit]; + CFDataRef keyData = NULL; + if (SecItemCopyMatching((__bridge CFDictionaryRef)keychainQuery, (CFTypeRef *)&keyData) == noErr) { + @try { + ret = (NSString *)[NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)keyData]; + } @catch (NSException *e) { + NSLog(@"Unarchive of %@ failed: %@", sKey, e); + } @finally { + } + } + if (keyData) + CFRelease(keyData); + return ret; +} ++ (void)deleteKeychainValue:(NSString *)sKey { + NSMutableDictionary *keychainQuery = [self getKeychainQuery:sKey]; + SecItemDelete((__bridge CFDictionaryRef)keychainQuery); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+AppService.h b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+AppService.h new file mode 100644 index 0000000..f15a5a2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+AppService.h @@ -0,0 +1,35 @@ +// +// AppDelegate+appService.h +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + + +#import +#import "AppDelegate.h" + +@interface AppDelegate (AppService) + +//初始化服务 +-(void)initService; +- (void)chageUrlService; +//初始化 window + +-(void)initWindow; + +//初始化键盘 +-(void)initIQKeyBord; + +//初始化高德地图 +-(void)configureAPIKey; + +//初始化 UMeng +-(void)initUMeng; + +//单例 ++ (AppDelegate *)shareAppDelegate; + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+AppService.m b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+AppService.m new file mode 100644 index 0000000..8f52968 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+AppService.m @@ -0,0 +1,408 @@ +// +// AppDelegate+appService.m +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import "AppDelegate+AppService.h" +#import "HQBaseTabBarController.h" +#import "HQLoginViewController.h" +#import +#import + +#import + + +@implementation AppDelegate (AppService) + +#pragma mark ————— 初始化服务 ————— +-(void)initService{ + + //网络状态监听 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(netWorkStateChange:) + name:KNotificationNetWorkStateChange + object:nil]; + + //登录状态改变通知 + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(loginStateChange:) + name:KNotificationLoginStateChange + object:nil]; + + + //切换SOStabbar + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(tabBarSoSChange:) + name:KNotificSelectSoSTabbar + object:nil]; + + //切换体检tabbar + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(tabBarPhyChange:) + name:KNotificSelectPhysicalTabbar + object:nil]; + + //切换档案tabbar + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(tabBarFileChange:) + name:KNotificSelectFileTabbar + object:nil]; + if ([HQCommonUtils isLogin]) { + //腾讯im + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + } +} + + +#pragma mark ————— 初始化window ————— +-(void)initWindow{ + + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + self.window.backgroundColor = KWhiteColor; + //直接进入显示登录页面 +// if ([HQCommonUtils isLogin]) { + self.mainTabBar = [HQBaseTabBarController new]; + self.mainTabBar.delegate =self; + self.window.rootViewController = self.mainTabBar; + [self.window makeKeyAndVisible]; +// }else { +// HQLoginViewController * loginvc = [[HQLoginViewController alloc] init]; +// HQBaseNavigationController * nav = [[HQBaseNavigationController alloc] initWithRootViewController:loginvc]; +// self.window.rootViewController = nav; +// } +// [self.window makeKeyAndVisible]; + + //判断是否是首次启动 + if(![[NSUserDefaults standardUserDefaults] boolForKey:@"agreeStatus"]){ + //添加隐私合规弹窗 + [self addAlertController]; + //更新App是否显示隐私弹窗的状态,隐私弹窗是否包含高德SDK隐私协议内容的状态. since 8.1.0 + [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; + } + [[TUICallEngine createInstance] addObserver:self]; +} + +#pragma mark:请求前缀 +- (void)chageUrlService { + + AFHTTPSessionManager *session=[AFHTTPSessionManager manager]; + // AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; + + session.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain", nil]; + //超时时间 + + session.requestSerializer.timeoutInterval= 30.f; + session.responseSerializer = [AFHTTPResponseSerializer serializer]; + + session.requestSerializer = [AFJSONRequestSerializer serializer]; + + session.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + + // 获取应用的版本号 + NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; + // 将版本号按照点(.)分割成数组 + NSArray * components = [version componentsSeparatedByString:@"."]; + + // 获取数组中的最后一个元素 + NSString * lastComponent = [components lastObject]; + // 如果需要将其转换为整数 + NSInteger lastNumber = [lastComponent integerValue]; + + [parmDic setObject:@(lastNumber) forKey:@"version"]; + [parmDic setObject:@"com.question.QinghaiProvince" forKey:@"pkg"]; + [session GET:@"https://base.icdat.cn/v2/url" parameters:parmDic headers:@{@"X-ClientSign":@"Quarry"} progress:^(NSProgress * _Nonnull downloadProgress) { + + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + NSString * dataString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; + DLog(@"response\n%@\n",dataString); + NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding]; + + id myResult = [NSJSONSerialization JSONObjectWithData:requestData options:NSJSONReadingMutableContainers error:nil]; + //判断是否为字典 + if ([myResult isKindOfClass:[NSDictionary class]]) { + + NSDictionary *response = (NSDictionary *)myResult; + if ([response.allKeys containsObject:@"result"]) { + NSDictionary * resultDic = [response objectForKey:@"result"]; + + if ([resultDic.allKeys containsObject:@"api"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"api"] forKey:@"HTTPS"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + NSString * apiString = [resultDic objectForKey:@"api"]; + //判断是否正在审 + BOOL isExmine; + if ([apiString containsString:@"api.out.icdat.cn"]) { //正在审 + isExmine = true; + }else + { + isExmine = false; + } + [[NSUserDefaults standardUserDefaults] setObject:@(isExmine) forKey:@"isExmine"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + + if ([resultDic.allKeys containsObject:@"h5"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5"] forKey:@"IntervenH5"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + if ([resultDic.allKeys containsObject:@"h5Host"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5Host"] forKey:@"H5DevHost"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + if ([resultDic.allKeys containsObject:@"health"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"health"] forKey:@"BASEURL"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + KPostNotification(KNotificAgreeProtoocl, nil); + } + } + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"]; + //请求超时 + if (error.code == -1001) { + [EasyTextView showErrorText:@"请求超时"]; + } + [[NSUserDefaults standardUserDefaults] setObject:@"https://api.cqygjk.com" forKey:@"HTTPS"]; + [[NSUserDefaults standardUserDefaults] setObject:@"https://yyjk.cqygjk.com/" forKey:@"BASEURL"]; + [[NSUserDefaults standardUserDefaults] setObject:@"api.cqygjk.com" forKey:@"IntervenH5"]; + [[NSUserDefaults standardUserDefaults] setObject:@"https://api.cqygjk.com" forKey:@"H5DevHost"]; + + [[NSUserDefaults standardUserDefaults] synchronize]; + KPostNotification(KNotificAgreeProtoocl, nil); + }]; + +} + + +#pragma mark: 键盘回收 +- (void)initIQKeyBord { + + IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager]; // 获取类库的单例变量 + + keyboardManager.enable = YES; // 控制整个功能是否启用 + + keyboardManager.shouldResignOnTouchOutside = YES; // 控制点击背景是否收起键盘 + + keyboardManager.shouldToolbarUsesTextFieldTintColor = YES; // 控制键盘上的工具条文字颜色是否用户自定义 + + keyboardManager.toolbarManageBehavior = IQAutoToolbarBySubviews; // 有多个输入框时,可以通过点击Toolbar 上的“前一个”“后一个”按钮来实现移动到不同的输入框 + + keyboardManager.enableAutoToolbar = YES; // 控制是否显示键盘上的工具条 + + keyboardManager.shouldShowToolbarPlaceholder = YES; // 是否显示占位文字 + + keyboardManager.placeholderFont = [UIFont boldSystemFontOfSize:17]; // 设置占位文字的字体 + + keyboardManager.keyboardDistanceFromTextField = 10.0f; // 输入框距离键盘的距离 + + +} +//初始化高德 +- (void)configureAPIKey +{ + + if ([AMAPSDKKEY length] == 0) + { + NSString *reason = [NSString stringWithFormat:@"apiKey为空,请检查key是否正确设置。"]; + + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:reason delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; + + [alert show]; + } + + [AMapServices sharedServices].apiKey = AMAPSDKKEY; +} + +#pragma mark:进来显示弹框--隐私权限 + +- (void)addAlertController{ + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + + paragraphStyle.alignment = NSTextAlignmentLeft; + + NSMutableAttributedString *message = [[NSMutableAttributedString alloc] initWithString:@"\n亲,感谢您对健康咨询员工端一直以来的信任!我们依据最新的监管要求更新了健康咨询员工端《隐私权政策》,特向您说明如下\n1.为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n2.基于您的明示授权,我们可能会获取您的位置(为您提供服务)等信息,您有权拒绝或取消授权;\n3.我们会采取业界先进的安全措施保护您的信息安全;\n4.未经您同意,我们不会从第三方处获取、共享或向提供您的信息;" attributes:@{ + NSParagraphStyleAttributeName:paragraphStyle, + }]; + + [message setAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} range:[[message string] rangeOfString:@"《隐私权政策》"]]; + + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示(隐私合规示例)" message:@"" preferredStyle:UIAlertControllerStyleAlert]; + + [alert setValue:message forKey:@"attributedMessage"]; + + UIAlertAction *conform = [UIAlertAction actionWithTitle:@"同意" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"agreeStatus"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + //更新用户授权高德SDK隐私协议状态. since 8.1.0 + [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; + [self chageUrlService]; + + }]; + + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"不同意" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"agreeStatus"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + //更新用户授权高德SDK隐私协议状态. since 8.1.0 + [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusNotAgree]; + [self chageUrlService]; + }]; + + [alert addAction:conform]; + [alert addAction:cancel]; + + [self.window.rootViewController presentViewController:alert animated:YES completion:nil]; +} + + +//代理方法,这个方法是来判断当点击某个tabBarItem时是否要点击 +- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{ + //判断用户是否登陆,这里我们可以从沙盒里面去取登陆状态 +// index = [tabBarController.viewControllers indexOfObject:viewController]; +// if (![HQCommonUtils isLogin] ) { +// if (index==2 || index==3) { +// HQLoginViewController *loginVC = [[HQLoginViewController alloc]init]; +//// self.mainTabBar.lastSelectIndex = index; +// //这里的NO是关键,如果是这个tabBarItem,就不要让他点击进去 +// UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:loginVC]; +// +// [[self getCurrentVC] presentViewController:nav animated:YES completion:nil]; +// +// return NO; +// } +// } + //当然其余的还是要点击进去的 + return YES; +} +#pragma mark ————— 网络状态变化 ————— +- (void)netWorkStateChange:(NSNotification *)notification +{ + BOOL isNetWork = [notification.object boolValue]; + + if (isNetWork) {//有网络 + + + }else {//无网络通知 + + [EasyTextView showErrorText:@"暂无网络!" config:^EasyTextConfig *{ + return [EasyTextConfig shared].setStatusType(TextStatusTypeMidden) ; + }]; + } +} + +- (void)loginStateChange:(NSNotification *)notification { + + BOOL islogin = [notification.object boolValue]; + + if (islogin) {//登录成功 重置Tabbar + self.mainTabBar = nil; + self.mainTabBar = [HQBaseTabBarController new]; + self.mainTabBar.delegate =self; + self.window.rootViewController = self.mainTabBar; + [self.window makeKeyAndVisible]; + + }else {//登陆失败加载登陆页面控制器 退出登录 + + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + self.window.backgroundColor = KWhiteColor; + HQLoginViewController * loginvc = [[HQLoginViewController alloc] init]; + HQBaseNavigationController * nav = [[HQBaseNavigationController alloc] initWithRootViewController:loginvc]; + self.window.rootViewController = nav; + [self.window makeKeyAndVisible]; + + } +} + +#pragma mark: 字体修改 + + +- (void)fontSizeChange:(NSNotification *)notification { + + +} + + +#pragma mark: 切换tabbar +- (void)tabBarSoSChange:(NSNotification *)notification { + + self.mainTabBar.selectedIndex = 2; + +} + +- (void)tabBarPhyChange:(NSNotification *)notification { + + self.mainTabBar.selectedIndex = 3; + +} + +- (void)tabBarFileChange:(NSNotification *)notification { + + self.mainTabBar.selectedIndex = 4; + +} + + + + + ++ (AppDelegate *)shareAppDelegate{ + return (AppDelegate *)[[UIApplication sharedApplication] delegate]; +} + + +#pragma mark -网络请求处理 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"IMAPI"]) { + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init]; + + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; + [[TUICallEngine createInstance] addObserver:self]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + } +} + + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+PushService.h b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+PushService.h new file mode 100644 index 0000000..17c07fb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+PushService.h @@ -0,0 +1,18 @@ + +// +// AppDelegate+pushService.h +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + + +#import +#import "AppDelegate.h" + +@interface AppDelegate (PushService) + +- (void)initWithJPush:(NSDictionary *)launchOptions; + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+PushService.m b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+PushService.m new file mode 100644 index 0000000..1969025 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate+PushService.m @@ -0,0 +1,64 @@ +// +// AppDelegate+pushService.m +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import "AppDelegate+PushService.h" + +@implementation AppDelegate (PushService) + +- (void)initWithJPush:(NSDictionary *)launchOptions +{ + /* + NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter]; + [defaultCenter addObserver:self selector:@selector(networkDidReceiveMessage:) name:kJPFNetworkDidReceiveMessageNotification object:nil]; + //Required + //notice: 3.0.0及以后版本注册可以这样写,也可以继续用之前的注册方式 + JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init]; + entity.types = JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound; + if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) { + // 可以添加自定义categories + // NSSet *categories for iOS10 or later + // NSSet *categories for iOS8 and iOS9 + } + [JPUSHService registerForRemoteNotificationConfig:entity delegate:self]; + + // Optional + // 获取IDFA + // 如需使用IDFA功能请添加此代码并在初始化方法的advertisingIdentifier参数中填写对应值 + NSString *advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; + + // Required + // init Push + // notice: 2.1.5版本的SDK新增的注册方法,改成可上报IDFA,如果没有使用IDFA直接传nil + // 如需继续使用pushConfig.plist文件声明appKey等配置内容,请依旧使用[JPUSHService setupWithOption:launchOptions]方式初始化。 + BOOL isProduction; + #ifdef DEBUG + isProduction = YES; + #else + isProduction = NO; + #endif + [JPUSHService setupWithOption:launchOptions appKey:JpushAppKey + channel:@"App Store" + apsForProduction:isProduction + advertisingIdentifier:advertisingId]; + + //2.1.9版本新增获取registration id block接口。 + [JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) { + if(resCode == 0){ + NSLog(@"registrationID获取成功:%@",registrationID); + + UserDefaultSetObjectForKey(registrationID, @"registrationID"); + + } + else{ + NSLog(@"registrationID获取失败,code:%d",resCode); + UserDefaultSetObjectForKey(@"0", @"registrationID"); + } + }]; + */ +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate.h b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate.h new file mode 100644 index 0000000..4498f81 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate.h @@ -0,0 +1,30 @@ +// +// AppDelegate.h +// healthQuestion +// +// Created by xulei on 2022/8/9. +// + +#import +#import "HQBaseTabBarController.h" +/**腾讯IM**/ +#import "TUIDefine.h" +#import "TUIBaseChatViewController.h" +#import "TUIThemeManager.h" +#import "TUILogin.h" +#import "TUIChatConfig.h" +#import "TUICallKit.h" +//Minimalist + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow * window; + +@property (nonatomic,assign)NSInteger allowRotate; + +@property (strong, nonatomic) HQBaseTabBarController * mainTabBar; + +@property (nonatomic,assign)NSInteger unreadNumber; + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate.m b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate.m new file mode 100644 index 0000000..f63fc1d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/AppDelegate/AppDelegate.m @@ -0,0 +1,178 @@ +// +// AppDelegate.m +// healthQuestion +// +// Created by xulei on 2022/8/9. +// + +#import "AppDelegate.h" +#import "SJRotationManager.h" +#import + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + + + + //前缀请求 + //初始化高德地图 + [self configureAPIKey]; + + //前缀请求 + [self chageUrlService]; + + [self initService]; + //初始化window + [self initWindow]; + //初始化IQKeybord + [self initIQKeyBord]; + // 监听推送 + [V2TIMManager.sharedInstance setAPNSListener:self]; + // 监听会话的未读数 + [[V2TIMManager sharedInstance] setConversationListener:self]; + + + SDImageWebPCoder*webPCoder = [SDImageWebPCoder sharedCoder]; + [[SDImageCodersManager sharedManager] addCoder:webPCoder]; + +#if DEBUG + +#else + [CheckProjectTool testAll]; + +#endif + + + return YES; +} + +// 2. 未读数发生变化后保存未读数 +- (void)onTotalUnreadMessageCountChanged:(UInt64)totalUnreadCount { + + self.unreadNumber = 0; +} +- (uint32_t)onSetAPPUnreadCount { + // 1. 获取自定义的角标 + uint32_t customBadgeNumber = 0; + + // 2. 加上 IM 的消息未读数 + customBadgeNumber += self.unreadNumber; + + // 3. 通过 IMSDK 上报给 IM 服务器 + return customBadgeNumber; +} + +- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { + return [SJRotationManager supportedInterfaceOrientationsForWindow:window]; +} + +#pragma mark - NSNotification + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + +} + +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray> * __nullable restorableObjects))restorationHandler { + + return YES; + +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + [application setApplicationIconBadgeNumber:0]; + [application cancelAllLocalNotifications]; + +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + [UIApplication sharedApplication].applicationIconBadgeNumber=0; + +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + + + +@end + +#warning Configuring rotation. 请配置旋转!! + +@implementation UIViewController (RotationConfiguration) +/// +/// 控制器是否可以旋转 +/// +- (BOOL)shouldAutorotate { + return NO; +} + +/// +/// 控制器旋转支持的方向 +/// +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return UIInterfaceOrientationMaskPortrait; +} +@end + + +@implementation UITabBarController (RotationConfiguration) +- (UIViewController *)sj_topViewController { + if ( self.selectedIndex == NSNotFound ) + return self.viewControllers.firstObject; + return self.selectedViewController; +} + +- (BOOL)shouldAutorotate { + return [[self sj_topViewController] shouldAutorotate]; +} + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return [[self sj_topViewController] supportedInterfaceOrientations]; +} + +- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { + return [[self sj_topViewController] preferredInterfaceOrientationForPresentation]; +} +@end + +@implementation UINavigationController (RotationConfiguration) +- (BOOL)shouldAutorotate { + return self.topViewController.shouldAutorotate; +} + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return self.topViewController.supportedInterfaceOrientations; +} + +- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { + return self.topViewController.preferredInterfaceOrientationForPresentation; +} + +- (nullable UIViewController *)childViewControllerForStatusBarStyle { + return self.topViewController; +} + +- (nullable UIViewController *)childViewControllerForStatusBarHidden { + return self.topViewController; +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Base/BaseWebViewVC.h b/XinjiangProject/XinjiangProject/Project/Base/BaseWebViewVC.h new file mode 100644 index 0000000..d9f67a9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/BaseWebViewVC.h @@ -0,0 +1,39 @@ +// +// BaseWebViewVC.h +// ScarHousekeeper +// +// Created by 张小万 on 2021/1/21. +// + +#import +#import + + +NS_ASSUME_NONNULL_BEGIN + +typedef enum { + WkJSMessageTypeDefault = 0, + WkJSMessageTypeBack = 1, +}WkJSMessageType; +typedef enum { + RightDefaultType = 0, + RightCompleteType = 1, +}RightNavType; + +@protocol WebJSExport + +- (void)startFunction; +@end + +@interface BaseWebViewVC : HQBaseViewController + +@property (nonatomic, strong) NSString *webUrl; +@property (nonatomic, strong) NSString *webTitle; +@property (nonatomic, strong) JSContext *context; +@property (nonatomic, strong) WKWebView *wkWebView; +@property (nonatomic, assign) RightNavType rightType; + +- (void)webViewRequest; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Base/BaseWebViewVC.m b/XinjiangProject/XinjiangProject/Project/Base/BaseWebViewVC.m new file mode 100644 index 0000000..b393cf6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/BaseWebViewVC.m @@ -0,0 +1,249 @@ +// +// BaseWebViewVC.m +// ScarHousekeeper +// +// Created by 张小万 on 2021/1/21. +// + +#import "BaseWebViewVC.h" + +@interface BaseWebViewVC () + +@property (nonatomic, strong)NSURL *originalUrl; +@property (nonatomic, copy)NSString *videoUrl; +@property (nonatomic, copy)NSString *messageType; + + +@end + +@implementation BaseWebViewVC + + +#pragma mark - LifeCycle +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + self.isHidenNaviBar = false; + [self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backVC) tags:@[@""]]; + [self addSubviews]; + if (self.webTitle) { + self.navigationItem.title = self.webTitle; + } +} + +- (void)backVC { + + [self.navigationController popViewControllerAnimated:YES]; +} + +- (void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + if (_wkWebView) { + _wkWebView.navigationDelegate = self; + _wkWebView.UIDelegate = self; + _wkWebView.allowsBackForwardNavigationGestures = true; + + } +} + + +- (void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + _wkWebView.navigationDelegate = nil; + _wkWebView.UIDelegate = nil; + //清除cookies + NSHTTPCookie *cookie; + NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + for (cookie in [storage cookies]) { + [storage deleteCookie:cookie]; + } + [[NSURLCache sharedURLCache] removeAllCachedResponses]; + [self clearWebViewCache]; +} + +#pragma mark - Create UI +- (void)addSubviews{ + WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; + WKPreferences *preferences = [[WKPreferences alloc]init]; + preferences.javaScriptEnabled = YES; + preferences.javaScriptCanOpenWindowsAutomatically = YES; + preferences.minimumFontSize = 10; + configuration.preferences = preferences; + [configuration.userContentController addScriptMessageHandler:self name:@"JSCallback"]; + [configuration.userContentController addScriptMessageHandler:self name:@"htmlBack"]; + //防止搜索框自动放大 注入js代码 + WKUserContentController *userController = [WKUserContentController new]; + NSString *jScript = @"var script = document.createElement('meta');script.name = 'viewport';script.content='width=device-width,user-scalable=no';document.getElementsByTagName('head')[0].appendChild(script);"; + + WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; + WKUserContentController * wkUController = [[WKUserContentController alloc] init]; + [wkUController addScriptMessageHandler: self name: @"finishActivity"];//不带参数的调用 + + [wkUController addUserScript:wkUScript]; + configuration.userContentController= wkUController; + + self.wkWebView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, MyViewHEIGHT) configuration:configuration]; + self.wkWebView.navigationDelegate = self; + self.wkWebView.UIDelegate = self; + if (@available(iOS 11.0, *)) { + self.wkWebView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + [self.view addSubview:self.wkWebView]; + self.wkWebView.scrollView.bounces = false;//禁止滑动 + [self webViewRequest]; + /* + [self.wkWebView evaluateJavaScript:@"htmlBack" completionHandler:^(id _Nullable response, NSError * _Nullable error) { + NSLog(@"response: %@ error: %@", response, error); + if (response) { + [self back]; + } + }]; + */ + + +} + +- (void)finishActivity { + + +} + + +- (void)webViewRequest{ + NSString *urlString = self.webUrl; + [self hiddenAllMBProgressHUD]; + if (urlString.length > 0) { + [self showMBProgressHUDOnlyWithString:@"加载中"]; + NSURL *url = [NSURL URLWithString:urlString]; + NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; + if (self.wkWebView) { + [self.wkWebView loadRequest:urlRequest]; + } + } +} + + + + +#pragma mark - WKNavigationDelegate +- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{ + if ([message.name isEqualToString:@"JSCallback"]) { + if (message.body) { + NSData *jsonData = [message.body dataUsingEncoding:NSUTF8StringEncoding]; + NSError *err; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData + options:NSJSONReadingMutableContainers + error:&err]; + if(err) { + } + WkJSMessageType messageType = [[dic objectForKey:@"messageType"] intValue]; + switch (messageType) { + case WkJSMessageTypeBack:{ +// [self.navigationController popViewControllerAnimated:YES]; + } + break; + default: + break; + } + } + + } else if ([message.name isEqualToString:@"htmlBack"]) { + [[NSNotificationCenter defaultCenter] postNotificationName:@"fromWebToReloadData" object:nil]; + } +} + +#pragma mark - WKScriptMessageHandler +- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { + [self hiddenAllMBProgressHUD]; + if (!navigationAction.targetFrame.isMainFrame) { + [webView loadRequest:navigationAction.request]; + } + return nil; +} + +- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{ + if (!self.webTitle) { + self.title = @"加载中..."; + } +} + +- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{ + [self hiddenAllMBProgressHUD]; + + if (!self.webTitle) { + self.title = webView.title; + } + +} + +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(nonnull NSError *)error{ + [self hiddenAllMBProgressHUD]; +} + + + + + + + + + + + + + + +#pragma mark - ACTION +- (void)ToClickNavRight:(UIButton *)button{ + +} + + +#pragma mark - 自定义 +- (void)onBackClicked{ + if ( self.wkWebView.canGoBack){ + [self.wkWebView goBack]; + } else { + [self clearWebViewCache]; + } +} + +- (void)clearWebViewCache{ + if (iOS9Later) { + NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes]; + NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0]; + [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{ + NSLog(@"-----clear webView cache success------"); + }]; + } else { + NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; + NSString *cookiesFolderPath = [libraryPath stringByAppendingString:@"/Cookies"]; + NSError *errors; + [[NSFileManager defaultManager] removeItemAtPath:cookiesFolderPath error:&errors]; + if (!errors) { + NSLog(@"-----clear wkWebView cache success------"); + } + } +} +- (NSString *)URLEncodedString:(NSString *)urlString{ + NSString *encodePath ; + if (!IOS7) { + encodePath = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + }else{ + encodePath = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + }return encodePath; +} + + +#pragma mark - SETTER +- (void)setRightType:(RightNavType)rightType{ + _rightType = rightType; +} + +- (void)setWebUrl:(NSString *)webUrl{ + _webUrl = webUrl; + [self webViewRequest]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Base/DownPDFFileVC.h b/XinjiangProject/XinjiangProject/Project/Base/DownPDFFileVC.h new file mode 100644 index 0000000..0f5be9c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/DownPDFFileVC.h @@ -0,0 +1,18 @@ +// +// DownPDFFileVC.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/1. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DownPDFFileVC : HQBaseViewController + +@property (nonatomic, strong) NSString * PDFUrl; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Base/DownPDFFileVC.m b/XinjiangProject/XinjiangProject/Project/Base/DownPDFFileVC.m new file mode 100644 index 0000000..0eeeb9a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/DownPDFFileVC.m @@ -0,0 +1,31 @@ +// +// DownPDFFileVC.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/1. +// + +#import "DownPDFFileVC.h" + +@interface DownPDFFileVC () + +@end + +@implementation DownPDFFileVC + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Base/HQBaseNavigationController.h b/XinjiangProject/XinjiangProject/Project/Base/HQBaseNavigationController.h new file mode 100644 index 0000000..d5f667e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/HQBaseNavigationController.h @@ -0,0 +1,25 @@ +// +// HQBaseNavigationController.h +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQBaseNavigationController : UINavigationController + +/*! + * 返回到指定的类视图 + * + * @param ClassName 类名 + * @param animated 是否动画 + */ +-(BOOL)popToAppointViewController:(NSString *)ClassName animated:(BOOL)animated; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Base/HQBaseNavigationController.m b/XinjiangProject/XinjiangProject/Project/Base/HQBaseNavigationController.m new file mode 100644 index 0000000..2dd1432 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/HQBaseNavigationController.m @@ -0,0 +1,305 @@ +// +// HQBaseNavigationController.m +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import "HQBaseNavigationController.h" +#import "XYTransitionProtocol.h" +#import "XYTransition.h" + +@interface HQBaseNavigationController () + +@property (nonatomic, weak) id popDelegate; +@property (nonatomic,strong) UIPercentDrivenInteractiveTransition *interactivePopTransition; +@property (nonatomic,strong) UIScreenEdgePanGestureRecognizer *popRecognizer; +@property(nonatomic,assign) BOOL isSystemSlidBack;//是否开启系统右滑返回 + +@end + +@implementation HQBaseNavigationController + +//APP生命周期中 只会执行一次 ++ (void)initialize +{ + //导航栏主题 title文字属性 + UINavigationBar *navBar = [UINavigationBar appearance]; + //导航栏背景图 + [navBar setBackgroundImage:[UIImage imageNamed:@"navBackImg"] forBarMetrics:UIBarMetricsDefault]; + [navBar setBarTintColor:UIColorHex(#21BEBD)]; + [navBar setTintColor:UIColorHex(#21BEBD)]; + [navBar setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName :[UIFont systemFontOfSize:18 weight:UIFontWeightBold] }]; + [navBar setBackgroundImage:[UIImage imageWithColor:UIColorHex(#21BEBD)] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; + + if (@available(iOS 15.0,*) ) { + UINavigationBarAppearance *apperance = [[UINavigationBarAppearance alloc]init]; + + [apperance configureWithOpaqueBackground];// 重置背景和阴影颜色 + + apperance.backgroundColor = UIColorHex(#21BEBD); + + apperance.backgroundEffect = nil; + + // 去除导航栏阴影(如果不设置clear,导航栏底下会有一条阴影线) + + apperance.shadowColor = [UIColor clearColor]; + + [apperance setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]]; + + [apperance setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName : [UIFont systemFontOfSize:18 weight:UIFontWeightBold]}]; + + [[UINavigationBar appearance]setStandardAppearance:apperance]; + + [[UINavigationBar appearance]setScrollEdgeAppearance:apperance]; + + }else{ + + + + [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName :[UIFont systemFontOfSize:18 weight:UIFontWeightBold]}]; + + [[UINavigationBar appearance] setBarTintColor:UIColorHex(#21BEBD)]; + + [[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]]; + + + + } + [UITabBar appearance].translucent = NO; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.popDelegate = self.interactivePopGestureRecognizer.delegate; + self.delegate = self; + + //默认开启系统右划返回 + self.interactivePopGestureRecognizer.enabled = YES; + self.interactivePopGestureRecognizer.delegate = self; + + //只有在使用转场动画时,禁用系统手势,开启自定义右划手势 + _popRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleNavigationTransition:)]; + //下面是全屏返回 + // _popRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleNavigationTransition:)]; + _popRecognizer.edges = UIRectEdgeLeft; + [_popRecognizer setEnabled:NO]; + [self.view addGestureRecognizer:_popRecognizer]; +} + +//解决手势失效问题 +- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated +{ + if (_isSystemSlidBack) { + self.interactivePopGestureRecognizer.enabled = YES; + [_popRecognizer setEnabled:NO]; + }else{ + self.interactivePopGestureRecognizer.enabled = NO; + [_popRecognizer setEnabled:YES]; + } +} + +//根视图禁用右划返回 +-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ + return self.childViewControllers.count == 1 ? NO : YES; +} + +//push时隐藏tabbar +- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated +{ + if (self.viewControllers.count > 0) { + if ([viewController conformsToProtocol:@protocol(XYTransitionProtocol)] && [self isNeedTransition:viewController]) { + viewController.hidesBottomBarWhenPushed = NO; + }else{ + viewController.hidesBottomBarWhenPushed = YES; + } + + } + [super pushViewController:viewController animated:animated]; + // 修改tabBra的frame + CGRect frame = self.tabBarController.tabBar.frame; + frame.origin.y = [UIScreen mainScreen].bounds.size.height - frame.size.height; + self.tabBarController.tabBar.frame = frame; +} + +-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{ + + if ([viewController isKindOfClass:[HQBaseViewController class]]) { + HQBaseViewController * vc = (HQBaseViewController *)viewController; + if (vc.isHidenNaviBar) { + vc.view.top = 0; + [vc.navigationController setNavigationBarHidden:YES animated:animated]; + }else{ + vc.view.top = kTopHeight; + [vc.navigationController setNavigationBarHidden:NO animated:animated]; + } + } + + +} + +/** + * 返回到指定的类视图 + * + * @param ClassName 类名 + * @param animated 是否动画 + */ +-(BOOL)popToAppointViewController:(NSString *)ClassName animated:(BOOL)animated +{ + id vc = [self getCurrentViewControllerClass:ClassName]; + if(vc != nil && [vc isKindOfClass:[UIViewController class]]) + { + [self popToViewController:vc animated:animated]; + return YES; + } + + return NO; +} + +/*! + * 获得当前导航器显示的视图 + * + * @param ClassName 要获取的视图的名称 + * + * @return 成功返回对应的对象,失败返回nil; + */ +-(instancetype)getCurrentViewControllerClass:(NSString *)ClassName +{ + Class classObj = NSClassFromString(ClassName); + + NSArray * szArray = self.viewControllers; + for (id vc in szArray) { + if([vc isMemberOfClass:classObj]) + { + return vc; + } + } + + return nil; +} + + +-(UIViewController *)childViewControllerForStatusBarStyle{ + return self.topViewController; +} + + +#pragma mark ————— 转场动画区 ————— + +//navigation切换是会走这个代理 +-(id)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC +{ + NSLog(@"转场动画代理方法"); + self.isSystemSlidBack = YES; + //如果来源VC和目标VC都实现协议,那么都做动画 + if ([fromVC conformsToProtocol:@protocol(XYTransitionProtocol)] && [toVC conformsToProtocol:@protocol(XYTransitionProtocol)]) { + + BOOL pinterestNedd = [self isNeedTransition:fromVC:toVC]; + XYTransition *transion = [XYTransition new]; + if (operation == UINavigationControllerOperationPush && pinterestNedd) { + transion.isPush = YES; + + //暂时屏蔽带动画的右划返回 + self.isSystemSlidBack = NO; + // self.isSystemSlidBack = YES; + } + else if(operation == UINavigationControllerOperationPop && pinterestNedd) + { + //暂时屏蔽带动画的右划返回 + // return nil; + + transion.isPush = NO; + self.isSystemSlidBack = NO; + } + else{ + return nil; + } + return transion; + }else if([toVC conformsToProtocol:@protocol(XYTransitionProtocol)]){ + //如果只有目标VC开启动画,那么isSystemSlidBack也要随之改变 + BOOL pinterestNedd = [self isNeedTransition:toVC]; + self.isSystemSlidBack = !pinterestNedd; + return nil; + } + return nil; +} + +//判断fromVC和toVC是否需要实现pinterest效果 +-(BOOL)isNeedTransition:(UIViewController *)fromVC :(UIViewController *)toVC +{ + BOOL a = NO; + BOOL b = NO; + if ([fromVC respondsToSelector:@selector(isNeedTransition)] && [fromVC isNeedTransition]) { + a = YES; + } + if ([toVC respondsToSelector:@selector(isNeedTransition)] && [toVC isNeedTransition]) { + b = YES; + } + return (a && b) ; + +} +//判断fromVC和toVC是否需要实现pinterest效果 +-(BOOL)isNeedTransition:(UIViewController *)toVC +{ + BOOL b = NO; + if ([toVC respondsToSelector:@selector(isNeedTransition)] && [toVC isNeedTransition]) { + b = YES; + } + return b; + +} + +#pragma mark -- NavitionContollerDelegate +- (id)navigationController:(UINavigationController *)navigationController +interactionControllerForAnimationController:(id)animationController +{ + if (!self.interactivePopTransition) { return nil; } + return self.interactivePopTransition; +} + + +#pragma mark UIGestureRecognizer handlers + +- (void)handleNavigationTransition:(UIScreenEdgePanGestureRecognizer*)recognizer +{ + CGFloat progress = [recognizer translationInView:self.view].x / (self.view.bounds.size.width); + // progress = MIN(1.0, MAX(0.0, progress)); + NSLog(@"右划progress %.2f",progress); + + if (recognizer.state == UIGestureRecognizerStateBegan) { + self.interactivePopTransition = [[UIPercentDrivenInteractiveTransition alloc] init]; + [self popViewControllerAnimated:YES]; + } + else if (recognizer.state == UIGestureRecognizerStateChanged) { + [self.interactivePopTransition updateInteractiveTransition:progress]; + } + else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) { + CGPoint velocity = [recognizer velocityInView:recognizer.view]; + + if (progress > 0.5 || velocity.x >100) { + [self.interactivePopTransition finishInteractiveTransition]; + } + else { + [self.interactivePopTransition cancelInteractiveTransition]; + } + self.interactivePopTransition = nil; + } +} + + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* + #pragma mark - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Base/HQBaseTabBarController.h b/XinjiangProject/XinjiangProject/Project/Base/HQBaseTabBarController.h new file mode 100644 index 0000000..2ee7729 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/HQBaseTabBarController.h @@ -0,0 +1,25 @@ +// +// HQBaseTabBarController.h +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQBaseTabBarController : UITabBarController + +/** + 设置小红点 + + @param index tabbar下标 + @param isShow 是显示还是隐藏 + */ +-(void)setRedDotWithIndex:(NSInteger)index isShow:(BOOL)isShow isNumber:(NSInteger)number; + +@property (nonatomic, assign)NSInteger lastSelectIndex; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Base/HQBaseTabBarController.m b/XinjiangProject/XinjiangProject/Project/Base/HQBaseTabBarController.m new file mode 100644 index 0000000..3f3f119 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/HQBaseTabBarController.m @@ -0,0 +1,157 @@ +// +// HQBaseTabBarController.m +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import "HQBaseTabBarController.h" +#import "HQTabBar.h" +#import "MyCenterViewController.h" +#import "ChatListViewController.h" +//主控制器 +#import "QuestionViewController.h" +#import "MyCenterViewController.h" +#import "SosCenterViewController.h" +#import "HeartBadViewController.h" + +//干预二期 + +@interface HQBaseTabBarController () + +@property (nonatomic,strong) NSMutableArray * VCS;//tabbar root VC + +@property (nonatomic, assign) BOOL isConnecting; + +@property (nonatomic, strong) UIActivityIndicatorView *indicatorView; + +@property (nonatomic, copy) NSDictionary * dictionary; + +@property (nonatomic, assign) BOOL isPushed; + + + + +@end + +@implementation HQBaseTabBarController + + +- (void)viewDidLoad { + [super viewDidLoad]; + self.delegate = self; + + + //初始化tabbar + [self setUpTabBar]; + //添加子控制器 + [self setUpAllChildViewController]; + +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + self.isPushed = NO; +} + +- (void)viewWillDisappear:(BOOL)animated { + self.isPushed = YES; +} + +#pragma mark ————— 初始化TabBar ————— +-(void)setUpTabBar{ + //设置背景色 去掉分割线 + [self setValue:[HQTabBar new] forKey:@"tabBar"]; + [self.tabBar setBackgroundColor:[UIColor whiteColor]]; + [self.tabBar setBackgroundImage:[UIImage new]]; + //通过这两个参数来调整badge位置 +// [self.tabBar setTabIconWidth:95]; +// [self.tabBar setBadgeTop:9]; + [[HQTabBar appearance] setTranslucent:NO]; +} + +#pragma mark -——————— 初始化VC ———————— +-(void)setUpAllChildViewController{ + _VCS = @[].mutableCopy; + + QuestionViewController * questionVC = [[QuestionViewController alloc]init]; + [self setupChildViewController:questionVC title:@"咨询" imageName:@"Question_normal_icon" seleceImageName:@"Question_selected_icon"]; + + + SosCenterViewController * sosVC = [[SosCenterViewController alloc]init]; + [self setupChildViewController:sosVC title:@"就医" imageName:@"Question_normal_icon" seleceImageName:@"Question_selected_icon"]; + + HeartBadViewController * jianceVC = [[HeartBadViewController alloc]init]; + [self setupChildViewController:jianceVC title:@"监测" imageName:@"Question_normal_icon" seleceImageName:@"Question_selected_icon"]; + + + MyCenterViewController * centerVC = [[MyCenterViewController alloc] init]; + [self setupChildViewController:centerVC title:@"我的" imageName:@"mine_normal" seleceImageName:@"mine_selected"]; + + + self.viewControllers = _VCS; + +} + + +-(void)setupChildViewController:(UIViewController*)controller title:(NSString *)title imageName:(NSString *)imageName seleceImageName:(NSString *)selectImageName{ + controller.title = title; + controller.tabBarItem.title = title;//跟上面一样效果 + controller.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; + controller.tabBarItem.selectedImage = [[UIImage imageNamed:selectImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; + //未选中字体颜色 + [controller.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColorHex(#666666),NSFontAttributeName:SYSTEMFONT(10.0f)} forState:UIControlStateNormal]; + //选中字体颜色 + + [controller.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColorHex(#21BEBD),NSFontAttributeName:SYSTEMFONT(10.0f)} forState:UIControlStateSelected]; + //包装导航控制器 + HQBaseNavigationController *nav = [[HQBaseNavigationController alloc]initWithRootViewController:controller]; + + [_VCS addObject:nav]; + +} +-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController +{ +// tabbarSelect = [NSString stringWithFormat:@"%ld",tabBarController.selectedIndex]; +} + + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + + +- (void)dealloc { + +} + +#pragma mark - auto rotate +- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { + + return [self.selectedViewController preferredInterfaceOrientationForPresentation]; +} + +- (BOOL)shouldAutorotate { + + return [self.selectedViewController shouldAutorotate]; +} + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + + return [self.selectedViewController supportedInterfaceOrientations]; +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Base/HQBaseViewController.h b/XinjiangProject/XinjiangProject/Project/Base/HQBaseViewController.h new file mode 100644 index 0000000..a845046 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/HQBaseViewController.h @@ -0,0 +1,91 @@ +// +// HQBaseViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import +#import "MBProgressHUD.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HQBaseViewController : UIViewController + +/** + * 修改状态栏颜色 + */ +@property (nonatomic, assign) UIStatusBarStyle StatusBarStyle; + +/** + * 是否显示返回按钮,默认情况是YES + */ +@property (nonatomic, assign) BOOL isShowLiftBack; + +/** + 是否隐藏导航栏 + */ +@property (nonatomic, assign) BOOL isHidenNaviBar; + +/** + 是否需要登录 + */ +@property (nonatomic, assign) BOOL isNeedLogin; + +/** + 导航栏添加文本按钮 + + @param titles 文本数组 + @param isLeft 是否是左边 非左即右 + @param target 目标 + @param action 点击方法 + @param tags tags数组 回调区分用 + */ +- (void)addNavigationItemWithTitles:(NSArray *)titles isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags; + +/** + 导航栏添加图标按钮 + + @param imageNames 图标数组 + @param isLeft 是否是左边 非左即右 + @param target 目标 + @param action 点击方法 + @param tags tags数组 回调区分用 + */ +- (void)addNavigationItemWithImageNames:(NSArray *)imageNames isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags; +/** + * 展示轮型加载器 + * + * @param string 展示的内容 + * @param hidden yes自动隐藏 no不隐藏 + */ +- (void)showMBProgressHUDWithString:(NSString *)string autoHidden:(BOOL)hidden; + +/** + * 展示提醒文字后1.5秒后消失 + * + * @param string 展示信息 + */ +- (void)showMBProgressHUDOnlyWithString:(NSString *)string; +- (void)showMBProgressHUDOnlyWithString:(NSString *)string autoHidden:(BOOL)hidden; +- (void)showMBProgressHUDOnlyWithString:(NSString *)string haveDelegate:(BOOL)haveDelegate; +- (void)hudWasHidden:(MBProgressHUD *)hud; //代理方法 + +/** + * 展示提醒 有详情字符串 + * + * @param string 简述 + * @param detailString 详情 + */ +- (void)showMBProgressHUDWithString:(NSString *)string detailString:(NSString *)detailString; + + + +/** + * 隐藏提醒框 + */ +- (void)hiddenAllMBProgressHUD; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Base/HQBaseViewController.m b/XinjiangProject/XinjiangProject/Project/Base/HQBaseViewController.m new file mode 100644 index 0000000..ff3e492 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/HQBaseViewController.m @@ -0,0 +1,255 @@ +// +// HQBaseViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import "HQBaseViewController.h" +#import "HQLoginViewController.h" + +@interface HQBaseViewController () + +@end + +@implementation HQBaseViewController + +- (UIStatusBarStyle)preferredStatusBarStyle{ + return _StatusBarStyle; +} + + +//动态更新状态栏颜色 +-(void)setStatusBarStyle:(UIStatusBarStyle)StatusBarStyle{ + _StatusBarStyle=StatusBarStyle; + [self setNeedsStatusBarAppearanceUpdate]; +} +// + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + //是否显示返回按钮 + self.isShowLiftBack = YES; + //是否需要登录/默认no + //默认导航栏样式:黑字 + self.StatusBarStyle = UIStatusBarStyleLightContent; +} + +/** + * 是否显示返回按钮 + */ +- (void) setIsShowLiftBack:(BOOL)isShowLiftBack +{ + _isShowLiftBack = isShowLiftBack; + NSInteger VCCount = self.navigationController.viewControllers.count; + //下面判断的意义是 当VC所在的导航控制器中的VC个数大于1 或者 是present出来的VC时,才展示返回按钮,其他情况不展示 + if (isShowLiftBack && ( VCCount > 1 || self.navigationController.presentingViewController != nil)) { + [self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backBtnClicked) tags:nil]; + + } else { + self.navigationItem.hidesBackButton = YES; + UIBarButtonItem * NULLBar=[[UIBarButtonItem alloc]initWithCustomView:[UIView new]]; + self.navigationItem.leftBarButtonItem = NULLBar; + } +} + + + +- (void)backBtnClicked +{ + if (self.presentingViewController) { + [self dismissViewControllerAnimated:YES completion:nil]; + }else{ + [self.navigationController popViewControllerAnimated:YES]; + } +} + + +#pragma mark ————— 导航栏 添加图片按钮 ————— +/** + 导航栏添加图标按钮 + + @param imageNames 图标数组 + @param isLeft 是否是左边 非左即右 + @param target 目标 + @param action 点击方法 + @param tags tags数组 回调区分用 + */ +- (void)addNavigationItemWithImageNames:(NSArray *)imageNames isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags +{ + NSMutableArray * items = [[NSMutableArray alloc] init]; + //调整按钮位置 + // UIBarButtonItem* spaceItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; + // //将宽度设为负值 + // spaceItem.width= -5; + // [items addObject:spaceItem]; + NSInteger i = 0; + for (NSString * imageName in imageNames) { + UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; + [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal]; + + btn.frame = CGRectMake(0, 0, 30, 30); + [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + + btn.tag = [tags[i++] integerValue]; + + UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:btn]; + [items addObject:item]; + + } + if (isLeft) { + self.navigationItem.leftBarButtonItems = items; + } else { + self.navigationItem.rightBarButtonItems = items; + } +} + +#pragma mark ————— 导航栏 添加文字按钮 ————— +- (NSMutableArray *)addNavigationItemWithTitles:(NSArray *)titles isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags +{ + + NSMutableArray * items = [[NSMutableArray alloc] init]; + + NSMutableArray * buttonArray = [NSMutableArray array]; + NSInteger i = 0; + for (NSString * title in titles) { + UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; + btn.frame = CGRectMake(0, 0, 30, 30); + [btn setTitle:title forState:UIControlStateNormal]; + [btn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + btn.titleLabel.font = SYSTEMFONT(15); + btn.tag = [tags[i++] integerValue]; + [btn sizeToFit]; + + //设置偏移 + if (isLeft) { + [btn setContentEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 10)]; + }else{ + [btn setContentEdgeInsets:UIEdgeInsetsMake(0, 10, 0, -10)]; + } + + UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:btn]; + [items addObject:item]; + [buttonArray addObject:btn]; + } + if (isLeft) { + self.navigationItem.leftBarButtonItems = items; + } else { + self.navigationItem.rightBarButtonItems = items; + } + return buttonArray; +} +#pragma mark - 屏幕旋转 +-(UIInterfaceOrientationMask)supportedInterfaceOrientations +{ + //当前支持的旋转类型 + return UIInterfaceOrientationMaskPortrait; +} + +- (BOOL)shouldAutorotate +{ + // 是否支持旋转 + return NO; +} + +-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation +{ + // 默认进去类型 + return UIInterfaceOrientationPortrait; +} + +#pragma mark - ProgressHUD +/** + * 展示轮型加载器 + * + * @param string 展示的内容 + * @param hidden yes自动隐藏 no不隐藏 + */ +- (void)showMBProgressHUDWithString:(NSString *)string autoHidden:(BOOL)hidden +{ + MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:kApplication.keyWindow animated:YES]; + HUD.backgroundColor = RGBA(0, 0, 0, 0.5); + if (string != nil && ![string isEqualToString:@""]) + { + HUD.label.text = string; + } + if (hidden) + { + [HUD hideAnimated:YES afterDelay:2]; + } +} + +/** + * 展示提醒文字后1.5秒后消失 + * + * @param string 展示信息 + */ +- (void)showMBProgressHUDOnlyWithString:(NSString *)string +{ + [self showMBProgressHUDOnlyWithString:string haveDelegate:NO]; +} +- (void)showMBProgressHUDOnlyWithString:(NSString *)string haveDelegate:(BOOL)haveDelegate +{ + MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + HUD.mode = MBProgressHUDModeText;//only show label + if (!ValidStr(string)) { + HUD.label.text = string; + + } + HUD.label.textColor = KWhiteColor; + HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor; + HUD.bezelView.color = UIColor.blackColor; + HUD.userInteractionEnabled = NO; + + if (haveDelegate) + { + HUD.delegate = self; + } + [HUD hideAnimated:YES afterDelay:3]; +} + +- (void)showMBProgressHUDOnlyWithString:(NSString *)string autoHidden:(BOOL)hidden +{ + MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:kApplication.keyWindow animated:YES]; + HUD.mode = MBProgressHUDModeText;//only show label + HUD.label.text = string; + if (hidden) + { + [HUD hideAnimated:YES afterDelay:1.5]; + } +} + +- (void)showMBProgressHUDWithString:(NSString *)string detailString:(NSString *)detailString +{ + MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + HUD.mode = MBProgressHUDModeText; + HUD.label.text = string; + HUD.detailsLabel.text = detailString; + [HUD hideAnimated:YES afterDelay:1.5]; +} + +- (void)hiddenAllMBProgressHUD +{ + + [MBProgressHUD hideHUDForView:kApplication.keyWindow animated:YES]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Base/TabBarView/HQTabBar.h b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/HQTabBar.h new file mode 100755 index 0000000..8f392fb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/HQTabBar.h @@ -0,0 +1,13 @@ +// +// HQTabBar.h +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// + +#import + +@interface HQTabBar : UITabBar + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Base/TabBarView/HQTabBar.m b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/HQTabBar.m new file mode 100755 index 0000000..32fb4cf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/HQTabBar.m @@ -0,0 +1,60 @@ +// +// HQTabBar.m +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// + +#import "HQTabBar.h" +@interface HQTabBar() + +@property (nonatomic,assign)UIEdgeInsets oldSafeAreaInsets; + +@end + +@implementation HQTabBar + + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + // 设置tabBarItem选中状态时的颜色 + self.tintColor = UIColorHex(#21BEBD); + } + + return self; +} + + +- (void) safeAreaInsetsDidChange +{ + [super safeAreaInsetsDidChange]; + if(self.oldSafeAreaInsets.left != self.safeAreaInsets.left || + self.oldSafeAreaInsets.right != self.safeAreaInsets.right || + self.oldSafeAreaInsets.top != self.safeAreaInsets.top || + self.oldSafeAreaInsets.bottom != self.safeAreaInsets.bottom) + { + self.oldSafeAreaInsets = self.safeAreaInsets; + [self invalidateIntrinsicContentSize]; + [self.superview setNeedsLayout]; + [self.superview layoutSubviews]; + } + +} +- (CGSize) sizeThatFits:(CGSize) size +{ + CGSize s = [super sizeThatFits:size]; + if(@available(iOS 11.0, *)) + { + CGFloat bottomInset = self.safeAreaInsets.bottom; + if( bottomInset > 0 && s.height < 50) { + s.height += bottomInset; + } + } + return s; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Base/TabBarView/UITabBar+CustomBadge.h b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/UITabBar+CustomBadge.h new file mode 100755 index 0000000..163d6f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/UITabBar+CustomBadge.h @@ -0,0 +1,32 @@ +// +// UITabBar+CustomBadge.h +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// + +#import +typedef NS_ENUM(NSUInteger, CustomBadgeType){ + kCustomBadgeStyleRedDot, + kCustomBadgeStyleNumber, + kCustomBadgeStyleNone +}; +@interface UITabBar (CustomBadge) +/** + *设置tab上icon的宽度,用于调整badge的位置 + */ +- (void)setTabIconWidth:(CGFloat)width; + +/** + *设置badge的top + */ +- (void)setBadgeTop:(CGFloat)top; + +/** + *设置badge样、数字 + */ +- (void)setBadgeStyle:(CustomBadgeType)type value:(NSInteger)badgeValue atIndex:(NSInteger)index; + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Base/TabBarView/UITabBar+CustomBadge.m b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/UITabBar+CustomBadge.m new file mode 100755 index 0000000..8b526b2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Base/TabBarView/UITabBar+CustomBadge.m @@ -0,0 +1,115 @@ +// +// UITabBar+CustomBadge.m +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// + +#import "UITabBar+CustomBadge.h" +#import + +static NSString * const kBadgeViewInitedKey = @"kBadgeViewInited"; +static NSString * const kBadgeDotViewsKey = @"kBadgeDotViewsKey"; +static NSString * const kBadgeNumberViewsKey = @"kBadgeNumberViewsKey"; +static NSString * const kTabIconWidth = @"kTabIconWidth"; +static NSString * const kBadgeTop = @"kBadgeTop"; + +@implementation UITabBar (CustomBadge) + +-(void)setTabIconWidth:(CGFloat)width{ + [self setValue:@(width) forUndefinedKey:kTabIconWidth]; +} + +-(void)setBadgeTop:(CGFloat)top{ + [self setValue:@(top) forUndefinedKey:kBadgeTop]; +} + +-(void)setBadgeStyle:(CustomBadgeType)type value:(NSInteger)badgeValue atIndex:(NSInteger)index{ + if( ![[self valueForKey:kBadgeViewInitedKey] boolValue] ){ + [self setValue:@(YES) forKey:kBadgeViewInitedKey]; + [self addBadgeViews]; + } + NSMutableArray *badgeDotViews = [self valueForKey:kBadgeDotViewsKey]; + NSMutableArray *badgeNumberViews = [self valueForKey:kBadgeNumberViewsKey]; + + [badgeDotViews[index] setHidden:YES]; + [badgeNumberViews[index] setHidden:YES]; + + if(type == kCustomBadgeStyleRedDot){ + [badgeDotViews[index] setHidden:NO]; + + }else if(type == kCustomBadgeStyleNumber){ + [badgeNumberViews[index] setHidden:NO]; + UILabel *label = badgeNumberViews[index]; + [self adjustBadgeNumberViewWithLabel:label number:badgeValue]; + + }else if(type == kCustomBadgeStyleNone){ + } +} + +-(void)addBadgeViews{ + id idIconWith = [self valueForKey:kTabIconWidth]; + CGFloat tabIconWidth = idIconWith ? [idIconWith floatValue] : 32; + id idBadgeTop = [self valueForKey:kBadgeTop]; + CGFloat badgeTop = idBadgeTop ? [idBadgeTop floatValue] : 11; + + NSInteger itemsCount = self.items.count; + CGFloat itemWidth = self.bounds.size.width / itemsCount; + + //dot views + NSMutableArray *badgeDotViews = [NSMutableArray new]; + for(int i = 0;i < itemsCount;i ++){ + UIView *redDot = [UIView new]; + redDot.bounds = CGRectMake(0, 0, 10, 10); + redDot.center = CGPointMake(itemWidth*(i+0.5)+tabIconWidth/2, badgeTop); + redDot.layer.cornerRadius = redDot.bounds.size.width/2; + redDot.clipsToBounds = YES; + redDot.backgroundColor = [UIColor redColor]; + redDot.hidden = YES; + [self addSubview:redDot]; + [badgeDotViews addObject:redDot]; + } + [self setValue:badgeDotViews forKey:kBadgeDotViewsKey]; + + //number views + NSMutableArray *badgeNumberViews = [NSMutableArray new]; + for(int i = 0;i < itemsCount;i ++){ + UILabel *redNum = [UILabel new]; + redNum.layer.anchorPoint = CGPointMake(0, 0.5); + redNum.bounds = CGRectMake(0, 0, 20, 14); + redNum.center = CGPointMake(itemWidth*(i+0.5)+tabIconWidth/2-10, badgeTop); + redNum.layer.cornerRadius = redNum.bounds.size.height/2; + redNum.clipsToBounds = YES; + redNum.backgroundColor = [UIColor redColor]; + redNum.hidden = YES; + + redNum.textAlignment = NSTextAlignmentCenter; + redNum.font = [UIFont systemFontOfSize:12]; + redNum.textColor = [UIColor whiteColor]; + + [self addSubview:redNum]; + [badgeNumberViews addObject:redNum]; + } + [self setValue:badgeNumberViews forKey:kBadgeNumberViewsKey]; +} + +-(void)adjustBadgeNumberViewWithLabel:(UILabel *)label number:(NSInteger)number{ + [label setText:(number > 99 ? @"..." : @(number).stringValue)]; + if(number < 10){ + label.bounds = CGRectMake(0, 0, 14, 14); + }else if(number < 99){ + label.bounds = CGRectMake(0, 0, 20, 14); + }else{ + label.bounds = CGRectMake(0, 0, 20, 14); + } +} + +-(id)valueForUndefinedKey:(NSString *)key{ + return objc_getAssociatedObject(self, (__bridge const void *)(key)); +} + +-(void)setValue:(id)value forUndefinedKey:(NSString *)key{ + objc_setAssociatedObject(self, (__bridge const void *)(key), value, OBJC_ASSOCIATION_COPY); +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomSystemEvaluateModel.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomSystemEvaluateModel.h new file mode 100644 index 0000000..0e3fbc8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomSystemEvaluateModel.h @@ -0,0 +1,26 @@ +// +// CustomSystemEvaluateModel.h +// EscortProject +// +// Created by Apple on 2024/6/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomSystemEvaluateModel : NSObject + + +@property (nonatomic, copy) NSString * title; + +@property (nonatomic, copy) NSString * content; + +@property (nonatomic, assign) NSInteger type; + +@property (nonatomic, assign) CGFloat systemHeight; +//CGFloat textMaxWidth = 245.f; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomSystemEvaluateModel.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomSystemEvaluateModel.m new file mode 100644 index 0000000..829b6fc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomSystemEvaluateModel.m @@ -0,0 +1,12 @@ +// +// CustomSystemEvaluateModel.m +// EscortProject +// +// Created by Apple on 2024/6/19. +// + +#import "CustomSystemEvaluateModel.h" + +@implementation CustomSystemEvaluateModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTUIHistoryModel.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTUIHistoryModel.h new file mode 100644 index 0000000..9c4a965 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTUIHistoryModel.h @@ -0,0 +1,42 @@ +// +// CustomTUIHistoryModel.h +// EscortProject +// +// Created by Apple on 2024/6/21. +// + +#import + +typedef NS_ENUM(NSUInteger, MessageType) { + MessageTypeText, + MessageTypeImage, + MessageTypeVideo, + MessageTypeReviceCustom,//评论消息 + MessageTypeMapCustom,//地图消息 + MessageTypeDoctorCard,//医生名片 + MessageTypeHealthData,//健康档案 +}; + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomTUIHistoryModel : NSObject + +@property (nonatomic, assign) BOOL isSelf; +@property (nonatomic, copy) NSString * avatar;//头像 +@property (nonatomic, copy) NSString * content; +@property (nonatomic, strong) NSString * image; +//视频 +@property (nonatomic, copy) NSString * VideoUrl; +@property (nonatomic, copy) NSString * ThumbUrl; +@property (nonatomic, assign) CGFloat videoHeight; + +@property (nonatomic, assign) NSString * customData; +@property (nonatomic, assign) CGFloat textHeight; +//评论 +@property (nonatomic, copy) NSString * title; +@property (nonatomic, assign) CGFloat systemHeight; +@property (nonatomic, assign) MessageType msgType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTUIHistoryModel.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTUIHistoryModel.m new file mode 100644 index 0000000..afd93e7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTUIHistoryModel.m @@ -0,0 +1,12 @@ + // +// CustomTUIHistoryModel.m +// EscortProject +// +// Created by Apple on 2024/6/21. +// + +#import "CustomTUIHistoryModel.h" + +@implementation CustomTUIHistoryModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTextModel.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTextModel.h new file mode 100644 index 0000000..aec4837 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTextModel.h @@ -0,0 +1,24 @@ +// +// CustomTextModel.h +// EscortProject +// +// Created by Apple on 2024/6/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomTextModel : NSObject + +@property (nonatomic, copy) NSString * text; + +@property (nonatomic, copy) NSString * imageHeard; + +@property (nonatomic, assign) BOOL isSelf; + +@property (nonatomic, assign) CGFloat textHeight; +//CGFloat textMaxWidth = 245.f; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTextModel.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTextModel.m new file mode 100644 index 0000000..d714621 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomModel/CustomTextModel.m @@ -0,0 +1,12 @@ +// +// CustomTextModel.m +// EscortProject +// +// Created by Apple on 2024/6/19. +// + +#import "CustomTextModel.h" + +@implementation CustomTextModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomTUIModel.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomTUIModel.h new file mode 100644 index 0000000..7dbbf5b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomTUIModel.h @@ -0,0 +1,60 @@ +// +// CustomTUIModel.h +// EscortProject +// +// Created by Apple on 2024/6/17. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + + +@interface DataContent : NSObject +@property (nonatomic, copy) NSString *businessID; +@property (nonatomic, copy) NSString *title; +@property (nonatomic, assign) NSInteger type; +@property (nonatomic, copy) NSString *content; +@end + + +@interface MsgContent : NSObject + +@property (nonatomic, copy) NSString *Text; //文本消息 + +@property (nonatomic, strong) DataContent *Data; //自定义消息 + +@property (nonatomic, strong) NSString *ThumbUrl; //缩略图 + +@property (nonatomic, strong) NSString * VideoUrl; //缩略图 + +@end + + +@interface MsgBody : NSObject +@property (nonatomic, strong) MsgContent *MsgContent; +@property (nonatomic, copy) NSString *MsgType; +@end + + +@interface CustomTUIModel : NSObject + +@property (nonatomic, assign) BOOL isSelf; +@property (nonatomic, assign) NSInteger OnlineOnlyFlag; +@property (nonatomic, copy) NSString *CallbackCommand; +@property (nonatomic, strong) NSArray *MsgBody; +@property (nonatomic, copy) NSString *Operator_Account; +@property (nonatomic, copy) NSString *GroupId; +@property (nonatomic, copy) NSString *Type; +@property (nonatomic, assign) NSInteger Random; +@property (nonatomic, assign) NSInteger EventTime; +@property (nonatomic, copy) NSString *MsgPriority; +@property (nonatomic, assign) NSInteger MsgSeq; +@property (nonatomic, copy) NSString *From_Account; +@property (nonatomic, assign) NSInteger MsgTime; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomTUIModel.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomTUIModel.m new file mode 100644 index 0000000..a1595b5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/CustomTUIModel.m @@ -0,0 +1,53 @@ +// +// CustomTUIModel.m +// EscortProject +// +// Created by Apple on 2024/6/17. +// + +#import "CustomTUIModel.h" + +@implementation DataContent + + +@end + + +@implementation MsgBody + + + +@end + +@implementation MsgContent + ++ (NSDictionary *)modelCustomPropertyMapper { + return @{ + @"Data" : @"Data" + }; +} + +- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic { + + if ([dic.allKeys containsObject:@"Data"]) { + NSString *dataString = dic[@"Data"]; + NSData *data = [dataString dataUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *dataDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + self.Data = [DataContent modelWithDictionary:dataDict]; + } + return YES; +} + + +@end + +@implementation CustomTUIModel + ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{ + @"MsgBody" : [MsgBody class], + }; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIBaseMessageController.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIBaseMessageController.h new file mode 100644 index 0000000..57ebc22 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIBaseMessageController.h @@ -0,0 +1,18 @@ +// +// CustomTUIBaseMessageController.h +// EscortProject +// +// Created by Apple on 2024/6/12. +// + +#import "TUIBaseMessageController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomTUIBaseMessageController : HQBaseViewController + +@property(nonatomic, strong) NSString * groupID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIBaseMessageController.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIBaseMessageController.m new file mode 100644 index 0000000..b8c6970 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIBaseMessageController.m @@ -0,0 +1,244 @@ +// +// CustomTUIBaseMessageController.m +// EscortProject +// +// Created by Apple on 2024/6/12. +// + +#import "CustomTUIBaseMessageController.h" +#import "TUIChatDataProvider.h" +#import "TUIChatPopMenu.h" +#import "TUIFaceMessageCell.h" +#import "TUIFaceView.h" +#import "TUIFileMessageCell.h" +#import "TUIFileViewController.h" +#import "TUIImageMessageCell.h" +#import "TUIJoinGroupMessageCell.h" +#import "TUILinkCell.h" +#import "TUIMediaView.h" +#import "TUIMergeMessageCell.h" +#import "TUIMergeMessageListController.h" +#import "TUIMessageDataProvider.h" +#import "TUIMessageProgressManager.h" +#import "TUIMessageReadViewController.h" +#import "TUIOrderCell.h" +#import "TUIReferenceMessageCell.h" +#import "TUIRepliesDetailViewController.h" +#import "TUIReplyMessageCell.h" +#import "TUIReplyMessageCellData.h" +#import "TUITextMessageCell.h" +#import "TUIVideoMessageCell.h" +#import "TUIVoiceMessageCell.h" +#import "CustomMapMessageCell.h" +#import "CustomTUIModel.h" +//自定义模型 + +#import "CustomTextModel.h" +#import "CustomSystemEvaluateModel.h" +#import "CustomTUIHistoryModel.h" +#import "CustomTUIHistoryTable.h" + + +@interface CustomTUIBaseMessageController () + +@property(nonatomic, strong) CustomTUIHistoryTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation CustomTUIBaseMessageController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + //获取历史记录 + [self createUI]; + self.navigationItem.title = @"聊天记录"; + [self getHistoryData]; + +} + +- (void)createUI { + + self.homeTable = [[CustomTUIHistoryTable alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight) style:UITableViewStyleGrouped]; + + [self.view addSubview:self.homeTable]; + + +} + +- (void)getHistoryData { +//http:192.168.1.28/health-consultation/api/consult/conSession/selectImMessagePageListSession?groupId=1801087415104962560&pageNo=1&pageSize=10 + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.groupID forKey:@"groupId"]; + + JKCQAPI * agreeAPI = [[JKCQAPI alloc] init:self tag:@"HISTORYAPI" NeedToken:@""]; + + [agreeAPI GetAllHistoryChatRecord:nil]; + + +// NSDictionary * responDic = @{@"OnlineOnlyFlag":@"0", +// @"CallbackCommand":@"Group.CallbackAfterSendMsg", +// @"CloudCustomData":@"", +// @"MsgBody":@[@{@"MsgContent":@{@"Text":@"您好,欢迎咨询,请输入您的问题?"}, +// @"MsgType":@"TIMTextElem"}], +// @"Operator_Account":@"administrator", +// @"GroupId":@"1800813149574791168", +// @"Type":@"Public", +// @"Random":@(4294967295), +// @"EventTime":@(1718182290636), +// @"MsgPriority":@"High", +// @"MsgSeq":@(1), +// @"From_Account":@"1684154499493081089", +// @"MsgTime":@(1718182290)}; +// + +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [EasyTextView showErrorText:message]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"HISTORYAPI"]) { + //解析模型 + NSDictionary * responDic = response; + CustomTUIModel * model = [CustomTUIModel modelWithDictionary:responDic]; + //用户信息 + HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + if ([user.user_id isEqualToString:model.From_Account]) { + model.isSelf = true; + }else + { + model.isSelf = false; + } + + for (MsgBody *msgBody in model.MsgBody) { + NSLog(@"MsgType: %@", msgBody.MsgType); + NSLog(@"MsgContent Data - title: %@", msgBody.MsgContent.Text); + + if([msgBody.MsgType isEqualToString:@"TIMTextElem"]) //文本消息 + { + CustomTUIHistoryModel * textModel = [[CustomTUIHistoryModel alloc] init]; + textModel.content = msgBody.MsgContent.Text; + textModel.isSelf = model.isSelf; + //计算文本高度 宽度245 + CGSize size = [self calculateTextSize:textModel.content withFont:[UIFont systemFontOfSize:13]]; + textModel.textHeight = size.height; + textModel.msgType = MessageTypeText; + [self.dataArray addObject:textModel]; + + } + if([msgBody.MsgType isEqualToString:@"TIMVideoFileElem"]) //视频消息 + { + CustomTUIHistoryModel * textModel = [[CustomTUIHistoryModel alloc] init]; + textModel.content = msgBody.MsgContent.Text; + textModel.isSelf = model.isSelf; + textModel.ThumbUrl = msgBody.MsgContent.ThumbUrl; + textModel.VideoUrl = msgBody.MsgContent.VideoUrl; + textModel.videoHeight = 245; + //计算文本高度 宽度245 + CGSize size = [self calculateTextSize:textModel.content withFont:[UIFont systemFontOfSize:13]]; + textModel.textHeight = size.height; + textModel.msgType = MessageTypeText; + [self.dataArray addObject:textModel]; + + } + + if([msgBody.MsgType isEqualToString:@"TIMCustomElem"]) //自定义消息 + { + if ( [msgBody.MsgContent.Data.businessID isEqualToString:@"system"])//自定义评论 + + { + UILabel * commanLabel = [[UILabel alloc] init]; + CGFloat h = [HQCommonUtils getSpaceLabelHeight:commanLabel withStr:msgBody.MsgContent.Data.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2]; + CGFloat textMaxWidth = 245.f; + CGFloat textMaxHeight = h + 100; + + CustomTUIHistoryModel * systemModel = [[CustomTUIHistoryModel alloc] init]; + systemModel.title = msgBody.MsgContent.Data.title; + systemModel.content = msgBody.MsgContent.Data.content; + //计算文本高度 宽度245 + CGSize size = [self calculateTextSize:systemModel.content withFont:[UIFont systemFontOfSize:13]]; + systemModel.systemHeight = size.height; + systemModel.textHeight = MessageTypeReviceCustom; + [self.dataArray addObject:systemModel]; + + } + + } + + + + if([msgBody.MsgType isEqualToString:@"TIMCustomElem"]) //自定义消息 + { + if ( [msgBody.MsgContent.Data.businessID isEqualToString:@"system"])//自定义评论 + + { + UILabel * commanLabel = [[UILabel alloc] init]; + CGFloat h = [HQCommonUtils getSpaceLabelHeight:commanLabel withStr:msgBody.MsgContent.Data.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2]; + CGFloat textMaxWidth = 245.f; + CGFloat textMaxHeight = h + 100; + + CustomSystemEvaluateModel * systemModel = [[CustomSystemEvaluateModel alloc] init]; + systemModel.title = msgBody.MsgContent.Data.title; + systemModel.content = msgBody.MsgContent.Data.content; + //计算文本高度 宽度245 + CGSize size = [self calculateTextSize:systemModel.content withFont:[UIFont systemFontOfSize:13]]; + systemModel.systemHeight = size.height; + [self.dataArray addObject:systemModel]; + + } + } + } + //自己造一个文本model + + self.homeTable.dataArray = self.dataArray; + + } + +} + +- (CGSize)calculateTextSize:(NSString *)text withFont:(UIFont *)font { + // 限制宽度为245 + CGFloat maxWidth = 245.0; + CGFloat verticalPadding = 20.0; // 上下各10点边距 + + // 创建限制尺寸 + CGSize maxSize = CGSizeMake(maxWidth, CGFLOAT_MAX); + + // 设置文本属性 + NSDictionary *attributes = @{NSFontAttributeName: font}; + + // 计算文本矩形 + CGRect textRect = [text boundingRectWithSize:maxSize + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:attributes + context:nil]; + + // 返回计算出的尺寸,并加上上下边距 + return CGSizeMake(textRect.size.width, textRect.size.height + verticalPadding); +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIHistoryTable.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIHistoryTable.h new file mode 100644 index 0000000..f249abd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIHistoryTable.h @@ -0,0 +1,18 @@ +// +// CustomTUIHistoryTable.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomTUIHistoryTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIHistoryTable.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIHistoryTable.m new file mode 100644 index 0000000..1dea67f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/VC/CustomTUIHistoryTable.m @@ -0,0 +1,164 @@ +// +// CustomTUIHistoryTable.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomTUIHistoryTable.h" +#import "CustomMapMessageCell.h" +#import "CustomSystemTextCell.h" +#import "CustomSystemImageCell.h" +#import "CustomHealthFileVideoCell.h" +#import "CustomAudioCell.h" +#import "CustomHealthReportVideoCell.h" +#import "CustomReviceTableViewCell.h" +#import "CustomTUIHistoryModel.h" +#import "CustomDoctorIDTableViewCell.h" + +@interface CustomTUIHistoryTable() + +@end + +@implementation CustomTUIHistoryTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + + [self reloadData]; + +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + + return 1; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.dataArray.count; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + CustomTUIHistoryModel * model = self.dataArray[indexPath.row]; + + if (model.msgType == MessageTypeText) // 文本消息 + { + CustomSystemTextCell * textCell = [[CustomSystemTextCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TEXTCELLID"]; + + textCell.model = model; + + textCell.backgroundColor = KClearColor; + return textCell; + } + if (model.msgType == MessageTypeImage) // 图文消息 + { + CustomSystemImageCell * iamgeCell = [[CustomSystemImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"IMAGECELLID"]; + + + return iamgeCell; + } + if (model.msgType == MessageTypeVideo) // 视频消息 + { + CustomSystemImageCell * iamgeCell = [[CustomSystemImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"IMAGECELLID"]; + + return iamgeCell; + } + if (model.msgType == MessageTypeMapCustom) // 地图消息 + { + CustomMapMessageCell * mapCell = [[CustomMapMessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MAPCELLID"]; + + return mapCell; + } + if (model.msgType == MessageTypeReviceCustom) // 评论消息 + { + CustomReviceTableViewCell * reviceCell = [[CustomReviceTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"REVICECELLID"]; + + return reviceCell; + } + if (model.msgType == MessageTypeDoctorCard) // 文本消息 + { + + CustomDoctorIDTableViewCell * reviceCell = [[CustomDoctorIDTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"REVICECELLID"]; + + return reviceCell; + } + if (model.msgType == MessageTypeHealthData) // 健康档案 + { + + } + return UITableViewCell.new; +} +////每行高度 +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +//{ +// +// return 40; +//} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +//组头 --- 组尾 + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + + return [UIView new]; + +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [UIView new]; + +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomAudioCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomAudioCell.h new file mode 100644 index 0000000..6eea7d6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomAudioCell.h @@ -0,0 +1,16 @@ +// +// CustomAudioCell.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomAudioCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomAudioCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomAudioCell.m new file mode 100644 index 0000000..bb10684 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomAudioCell.m @@ -0,0 +1,23 @@ +// +// CustomAudioCell.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomAudioCell.h" + +@implementation CustomAudioCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomDoctorIDTableViewCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomDoctorIDTableViewCell.h new file mode 100644 index 0000000..ace5b7a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomDoctorIDTableViewCell.h @@ -0,0 +1,16 @@ +// +// CustomDoctorIDTableViewCell.h +// EscortProject +// +// Created by Apple on 2024/7/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomDoctorIDTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomDoctorIDTableViewCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomDoctorIDTableViewCell.m new file mode 100644 index 0000000..86ce2c3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomDoctorIDTableViewCell.m @@ -0,0 +1,23 @@ +// +// CustomDoctorIDTableViewCell.m +// EscortProject +// +// Created by Apple on 2024/7/5. +// + +#import "CustomDoctorIDTableViewCell.h" + +@implementation CustomDoctorIDTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthFileVideoCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthFileVideoCell.h new file mode 100644 index 0000000..21a0c4d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthFileVideoCell.h @@ -0,0 +1,16 @@ +// +// CustomHealthFileVideoCell.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomHealthFileVideoCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthFileVideoCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthFileVideoCell.m new file mode 100644 index 0000000..f334c68 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthFileVideoCell.m @@ -0,0 +1,23 @@ +// +// CustomHealthFileVideoCell.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomHealthFileVideoCell.h" + +@implementation CustomHealthFileVideoCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthReportVideoCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthReportVideoCell.h new file mode 100644 index 0000000..14b1cac --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthReportVideoCell.h @@ -0,0 +1,16 @@ +// +// CustomHealthReportVideoCell.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomHealthReportVideoCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthReportVideoCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthReportVideoCell.m new file mode 100644 index 0000000..fed2751 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomHealthReportVideoCell.m @@ -0,0 +1,39 @@ +// +// CustomHealthReportVideoCell.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomHealthReportVideoCell.h" + +@implementation CustomHealthReportVideoCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style + reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomMapMessageCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomMapMessageCell.h new file mode 100644 index 0000000..0142b26 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomMapMessageCell.h @@ -0,0 +1,17 @@ +// +// CustomMapMessageCell.h +// EscortProject +// +// Created by Apple on 2024/6/12. +// + +#import +#import +#import "CustomMapMessageCellData.h" + + +@interface CustomMapMessageCell : UITableViewCell + + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomMapMessageCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomMapMessageCell.m new file mode 100644 index 0000000..08ad66b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomMapMessageCell.m @@ -0,0 +1,79 @@ +// +// CustomMapMessageCell.m +// EscortProject +// +// Created by Apple on 2024/6/12. +// + +#import "CustomMapMessageCell.h" + +@interface CustomMapMessageCell () + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) UILabel * connetLabel; + + +@end + +@implementation CustomMapMessageCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + + [self createUI]; + + + } + return self; +} + +- (void)createUI { + + self.heardImage = [[UIImageView alloc] init]; + self.heardImage.backgroundColor = KRedColor; + [self.contentView addSubview:self.heardImage]; + self.heardImage.layer.cornerRadius = 15; + self.heardImage.layer.masksToBounds = true; + [self.heardImage mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@30); + }]; + + self.connetLabel = [[UILabel alloc] init]; + self.connetLabel.backgroundColor = KRedColor; + [self.contentView addSubview:self.heardImage]; + self.connetLabel.layer.cornerRadius = 10; + self.connetLabel.layer.masksToBounds = true; + self.connetLabel.numberOfLines = 0; + [self.connetLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.heardImage.right).offset(8); + make.top.mas_equalTo(@10); + make.width.mas_equalTo(@245.0); + }]; + [self.connetLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + +} + + + +@end + + diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomReviceTableViewCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomReviceTableViewCell.h new file mode 100644 index 0000000..c0c4b33 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomReviceTableViewCell.h @@ -0,0 +1,16 @@ +// +// CustomReviceTableViewCell.h +// EscortProject +// +// Created by Apple on 2024/7/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomReviceTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomReviceTableViewCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomReviceTableViewCell.m new file mode 100644 index 0000000..da470e9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomReviceTableViewCell.m @@ -0,0 +1,23 @@ +// +// CustomReviceTableViewCell.m +// EscortProject +// +// Created by Apple on 2024/7/5. +// + +#import "CustomReviceTableViewCell.h" + +@implementation CustomReviceTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemImageCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemImageCell.h new file mode 100644 index 0000000..0380026 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemImageCell.h @@ -0,0 +1,19 @@ +// +// CustomSystemImageCell.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import +#import "CustomTUIHistoryModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface CustomSystemImageCell : UITableViewCell + +@property (nonatomic, strong) CustomTUIHistoryModel * model; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemImageCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemImageCell.m new file mode 100644 index 0000000..58e64f5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemImageCell.m @@ -0,0 +1,102 @@ +// +// CustomSystemImageCell.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomSystemImageCell.h" + +@interface CustomSystemImageCell () + +@property (nonatomic, strong) UIImageView * phoneImage; + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) UIImageView * connetLabel; + +@end + +@implementation CustomSystemImageCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style + reuseIdentifier:reuseIdentifier]) { + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.phoneImage = [[UIImageView alloc] init]; + self.phoneImage.backgroundColor = KRedColor; + [self.contentView addSubview:self.phoneImage]; + self.phoneImage.layer.cornerRadius = 10; + self.phoneImage.layer.masksToBounds = true; + [self.phoneImage mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@100); + }]; + + +} +- (void)setModel:(CustomTUIHistoryModel *)model { + + _model = model; + + if (_model.isSelf == true) { //头像在右 + + [self.heardImage mas_updateConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@30); + }]; + + [self.connetLabel mas_updateConstraints:^(MASConstraintMaker *make) { + + make.right.mas_equalTo(self.heardImage.left).offset(8); + make.top.mas_equalTo(@10); + make.width.mas_equalTo(@245.0); + make.bottom.mas_offset(8); + }]; + [self.connetLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + }else + { + [self.heardImage mas_updateConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@30); + }]; + + [self.connetLabel mas_updateConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.heardImage.right).offset(8); + make.top.mas_equalTo(@10); + make.width.mas_equalTo(@245.0); + make.bottom.mas_offset(8); + }]; + } + + + [self.heardImage sd_setImageWithURL: [NSURL URLWithString: [NSString stringWithFormat:@"%@",_model.avatar]] placeholderImage:PLACEHOLD_IMG]; + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemTextCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemTextCell.h new file mode 100644 index 0000000..545d60b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemTextCell.h @@ -0,0 +1,17 @@ +// +// CustomSystemTextCell.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import +#import "CustomTUIHistoryModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomSystemTextCell : UITableViewCell +@property (nonatomic, strong) CustomTUIHistoryModel * model; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemTextCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemTextCell.m new file mode 100644 index 0000000..5a54655 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemTextCell.m @@ -0,0 +1,167 @@ +// +// CustomSystemTextCell.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomSystemTextCell.h" + +@interface CustomSystemTextCell () + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) UILabel * connetLabel; + +@property (nonatomic, strong) UILabel * nickNameLabel; + +@end + +@implementation CustomSystemTextCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + + [self createUI]; + + + } + return self; +} + +- (void)createUI { + + self.heardImage = [[UIImageView alloc] init]; + self.heardImage.backgroundColor = KWhiteColor; + self.heardImage.image = [UIImage imageNamed:@"heard_man"]; + [self.contentView addSubview:self.heardImage]; + self.heardImage.layer.cornerRadius = 20; + self.heardImage.layer.masksToBounds = true; + [self.heardImage mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@30); + }]; + + self.nickNameLabel = [[UILabel alloc] init]; + self.nickNameLabel.text = @"全科医生"; + [self.contentView addSubview:self.nickNameLabel]; + self.nickNameLabel.font = SYSTEMFONT(12); + [self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.heardImage.mas_right).offset(10); + make.top.mas_equalTo(@10); + make.width.mas_equalTo(@300.0); + make.height.mas_offset(13); + }]; + + + self.connetLabel = [[UILabel alloc] init]; + self.connetLabel.backgroundColor = KWhiteColor; + [self.contentView addSubview:self.connetLabel]; + self.connetLabel.font = SYSTEMFONT(15); + self.connetLabel.layer.cornerRadius = 10; + self.connetLabel.layer.masksToBounds = true; + self.connetLabel.numberOfLines = 0; + [self.connetLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.heardImage.mas_right).offset(8); + make.top.mas_equalTo(self.nickNameLabel.mas_bottom).offset(2); + make.width.mas_equalTo(@300.0); + make.bottom.mas_offset(8); + }]; + [self.connetLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(0); + make.bottom.mas_equalTo(self.connetLabel.mas_bottom).offset(10); + }]; +} + +- (void)setModel:(CustomTUIHistoryModel *)model { + + _model = model; + + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.firstLineHeadIndent = 10.0; // 左边距 + paragraphStyle.headIndent = 10.0; // 左边距 + paragraphStyle.tailIndent = -10.0; // 右边距 + + NSDictionary *attributes = @{ + NSParagraphStyleAttributeName: paragraphStyle + }; + + NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:model.content attributes:attributes]; + + // 将带有内边距的 attributedText 赋值给 UILabel + self.connetLabel.attributedText = attributedText; + + if (_model.isSelf == true) { //头像在右 + + [self.heardImage mas_updateConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@30); + }]; + + [self.connetLabel mas_updateConstraints:^(MASConstraintMaker *make) { + + make.right.mas_equalTo(self.heardImage.mas_left).offset(10); + make.top.mas_equalTo(@10); + make.width.mas_equalTo(@300.0); + make.bottom.mas_offset(8); + }]; + [self.connetLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + }else + { + [self.heardImage mas_updateConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.top.mas_equalTo(@8); + make.height.width.mas_equalTo(@40); + }]; + + [self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.heardImage.mas_right).offset(10); + make.top.mas_equalTo(@10); + make.width.mas_equalTo(@300.0); + make.height.mas_offset(13); + }]; + + + [self.connetLabel mas_updateConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.heardImage.mas_right).offset(10); + make.top.mas_equalTo(self.nickNameLabel.mas_bottom).offset(5); + make.width.mas_equalTo(@245.0); + make.bottom.mas_offset(8); + }]; + } + [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(0); + make.bottom.mas_equalTo(self.connetLabel.mas_bottom).offset(10); + }]; + [self.contentView layoutIfNeeded]; + +// [self.heardImage sd_setImageWithURL: [NSURL URLWithString: [NSString stringWithFormat:@"%@",_model.avatar]] placeholderImage:PLACEHOLD_IMG]; + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemVideoCell.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemVideoCell.h new file mode 100644 index 0000000..ca5f9f1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemVideoCell.h @@ -0,0 +1,16 @@ +// +// CustomSystemVideoCell.h +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomSystemVideoCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemVideoCell.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemVideoCell.m new file mode 100644 index 0000000..c4ed379 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cell/CustomSystemVideoCell.m @@ -0,0 +1,23 @@ +// +// CustomSystemVideoCell.m +// EscortProject +// +// Created by Apple on 2024/6/14. +// + +#import "CustomSystemVideoCell.h" + +@implementation CustomSystemVideoCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cellData/CustomMapMessageCellData.h b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cellData/CustomMapMessageCellData.h new file mode 100644 index 0000000..5fec76d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cellData/CustomMapMessageCellData.h @@ -0,0 +1,18 @@ +// +// CustomMapMessageCellData.h +// EscortProject +// +// Created by Apple on 2024/6/12. +// + +#import "TUIMessageCellData.h" +#import + + +@interface CustomMapMessageCellData : TUIBubbleMessageCellData + +@property (nonatomic, copy) NSString *text; +@property (nonatomic, copy) NSString * MapPictureImg; + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cellData/CustomMapMessageCellData.m b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cellData/CustomMapMessageCellData.m new file mode 100644 index 0000000..3632559 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/CustomTUIChat/cellData/CustomMapMessageCellData.m @@ -0,0 +1,79 @@ +// +// CustomMapMessageCellData.m +// EscortProject +// +// Created by Apple on 2024/6/12. +// + +#import "CustomMapMessageCellData.h" +#import + +@implementation CustomMapMessageCellData + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ +// NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.locationElem.desc options:NSJSONReadingAllowFragments error:nil]; + CustomMapMessageCellData *cellData = [[CustomMapMessageCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.text = message.locationElem.desc; + cellData.MapPictureImg = [self mapLocationImage:message.locationElem.longitude Withlation:message.locationElem.latitude]; + cellData.reuseId = @"MapMessageCustomCell"; + cellData.showAvatar = true; +// cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + + ++ (NSString *)mapLocationImage:(CGFloat)longLation Withlation:(CGFloat)lation { + // 0: self.longLation,self.lation + //https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png + NSString * staciUrl = @"https://restapi.amap.com/v3/staticmap?key=9e4aac9a04b8296e9039adce3b472f28"; + NSString * mapKey = @"9e4aac9a04b8296e9039adce3b472f28"; + NSString * loctaionUrl = @"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png"; + + NSString * needMdString = [NSString stringWithFormat:@"key=%@&location=%f,%f&markers=-1,%@,0:%f,%f&size=700*500&zoom=154985aa1abb49ce2daa20d032a374eb58",mapKey,longLation,lation,loctaionUrl,longLation,lation]; + + + NSString * mapUrl = [NSString stringWithFormat:@"%@&location=%f,%f&markers=-1,%@,0:%f,%f&size=700*500&zoom=15&sig=%@",staciUrl,longLation,lation,loctaionUrl,longLation,lation,[self md5:needMdString]]; + + return mapUrl; + + + +} +//md加密 ++ (NSString *)md5:(NSString *)str +{ + const char *cStr = [str UTF8String]; + unsigned char result[16]; + CC_MD5(cStr, strlen(cStr), result); // This is the md5 call + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} + + + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + + CGFloat textMaxWidth = 245.f; + + CGSize size = CGSizeMake(textMaxWidth, 170); + return size; +} + + + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/HQLoginViewController.h b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/HQLoginViewController.h new file mode 100644 index 0000000..f3170e7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/HQLoginViewController.h @@ -0,0 +1,16 @@ +// +// HQLoginViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HQLoginViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/HQLoginViewController.m b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/HQLoginViewController.m new file mode 100644 index 0000000..0891e62 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/HQLoginViewController.m @@ -0,0 +1,576 @@ +// +// HQLoginViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "HQLoginViewController.h" +#import "TUIC2CChatViewController.h" +#import "LoginFoundPasswordViewController.h" +#import "IMUserInfoModel.h" +#import "RSAObjC.h" +#import "MineCenterUserModel.h" +#import "ADJumpViewController.h" +#import "HQRegisterViewController.h" +#import "LVKeyboard.h" +#import "MQTextField.h" +@interface HQLoginViewController () + +@property (nonatomic, strong) UITextField * userNameField; + +@property (nonatomic, strong) MQTextField * passwordField; + +@property (nonatomic, strong) UIButton * logoBtn; + +@property (nonatomic, strong) UIView * loginView; + +@property (nonatomic, strong) UIButton * privacyPolicyBtn; + +@property (nonatomic, strong) UIButton * agreenBtn; + +@property (nonatomic, strong) IMUserInfoModel * model ; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) UIButton * regisBtn; + +@property (nonatomic, strong) LVKeyboard *keyboard; + +@property (nonatomic, strong) UIButton *toggleButton; + +@end + +@implementation HQLoginViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = YES; + self.view.backgroundColor = KWhiteColor; + [self createUI]; + [self createData]; +// [self ishiderRegisData]; + //初始化键盘 + LVKeyboard *keyboard = [[LVKeyboard alloc] init]; + keyboard.delegate = self; + self.keyboard = keyboard; + + +} + +- (void)createUI { + + UIImageView * topBackImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(243))]; + topBackImg.image = IMAGE_NAMED(@"loginTopBimg"); + topBackImg.userInteractionEnabled = true; + [self.view addSubview:topBackImg]; + + UIImageView * cenetrImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, kRealValue(70), kRealValue(68), kRealValue(68))]; + cenetrImg.centerX = self.view.centerX; + cenetrImg.image = IMAGE_NAMED(@"login_icon"); + cenetrImg.userInteractionEnabled = true; + [self.view addSubview:cenetrImg]; + + UIButton * homeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + homeBtn.frame = CGRectMake(kRealValue(15), kRealValue(40),kRealValue(100), 41); + [homeBtn setTitle:@"< 去首页" forState:UIControlStateNormal]; + [homeBtn.titleLabel setFont:BOLDSYSTEMFONT(14)]; + [homeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [homeBtn addTarget:self action:@selector(backHomeAction) forControlEvents:UIControlEventTouchUpInside]; + [topBackImg addSubview:homeBtn]; + + UIImageView *titleImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, cenetrImg.bottom + kRealValue(20), kRealValue(109), kRealValue(24))]; + titleImg.centerX = self.view.centerX; + titleImg.image = IMAGE_NAMED(@"loginTitle_Img"); + [self.view addSubview:titleImg]; +// + UIView *loginView = [[UIView alloc]init]; + loginView.frame = CGRectMake(0, titleImg.bottom + kRealValue(41), kScreenWidth, kScreenHeight - titleImg.bottom - kRealValue(41)); + [self.view addSubview:loginView]; + loginView.backgroundColor = KWhiteColor; + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:loginView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(20, 20)]; + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.path = maskPath.CGPath; + loginView.layer.mask = maskLayer; + self.loginView = loginView; +// + UITextField *accountField = [[UITextField alloc]init]; + accountField.frame = CGRectMake(kRealValue(35), kRealValue(36), loginView.width - kRealValue(70), 40); + accountField.placeholder = @"请输入用户名"; + accountField.font = BOLDSYSTEMFONT(14); + accountField.textColor = CFontColor1; + self.userNameField = accountField; + self.userNameField.backgroundColor = UIColorHex(#EEEEEE); + self.userNameField.layer.cornerRadius = 20; + self.userNameField.layer.masksToBounds = true; + UIView * leftview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 40)]; + self.userNameField.leftView = leftview; + self.userNameField.leftViewMode = UITextFieldViewModeAlways; + [loginView addSubview:accountField ]; +// +// + MQTextField * passwordField = [[MQTextField alloc]init]; + passwordField.frame = CGRectMake(kRealValue(35), accountField.bottom + kRealValue(19), accountField.width, accountField.height); + passwordField.placeholder = @"请输入密码"; + passwordField.font = BOLDSYSTEMFONT(14); + passwordField.textColor = CFontColor1; + passwordField.backgroundColor = UIColorHex(#EEEEEE); + passwordField.secureTextEntry = YES; + self.passwordField = passwordField; + self.passwordField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 40)]; + self.passwordField.leftViewMode = UITextFieldViewModeAlways; + self.passwordField.layer.cornerRadius = 20; + self.passwordField.layer.masksToBounds = true; + self.passwordField.delegate = self; + self.passwordField.inputView = self.keyboard; + + self.toggleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [self.toggleButton setImage:[UIImage imageNamed:@"eye"] forState:UIControlStateNormal]; + [self.toggleButton setImage:[UIImage imageNamed:@"eye.slash"] forState:UIControlStateSelected]; + self.toggleButton.frame = CGRectMake(0, 5, 30,30); + [self.toggleButton addTarget:self action:@selector(togglePasswordVisibility) forControlEvents:UIControlEventTouchUpInside]; + // 创建一个容器视图来包含按钮,并增加边距 + UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; + [rightView addSubview:self.toggleButton]; + + // 调整按钮在容器视图中的位置,增加边距 + self.toggleButton.center = CGPointMake(rightView.frame.size.width - self.toggleButton.frame.size.width / 2, rightView.frame.size.height / 2); + self.passwordField.rightView = rightView; + self.passwordField.rightViewMode = UITextFieldViewModeAlways; + + [loginView addSubview:passwordField]; + + + + + UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + loginBtn.frame = CGRectMake(kRealValue(35), self.passwordField.bottom + kRealValue(19), WIDTH - kRealValue(70), 41); + [loginBtn setTitle:@"登录" forState:UIControlStateNormal]; + [loginBtn.titleLabel setFont:BOLDSYSTEMFONT(14)]; + [loginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [loginBtn setBackgroundImage:[UIImage imageNamed:@"loginBtn_img"] forState:UIControlStateNormal]; + [loginBtn addTarget:self action:@selector(toClickFootBtn:) forControlEvents:UIControlEventTouchUpInside]; + [loginView addSubview:loginBtn]; + + UIButton * foundPasswordBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + foundPasswordBtn.frame = CGRectMake(kRealValue(35), loginBtn.bottom + kRealValue(10), WIDTH - kRealValue(70), 20); + [foundPasswordBtn setTitle:@"找回密码" forState:UIControlStateNormal]; + foundPasswordBtn.titleLabel.font = MEDIUMFONT(14); + [foundPasswordBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal]; + [foundPasswordBtn addTarget:self action:@selector(foundUserPasswordAction) forControlEvents:UIControlEventTouchUpInside]; + [loginView addSubview:foundPasswordBtn]; + + + UIButton * regisBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + regisBtn.frame = CGRectMake(kRealValue(35), foundPasswordBtn.bottom + kRealValue(20), kScreenWidth - kRealValue(70), 20); + [regisBtn setTitle:@"注册" forState:UIControlStateNormal]; + self.regisBtn = regisBtn; + regisBtn.titleLabel.font = MEDIUMFONT(14); + self.regisBtn.hidden = true; + [regisBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal]; + [regisBtn addTarget:self action:@selector(regisAction) forControlEvents:UIControlEventTouchUpInside]; + [loginView addSubview:regisBtn]; + + [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"LOGINAgree"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + NSUserDefaults * agreeDefaul = [NSUserDefaults standardUserDefaults]; + + NSString * agree = [agreeDefaul objectForKey:@"LOGINAgree"]; + + self.agreenBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + self.agreenBtn.frame = CGRectMake(kRealValue(28), self.view.bottom - kRealValue(45) - SafetyAreaHeight, kRealValue(20), kRealValue(20)); + [self.agreenBtn addTarget:self action:@selector(agreeProtocolAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.agreenBtn setImage:IMAGE_NAMED(@"login_nomalProtocol") forState:UIControlStateNormal]; + [self.agreenBtn setImage:IMAGE_NAMED(@"login_selectProtocol") forState:UIControlStateSelected]; + if ([agree intValue] == 1) { + self.agreenBtn.selected = true; + }else + { + self.agreenBtn.selected = false; + } + [self.view addSubview:self.agreenBtn]; + + + //隐私 + YYLabel * yslabel = [[YYLabel alloc] initWithFrame:CGRectMake(self.agreenBtn.right + kRealValue(5) ,self.agreenBtn.top , kScreenWidth - self.agreenBtn.right - kRealValue(47), 20)]; + [self.view addSubview:yslabel]; + yslabel.numberOfLines = 0; + + NSString *string = @"已阅读并同意《用户协议》、《隐私政策》"; + NSMutableAttributedString *attributed = [[NSMutableAttributedString alloc] initWithString:string]; + [attributed setAttribute:NSForegroundColorAttributeName value:UIColorHex(#3390FF) range:[string rangeOfString:@"《用户协议》"]]; + [attributed setAttribute:NSForegroundColorAttributeName value:UIColorHex(#3390FF) range:[string rangeOfString:@"《隐私政策》"]]; +// [attributed setAttribute:NSForegroundColorAttributeName value:UIColorHex(#3390FF) range:[string rangeOfString:@"《相关法律说明》"]]; + + YYTextHighlight * protocolHightlight = [[YYTextHighlight alloc] init]; + protocolHightlight.userInfo = @{@"协议":@"《用户协议》"}; + [protocolHightlight setColor:UIColorHex(#3390FF)]; + [attributed setTextHighlight:protocolHightlight range:[string rangeOfString:@"《用户协议》"]]; + + YYTextHighlight * layHightlight = [[YYTextHighlight alloc] init]; + layHightlight.userInfo = @{@"隐私":@"《隐私政策》"}; + [layHightlight setColor:UIColorHex(#3390FF)]; + [attributed setTextHighlight:layHightlight range:[string rangeOfString:@"《隐私政策》"]]; + +// +// YYTextHighlight * shuoHightlight = [[YYTextHighlight alloc] init]; +// shuoHightlight.userInfo = @{@"说明":@"《相关法律说明》"}; +// [shuoHightlight setColor:UIColorHex(#3390FF)]; +// [attributed setTextHighlight:shuoHightlight range:[string rangeOfString:@"《相关法律说明》"]]; + + attributed.lineSpacing = 3; + attributed.paragraphSpacing = 5; + yslabel.attributedText = attributed; + + yslabel.highlightTapAction = ^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + NSString *string = [text.string substringWithRange:range]; + if ([string containsString:@"用户协议"]){ + if (self.dataArray.count <= 0) { + [EasyTextView showErrorText:@"暂无用户协议"]; + return; + } + for (MineCenterUserModel * model in self.dataArray) { + + if ([model.value integerValue] == 1) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"用户协议"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + + } + if ([string containsString:@"隐私政策"]){ + if (self.dataArray.count <= 0) { + [EasyTextView showErrorText:@"暂无隐私政策"]; + return; + } + for (MineCenterUserModel * model in self.dataArray) { + if ([model.value integerValue] == 2) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"隐私政策"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + } + } + if ([string containsString:@"相关法律说明"]){ + for (MineCenterUserModel * model in self.dataArray) { + if ([model.value integerValue] == 3) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"相关法律说明"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + } + } + }; + +} +- (void)createData { + + JKCQAPI * agreeAPI = [[JKCQAPI alloc] init:self tag:@"AGREEAPI" NeedToken:@""]; + + [agreeAPI getUserAgreementPrivacy:nil]; + +} + + +#pragma mark - ACTION +- (void)toClickFootBtn:(UIButton *)button{ + + if (self.agreenBtn.selected == false) { + [EasyTextView showErrorText:@"请选阅读并同意用户服务协议与隐私"]; + return;; + } + + + + if (self.userNameField.text.length < 1) { + [EasyTextView showErrorText:@"请输入用户名"]; + return;; + } + + if (self.passwordField.text.length < 12 || self.passwordField.text.length > 32) { + + + + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"密码不安全,请先修改密码" preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + + }]; + UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + + LoginFoundPasswordViewController * modifVC = [[LoginFoundPasswordViewController alloc] init]; + [self.navigationController pushViewController:modifVC animated:YES]; + + }]; + [alertController addAction:cancelAction]; + [alertController addAction:sureAction]; + + [self presentViewController:alertController animated:YES completion:nil]; + + + return;; + } + + if (self.passwordField.text.length < 1) { + [EasyTextView showErrorText:@"请输入密码"]; + return;; + } + + NSString * publish_key = @" MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmZfR/bA9X3vp86y1aEpvwzXJYKRRF1fLau2+05/ZtaITLpV8bhkmSf3neSy/Q9gAdvG75Fr73E+GWE+K5b0BpvIS1jDGo319+PpZR39SaZTKZ27XFXrosmJTZutN79t819HS1VseleunHAFgMVufE9U5jP6LGzl/wbkSy01GhzwIDAQAB"; + + // 原始数据,要加密的字符串 + NSString *originalString = self.passwordField.text; + + // RSA 加密,使用字符串格式的公钥私钥加密解密, RSAPublickKey 为公钥字符串(NSString 格式) + NSString *encryptStr = [RSAObjC encrypt:originalString PublicKey:publish_key]; + + [self showMBProgressHUDWithString:@"登录中" autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.userNameField.text forKey:@"username"]; + //新增 + UIDevice *currentDevice = [UIDevice currentDevice]; + NSString * phone = [currentDevice getCurrentDeviceModel]; +// NSString * system = [NSString stringWithFormat:@"%.1f",CurrentSystemVersion] ; + if (!ValidStr(phone)) { + [parmDic setObject:phone forKey:@"deviceType"]; + + } + [parmDic setObject:@(CurrentSystemVersion) forKey:@"deviceSystem"]; + + [parmDic setObject:encryptStr forKey:@"password"]; + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"LOGINGAPI" NeedToken:nil]; + [proctocolApi PostLogin:parmDic]; + +// +// NSString * userSig = @""; +// if ([self.userNameField.text isEqual:@"111"]) { +// +// userSig = @"eAEtzMsKgkAUBuB3OdtCzow2N3CTiZs01F4gcmpOkYgjUUTvnjhtv--ygeO*jXx3Pw0DdWBYgig1l1ytl2Sih51VSLHhUqgkqKcrGGhjXZZFvap2mTvnLneHbXOrG1k5XcT4Vk1Bo2Uq471PIQzta5gNjMBEIQZ72nE*4xH*O9TZfqILLcwYg*8PBAYuZw__"; +// }else { +// userSig = @"eAEtzLsOgjAUBuB36arB9gR6gMSBQV0g0UBwcTFpK0esaQARY3x3iXX9-subVXkZ9Ko9O0eKpSLkHBNAiJe-ZCCrZ5UoI0CUodeeLixl1xticRRCtmbf2M0z2dVVsS2jCbKHMK-Tyo1NVotykdvDmvmlnhx186PkYcy5t1F38xsE-N8hpe8DGfIMwD5fblkvWg__"; +// } +// +// [ESCTUIManager loginInitTUISDKUserID:self.userNameField.text userSig:userSig]; +// +// + +} + +#pragma mark -网络请求处理 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + [self showMBProgressHUDOnlyWithString:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"LOGINGAPI"]) { + [self hiddenAllMBProgressHUD]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"AVATAR"]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"placeholdImg"]; + + NSDictionary * dic = response; + HQUserInfo * user = [[HQUserInfo alloc] init]; + user.userInfo = [dic objectForKey:@"userInfo"]; + user.token = [dic objectForKey:@"token"]; + [HQCommonUtils keyedArchiverWithData:user key:LoginUserInfo]; + [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"LOGINAgree"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + NSString * avatar = @""; + NSString * placeholdImg ; + if (!ValidStr(user.avatar)) { + avatar = user.avatar; + }else + { + if ([user.sex_dictText isEqualToString:@"女"]) { + placeholdImg = @"heard_man"; + }else + { + placeholdImg = @"heard_woman"; + } + } + if (ValidStr(user.personType) || [user.personType intValue] != 1 ) { + + [self showMBProgressHUDOnlyWithString:@"账号或登录密码错误,请重试"]; + return; + } + [[NSUserDefaults standardUserDefaults] setObject:avatar forKey:@"AVATAR"]; + [[NSUserDefaults standardUserDefaults] setObject:placeholdImg forKey:@"placeholdImg"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + KPostNotification(KNotificationLoginStateChange, @YES); + //登录im + [self loginImAccount]; + } + if ([tag isEqualToString:@"IMAPI"]) { + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init]; + + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + } + if ([tag isEqualToString:@"AGREEAPI"]) { + + NSArray * array = response; + + for (NSDictionary * parmDic in array) { + + MineCenterUserModel * model = [MineCenterUserModel modelWithDictionary:parmDic]; + https://api.cqygjk.com/health-consultation/api/consult/conDoctor/selectDictList?dictKey=qh_jump_url + [self.dataArray addObject:model]; + + } + + } + if ([tag isEqualToString:@"VERSIONAPI"]) { + + NSString * version = response; + + + NSBundle *mainBundle = [NSBundle mainBundle]; + if (mainBundle) { + NSString *version = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; +// NSString *build = [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]; +// NSString *displayName = [mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]; +// NSString *fullVersion = [NSString stringWithFormat:@"%@ %@ (Build %@)", displayName, version, build]; + if([version floatValue] < [version floatValue]) { + self.regisBtn.hidden = true; + }else + { + self.regisBtn.hidden = false; + } + } + } +} + + +- (void)backHomeAction { + + KPostNotification(KNotificationLoginStateChange, @YES); + +} + + +- (void)loginImAccount { + + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + + + +} +//建议整体禁用(复制、粘贴、全选等都被禁用了) +-(BOOL)canPerformAction:(SEL)action withSender:(id)sender{ + + UIMenuController *menuController = [UIMenuController sharedMenuController]; + if (menuController) { + [UIMenuController sharedMenuController].menuVisible = NO; + } + return NO; +} + +- (void)agreeProtocolAction:(UIButton *)agreeBtn { + + agreeBtn.selected = !agreeBtn.selected; + + +} +#pragma mark:找回密码 +- (void)foundUserPasswordAction { +// GastoremteroscopeViewController * resultAppointVC = [[GastoremteroscopeViewController alloc] init]; +// [self.navigationController pushViewController:resultAppointVC animated:YES]; + LoginFoundPasswordViewController * foundVC = [[LoginFoundPasswordViewController alloc] init]; + + [self.navigationController pushViewController:foundVC animated:YES]; +} + +- (void)ishiderRegisData { + + + JKCQAPI * versionAPI = [[JKCQAPI alloc] init:self tag:@"VERSIONAPI" NeedToken:@""]; + + [versionAPI getVesionHideRegis:@{@"type":@"app_update_user_ios"}.mutableCopy]; + + +} + +#pragma mark:注册 +- (void)regisAction { + + HQRegisterViewController * forgetVc = [[HQRegisterViewController alloc] init]; + + [self presentViewController:forgetVc animated:YES completion:nil]; +} + + +-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField { + + if(textField == self.passwordField) { + + self.passwordField.inputView = self.keyboard; + } + return YES; + +} + +- (void)keyboard:(LVKeyboard *)keyboard didClickDeleteButton:(UIButton *)deleteBtn string:(NSMutableString *)string { + self.passwordField.text = string; +} + +- (void)keyboard:(LVKeyboard *)keyboard didClickTextButton:(UIButton *)textBtn string:(NSMutableString *)string { + self.passwordField.text = string; +} + + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self.passwordField resignFirstResponder]; +} + +- (void)togglePasswordVisibility { + self.passwordField.secureTextEntry = !self.passwordField.secureTextEntry; + self.toggleButton.selected = !self.toggleButton.selected; +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginFoundPasswordViewController.h b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginFoundPasswordViewController.h new file mode 100644 index 0000000..6f4a6bf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginFoundPasswordViewController.h @@ -0,0 +1,16 @@ +// +// LoginFoundPasswordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LoginFoundPasswordViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginFoundPasswordViewController.m b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginFoundPasswordViewController.m new file mode 100644 index 0000000..ca8e062 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginFoundPasswordViewController.m @@ -0,0 +1,211 @@ +// +// LoginFoundPasswordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "LoginFoundPasswordViewController.h" +#import "LoginSetPasswordViewController.h" +#import "LVKeyboard.h" +#import "MQTextField.h" +@interface LoginFoundPasswordViewController () + +@property (nonatomic, strong)UITextField * nameTextFild; +@property (nonatomic, strong)UITextField * phoneTextFild; +@property (nonatomic, strong)MQTextField * codeTextFild; +@property (nonatomic, strong)UIButton * codeButton; +@property (nonatomic, strong) LVKeyboard *keyboard; + +@end + +@implementation LoginFoundPasswordViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"修改密码"; + // Do any additional setup after loading the view. + self.view.backgroundColor = UIColorHex(#E0E0E0); + [self createUI]; +} + +- (void)createUI { + + + //初始化键盘 + LVKeyboard *keyboard = [[LVKeyboard alloc] init]; + keyboard.delegate = self; + self.keyboard = keyboard; + + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(151))]; + topView.backgroundColor = KWhiteColor; + [self.view addSubview:topView]; + + + + UIView * nameLeft = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 112, kRealValue(50))]; + UILabel * nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 80, kRealValue(50))]; + nameLabel.text = @"用户姓名"; + nameLabel.textAlignment = NSTextAlignmentLeft; + nameLabel.font = SYSTEMFONT(13); + nameLabel.textColor = UIColorHex(#666666); + [nameLeft addSubview:nameLabel]; + + + self.nameTextFild = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(50))]; + self.nameTextFild.placeholder = @"请输入用户姓名"; + self.nameTextFild.returnKeyType = UIReturnKeyDone; + self.nameTextFild.font = [UIFont systemFontOfSize:14]; + self.nameTextFild.backgroundColor = KWhiteColor; + self.nameTextFild.leftView = nameLeft; + self.nameTextFild.leftViewMode = UITextFieldViewModeAlways; + self.nameTextFild.font = SYSTEMFONT(14); + [topView addSubview:self.nameTextFild]; + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(16, self.nameTextFild.bottom, kScreenWidth - 32, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [topView addSubview:linv]; + + UIView * codeLeft = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 112, kRealValue(50))]; + UILabel * codeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 90, kRealValue(50))]; + codeLabel.text = @"身份证号"; + codeLabel.textAlignment = NSTextAlignmentLeft; + codeLabel.font = SYSTEMFONT(13); + codeLabel.textColor = UIColorHex(#666666); + + [codeLeft addSubview:codeLabel]; + + self.codeTextFild = [[MQTextField alloc] initWithFrame:CGRectMake(0, self.nameTextFild.bottom+1, kScreenWidth, kRealValue(50))]; + self.codeTextFild.placeholder = @"请输入用户身份证号"; + self.codeTextFild.font = [UIFont systemFontOfSize:14]; + self.codeTextFild.backgroundColor = KWhiteColor; + self.codeTextFild.inputView = self.keyboard; + self.codeTextFild.delegate = self; + self.codeTextFild.leftView = codeLeft; + self.codeTextFild.leftViewMode = UITextFieldViewModeAlways; + [topView addSubview:self.codeTextFild]; + + UIView * linvCard = [[UIView alloc] initWithFrame:CGRectMake(16, self.codeTextFild.bottom, kScreenWidth - 32, 1)]; + linvCard.backgroundColor = UIColorHex(#E0E0E0); + [topView addSubview:linvCard]; + + + UIView * phoneLeft = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 112, kRealValue(50))]; + UILabel * phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 90, kRealValue(50))]; + phoneLabel.text = @"手机号"; + phoneLabel.textAlignment = NSTextAlignmentLeft; + phoneLabel.font = SYSTEMFONT(13); + phoneLabel.textColor = UIColorHex(#666666); + [phoneLeft addSubview:phoneLabel]; + + self.phoneTextFild = [[UITextField alloc] initWithFrame:CGRectMake(0, self.codeTextFild.bottom+1, kScreenWidth, kRealValue(50))]; + self.phoneTextFild.placeholder = @"请输入用户手机号"; + self.phoneTextFild.font = [UIFont systemFontOfSize:14]; + self.phoneTextFild.backgroundColor = KWhiteColor; + self.phoneTextFild.leftView = phoneLeft; + self.phoneTextFild.keyboardType = UIKeyboardTypeNumberPad; + self.phoneTextFild.leftViewMode = UITextFieldViewModeAlways; + [topView addSubview:self.phoneTextFild]; + + UIView * phoneLinv = [[UIView alloc] initWithFrame:CGRectMake(16, self.phoneTextFild.bottom, kScreenWidth - 32, 1)]; + phoneLinv.backgroundColor = UIColorHex(#E0E0E0); + [topView addSubview:phoneLinv]; + + + UIButton * loginBtn = [[UIButton alloc] initWithFrame:CGRectMake(48,self.phoneTextFild.bottom+58, kScreenWidth-96, 48)]; + [loginBtn setTitle:@"确定" forState:UIControlStateNormal ]; + loginBtn.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14]; + [loginBtn setBackgroundColor:UIColorHex(#21BEBD)]; + loginBtn.layer.cornerRadius = 20; + loginBtn.layer.masksToBounds = true; + [loginBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [loginBtn addTarget:self action:@selector(sureFoundAction) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:loginBtn]; +} + +#pragma mark - 确定点击 +- (void)sureFoundAction { + + + if (ValidStr(self.nameTextFild.text)) { + [EasyTextView showErrorText:@"请输入用户姓名"]; + return; + } + if (ValidStr(self.codeTextFild.text)) { + [EasyTextView showErrorText:@"请输入用户身份证号"]; + return; + } + if (ValidStr(self.phoneTextFild.text)) { + [EasyTextView showErrorText:@"请输入用户手机号"]; + return; + } + [self showMBProgressHUDWithString:@"信息验证中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.nameTextFild.text forKey:@"realname"]; + [parmDic setObject:self.codeTextFild.text forKey:@"idCard"]; + [parmDic setObject:self.phoneTextFild.text forKey:@"phone"]; + + JKCQAPI * chageApi = [[JKCQAPI alloc] init:self tag:@"CHANGEAPI" NeedToken:@""]; + + [chageApi postSetUserPassword:parmDic]; + + +} + +#pragma mark -网络请求处理 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"CHANGEAPI"]) { + + [self hiddenAllMBProgressHUD]; + NSString * result = response; + + LoginSetPasswordViewController * password = [[LoginSetPasswordViewController alloc] init]; + password.result = result; + [self.navigationController pushViewController:password animated:YES]; + } + +} + + +-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField { + + if(textField == self.codeTextFild) { + + self.codeTextFild.inputView = self.keyboard; + } + return YES; + +} + +- (void)keyboard:(LVKeyboard *)keyboard didClickDeleteButton:(UIButton *)deleteBtn string:(NSMutableString *)string { + self.codeTextFild.text = string; +} + +- (void)keyboard:(LVKeyboard *)keyboard didClickTextButton:(UIButton *)textBtn string:(NSMutableString *)string { + self.codeTextFild.text = string; +} + + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self.codeTextFild resignFirstResponder]; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginSetPasswordViewController.h b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginSetPasswordViewController.h new file mode 100644 index 0000000..912e472 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginSetPasswordViewController.h @@ -0,0 +1,18 @@ +// +// LoginSetPasswordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LoginSetPasswordViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * result; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginSetPasswordViewController.m b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginSetPasswordViewController.m new file mode 100644 index 0000000..a14673a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/LoginSetPasswordViewController.m @@ -0,0 +1,229 @@ +// +// LoginSetPasswordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "LoginSetPasswordViewController.h" +#import "RSAObjC.h" +#import "HQLoginViewController.h" + +@interface LoginSetPasswordViewController () + +@property (nonatomic, strong) UITextField * phoneTextFild; +@property (nonatomic, strong) UITextField * codeTextFild; + +@property (nonatomic, strong) UIButton * toggleButton; +@property (nonatomic, strong) UIButton * suretoggleButton; + +@end + +@implementation LoginSetPasswordViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"设置密码"; + self.view.backgroundColor = UIColorHex(#EFEFEF); + [self createUI]; +} + +- (void)createUI { + + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(100))]; + topView.backgroundColor = KWhiteColor; + [self.view addSubview:topView]; + + + + UIView * phoneLeft = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 112, kRealValue(50))]; + UILabel * phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 80, kRealValue(50))]; + phoneLabel.text = @"新密码"; + phoneLabel.textAlignment = NSTextAlignmentLeft; + phoneLabel.font = SYSTEMFONT(13); + phoneLabel.textColor = UIColorHex(#666666); + [phoneLeft addSubview:phoneLabel]; + + + self.phoneTextFild = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(50))]; + self.phoneTextFild.placeholder = @"请输入新密码"; + self.phoneTextFild.returnKeyType = UIReturnKeyDone; + self.phoneTextFild.font = [UIFont systemFontOfSize:14]; + self.phoneTextFild.backgroundColor = KWhiteColor; + self.phoneTextFild.leftView = phoneLeft; + self.phoneTextFild.secureTextEntry = YES; + self.phoneTextFild.leftViewMode = UITextFieldViewModeAlways; + self.phoneTextFild.font = SYSTEMFONT(14); + [self.view addSubview:self.phoneTextFild]; + + + self.toggleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [self.toggleButton setImage:[UIImage imageNamed:@"eye"] forState:UIControlStateNormal]; + [self.toggleButton setImage:[UIImage imageNamed:@"eye.slash"] forState:UIControlStateSelected]; + self.toggleButton.frame = CGRectMake(0, 5, 30,30); + [self.toggleButton addTarget:self action:@selector(togglePasswordVisibility) forControlEvents:UIControlEventTouchUpInside]; + // 创建一个容器视图来包含按钮,并增加边距 + UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; + [rightView addSubview:self.toggleButton]; + + // 调整按钮在容器视图中的位置,增加边距 + self.toggleButton.centerX = rightView.centerX; + + self.toggleButton.center = CGPointMake(rightView.frame.size.width - self.toggleButton.frame.size.width / 2, rightView.frame.size.height / 2); + self.phoneTextFild.rightView = rightView; + self.phoneTextFild.rightViewMode = UITextFieldViewModeAlways; + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(16, self.phoneTextFild.bottom, kScreenWidth - 32, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self.view addSubview:linv]; + + UIView * codeLeft = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 112, kRealValue(50))]; + UILabel * codeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 90, kRealValue(50))]; + codeLabel.text = @"确认密码"; + codeLabel.textAlignment = NSTextAlignmentLeft; + codeLabel.font = SYSTEMFONT(13); + codeLabel.textColor = UIColorHex(#666666); + [codeLeft addSubview:codeLabel]; + + self.codeTextFild = [[UITextField alloc] initWithFrame:CGRectMake(0, self.phoneTextFild.bottom+1, kScreenWidth, kRealValue(50))]; + self.codeTextFild.placeholder = @"请输入新密码"; + self.codeTextFild.font = [UIFont systemFontOfSize:14]; + self.codeTextFild.backgroundColor = KWhiteColor; + self.codeTextFild.leftView = codeLeft; + self.codeTextFild.secureTextEntry = YES; + self.codeTextFild.leftViewMode = UITextFieldViewModeAlways; + [self.view addSubview:self.codeTextFild]; + + + self.suretoggleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [self.suretoggleButton setImage:[UIImage imageNamed:@"eye"] forState:UIControlStateNormal]; + [self.suretoggleButton setImage:[UIImage imageNamed:@"eye.slash"] forState:UIControlStateSelected]; + self.suretoggleButton.frame = CGRectMake(0, 5, 30,30); + [self.suretoggleButton addTarget:self action:@selector(sureTogglePasswordVisibility) forControlEvents:UIControlEventTouchUpInside]; + // 创建一个容器视图来包含按钮,并增加边距 + UIView *coderightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; + [coderightView addSubview:self.suretoggleButton]; + + // 调整按钮在容器视图中的位置,增加边距 + self.suretoggleButton.centerX = coderightView.centerX; + self.codeTextFild.rightView = coderightView; + self.codeTextFild.rightViewMode = UITextFieldViewModeAlways; + + UILabel * passwordLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), topView.bottom + kRealValue(8) , kScreenWidth - kRealValue(30), 42)]; + passwordLabel.textColor = UIColorHex(#666666); + passwordLabel.text = @"温馨提示:密码需要为12-32位(包含数字、大写、小写字母、特殊字符)"; + passwordLabel.numberOfLines = 2; + passwordLabel.font =MEDIUMFONT(14); + [passwordLabel sizeToFit]; +// NSMutableAttributedString * attString = [HQCommonUtils firstString:@"请为您的账号" firstColor:UIColorHex(#666666) firstSize:14 secondString:@"zhangsan" secondColor:UIColorHex(#333333) secondSize:14 thirdString:@"设置一个新密码" thirdColor:UIColorHex(#666666) thirdSize:14]; +// passwordLabel.attributedText = attString ; +// passwordLabel.textAlignment = NSTextAlignmentCenter; +// [topView addSubview:passwordLabel]; + [self.view addSubview:passwordLabel]; + + UIButton * loginBtn = [[UIButton alloc] initWithFrame:CGRectMake(48,passwordLabel.bottom+58, kScreenWidth-96, 48)]; + [loginBtn setTitle:@"确定" forState:UIControlStateNormal ]; + loginBtn.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14]; + [loginBtn setBackgroundColor:UIColorHex(#21BEBD)]; + loginBtn.layer.cornerRadius = 20; + loginBtn.layer.masksToBounds = true; + [loginBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [loginBtn addTarget:self action:@selector(sureFoundAction) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:loginBtn]; +} + +#pragma mark:重新设置密码 +- (void)sureFoundAction { + + [self.phoneTextFild resignFirstResponder]; + [self.codeTextFild resignFirstResponder]; + + if (ValidStr(self.phoneTextFild.text) || ValidStr(self.codeTextFild.text)) { + [EasyTextView showErrorText:@"请输入新密码"]; + return; + } + if (isValidPassword(self.phoneTextFild.text)) { + + } else { + [EasyTextView showErrorText:@"请按照密码规则,请重新输入"]; + return; + } + if ( ![self.phoneTextFild.text isEqualToString:self.codeTextFild.text]) { + [EasyTextView showErrorText:@"两次输入密码不一致,请重新输入"]; + return; + } + + NSString * publish_key = @" MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmZfR/bA9X3vp86y1aEpvwzXJYKRRF1fLau2+05/ZtaITLpV8bhkmSf3neSy/Q9gAdvG75Fr73E+GWE+K5b0BpvIS1jDGo319+PpZR39SaZTKZ27XFXrosmJTZutN79t819HS1VseleunHAFgMVufE9U5jP6LGzl/wbkSy01GhzwIDAQAB"; + + // 原始数据,要加密的字符串 + NSString *originalString = self.phoneTextFild.text; + + // RSA 加密,使用字符串格式的公钥私钥加密解密, RSAPublickKey 为公钥字符串(NSString 格式) + NSString *encryptStr = [RSAObjC encrypt:originalString PublicKey:publish_key]; + + [self showMBProgressHUDWithString:@"密码重置中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:encryptStr forKey:@"newPassword"]; + [parmDic setObject:encryptStr forKey:@"newPasswordConfirm"]; + [parmDic setObject:self.result forKey:@"resetCode"]; + + JKCQAPI * chageApi = [[JKCQAPI alloc] init:self tag:@"CHANGEAPI" NeedToken:@""]; + + [chageApi postResetUserNewPassword:parmDic]; + + +} + + +BOOL isValidPassword(NSString *password) { + // 定义正则表达式 + NSString *pattern = @"^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*(),.?\":{}|<>]).{12,32}$"; + + // 创建NSPredicate对象 + NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern]; + + // 使用NSPredicate对象进行判断 + return [predicate evaluateWithObject:password]; +} + +#pragma mark -网络请求处理 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"CHANGEAPI"]) { + [self hiddenAllMBProgressHUD]; + [self.navigationController popToRootViewControllerAnimated:YES]; + [self showMBProgressHUDOnlyWithString:response]; + } + +} + + +- (void)togglePasswordVisibility { + self.phoneTextFild.secureTextEntry = !self.phoneTextFild.secureTextEntry; + self.toggleButton.selected = !self.toggleButton.selected; +} + +- (void)sureTogglePasswordVisibility { + self.codeTextFild.secureTextEntry = !self.codeTextFild.secureTextEntry; + self.suretoggleButton.selected = !self.suretoggleButton.selected; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/Model/IMUserInfoModel.h b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/Model/IMUserInfoModel.h new file mode 100644 index 0000000..5572c6f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/Model/IMUserInfoModel.h @@ -0,0 +1,25 @@ +// +// IMUserInfoModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/29. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface IMUserInfoModel : NSObject + +@property (nonatomic, strong) NSDictionary *IMInfo; + + +@property (nonatomic, copy) NSString * sdkAppId; + +@property (nonatomic, copy) NSString * userSig; + +@property (nonatomic, copy) NSString * userId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/Login/Model/IMUserInfoModel.m b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/Model/IMUserInfoModel.m new file mode 100644 index 0000000..0df806a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/Login/Model/IMUserInfoModel.m @@ -0,0 +1,43 @@ +// +// IMUserInfoModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/29. +// + +#import "IMUserInfoModel.h" + +@implementation IMUserInfoModel + +- (void)encodeWithCoder:(NSCoder *)aCoder +{ + [aCoder encodeObject:self.sdkAppId forKey:@"sdkAppId"]; + [aCoder encodeObject:self.userSig forKey:@"userSig"]; + [aCoder encodeObject:self.userId forKey:@"userId"]; + + +} +- (id)initWithCoder:(NSCoder *)aDecoder +{ + self = [super init]; + if (self) + { + self.userId = [aDecoder decodeObjectForKey:@"userId"]; + self.userSig = [aDecoder decodeObjectForKey:@"userSig"]; + self.sdkAppId = [aDecoder decodeObjectForKey:@"sdkAppId"]; + + } + return self; +} + + +-(void)setIMInfo:(NSDictionary *)IMInfo { + + _IMInfo = IMInfo; + self.sdkAppId = [_IMInfo objectForKey:@"sdkAppId"]; + self.userSig = [_IMInfo objectForKey:@"userSig"]; + self.userId = [_IMInfo objectForKey:@"userId"]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/register/HQRegisterViewController.h b/XinjiangProject/XinjiangProject/Project/Login_Register/register/HQRegisterViewController.h new file mode 100644 index 0000000..47bb2ad --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/register/HQRegisterViewController.h @@ -0,0 +1,16 @@ +// +// HQRegisterViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HQRegisterViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Login_Register/register/HQRegisterViewController.m b/XinjiangProject/XinjiangProject/Project/Login_Register/register/HQRegisterViewController.m new file mode 100644 index 0000000..eeacd0b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Login_Register/register/HQRegisterViewController.m @@ -0,0 +1,264 @@ +// +// HQRegisterViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "HQRegisterViewController.h" +#import "ADJumpViewController.h" +#import "MineCenterUserModel.h" + +@interface HQRegisterViewController () + +@property (nonatomic, strong)UITextField * phoneTextField; +@property (nonatomic, strong)UITextField * codeTextField; +@property (nonatomic, strong)UITextField * passwordTextField; +@property (nonatomic, strong)UITextField * surePasswordTextField; +@property (nonatomic, strong)UITextField * inviteCodeTextField; +@property (nonatomic, strong)UIButton * protocolBtn; +@property (nonatomic, strong)UIButton * codeButton; +@property (nonatomic, copy)NSString * protocolString; + +@end + +@implementation HQRegisterViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = YES; + self.StatusBarStyle = UIStatusBarStyleDefault; + self.view.backgroundColor = CViewBgColor; + [self createUI]; + [self getUserProtocol]; +} + +- (void)createUI +{ + + UIImageView * topBackImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(243))]; + topBackImg.image = IMAGE_NAMED(@"loginTopBimg"); + [self.view addSubview:topBackImg]; + + UIImageView * cenetrImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, kRealValue(70), kRealValue(68), kRealValue(68))]; + cenetrImg.centerX = self.view.centerX; + cenetrImg.image = IMAGE_NAMED(@"login_icon"); + [self.view addSubview:cenetrImg]; + + + UIImageView *titleImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, cenetrImg.bottom + kRealValue(20), kRealValue(109), kRealValue(24))]; + titleImg.centerX = self.view.centerX; + titleImg.image = IMAGE_NAMED(@"loginTitle_Img"); + [self.view addSubview:titleImg]; + + UIButton * leftButton = [[UIButton alloc] initWithFrame:CGRectMake(11, 40, 20, 20)]; + [leftButton setImage:[UIImage imageNamed:@"close_Icon"] forState:UIWindowLevelNormal]; + [leftButton addTarget:self action:@selector(leftBtnClick) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:leftButton]; + + UIView * connetView = [[UIView alloc] init]; + connetView.frame = CGRectMake(0, topBackImg.bottom+1, kScreenWidth, 200); + connetView.backgroundColor = [UIColor whiteColor]; + [self.view addSubview:connetView]; + + self.phoneTextField = [self createTextFieldWithFrame:CGRectMake(10, 0, kScreenWidth-20, 50) placeholder:@"请输入账户名" passWord:NO leftImageView:nil rightImageView:nil Font:14]; + self.phoneTextField.delegate =self; + self.phoneTextField.keyboardType = UIKeyboardTypeNumberPad; + [connetView addSubview:self.phoneTextField]; + + + self.passwordTextField = [self createTextFieldWithFrame:CGRectMake(10, self.phoneTextField.bottom+1, kScreenWidth-20, 50) placeholder:@"请输入密码(6-20位)" passWord:NO leftImageView:nil rightImageView:nil Font:14]; + self.passwordTextField.secureTextEntry = YES; + self.passwordTextField.delegate =self; + [connetView addSubview:self.passwordTextField]; + + + + //平台协议 + UIButton * protocolBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, connetView.bottom+9, 20, 20)]; + [protocolBtn setImage:IMAGE_NAMED(@"login_nomalProtocol") forState:UIControlStateNormal]; + [protocolBtn setImage:IMAGE_NAMED(@"login_selectProtocol") forState:UIControlStateSelected]; + protocolBtn.selected = NO; + [protocolBtn addTarget:self action:@selector(agreeProtocol:) forControlEvents:UIControlEventTouchUpInside]; + self.protocolBtn = protocolBtn; + [self.view addSubview:protocolBtn]; + + UILabel * contentTitle = [[UILabel alloc] initWithFrame:CGRectMake(protocolBtn.right+5,connetView.bottom+9, 300, 20)]; + NSString *text = @"我已阅读并同意《健康咨询员工端使用协议》"; + NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:text]; + [attributeStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:50/255.0 green:170/255.0 blue:223/255.0 alpha:1] range:NSMakeRange(7, text.length - 7)]; + contentTitle.attributedText = attributeStr; + contentTitle.textAlignment = NSTextAlignmentLeft; + contentTitle.font = [UIFont systemFontOfSize:12]; + contentTitle.userInteractionEnabled = YES; + UITapGestureRecognizer * tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)]; + [contentTitle addGestureRecognizer:tapRecognizer]; + [self.view addSubview:contentTitle]; + + UIButton * loginBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, self.surePasswordTextField.bottom+140, kScreenWidth-20, 44)]; + loginBtn.mj_y = self.protocolBtn.bottom+25; + [loginBtn setTitle:@"注册" forState:UIControlStateNormal ]; + loginBtn.tag = 100; + loginBtn.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16]; + [loginBtn setBackgroundImage:[UIImage imageNamed:@"loginBtn_img"] forState:UIControlStateNormal]; + [loginBtn setTitleColor:UIColorTitle1 forState:UIControlStateNormal]; + [loginBtn addTarget:self action:@selector(regisOnClick) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:loginBtn]; + +} +- (void)agreeProtocol:(UIButton *)agreeBtn +{ + agreeBtn.selected = !agreeBtn.selected; + +} + +#pragma mark - 获取协议 +- (void)getUserProtocol { + + JKCQAPI * agreeAPI = [[JKCQAPI alloc] init:self tag:@"AGREEAPI" NeedToken:@""]; + + [agreeAPI getUserAgreementPrivacy:nil]; +} + +// 跳转用户协议 +- (void)tap +{ + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"用户注册协议"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,self.protocolString]; + [self.navigationController pushViewController:webVC animated:YES]; +} + + +- (void)xmProtocol +{ + self.protocolBtn.selected = YES; + +} + +#pragma mark - 注册 + +- (void)regisOnClick +{ + if ([NSString stringWithFormat:@"%@",self.passwordTextField.text].length<6||[NSString stringWithFormat:@"%@",self.passwordTextField.text].length>20) + { + [EasyTextView showErrorText:@"密码的长度是6-20位"]; + return; + } + + if (!self.protocolBtn.selected ) + { + [EasyTextView showErrorText:@"请先阅读并同意协议"]; + return; + } + + [self showMBProgressHUDOnlyWithString:@"注册已提交,请等待审核通过后方可登录"]; +} + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + + if ([tag isEqualToString:@"GetUserRegister"]) + { + [self showMBProgressHUDOnlyWithString:@"注册成功"]; + [self dismissViewControllerAnimated:YES completion:nil]; + } + if ([tag isEqualToString:@"AGREEAPI"]) { + + NSArray * array = response; + NSMutableArray * dataArray = [[NSMutableArray alloc] init]; + + for (NSDictionary * parmDic in array) { + + MineCenterUserModel * model = [MineCenterUserModel modelWithDictionary:parmDic]; + if ([model.value integerValue] == 1) { + self.protocolString = model.text; + } + [dataArray addObject:model]; + + } + + } +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [EasyTextView showErrorText:message]; + + NSLog(@"apiError=%@",message); + // [self showMessage:message]; + +} + +- (void)leftBtnClick +{ + [self dismissViewControllerAnimated:YES completion:nil]; +} +//实现UITextField代理方法 +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + + [textField resignFirstResponder];//取消第一响应者 + + return YES; +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self.view endEditing:YES]; +} +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +-(UITextField*)createTextFieldWithFrame:(CGRect)frame placeholder:(NSString*)placeholder passWord:(BOOL)YESorNO leftImageView:(UIView*)leftView rightImageView:(UIView*)rightView Font:(float)font +{ + UITextField*textField=[[UITextField alloc]initWithFrame:frame]; + //灰色提示框 + textField.placeholder=placeholder; + //文字对齐方式 + textField.textAlignment=NSTextAlignmentLeft; + textField.secureTextEntry=YESorNO; + + //边框 + //textField.borderStyle=UITextBorderStyleLine; + //键盘类型 + textField.returnKeyType=UIReturnKeyDone; + //关闭首字母大写 + textField.autocapitalizationType=NO; + //清除按钮 + textField.clearButtonMode=NO; + //左图片 + textField.leftView=leftView; + textField.leftViewMode=UITextFieldViewModeAlways; + //右图片 + textField.rightView=rightView; + //编辑状态下一直存在 + textField.rightViewMode=UITextFieldViewModeAlways; + //自定义键盘 + //textField.inputView + //字体 + textField.font=[UIFont systemFontOfSize:font]; + //字体颜色 + UIView * line2 = [[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height-1, kScreenWidth, 1)]; + line2.backgroundColor = UIColorLine; + [textField addSubview:line2]; + return textField; + +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/AddContactViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/AddContactViewController.h new file mode 100644 index 0000000..bea1f48 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/AddContactViewController.h @@ -0,0 +1,21 @@ +// +// AddContactViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "HQBaseViewController.h" +#import "EmergencyContactModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AddContactViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * contact_id; + +@property (nonatomic, strong) EmergencyContactModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/AddContactViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/AddContactViewController.m new file mode 100644 index 0000000..bf56c8f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/AddContactViewController.m @@ -0,0 +1,356 @@ +// +// AddContactViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "AddContactViewController.h" +#import "LineTextField.h" +#import "FamilyMemberRelationModel.h" +#import "BRStringPickerView.h" +#import "AddContactViewController.h" + +@interface AddContactViewController () + +@property (nonatomic, strong) LineTextField * nameField; + +@property (nonatomic, strong) LineTextField * phoneField; + +@property (nonatomic, strong) LineTextField * cardNumberField; + +@property (nonatomic, strong) LineTextField * relationshipTextField; + +@property (nonatomic, strong) NSMutableArray * memberArray; + +@property (nonatomic, copy) NSString * familyInt; + + +@end + +@implementation AddContactViewController + + +- (NSMutableArray *)memberArray { + if (!_memberArray) { + + _memberArray = [[NSMutableArray alloc] init]; + } + + return _memberArray; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"紧急联系人"; + self.view.backgroundColor = KWhiteColor; + [self createUI]; + [self getFamilyMembers]; + // Do any additional setup after loading the view. +} + + +- (void)createUI { + + //咨询人姓名 + self.nameField = [self createFieldWithLeftTitle:@"姓名" withRightString:@"" placeholderStr:@"请填写紧急联系人姓名" isShowRight:true]; + self.nameField.frame = CGRectMake(0, 1, kScreenWidth, 51); + [self.view addSubview:self.nameField]; + //手机号 + self.phoneField = [self createFieldWithLeftTitle:@"手机号" withRightString:@" " placeholderStr:@"请填写手机号" isShowRight:true]; + self.phoneField.frame = CGRectMake(0, self.nameField.bottom, kScreenWidth, 51); + [self.view addSubview:self.phoneField]; + //身份证号码, + self.cardNumberField = [self createFieldWithLeftTitle:@"身份证号" withRightString:@"" placeholderStr:@"请填写身份证号" isShowRight:true]; + self.cardNumberField.frame = CGRectMake(0, self.phoneField.bottom, kScreenWidth, 51); + [self.view addSubview:self.cardNumberField]; + + + //与本人关系 + self.relationshipTextField = [self createFieldWithLeftTitle:@"与咨询人关系" withRightString:@">" placeholderStr:@"请点击选择" isShowRight:true]; + self.relationshipTextField.frame = CGRectMake(0, self.cardNumberField.bottom, kScreenWidth, 51); + self.relationshipTextField.userInteractionEnabled = true; + [self.view addSubview:self.relationshipTextField]; + + UIButton * shipBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 51)]; + [shipBtn addTarget:self action:@selector(relastionShipOnclick) forControlEvents:UIControlEventTouchUpInside]; + [self.relationshipTextField addSubview:shipBtn]; + + + //保存按钮 + + if (self.model) { + + self.nameField.text = self.model.name; + self.phoneField.text = self.model.phone; + self.cardNumberField.text = self.model.idCard; + self.relationshipTextField.text = self.model.familyRelation_dictText; + + UIButton * delectBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 - kRealValue(120) , kScreenHeight - kTopHeight - kTabBarHeight - 30 - 40, kRealValue(110), 33)]; + [delectBtn setTitle:@"删除" forState:UIControlStateNormal]; + delectBtn.titleLabel.font = SYSTEMFONT(14); + delectBtn.layer.cornerRadius = 17.0f; + delectBtn.layer.masksToBounds = true; + delectBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + delectBtn.layer.borderWidth = 1.0f; + delectBtn.backgroundColor = KWhiteColor; + [delectBtn addTarget:self action:@selector(delectedInfoAction) forControlEvents:UIControlEventTouchUpInside]; + [delectBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.view addSubview:delectBtn]; + + UIButton * saveBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 + kRealValue(10), kScreenHeight - kTopHeight - kTabBarHeight - 30 - 40, kRealValue(110), 33)]; + [saveBtn setTitle:@"保存" forState:UIControlStateNormal]; + saveBtn.titleLabel.font = SYSTEMFONT(14); + saveBtn.layer.cornerRadius = 17; + saveBtn.layer.masksToBounds = true; + saveBtn.backgroundColor = UIColorHex(#21BEBD); + [saveBtn addTarget:self action:@selector(saveInfo) forControlEvents:UIControlEventTouchUpInside]; + [saveBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.view addSubview:saveBtn]; + }else + { + UIButton * saveBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(48), kScreenHeight - kTopHeight - kTabBarHeight - 30 - 40, kScreenWidth - kRealValue(96), 40)]; + [saveBtn setTitle:@"保存" forState:UIControlStateNormal]; + saveBtn.titleLabel.font = SYSTEMFONT(14); + saveBtn.layer.cornerRadius = 20.0f; + saveBtn.layer.masksToBounds = true; + saveBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + saveBtn.layer.borderWidth = 1.0f; + saveBtn.backgroundColor = KWhiteColor; + [saveBtn addTarget:self action:@selector(saveInfo) forControlEvents:UIControlEventTouchUpInside]; + [saveBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.view addSubview:saveBtn]; + } + +} + + +- (LineTextField *)createFieldWithLeftTitle:(NSString *)leftStr + withRightString:(NSString *)rightStr + placeholderStr:(NSString *)placeStr + isShowRight:(BOOL)isShowRight { + + LineTextField * field = [[LineTextField alloc] init]; + field.font = SYSTEMFONT(13); + field.placeholder = placeStr; + field.textAlignment = NSTextAlignmentRight; + field.backgroundColor = KWhiteColor; + UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 51)]; + + UILabel * leftlabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), 0, 100, 51)]; + + leftlabel.text = leftStr; + + leftlabel.font = SYSTEMFONT(13); + + leftlabel.textAlignment = NSTextAlignmentLeft; + + leftlabel.textColor = UIColorHex(#666666); + + [leftView addSubview:leftlabel]; + + field.leftView = leftView; + + field.leftViewMode = UITextFieldViewModeAlways; + + if (isShowRight) { + + UIView * rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 51)]; + + UILabel * rightlabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 30, 51)]; + + rightlabel.text = rightStr; + + rightlabel.font = SYSTEMFONT(13); + + rightlabel.textColor = UIColorHex(#666666); + + field.rightView = rightView; + + rightlabel.textAlignment = NSTextAlignmentLeft; + + field.rightViewMode = UITextFieldViewModeAlways; + + [rightView addSubview:rightlabel]; + + } + + return field; +} + +- (void)delectedInfoAction { + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.model.contact_ID forKey:@"id"]; + + JKCQAPI * memberApi = [[JKCQAPI alloc] init:self tag:@"DelectedAPI" NeedToken:@""]; + [memberApi getDelectedEmergencyContact:parmDic]; + +} + + +- (void)getFamilyMembers { + + JKCQAPI * memberApi = [[JKCQAPI alloc] init:self tag:@"Family" NeedToken:@""]; + + [memberApi getCheckKeyResult:@{@"dictKey":@"family_member_relation"}]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"Family"]) { + + NSArray * array = response; + + for (NSDictionary * dic in array) { + + FamilyMemberRelationModel * model = [FamilyMemberRelationModel modelWithDictionary:dic] ; + + [self.memberArray addObject:model]; + } + } + if ([tag isEqualToString:@"ADDAPI"]) { + + [EasyTextView showSuccessText:@"操作成功"]; + [self.navigationController popViewControllerAnimated:YES]; + + } + if ([tag isEqualToString:@"DelectedAPI"]) { + + [EasyTextView showSuccessText:@"操作成功"]; + [self.navigationController popViewControllerAnimated:YES]; + } + +} + + + +- (void)relastionShipOnclick { + + /// 1.单列字符串选择器(传字符串数组) + BRStringPickerView *stringPickerView = [[BRStringPickerView alloc]init]; + stringPickerView.pickerMode = BRStringPickerComponentSingle; + stringPickerView.title = @"关系"; + + NSMutableArray * array = [[NSMutableArray alloc] init]; + for (FamilyMemberRelationModel * model in self.memberArray) { + + [array addObject:model.text]; + } + stringPickerView.dataSourceArr = array; + stringPickerView.selectIndex = 2; + stringPickerView.resultModelBlock = ^(BRResultModel *resultModel) { + NSLog(@"选择的值:%@", resultModel.value); + + for (FamilyMemberRelationModel * model in self.memberArray) { + + if ([model.text isEqualToString:resultModel.value]) { + + self.familyInt = model.value; + } + + } + self.relationshipTextField.text = resultModel.value; + }; + + [stringPickerView show]; + +} + + +- (void)saveInfo { + + [self.view endEditing:TRUE]; + + + if (ValidStr(self.nameField.text)) { + [EasyTextView showErrorText:@"请输入紧急联系人姓名"]; + return; + } + if (ValidStr(self.phoneField.text)) { + [EasyTextView showErrorText:@"请输入手机号"]; + return; + } + if (ValidStr(self.cardNumberField.text)) { + [EasyTextView showErrorText:@"请输入身份证号"]; + return; + } + + if (ValidStr(self.relationshipTextField.text)) { + [EasyTextView showErrorText:@"请选择与咨询人关系"]; + return; + } + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + if (self.model) { + [parmDic setObject:self.model.contact_ID forKey:@"id"]; + }else + { + [parmDic setObject:@"" forKey:@"id"]; + } + [parmDic setObject:self.nameField.text forKey:@"name"]; + [parmDic setObject:self.phoneField.text forKey:@"phone"]; + [parmDic setObject:self.cardNumberField.text forKey:@"idCard"]; + [parmDic setObject:self.familyInt forKey:@"familyRelation"]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"ADDAPI" NeedToken:@""]; + + [api postAddEmergencyContact:parmDic]; + +} + +- (NSString *)getTimestampFromTime:(NSString *)CurrentTime{ + + + + + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + + [formatter setDateStyle:NSDateFormatterMediumStyle]; + + [formatter setTimeStyle:NSDateFormatterShortStyle]; + + [formatter setDateFormat:@"yyyy-MM-dd"]; //(@"YYYY-MM-dd hh:mm:ss") ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制 + + //设置时区选择北京时间 + + NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"]; + + [formatter setTimeZone:timeZone]; + + NSDate* date = [formatter dateFromString:CurrentTime]; //------------将字符串按formatter转成nsdate + + //时间转时间戳的方法: + + NSInteger timeSp = [[NSNumber numberWithDouble:[date timeIntervalSince1970]] integerValue] * 1000; + + + return [NSString stringWithFormat:@"%ld",(long)timeSp]; + + + +} + + + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/EditSystemViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/EditSystemViewController.h new file mode 100644 index 0000000..f3a273b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/EditSystemViewController.h @@ -0,0 +1,16 @@ +// +// EditSystemViewController.h +// EscortProject +// +// Created by 仁康信息 on 2024/1/10. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EditSystemViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/EditSystemViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/EditSystemViewController.m new file mode 100644 index 0000000..1c49a4f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/EditSystemViewController.m @@ -0,0 +1,239 @@ +// +// EditSystemViewController.m +// EscortProject +// +// Created by 仁康信息 on 2024/1/10. +// + +#import "EditSystemViewController.h" +#import "LoginFoundPasswordViewController.h" +#import "MineCenterUserModel.h" +#import "ADJumpViewController.h" + +@interface EditSystemViewController () + +@property (nonatomic, strong) UITableView * homeTableView; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation EditSystemViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = CViewBgColor; + self.navigationItem.title = @"设置"; + [self createUI]; + [self createData]; +} + +- (void)createUI +{ + self.homeTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight) style:UITableViewStyleGrouped]; + if (@available(iOS 11.0, *)) { + self.homeTableView.estimatedRowHeight = 0; + self.homeTableView.estimatedSectionFooterHeight = 0; + self.homeTableView.estimatedSectionHeaderHeight = 0; + self.homeTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.homeTableView.delegate = self; + self.homeTableView.backgroundColor = CViewBgColor; + self.homeTableView.dataSource = self; + self.homeTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + self.homeTableView.showsVerticalScrollIndicator = NO; + [self.view addSubview:self.homeTableView]; +} + +- (void)createData { + + JKCQAPI * agreeAPI = [[JKCQAPI alloc] init:self tag:@"AGREEAPI" NeedToken:@""]; + + [agreeAPI getUserAgreementPrivacy:nil]; + +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"AGREEAPI"]) { + + NSArray * array = response; + + for (NSDictionary * parmDic in array) { + + MineCenterUserModel * model = [MineCenterUserModel modelWithDictionary:parmDic]; + + [self.dataArray addObject:model]; + + } + + } +} + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + if (section == 0) { + return 3; + } + return 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 2; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.section == 0) { + + NSArray * sectionOne = @[@"账号与安全(修改密码)",@"用户协议",@"隐私政策"]; + + + static NSString * cellID = @"cellID"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.textLabel.font = SYSTEMFONT(14); + cell.textLabel.text = sectionOne[indexPath.row]; + cell.textLabel.textColor = UIColorHex(#666666); + cell.textLabel.font = SYSTEMFONT(14); + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.backgroundColor = KWhiteColor; + return cell; + + + } + if (indexPath.section == 1) { + + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CONNETCELL"]; + + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"CONNETCELL"]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.textLabel.font = SYSTEMFONT(14); + cell.textLabel.text = @"版本号"; + cell.detailTextLabel.text = [[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + return cell; + + + } + + + return UITableViewCell.new; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + + return 44; + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + + return CGFLOAT_MIN; +} + + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return kRealValue(5); +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + return UIView.new; + +} + + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.section == 0) { + + if (indexPath.row == 0) { + + LoginFoundPasswordViewController * loginVC = [[LoginFoundPasswordViewController alloc] init]; + [self.navigationController pushViewController:loginVC animated:YES]; + } + if (indexPath.row == 1) { + + for (MineCenterUserModel * model in self.dataArray) { + + if ([model.value integerValue] == 1) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"用户协议"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + } + if (indexPath.row == 2) { + + for (MineCenterUserModel * model in self.dataArray) { + + if ([model.value integerValue] == 2) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"隐私政策"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + } + } + + + +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MinePictureRecordViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MinePictureRecordViewController.h new file mode 100644 index 0000000..45dcf86 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MinePictureRecordViewController.h @@ -0,0 +1,18 @@ +// +// MinePictureRecordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MinePictureRecordViewController : HQBaseViewController + +@property (nonatomic, assign) NSInteger selectOnes; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MinePictureRecordViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MinePictureRecordViewController.m new file mode 100644 index 0000000..acd4d92 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MinePictureRecordViewController.m @@ -0,0 +1,561 @@ +// +// MinePictureRecordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// +#import "MinePictureRecordViewController.h" + +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" +#import "RecordIMListDateModel.h" +#import "DoctorMainViewController.h" +@interface MinePictureRecordViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; +@property (nonatomic, strong) NSMutableArray * redCountArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * groupIDArray; + +@property (nonatomic, strong) NSMutableArray * jingxingArray; + +@property (nonatomic, assign) NSInteger totalCount; + +@end + + +@implementation MinePictureRecordViewController + + +- (NSMutableArray *)groupIDArray { + + if (!_groupIDArray) { + + _groupIDArray = [[NSMutableArray alloc] init]; + + } + return _groupIDArray; + +} + +- (NSMutableArray *)redCountArray { + + if (!_redCountArray) { + + _redCountArray = [[NSMutableArray alloc] init]; + } + return _redCountArray; + +} +- (NSMutableArray *)jingxingArray { + + if (!_jingxingArray) { + + _jingxingArray = [[NSMutableArray alloc] init]; + + } + return _jingxingArray; + +} + + + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 0; + + + [self createUI]; + + if ([ESCTUIManager TUIUserStatus] == false) { + + [self loginImAccount]; + } + + if ([self.type integerValue] == 3) + { + [self getChatList]; + } + else + { + [self createData]; + } + +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + [self.homeTable.mj_header beginRefreshing]; + + +} +- (void)createUI { + + NSArray * array = @[@"进行中",@"已评价",@"历史"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(80); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(15) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; + if (self.selectOnes == 3) { + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + if (self.selectOnes == 4) { + if (index == 1 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + if (self.selectOnes == 5) { + if (index == 2 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + if (self.selectOnes == 6) { + if (index == 2 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - 50 - SafetyAreaHeight) style:UITableViewStyleGrouped]; + + self.homeTable.detailBlock = ^(NSString * _Nonnull recordID, NSString * _Nonnull imID, NSString * _Nonnull memberId, RecordIMListDateModel * _Nonnull model) { + +// DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; +// doctorVC.yuyue_id = recordID; +// [self.navigationController pushViewController:doctorVC animated:YES]; + if ([TUILogin isUserLogined]) { + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = imID ; + chatVC.pictureEnd_id = recordID ; + chatVC.eableSendReport = true; + chatVC.eablehaveHelathData = false; + chatVC.navTitle = @"图文咨询"; + chatVC.isVideo = NO; + chatVC.questionType = 2; + chatVC.medicalRecordsId = memberId; + //是否评价 + if ([model.contentStatus integerValue] == 5 ) { + chatVC.isEveal = true; + }else + { + chatVC.isEveal = false; + } + + if ([model.contentStatus intValue] >= 4) + { + chatVC.endRecordType = 100; + } + [self.navigationController pushViewController:chatVC animated:YES]; + }else + { + [self loginImAccount]; + } + + }; + [self.view addSubview:self.homeTable]; + +// [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { +// make.top.mas_equalTo(@50); +// make.bottom.left.right.mas_offset(0); +// }]; + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 0; + if ([ESCTUIManager TUIUserStatus] == false) { + + [self loginImAccount]; + } + if ([self.type integerValue] == 3) + { + [self getChatList]; + } + else + { + [weakSelf createData]; + } + + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + if ([ESCTUIManager TUIUserStatus] == false) { + + [self loginImAccount]; + } + if ([self.type integerValue] == 3) + { + [self getChatList]; + } + else + { + [weakSelf createData]; + } + }]; + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noData" titleStr:@"暂无数据" detailStr:@""]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = [UIColor blackColor]; + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + //按钮背景色 + emptyView.actionBtnBackGroundColor = KWhiteColor; + emptyView.actionBtnWidth = CGFLOAT_MIN; + emptyView.actionBtnHeight = CGFLOAT_MIN; + + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; + + +} +//获取腾讯im会话列表 + +- (void)getChatList { + + + V2TIMConversationListFilter *filter = [[V2TIMConversationListFilter alloc] init]; +// filter.type = V2TIM_C2C; //拉取单聊会话 + filter.type = V2TIM_GROUP; //拉取群聊会话 + [[V2TIMManager sharedInstance] getConversationListByFilter:filter nextSeq:self.pageNo count:50 succ:^(NSArray *list, uint64_t nextSeq, BOOL isFinished) { + // 获取会话列表成功,list 为会话列表 + if (self.pageNo == 0) { + [self.groupIDArray removeAllObjects]; + } + DLog(@"%@",list); + [self.redCountArray addObjectsFromArray:list]; + + for (V2TIMConversation * v2Model in list) { + [self.groupIDArray addObject: v2Model.groupID]; + + + } + [self postGroupArray:self.groupIDArray]; + } fail:^(int code, NSString *desc) { + // 获取会话列表失败 + }]; + +// //获取所以会话的未读总数 +// // filter.type = V2TIM_GROUP; //拉取群聊会话 +// +// [[V2TIMManager sharedInstance] getUnreadMessageCountByFilter:filter succ:^(UInt64 totalUnreadCount) { +// self.totalCount = totalUnreadCount; +// } fail:^(int code, NSString *desc) { +// +// }]; + +} + + +#pragma mark:上传id数组 +- (void)postGroupArray:(NSArray *)array { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:array forKey:@"imIds"]; + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:NO]; + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"GROUPID" NeedToken:@""]; + [recordApi PostGroupIDArray:parmDic]; +} + + +- (void)createData { + // type : 1 图文 2 音视频 + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:self.type forKey:@"status"]; + [parmDic setObject:@"1" forKey:@"type"]; + //status 1 3 4 5 //4 代评价 + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi getMineQuestionRecord:parmDic]; +} + +- (void)loginImAccount { + + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + + + +} + + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECORD"]) { + [self hiddenAllMBProgressHUD]; + if (self.pageNo == 0) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + RecordIMListDateModel * model = [ RecordIMListDateModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } + if ([tag isEqualToString:@"IMAPI"]) { + + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init]; + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + + [TUILogin login:[model.sdkAppId intValue] userID:model.userId userSig:model.userSig succ:^{ + + [self getChatList]; + + } fail:^(int code, NSString *msg) { + + [EasyTextView showErrorText:msg]; + + }]; + + + + + } + if ([tag isEqualToString:@"GROUPID"]) { + + NSArray * array = response; + [self.jingxingArray removeAllObjects]; + [self hiddenAllMBProgressHUD]; + for (NSDictionary * parmDic in array) { + + RecordIMListDateModel * model = [ RecordIMListDateModel modelWithDictionary:parmDic]; + + for (V2TIMConversation * v2Model in self.redCountArray) { + + if ([v2Model.groupID isEqualToString:model.imId]) + { + model.unredCount = v2Model.unreadCount; + } + } + + [self.jingxingArray addObject:model]; + } + self.homeTable.dataArray = self.jingxingArray; +// self.homeTable.totalCount + } +} + +- (void)statusChange:(UIButton *)statusBtn { + [self.dataArray removeAllObjects]; + if (statusBtn.tag == 1000) { + self.type = @"3"; //进行中 + [self getChatList]; + } + if (statusBtn.tag == 1001) { + self.type = @"5"; //已评价 + [self createData]; + } + if (statusBtn.tag == 1002) { + self.type = @""; //全部 历史 + [self createData]; + } + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + + +} + +- (void)setSelectOnes:(NSInteger)selectOnes { + + _selectOnes = selectOnes; + self.type = [NSString stringWithFormat:@"%ld",_selectOnes]; + switch (_selectOnes) { + case 3://进行中 + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1000) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + case 5://已评价 + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1001) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + case 6: + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1002) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + + + default: + break; + } + +} + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineQuestionRecordViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineQuestionRecordViewController.h new file mode 100644 index 0000000..c933613 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineQuestionRecordViewController.h @@ -0,0 +1,18 @@ +// +// MineQuestionRecordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MineQuestionRecordViewController : HQBaseViewController + +@property (nonatomic, assign) NSInteger type; // 1 进行中 2 待评价 3 已评价 4 历史 +@property (nonatomic, assign) NSInteger titleSelected; // 10 图文 11 音视频 +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineQuestionRecordViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineQuestionRecordViewController.m new file mode 100644 index 0000000..30369ec --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineQuestionRecordViewController.m @@ -0,0 +1,256 @@ +// +// MineQuestionRecordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "MineQuestionRecordViewController.h" +#import "MineVideoRecordViewController.h" +#import "MinePictureRecordViewController.h" + +@interface MineQuestionRecordViewController () + +/** 顶部控件*/ +@property (nonatomic, weak) UIScrollView *topView; +/** 下划线 */ +@property (nonatomic, weak) UIView *lineView; +/** 滚动视图 */ +@property (nonatomic, weak) UICollectionView *collectionView; +/** 当前选中的按钮 */ +@property (nonatomic, weak) UIButton *selectButton; +/** 按钮数组 */ +@property (nonatomic, strong) NSMutableArray *titleButtons; + +@end + +@implementation MineQuestionRecordViewController + +#pragma mark - 懒加载 +- (NSMutableArray *)titleButtons { + if (_titleButtons==nil) { + _titleButtons = [NSMutableArray array]; + } + return _titleButtons; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = NO; + self.title = @"我的咨询"; + self.view.backgroundColor = UIColorBackground; +// [self addNavigationItemWithImageNames:@[@"backIcon@2x"] isLeft:YES target:self action:@selector(popVc) tags:@[@"100"]]; + [self createUI]; + +} + +#pragma mark:返回 +- (void)popVc +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +- (void)createUI +{ + [self setupNavgationBar]; + + // 添加底部内容view + [self setupBottomContentView]; + + // 添加所有子控制器 + [self setupAllChildViewController]; + + [self setupAllTitle:self.titleSelected]; + + // 不添加额外滚动区域 + self.automaticallyAdjustsScrollViewInsets = NO; +} + +#pragma mark - 添加所有的子控制器 +- (void)setupAllChildViewController { + + MinePictureRecordViewController * pictureVc = [[MinePictureRecordViewController alloc] init]; + pictureVc.navigationItem.title = @"图文咨询"; + pictureVc.selectOnes = self.type; + pictureVc.view.backgroundColor = CViewBgColor; + [self addChildViewController:pictureVc]; + + // + MineVideoRecordViewController * videoVc = [[MineVideoRecordViewController alloc] init]; + videoVc.navigationItem.title = @"视频咨询"; + videoVc.selectOnes = self.type; + videoVc.view.backgroundColor = CViewBgColor; + [self addChildViewController:videoVc]; + +} + +#pragma mark - 设置导航条内容 +- (void)setupNavgationBar { + UIScrollView *topView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 1, kScreenWidth, kRealValue(48))]; + topView.backgroundColor = [UIColor whiteColor]; + _topView = topView; + [self.view addSubview:topView]; +} + +#pragma mark - 按钮被点击 +- (void)titleClick:(UIButton *)titleButton{ + + NSInteger i = titleButton.tag; + // 重复点击标题按钮的时候,刷新当前界面 + if (titleButton == _selectButton) { + } + + [self selButton:titleButton]; + + //滚动collectionView 修改偏移量 + CGFloat offsetX = i * kScreenWidth; + _collectionView.contentOffset = CGPointMake(offsetX, 0); +} + +#pragma mark - 选中标题按钮 +- (void)selButton:(UIButton *)titleButton{ + + _selectButton.selected = NO; + titleButton.selected = YES; + _selectButton = titleButton; + + // 移动下划线的位置 + [UIView animateWithDuration:0.25 animations:^{ + _lineView.centerX = titleButton.centerX; + }]; +} + +#pragma mark - 添加标题 +- (void)setupAllTitle:(NSInteger)titleSelected{ + + NSUInteger count = self.childViewControllers.count; + CGFloat btnX = 0; + CGFloat btnW = kScreenWidth/count; + CGFloat btnH = _topView.height; + for (int i = 0; i < count; i++) { + UIButton *titleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + titleButton.tag = i; + + UIViewController *vc = self.childViewControllers[i]; + [titleButton setTitle:vc.navigationItem.title forState:UIControlStateNormal]; + // 设置标题颜色 + [titleButton setTitleColor:RGBA(34, 34, 34, 1) forState:UIControlStateSelected]; + [titleButton setTitleColor:RGBA(102, 102, 102, 1) forState:UIControlStateNormal]; + + // 设置标题字体 + titleButton.titleLabel.font = MEDIUMFONT(14); + + btnX = i * btnW; + + titleButton.frame = CGRectMake(btnX, 0, btnW, btnH); + + // 监听按钮点击 + [titleButton addTarget:self action:@selector(titleClick:) forControlEvents:UIControlEventTouchUpInside]; + + [_topView addSubview:titleButton]; + + if (i == titleSelected - 10) { + // 添加下划线 + // 下划线宽度 = 按钮文字宽度 + // 下划线中心点x = 按钮中心点x + CGFloat h = 5; + CGFloat y = kRealValue(45) ; + UIView *lineView =[[UIView alloc] init]; + // 位置和尺寸 + lineView.height = h; + // 先计算文字尺寸,在给label去赋值 + [titleButton.titleLabel sizeToFit]; + lineView.width = kRealValue(28); + lineView.centerX = titleButton.centerX; + lineView.mj_y = y; + lineView.backgroundColor = UIColorHex(#21BEBD); + _lineView = lineView; + [_topView addSubview:lineView]; + + [self titleClick:titleButton]; + } + [self.titleButtons addObject:titleButton]; + } +} + +#pragma mark - 添加底部内容view +- (void)setupBottomContentView +{ + // 创建一个流水布局 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(kScreenWidth, kScreenHeight-44); + + // 设置水平滚动方向 + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + layout.minimumInteritemSpacing = 0; + layout.minimumLineSpacing = 0; + + // 创建UICollectionView + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0,kRealValue(48), kScreenWidth, kScreenHeight - kRealValue(48) ) collectionViewLayout:layout]; + collectionView.backgroundColor = [UIColor whiteColor]; + [self.view addSubview:collectionView]; + _collectionView = collectionView; + collectionView.scrollsToTop = NO; + collectionView.scrollEnabled = YES; + // 开启分页 + collectionView.pagingEnabled = YES; + collectionView.showsHorizontalScrollIndicator = NO; + collectionView.bounces = YES; + + // 展示cell + collectionView.dataSource = self; + collectionView.delegate = self; + + // 注册cell + [collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"COUPCELLID"]; +} + +#pragma mark - UICollectionViewDelegate +// 滚动完成的时候就会调用 +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ + // 获取角标 + NSInteger i = scrollView.contentOffset.x / kScreenWidth; + + // 获取选中标题 + UIButton *selButton = self.titleButtons[i]; + + // 选中标题 + [self selButton:selButton]; +} + +#pragma mark - UICollectionViewDataSource +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + + return self.childViewControllers.count; +} + +// 只要有新的cell出现的时候才会调用 +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"COUPCELLID" forIndexPath:indexPath]; + + // 移除之前子控制器view + [cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + // 取出对应的子控制器添加到对应cell上 + UIViewController *vc = self.childViewControllers[indexPath.row]; + + [cell.contentView addSubview:vc.view]; + + return cell; +} + + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineUserInfoViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineUserInfoViewController.h new file mode 100644 index 0000000..897b290 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineUserInfoViewController.h @@ -0,0 +1,16 @@ +// +// MineUserInfoViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MineUserInfoViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineUserInfoViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineUserInfoViewController.m new file mode 100644 index 0000000..fde6c31 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineUserInfoViewController.m @@ -0,0 +1,141 @@ +// +// MineUserInfoViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import "MineUserInfoViewController.h" +#import "MineUserInfoTable.h" +#import "EmergencyContactModel.h" +#import "AddContactViewController.h" +@interface MineUserInfoViewController () + +@property (nonatomic, strong) MineUserInfoTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + + +@end + +@implementation MineUserInfoViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.navigationItem.title = @"个人信息"; + self.isHidenNaviBar = false; + self.view.backgroundColor = KWhiteColor; + [self createUI]; + [self createData]; + +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated] ; + [self.dataArray removeAllObjects]; + [self getEmergencyContact]; + + + +} +- (void)createUI { + + MJWeakSelf + self.homeTable = [[MineUserInfoTable alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight) style:UITableViewStyleGrouped]; + self.homeTable.addBlcok = ^{ + //新增紧急联系人 + [weakSelf addEmergencyContact]; + }; + self.homeTable.editBlcok = ^(EmergencyContactModel * _Nonnull model) { + + AddContactViewController * addVC = [[AddContactViewController alloc] init]; + addVC.model = model; + [weakSelf.navigationController pushViewController:addVC animated:YES]; + }; + [self.view addSubview:self.homeTable]; + +} + +- (void)createData { + + JKCQAPI * infoApi = [[JKCQAPI alloc] init:self tag:@"USERINFO" NeedToken:@""]; + [infoApi getMineCenterUserInfo:nil]; + + +} + + + +- (void)getEmergencyContact { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + JKCQAPI * numbeApi = [[JKCQAPI alloc] init:self tag:@"ContactAPI" NeedToken:@""]; + + [numbeApi getEmergencyContact:dic]; +} + + +#pragma mark -网络请求处理 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + if ([tag isEqualToString:@"USERINFO"]) { + NSDictionary * dic = response; + MineCenterUserModel * userModel = [MineCenterUserModel modelWithDictionary:dic]; + self.homeTable.model = userModel; + + } + if ([tag isEqualToString:@"ContactAPI"]) { + + NSArray * array = response; + + for (NSDictionary * parmDic in array) { + + EmergencyContactModel * model = [EmergencyContactModel modelWithDictionary:parmDic]; + + [self.dataArray addObject:model]; + + } + self.homeTable.dataArray = self.dataArray; + } +} +#pragma mark:新增联系人 +- (void)addEmergencyContact { + + AddContactViewController * addVC = [[AddContactViewController alloc] init]; + + [self.navigationController pushViewController:addVC animated:YES]; + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineVideoRecordViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineVideoRecordViewController.h new file mode 100644 index 0000000..0ad5a9c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineVideoRecordViewController.h @@ -0,0 +1,19 @@ +// +// MineVideoRecordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MineVideoRecordViewController : HQBaseViewController + +@property (nonatomic, assign) NSInteger selectOnes; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineVideoRecordViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineVideoRecordViewController.m new file mode 100644 index 0000000..af15445 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MineVideoRecordViewController.m @@ -0,0 +1,374 @@ +// +// MineVideoRecordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "MineVideoRecordViewController.h" +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" +#import "RecordIMListDateModel.h" +#import "DoctorMainViewController.h" +@interface MineVideoRecordViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * groupIDArray; + +@property (nonatomic, strong) NSMutableArray * jingxingArray; + +@end + + +@implementation MineVideoRecordViewController + + +- (NSMutableArray *)groupIDArray { + + if (!_groupIDArray) { + + _groupIDArray = [[NSMutableArray alloc] init]; + + } + return _groupIDArray; + +} + +- (NSMutableArray *)jingxingArray { + + if (!_jingxingArray) { + + _jingxingArray = [[NSMutableArray alloc] init]; + + } + return _jingxingArray; + +} + + + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 0; + self.type = [NSString stringWithFormat:@"%ld",_selectOnes]; + [self createUI]; + [self createData]; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + [self.homeTable.mj_header beginRefreshing]; + +} + +- (void)createUI { + + NSArray * array = @[@"进行中",@"待评价",@"已评价",@"历史"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(70); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(17) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; +// if (index == 0 ) { +// listBtn.selected = YES; +// listBtn.backgroundColor = UIColorHex(#21BEBD); +// }else{ +// listBtn.backgroundColor = UIColorHex(#DDDDDD); +// } + if (self.selectOnes == 3) { + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + if (self.selectOnes == 4) { + if (index == 1 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + if (self.selectOnes == 5) { + if (index == 2 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + if (self.selectOnes == 6) { + if (index == 3 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - 45 - 60) style:UITableViewStyleGrouped]; + MJWeakSelf; + self.homeTable.detailBlock = ^(NSString * _Nonnull recordID, NSString * _Nonnull imID, NSString * _Nonnull memberId, RecordIMListDateModel * _Nonnull model) { + + DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; + doctorVC.yuyue_id = recordID; + doctorVC.popType = 1; + [weakSelf.navigationController pushViewController:doctorVC animated:YES]; + }; + [self.view addSubview:self.homeTable]; + + + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 0; + [weakSelf createData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [weakSelf createData]; + }]; + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noData" titleStr:@"暂无数据" detailStr:@""]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = [UIColor blackColor]; + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + //按钮背景色 + emptyView.actionBtnBackGroundColor = KWhiteColor; + emptyView.actionBtnWidth = CGFLOAT_MIN; + emptyView.actionBtnHeight = CGFLOAT_MIN; + + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; +} + + +- (void)createData { + // type : 1 图文 2 音视频 + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:self.type forKey:@"status"]; + [parmDic setObject:@"2" forKey:@"type"]; + //status 1 3 4 5 //4 代评价 + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi getMineQuestionRecord:parmDic]; +} + + + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + + if ([tag isEqualToString:@"RECORD"]) { + + [self hiddenAllMBProgressHUD]; + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + if (self.pageNo == 0) { + [self.dataArray removeAllObjects]; + } + for (NSDictionary * dic in array) { + + RecordIMListDateModel * model = [ RecordIMListDateModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + + self.homeTable.dataArray = self.dataArray; + + } + + +} + +- (void)statusChange:(UIButton *)statusBtn { + + + if (statusBtn.tag == 1000) { //进行中 + self.type = @"3"; + } + if (statusBtn.tag == 1001) { //待评价 + self.type = @"4"; + } + if (statusBtn.tag == 1002) { //已评价 + self.type = @"5"; + } + if (statusBtn.tag == 1003) { //全部 + self.type = @"6"; + } + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + + [self.homeTable.mj_header beginRefreshing]; +} + +- (void)setSelectOnes:(NSInteger)selectOnes { + + _selectOnes = selectOnes; + + switch (_selectOnes) { + case 3: //进行中 + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1000) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + case 4: //待评价 + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1001) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + case 5://已经评价 + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1002) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + case 6:// 全部历史 + { + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 1002) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.selected = NO; + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + } + break; + + default: + break; + } + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MyCenterViewController.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MyCenterViewController.h new file mode 100644 index 0000000..2989426 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MyCenterViewController.h @@ -0,0 +1,16 @@ +// +// MyCenterViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MyCenterViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MyCenterViewController.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MyCenterViewController.m new file mode 100644 index 0000000..8689744 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Controller/MyCenterViewController.m @@ -0,0 +1,345 @@ +// +// MyCenterViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "MyCenterViewController.h" +#import "SliderView.h" +#import "UILabel+Extension.h" +#import "SliderView.h" +#import "MyCenterTableView.h" +#import "QuestionPeopleMangerVC.h" +#import "MineQuestionRecordViewController.h" +#import "MineUserInfoViewController.h" +#import "MineCenterUserModel.h" +#import "EditSystemViewController.h" +#import "LoginFoundPasswordViewController.h" +#import "ADJumpViewController.h" +#import "LoginSetPasswordViewController.h" +#import "LoginFoundPasswordViewController.h" +@interface MyCenterViewController () + +@property (nonatomic, strong) MyCenterTableView * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + + +@end + +@implementation MyCenterViewController + + + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"个人中心"; + self.view.backgroundColor = UIColorHex(#EEEEEE); +// [self createTopAndNav]; + [self addNavigationItemWithImageNames:@[@"setting_icon"] isLeft:false target:self action:@selector(settingAction) tags:@[ @"100"]]; + [self createUI]; + + [self createData]; + +} + +-(void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + if ([HQCommonUtils isLogin]) { + [self createUserInfo]; + [self questionNumber]; + } +} + + +- (void)settingAction { + + EditSystemViewController * infoVC = [[EditSystemViewController alloc] init]; + + [self.navigationController pushViewController:infoVC animated:YES]; + +} + +#pragma mark - numberFormat +- (NSString *)numberFormat:(float)num { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + [formatter setPositiveFormat:@"0"]; + return [formatter stringFromNumber:[NSNumber numberWithFloat:num]]; +} + + + +- (void)createUI { + + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(120))]; + topView.backgroundColor = UIColorHex(#21BEBD); + [self.view addSubview:topView]; + + + + self.homeTable = [[MyCenterTableView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(25), kScreenWidth - kRealValue(30), kScreenHeight - kRealValue(25) - kTopHeight - kTabBarHeight) style:UITableViewStyleGrouped]; + self.homeTable.heardDelegate =self; + self.homeTable.cellDelegate = self; + self.homeTable.contentInset = UIEdgeInsetsMake(20, 0, 0, 0); + [self.homeTable scrollRectToVisible:CGRectMake(0, 29,1, 1) animated:YES]; + [self.view addSubview:self.homeTable]; + + UIButton * outLoginBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(48), kScreenHeight - kTabBarHeight - kTopHeight -kRealValue(100) , kScreenWidth - kRealValue(96), kRealValue(40))]; + outLoginBtn.backgroundColor = KWhiteColor; + if ([HQCommonUtils isLogin]) { + [outLoginBtn setTitle:@"退出登录" forState:UIControlStateNormal]; + [outLoginBtn addTarget:self action:@selector(outLoginUserinfo) forControlEvents:UIControlEventTouchUpInside]; + }else + { + [outLoginBtn setTitle:@"去登录" forState:UIControlStateNormal]; + [outLoginBtn addTarget:self action:@selector(gotoLoginUserinfo) forControlEvents:UIControlEventTouchUpInside]; + } + [outLoginBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + outLoginBtn.layer.cornerRadius = 20; + outLoginBtn.layer.masksToBounds = YES; + outLoginBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + outLoginBtn.titleLabel.font = SYSTEMFONT(14); + outLoginBtn.layer.borderWidth = 1.0f; + [self.view addSubview:outLoginBtn]; +} + +- (void)createUserInfo { + + JKCQAPI * infoApi = [[JKCQAPI alloc] init:self tag:@"USERINFO" NeedToken:@""]; + [infoApi getMineCenterUserInfo:nil]; +} + +- (void)createData { + + JKCQAPI * agreeAPI = [[JKCQAPI alloc] init:self tag:@"AGREEAPI" NeedToken:@""]; + + [agreeAPI getUserAgreementPrivacy:nil]; + +} + + +- (void)outLoginUserinfo { + + + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"是否确定退出登录?" preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + + }]; + UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + }]; + [alertController addAction:cancelAction]; + [alertController addAction:sureAction]; + + [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController animated:YES completion:nil]; +} + +#pragma mark:进行中 +- (void)myCenterInProgress { + + + if (![HQCommonUtils isLogin]) { + + [EasyTextView showErrorText:@"请登录"]; + return; + } + MineQuestionRecordViewController * recordVC = [[MineQuestionRecordViewController alloc] init]; + recordVC.titleSelected = 10;//图文视频 + recordVC.type = 3; + [self.navigationController pushViewController:recordVC animated:YES]; +} + +#pragma mark:待评价 +- (void)waitEvaluation { + if (![HQCommonUtils isLogin]) { + + [EasyTextView showErrorText:@"请登录"]; + return; + } + MineQuestionRecordViewController * recordVC = [[MineQuestionRecordViewController alloc] init]; + recordVC.titleSelected = 11;//音视频 + recordVC.type = 4; + [self.navigationController pushViewController:recordVC animated:YES]; +} + +#pragma mark:已评价 +- (void)completeEvaluation { + if (![HQCommonUtils isLogin]) { + + [EasyTextView showErrorText:@"请登录"]; + return; + } + MineQuestionRecordViewController * recordVC = [[MineQuestionRecordViewController alloc] init]; + recordVC.titleSelected = 10;//图文视频 + recordVC.type = 4; + [self.navigationController pushViewController:recordVC animated:YES]; + +} +#pragma mark:历史 +- (void)myHistoryAction { + if (![HQCommonUtils isLogin]) { + + [EasyTextView showErrorText:@"请登录"]; + return; + } + MineQuestionRecordViewController * recordVC = [[MineQuestionRecordViewController alloc] init]; + recordVC.titleSelected = 10;//图文视频 + recordVC.type = 6; + [self.navigationController pushViewController:recordVC animated:YES]; + +} +#pragma mark:查看全部 +- (void)lookAllQuestion { + if (![HQCommonUtils isLogin]) { + + [EasyTextView showErrorText:@"请登录"]; + return; + } + MineQuestionRecordViewController * recordVC = [[MineQuestionRecordViewController alloc] init]; + recordVC.titleSelected = 10;//图文视频 + recordVC.type = 6; + [self.navigationController pushViewController:recordVC animated:YES]; +} + +- (void)cellListClick:(NSInteger)cellIndex { + + if (![HQCommonUtils isLogin]) { + + [EasyTextView showErrorText:@"请登录"]; + return; + } + + if (cellIndex == 0) { + + LoginFoundPasswordViewController * loginVC = [[LoginFoundPasswordViewController alloc] init]; + [self.navigationController pushViewController:loginVC animated:YES]; + } + if (cellIndex == 1) { + + if (self.dataArray.count <= 0) { + [EasyTextView showErrorText:@"暂无用户协议"]; + return; + } + for (MineCenterUserModel * model in self.dataArray) { + + if ([model.value integerValue] == 1) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"用户协议"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + } + if (cellIndex == 2) { + if (self.dataArray.count <= 0) { + [EasyTextView showErrorText:@"暂无隐私政策"]; + return; + } + for (MineCenterUserModel * model in self.dataArray) { + + if ([model.value integerValue] == 2) { + + ADJumpViewController * webVC= [[ADJumpViewController alloc] init]; + webVC.webTitle = @"隐私政策"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + } + +} + +- (void)questionNumber { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + JKCQAPI * numbeApi = [[JKCQAPI alloc] init:self tag:@"NUMBERAPI" NeedToken:@""]; + + [numbeApi getMineCenterNumber:dic]; + +} + +- (void)heardImageOnClick { + + + MineUserInfoViewController * infoVC = [[MineUserInfoViewController alloc] init]; + + [self.navigationController pushViewController:infoVC animated:YES]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"NUMBERAPI"]) { + + NSString * number = response; + + self.homeTable.number = [number integerValue]; + + } + + if ([tag isEqualToString:@"USERINFO"]) { + NSDictionary * dic = response; + MineCenterUserModel * userModel = [MineCenterUserModel modelWithDictionary:dic]; + self.homeTable.userModel = userModel; + + } + if ([tag isEqualToString:@"AGREEAPI"]) { + + NSArray * array = response; + [self.dataArray removeAllObjects]; + for (NSDictionary * parmDic in array) { + + MineCenterUserModel * model = [MineCenterUserModel modelWithDictionary:parmDic]; + + [self.dataArray addObject:model]; + + } + + } +} + +- (void)gotoLoginUserinfo { + + KPostNotification(KNotificationLoginStateChange, @NO); + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessDetailModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessDetailModel.h new file mode 100644 index 0000000..e7aab30 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessDetailModel.h @@ -0,0 +1,38 @@ +// +// BigillessDetailModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BigillessDetailModel : NSObject + +@property (nonatomic, copy) NSString * detail_id; +@property (nonatomic, copy) NSString * hospitalId; +@property (nonatomic, copy) NSString * hospitalName; +@property (nonatomic, copy) NSString * medicalCardNo; +@property (nonatomic, copy) NSString * registerCategory; +@property (nonatomic, copy) NSString * registerCategory_dictText; +@property (nonatomic, copy) NSString * yiyuan_id; +@property (nonatomic, copy) NSString * state; +@property (nonatomic, copy) NSString * desireTime; +@property (nonatomic, copy) NSString * reservationOffice; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * reservationDoctor; +@property (nonatomic, copy) NSString * diseaseDescribe; +@property (nonatomic, copy) NSString * rejectionReason; +@property (nonatomic, copy) NSString * realname; +@property (nonatomic, copy) NSString * idNo; +@property (nonatomic, copy) NSString * telPhone; +@property (nonatomic, copy) NSString * reservationNo; +@property (nonatomic, copy) NSString * topState; +@property (nonatomic, copy) NSString * rejectionTime; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessDetailModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessDetailModel.m new file mode 100644 index 0000000..fe0b92e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessDetailModel.m @@ -0,0 +1,17 @@ +// +// BigillessDetailModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import "BigillessDetailModel.h" + +@implementation BigillessDetailModel ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"topState" :@"newState"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessHospitalModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessHospitalModel.h new file mode 100644 index 0000000..a89cefe --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessHospitalModel.h @@ -0,0 +1,19 @@ +// +// BigillessHospitalModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BigillessHospitalModel : NSObject + +@property (nonatomic, copy) NSString * yiyuan_id; +@property (nonatomic, copy) NSString * name; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessHospitalModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessHospitalModel.m new file mode 100644 index 0000000..4307561 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillessHospitalModel.m @@ -0,0 +1,18 @@ +// +// BigillessHospitalModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import "BigillessHospitalModel.h" + +@implementation BigillessHospitalModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"yiyuan_id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillnessModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillnessModel.h new file mode 100644 index 0000000..5845d81 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillnessModel.h @@ -0,0 +1,24 @@ +// +// BigillnessModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BigillnessModel : NSObject + +@property (nonatomic, copy) NSString * zixun_id; +@property (nonatomic, copy) NSString * hospitalName; +@property (nonatomic, copy) NSString * reservationOffice; +@property (nonatomic, copy) NSString * reservationDoctor; +@property (nonatomic, copy) NSString * realname; +@property (nonatomic, copy) NSString * state ;// 状态 1未派单 2已派单 3已接单 4已预约 5已完成 6操作人员驳回 7驻场人员驳回 8 超时未接单 6,7,8红色 其余都是绿色 +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * desireTime; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillnessModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillnessModel.m new file mode 100644 index 0000000..d333661 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/BigillnessModel.m @@ -0,0 +1,19 @@ +// +// BigillnessModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import "BigillnessModel.h" + +@implementation BigillnessModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"zixun_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/EmergencyContactModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/EmergencyContactModel.h new file mode 100644 index 0000000..cfd9531 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/EmergencyContactModel.h @@ -0,0 +1,23 @@ +// +// EmergencyContactModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface EmergencyContactModel : NSObject + +@property (nonatomic, copy) NSString * contact_ID; +@property (nonatomic, copy) NSString * phone; +@property (nonatomic, copy) NSString * familyRelation_dictText; +@property (nonatomic, copy) NSString * name; +@property (nonatomic, copy) NSString * idCard; +@property (nonatomic, copy) NSString * familyRelation; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/EmergencyContactModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/EmergencyContactModel.m new file mode 100644 index 0000000..7f041d1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/EmergencyContactModel.m @@ -0,0 +1,19 @@ +// +// EmergencyContactModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "EmergencyContactModel.h" + +@implementation EmergencyContactModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"contact_ID" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/MineCenterUserModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/MineCenterUserModel.h new file mode 100644 index 0000000..7994ae1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/MineCenterUserModel.h @@ -0,0 +1,30 @@ +// +// MineCenterUserModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MineCenterUserModel : NSObject + +@property (nonatomic, copy) NSString * realname; +@property (nonatomic, copy) NSString * workNo; +@property (nonatomic, copy) NSString * phone; +@property (nonatomic, copy) NSString * idCard; +@property (nonatomic, copy) NSString * sex; +@property (nonatomic, copy) NSString * sex_dictText; +@property (nonatomic, copy) NSString * personType; +@property (nonatomic, copy) NSString * personType_dictText; +@property (nonatomic, copy) NSString * orgCode; +@property (nonatomic, copy) NSString * avatar; +@property (nonatomic, copy) NSString * value; +@property (nonatomic, copy) NSString * text; +@property (nonatomic, copy) NSString * title; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/MineCenterUserModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/MineCenterUserModel.m new file mode 100644 index 0000000..6746c54 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/MineCenterUserModel.m @@ -0,0 +1,12 @@ +// +// MineCenterUserModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import "MineCenterUserModel.h" + +@implementation MineCenterUserModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorDetailInfoModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorDetailInfoModel.h new file mode 100644 index 0000000..8537bfd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorDetailInfoModel.h @@ -0,0 +1,107 @@ +// +// SOSDoctorDetailInfoModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/23. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SOSDoctorDetailHistory : NSObject + +@property (nonatomic, copy) NSString * status; +@property (nonatomic, copy) NSString * stationUserId; +@property (nonatomic, copy) NSString * stationUserName; +@property (nonatomic, copy) NSString * stationUserSex; +@property (nonatomic, copy) NSString * accept_dictText; +@property (nonatomic, copy) NSString * updateTime; +@property (nonatomic, copy) NSString * stationBusiness_dictText; +@property (nonatomic, copy) NSString * sendOrderHospital; +@property (nonatomic, copy) NSString * orderId; +@property (nonatomic, copy) NSString * stationBusiness; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * createBy; +@property (nonatomic, copy) NSString * history_id; +@property (nonatomic, copy) NSString * transferOrderTime; + + +@end + +@interface SOSDoctorDetailInfoModel : NSObject + +@property (nonatomic, copy) NSString * createTimeEnd; +@property (nonatomic, copy) NSString * majorSalvageOpinion; +@property (nonatomic, copy) NSString * infoDesc; +@property (nonatomic, copy) NSString * delFlag; +@property (nonatomic, copy) NSString * detail_id; +@property (nonatomic, copy) NSString * initiatorUserDepart; +@property (nonatomic, copy) NSString * stationUserMobile; +@property (nonatomic, copy) NSString * memo; +@property (nonatomic, copy) NSString * orderDetail; +@property (nonatomic, copy) NSString * stationUserAvatar; + +@property (nonatomic, copy) NSString * updateBy; +@property (nonatomic, copy) NSString * sessionNow; +@property (nonatomic, copy) NSString * stationUserSex; +@property (nonatomic, copy) NSString * stationUserId; +@property (nonatomic, copy) NSString * isDispatch_dictText; +@property (nonatomic, copy) NSString * createBy; +@property (nonatomic, copy) NSString * stationRejectionTime; +@property (nonatomic, copy) NSString * initiatorUserName; +@property (nonatomic, copy) NSString * salvageUserAge; +@property (nonatomic, copy) NSString * createTime; + +@property (nonatomic, copy) NSString * resourceId; +@property (nonatomic, copy) NSString * operationUserSex; +@property (nonatomic, copy) NSString * stationBusiness; +@property (nonatomic, copy) NSString * majorUserSex; +@property (nonatomic, copy) NSString * status; +@property (nonatomic, copy) NSString * operationUserName; +@property (nonatomic, copy) NSString * stationUserDepart; +@property (nonatomic, copy) NSString * salvageUserSecondDepart; +@property (nonatomic, copy) NSString * majorUserId; +@property (nonatomic, copy) NSString * initiatorUserSex; + +@property (nonatomic, strong) NSArray * orderSendRecordList; + +@property (nonatomic, copy) NSString * stationBusiness_dictText; +@property (nonatomic, copy) NSString * majorResponseTime; +@property (nonatomic, copy) NSString * salvageUserMobile; +@property (nonatomic, copy) NSString * initiatorUserId; +@property (nonatomic, copy) NSString * orderStatus; +@property (nonatomic, copy) NSString * salvageUserAvatar; +@property (nonatomic, copy) NSString * initiatorType; +@property (nonatomic, copy) NSString * initiatorUserAge; +@property (nonatomic, copy) NSString * sessionId; + +@property (nonatomic, copy) NSString * salvageUserName; +@property (nonatomic, copy) NSString * initiatorUserMobile; +@property (nonatomic, copy) NSString * stationUserName; +@property (nonatomic, copy) NSString * updateTime; +@property (nonatomic, copy) NSString * operationUserMobile; +@property (nonatomic, copy) NSString * majorUserName; +@property (nonatomic, copy) NSString * isDispatch; +@property (nonatomic, copy) NSString * orderStatus_dictText; +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, copy) NSString * initiatorUserSecondDepart; +@property (nonatomic, copy) NSString * salvageUserDepart; +@property (nonatomic, copy) NSString * orderOverTime; +@property (nonatomic, copy) NSString * initiatorUserIdCard; +@property (nonatomic, copy) NSString * initiatorUserAvatar; +@property (nonatomic, copy) NSString * salvageUserId; +@property (nonatomic, copy) NSString * operationUserId; +@property (nonatomic, copy) NSString * operationResponseTime; +@property (nonatomic, copy) NSString * stationResponseTime; + +@property (nonatomic, copy) NSString * operationSendOrderTime; +@property (nonatomic, assign) BOOL isFill; +@property (nonatomic, copy) NSString * sendOrderHospital; +@property (nonatomic, copy) NSString * salvageUserIdCard; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorDetailInfoModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorDetailInfoModel.m new file mode 100644 index 0000000..935dd1c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorDetailInfoModel.m @@ -0,0 +1,40 @@ +// +// SOSDoctorDetailInfoModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/23. +// + +#import "SOSDoctorDetailInfoModel.h" + + + +@implementation SOSDoctorDetailHistory + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"history_id" :@"id"}; + return dic; +} + + +@end + +@implementation SOSDoctorDetailInfoModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"orderSendRecordList":[SOSDoctorDetailHistory class] + }; +} + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"detail_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorModel.h b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorModel.h new file mode 100644 index 0000000..95f0230 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorModel.h @@ -0,0 +1,38 @@ +// +// SOSDoctorModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + + +@interface SOSDoctorRecordListModel : NSObject + +@property (nonatomic, copy) NSString * sos_id; +@property (nonatomic, copy) NSString * sessionId; +@property (nonatomic, copy) NSString * initiatorUserId; +@property (nonatomic, copy) NSString * initiatorUserName; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * initiatorUserSex; +@property (nonatomic, copy) NSString * orderStatus_dictText; +@property (nonatomic, copy) NSString * sendOrderHospital; +@property (nonatomic, copy) NSString * stationBusiness; +@property (nonatomic, copy) NSString * orderStatus; +@property (nonatomic, copy) NSString * stationBusiness_dictText; + +@end + + +@interface SOSDoctorModel : NSObject + +@property (nonatomic, strong) NSArray * records; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorModel.m b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorModel.m new file mode 100644 index 0000000..02c35a4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/Model/SOSDoctorModel.m @@ -0,0 +1,37 @@ +// +// SOSDoctorModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import "SOSDoctorModel.h" + + + +@implementation SOSDoctorRecordListModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"sos_id" :@"id"}; + return dic; +} + + +@end + + + +@implementation SOSDoctorModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"records":[SOSDoctorRecordListModel class] + }; +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigilessTopStatusView.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigilessTopStatusView.h new file mode 100644 index 0000000..8c7c8fb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigilessTopStatusView.h @@ -0,0 +1,25 @@ +// +// BigilessTopStatusView.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BigilessTopStatusView : UIView + +@property (nonatomic, assign) BOOL isSelected; + +@property (nonatomic, assign) BOOL isLast; + +@property (nonatomic, assign) NSInteger lastType; + +@property (nonatomic, copy) NSString * statusString; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigilessTopStatusView.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigilessTopStatusView.m new file mode 100644 index 0000000..8235576 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigilessTopStatusView.m @@ -0,0 +1,120 @@ +// +// BigilessTopStatusView.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/21. +// + +#import "BigilessTopStatusView.h" + + +@interface BigilessTopStatusView () + +@property (nonatomic, strong) UIButton * statusBtn; + +@property (nonatomic, strong) UILabel * statusLabel; + +@property (nonatomic, strong) UILabel * numberLabel; + + +@property (nonatomic, strong) UIImageView * statusView; + +@property (nonatomic, strong) UIView * lineView; + +@end + + +@implementation BigilessTopStatusView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.statusBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(5), 0, kRealValue(38), kRealValue(38))]; + [self.statusBtn setImage:[UIImage imageNamed:@"statusTop_nomal"] forState:UIControlStateNormal]; + [self.statusBtn setImage:[UIImage imageNamed:@"statusTop_selected"] forState:UIControlStateSelected]; + [self addSubview:self.statusBtn]; + + + self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(5), 0, kRealValue(38), kRealValue(38))]; + self.numberLabel.textAlignment = NSTextAlignmentCenter; + self.numberLabel.font = SYSTEMFONT(13); + self.numberLabel.text = @"1"; + self.numberLabel.textColor = UIColorHex(#21BEBD); + [self addSubview:self.numberLabel]; + + + self.statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.statusBtn.bottom + 8, 60, 13)]; + self.statusLabel.textAlignment = NSTextAlignmentLeft; + self.statusLabel.font = SYSTEMFONT(13); + self.statusLabel.text = @"在线咨询"; + self.statusLabel.textColor = KWhiteColor; + [self addSubview:self.statusLabel]; + + self.statusView = [[UIImageView alloc] initWithFrame:CGRectMake(self.statusBtn.right + kRealValue(13) , kRealValue(13), 20, 7)]; + self.statusView.image = [UIImage imageNamed:@"line_selected"]; + self.statusView.hidden = true; + [self addSubview:self.statusView]; + + self.lineView = [[UIImageView alloc] initWithFrame:CGRectMake(self.statusBtn.right , kRealValue(19), kRealValue(24), 2)]; + self.lineView.backgroundColor = KWhiteColor; + self.lineView.hidden = true; + [self addSubview:self.lineView]; + +} + +- (void)setIsSelected:(BOOL)isSelected { + + _isSelected = isSelected; + + if (_isSelected) { + self.statusBtn.selected = true; + self.statusView.hidden = false; + self.lineView.hidden = true; + self.statusLabel.textColor = KWhiteColor; + } + else { + self.statusBtn.selected = false; + self.statusView.hidden = true; + self.lineView.hidden = false; + self.statusLabel.textColor = UIColorHex(#FBFBFB); + } +} + + +- (void)setLastType:(NSInteger)lastType { + + _lastType = lastType; + + if (_lastType == 3) { + self.lineView.hidden = YES; + self.statusView.hidden = YES; + } + self.numberLabel.text = [NSString stringWithFormat:@"%ld",_lastType + 1]; + +} + +- (void)setStatusString:(NSString *)statusString { + + _statusString = statusString; + + self.statusLabel.text = _statusString; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessListTable.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessListTable.h new file mode 100644 index 0000000..d833c57 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessListTable.h @@ -0,0 +1,22 @@ +// +// BigillessListTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookDetailBlock)(NSString * card_id); + +@interface BigillessListTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) lookDetailBlock detailBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessListTable.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessListTable.m new file mode 100644 index 0000000..536ea9e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessListTable.m @@ -0,0 +1,137 @@ +// +// BigillessListTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/19. +// + +#import "BigillessListTable.h" +#import "BigillessTableViewCell.h" + + +@interface BigillessListTable () + + +@end + + +@implementation BigillessListTable + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.backgroundColor = UIColor.clearColor; + self.showsVerticalScrollIndicator = false; + self.showsHorizontalScrollIndicator = false; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + + [self reloadData]; +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 1; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + BigillessTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[BigillessTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.model= self.dataArray[indexPath.section]; + cell.backgroundColor = KWhiteColor; + cell.layer.cornerRadius = 10; + cell.layer.masksToBounds = YES; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + + + +} +//每行高度 +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +//{ +// return kRealValue(77); +//} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(10); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +//组头 --- 组尾 + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + + return [UIView new]; + +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + + UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + + + return footerView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + BigillnessModel * model= self.dataArray[indexPath.section]; + + if (self.detailBlock) { + self.detailBlock(model.zixun_id); + } +} + + +@end + + + diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessTableViewCell.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessTableViewCell.h new file mode 100644 index 0000000..8c84106 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessTableViewCell.h @@ -0,0 +1,18 @@ +// +// BigillessTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/19. +// + +#import +#import "BigillnessModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface BigillessTableViewCell : UITableViewCell + +@property (nonatomic, strong) BigillnessModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessTableViewCell.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessTableViewCell.m new file mode 100644 index 0000000..e7f4ee7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/BigillessTableViewCell.m @@ -0,0 +1,193 @@ +// +// BigillessTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/19. +// + +#import "BigillessTableViewCell.h" + +@interface BigillessTableViewCell() + +@property (nonatomic, strong) UILabel * hospitalLabel; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * doctorLabel; + +@property (nonatomic, strong) UILabel * peopleLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * statusLabel; + +@end + +@implementation BigillessTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + self.hospitalLabel = [[UILabel alloc] init]; + self.hospitalLabel.textColor = UIColorHex(#333333); + self.hospitalLabel.font = BOLDSYSTEMFONT(14); + self.hospitalLabel.textAlignment = NSTextAlignmentLeft; + self.hospitalLabel.text = @"预约医院:"; + [self.contentView addSubview:self.hospitalLabel]; + + [self.hospitalLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(14); + make.top.mas_offset(16); + make.height.mas_offset(14); + }]; + [self.hospitalLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + self.roomLabel = [[UILabel alloc] init]; + self.roomLabel.textColor = UIColorHex(#333333); + self.roomLabel.font = SYSTEMFONT(13); + self.roomLabel.textAlignment = NSTextAlignmentLeft; + self.roomLabel.text = @"预约科室:"; + [self.contentView addSubview:self.roomLabel]; + + + [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(14); + make.top.mas_equalTo(self.hospitalLabel.mas_bottom).offset(14); + make.height.mas_offset(14); + make.right.mas_offset (0); + }]; + + + self.doctorLabel = [[UILabel alloc] init]; + self.doctorLabel.textColor = UIColorHex(#333333); + self.doctorLabel.font = SYSTEMFONT(14); + self.doctorLabel.textAlignment = NSTextAlignmentLeft; + self.doctorLabel.text = @"预约医生:"; + [self.contentView addSubview:self.doctorLabel]; + + [self.doctorLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(14); + make.top.mas_equalTo(self.roomLabel.mas_bottom).offset(14); + make.height.mas_offset(14); + make.right.mas_offset (0); + }]; + + self.peopleLabel = [[UILabel alloc] init]; + self.peopleLabel.textColor = UIColorHex(#333333); + self.peopleLabel.font = SYSTEMFONT(14); + self.peopleLabel.text = @"预约人:"; + self.peopleLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.peopleLabel]; + + [self.peopleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(14); + make.top.mas_equalTo(self.doctorLabel.mas_bottom).offset(14); + make.height.mas_offset(14); + make.right.mas_offset (0); + make.bottom.mas_offset(-15); + }]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.font = SYSTEMFONT(13); + self.timeLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(@17); + make.height.mas_offset(12); + make.right.mas_offset (-17); + }]; + + self.statusLabel = [[UILabel alloc] init]; + self.statusLabel.textColor = UIColorHex(#16C716); + self.statusLabel.font = SYSTEMFONT(14); + self.statusLabel.textAlignment = NSTextAlignmentRight; + self.statusLabel.text = @"待派单"; + [self.contentView addSubview:self.statusLabel]; + + [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.timeLabel.mas_right); + make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(28); + make.height.mas_offset(12); + make.right.mas_offset (-17); + }]; +} +- (void)setModel:(BigillnessModel *)model { + + _model = model; + + self.hospitalLabel.text = [NSString stringWithFormat:@"预约医院:%@",model.hospitalName] ; + self.roomLabel.text = [NSString stringWithFormat:@"预约科室:%@",model.reservationOffice]; + self.doctorLabel.text = [NSString stringWithFormat:@"预约医生:%@",model.reservationDoctor]; + self.peopleLabel.text = [NSString stringWithFormat:@"预约人:%@",model.realname]; + self.timeLabel.text = model.createTime; + //状态 1未派单 2已派单 3已接单 4已预约 5已完成 6操作人员驳回 7驻场人员驳回 8 超时未接单 6,7,8红色 其余都是绿色 + if ([_model.state integerValue] == 1 ) { + + self.statusLabel.text =@"待派单"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.state integerValue] == 2 ) { + + self.statusLabel.text =@"已派单"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.state integerValue] == 3 ) { + + self.statusLabel.text =@"已接单"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.state integerValue] == 4 ) { + + self.statusLabel.text =@"已预约"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.state integerValue] == 5 ) { + + self.statusLabel.text =@"已完成"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.state integerValue] == 6 ) { + + self.statusLabel.text =@"被驳回"; + self.statusLabel.textColor = KRedColor; + + + } + if ([_model.state integerValue] == 7 ) { + + self.statusLabel.text =@"被驳回"; + self.statusLabel.textColor = KRedColor; + + + } + if ([_model.state integerValue] == 8 ) { + + self.statusLabel.text =@"未响应"; + self.statusLabel.textColor = KRedColor; + } +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/HistoryOrderTableViewCell.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/HistoryOrderTableViewCell.h new file mode 100644 index 0000000..d365bec --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/HistoryOrderTableViewCell.h @@ -0,0 +1,18 @@ +// +// HistoryOrderTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/23. +// + +#import +#import "SOSDoctorDetailInfoModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface HistoryOrderTableViewCell : UITableViewCell + +@property (nonatomic, strong) SOSDoctorDetailHistory * historyModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/HistoryOrderTableViewCell.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/HistoryOrderTableViewCell.m new file mode 100644 index 0000000..e9d6b00 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/HistoryOrderTableViewCell.m @@ -0,0 +1,101 @@ +// +// HistoryOrderTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/23. +// + +#import "HistoryOrderTableViewCell.h" + +@implementation HistoryOrderTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + + NSArray * leftInfoArray = @[@"派单时间",@"当前状态",@"派单业务",@"派单医院",@"驻场人员",@"转单时间"]; + UIView * linTwoView; + for (int j = 0; j < leftInfoArray.count; j ++) { + + UIView * orderView = [self orderInfoLabelViewWithFrame:CGRectMake(0, kRealValue(5) + kRealValue(25) * j, kScreenWidth - kRealValue(22), kRealValue(25)) withLeftText:leftInfoArray[j] withRightLabTag:300 + j]; + [self addSubview:orderView]; + if (j == leftInfoArray.count - 1) { + linTwoView = [[UIView alloc] initWithFrame:CGRectMake(0, orderView.bottom + kRealValue(8), kScreenWidth - kRealValue(22), 1)]; + linTwoView.backgroundColor = UIColorHex(#E0E0E0); + } + [self addSubview:linTwoView]; + } + +} + +- (UIView *)orderInfoLabelViewWithFrame:(CGRect)frame + withLeftText:(NSString *)leftText + withRightLabTag:(NSInteger)rightTag { + + UIView * labeView = [[UIView alloc] initWithFrame:frame]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), 0, 80, kRealValue(25))]; + leftLabel.textColor = UIColorHex(#666666); + leftLabel.font = SYSTEMFONT(13); + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.text = leftText; + [labeView addSubview:leftLabel]; + + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(22) - 200 - kRealValue(14), 0, 200, kRealValue(25))]; + rightLabel.textColor = UIColorHex(#333333); + rightLabel.font = SYSTEMFONT(13); + rightLabel.textAlignment = NSTextAlignmentRight; + rightLabel.text = leftText; + rightLabel.tag = rightTag; + [labeView addSubview:rightLabel]; + + return labeView; + +} + +- (void)setHistoryModel:(SOSDoctorDetailHistory *)historyModel { + + _historyModel = historyModel; + + UILabel * timeLabel = [self viewWithTag:300]; + timeLabel.text = _historyModel.createTime; + + UILabel * currentStatusLabel = [self viewWithTag:301]; + currentStatusLabel.text = _historyModel.accept_dictText; + + UILabel * yewuLabel = [self viewWithTag:302]; + yewuLabel.text = _historyModel.stationBusiness_dictText; + + UILabel * hospitalLabel = [self viewWithTag:303]; + hospitalLabel.text = _historyModel.sendOrderHospital; + + UILabel * zhuchangLabel = [self viewWithTag:304]; + zhuchangLabel.text = _historyModel.stationUserName; + + UILabel * zhuangTimeLabel = [self viewWithTag:305]; + zhuangTimeLabel.text = _historyModel.transferOrderTime; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineHeardTableViewCell.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineHeardTableViewCell.h new file mode 100644 index 0000000..0649c0c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineHeardTableViewCell.h @@ -0,0 +1,18 @@ +// +// MineHeardTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import +#import "MineCenterUserModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface MineHeardTableViewCell : UITableViewCell + +@property (nonatomic, strong) MineCenterUserModel * heardModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineHeardTableViewCell.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineHeardTableViewCell.m new file mode 100644 index 0000000..7272941 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineHeardTableViewCell.m @@ -0,0 +1,77 @@ +// +// MineHeardTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import "MineHeardTableViewCell.h" + +@interface MineHeardTableViewCell () + +@property (nonatomic, strong) UILabel * headLabel; + +@property (nonatomic, strong) UIImageView * heardImage ; + +@end + +@implementation MineHeardTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.headLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 24, 100, 14)]; + self.headLabel.textColor = UIColorHex(#666666); + self.headLabel.text = @"头像"; + self.headLabel.font = MEDIUMFONT(14); + self.headLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.headLabel]; + + self.heardImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - 33 - 45, 8, 45, 45)]; + self.heardImage.layer.cornerRadius = 22.0; + self.heardImage.layer.masksToBounds = YES; + [self.contentView addSubview:self.heardImage]; +} + +- (void)setHeardModel:(MineCenterUserModel *)heardModel { + + _heardModel = heardModel; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_heardModel.avatar]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + if ([_heardModel.sex integerValue] == 1) { //女[] + [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"heard_woman"]]; + + }else + { + [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"heard_man"]]; + + } +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineUserInfoTable.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineUserInfoTable.h new file mode 100644 index 0000000..0bb2732 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineUserInfoTable.h @@ -0,0 +1,29 @@ +// +// MineUserInfoTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import +#import "MineCenterUserModel.h" +#import "EmergencyContactModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^addContactBlock)(); + +typedef void(^editContactMode)(EmergencyContactModel * model); + +@interface MineUserInfoTable : UITableView + +@property (nonatomic, strong) MineCenterUserModel * model; + +@property (nonatomic, copy) addContactBlock addBlcok; +@property (nonatomic, copy) editContactMode editBlcok; + +@property (nonatomic, strong) NSArray * dataArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineUserInfoTable.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineUserInfoTable.m new file mode 100644 index 0000000..457af56 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MineUserInfoTable.m @@ -0,0 +1,265 @@ +// +// MineUserInfoTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/26. +// + +#import "MineUserInfoTable.h" +#import "MineHeardTableViewCell.h" +#import "EmergencyContactModel.h" + +@interface MineUserInfoTable () + + +@end + +@implementation MineUserInfoTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.backgroundColor = CViewBgColor; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + self.showsVerticalScrollIndicator = NO; +} + +- (void)setModel:(MineCenterUserModel *)model { + + _model = model; + + [self reloadData]; + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + [self reloadData]; + +} + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + if (section == 0) { + return 8; + } + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 2; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.section == 0) { + //头像 + if (indexPath.row == 0) { + + MineHeardTableViewCell * heardCell = [tableView dequeueReusableCellWithIdentifier:@"HEARDCELL"]; + + if (!heardCell) { + heardCell = [[MineHeardTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HEARDCELL"]; + } + heardCell.backgroundColor = KWhiteColor; + heardCell.heardModel = self.model; + heardCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + return heardCell; + + }else + { + NSArray * sectionOne = @[@"姓名",@"性别",@"工号",@"手机号",@"身份证号",@"人员类型",@"所属部门"]; + NSArray * sectionTwo ; + NSString * workNo = @"--"; + NSString * sex_dictText = @"--"; + NSString * realname = @"--"; + NSString * phone = @"--"; + NSString * idCard = @"--"; + NSString * personType_dictText = @"--"; + NSString * orgCode = @"--"; + + if (!ValidStr(self.model.workNo)) { + workNo = [NSString stringWithFormat:@"%@",self.model.workNo]; + + } + if (!ValidStr(self.model.realname)) { + realname = [NSString stringWithFormat:@"%@",self.model.realname]; + + } + if (!ValidStr(self.model.sex_dictText)) { + sex_dictText = [NSString stringWithFormat:@"%@",self.model.sex_dictText]; + + } + if (!ValidStr(self.model.phone)) { + phone = [NSString stringWithFormat:@"%@",self.model.phone]; + + } + if (!ValidStr(self.model.idCard)) { + idCard = [NSString stringWithFormat:@"%@",self.model.idCard]; + + } + if (!ValidStr(self.model.personType_dictText)) { + personType_dictText = [NSString stringWithFormat:@"%@",self.model.personType_dictText]; + + } + if (!ValidStr(self.model.orgCode)) { + orgCode = [NSString stringWithFormat:@"%@",self.model.orgCode]; + + } + sectionTwo = @[realname,sex_dictText,workNo,phone,idCard,personType_dictText,orgCode]; + + static NSString * cellID = @"cellID"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.textLabel.font = SYSTEMFONT(14); + if (self.model) { + cell.detailTextLabel.text = sectionTwo[indexPath.row - 1]; + } + cell.textLabel.text = sectionOne[indexPath.row - 1]; + cell.textLabel.textColor = UIColorHex(#666666); + cell.textLabel.font = SYSTEMFONT(14); + cell.detailTextLabel.font = SYSTEMFONT(14); + cell.detailTextLabel.textColor = UIColorHex(#333333); + cell.backgroundColor = KWhiteColor; + return cell; + + } + } + if (indexPath.section == 1) { + + EmergencyContactModel * model = self.dataArray[indexPath.row]; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CONNETCELL"]; + + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CONNETCELL"]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.textLabel.font = SYSTEMFONT(14); + cell.textLabel.text = [NSString stringWithFormat:@"%@-%@",model.name,model.phone]; + return cell; + + + } + + + return UITableViewCell.new; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.section == 0) { + if (indexPath.row == 0) { + return 62; + }else + { + return 45; + } + } + return 46; + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + if (section == 1) { + return 50; + } + return CGFLOAT_MIN; +} + + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + if (section == 1) { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 50)]; + sectionHeardView.backgroundColor = CViewBgColor; + + UIView * labView = [[UIView alloc] initWithFrame:CGRectMake(0, 10, kScreenWidth, 40)]; + labView.backgroundColor = KWhiteColor; + [sectionHeardView addSubview:labView]; + + UILabel * heardLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 200, 40)]; + heardLabel.text = @"紧急联系人"; + heardLabel.textColor = UIColorHex(#666666); + heardLabel.font = SYSTEMFONT(14); + + heardLabel.textAlignment = NSTextAlignmentLeft; + [labView addSubview:heardLabel]; + + UIButton * addBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - 18 - 40, 12, 40, 13)]; + [addBtn setTitle:@"新增" forState:UIControlStateNormal]; + addBtn.titleLabel.textAlignment = NSTextAlignmentRight; + [addBtn setTitleColor:UIColorHex(#3390FF) forState:UIControlStateNormal]; + addBtn.titleLabel.font = SYSTEMFONT(13); + [addBtn addTarget:self action:@selector(addEmergencyContact) forControlEvents:UIControlEventTouchUpInside]; + [labView addSubview:addBtn]; + + return sectionHeardView; + } + + return UIView.new; + +} + +- (void)addEmergencyContact { + + if (self.addBlcok) { + self.addBlcok(); + } +} + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.section == 1) { + + EmergencyContactModel * model = self.dataArray[indexPath.row]; + + self.editBlcok(model); + } + + + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterHeardView.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterHeardView.h new file mode 100644 index 0000000..0ea6e6d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterHeardView.h @@ -0,0 +1,50 @@ +// +// MyCenterHeardView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/23. +// + +#import +#import "MineCenterUserModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol myCenterHeardToolsDelegate + +/* + 进行中 + */ +- (void)myCenterInProgress; +/* + 待评价 + */ +- (void)waitEvaluation; +/* + 已评价 + */ +- (void)completeEvaluation; +/* + 历史 + */ +- (void)myHistoryAction; + +//查看全部 +- (void)lookAllQuestion; + +- (void)heardImageOnClick; + +@end + + +@interface MyCenterHeardView : UIView + +@property (nonatomic, weak)id heardDelegate; + +@property (nonatomic, assign) NSInteger number; + +@property (nonatomic, strong) MineCenterUserModel * heardModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterHeardView.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterHeardView.m new file mode 100644 index 0000000..2a25b9f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterHeardView.m @@ -0,0 +1,203 @@ +// +// MyCenterHeardView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/23. +// + +#import "MyCenterHeardView.h" + +@interface MyCenterHeardView () + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * numberLabel; + +@property (nonatomic, strong) YYLabel * lookMoreLabel; + +@end + + + +@implementation MyCenterHeardView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + UIImageView * heardImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(26), - kRealValue(16) , 52, 52)]; + self.heardImage = heardImg; + heardImg.layer.cornerRadius = 26; + heardImg.layer.masksToBounds = true; + heardImg.userInteractionEnabled = true; + heardImg.image = [UIImage imageNamed:@"heard_woman"] ; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(heardImageAction)]; + [heardImg addGestureRecognizer:tap]; + [self addSubview:heardImg]; + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.heardImage.right + kRealValue(8), kRealValue(10), self.width - self.heardImage.right - kRealValue(10), 15)]; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = SYSTEMFONT(15); + self.nameLabel.textAlignment = NSTextAlignmentLeft; + self.nameLabel.text = @"未登录"; + [self addSubview:self.nameLabel]; + + self.lookMoreLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(100), kRealValue(10), kRealValue(60), 15)]; + self.lookMoreLabel.textColor = CFontColor1; + self.lookMoreLabel.font = SYSTEMFONT(13); + self.lookMoreLabel.textAlignment = NSTextAlignmentRight; + self.lookMoreLabel.text = @"查看更多>"; + MJWeakSelf + [self.lookMoreLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + if ([weakSelf.heardDelegate respondsToSelector:@selector(lookAllQuestion)]) { + [weakSelf.heardDelegate lookAllQuestion]; + } + }]; + [self addSubview:self.lookMoreLabel]; + + + NSArray * array = @[@[@"进行中",@"HeardProgress_icon"],@[@"待评价",@"waitEveal_icon"],@[@"已评价",@"alreadyEveal"],@[@"历史",@"HeardHistory_icon"]]; + + CGFloat w = 58 ; + + for (int i = 0 ; i < 4; i++) { + + UIView * heardView = [[UIView alloc] initWithFrame:CGRectMake(i * (kScreenWidth - kRealValue(30))/4, self.heardImage.bottom + kRealValue(18),(kScreenWidth - kRealValue(30))/4, self.height - self.heardImage.bottom - kRealValue(18))]; + [self addSubview:heardView]; + + UIImageView * toolsImg = [[UIImageView alloc] initWithFrame:CGRectMake((heardView.width / 2 - 29 ) , kRealValue(18), w, w)]; + toolsImg.image = [UIImage imageNamed:array[i][1]]; + toolsImg.userInteractionEnabled = true; + + if (i == 0) + { + UILabel * numLabel = [[UILabel alloc] initWithFrame:CGRectMake(toolsImg.width - 16, -2, 18, 18)]; + numLabel.text = @"1"; + numLabel.textColor = KWhiteColor; + numLabel.font = SYSTEMFONT(13); + numLabel.textAlignment = NSTextAlignmentCenter; + numLabel.backgroundColor = KRedColor; + numLabel.layer.borderColor = UIColor.whiteColor.CGColor; + numLabel.layer.borderWidth = 1.0f; + numLabel.layer.cornerRadius = 9.0; + numLabel.layer.masksToBounds = YES; + self.numberLabel = numLabel; + numLabel.hidden = YES; + [toolsImg addSubview:numLabel]; + } + [heardView addSubview:toolsImg]; + + UILabel * toolsLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 ,toolsImg.bottom + kRealValue(5), heardView.width, 15)]; + toolsLabel.textColor = CFontColor1; + toolsLabel.font = SYSTEMFONT(13); + toolsLabel.text = array[i][0]; + toolsLabel.textAlignment = NSTextAlignmentCenter; + [heardView addSubview:toolsLabel]; + + UIButton * heardBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, heardView.width, 80)]; + [heardBtn addTarget:self action:@selector(heardToolsAction:) forControlEvents:UIControlEventTouchUpInside]; + heardBtn.tag = 100 + i; + [heardView addSubview:heardBtn]; + + + } + + +} + +- (void)heardToolsAction:(UIButton *)toolsBtn { + + + + if (toolsBtn.tag == 100) { + + if ([self.heardDelegate respondsToSelector:@selector(myCenterInProgress)]) { + [self.heardDelegate myCenterInProgress]; + } + } + if (toolsBtn.tag == 101) { + + if ([self.heardDelegate respondsToSelector:@selector(waitEvaluation)]) { + [self.heardDelegate waitEvaluation]; + } + } + if (toolsBtn.tag == 102) { + + if ([self.heardDelegate respondsToSelector:@selector(completeEvaluation)]) { + [self.heardDelegate completeEvaluation]; + } + } + if (toolsBtn.tag == 103) { + + if ([self.heardDelegate respondsToSelector:@selector(myHistoryAction)]) { + [self.heardDelegate myHistoryAction]; + } + } + + +} + +- (void)setNumber:(NSInteger )number { + _number = number; + + if (number == 0) { + self.numberLabel.hidden = YES; + }else + { + self.numberLabel.hidden = false; + self.numberLabel.text = [NSString stringWithFormat:@"%ld",number]; + } + +} + +- (void)setHeardModel:(MineCenterUserModel *)heardModel { + + _heardModel = heardModel; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_heardModel.avatar]; + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + self.nameLabel.text = _heardModel.realname; + + if ([_heardModel.sex integerValue] == 1) { //女[] + [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"heard_woman"]]; + + }else + { + [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"heard_man"]]; + + } + + +} + +- (void)heardImageAction { + + if ([self.heardDelegate respondsToSelector:@selector(heardImageOnClick)]) { + [self.heardDelegate heardImageOnClick]; + } + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterTableView.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterTableView.h new file mode 100644 index 0000000..9b79775 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterTableView.h @@ -0,0 +1,33 @@ +// +// MyCenterTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/23. +// + +#import +#import "MyCenterHeardView.h" +#import "MineCenterUserModel.h" + +NS_ASSUME_NONNULL_BEGIN +@protocol cenerCellListDelegate + +- (void)cellListClick:(NSInteger)cellIndex; + +@end + +@interface MyCenterTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, weak)id heardDelegate; + +@property (nonatomic, weak)id cellDelegate; + +@property (nonatomic, assign) NSInteger number; + +@property (nonatomic, strong) MineCenterUserModel * userModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterTableView.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterTableView.m new file mode 100644 index 0000000..ac2b594 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/MyCenterTableView.m @@ -0,0 +1,253 @@ +// +// MyCenterTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/23. +// + +#import "MyCenterTableView.h" +#import "MyCenterHeardView.h" + +@interface MyCenterTableView () + +@property (nonatomic, strong) MyCenterHeardView * heardV; + +@end + +@implementation MyCenterTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.backgroundColor = KClearColor; + self.dataSource = self; + self.tableHeaderView = [self createHeardView]; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + +- (void)setHeardDelegate:(id)heardDelegate { + + _heardDelegate = heardDelegate; + + self.heardV.heardDelegate = _heardDelegate; +} + +- (void)setUserModel:(MineCenterUserModel *)userModel { + + _userModel = userModel; + + self.heardV.heardModel = _userModel; + +} + + +- (void)setNumber:(NSInteger)number { + _number = number; + + self.heardV.number = _number; +} + +- (UIView *)createHeardView +{ + MyCenterHeardView * heardV = [[MyCenterHeardView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(150))]; + heardV.layer.cornerRadius = 10; + heardV.backgroundColor = KWhiteColor; + heardV.heardDelegate = self.heardDelegate; + [HQCommonUtils addShadowToView:heardV]; + self.heardV = heardV; + return heardV; +} + + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + if (section == 0) { + return 3; + } + return 3; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + //,@[@"我的关注",@"myLove_icon"] + NSArray * sectionOne = @[@[@"账户与安全(修改密码)",@"relati"],@[@"用户协议",@"myRen"],@[@"隐私政策",@"medi"]]; + + static NSString * cellID = @"cellID"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.textLabel.font = SYSTEMFONT(14); + cell.textLabel.text = sectionOne[indexPath.row][0]; +// cell.imageView.image = [UIImage imageNamed: sectionOne[indexPath.row][1]]; + + return cell; + +} + + + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return kRealValue(10); +} + + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + return kRealValue(52); +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + sectionHeardView.backgroundColor = KClearColor; + return sectionHeardView; + +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + + + if ([self.cellDelegate respondsToSelector:@selector(cellListClick:)] ) { + + [self.cellDelegate cellListClick:indexPath.row]; + } + + + +} + +- (void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath + +{ + + if([cell respondsToSelector:@selector(tintColor)]) { + + if(tableView ==self) { + + CGFloat cornerRadius =5.f; + + cell.backgroundColor=UIColor.clearColor; + + CAShapeLayer * layer = [[CAShapeLayer alloc]init]; + + CGMutablePathRef pathRef = CGPathCreateMutable(); + + CGRect bounds = CGRectInset(cell.bounds,0,0); + + BOOL addLine =NO; + + if(indexPath.row==0&& indexPath.row== [tableView numberOfRowsInSection:indexPath.section]-1) { + + CGPathAddRoundedRect(pathRef,nil, bounds, cornerRadius, cornerRadius); + + }else if(indexPath.row==0) { + + CGPathMoveToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMaxY(bounds)); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMinY(bounds),CGRectGetMidX(bounds),CGRectGetMinY(bounds), cornerRadius); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMinY(bounds),CGRectGetMaxX(bounds),CGRectGetMidY(bounds), cornerRadius); + + CGPathAddLineToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMaxY(bounds)); + + addLine =YES; + + }else if(indexPath.row== [tableView numberOfRowsInSection:indexPath.section]-1) { + + CGPathMoveToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMinY(bounds)); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMaxY(bounds),CGRectGetMidX(bounds),CGRectGetMaxY(bounds), cornerRadius); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMaxY(bounds),CGRectGetMaxX(bounds),CGRectGetMidY(bounds), cornerRadius); + + CGPathAddLineToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMinY(bounds)); + + }else{ + + CGPathAddRect(pathRef,nil, bounds); + + addLine =YES; + + } + + layer.path= pathRef; + + CFRelease(pathRef); + + layer.fillColor= [UIColor colorWithWhite:1.f alpha:0.8f].CGColor; + + if(addLine ==YES) { + + CALayer* lineLayer = [[CALayer alloc]init]; + + CGFloat lineHeight = (1.f/ [UIScreen mainScreen].scale); + + lineLayer.frame=CGRectMake(CGRectGetMinX(bounds)+10, bounds.size.height-lineHeight, bounds.size.width-10, lineHeight); + + lineLayer.backgroundColor= tableView.separatorColor.CGColor; + + [layer addSublayer:lineLayer]; + + } + + UIView*testView = [[UIView alloc]initWithFrame:bounds]; + + [testView.layer insertSublayer:layer atIndex:0]; + + testView.backgroundColor=UIColor.clearColor; + + cell.backgroundView= testView; + + } + + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDetailTableHeardView.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDetailTableHeardView.h new file mode 100644 index 0000000..28e98a5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDetailTableHeardView.h @@ -0,0 +1,22 @@ +// +// SOSDetailTableHeardView.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import +#import "SOSDoctorDetailInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SOSDetailTableHeardView : UIView + +@property (nonatomic, assign) CGFloat heradHeight; + +@property (nonatomic, strong) SOSDoctorDetailInfoModel * heardModel; +@property (nonatomic, strong) SOSDoctorDetailHistory * historyModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDetailTableHeardView.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDetailTableHeardView.m new file mode 100644 index 0000000..ef242d3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDetailTableHeardView.m @@ -0,0 +1,207 @@ +// +// SOSDetailTableHeardView.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import "SOSDetailTableHeardView.h" + + +@interface SOSDetailTableHeardView () + +@property (nonatomic, strong) UILabel * orderStatusLabel; +@property (nonatomic, strong) UILabel * sendLabel; +@property (nonatomic, strong) UILabel * helpLabel; +@property (nonatomic, strong) UILabel * orderNumberLabel; +@property (nonatomic, strong) UILabel * helpTimeLabel; +@property (nonatomic, strong) UILabel * sosTimeLabel; +@property (nonatomic, strong) UILabel * peopleLabel; +@property (nonatomic, strong) UILabel * orderTimeLabel; +@property (nonatomic, strong) UILabel * statusLabel; +@property (nonatomic, strong) UILabel * yewuLabel; +@property (nonatomic, strong) UILabel * hospitalLabel; +@property (nonatomic, strong) UILabel * zhuchangLabel; +@property (nonatomic, strong) UILabel * jiedanLabel; +@property (nonatomic, strong) UILabel * infoLabel; +@property (nonatomic, strong) UIView * lineView; +@property (nonatomic, strong) UIView * lineTwoView; + +@end + +@implementation SOSDetailTableHeardView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + self.backgroundColor = KWhiteColor; + [self createUI]; + } + return self; +} + +- (void)createUI { + + + UILabel * titLabel= [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), kRealValue(24), 100, 14)]; + titLabel.text = @"工单信息"; + titLabel.textAlignment = NSTextAlignmentLeft; + titLabel.font =BOLDSYSTEMFONT(14); + titLabel.textColor = UIColorHex(#333333); + [self addSubview:titLabel]; + NSArray * leftArray = @[@"工单状态",@"发起人",@"求助人",@"工单号",@"求助时间",@"就助时间"]; + UIView * linView; + for (int i = 0; i < leftArray.count; i ++) { + + UIView * infoView = [self orderInfoLabelViewWithFrame:CGRectMake(0, titLabel.bottom + kRealValue(10)+ kRealValue(27) * i, self.width, kRealValue(27)) withLeftText:leftArray[i] withRightLabTag:100 + i]; + [self addSubview:infoView]; + if (i == leftArray.count - 1) { + linView = [[UIView alloc] initWithFrame:CGRectMake(0, infoView.bottom + kRealValue(8), self.width, 1)]; + linView.backgroundColor = UIColorHex(#E0E0E0); + self.lineView = linView; + } + [self addSubview:linView]; + } + + UILabel * infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), linView.bottom + kRealValue(21), 100, 14)]; + infoLabel.text = @"派单信息"; + infoLabel.textAlignment = NSTextAlignmentLeft; + infoLabel.font =BOLDSYSTEMFONT(14); + infoLabel.textColor = UIColorHex(#333333); + self.infoLabel = infoLabel; + [self addSubview:infoLabel]; + + NSArray * leftInfoArray = @[@"操作人员",@"派单时间",@"当前状态",@"派单业务",@"派单医院",@"驻场人员",@"接单时间"]; + UIView * linTwoView; + for (int j = 0; j < leftInfoArray.count; j ++) { + + UIView * orderView = [self orderInfoLabelViewWithFrame:CGRectMake(0, infoLabel.bottom + kRealValue(10) + kRealValue(25) * j, self.width, kRealValue(25)) withLeftText:leftInfoArray[j] withRightLabTag:200 + j]; + orderView.tag = 500 + j; + [self addSubview:orderView]; + + if (j == leftInfoArray.count - 1) { + linTwoView = [[UIView alloc] initWithFrame:CGRectMake(0, orderView.bottom + kRealValue(8), self.width, 1)]; + linTwoView.backgroundColor = UIColorHex(#E0E0E0); + self.lineTwoView = linTwoView; + } + + [self addSubview:linTwoView]; + } + +} + + +- (UIView *)orderInfoLabelViewWithFrame:(CGRect)frame + withLeftText:(NSString *)leftText + withRightLabTag:(NSInteger)rightTag { + + UIView * labeView = [[UIView alloc] initWithFrame:frame]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), 0, 80, kRealValue(25))]; + leftLabel.textColor = UIColorHex(#666666); + leftLabel.font = SYSTEMFONT(13); + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.text = leftText; + [labeView addSubview:leftLabel]; + + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width - 200 - kRealValue(14), 0, 200, kRealValue(25))]; + rightLabel.textColor = UIColorHex(#333333); + rightLabel.font = SYSTEMFONT(13); + rightLabel.textAlignment = NSTextAlignmentRight; + rightLabel.text = leftText; + rightLabel.tag = rightTag; + [labeView addSubview:rightLabel]; + + return labeView; + +} + +- (void)setHeardModel:(SOSDoctorDetailInfoModel *)heardModel { + + _heardModel = heardModel; + + self.statusLabel = [self viewWithTag:100]; + self.statusLabel.text = _heardModel.orderStatus_dictText; + + self.sendLabel = [self viewWithTag:101]; + self.sendLabel.text = _heardModel.initiatorUserName; + + self.helpLabel = [self viewWithTag:102]; + self.helpLabel.text = _heardModel.salvageUserName; + + self.orderNumberLabel = [self viewWithTag:103]; + self.orderNumberLabel.text = _heardModel.detail_id; + + self.helpTimeLabel = [self viewWithTag:104]; + self.helpTimeLabel.text = _heardModel.createTime; + + self.sosTimeLabel = [self viewWithTag:105]; + self.sosTimeLabel.text = _heardModel.majorResponseTime; +// + + self.peopleLabel = [self viewWithTag:200]; + self.peopleLabel.text = _heardModel.operationUserName; + + +} + +- (void)setHistoryModel:(SOSDoctorDetailHistory *)historyModel { + + _historyModel = historyModel; + + UIView * oneView = [self viewWithTag:500]; + UIView * twoView = [self viewWithTag:501]; + UIView * threeView = [self viewWithTag:502]; + UIView * fourView = [self viewWithTag:503]; + UIView * fiveView = [self viewWithTag:504]; + UIView * sixView = [self viewWithTag:505]; + UIView * sevView = [self viewWithTag:506]; + + self.orderTimeLabel = [self viewWithTag:201]; + self.statusLabel = [self viewWithTag:202]; + self.yewuLabel = [self viewWithTag:203]; + self.hospitalLabel = [self viewWithTag:204]; + self.zhuchangLabel = [self viewWithTag:205]; + self.jiedanLabel = [self viewWithTag:206]; + + + + if (_historyModel) { + self.orderTimeLabel.text = _historyModel.createTime; + self.statusLabel.text = _historyModel.accept_dictText; + self.yewuLabel.text = _historyModel.stationBusiness_dictText; + self.hospitalLabel.text = _historyModel.sendOrderHospital; + self.zhuchangLabel.text = _historyModel.stationUserName; + self.jiedanLabel.text = _historyModel.transferOrderTime; + self.lineTwoView.hidden = false; + self.heradHeight = sevView.bottom; + }else + { + [oneView removeFromSuperview]; + [twoView removeFromSuperview]; + [threeView removeFromSuperview]; + [fourView removeFromSuperview]; + [fiveView removeFromSuperview]; + [sixView removeFromSuperview]; + [sevView removeFromSuperview]; + + self.infoLabel.hidden = true; + self.orderTimeLabel.hidden = true; + self.statusLabel.hidden = true; + self.yewuLabel.hidden = true; + self.hospitalLabel.hidden = true; + self.zhuchangLabel.hidden = true; + self.lineTwoView.hidden = true; + self.heradHeight = self.lineView.bottom; + } + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorDetailTable.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorDetailTable.h new file mode 100644 index 0000000..5d22477 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorDetailTable.h @@ -0,0 +1,18 @@ +// +// SOSDoctorDetailTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/23. +// + +#import +#import "SOSDoctorDetailInfoModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface SOSDoctorDetailTable : UITableView + +@property (nonatomic, strong) SOSDoctorDetailInfoModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorDetailTable.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorDetailTable.m new file mode 100644 index 0000000..4031750 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorDetailTable.m @@ -0,0 +1,182 @@ +// +// SOSDoctorDetailTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/23. +// + +#import "SOSDoctorDetailTable.h" +#import "SOSDetailTableHeardView.h" +#import "SOSDoctorTableViewCell.h" +#import "HistoryOrderTableViewCell.h" + +@interface SOSDoctorDetailTable () + +@property (nonatomic, strong) SOSDetailTableHeardView * heardView; + +@end + + +@implementation SOSDoctorDetailTable + +- (SOSDetailTableHeardView *)heardView { + + if (!_heardView) { + + _heardView = [[SOSDetailTableHeardView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - kRealValue(22), 190)]; + + _heardView.backgroundColor = KClearColor; + + } + return _heardView; +} + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.backgroundColor = UIColor.clearColor; + self.showsVerticalScrollIndicator = false; + self.showsHorizontalScrollIndicator = false; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + self.tableHeaderView = self.heardView; + self.tableHeaderView.height = self.heardView.heradHeight; + +} + + +- (void)setModel:(SOSDoctorDetailInfoModel *)model { + + _model = model; + if (_model.orderSendRecordList.count >= 1) { + + self.heardView.historyModel = self.model.orderSendRecordList[0]; + }else + { + self.heardView.historyModel = nil; + } + self.heardView.heardModel = self.model; + self.heardView.height = self.heardView.heradHeight; + [self reloadData]; + +} +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + if (_model.orderSendRecordList.count >= 1) { + + return 1; + }else + { + return 0; + } +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + if (_model.orderSendRecordList.count >= 1) { + + return self.model.orderSendRecordList.count - 1; + }else + { + return 0; + } + +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSMutableArray * dataArray = [[NSMutableArray alloc] initWithArray:self.model.orderSendRecordList]; + [dataArray removeFirstObject]; + + SOSDoctorDetailHistory * hisModel = dataArray[indexPath.row]; + HistoryOrderTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[HistoryOrderTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.historyModel= hisModel; + cell.backgroundColor = KWhiteColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + + + +} +//每行高度 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return kRealValue(180); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(46); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +//组头 --- 组尾 + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + + return [UIView new]; + +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + if (_model.orderSendRecordList.count >= 2) { + + + + UIView * heardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(46))]; + heardView.backgroundColor = KWhiteColor; + UILabel * historyLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), kRealValue(23), 100, 14)]; + historyLabel.text = @"历史派单"; + historyLabel.textAlignment = NSTextAlignmentLeft; + historyLabel.font =BOLDSYSTEMFONT(14); + historyLabel.textColor = UIColorHex(#333333); + [heardView addSubview:historyLabel]; + return heardView; + } + return UIView.new; + + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + +} + + +@end + + + diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableView.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableView.h new file mode 100644 index 0000000..70f5bbf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableView.h @@ -0,0 +1,21 @@ +// +// SOSDoctorTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +typedef void(^sosDoctorListActionBlock)(NSString * sessionId , NSString * hospitalId); + +@interface SOSDoctorTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) sosDoctorListActionBlock recordBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableView.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableView.m new file mode 100644 index 0000000..75ac8d6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableView.m @@ -0,0 +1,137 @@ +// +// SOSDoctorTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import "SOSDoctorTableView.h" +#import "SOSDoctorTableViewCell.h" + +@interface SOSDoctorTableView () + + +@end + + +@implementation SOSDoctorTableView + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.backgroundColor = UIColor.clearColor; + self.showsVerticalScrollIndicator = false; + self.showsHorizontalScrollIndicator = false; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + +} + + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + + [self reloadData]; +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 1; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + SOSDoctorTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[SOSDoctorTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.model= self.dataArray[indexPath.section]; + cell.backgroundColor = KWhiteColor; + cell.layer.cornerRadius = 10; + cell.layer.masksToBounds = YES; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + + + +} +//每行高度 +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +//{ +// return kRealValue(77); +//} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(10); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +//组头 --- 组尾 + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + + return [UIView new]; + +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + + UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + + + return footerView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + SOSDoctorRecordListModel * model= self.dataArray[indexPath.section]; + + if (self.recordBlock) { + self.recordBlock(model.sos_id,model.sos_id); + } +} + + +@end + + + diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableViewCell.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableViewCell.h new file mode 100644 index 0000000..7e6f9fc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableViewCell.h @@ -0,0 +1,18 @@ +// +// SOSDoctorTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import +#import "SOSDoctorModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface SOSDoctorTableViewCell : UITableViewCell + +@property (nonatomic, strong) SOSDoctorRecordListModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableViewCell.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableViewCell.m new file mode 100644 index 0000000..61c87cf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SOSDoctorTableViewCell.m @@ -0,0 +1,149 @@ +// +// SOSDoctorTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/22. +// + +#import "SOSDoctorTableViewCell.h" + +@interface SOSDoctorTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) YYLabel * lookDetail; + +@property (nonatomic, strong) UILabel * statusLabel; + +@property (nonatomic, strong) UILabel * hospitalLabel; + + + +@end + + +@implementation SOSDoctorTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.textAlignment = NSTextAlignmentLeft; + self.nameLabel.text = @"求助人:张三"; + [self.contentView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(16); + make.height.mas_offset(14); + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.textColor = UIColorHex(#333333); + self.timeLabel.font = MEDIUMFONT(14); + self.timeLabel.text = @"求救时间:202-01-01 13:12"; + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(14); + make.height.mas_offset(14); + }]; + [self.timeLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.hospitalLabel = [[UILabel alloc] init]; + self.hospitalLabel.textColor = UIColorHex(#333333); + self.hospitalLabel.font = MEDIUMFONT(14); + self.hospitalLabel.textAlignment = NSTextAlignmentLeft; + self.hospitalLabel.text = @"应急医院:西京医院-协助检查"; + [self.contentView addSubview:self.hospitalLabel]; + + [self.hospitalLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(14); + make.height.mas_offset(13); + make.bottom.mas_offset(-18); + }]; + [self.hospitalLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + UIImageView * accowImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"garyRight"]]; + [self.contentView addSubview:accowImg]; + + + [accowImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(16); + make.height.mas_offset(14); + make.width.mas_offset(8); + }]; + + self.lookDetail = [[YYLabel alloc] init]; + self.lookDetail.textColor = UIColorHex(#999999); + self.lookDetail.font = MEDIUMFONT(13); + self.lookDetail.text = @"查看详情"; + self.lookDetail.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.lookDetail]; + + [self.lookDetail mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(accowImg.mas_left).offset(-6); + make.top.mas_offset(16); + make.height.mas_offset(14); + make.width.mas_offset(100); + }]; + + self.statusLabel = [[UILabel alloc] init]; + self.statusLabel.textColor = UIColorHex(#16C716); + self.statusLabel.font = MEDIUMFONT(14); + self.statusLabel.text = @"已完成"; + self.statusLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.statusLabel]; + + [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_equalTo(self.lookDetail.mas_bottom).offset(26); + make.height.mas_offset(13); + }]; + + +} + +- (void)setModel:(SOSDoctorRecordListModel *)model { + _model = model; + self.nameLabel.text = [NSString stringWithFormat:@"求助人:%@",_model.initiatorUserName]; + self.timeLabel.text = [NSString stringWithFormat:@"求救时间:%@",_model.createTime]; + if ( ValidStr(_model.sendOrderHospital) ) { + self.hospitalLabel.text = @"应急医院:"; + }else + { + self.hospitalLabel.text =[NSString stringWithFormat:@"应急医院:%@-%@",_model.sendOrderHospital,_model.stationBusiness_dictText]; + } + self.statusLabel.text = model.orderStatus_dictText; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SliderView.h b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SliderView.h new file mode 100644 index 0000000..0271235 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SliderView.h @@ -0,0 +1,21 @@ +// +// SliderView.h +// WDYAdjustFontSize +// +// Created by wdyzmx on 2022/1/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^SliderValueCallBack)(UISlider *); + +@interface SliderView : UIView +/// 初始化方法 +/// @param frame frame +/// @param callBack 回调block +- (instancetype)initWithFrame:(CGRect)frame callBack:(SliderValueCallBack)callBack; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/MainCenter/View/SliderView.m b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SliderView.m new file mode 100644 index 0000000..6ef71a6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/MainCenter/View/SliderView.m @@ -0,0 +1,157 @@ +// +// SliderView.m +// WDYAdjustFontSize +// +// Created by wdyzmx on 2022/1/19. +// + +#import "SliderView.h" + +#define kScreenWidth UIScreen.mainScreen.bounds.size.width +#define kScreenHeight UIScreen.mainScreen.bounds.size.height +#define SliderRate 1.0 +#define DefaultFontSize 16 +#define SliderHeight 10 +#define SliderBGWidth 300 +#define SliderWidth 330 + +@interface SliderView () +/// slider +@property (nonatomic, strong) UISlider *slider; +/// tap手势 +@property (nonatomic, strong) UITapGestureRecognizer *tapGesture; +/// slider控件value回调 +@property (nonatomic, copy) SliderValueCallBack callBack; +/// @{@"字体size": @"slider value"} 字体size对应slider value +@property (nonatomic, strong) NSDictionary *unitDict; +@property (nonatomic, strong) NSArray *unitArr; +@end + +@implementation SliderView + +#pragma mark - initWithFrame +- (instancetype)initWithFrame:(CGRect)frame callBack:(SliderValueCallBack)callBack { + self = [super initWithFrame:frame]; + if (self) { + self.callBack = callBack; + + UIImageView *sliderBgImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_detail_sliderBgImg"]]; + [self addSubview:sliderBgImgView]; + sliderBgImgView.frame = CGRectMake(frame.size.width / 2 - SliderBGWidth / 2, 5, SliderBGWidth, SliderHeight); + + self.slider = [[UISlider alloc] init]; + self.slider.minimumValue = 1; + self.slider.maximumValue = 4; + self.slider.minimumTrackTintColor = [UIColor clearColor]; + self.slider.maximumTrackTintColor = [UIColor clearColor]; + self.slider.multipleTouchEnabled = NO; + [self.slider setThumbImage:[UIImage imageNamed:@"icon_detail_slider_thum"] forState:UIControlStateNormal]; + [self addSubview:self.slider]; + self.slider.frame = CGRectMake(0, 0, SliderWidth, SliderHeight); + self.slider.center = sliderBgImgView.center; + [self.slider addTarget:self + action:@selector(valueChanged:) + forControlEvents:UIControlEventValueChanged]; + [self.slider addTarget:self + action:@selector(sliderTouchDown:) + forControlEvents:UIControlEventTouchDown]; + [self.slider addTarget:self + action:@selector(sliderTouchUp:) + forControlEvents:UIControlEventTouchUpInside]; + // 字体size值为该字典key slider value值为该字典value + self.unitDict = @{ + @"16": @"1", + @"18": @"2", + @"20": @"3", + @"22": @"4" + }; + + self.unitArr = @[ + @"16", + @"18", + @"20", + @"22" + ]; + + [self.slider setValue:[self sliderInitialValue]]; + + for (int i = 0; i < self.unitArr.count; i++) { + CGFloat ptx = (kScreenWidth - SliderBGWidth) / 2 + (SliderBGWidth / 3) * i; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 20)]; + label.center = CGPointMake(ptx, self.slider.center.y + 25); + label.font = [UIFont systemFontOfSize:14]; + label.textAlignment = NSTextAlignmentCenter; + label.text = self.unitArr[i]; +// label.backgroundColor = UIColor.redColor; + [self addSubview:label]; + } +// self.backgroundColor = UIColor.orangeColor; + self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; + [self addGestureRecognizer:self.tapGesture]; + } + return self; +} + +- (CGFloat)sliderInitialValue { + NSMutableDictionary *mdict = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:@"fontSizeDict"]]; + __block NSString *value = nil; + if (mdict) { + [mdict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) { + if ([obj isEqualToString:@"1"]) { + value = self.unitDict[key]; + } + }]; + } + return value ? value.floatValue : 1; +} + +#pragma mark - 滑动slider修改 +- (void)valueChanged:(UISlider *)sender { + // 只取整数值,固定间距 + NSString *tempStr = [self numberFormat:sender.value]; + if (tempStr.floatValue == sender.value) { + return; + } + [sender setValue:tempStr.integerValue]; + // 调用block + self.callBack(self.slider); +} + +#pragma mark - Slider Action +- (void)sliderTouchDown:(UISlider *)sender { + self.tapGesture.enabled = NO; +} + +- (void)sliderTouchUp:(UISlider *)sender { + self.tapGesture.enabled = YES; +} + +#pragma mark - 手势点击事件 +- (void)tapAction:(UITapGestureRecognizer *)tap { + CGPoint point = [tap locationInView:self]; + CGFloat margin = kScreenWidth / 2 - SliderBGWidth / 2; + CGFloat unitWidth = SliderWidth / 3; + CGFloat res = (point.x - margin) / unitWidth; + [self.slider setValue:[self numberFormat:res].floatValue + 1]; + // 调用block + self.callBack(self.slider); +// CGFloat rate = res - [self numberFormat:res].floatValue; +} + +#pragma mark - numberFormat +- (NSString *)numberFormat:(float)num { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + [formatter setPositiveFormat:@"0"]; + return [formatter stringFromNumber:[NSNumber numberWithFloat:num]]; +} + + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/HeartBadViewController.h b/XinjiangProject/XinjiangProject/Project/Monitoring/HeartBadViewController.h new file mode 100644 index 0000000..1d4d335 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/HeartBadViewController.h @@ -0,0 +1,16 @@ +// +// HeartBadViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HeartBadViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/HeartBadViewController.m b/XinjiangProject/XinjiangProject/Project/Monitoring/HeartBadViewController.m new file mode 100644 index 0000000..b4b2cdb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/HeartBadViewController.m @@ -0,0 +1,223 @@ +// +// HeartBadViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import "HeartBadViewController.h" +#import "HeardBadTableView.h" +#import "ADJumpViewController.h" +#import "SDGETHealthTokenManager.h" +#import "SDHttpRequest.h" +#import "MonitoringDataModel.h" + +@interface HeartBadViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollView; + + +@property (nonatomic, strong) HeardBadTableView * homeTable; + +@property (nonatomic, strong) UIView * warnView; + +@property (nonatomic, strong) UIImageView * noQustionImg; + +@end + +@implementation HeartBadViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = CViewBgColor; + [self createUI]; + [self createDetail]; + //请求问券 + [self createData]; +// [self showNowImage:YES]; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + [self createData]; + [self createDetail]; + [self hiddenAllMBProgressHUD]; +} + +- (void)createUI { + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight -kTabBarHeight)]; + self.mainScrollView.backgroundColor = CViewBgColor; + [self.view addSubview:self.mainScrollView]; + + + self.homeTable = [[HeardBadTableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(135) * 5 + kRealValue(195) + kRealValue(165)) style:UITableViewStyleGrouped]; + [self.mainScrollView addSubview:self.homeTable]; + + + UIView * warnView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.homeTable.bottom + kRealValue(15), kScreenWidth - kRealValue(30), kRealValue(325))]; + warnView.layer.cornerRadius = 10; + warnView.backgroundColor = KWhiteColor; + warnView.layer.masksToBounds = true; + self.warnView = warnView; + [self.mainScrollView addSubview:warnView]; + + UILabel * warnTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(17), kRealValue(24), warnView.width, 16)]; + warnTitleLabel.font = BOLDSYSTEMFONT(16); + warnTitleLabel.numberOfLines = 0; + warnTitleLabel.textColor = UIColorHex(#252535); + warnTitleLabel.textAlignment = NSTextAlignmentLeft; + warnTitleLabel.text = @"疾病预警"; + [warnView addSubview:warnTitleLabel]; + + self.noQustionImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(11), kRealValue(34), warnView.width - kRealValue(22), 176)]; + self.noQustionImg.image = [UIImage imageNamed:@"noQuestionImg"]; + [warnView addSubview:self.noQustionImg]; + + UILabel * infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,self.noQustionImg.bottom + 5, warnView.width, 16)]; + infoLabel.font = MEDIUMFONT(14); + infoLabel.textColor = UIColorHex(#77849E); + infoLabel.textAlignment = NSTextAlignmentCenter; + infoLabel.text = @"请先完成基本信息问卷"; + [warnView addSubview:infoLabel]; + + UIButton * inputBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.warnView.width/2 - kRealValue(60),infoLabel.bottom + kRealValue(21), kRealValue(120), kRealValue(36))]; + [inputBtn setTitle:@"填写" forState:UIControlStateNormal]; + [inputBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + inputBtn.titleLabel.font = MEDIUMFONT(14); + inputBtn.layer.cornerRadius = 17; + inputBtn.layer.masksToBounds = true; + [inputBtn addTarget:self action:@selector(inputQuestionClick) forControlEvents:UIControlEventTouchUpInside]; + inputBtn.backgroundColor = UIColorHex(#21BEBD); + [warnView addSubview:inputBtn]; + + + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth, warnView.bottom + kRealValue(64)); + + + UIView * bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight - kTopHeight - kRealValue(56) - kTabBarHeight, kScreenWidth, kRealValue(56))]; + bottomView.backgroundColor = KWhiteColor; + [self.view addSubview:bottomView]; + + UIButton * helpBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(45), kRealValue(6), kScreenWidth - kRealValue(90), kRealValue(44))]; + [helpBtn setTitle:@"一键帮助" forState:UIControlStateNormal]; + [helpBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + helpBtn.titleLabel.font = BOLDSYSTEMFONT(18); + helpBtn.layer.cornerRadius = 22.0; + helpBtn.layer.masksToBounds = true; + helpBtn.backgroundColor = UIColorHex(#F24439); + [bottomView addSubview:helpBtn]; + + //初始化一个emptyView + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"boxNoData" titleStr:@"正在开发中..." detailStr:@""]; + + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = [UIColor blackColor]; + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + //按钮背景色 + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; +// +} + + + +- (void)createData { + // type 1 防心梗。 2脑卒 + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@"2" forKey:@"type"]; + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"QUSTIONAPI" NeedToken:@""]; + [sosApi getMinitringFillQusetion:parmDic]; + +} + +- (void)createDetail { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:User_ID forKey:@"userId"]; + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"DETAILAPI" NeedToken:@""]; + [sosApi getMinitringWatchData:parmDic]; + +} + +#pragma mark:网络请求 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [EasyTextView showErrorText:message]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"QUSTIONAPI"]) + { + + BOOL isQuestion = [response boolValue]; + + //没有问卷 + if (isQuestion == false) { + + } + + + } + if ([tag isEqualToString:@"DETAILAPI"]) + { + + + + } + + +} + +- (void)inputQuestionClick { + + HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + + ADJumpViewController * webVC = [[ADJumpViewController alloc] init]; + + webVC.webUrl = [NSString stringWithFormat:@"%@/static/mobile/heart-attack?scheme=%@&host=%@&tokenF=%@&heartType=2",IntervenH5,SCHEME,H5DevHost,user.token]; + + [self.navigationController pushViewController:webVC animated:YES]; + + + +} +//- (void)showNowImage:(BOOL)isShow { +// // LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"boxNoData" titleStr:@"暂无数据" detailStr:@""]; +// +// UIImageView * noImageView = [[UIImageView alloc] initWithFrame: CGRectMake(0, self.view.centerY - kRealValue(150), kRealValue(200), kRealValue(200))]; +// noImageView.image = IMAGE_NAMED(@"boxNoData"); +// noImageView.hidden = !isShow; +// noImageView.centerX = self.view.centerX; +// [self.view addSubview:noImageView]; +// +// UILabel * resultLabe = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),noImageView.bottom + kRealValue(10), kScreenWidth, 20)]; +// resultLabe.font = MEDIUMFONT(15); +// resultLabe.textColor = UIColorHex(#333333); +// resultLabe.textAlignment = NSTextAlignmentCenter; +// resultLabe.text = @"功能待开发"; +// resultLabe.hidden = !isShow; +// [self.view addSubview:resultLabe]; +//} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/Model/MonitoringDataModel.h b/XinjiangProject/XinjiangProject/Project/Monitoring/Model/MonitoringDataModel.h new file mode 100644 index 0000000..cd37294 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/Model/MonitoringDataModel.h @@ -0,0 +1,25 @@ +// +// MonitoringDataModel.h +// XinjiangProject +// +// Created by Apple on 2025/6/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MonitoringDataModel : NSObject + +@property (nonatomic, copy) NSString * dataValue; +@property (nonatomic, copy) NSString * wdTypeName; +@property (nonatomic, copy) NSString * warnMin; +@property (nonatomic, copy) NSString * warnMax; +@property (nonatomic, copy) NSString * wdType; +@property (nonatomic, copy) NSString * dataDate; +@property (nonatomic, copy) NSString * imageName; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/Model/MonitoringDataModel.m b/XinjiangProject/XinjiangProject/Project/Monitoring/Model/MonitoringDataModel.m new file mode 100644 index 0000000..df664fa --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/Model/MonitoringDataModel.m @@ -0,0 +1,12 @@ +// +// MonitoringDataModel.m +// XinjiangProject +// +// Created by Apple on 2025/6/25. +// + +#import "MonitoringDataModel.h" + +@implementation MonitoringDataModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadHeardView.h b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadHeardView.h new file mode 100644 index 0000000..60af7cc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadHeardView.h @@ -0,0 +1,16 @@ +// +// HeardBadHeardView.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HeardBadHeardView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadHeardView.m b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadHeardView.m new file mode 100644 index 0000000..39f2388 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadHeardView.m @@ -0,0 +1,214 @@ +// +// HeardBadHeardView.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import "HeardBadHeardView.h" + +@interface HeardBadHeardView () + +@property (nonatomic, strong) UILabel * stepLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * numberLabel; + +@property (nonatomic, strong) UILabel * allNumberLabel; + +@property (nonatomic, strong) UILabel * sleepTimeLabel; + +@property (nonatomic, strong) UILabel * subTimeLabel; + +@property (nonatomic, strong) UILabel * avgTimeLabel; + +@end + +@implementation HeardBadHeardView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + self.backgroundColor = CViewBgColor; + [self createUI]; + } + return self; +} + +- (void)createUI { + + UIImageView * StepView = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(15), ( kScreenWidth - kRealValue(45))/2, kRealValue(165))]; + StepView.layer.cornerRadius = 15.0; + StepView.layer.masksToBounds = YES; + StepView.image = [UIImage imageNamed:@"stepNumerIcon"]; + StepView.userInteractionEnabled = true; + StepView.backgroundColor = KWhiteColor; + [self addSubview:StepView]; + + + UIImageView * stepImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(12), kRealValue(16), kRealValue(32), kRealValue(32))]; + stepImg.image = [UIImage imageNamed:@"stepNumberIcon"]; + [StepView addSubview:stepImg]; + + self.stepLabel = [[UILabel alloc] initWithFrame:CGRectMake(stepImg.right + kRealValue(12), kRealValue(14), StepView.width - kRealValue(46), 16)]; + self.stepLabel.text = @"步数"; + self.stepLabel.textColor = CFontColor1; + self.stepLabel.font = BOLDSYSTEMFONT(16); + self.stepLabel.textAlignment = NSTextAlignmentLeft; + [StepView addSubview:self.stepLabel]; + + self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(stepImg.right + kRealValue(12),self.stepLabel.bottom + kRealValue(9), StepView.width - kRealValue(46), 16)]; + self.timeLabel.text = @"--/--/--"; + self.timeLabel.textColor = UIColorHex(#77849E); + self.timeLabel.font = SYSTEMFONT(13); + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [StepView addSubview:self.timeLabel]; + + UIButton * stepIconBtn = [[UIButton alloc] initWithFrame:CGRectMake(StepView.width - kRealValue(9) - 20, kRealValue(16), 20, 20)]; + [stepIconBtn setImage:[UIImage imageNamed:@"garyRight"] forState:UIControlStateNormal]; + [StepView addSubview:stepIconBtn]; + + UIImageView * stepBackImg =[[UIImageView alloc] initWithFrame:CGRectMake(0, stepImg.bottom + kRealValue(4), StepView.width, kRealValue(114))]; + stepBackImg.image = [UIImage imageNamed:@"steoBackImage"]; + [StepView addSubview:stepBackImg]; + + + self.allNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), StepView.height - 12 - kRealValue(8), StepView.width - kRealValue(30), 12)]; + self.allNumberLabel.text = @"累计约步行--公里"; + self.allNumberLabel.textColor = UIColorHex(#77849E); + self.allNumberLabel.font = MEDIUMFONT(12); + self.allNumberLabel.textAlignment = NSTextAlignmentLeft; + [StepView addSubview:self.allNumberLabel]; + + self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), self.allNumberLabel.top - 28 - kRealValue(12), StepView.width - kRealValue(30), 28)]; + self.numberLabel.text = @"--步"; + self.numberLabel.textColor = UIColorHex(#77849E); + self.numberLabel.font = BOLDSYSTEMFONT(28); + self.numberLabel.textAlignment = NSTextAlignmentLeft; + [StepView addSubview:self.numberLabel]; + + + + + //睡眠 + UIView * sleepView = [[UIView alloc] initWithFrame:CGRectMake(StepView.right + kRealValue(15), kRealValue(15), ( kScreenWidth - kRealValue(45))/2, kRealValue(165))]; + sleepView.layer.cornerRadius = 15.0; + sleepView.layer.masksToBounds = YES; + sleepView.backgroundColor = KWhiteColor; + [self addSubview:sleepView]; + + UIImageView * sleepImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(12), kRealValue(16), kRealValue(32), kRealValue(32))]; + sleepImg.image = [UIImage imageNamed:@"sleepIcon"]; + [sleepView addSubview:sleepImg]; + + + UILabel * sleepLab = [[UILabel alloc] initWithFrame:CGRectMake(sleepImg.right + kRealValue(12), kRealValue(14), StepView.width - kRealValue(46), 16)]; + sleepLab.text = @"睡眠"; + sleepLab.textColor = CFontColor1; + sleepLab.font = BOLDSYSTEMFONT(16); + sleepLab.textAlignment = NSTextAlignmentLeft; + [sleepView addSubview:sleepLab]; + + self.sleepTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(sleepImg.right + kRealValue(12),sleepLab.bottom + kRealValue(9), sleepView.width - kRealValue(46), 16)]; + self.sleepTimeLabel.text = @"--/--/--"; + self.sleepTimeLabel.textColor = UIColorHex(#77849E); + self.sleepTimeLabel.font = SYSTEMFONT(13); + self.sleepTimeLabel.textAlignment = NSTextAlignmentLeft; + [sleepView addSubview:self.sleepTimeLabel]; + + UIButton * sleepIconBtn = [[UIButton alloc] initWithFrame:CGRectMake(sleepView.width - kRealValue(9) - 20, kRealValue(16), 20, 20)]; + [sleepIconBtn setImage:[UIImage imageNamed:@"garyRight"] forState:UIControlStateNormal]; + [sleepView addSubview:sleepIconBtn]; + + UIView * blueView = [[UIView alloc] initWithFrame:CGRectMake(sleepView.width - kRealValue(29) , self.sleepTimeLabel.bottom + kRealValue(11), kRealValue(17), kRealValue(34))]; + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.frame = blueView.bounds; + gradientLayer.colors = @[(__bridge id)RGBA(1, 142, 253, 0.5).CGColor, (__bridge id)UIColorHex(#FFFFFF).CGColor]; + gradientLayer.startPoint = CGPointMake(0, 0); + gradientLayer.endPoint = CGPointMake(0, 1); + gradientLayer.transform = CATransform3DMakeRotation(0, 0, 0, 1); + [blueView.layer addSublayer:gradientLayer]; + [sleepView addSubview:blueView]; + UIView * blueLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, blueView.width, 2)]; + blueLine.backgroundColor = UIColorHex(#018EFD); + [blueView addSubview:blueLine]; + + UIView * orangeView = [[UIView alloc] initWithFrame:CGRectMake(blueView.left - kRealValue(5) , self.sleepTimeLabel.bottom + kRealValue(11), kRealValue(4), kRealValue(34))]; + CAGradientLayer * orangegradientLayer = [CAGradientLayer layer]; + orangegradientLayer.frame = orangeView.bounds; + orangegradientLayer.colors = @[(__bridge id)RGBA(253, 193, 32, 0.5).CGColor, (__bridge id)UIColorHex(#FFFFFF).CGColor]; + orangegradientLayer.startPoint = CGPointMake(0, 0); + orangegradientLayer.endPoint = CGPointMake(0, 1); + orangegradientLayer.transform = CATransform3DMakeRotation(0, 0, 0, 1); + [orangeView.layer addSublayer:orangegradientLayer]; + [sleepView addSubview:orangeView]; + UIView * orangeLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, orangeView.width, 2)]; + orangeLine.backgroundColor = RGBA(253, 193, 32, 1); + [orangeView addSubview:orangeLine]; + + UIView * pickView = [[UIView alloc] initWithFrame:CGRectMake(orangeView.left - kRealValue(35) , self.sleepTimeLabel.bottom + kRealValue(11), kRealValue(34), kRealValue(34))]; + CAGradientLayer * pickViewgradientLayer = [CAGradientLayer layer]; + pickViewgradientLayer.frame = pickView.bounds; + pickViewgradientLayer.colors = @[(__bridge id)RGBA(252, 120, 117, 0.5).CGColor, (__bridge id)UIColorHex(#FFFFFF).CGColor]; + pickViewgradientLayer.startPoint = CGPointMake(0, 0); + pickViewgradientLayer.endPoint = CGPointMake(0, 1); + pickViewgradientLayer.transform = CATransform3DMakeRotation(0, 0, 0, 1); + [pickView.layer addSublayer:pickViewgradientLayer]; + [sleepView addSubview:pickView]; + UIView * pickLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, pickView.width, 2)]; + pickLine.backgroundColor = RGBA(252, 120, 117, 1); + [pickView addSubview:pickLine]; + + UIView * purpleView = [[UIView alloc] initWithFrame:CGRectMake(pickView.left - kRealValue(45) , self.sleepTimeLabel.bottom + kRealValue(11), kRealValue(44), kRealValue(34))]; + CAGradientLayer * pupleViewgradientLayer = [CAGradientLayer layer]; + pupleViewgradientLayer.frame = purpleView.bounds; + pupleViewgradientLayer.colors = @[(__bridge id)RGBA(203, 45, 218, 0.5).CGColor, (__bridge id)UIColorHex(#FFFFFF).CGColor]; + pupleViewgradientLayer.startPoint = CGPointMake(0, 0); + pupleViewgradientLayer.endPoint = CGPointMake(0, 1); + pupleViewgradientLayer.transform = CATransform3DMakeRotation(0, 0, 0, 1); + [purpleView.layer addSublayer:pupleViewgradientLayer]; + [sleepView addSubview:purpleView]; + UIView * purpleLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, purpleView.width, 2)]; + purpleLine.backgroundColor = RGBA(203, 45, 218, 1); + [purpleView addSubview:purpleLine]; + + UIView * blackPurple = [[UIView alloc] initWithFrame:CGRectMake(purpleView.left - kRealValue(39) , self.sleepTimeLabel.bottom + kRealValue(11), kRealValue(38), kRealValue(34))]; + CAGradientLayer * blackPurplegradientLayer = [CAGradientLayer layer]; + blackPurplegradientLayer.frame = blackPurple.bounds; + blackPurplegradientLayer.colors = @[(__bridge id)RGBA(155, 70, 225, 0.5).CGColor, (__bridge id)UIColorHex(#FFFFFF).CGColor]; + blackPurplegradientLayer.startPoint = CGPointMake(0, 0); + blackPurplegradientLayer.endPoint = CGPointMake(0, 1); + blackPurplegradientLayer.transform = CATransform3DMakeRotation(0, 0, 0, 1); + [blackPurple.layer addSublayer:blackPurplegradientLayer]; + [sleepView addSubview:blackPurple]; + UIView * blackPurpleLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, blackPurple.width, 2)]; + blackPurpleLine.backgroundColor = RGBA(155, 70, 225, 1); + [blackPurple addSubview:blackPurpleLine]; + + + self.avgTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), sleepView.height - 12 - kRealValue(8), StepView.width - kRealValue(30), 12)]; + self.avgTimeLabel.text = @"平均睡眠--小时"; + self.avgTimeLabel.textColor = UIColorHex(#77849E); + self.avgTimeLabel.font = MEDIUMFONT(12); + self.avgTimeLabel.textAlignment = NSTextAlignmentLeft; + [sleepView addSubview:self.avgTimeLabel]; + + self.subTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),self.avgTimeLabel.top - 28 - kRealValue(12), StepView.width - kRealValue(30), 28)]; + self.subTimeLabel.text = @"--小时--分"; + self.subTimeLabel.textColor = UIColorHex(#77849E); + self.subTimeLabel.font = BOLDSYSTEMFONT(28); + self.subTimeLabel.textAlignment = NSTextAlignmentLeft; + [sleepView addSubview:self.subTimeLabel]; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTabFooterView.h b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTabFooterView.h new file mode 100644 index 0000000..77e0afd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTabFooterView.h @@ -0,0 +1,16 @@ +// +// HeardBadTabFooterView.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HeardBadTabFooterView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTabFooterView.m b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTabFooterView.m new file mode 100644 index 0000000..ea92b01 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTabFooterView.m @@ -0,0 +1,88 @@ +// +// HeardBadTabFooterView.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import "HeardBadTabFooterView.h" + +@interface HeardBadTabFooterView () + +@property (nonatomic, strong) UIView * warnView ; + +@end + +@implementation HeardBadTabFooterView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + + UIView * watchView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(16), kScreenWidth - kRealValue(30), kRealValue(143))]; + watchView.layer.cornerRadius = 15; + watchView.backgroundColor = KWhiteColor; + watchView.layer.masksToBounds = true; + [self addSubview:watchView]; + CGFloat footWidth = (watchView.width - kRealValue(60))/3; + + for (int i = 0; i < 3; i ++) { + + UIView * footView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15) + (footWidth + kRealValue(15) )* i, kRealValue(11), footWidth, kRealValue(123))]; + footView.layer.cornerRadius = 15; + footView.backgroundColor = KWhiteColor; + footView.layer.masksToBounds = true; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(19), footWidth, 16)]; + titleLabel.font = BOLDSYSTEMFONT(16); + titleLabel.textAlignment = NSTextAlignmentCenter; + + UILabel * contLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, titleLabel.bottom + kRealValue(12), footWidth, footView.height - kRealValue(56))]; + contLabel.font = MEDIUMFONT(12); + contLabel.numberOfLines = 0; + contLabel.textColor = UIColorHex(#77849E); + contLabel.textAlignment = NSTextAlignmentCenter; + + if (i == 0) { + footView.backgroundColor = UIColorHex(#E3F2F9); + titleLabel.text = @"穿戴设备"; + titleLabel.textColor = UIColorHex(#0789C0); + contLabel.text = @"佩戴90天23小时\n充电284次"; + + } + if (i == 1) { + footView.backgroundColor = UIColorHex(#FFF3EB); + titleLabel.text = @"预警研究"; + titleLabel.textColor = UIColorHex(#E7AE84); + contLabel.text = @"心率失常权重 \n 心率失常权重 \n 心率失常权重"; + } + if (i == 2) { + footView.backgroundColor = UIColorHex(#FFEFF2); + titleLabel.text = @"心脏体检"; + titleLabel.textColor = UIColorHex(#D16685); + contLabel.text = @"心电图正常 \n 心脏CTA正常 \n 检验指标正常"; + } + [watchView addSubview:footView]; + [footView addSubview:titleLabel]; + [footView addSubview:contLabel]; + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableView.h b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableView.h new file mode 100644 index 0000000..17175c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableView.h @@ -0,0 +1,20 @@ +// +// HeardBadTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HeardBadTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, assign) BOOL isHaveQustion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableView.m b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableView.m new file mode 100644 index 0000000..d2fa011 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableView.m @@ -0,0 +1,136 @@ +// +// HeardBadTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import "HeardBadTableView.h" +#import "HeardBadHeardView.h" +#import "HeardBadTableViewCell.h" +#import "HeardBadTabFooterView.h" + +@interface HeardBadTableView () + +@property (nonatomic, strong) HeardBadHeardView * badHeardView; + +@property (nonatomic, strong) HeardBadTabFooterView * badfooterView; + + +@end + +@implementation HeardBadTableView + + +- (HeardBadHeardView *)badHeardView { + + if (!_badHeardView) { + + _badHeardView = [[HeardBadHeardView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(195))]; + } + return _badHeardView; +} + +- (HeardBadTabFooterView *)badfooterView { + + if (!_badfooterView) { + + _badfooterView = [[HeardBadTabFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(165))]; + } + return _badfooterView; + +} + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.backgroundColor = KClearColor; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.tableHeaderView = self.badHeardView; + self.tableFooterView = self.badfooterView; +} + +//- (void)setDataArray:(NSArray *)dataArray { +// +// _dataArray = dataArray; +// +// [self reloadData]; +// +//} +// + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 5; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + HeardBadTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"CELLID"]; + + if (!cell) { + + cell = [[HeardBadTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELLID"]; + } + cell.backgroundColor = CViewBgColor; + cell.selectionStyle = UITableViewCellSelectionStyleDefault; + return cell; +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return kRealValue(15); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + return kRealValue(120); +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + return [UIView new]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableViewCell.h new file mode 100644 index 0000000..3e94c09 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableViewCell.h @@ -0,0 +1,16 @@ +// +// HeardBadTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HeardBadTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableViewCell.m new file mode 100644 index 0000000..7b7b9e9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Monitoring/View/HeardBadTableViewCell.m @@ -0,0 +1,104 @@ +// +// HeardBadTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/14. +// + +#import "HeardBadTableViewCell.h" + +@interface HeardBadTableViewCell () + +@property (nonatomic, strong) UIImageView * projectImage; + +@property (nonatomic, strong) UILabel * projectName; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * dataLabel; + +@end + +@implementation HeardBadTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + UIView * backView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kRealValue(120))]; + backView.backgroundColor = KWhiteColor; + backView.layer.cornerRadius = 15.0; + backView.layer.masksToBounds = true; + [self addSubview:backView]; + + self.projectImage = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(12), kRealValue(22), kRealValue(32), kRealValue(32))]; + [backView addSubview:self.projectImage]; + + self.projectName = [[UILabel alloc] initWithFrame:CGRectMake(self.projectImage.right + kRealValue(12), kRealValue(20), backView.width - kRealValue(90), 15)]; + self.projectName.text = @"--"; + self.projectName.textColor = CFontColor1; + self.projectName.textAlignment = NSTextAlignmentLeft; + self.projectName.font = BOLDSYSTEMFONT(16); + [backView addSubview:self.projectName]; + + self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.projectImage.right + kRealValue(12),self.projectName.bottom + kRealValue(10), backView.width - kRealValue(90), 15)]; + self.timeLabel.text = @"--"; + self.timeLabel.textColor = CFontColor1; + self.timeLabel.textAlignment = NSTextAlignmentLeft; + self.timeLabel.font = BOLDSYSTEMFONT(16); + [backView addSubview:self.timeLabel]; + + UIButton * accowBtn = [[UIButton alloc] initWithFrame:CGRectMake(backView.width - kRealValue(12) - 20, kRealValue(23), 20, 20)]; + [accowBtn setImage:[UIImage imageNamed:@"garyRight"] forState:UIControlStateNormal]; + [backView addSubview:accowBtn]; + + self.dataLabel = [[UILabel alloc] initWithFrame:CGRectMake(accowBtn.left - kRealValue(12) - 200, kRealValue(26), 200, 22)]; + self.dataLabel.text = @"--"; + self.dataLabel.textColor = CFontColor1; + self.dataLabel.textAlignment = NSTextAlignmentRight; + self.dataLabel.font = BOLDSYSTEMFONT(16); + [backView addSubview:self.dataLabel]; + + UIView * lineView = [[UIView alloc] initWithFrame:CGRectMake(0, backView.bottom - kRealValue(44), backView.width, 1)]; + lineView.backgroundColor = UIColorHex(#EAECF1); + [backView addSubview:lineView]; + + UIButton * historyBtn = [[UIButton alloc] initWithFrame:CGRectMake(backView.width - kRealValue(82) ,backView.bottom - kRealValue(10) - kRealValue(24) , kRealValue(70), kRealValue(24))]; + [historyBtn setTitle:@"预警历史" forState:UIControlStateNormal]; + [historyBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + historyBtn.layer.cornerRadius = 4.0; + historyBtn.layer.masksToBounds = true; + historyBtn.titleLabel.font = BOLDSYSTEMFONT(13); + historyBtn.backgroundColor = UIColorHex(#21BEBD); + [backView addSubview:historyBtn]; + + + UIButton * thresholdBtn = [[UIButton alloc] initWithFrame:CGRectMake(historyBtn.left - kRealValue(82) ,backView.bottom - kRealValue(10) - kRealValue(24) , kRealValue(70), kRealValue(24))]; + [thresholdBtn setTitle:@"阈值设置" forState:UIControlStateNormal]; + [thresholdBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + thresholdBtn.layer.cornerRadius = 4.0; + thresholdBtn.layer.masksToBounds = true; + thresholdBtn.titleLabel.font = BOLDSYSTEMFONT(13); + thresholdBtn.backgroundColor = UIColorHex(#F1B101); + [backView addSubview:thresholdBtn]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/AddQuestionViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/AddQuestionViewController.h new file mode 100644 index 0000000..093bc0b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/AddQuestionViewController.h @@ -0,0 +1,19 @@ +// +// AddQuestionViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "HQBaseViewController.h" +#import "QuestionPeopleModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AddQuestionViewController : HQBaseViewController + +@property (nonatomic, strong) QuestionPeopleModel * questionModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/AddQuestionViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/AddQuestionViewController.m new file mode 100644 index 0000000..36ee271 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/AddQuestionViewController.m @@ -0,0 +1,598 @@ +// +// AddQuestionViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "AddQuestionViewController.h" +#import "LineTextField.h" +#import "BRPickerView.h" +#import "FamilyMemberRelationModel.h" +#import "UserInfoHealthPopView.h" +#import "BasicHealthInfoViewController.h" +#import "BasicHealthInfoViewController.h" + + +@interface AddQuestionViewController () + +@property (nonatomic, strong) LineTextField * questionNameField; + +@property (nonatomic, strong) UIButton * sexBtn; + +@property (nonatomic, strong) UILabel * birthdayLabel; + +@property (nonatomic, strong) LineTextField * birthdayTextField; + +@property (nonatomic, strong) UIButton * womanBtn ; + +@property (nonatomic, strong) UIButton * manBtn ; + +@property (nonatomic, strong) NSMutableArray * memberArray; + +@property (nonatomic, strong) LineTextField * heiTextField; + +@property (nonatomic, strong) LineTextField * weightTextField; + +@property (nonatomic, strong) LineTextField * relationshipTextField; + +@property (nonatomic, copy) NSString * familyInt; + +@property (nonatomic, strong) UserInfoHealthPopView * popView; + +@property (nonatomic, strong) LineTextField * baseHelathInfoField; + + +@property (nonatomic, copy) NSString * memberId; + +@property (nonatomic, assign) bool isJump; + +@end + +@implementation AddQuestionViewController + + +- (NSMutableArray *)memberArray { + + if (!_memberArray) { + + _memberArray = [[NSMutableArray alloc] init]; + } + return _memberArray; +} + +- (UserInfoHealthPopView *)popView { + + if (!_popView) { + + _popView = [[UserInfoHealthPopView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + _popView.popDelegate = self; + } + + return _popView; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.view.backgroundColor = UIColorHex(#EFEFEF); + self.navigationItem.title = @"添加咨询人信息"; + + [self createUI]; + [self getFamilyMembers]; +} + +- (void)createUI { + + //咨询人姓名 + self.questionNameField = [self createFieldWithLeftTitle:@"咨询人姓名" withRightString:@"" placeholderStr:@"请填写咨询人姓名" isShowRight:true]; + self.questionNameField.frame = CGRectMake(0, 1, kScreenWidth, 51); + [self.view addSubview:self.questionNameField]; + + //性别选择 + UIView * sexView = [[UIView alloc] initWithFrame:CGRectMake(0, self.questionNameField.bottom, kScreenWidth, 51)]; + sexView.backgroundColor = KWhiteColor; + [self.view addSubview:sexView]; + + UILabel * sexlabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), 0, 100, 51)]; + sexlabel.text = @"性别"; + sexlabel.font = SYSTEMFONT(13); + sexlabel.textAlignment = NSTextAlignmentLeft; + sexlabel.textColor = UIColorHex(#666666); + [sexView addSubview:sexlabel]; + + UIButton * womanBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(16) - 60, 0, 50, 51)]; + [womanBtn setImage:[UIImage imageNamed:@"choose_nomal"] forState:UIControlStateNormal]; + [womanBtn setImage:[UIImage imageNamed:@"choose_Selected"] forState:UIControlStateSelected]; + [womanBtn addTarget:self action:@selector(womanAction) forControlEvents:UIControlEventTouchUpInside]; + [womanBtn setTitle:@" 女" forState:UIControlStateNormal]; + womanBtn.titleLabel.font = SYSTEMFONT(13); + self.womanBtn = womanBtn; + [womanBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [sexView addSubview:womanBtn]; + + UIButton * manBtn = [[UIButton alloc] initWithFrame:CGRectMake(womanBtn.left - 60, 0, 50, 51)]; + [manBtn setImage:[UIImage imageNamed:@"choose_nomal"] forState:UIControlStateNormal]; + [manBtn setImage:[UIImage imageNamed:@"choose_Selected"] forState:UIControlStateSelected]; + [manBtn setTitle:@" 男" forState:UIControlStateNormal]; + [manBtn addTarget:self action:@selector(manAction) forControlEvents:UIControlEventTouchUpInside]; + manBtn.titleLabel.font = SYSTEMFONT(13); + [manBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + self.manBtn = manBtn; + [sexView addSubview:manBtn]; + + UIView * sexLineView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(14), sexView.bottom, kScreenWidth - kRealValue(28), 0.5)]; + sexLineView.backgroundColor = UIColorHex(#E0E0E0); + [self.view addSubview:sexLineView]; + + //出生日期 + + self.birthdayTextField = [self createFieldWithLeftTitle:@"出生日期" withRightString:@">" placeholderStr:@"请选择出生日期" isShowRight:true]; + + self.birthdayTextField.frame = CGRectMake(0, sexLineView.bottom, kScreenWidth, 51); + self.birthdayTextField.userInteractionEnabled = true; + [self.view addSubview:self.birthdayTextField]; + + UIButton * birBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 51)]; + [birBtn addTarget:self action:@selector(selectBirthdayOnclick) forControlEvents:UIControlEventTouchUpInside]; + [self.birthdayTextField addSubview:birBtn]; + + self.heiTextField = [self createFieldWithLeftTitle:@"身高" withRightString:@"cm" placeholderStr:@"请填写咨询人身高" isShowRight:true]; + self.heiTextField.keyboardType = UIKeyboardTypeNumberPad; + self.heiTextField.frame = CGRectMake(0, self.birthdayTextField.bottom, kScreenWidth, 51); + + [self.view addSubview:self.heiTextField]; + + + self.weightTextField = [self createFieldWithLeftTitle:@"体重" withRightString:@"kg" placeholderStr:@"请填写咨询人体重" isShowRight:true]; + self.weightTextField.keyboardType = UIKeyboardTypeDecimalPad; + self.weightTextField.frame = CGRectMake(0, self.heiTextField.bottom, kScreenWidth, 51); + + [self.view addSubview:self.weightTextField]; + + //与本人关系 + self.relationshipTextField = [self createFieldWithLeftTitle:@"与咨询人关系" withRightString:@">" placeholderStr:@"请点击选择" isShowRight:true]; + + self.relationshipTextField.frame = CGRectMake(0, self.weightTextField.bottom, kScreenWidth, 51); + self.relationshipTextField.userInteractionEnabled = true; + [self.view addSubview:self.relationshipTextField]; + + UIButton * shipBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 51)]; + [shipBtn addTarget:self action:@selector(relastionShipOnclick) forControlEvents:UIControlEventTouchUpInside]; + [self.relationshipTextField addSubview:shipBtn]; + + self.baseHelathInfoField = [self createFieldWithLeftTitle:@"基本健康信息" withRightString:@">" placeholderStr:@"" isShowRight:true]; + self.baseHelathInfoField.frame = CGRectMake(0, self.relationshipTextField.bottom + 5, kScreenWidth, 51); + self.baseHelathInfoField.userInteractionEnabled = true; + UIButton * baseBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 51)]; + [baseBtn addTarget:self action:@selector(healthInfoAction) forControlEvents:UIControlEventTouchUpInside]; + [self.baseHelathInfoField addSubview:baseBtn]; + [self.view addSubview:self.baseHelathInfoField]; + + + UILabel * tishiLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), self.relationshipTextField.bottom + kRealValue(10) , kScreenWidth - kRealValue(30), 30)]; + + + tishiLabel.text = @"温馨提示:咨询人姓名、证件信息用于平台审核,不会外传。请输入正确的咨询人姓名和证件号码。"; + tishiLabel.numberOfLines = 0; + tishiLabel.font = SYSTEMFONT(12); + tishiLabel.textColor = UIColorHex(#999999); + CGFloat h = [HQCommonUtils getSpaceLabelHeight:tishiLabel withStr:tishiLabel.text withFont: SYSTEMFONT(12) withWidth:kScreenWidth withLineSpacing:2]; + tishiLabel.height = h ; + [self.view addSubview:tishiLabel]; + //保存按钮 + + UIButton * saveBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(48), kScreenHeight - kTopHeight - kTabBarHeight - 30 - 40, kScreenWidth - kRealValue(96), 40)]; + [saveBtn setTitle:@"保存" forState:UIControlStateNormal]; + saveBtn.titleLabel.font = SYSTEMFONT(14); + saveBtn.layer.cornerRadius = 20.0f; + saveBtn.layer.masksToBounds = true; + saveBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + saveBtn.layer.borderWidth = 1.0f; + saveBtn.backgroundColor = KWhiteColor; + [saveBtn addTarget:self action:@selector(saveInfo) forControlEvents:UIControlEventTouchUpInside]; + [saveBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.view addSubview:saveBtn]; + + if (self.questionModel) { + self.baseHelathInfoField.hidden = false; + baseBtn.hidden = false; + tishiLabel.top = self.baseHelathInfoField.bottom + kRealValue(10); + self.questionNameField.text = self.questionModel.name; + self.relationshipTextField.text = self.questionModel.familyRelation; + self.weightTextField.text = [NSString stringWithFormat:@"%@",self.questionModel.weight]; + self.heiTextField.text = [NSString stringWithFormat:@"%@",self.questionModel.height]; + if ( [self.questionModel.gender integerValue] == 1 ) { + self.womanBtn.selected = true; + self.manBtn.selected = false; + }else + { + self.womanBtn.selected = false; + self.manBtn.selected = true; + } + self.birthdayTextField.text = [NSString stringWithFormat:@"%@",self.questionModel.birthday]; + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + //需要设置为和字符串相同的格式 + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSDate *localDate = [dateFormatter dateFromString:self.questionModel.birthday]; + NSString * str = [NSDate br_stringFromDate:localDate dateFormat:@"yyyy-MM-dd"]; + self.birthdayTextField.text = str; + + }else { + self.baseHelathInfoField.hidden = true; + baseBtn.hidden = true; + tishiLabel.top = self.relationshipTextField.bottom + kRealValue(10); + } +// [kAppWindow addSubview:self.popView]; + +} + + +- (LineTextField *)createFieldWithLeftTitle:(NSString *)leftStr + withRightString:(NSString *)rightStr + placeholderStr:(NSString *)placeStr + isShowRight:(BOOL)isShowRight { + + LineTextField * field = [[LineTextField alloc] init]; + field.font = SYSTEMFONT(13); + field.placeholder = placeStr; + field.textAlignment = NSTextAlignmentRight; + field.backgroundColor = KWhiteColor; + UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 51)]; + + UILabel * leftlabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), 0, 100, 51)]; + + leftlabel.text = leftStr; + + leftlabel.font = SYSTEMFONT(13); + + leftlabel.textAlignment = NSTextAlignmentLeft; + + leftlabel.textColor = UIColorHex(#666666); + + [leftView addSubview:leftlabel]; + + field.leftView = leftView; + + field.leftViewMode = UITextFieldViewModeAlways; + + if (isShowRight) { + + UIView * rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 51)]; + + UILabel * rightlabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 30, 51)]; + + rightlabel.text = rightStr; + + rightlabel.font = SYSTEMFONT(13); + + rightlabel.textColor = UIColorHex(#666666); + + field.rightView = rightView; + + rightlabel.textAlignment = NSTextAlignmentLeft; + + field.rightViewMode = UITextFieldViewModeAlways; + + [rightView addSubview:rightlabel]; + + } + + return field; +} + +- (void)getFamilyMembers { + + JKCQAPI * memberApi = [[JKCQAPI alloc] init:self tag:@"Family" NeedToken:@""]; + + [memberApi getCheckKeyResult:@{@"dictKey":@"family_member_relation"}]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [EasyTextView showErrorText:message]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"Family"]) { + + NSArray * array = response; + + for (NSDictionary * dic in array) { + + FamilyMemberRelationModel * model = [FamilyMemberRelationModel modelWithDictionary:dic] ; + + [self.memberArray addObject:model]; + } + } + if ([tag isEqualToString:@"ADDAPI"]) { + + self.memberId = response; + [self hiddenAllMBProgressHUD]; + if (self.isJump == true) { + [self.navigationController popViewControllerAnimated:YES]; + } + if (self.isJump == false) { + BasicHealthInfoViewController * basicVC = [[BasicHealthInfoViewController alloc] init]; + basicVC.memberId = self.memberId; + if (self.questionModel) { + basicVC.isAddQuetsion = false; + }else + { + basicVC.isAddQuetsion = true; + } + [self.navigationController pushViewController:basicVC animated:YES]; + } + + } + if ([tag isEqualToString:@"updataAPI"]) { + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:@"保存成功"]; + [self.navigationController popViewControllerAnimated:YES]; + } +} + +- (void)selectBirthdayOnclick { + [self.view endEditing:TRUE]; + + // 1.创建日期选择器 + BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; + // 2.设置属性 + datePickerView.pickerMode = BRDatePickerModeYMD; + datePickerView.title = @"选择出生日期"; + // datePickerView.selectValue = @"2019-10-30"; + datePickerView.minDate = [NSDate br_setYear:1949 month:3 day:12]; + datePickerView.maxDate = [NSDate date]; + datePickerView.isAutoSelect = YES; + datePickerView.showUnitType = BRShowUnitTypeOnlyCenter; + datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) { + NSLog(@"选择的值:%@", selectValue); + self.birthdayTextField.text = selectValue; + }; + + datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithThemeColor:UIColorHex(#21BEBD)]; + // 3.显示 + [datePickerView show]; +} + +- (void)relastionShipOnclick { + + /// 1.单列字符串选择器(传字符串数组) + BRStringPickerView *stringPickerView = [[BRStringPickerView alloc]init]; + stringPickerView.pickerMode = BRStringPickerComponentSingle; + stringPickerView.title = @"关系"; + + NSMutableArray * array = [[NSMutableArray alloc] init]; + for (FamilyMemberRelationModel * model in self.memberArray) { + + [array addObject:model.text]; + } + stringPickerView.dataSourceArr = array; + stringPickerView.selectIndex = 2; + stringPickerView.resultModelBlock = ^(BRResultModel *resultModel) { + NSLog(@"选择的值:%@", resultModel.value); + + + for (FamilyMemberRelationModel * model in self.memberArray) { + + if ([model.text isEqualToString:resultModel.value]) { + + self.familyInt = model.value; + } + + } + self.relationshipTextField.text = resultModel.value; + }; + + [stringPickerView show]; + +} + +- (void)womanAction { + + [self.view endEditing:TRUE]; + self.womanBtn.selected = true; + self.manBtn.selected = false; + +} + +- (void)manAction { + [self.view endEditing:TRUE]; + self.womanBtn.selected = false; + self.manBtn.selected = true; + +} + +- (void)saveInfo { + + [self.view endEditing:TRUE]; + + NSInteger sexInter; + + sexInter = self.womanBtn.selected == true ?1:2; + + if (ValidStr(self.questionNameField.text)) { + [EasyTextView showErrorText:@"请输入咨询人姓名"]; + return; + } + if (self.womanBtn.selected == false && self.manBtn.selected == false ) { + [EasyTextView showErrorText:@"请选择咨询人性别"]; + return; + } + if (ValidStr(self.birthdayTextField.text)) { + [EasyTextView showErrorText:@"请选择咨询人出生日期"]; + return; + } + if (ValidStr(self.heiTextField.text)) { + [EasyTextView showErrorText:@"请输入咨询人身高"]; + return; + } + if (ValidStr(self.weightTextField.text)) { + [EasyTextView showErrorText:@"请输入咨询人体重"]; + return; + } + if (ValidStr(self.relationshipTextField.text)) { + [EasyTextView showErrorText:@"请选择与咨询人关系"]; + return; + } + + if (self.questionModel) { + [self updateQuestionInfo]; + }else + { + + [kAppWindow addSubview:self.popView]; + } + + + + +} + +- (NSString *)getTimestampFromTime:(NSString *)CurrentTime{ + + + + + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + + [formatter setDateStyle:NSDateFormatterMediumStyle]; + + [formatter setTimeStyle:NSDateFormatterShortStyle]; + + [formatter setDateFormat:@"yyyy-MM-dd"]; //(@"YYYY-MM-dd hh:mm:ss") ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制 + + //设置时区选择北京时间 + + NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"]; + + [formatter setTimeZone:timeZone]; + + NSDate* date = [formatter dateFromString:CurrentTime]; //------------将字符串按formatter转成nsdate + + //时间转时间戳的方法: + + NSInteger timeSp = [[NSNumber numberWithDouble:[date timeIntervalSince1970]] integerValue] * 1000; + + + return [NSString stringWithFormat:@"%ld",(long)timeSp]; + + + +} + +- (void)jumpOnclick { + + self.isJump = true; + [self.popView removeFromSuperview]; + [self addQuestionInfo]; + + +} + + +- (void)updateQuestionInfo { + + NSInteger sexInter; + + sexInter = self.womanBtn.selected == true ?1:2; + [self showMBProgressHUDWithString:@"更新中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + NSString * time = [self getTimestampFromTime:self.birthdayTextField.text]; + [parmDic setObject:self.questionNameField.text forKey:@"name"]; + [parmDic setObject:@(sexInter) forKey:@"gender"]; + [parmDic setObject:time forKey:@"birthdayLong"]; + [parmDic setObject:self.heiTextField.text forKey:@"height"]; + [parmDic setObject:self.weightTextField.text forKey:@"weight"]; + if (ValidStr(self.familyInt)) { + self.familyInt = self.questionModel.familyRelation; + } + [parmDic setObject:self.familyInt forKey:@"familyRelation"]; + [parmDic setObject:self.questionModel.people_id forKey:@"id"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"updataAPI" NeedToken:@""]; + + [api postUpdateQuestionFailyMembers:parmDic]; + +} + + +- (void)wanshanOnclick { + self.isJump = false; + [self.popView removeFromSuperview]; + [self addQuestionInfo]; + +} + + +- (void)addQuestionInfo { + + [self.view endEditing:TRUE]; + + NSInteger sexInter; + + sexInter = self.womanBtn.selected == true ?1:2; + + if (ValidStr(self.questionNameField.text)) { + [EasyTextView showErrorText:@"请输入咨询人姓名"]; + return; + } + if (self.womanBtn.selected == false && self.manBtn.selected == false ) { + [EasyTextView showErrorText:@"请选择咨询人性别"]; + return; + } + if (ValidStr(self.birthdayTextField.text)) { + [EasyTextView showErrorText:@"请选择咨询人出生日期"]; + return; + } + if (ValidStr(self.heiTextField.text)) { + [EasyTextView showErrorText:@"请输入咨询人身高"]; + return; + } + if (ValidStr(self.weightTextField.text)) { + [EasyTextView showErrorText:@"请输入咨询人体重"]; + return; + } + if (ValidStr(self.relationshipTextField.text)) { + [EasyTextView showErrorText:@"请选择与咨询人关系"]; + return; + } + [self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + NSString * time = [self getTimestampFromTime:self.birthdayTextField.text]; + [parmDic setObject:self.questionNameField.text forKey:@"name"]; + [parmDic setObject:@(sexInter) forKey:@"gender"]; + [parmDic setObject:time forKey:@"birthdayLong"]; + [parmDic setObject:self.heiTextField.text forKey:@"height"]; + [parmDic setObject:self.weightTextField.text forKey:@"weight"]; + [parmDic setObject:self.familyInt forKey:@"familyRelation"]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"ADDAPI" NeedToken:@""]; + + [api getAddQuestionFailyMembers:parmDic]; + +} +- (void)healthInfoAction { + + BasicHealthInfoViewController * basicVC = [[BasicHealthInfoViewController alloc] init]; + basicVC.memberId = self.questionModel.people_id; + [self.navigationController pushViewController:basicVC animated:YES]; + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/BasicHealthInfoViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/BasicHealthInfoViewController.h new file mode 100644 index 0000000..ed8a59e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/BasicHealthInfoViewController.h @@ -0,0 +1,19 @@ +// +// BasicHealthInfoViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/21. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface BasicHealthInfoViewController : HQBaseViewController + +@property (nonatomic, strong) NSString * memberId; + +@property (nonatomic, assign) bool isAddQuetsion; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/BasicHealthInfoViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/BasicHealthInfoViewController.m new file mode 100644 index 0000000..a8f5865 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/BasicHealthInfoViewController.m @@ -0,0 +1,290 @@ +// +// BasicHealthInfoViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/21. +// + +#import "BasicHealthInfoViewController.h" +#import "BasicHealthTable.h" +#import "QuestionOptionModel.h" +#import "QuestionPeopleMangerVC.h" +@interface BasicHealthInfoViewController () + +@property (nonatomic, strong) BasicHealthTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation BasicHealthInfoViewController + + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; + +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"基本健康信息"; + [self createUI]; + [self createData]; + [self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backQuestionVC) tags:@[@"1"]]; + +} + +- (void)backQuestionVC { + + if (self.isAddQuetsion == true) { + + for (UIViewController *controller in self.navigationController.viewControllers) + { + if ([controller isKindOfClass:[QuestionPeopleMangerVC class]]) { + QuestionPeopleMangerVC * phyVC =(QuestionPeopleMangerVC *)controller; + [self.navigationController popToViewController:phyVC animated:false]; + } + } + }else + { + [self.navigationController popViewControllerAnimated:YES]; + } + +} + +- (void)createUI { + + self.homeTable = [[BasicHealthTable alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight) style:UITableViewStyleGrouped]; + self.homeTable.saveBlock = ^(NSArray * _Nonnull array) { + DLog(@"%@",array); + NSString * baseHealthId; + NSString * itemType; + NSString * itemOptions = @""; + NSMutableArray * customArray = [[NSMutableArray alloc] init]; + for (QuestionOptionModel * model in array) { + + for (QuestionOptionChildListModel * listModel in model.childList) { + baseHealthId = listModel.option_id; + itemType = listModel.itemType; + NSMutableDictionary * pamrDic = [[NSMutableDictionary alloc] init]; + for (QuestionOptionCustomModel * customModel in listModel.answerList) { + + [pamrDic setObject:customModel.value forKey:customModel.radioText]; +// itemOptions = [NSString stringWithFormat:@"%@,%@",currentString,itemOptions]; + itemOptions = [self convertToJSONData:pamrDic]; + + } + listModel.itemOptions = itemOptions; + itemOptions = @""; + } + + + + + [customArray addObject:model]; + } + DLog(@"%@",customArray); + [self saveBaseHealthInfo:customArray]; + + }; + [self.view addSubview:self.homeTable]; +} + +- (void)createData { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.memberId forKey:@"memberId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"MEMBERAPI" NeedToken:@""]; + + [detailApi getQustionOptionsMembers :parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + if ([tag isEqualToString:@"MEMBERAPI"]) { + + NSArray * array = response; + + for (NSDictionary * dic in array) { + + QuestionOptionModel * model = [QuestionOptionModel modelWithDictionary:dic]; + + NSMutableArray * customAnswerArray = [[NSMutableArray alloc] init]; + + for (QuestionOptionChildListModel * optionModel in model.childList) { + + NSData *jsonData = [optionModel.itemOptions dataUsingEncoding:NSUTF8StringEncoding]; + + NSDictionary * dictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil]; + + NSMutableArray * dicArray = [[NSMutableArray alloc] init]; + + + [dictionary enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) { + + NSDictionary * dic = @{@"radioText":key,@"itemType":optionModel.itemType,@"checked":@(false),@"value":[NSString stringWithFormat:@"%@",obj]}; + + NSString *mainString = optionModel.itemOptions; + NSString *subString = key; + + NSRange range = [mainString rangeOfString:subString]; + + if (range.location != NSNotFound) { + NSLog(@"Substring '%@' found at location %lu, length %lu", subString, (unsigned long)range.location, (unsigned long)range.length); + } else { + NSLog(@"Substring '%@' not found", subString); + } + + QuestionOptionCustomModel * model = [[QuestionOptionCustomModel alloc] init]; + model.radioText = key; + model.itemType = optionModel.itemType; + model.checked = false; + model.loctaionThin = range.location; + if ([optionModel.itemType intValue] == 4) { //带输入框 + + + }else + { + if ([obj boolValue] == true) { + optionModel.answerContent = key; + } + } + + model.value =[NSString stringWithFormat:@"%@",obj] ; + + + + [dicArray addObject:model]; + + optionModel.answerList = dicArray; + + }]; + + + } + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } + if ([tag isEqualToString:@"UPHEALTH"]) { + + [EasyTextView showSuccessText:response]; + [self backQuestionVC]; + } +} + +- (void)saveBaseHealthInfo:(NSArray *)array { + + + NSMutableArray * jsonArray = [[NSMutableArray alloc] init]; + + NSString * baseHealthId; + NSString * itemType; + NSString * itemOptions = @""; + NSMutableArray * customArray = [[NSMutableArray alloc] init]; + + for (QuestionOptionModel * model in array) { + + for (QuestionOptionChildListModel * listModel in model.childList) { + baseHealthId = listModel.option_id; + itemType = listModel.itemType; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:baseHealthId forKey:@"id"]; + [dic setObject:listModel.itemOptions forKey:@"itemOptions"]; + [dic setObject:listModel.itemType forKey:@"itemType"]; + [dic setObject:self.memberId forKey:@"memberId"]; + if (![listModel.itemOptions containsString:@"1"]) { + [EasyTextView showErrorText:[NSString stringWithFormat:@"请选择%@",listModel.itemProblem]]; + return; + } + if ([listModel.itemType intValue] == 4) { + NSString *itemOptionsJSONString = listModel.itemOptions; + + NSData *jsonData = [itemOptionsJSONString dataUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *itemOptions = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil]; + if ([itemOptions[@"无"] isEqualToString:@"1"]) { + listModel.answerContent = @""; + } + + } + [dic setObject:listModel.answerContent forKey:@"answerContent"]; + + [jsonArray addObject:dic]; + } + + + + + [customArray addObject:model]; + } + + + + [self showMBProgressHUDWithString:@"正在保存" autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:jsonArray forKey:@"list"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"UPHEALTH" NeedToken:@""]; + + [detailApi postBaseHealthInfoAPI :parmDic]; + +} + +- (NSString*)convertToJSONData:(id)infoDict +{ + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:infoDict + options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string + error:&error]; + + NSString *jsonString = @""; + + if (! jsonData) + { + }else + { + jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + } + + jsonString = [jsonString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符 + + [jsonString stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + + return jsonString; +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/DoctorMainViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/DoctorMainViewController.h new file mode 100644 index 0000000..79d414e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/DoctorMainViewController.h @@ -0,0 +1,21 @@ +// +// DoctorMainViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import "HQBaseViewController.h" +#import "QuestionDiseaseInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorMainViewController : HQBaseViewController + +@property (nonatomic, strong) QuestionDiseaseInfoModel * disModel; +@property (nonatomic, strong) NSString * yuyue_id; +@property (nonatomic, assign) NSInteger popType; // 1返回上一页 其他跳转向相应 + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/DoctorMainViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/DoctorMainViewController.m new file mode 100644 index 0000000..1ff6f50 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/DoctorMainViewController.m @@ -0,0 +1,733 @@ +// +// DoctorMainViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import "DoctorMainViewController.h" +#import "DoctorStatusView.h" +#import "DoctorInfoTopView.h" +#import "AppointmentInfoView.h" +#import "evaluationPopView.h" +#import "SelectedDoctorTimeVC.h" +#import "DoctorReportModel.h" +#import "LookModficalFileViewController.h" +#import "QuesstionDetailLookFileViewController.h" +#import "QuestionBodyReportModel.h" +#import "ExpertMainViewController.h" +#import "evaluationPopView.h" +#import "FSXBStarRateView.h" +#import "SelectedQuestionViewController.h" + +@interface DoctorMainViewController () + +@property (nonatomic, strong) DoctorReportDoctorInfoModel * doctorModel; +@property (nonatomic, strong) DoctorReportConSessionModel * sessionModel; +@property (nonatomic, strong) DoctorReportRecordsModel * danganModel; +@property (nonatomic, strong) DoctorInfoTopView * doctorInfoView; +@property (nonatomic, strong) AppointmentInfoView * AppointView; +@property (nonatomic, strong) UIScrollView * mainScrollview; +@property (nonatomic, copy) NSString * yueyue_id; +@property (nonatomic, strong) UIButton * bottomBtn; +@property (nonatomic, strong) UIButton * pingjiaBtn; +@property (nonatomic, strong) UIView * evaluateView; +@property (nonatomic, strong) NSMutableArray * topViewArray; +@property (nonatomic, strong) UILabel * evaluateLabel; +@property (nonatomic, strong) UILabel * evaluateNameLabel; +@property (nonatomic, strong) FSXBStarRateView * starRateView; + +@property (nonatomic, strong) evaluationPopView * popView; + + + +@end + +@implementation DoctorMainViewController + +- (NSMutableArray *)topViewArray { + + if (!_topViewArray) { + + _topViewArray = [[NSMutableArray alloc] init]; + } + return _topViewArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = UIColorHex(#EFEFEF); + + // 注册键盘通知 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(keyboardWillShow:) + name:UIKeyboardWillShowNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(keyboardWillHide:) + name:UIKeyboardWillHideNotification + object:nil]; + // 启用侧滑返回手势 + self.navigationController.interactivePopGestureRecognizer.delegate = self; + self.navigationController.interactivePopGestureRecognizer.enabled = YES; + + // 创建自定义手势识别器 + UIScreenEdgePanGestureRecognizer *panGesture = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)]; + panGesture.edges = UIRectEdgeLeft; + [self.view addGestureRecognizer:panGesture]; + self.isHidenNaviBar = YES; + [self createTopAndNav]; + [self createStatusView]; + [self createData]; +} + +- (void)createTopAndNav { + + UIView * navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(222))]; + navView.backgroundColor = UIColorHex(#21BEBD); + [self.view addSubview:navView]; + UIButton * backBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15), kStatusBarHeight + kRealValue(15), 30, 30)]; + [backBtn setImage:[UIImage imageNamed:@"whiteBack_icon"] forState:UIControlStateNormal]; + [backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; + [navView addSubview:backBtn]; +} + +- (void)backAction { + +// if (self.popType == 1) { +// [self.navigationController popViewControllerAnimated:YES]; +// }else +// { +//// int i = 0; +//// int allCount = self.navigationController.viewControllers.count; +//// for (UIViewController *controller in self.navigationController.viewControllers) +//// { +//// if ([controller isKindOfClass:[ExpertMainViewController class]]) { +//// ExpertMainViewController * expervc =(ExpertMainViewController *)controller; +//// [self.navigationController popToViewController:expervc animated:YES]; +//// } +//// if ([controller isKindOfClass:[OneKeyQuestionDetailVC class]]) { +//// OneKeyQuestionDetailVC * phyVC =(OneKeyQuestionDetailVC *)controller; +//// [self.navigationController popToViewController:phyVC animated:false]; +//// } +//// i++; +//// if (i == allCount && ![controller isKindOfClass:[ExpertMainViewController class]] && ![controller isKindOfClass:[OneKeyQuestionDetailVC class]] ) { +//// [self.navigationController popViewControllerAnimated:YES]; +//// } +//// +//// } +// // 获取导航堆栈视图控制器数组 +// NSArray *viewControllers = self.navigationController.viewControllers; +// +// // 确保堆栈中有足够的视图控制器 +// if (viewControllers.count >= 3) { +// // 返回到上上级视图控制器 +// UIViewController *targetViewController = viewControllers[viewControllers.count - 3]; +// [self.navigationController popToViewController:targetViewController animated:YES]; +// } else { +// // 处理视图控制器不足的情况,比如弹出提示或者直接 popToRootViewController +// [self.navigationController popViewControllerAnimated:YES]; +// } +// } + // 获取当前导航控制器的视图控制器堆栈 + NSArray *viewControllers = self.navigationController.viewControllers; + + // 查找导航堆栈中的目标视图控制器 + UIViewController *targetViewController = nil; + for (UIViewController *vc in viewControllers) { + if ([vc isKindOfClass:[SelectedQuestionViewController class]]) { + targetViewController = vc; + break; + } + } + + if (targetViewController) { + // 如果找到目标视图控制器,则弹出到该视图控制器 + [self.navigationController popToViewController:targetViewController animated:YES]; + } else { + // 如果没有找到目标视图控制器,则返回到上一页 + [self.navigationController popViewControllerAnimated:YES]; + } +} + +- (void)createStatusView { + NSArray * array = @[@" 待确认 ",@" 待开始 ",@"在线咨询",@" 待评价 ",@" 完成 "]; + CGFloat statusW = (kScreenWidth - kRealValue(68))/5; + for (int i = 0; i < 5 ; i ++) { + + DoctorStatusView * statusView = [[DoctorStatusView alloc] initWithFrame:CGRectMake(kRealValue(34) + (statusW + 5) * i , kTopHeight + kRealValue(5), statusW, kRealValue(50))]; + if (i == 0) { + statusView.isSelected = true; + }else + { + statusView.isSelected = false; + + } + statusView.lastType = 4; + + statusView.statusString = array[i]; + [self.topViewArray addObject:statusView]; + [self.view addSubview:statusView]; + } + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(33), kTopHeight + kRealValue(11) + kRealValue(70) , kScreenWidth - kRealValue(66), 13)]; + titleLabel.text = @"预约成功后,请就诊当日打开APP等待医生呼叫"; + titleLabel.textColor = KWhiteColor; + titleLabel.font = MEDIUMFONT(12); + titleLabel.textAlignment = NSTextAlignmentLeft; + [self.view addSubview:titleLabel]; + + UIButton * bottomBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(31.5), kScreenHeight - 50 , self.view.width - kRealValue(66), 40)]; + [bottomBtn setTitle:@"取消预约" forState:UIControlStateNormal]; + [bottomBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + bottomBtn.titleLabel.font = SYSTEMFONT(14); + bottomBtn.layer.cornerRadius = 20; + bottomBtn.layer.masksToBounds = true; + bottomBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + [bottomBtn addTarget:self action:@selector(cancelAppointClick) forControlEvents:UIControlEventTouchUpInside]; + bottomBtn.layer.borderWidth = 1.0f; + self.bottomBtn = bottomBtn; + [self.view addSubview:bottomBtn]; + + self.pingjiaBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(31.5), kScreenHeight - 50 , self.view.width - kRealValue(66), 40)]; + [self.pingjiaBtn setTitle:@"去评价" forState:UIControlStateNormal]; + [self.pingjiaBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.pingjiaBtn.titleLabel.font = SYSTEMFONT(14); + self.pingjiaBtn.layer.cornerRadius = 20; + self.pingjiaBtn.layer.masksToBounds = true; + [self.pingjiaBtn addTarget:self action:@selector(qupingjiaAction) forControlEvents:UIControlEventTouchUpInside]; + self.pingjiaBtn.hidden = true; + self.pingjiaBtn.backgroundColor = UIColorHex(#21BEBD); + [self.view addSubview:self.pingjiaBtn]; + MJWeakSelf + UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), titleLabel.bottom + kRealValue(27), kScreenWidth - kRealValue(30),kScreenHeight - titleLabel.bottom - 50 - 40)]; + mainScrollView.showsVerticalScrollIndicator = false; + mainScrollView.showsHorizontalScrollIndicator = false; + mainScrollView.backgroundColor = KClearColor; + self.mainScrollview = mainScrollView; + [self.view addSubview:mainScrollView]; + + DoctorInfoTopView * infoView = [[DoctorInfoTopView alloc] initWithFrame:CGRectMake(0, 0, mainScrollView.width, 210)]; + infoView.backgroundColor = KWhiteColor; + self.doctorInfoView = infoView; + infoView.height = infoView.doctorinfoHeight; + infoView.layer.cornerRadius = 5.0; + infoView.layer.masksToBounds = true; + infoView.collectBlock = ^(DoctorReportDoctorInfoModel * _Nonnull doctorModel) { + [weakSelf collectDoctor:doctorModel]; + }; + [mainScrollView addSubview:infoView]; + + + AppointmentInfoView * AppointView = [[AppointmentInfoView alloc] initWithFrame:CGRectMake(0, infoView.bottom + kRealValue(10), mainScrollView.width, 400)]; + AppointView.backgroundColor = KWhiteColor; + self.AppointView = AppointView; + + AppointView.lookBlock = ^{ + [weakSelf lookFileDeatil]; + }; + + [HQCommonUtils addShadowToView:AppointView]; + AppointView.height = AppointView.infoH; + [mainScrollView addSubview:AppointView]; + + self.evaluateView = [[UIView alloc] initWithFrame:CGRectMake(0, AppointView.bottom + kRealValue(10), mainScrollView.width, 50)]; + self.evaluateView.backgroundColor = KWhiteColor; + self.evaluateView.layer.cornerRadius = 10; + self.evaluateView.layer.masksToBounds = true; + self.evaluateView.hidden = true; + [mainScrollView addSubview:self.evaluateView]; + + self.evaluateNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(15), 100, 15)]; + self.evaluateNameLabel.textColor = CFontColor1; + self.evaluateNameLabel.textAlignment = NSTextAlignmentLeft; + self.evaluateNameLabel.font = BOLDSYSTEMFONT(14); + self.evaluateNameLabel.text = @"--"; + + [self.evaluateView addSubview:self.evaluateNameLabel]; + + self.starRateView = [[FSXBStarRateView alloc] initWithFrame:CGRectMake(self.evaluateNameLabel.right, kRealValue(13), 100, 15) numberOfStars:5 rateStyle:HalfStar isAnination:YES finish:^(CGFloat currentScore) { + }]; + self.starRateView.enable = false; + self.starRateView.currentScore = 3; + [self.evaluateView addSubview:self.starRateView]; + + self.evaluateLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),self.evaluateNameLabel.bottom + kRealValue(15), self.evaluateView.width - kRealValue(30), 15)]; + self.evaluateLabel.textColor = CFontColor2; + self.evaluateLabel.textAlignment = NSTextAlignmentLeft; + self.evaluateLabel.font = SYSTEMFONT(12); + self.evaluateLabel.text = @"--"; + [self.evaluateView addSubview:self.evaluateLabel]; + + + + mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), kScreenHeight - titleLabel.bottom - 50 - 40); + + + +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.yuyue_id forKey:@"id"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"ReportApi" NeedToken:@""]; + + [detailApi getAppointmentReportDetailAPI:parmDic]; +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"ReportApi"]) { + + [self hiddenAllMBProgressHUD]; + NSDictionary * resDic = response; + DoctorReportModel * model = [DoctorReportModel modelWithDictionary:resDic]; + + self.sessionModel = [DoctorReportConSessionModel modelWithDictionary:model.conSession] ; + self.doctorModel = [DoctorReportDoctorInfoModel modelWithDictionary:model.conDoctorDO] ; + self.danganModel = [DoctorReportRecordsModel modelWithDictionary:model.conMedicalRecordsListDO]; +// 预约状态 1待确认 2待开始 3已开始 4待评价 5已完成 6 拒绝 7取消 8 超时 + [self topStatus:[self.sessionModel.contentStatus intValue]]; + self.doctorInfoView.model = model; + +// self.AppointView.recordModel = [DoctorReportRecordsModel modelWithDictionary:model.conMedicalRecordsListDO] ; +// self.AppointView.familyModel = [DoctorReportFamilyInfoModel modelWithDictionary:model.conFamilyMembersDO]; +// self.AppointView.answerModel = model; + self.AppointView.model = model; + if ([self.sessionModel.contentStatus intValue] == 7) { + self.AppointView.isQuxiao = true; + self.bottomBtn.hidden = true; + } + if ([self.sessionModel.contentStatus intValue] == 6) { + self.AppointView.isQuxiao = false; + self.bottomBtn.hidden = true; + } + if ([self.sessionModel.contentStatus intValue] == 4) { + + self.pingjiaBtn.hidden = false; + } + if ([self.sessionModel.contentStatus intValue] == 5) { + + self.pingjiaBtn.hidden = true; + self.bottomBtn.hidden = true; + self.evaluateView.hidden = false; + DoctorConEvaluateDOModel * evModel = [DoctorConEvaluateDOModel modelWithDictionary:model.conEvaluateDO] ; + self.evaluateLabel.text = evModel.context; + self.evaluateNameLabel.text = evModel.userName; + self.starRateView.currentScore = [evModel.score floatValue]; + + self.evaluateNameLabel.width = [HQCommonUtils getLengthFromText:self.evaluateNameLabel.text andFontSize:16]; + self.starRateView.left = self.evaluateNameLabel.right + kRealValue(10); + self.evaluateLabel.height = [HQCommonUtils getSpaceLabelHeight:self.evaluateLabel withStr:self.evaluateLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth:self.evaluateLabel.width withLineSpacing:5]; + self.evaluateView.height = self.evaluateLabel.bottom + kRealValue(10); + + } + if ([self.sessionModel.contentStatus intValue] == 1 || [self.sessionModel.contentStatus intValue] == 2 || [self.sessionModel.contentStatus intValue] == 3) + { + self.AppointView.isQuxiao = false; + } + //布局 + self.doctorInfoView.height = self.doctorInfoView.doctorinfoHeight; + self.AppointView.top = self.doctorInfoView.bottom + 10; + self.AppointView.height = self.AppointView.infoH; + self.evaluateView.top = self.AppointView.bottom + 10; + self.AppointView.height = self.AppointView.infoH; + self.evaluateView.top = self.AppointView.bottom + 10; + self.mainScrollview.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.evaluateView.bottom); +// //是否体检报告 +// if ([self.danganModel.tfPermission integerValue] == 1) { //有体检报告 +// +// [self getBodyInfoReport:model.idNo]; +// +// }else +// { +// +// } + } + + if ([tag isEqualToString:@"CARDSEARCH"]) { + + [self hiddenAllMBProgressHUD]; +// NSDictionary * dic = response; +// +// if ([dic.allKeys containsObject:@"records"]) { +// int i = 0; +// NSArray * array = [dic objectForKey:@"records"]; +// for (NSDictionary * parm in array) { +// +// PhyscialReportListModel * model = [PhyscialReportListModel modelWithDictionary:parm]; +// +// if (i == 0) { +// self.AppointView.bodyModel =model; +// } +// i++; +// } +// if (array.count <= 0) { +// self.AppointView.bodyModel = nil; +// } +// self.AppointView.height = self.AppointView.infoH; +// self.evaluateView.top = self.AppointView.bottom + 10; +// self.mainScrollview.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.evaluateView.bottom); +// +// } +// + } + + if ([tag isEqualToString:@"CANCELQUESTION"]) { + [self hiddenAllMBProgressHUD]; + [self createData]; + } + if ([tag isEqualToString:@"CollAPI"]) { + [self hiddenAllMBProgressHUD]; + + [EasyTextView showSuccessText:response]; + [self createData]; + } + if ([tag isEqualToString:@"cancelAPI"]) { + [self hiddenAllMBProgressHUD]; + + [EasyTextView showSuccessText:response]; + [self createData]; + + } + if ([tag isEqualToString:@"DoctorSource"]) { + [self hiddenAllMBProgressHUD]; + [self.popView removeFromSuperview]; + [self createData]; + } +} + +- (void)collectDoctor:(DoctorReportDoctorInfoModel *)doctorModel { + + + if([doctorModel.tfFollow integerValue] == 1) { //已经关注 点击取消 + + + [self showMBProgressHUDWithString:@"正在取消关注" autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:doctorModel.doctor_id forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"cancelAPI" NeedToken:@""]; + + [detailApi getCancelCollectDoctorExpertData:parmDic]; + + } +else + { + [self showMBProgressHUDWithString:@"正在关注" autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:doctorModel.doctor_id forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"CollAPI" NeedToken:@""]; + + [detailApi getCollectDoctorExpertData:parmDic]; + + } + + +} + +//请求体检信息 +- (void)getBodyInfoReport:(NSString *)byID { + +// NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; +// +// [parmDic setObject:User_ID forKey:@"userId"]; +// +// JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"CARDSEARCH" NeedToken:nil]; +// +// [api GetPhyscialIDCardSearch:parmDic]; + +} + +- (void)topStatus:(int)status { + //预约状态 1待确认 2待开始 3已开始 4待评价 5已完成 + // 6 拒绝 7取消 8 超时 + + if(status == 1 || status == 6 ) { + + int i = 0; + for (DoctorStatusView * topView in self.topViewArray) { + if ( i == 0) { + topView.isSelected = true; + }else + { + topView.isSelected = false; + } + topView.lastType = i ; + i ++; + } + } + if(status == 2) { + + int i = 0; + for (DoctorStatusView * topView in self.topViewArray) { + if ( i == 1) { + + topView.isSelected = true; + }else + { + topView.isSelected = false; + } + topView.lastType = i ; + + i ++; + } + } + if(status == 3) { + + int i = 0; + for (DoctorStatusView * topView in self.topViewArray) { + if ( i == 2) { + + topView.isSelected = true; + }else + { + topView.isSelected = false; + } + i ++; + } + } + if(status == 4) { + + int i = 0; + for (DoctorStatusView * topView in self.topViewArray) { + if ( i == 3) { + + topView.isSelected = true; + }else + { + topView.isSelected = false; + } + topView.lastType = i ; + + i ++; + } + } + + if(status == 5) { + + int i = 0; + for (DoctorStatusView * topView in self.topViewArray) { + if ( i == 4) { + + topView.isSelected = true; + }else + { + topView.isSelected = false; + } + topView.lastType = i ; + + i ++; + } + } + // 6 拒绝 7取消 8 超时 + if(status == 7) + { + int i = 0; + for (DoctorStatusView * topView in self.topViewArray) { + if ( i == 1) { + topView.statusString = @"取消预约"; + topView.isSelected = true; + }else + { + topView.isSelected = false; + } + topView.lastType = i ; + + i ++; + } + } + + if(status == 8 ) + { + DoctorStatusView * topView = self.topViewArray.lastObject; + topView.isSelected = true; + } + DoctorStatusView * lastView = self.topViewArray.lastObject; + lastView.lastType = 4; + +} + +#pragma mark:查看档案详情 + +- (void)lookFileDeatil { + +#pragma mark - 网络请求 + + +// NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; +// +// [parmDic setObject:self.danganModel.dangan_id forKey:@"id"]; +// +// JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"FILEDATA" NeedToken:@""]; +// +// [upApi GetLookModficalMemberShipFileData:parmDic]; +// + QuesstionDetailLookFileViewController * detailvc = [[QuesstionDetailLookFileViewController alloc] init]; + detailvc.danganID = self.danganModel.dangan_id; + [self.navigationController pushViewController:detailvc animated:YES]; +} + +#pragma mark:查看体检报告 + +- (void)lookReportDeatil { + +// PhysicalReportViewController * phyVC = [[PhysicalReportViewController alloc] init]; +// [self.navigationController pushViewController:phyVC animated:YES]; +// PhyReportDetailViewController * yearVC = [[PhyReportDetailViewController alloc] init]; +// yearVC.navTitle = model.medicalYear; +// yearVC.yearString = model.report_id; +// [self.navigationController pushViewController:yearVC animated:YES]; + +} + +#pragma mark:取消预约 + +- (void)cancelAppointClick { + +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conSession/cancelSession?id=1716737797670907906 HTTP/1.1 + +// evaluationPopView * popView = [[evaluationPopView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; +// popView.popBlock = ^(CGFloat starNumber, BOOL isSecrect, NSString * _Nonnull evaluationString) { +// [EasyTextView showInfoText:@"点击了提交"]; +// }; +// [[UIApplication sharedApplication].keyWindow addSubview:popView]; + +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDoctorSchedulingDate/selectSchedulingDateListByDoctorId?doctorId=1539253293e421ab0115425351860001 HTTP/1.1 +// QuesstionDetailLookFileViewController * lookVC = [[QuesstionDetailLookFileViewController alloc] init]; +// +// lookVC.danganID = self.danganModel.dangan_id; +// +// [self.navigationController pushViewController:lookVC animated:YES]; + [self showMBProgressHUDWithString:@"正在取消..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.sessionModel.yuyue_id forKey:@"id"]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"CANCELQUESTION" NeedToken:nil]; + + [api getCancelQuestion:parmDic]; + +} + +- (void)qupingjiaAction { + + evaluationPopView * popView = [[evaluationPopView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + self.popView = popView; + popView.popBlock = ^(CGFloat starNumber, BOOL isSecrect, NSString * _Nonnull evaluationString) { + NSString * niming = isSecrect == YES? @"1":@"0"; + [self doctorSourceWithStarNumaber:starNumber withContext:evaluationString isKnow:niming]; + }; + [[UIApplication sharedApplication].keyWindow addSubview:popView]; + +} + +- (void)doctorSourceWithStarNumaber:(CGFloat)starNumer withContext:(NSString *)connet isKnow:(NSString *)isNiming{ + + [self showMBProgressHUDWithString:@"评价中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(starNumer) forKey:@"score"]; + [parmDic setObject:connet forKey:@"context"]; + [parmDic setObject:self.sessionModel.yuyue_id forKey:@"sessionId"]; + [parmDic setObject:isNiming forKey:@"tfUnknow"]; + + JKCQAPI * endApi = [[JKCQAPI alloc] init:self tag:@"DoctorSource" NeedToken:@""]; + [endApi PostQustionDoctorScore:parmDic]; + +} + + +- (void)keyboardWillShow:(NSNotification *)notification { + // 获取键盘的大小和动画持续时间 + NSDictionary *userInfo = [notification userInfo]; + CGRect keyboardFrame = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; + double duration = [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + + // 根据键盘的大小调整视图的位置 + [UIView animateWithDuration:duration animations:^{ + // 您可以在这里调整视图的位置,例如: + self.popView.frame = CGRectMake(0, self.view.bounds.size.height - keyboardFrame.size.height - self.popView.bounds.size.height, self.popView.bounds.size.width, self.popView.bounds.size.height); + }]; +} + +- (void)keyboardWillHide:(NSNotification *)notification { + // 获取动画持续时间 + NSDictionary *userInfo = [notification userInfo]; + double duration = [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + + // 恢复视图的位置 + [UIView animateWithDuration:duration animations:^{ + // 恢复视图到原来的位置,例如: + self.popView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight); // originalFrame 是视图原来的位置 + }]; +} + + + +- (void)dealloc { + // 移除通知 + [[NSNotificationCenter defaultCenter] removeObserver:self + name:UIKeyboardWillShowNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:UIKeyboardWillHideNotification + object:nil]; +} +// 手势处理方法 +- (void)handlePanGesture:(UIScreenEdgePanGestureRecognizer *)gesture { + if (gesture.state == UIGestureRecognizerStateEnded) { + NSArray *viewControllers = self.navigationController.viewControllers; + UIViewController *targetViewController = nil; + + // 查找导航堆栈中的目标视图控制器 + for (UIViewController *vc in viewControllers) { + if ([vc isKindOfClass:[SelectedQuestionViewController class]]) { + targetViewController = vc; + break; + } + } + if (targetViewController) { + // 如果找到目标视图控制器,则弹出到该视图控制器 + [self.navigationController popToViewController:targetViewController animated:YES]; + } else { + // 如果没有找到目标视图控制器,则返回到上一页 + [self.navigationController popViewControllerAnimated:YES]; + } + } +} + +// UIGestureRecognizerDelegate 方法 +- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { + // 确保只有在不是根视图控制器时才启用手势 + return self.navigationController.viewControllers.count > 1; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/EvaluationListViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/EvaluationListViewController.h new file mode 100644 index 0000000..98b07ca --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/EvaluationListViewController.h @@ -0,0 +1,20 @@ +// +// EvaluationListViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EvaluationListViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * hospitalID; +@property (nonatomic, assign) NSInteger type; +@property (nonatomic, copy) NSString * doctorId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/EvaluationListViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/EvaluationListViewController.m new file mode 100644 index 0000000..c9cf91c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/EvaluationListViewController.m @@ -0,0 +1,264 @@ +// +// EvaluationListViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import "EvaluationListViewController.h" +#import "EvaluationListTableView.h" +#import "FSXBStarRateView.h" +#import "EvaluatListModel.h" + + +@interface EvaluationListViewController () + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, strong) EvaluationListTableView * homeTable; +@property (nonatomic, strong) UILabel * numberLabel; +@property (nonatomic, strong) UILabel * scourLabel; +@property (nonatomic, strong) UILabel * fenLabel; + +@property (nonatomic, strong) FSXBStarRateView * starView; +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation EvaluationListViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = UIColorHex(#EEEEEE); + self.navigationItem.title = @"用户评价"; + self.pageNo = 1; + [self createUI]; + + if (self.type == 2) { + [self getDoctorSoucre]; + [self createDoctorData]; + }else{ + [self createData]; + [self createHospitalData]; + } +} +- (void)createUI { + + UIView * evaluationView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(13), kScreenWidth - kRealValue(30), kScreenHeight - kRealValue(41) - kTopHeight)]; + evaluationView.backgroundColor = KWhiteColor; + evaluationView.layer.cornerRadius = 10; + evaluationView.layer.masksToBounds = true; + [self.view addSubview:evaluationView]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(17), kRealValue(22), 75, 18)]; + titleLabel.text = @"患者评价"; + titleLabel.textAlignment = NSTextAlignmentLeft; + titleLabel.font = BOLDSYSTEMFONT(16); + titleLabel.textColor = UIColorHex(#333333); + [evaluationView addSubview:titleLabel]; + + self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(titleLabel.right + kRealValue(7), kRealValue(26), 180, 13)]; + self.numberLabel .text = @""; + self.numberLabel .textAlignment = NSTextAlignmentLeft; + self.numberLabel .font = BOLDSYSTEMFONT(11); + self.numberLabel .textColor = UIColorHex(#666666); + [evaluationView addSubview:self.numberLabel ]; + + self.scourLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(17), titleLabel.bottom + kRealValue(22), 65, 34)]; + self.scourLabel.text = @""; + self.scourLabel.textAlignment = NSTextAlignmentLeft; + self.scourLabel.font = SYSTEMFONT(34); + self.scourLabel.textColor = UIColorHex(#21BEBD); + [evaluationView addSubview:self.scourLabel]; + + UILabel * fenLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.scourLabel.right, titleLabel.bottom + kRealValue(25), 15, 30)]; + fenLabel.text = @"分"; + fenLabel.textAlignment = NSTextAlignmentLeft; + self.fenLabel = fenLabel; + fenLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightHeavy]; + fenLabel.textColor = UIColorHex(#21BEBD); + [evaluationView addSubview:fenLabel]; + + + + + self.starView = [[FSXBStarRateView alloc] initWithFrame:CGRectMake(self.scourLabel.right + kRealValue(3), self.numberLabel.bottom + kRealValue(27), kRealValue(120), 20) numberOfStars:5 rateStyle:HalfStar isAnination:YES finish:^(CGFloat currentScore) { + + }]; + self.starView.currentScore = 0; + [evaluationView addSubview:self.starView]; + + self.homeTable = [[EvaluationListTableView alloc] initWithFrame:CGRectMake(0, self.scourLabel.bottom + kRealValue(25) , evaluationView.width, evaluationView.height - self.scourLabel.bottom - kRealValue(25)) style:UITableViewStyleGrouped]; + self.homeTable.type = self.type; + [evaluationView addSubview:self.homeTable]; + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + if (self.type == 2) { + [weakSelf createDoctorData]; + }else + { + [weakSelf createData]; + } + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + + if (self.type == 2) { + + [weakSelf createDoctorData]; + + }else + { + [weakSelf createData]; + } + }]; +} +- (void)createDoctorData { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@"10" forKey:@"pageSize"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"DoctorAPI" NeedToken:@""]; + + [detailApi getExpertDoctorEvluateData:parmDic]; +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"hospitalId"]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@"10" forKey:@"pageSize"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"EVALUATAPI" NeedToken:@""]; + + [detailApi getHospatilEvaluate:parmDic]; +} + +- (void)createHospitalData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"hospitalId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"SCOREAPI" NeedToken:@""]; + + [detailApi getHospatilScore:parmDic]; + +} + +- (void)getDoctorSoucre { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"SCOREAPI" NeedToken:@""]; + + [detailApi getDoctorScore:parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_header endRefreshing]; + [self.homeTable.mj_footer endRefreshing]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + [self.homeTable.mj_header endRefreshing]; + [self.homeTable.mj_footer endRefreshing]; + + if ([tag isEqualToString:@"EVALUATAPI"]) { + + NSArray * array = response; + + if (self.pageNo == 1) { + + [self.dataArray removeAllObjects]; + } + for (NSDictionary * dic in array) { + + EvaluatListModel * evModel = [EvaluatListModel modelWithDictionary:dic]; + + [self.dataArray addObject:evModel]; + + } + self.homeTable.dataArray = self.dataArray; + + } + + if ([tag isEqualToString:@"DoctorAPI"]) { + + NSArray * array = response; + + if (self.pageNo == 1) { + + [self.dataArray removeAllObjects]; + } + for (NSDictionary * dic in array) { + + EvaluatListModel * evModel = [EvaluatListModel modelWithDictionary:dic]; + + [self.dataArray addObject:evModel]; + + } + self.homeTable.dataArray = self.dataArray; + + + } + + if ([tag isEqualToString:@"SCOREAPI"]) { + + NSDictionary * dic = response; + + + + + NSString * score = [NSString stringWithFormat:@"%.1f",[[dic objectForKey:@"score"] floatValue]]; + NSString * userScoreNum = [NSString stringWithFormat:@"%@",[dic objectForKey:@"userScoreNum"]]; + self.numberLabel.text = [NSString stringWithFormat:@"(%@员工评价)",userScoreNum]; + self.scourLabel.text = score; + self.scourLabel.width = [HQCommonUtils getLengthFromText:score andFontSize:34]; + self.fenLabel.left = self.scourLabel.right; + self.starView.left = self.fenLabel.right + kRealValue(3); + self.starView.currentScore = [score floatValue]; + + } + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/ExpertMainViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/ExpertMainViewController.h new file mode 100644 index 0000000..2d4a22b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/ExpertMainViewController.h @@ -0,0 +1,18 @@ +// +// ExpertMainViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ExpertMainViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * doctorId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/ExpertMainViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/ExpertMainViewController.m new file mode 100644 index 0000000..0c90e23 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/ExpertMainViewController.m @@ -0,0 +1,711 @@ +// +// ExpertMainViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import "ExpertMainViewController.h" +#import "ZHTagListView.h" +#import "HospitalMainTableView.h" +#import "EvaluationListViewController.h" +#import "DoctorDetailModel.h" +#import "EvaluatListModel.h" +#import "DoctorEvaluationTable.h" +#import "SelectedDoctorTimeVC.h" +#import "FileDataDetailViewController.h" +#import "SelectFIleDateDetailViewController.h" +#import "SelectedQuestionViewController.h" +#import "QuestionMustKnowViewController.h" + +@interface ExpertMainViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) UIView * topView; +@property (nonatomic, strong) UIImageView * doctorImageView; +@property (nonatomic, strong) UIImageView * starImg; + +@property (nonatomic, strong) UILabel * doctorName; +@property (nonatomic, strong) UILabel * jobName; +@property (nonatomic, strong) UILabel * hospitalName; +@property (nonatomic, strong) UILabel * evaluationLabel; +@property (nonatomic, strong) UIButton * collectBtn; +@property (nonatomic, strong) ZHTagListView *tagList; + +@property (nonatomic, strong) UIView * pictureView; +@property (nonatomic, strong) UIView * videoView; +@property (nonatomic, strong) UIView * doctorView; +@property (nonatomic, strong) UIView * hotView; +@property (nonatomic, strong) UIView * quesstionView; +@property (nonatomic, strong) UIView * linView; +@property (nonatomic, strong) UIView * currentHot; + + +@property (nonatomic, strong) UILabel * doctorIndorLabel; +@property (nonatomic, strong) UILabel * doctorGoodLabel; +@property (nonatomic, strong) UILabel * doctorTitle; +@property (nonatomic, strong) NSDictionary * AudioknowDic; +@property (nonatomic, strong) NSDictionary * PictureknowDic; + +@property (nonatomic, strong) UILabel * gradientView; + +@property (nonatomic, assign) NSInteger questionType; + +@property (nonatomic, strong) DoctorEvaluationTable * homeTable; + +@property (nonatomic, strong) UIButton * videoBtn; +@property (nonatomic, strong) UIButton * pictureBtn; + + +@end + +@implementation ExpertMainViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"专家主页"; + self.view.backgroundColor = UIColorHex(#EEEEEE); + [self createUI]; + [self createData]; + [self getMustknowWithType:@"1"]; + [self getMustknowWithType:@"2"]; + +} + +- (void)createUI { + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0.5, kScreenWidth, kScreenHeight - kTopHeight)]; + [self.view addSubview:self.mainScrollView]; + + self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(170))]; + self.topView.backgroundColor = UIColorHex(#21BEBD); + [self.mainScrollView addSubview:self.topView]; + + self.doctorImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(17), kRealValue(10), 60, 60)]; + self.doctorImageView.image = PLACEHOLD_IMG; + self.doctorImageView.layer.cornerRadius = 30.0; + self.doctorImageView.layer.masksToBounds = YES; + [self.topView addSubview:self.doctorImageView]; + + //暂停服务标识 + UIView *gradientView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(16), self.doctorImageView.bottom - 13 , 60, 19)]; + gradientView.layer.cornerRadius = 5; + gradientView.layer.masksToBounds = YES; + self.gradientView = gradientView; + [self.topView addSubview:gradientView]; + + // 创建CAGradientLayer来实现渐变效果 + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.frame = gradientView.bounds; + + // 设置渐变的颜色 + gradientLayer.colors = @[ + (__bridge id)[UIColor colorWithRed:0x66/255.0 green:0x66/255.0 blue:0x66/255.0 alpha:1.0].CGColor, + (__bridge id)[UIColor colorWithRed:0xC3/255.0 green:0xC3/255.0 blue:0xC3/255.0 alpha:1.0].CGColor + ]; + + // 设置渐变的方向(从左到右) + gradientLayer.startPoint = CGPointMake(0, 0.5); + gradientLayer.endPoint = CGPointMake(1, 0.5); + + [gradientView.layer addSublayer:gradientLayer]; + + // 创建一个UILabel来显示“暂停服务” + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, gradientView.width, gradientView.height)]; + label.text = @"暂停服务"; + label.font = SYSTEMFONT(12); + label.textColor = [UIColor whiteColor]; + label.backgroundColor = KClearColor; + + // 将UILabel居中 + label.textAlignment = NSTextAlignmentCenter; + [gradientView addSubview:label]; + + self.doctorName = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorImageView.right + kRealValue(20), kRealValue(19), 70, 20)]; + self.doctorName.textColor = KWhiteColor; + self.doctorName.font = [UIFont systemFontOfSize:21 weight:UIFontWeightHeavy]; + self.doctorName.textAlignment = NSTextAlignmentLeft; + self.doctorName.text = @""; + [self.topView addSubview:self.doctorName]; + + self.jobName = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorName.right + kRealValue(12), kRealValue(25), 90, 13)]; + self.jobName.textColor = KWhiteColor; + self.jobName.font = BOLDSYSTEMFONT(13); + self.jobName.textAlignment = NSTextAlignmentLeft; + self.jobName.text = @""; + [self.topView addSubview:self.jobName]; + + self.hospitalName = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorImageView.right + kRealValue(20),self.doctorName.bottom + kRealValue(12) , kScreenWidth - kRealValue(159), 30)]; + self.hospitalName.textColor = KWhiteColor; + self.hospitalName.font = BOLDSYSTEMFONT(13); + self.hospitalName.textAlignment = NSTextAlignmentLeft; + self.hospitalName.text = @""; + self.hospitalName.numberOfLines = 2; + [self.topView addSubview:self.hospitalName]; + + self.collectBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(15) - 60, kRealValue(33), 60, 26)]; + self.collectBtn.backgroundColor = KWhiteColor; + [self.collectBtn setTitle:@" 关注" forState:UIControlStateNormal]; + [self.collectBtn setTitle:@"已关注" forState:UIControlStateSelected]; + self.collectBtn.titleLabel.font = SYSTEMFONT(12); + [self.collectBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.collectBtn addTarget:self action:@selector(collectHosptal:) forControlEvents:UIControlEventTouchUpInside]; + self.collectBtn.layer.cornerRadius = 13.0; + self.collectBtn.layer.masksToBounds = true; + [self.topView addSubview:self.collectBtn]; + + NSMutableArray *_dataSource = @[ + ].mutableCopy; + + ZHTagListConfiguration *config = [ZHTagListConfiguration defaultConfiguration]; + config.tagTextColor = UIColorHex(#21BEBD); + config.tagTextMargin = 11; + config.tagHeight = 17; + config.tagTextFont = BOLDSYSTEMFONT(11); + config.tagBackColor = KWhiteColor; + config.tagMaxWidth = kScreenWidth - kRealValue(120); +// config.tagListViewInset = UIEdgeInsetsMake(15, 15, 15, 10); + + ZHTagListView *tagList = [[ZHTagListView alloc] initWithFrame:CGRectMake(self.doctorImageView.right + kRealValue(20) , self.hospitalName.bottom + kRealValue(8), kScreenWidth - kRealValue(120) , 0) configuration:config tagTexts:_dataSource]; + self.tagList = tagList; + [self.topView addSubview:tagList]; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + }]; + +// UIImageView * starImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(37), tagList.bottom + kRealValue(14), 15, 15)]; +// starImg.image = [UIImage imageNamed:@"home_star"]; +// self.starImg = starImg; +// [self.topView addSubview:starImg]; + + self.evaluationLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, tagList.bottom + kRealValue(16), kScreenWidth, 11)]; + self.evaluationLabel.font = SYSTEMFONT(13); + self.evaluationLabel.textAlignment = NSTextAlignmentCenter; + self.evaluationLabel.textColor = KWhiteColor; + [self.topView addSubview:self.evaluationLabel]; + +// UIView * hotView = [[UIView alloc] initWithFrame:CGRectMake(self.evaluationLabel.right + kRealValue(3), self.evaluationLabel.top, kRealValue(51), kRealValue(10))]; +// hotView.layer.cornerRadius = 5; +// hotView.layer.masksToBounds = YES; +// hotView.backgroundColor = UIColorHex(#ED2A26); +// self.hotView = hotView; +// [self.topView addSubview:hotView]; + +// UIView * currentHot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(51) * 0.4, kRealValue(10))]; +// currentHot.backgroundColor = UIColorHex(#FF7E31); +// currentHot.layer.cornerRadius = 5; +// currentHot.layer.masksToBounds = YES; +// self.currentHot = currentHot; +// [hotView addSubview:currentHot]; + + self.topView.height = self.evaluationLabel.bottom + kRealValue(55); + + UIView * quesstionView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.topView.bottom - kRealValue(40), kScreenWidth - kRealValue(30), kRealValue(143))]; + quesstionView.backgroundColor = KWhiteColor; + quesstionView.layer.cornerRadius = 10.0; + quesstionView.layer.masksToBounds = YES; + self.quesstionView = quesstionView; + [self.mainScrollView addSubview:quesstionView]; + + self.pictureView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, quesstionView.width, 42)]; + + [quesstionView addSubview:self.pictureView]; + + UIImageView * pcitImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(22), kRealValue(19), 42, 42)]; + pcitImg.image = IMAGE_NAMED(@"pictureQuestion_Left"); + pcitImg.layer.cornerRadius = 21.0; + pcitImg.layer.masksToBounds = YES; + [self.pictureView addSubview:pcitImg]; + + + UILabel * picName = [[UILabel alloc] initWithFrame:CGRectMake(pcitImg.right + kRealValue(11), pcitImg.top + kRealValue(3) ,kRealValue(129), 14)]; + picName.textColor = UIColorHex(#333333); + picName.font = BOLDSYSTEMFONT(14); + picName.textAlignment = NSTextAlignmentLeft; + picName.text = @"图文咨询"; + [self.pictureView addSubview:picName]; + + UILabel * picDetailName = [[UILabel alloc] initWithFrame:CGRectMake(pcitImg.right + kRealValue(11),picName.bottom + kRealValue(7) ,200, 12)]; + picDetailName.textColor = UIColorHex(#666666); + picDetailName.font = MEDIUMFONT(11); + picDetailName.textAlignment = NSTextAlignmentLeft; + picDetailName.text = @"通过图片、文字的形式进行咨询"; + [self.pictureView addSubview:picDetailName]; + + UIButton * picBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.pictureView.right - kRealValue(15) - 70 ,pcitImg.top + kRealValue(8), 70, 26)]; + picBtn.layer.cornerRadius = 13; + picBtn.layer.masksToBounds = YES; + [picBtn setTitle:@"去咨询 >" forState:UIControlStateNormal]; + picBtn.titleLabel.font = MEDIUMFONT(12); + picBtn.backgroundColor = UIColorHex(#21BEBD); + [picBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.pictureBtn = picBtn; + [picBtn addTarget:self action:@selector(questionPictureAction) forControlEvents:UIControlEventTouchUpInside]; + [self.pictureView addSubview:picBtn]; + + //音视频 + self.videoView = [[UIView alloc] initWithFrame:CGRectMake(0, self.pictureView.bottom + kRealValue(24) , quesstionView.width, 42)]; + [quesstionView addSubview:self.videoView]; + + UIImageView * videoImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(22), kRealValue(19), 40, 40)]; + videoImg.image = IMAGE_NAMED(@"videQuestion_Left"); + videoImg.layer.cornerRadius = 20.0; + videoImg.layer.masksToBounds = YES; + [self.videoView addSubview:videoImg]; + + + UILabel * videoName = [[UILabel alloc] initWithFrame:CGRectMake(videoImg.right + kRealValue(11), videoImg.top + kRealValue(3) ,kRealValue(129), 14)]; + videoName.textColor = UIColorHex(#333333); + videoName.font = BOLDSYSTEMFONT(14); + videoName.textAlignment = NSTextAlignmentLeft; + videoName.text = @"视频咨询"; + [self.videoView addSubview:videoName]; + + UILabel * videoDetailName = [[UILabel alloc] initWithFrame:CGRectMake(videoImg.right + kRealValue(11),videoName.bottom + kRealValue(7) ,200, 12)]; + videoDetailName.textColor = UIColorHex(#666666); + videoDetailName.font = MEDIUMFONT(11); + videoDetailName.textAlignment = NSTextAlignmentLeft; + videoDetailName.text = @"通过语音视频电话的形式进行咨询"; + [self.videoView addSubview:videoDetailName]; + + UIButton * videoBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.videoView.right - kRealValue(15) - 70 ,videoImg.top + kRealValue(8), 70, 26)]; + videoBtn.layer.cornerRadius = 13; + videoBtn.layer.masksToBounds = YES; + [videoBtn setTitle:@"去咨询 >" forState:UIControlStateNormal]; + videoBtn.titleLabel.font = MEDIUMFONT(12); + videoBtn.backgroundColor = UIColorHex(#21BEBD); + self.videoBtn = videoBtn; + [videoBtn addTarget:self action:@selector(questionVideoAction) forControlEvents:UIControlEventTouchUpInside]; + [videoBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.videoView addSubview:videoBtn]; + + //医生简介 + + UIView * doctorView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), quesstionView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), 100)]; + self.doctorView = doctorView; + doctorView.layer.cornerRadius = 10.0; + doctorView.layer.masksToBounds = YES; + doctorView.backgroundColor = KWhiteColor; + [self.mainScrollView addSubview:doctorView]; + + UILabel * doctorTitle = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16),kRealValue(20) ,100, 16)]; + doctorTitle.textColor = UIColorHex(#333333); + doctorTitle.font = BOLDSYSTEMFONT(16); + doctorTitle.textAlignment = NSTextAlignmentLeft; + doctorTitle.text = @"医生简介"; + [doctorView addSubview:doctorTitle]; + + self.doctorIndorLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16),doctorTitle.bottom + kRealValue(10) ,doctorView.width - kRealValue(32), 16)]; + self.doctorIndorLabel.textColor = CFontColor2; + self.doctorIndorLabel.font = BOLDSYSTEMFONT(13); + self.doctorIndorLabel.textAlignment = NSTextAlignmentLeft; + self.doctorIndorLabel.numberOfLines = 0; + self.doctorIndorLabel.text = @""; + [doctorView addSubview:self.doctorIndorLabel]; + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(0, self.doctorIndorLabel.bottom + kRealValue(15), doctorView.width, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + self.linView = linv; + [doctorView addSubview:linv]; + + UILabel * doctorGoodLab = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16) , linv.bottom + kRealValue(21) ,100, 16)]; + doctorGoodLab.textColor = UIColorHex(#333333); + doctorGoodLab.font = BOLDSYSTEMFONT(16); + doctorGoodLab.textAlignment = NSTextAlignmentLeft; + doctorGoodLab.text = @"医生擅长"; + self.doctorTitle = doctorGoodLab; + [doctorView addSubview:doctorGoodLab]; + + self.doctorGoodLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16),doctorGoodLab.bottom + kRealValue(18) ,doctorView.width - kRealValue(32), 16)]; + self.doctorGoodLabel.textColor = UIColorHex(#333333); + self.doctorGoodLabel.font = BOLDSYSTEMFONT(13); + self.doctorGoodLabel.textAlignment = NSTextAlignmentLeft; + self.doctorGoodLabel.numberOfLines = 0; + self.doctorGoodLabel.text = @""; + self.doctorGoodLabel.height = [HQCommonUtils getSpaceLabelHeight:self.doctorGoodLabel withStr:self.doctorGoodLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightBold] withWidth:self.doctorIndorLabel.width withLineSpacing:5]; + [doctorView addSubview:self.doctorGoodLabel]; + + doctorView.height = self.doctorGoodLabel.bottom + kRealValue(27); + + self.homeTable = [[DoctorEvaluationTable alloc] initWithFrame:CGRectMake(kRealValue(15), self.doctorView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), 410 ) style:UITableViewStyleGrouped]; + self.homeTable.scrollEnabled = false; + self.homeTable.backgroundColor = KWhiteColor; + self.homeTable.layer.cornerRadius = 10; + self.homeTable.layer.masksToBounds = true; + MJWeakSelf; + self.homeTable.moreBlock = ^{ + EvaluationListViewController * evalVC = [[EvaluationListViewController alloc] init]; + evalVC.doctorId = weakSelf.doctorId; + evalVC.type = 2; + [weakSelf.navigationController pushViewController:evalVC animated:YES]; + }; + [self.mainScrollView addSubview:self.homeTable]; + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.homeTable.bottom + kRealValue(20)); + +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"DOCTORAPI" NeedToken:@""]; + + [detailApi getDoctorExpertMainData:parmDic]; + +} + +- (void)getEvaluationList { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + [parmDic setObject:@"1" forKey:@"pageNo"]; + [parmDic setObject:@"4" forKey:@"pageSize"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"evluateAPI" NeedToken:@""]; + + [detailApi getExpertDoctorEvluateData:parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"DOCTORAPI"]) { + + [self hiddenAllMBProgressHUD]; + + NSDictionary * parmDic = response; + + DoctorDetailModel * model = [DoctorDetailModel modelWithDictionary:parmDic]; + + if ([model.tfFollow integerValue] == 1) { + + self.collectBtn.selected = YES; + [self.collectBtn setImage:[UIImage imageWithColor:KWhiteColor] forState:UIControlStateNormal]; + + + }else + { + self.collectBtn.selected = NO; + [self.collectBtn setImage:IMAGE_NAMED(@"collectLove") forState:UIControlStateNormal]; + + } + self.doctorName.text = model.doctorName; + self.jobName.text = model.doctorTitle; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImageView sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; + +// //评分 +// NSMutableAttributedString * firstPart = [[NSMutableAttributedString alloc] initWithString:@"综合评价:"]; +// NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:11],NSForegroundColorAttributeName:KWhiteColor}; +// [firstPart setAttributes:firstAttributes range:NSMakeRange(0,firstPart.length)]; +// +// NSMutableAttributedString * secondPart = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ / ",model.overallMerit]]; +// NSDictionary * secondAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:KWhiteColor}; +// [secondPart setAttributes:secondAttributes range:NSMakeRange(0,secondPart.length)]; +// [firstPart appendAttributedString:secondPart]; +// +// NSMutableAttributedString * thirdPart = [[NSMutableAttributedString alloc] initWithString:@"24小时回复率:"]; +// NSDictionary * thirdAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:11],NSForegroundColorAttributeName:KWhiteColor}; +// [thirdPart setAttributes:thirdAttributes range:NSMakeRange(0,thirdPart.length)]; +// [firstPart appendAttributedString:thirdPart]; +// +// NSMutableAttributedString * fourPart = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@%@ / ",model.responseRate,@"%"]]; +// NSDictionary * fourAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:KWhiteColor}; +// [fourPart setAttributes:fourAttributes range:NSMakeRange(0,fourPart.length)]; +// [firstPart appendAttributedString:fourPart]; +// +// NSMutableAttributedString * fivePart = [[NSMutableAttributedString alloc] initWithString:@"咨询量:"]; +// NSDictionary * fiveAttributes = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:11],NSForegroundColorAttributeName:KWhiteColor}; +// [fivePart setAttributes:fiveAttributes range:NSMakeRange(0,fivePart.length)]; +// [firstPart appendAttributedString:fivePart]; + + if ([model.overallMerit isEqualToString:@"null"]) { + model.overallMerit = @"0"; + } + if ([model.responseRate isEqualToString:@"null"]) { + model.responseRate = @"0"; + } + if ([model.messageNum isEqualToString:@"null"]) { + model.messageNum = @"0"; + } + + + self.evaluationLabel.text = [NSString stringWithFormat:@" 综合评价:%@ / 24小时回复率:%@%% / 咨询量:%@",model.overallMerit,model.responseRate, model.messageNum ] ; + + NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:self.evaluationLabel.text]; + [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] range:NSMakeRange(0, [self.evaluationLabel.text length])]; + NSTextAttachment *icon = [[NSTextAttachment alloc] init]; + UIImage *iconImage = [UIImage imageNamed:@"home_star"]; + [icon setBounds:CGRectMake(0, -3, 15, 15)]; + [icon setImage:iconImage]; + NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:icon]; + [attrStr insertAttributedString:string atIndex:0]; + self.evaluationLabel.attributedText = attrStr; + + NSMutableArray * sicksArray = [[NSMutableArray alloc] init]; + + for (DoctorGoodAtSicknessModel * sicModel in model.goodAtSicknessName) { + + [sicksArray addObject:sicModel.sicksName]; + } + self.tagList.tagDataArray = sicksArray; + self.hospitalName.text = [NSString stringWithFormat:@"%@ %@",model.resourceName,model.departmentName]; + CGFloat hospitalH = [HQCommonUtils getSpaceLabelHeight:self.hospitalName withStr:self.hospitalName.text withFont:[UIFont systemFontOfSize:13 weight:bold] withWidth:self.hospitalName.width withLineSpacing:3]; + self.hospitalName.height = hospitalH; + //布局 + self.doctorName.width = [HQCommonUtils getLengthFromText:model.doctorName andFontSize:23]; + self.jobName.left = self.doctorName.right + kRealValue(12); + + self.starImg.top = self.tagList.bottom + kRealValue(14); + +// CGSize attSize = [firstPart boundingRectWithSize:CGSizeMake(kScreenWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size; + self.evaluationLabel.frame = CGRectMake(0, self.tagList.bottom + kRealValue(16), kScreenWidth, 15); +// self.hotView.top = self.starImg.top + kRealValue(2); +// self.hotView.left = self.evaluationLabel.right + kRealValue(5); + self.topView.height = self.evaluationLabel.bottom + kRealValue(60); + self.quesstionView.top = self.topView.bottom - kRealValue(40); + if (!ValidStr(model.goodAt)) { + self.doctorGoodLabel.text = model.goodAt; + self.doctorGoodLabel.height = [HQCommonUtils getSpaceLabelHeight:self.doctorGoodLabel withStr:self.doctorGoodLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightBold] withWidth:self.doctorGoodLabel.width withLineSpacing:2] ; + + } + if (!ValidStr(model.experience)) { + self.doctorIndorLabel.text = model.experience; + self.doctorIndorLabel.height = [HQCommonUtils getSpaceLabelHeight:self.doctorIndorLabel withStr:self.doctorIndorLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightBold] withWidth:self.doctorIndorLabel.width withLineSpacing:2] ; + + } + + + //判断是否开始服务 + if ([model.doctorStatus intValue] != 3) { //非停诊 + self.gradientView.hidden = true; + if ([model.audioStatus intValue] == 1) { //开启 + + [self.videoBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.videoBtn.backgroundColor = UIColorHex(#21BEBD); + self.videoBtn.userInteractionEnabled = true; + + }else + { + [self.videoBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.videoBtn.backgroundColor = UIColor.grayColor; + self.videoBtn.userInteractionEnabled = false; + } + + } + else{ + self.videoBtn.userInteractionEnabled = false; + [self.videoBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.pictureBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.videoBtn.backgroundColor = UIColor.grayColor; + self.pictureBtn.backgroundColor = UIColor.grayColor; + self.pictureBtn.userInteractionEnabled = false; + self.gradientView.hidden = false; + } + + + self.linView.top = self.doctorIndorLabel.bottom + + kRealValue(10); + self.doctorTitle.top = self.linView.bottom + kRealValue(21); + self.doctorGoodLabel.top = self.doctorTitle.bottom + kRealValue(10); + self.doctorView.top = self.quesstionView.bottom + kRealValue(10); + self.doctorView.height = self.doctorGoodLabel.bottom + kRealValue(17); + [self getEvaluationList]; + + } + if ([tag isEqualToString:@"CollAPI"]) { + [self hiddenAllMBProgressHUD]; + [self createData]; + [EasyTextView showSuccessText:response]; + } + if ([tag isEqualToString:@"cancelAPI"]) { + [self hiddenAllMBProgressHUD]; + [self createData]; + [EasyTextView showSuccessText:response]; + + } + if ([tag isEqualToString:@"evluateAPI"]) { + + NSMutableArray * dataArray = [[NSMutableArray alloc] init]; + NSMutableArray * frameArray = [[NSMutableArray alloc] init]; + + for (NSDictionary * dic in response) { + + EvaluatListModel * evModel = [EvaluatListModel modelWithDictionary:dic]; + CGFloat H = [self calculateHeightForText:evModel.context withFont:SYSTEMFONT(12) width:kScreenWidth - kRealValue(30) - 31]; + [frameArray addObject:[NSString stringWithFormat:@"%.2f",H + kRealValue(50)]]; + [dataArray addObject:evModel]; + + } + __block float sum = 0.0f; + [frameArray enumerateObjectsUsingBlock:^(NSNumber *number, NSUInteger idx, BOOL *stop) { + sum += [number floatValue]; + }]; + NSLog(@"Sum: %f", sum); + self.homeTable.dataArray = dataArray; + + self.homeTable.frame = CGRectMake(kRealValue(15), self.doctorView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), sum +kRealValue(50) ); + + if (!ValidArray(dataArray)) { + self.homeTable.hidden = true; + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.doctorView.bottom + kRealValue(30)); + + }else { + self.homeTable.hidden = false; + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.homeTable.bottom + kRealValue(30)); + } + + } + if ([tag isEqualToString:@"xuzhi_1"]) { + [self hiddenAllMBProgressHUD]; + NSDictionary * parmDic = response; + self.PictureknowDic = parmDic; + + } + if ([tag isEqualToString:@"xuzhi_2"]) { + [self hiddenAllMBProgressHUD]; + NSDictionary * parmDic = response; + self.AudioknowDic = parmDic; + + } +} + +// 方法:计算文本高度 +- (CGFloat)calculateHeightForText:(NSString *)text + withFont:(UIFont *)font + width:(CGFloat)width { + if (text == nil || font == nil) { + return 0; + } + + // 设置文本属性 + NSDictionary *attributes = @{NSFontAttributeName: font}; + + // 设置计算区域 + CGSize maxSize = CGSizeMake(width, CGFLOAT_MAX); + + // 计算文本的 bounding rect + CGRect textRect = [text boundingRectWithSize:maxSize + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:attributes + context:nil]; + + // 返回计算的高度 + return ceil(textRect.size.height); +} +- (void)collectHosptal:(UIButton *)collBtn { + + if (collBtn.selected == YES) { + + [self showMBProgressHUDWithString:@"取消关注中..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"cancelAPI" NeedToken:@""]; + + [detailApi getCancelCollectDoctorExpertData:parmDic]; + + }else + { + [self showMBProgressHUDWithString:@"关注中..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"CollAPI" NeedToken:@""]; + + [detailApi getCollectDoctorExpertData:parmDic]; + } + + + +} + +#pragma mark:去咨询 + +- (void)questionVideoAction { + + + self.questionType = 2; + + if ( ValidDict(self.AudioknowDic)) + { + QuestionMustKnowViewController * questionVC = [[QuestionMustKnowViewController alloc] init]; + questionVC.doctorId = self.doctorId; + questionVC.popType = 2; //1 图文 0 音视频 2 用户须知 + [self.navigationController pushViewController:questionVC animated:YES]; + }else + { + SelectedDoctorTimeVC * timeVC = [[SelectedDoctorTimeVC alloc] init]; + timeVC.doctorId = self.doctorId; + [self.navigationController pushViewController:timeVC animated:YES]; + } + +} + +- (void)questionPictureAction { + + self.questionType = 1; + + if ( ValidDict(self.PictureknowDic)) + { + QuestionMustKnowViewController * questionVC = [[QuestionMustKnowViewController alloc] init]; + questionVC.doctorId = self.doctorId; + questionVC.popType = 1; //1 图文 0 音视频 2 用户须知 + [self.navigationController pushViewController:questionVC animated:YES]; + }else + { + SelectedQuestionViewController * questionVC = [[SelectedQuestionViewController alloc] init]; + questionVC.doctorID = self.doctorId; + questionVC.questionType = self.questionType ; + [self.navigationController pushViewController:questionVC animated:YES]; + } + +} + +#pragma mark:请求须知 +- (void)getMustknowWithType:(NSString *)type { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:type forKey:@"type"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:[NSString stringWithFormat:@"xuzhi_%@",type] NeedToken:@""]; + + [detailApi getFoundPopConnetResult :parmDic]; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/FileDataDetailViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/FileDataDetailViewController.h new file mode 100644 index 0000000..be672bb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/FileDataDetailViewController.h @@ -0,0 +1,16 @@ +// +// FileDataDetailViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FileDataDetailViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/FileDataDetailViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/FileDataDetailViewController.m new file mode 100644 index 0000000..a7e7502 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/FileDataDetailViewController.m @@ -0,0 +1,68 @@ +// +// FileDataDetailViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "FileDataDetailViewController.h" +#import "DetailTitleView.h" +#import "DetailUserInfoView.h" +#import "FileDataDeatilCenterView.h" +#import "BasicHealthInfoView.h" + +@interface FileDataDetailViewController () + +@end + +@implementation FileDataDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = UIColorHex(#F3F3F5); + self.isHidenNaviBar = false; + self.navigationItem.title = @"档案详情"; + [self createUI]; + // Do any additional setup after loading the view. +} + +- (void)createUI { + + UIImageView * topImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)]; + topImage.image = [UIImage imageNamed:@"questionDetailBack"]; + [self.view addSubview:topImage]; + + + + UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight )]; + mainScrollView.showsVerticalScrollIndicator = false; + mainScrollView.showsHorizontalScrollIndicator = false; + mainScrollView.layer.cornerRadius = 8.0; + mainScrollView.layer.masksToBounds = true; + mainScrollView.backgroundColor = KClearColor; + [self.view addSubview:mainScrollView]; + + DetailTitleView * titleview = [[DetailTitleView alloc] initWithFrame:CGRectMake(0, 0, mainScrollView.width, 33)]; + [mainScrollView addSubview:titleview]; + + //个人信息 + DetailUserInfoView * infoView = [[DetailUserInfoView alloc] initWithFrame:CGRectMake(0, titleview.bottom, kScreenWidth - kRealValue(30), kRealValue(103))]; + infoView.backgroundColor = KWhiteColor; + [mainScrollView addSubview:infoView]; + //问题 + FileDataDeatilCenterView * detailView = [[FileDataDeatilCenterView alloc] initWithFrame:CGRectMake(0, infoView.bottom + kRealValue(10), mainScrollView.width, 500)]; + [mainScrollView addSubview:detailView]; + detailView.height = detailView.questionH; + detailView.layer.cornerRadius = 10; + [HQCommonUtils addShadowToView:detailView]; + + BasicHealthInfoView * healthView = [[BasicHealthInfoView alloc] initWithFrame:CGRectMake(0,detailView.bottom + kRealValue(15), kScreenWidth - kRealValue(30), kRealValue(280))]; + healthView.backgroundColor = [UIColor whiteColor]; + healthView.layer.cornerRadius = 10.0; + [HQCommonUtils addShadowToView:healthView]; + [mainScrollView addSubview:healthView]; + + mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), healthView.bottom + 50); + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalIntroViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalIntroViewController.h new file mode 100644 index 0000000..9d70418 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalIntroViewController.h @@ -0,0 +1,19 @@ +// +// HospitalIntroViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalIntroViewController : HQBaseViewController + +@property (nonatomic, strong) NSString * hospitalID; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalIntroViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalIntroViewController.m new file mode 100644 index 0000000..fcba9ea --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalIntroViewController.m @@ -0,0 +1,307 @@ +// +// HospitalIntroViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import "HospitalIntroViewController.h" +#import "HospitalInfoModel.h" +#import "TYMapNavSheet.h" + +@interface HospitalIntroViewController () +{ + TYMapNavSheet * TYNavSheet; + +} +@property (nonatomic, strong) UILabel * hospitalNameLabel; +@property (nonatomic, strong) UILabel * lvLabel; +@property (nonatomic, strong) UILabel * adressLabel; +@property (nonatomic, strong) UIScrollView * mainScrollView; +@property (nonatomic, strong) UIImageView * hospitalImg; +@property (nonatomic, strong) UIView * jianjiesView; +@property (nonatomic, strong) YYLabel * conntLabel; +@property (nonatomic, strong) UIView * addressView; +@property (nonatomic, strong) UIImageView * addressImg; +@property (nonatomic, strong) HospitalInfoModel * model ; +@property (nonatomic, strong) UIButton * daohangBtn; + +@end + +@implementation HospitalIntroViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.view.backgroundColor = UIColorHex(#EEEEEE); + self.navigationItem.title = @"医院概况"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + + + + UIView * topview = [[UIView alloc] initWithFrame:CGRectMake(0, 0.5, kScreenWidth, kRealValue(126))]; + + topview.backgroundColor = UIColorHex(#21BEBD); + + [self.view addSubview:topview]; + + TYNavSheet = [[TYMapNavSheet alloc]init]; + + UIImageView * hospitalImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(9), 60, 60)]; + hospitalImg.layer.cornerRadius = 5.0f; + hospitalImg.layer.masksToBounds = YES; + hospitalImg.image = PLACEHOLD_IMG; + self.hospitalImg = hospitalImg; + [topview addSubview:hospitalImg]; + + self.hospitalNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.hospitalImg.right + kRealValue(20), kRealValue(16), kScreenWidth - kRealValue(96), 17)]; + + self.hospitalNameLabel.textColor = KWhiteColor; + + self.hospitalNameLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightHeavy]; + + self.hospitalNameLabel.textAlignment = NSTextAlignmentLeft; + + self.hospitalNameLabel.text = @""; + + [topview addSubview:self.hospitalNameLabel]; + + + self.lvLabel = [[UILabel alloc] initWithFrame:CGRectMake(hospitalImg.right + kRealValue(20), self.hospitalNameLabel.bottom + kRealValue(16), 60, 17)]; + + self.lvLabel.textColor = UIColorHex(#21BEBD); + + self.lvLabel.backgroundColor = KWhiteColor; + + self.lvLabel.layer.cornerRadius = 5; + + self.lvLabel.layer.masksToBounds = YES; + + self.lvLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightBold]; + + self.lvLabel.textAlignment = NSTextAlignmentCenter; + + self.lvLabel.text = @""; + + CGFloat w = [HQCommonUtils getLengthFromText:self.lvLabel.text andFontSize:11]; + self.lvLabel.width = w + 16; + [topview addSubview:self.lvLabel]; + + + UIView * addressView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(16), self.hospitalImg.bottom + kRealValue(17), kScreenWidth - kRealValue(32), kRealValue(44))]; + addressView.backgroundColor = KWhiteColor; + addressView.layer.cornerRadius = 10; + addressView.layer.masksToBounds = YES; + [topview addSubview:addressView]; + self.addressView = addressView; + + UIImageView * addressImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(14), kRealValue(13), kRealValue(15))]; + addressImg.image = [UIImage imageNamed:@"hospatilAddress"]; + self.addressImg = addressImg; + [addressView addSubview:addressImg]; + + self.adressLabel = [[UILabel alloc] initWithFrame:CGRectMake(addressImg.right + kRealValue(5),kRealValue(10), kScreenWidth - kRealValue(96), 13)]; + + self.adressLabel.textColor = UIColorHex(#333333); + + self.adressLabel.font = MEDIUMFONT(13); + + self.adressLabel.textAlignment = NSTextAlignmentLeft; + + self.adressLabel.text = @""; + + self.adressLabel.numberOfLines = 0; + + [addressView addSubview:self.adressLabel]; + + UIButton * daohangBtn = [[UIButton alloc] initWithFrame:CGRectMake(addressView.width - 16 - 30, kRealValue(5), 30 , kRealValue(30))]; + [daohangBtn setTitle:@"导航" forState:UIControlStateNormal]; + [daohangBtn setTitleColor:UIColorHex(#3390FF) forState:UIControlStateNormal]; + daohangBtn.titleLabel.font = SYSTEMFONT(12); + self.daohangBtn = daohangBtn; + [daohangBtn addTarget:self action:@selector(daohangAction) forControlEvents:UIControlEventTouchUpInside]; + [addressView addSubview:daohangBtn]; + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(16) , self.addressView.bottom + kRealValue(10) , kScreenWidth - kRealValue(32) , kScreenHeight - addressView.bottom - kRealValue(10))]; + self.mainScrollView.backgroundColor = KClearColor; + self.mainScrollView.showsVerticalScrollIndicator = false; + self.mainScrollView.showsHorizontalScrollIndicator = false; + [self.view addSubview:self.mainScrollView]; + + + //医院简介 + + UIView * jianjiesView = [[UIView alloc] initWithFrame:CGRectMake(0 , 0, kScreenWidth - kRealValue(32), kRealValue(300))]; + jianjiesView.backgroundColor = KWhiteColor; + jianjiesView.layer.cornerRadius = 10; + jianjiesView.layer.masksToBounds = YES; + self.jianjiesView = jianjiesView; + [self.mainScrollView addSubview:jianjiesView]; + + UILabel * hosLabel = [[UILabel alloc] initWithFrame:CGRectMake( kRealValue(16),kRealValue(16), kScreenWidth - kRealValue(96), 17)]; + + hosLabel.textColor = UIColorHex(#333333); + + hosLabel.font = BOLDSYSTEMFONT(16); + + hosLabel.textAlignment = NSTextAlignmentLeft; + + hosLabel.text = @"医院简介"; + + [jianjiesView addSubview:hosLabel]; + + self.conntLabel = [[YYLabel alloc] initWithFrame:CGRectMake( kRealValue(16),hosLabel.bottom + kRealValue(21), jianjiesView.width - kRealValue(32), 13)]; + self.conntLabel.textAlignment = NSTextAlignmentLeft; + self.conntLabel.font = MEDIUMFONT(13); + self.conntLabel.textColor = UIColorHex(#333333); + self.conntLabel.numberOfLines = 0; + + // 查询文本排版结果 + // 计算文本尺寸YYTextLayout + // 显示文本排版结果 + [jianjiesView addSubview:self.conntLabel]; + + + + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.jianjiesView.bottom + kRealValue(50)); + +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"id"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"DETAILAPI" NeedToken:@""]; + + [detailApi getHospatilDetail:parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"DETAILAPI"]) { + + [self hiddenAllMBProgressHUD]; + + HospitalInfoModel * model = [HospitalInfoModel modelWithDictionary:response]; + self.model = model; + if (ValidStr(model.level)) { + self.lvLabel.hidden = YES; + }else + { + self.lvLabel.text = model.level; + CGFloat w = [HQCommonUtils getLengthFromText:self.lvLabel.text andFontSize:11]; + self.lvLabel.width = w + 16; + + } + + self.hospitalNameLabel.text = model.resourceName; + + + self.adressLabel.text = [NSString stringWithFormat:@"%@",model.address]; + + CGFloat addressH = [HQCommonUtils getSpaceLabelHeight:self.adressLabel withStr:self.adressLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:self.adressLabel.width withLineSpacing:5]; + + self.adressLabel.height = addressH; + + self.addressView.height = self.adressLabel.bottom + kRealValue(10); + + self.addressImg.top = self.adressLabel.centerY - kRealValue(8); + + self.daohangBtn.top = self.addressView.height/2 - kRealValue(15); + + self.mainScrollView.frame = CGRectMake(kRealValue(16) , self.addressView.bottom + kRealValue(10) , kScreenWidth - kRealValue(32) , kScreenHeight - self.addressView.bottom - kRealValue(10)); + + //图片 + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.img]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + [self.hospitalImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"hospitalNoimage"]]; + + NSMutableAttributedString *text = [NSMutableAttributedString new]; + // 添加文本 + NSString *title = model.resourceDetail; + + // //富文本 + // [NSString stringWithFormat:@"%@ ",title]; + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[[NSString stringWithFormat:@"%@ ",title] dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + [text appendAttributedString:attrStr]; + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:6]; + [text addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])]; + + self.conntLabel.attributedText = text; + + CGSize maxSize = CGSizeMake(self.conntLabel.width, MAXFLOAT); + + YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:self.conntLabel.attributedText]; + self.conntLabel.textLayout = layout; + CGFloat introHeight = layout.textBoundingSize.height; + self.conntLabel.width = maxSize.width; + // 记录真正的正确高度 + self.conntLabel.height = introHeight; + // 显示文本排版结果 + self.jianjiesView.height = kRealValue(91) + introHeight; + + + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(32), self.jianjiesView.bottom + kRealValue(20)); + + } +} + +- (void)daohangAction { + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + +// NSLog(@"经度:%f 纬度:%f", longitude, latitude); +// //1.将两个经纬度点转成投影点 +// MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(model.latitude,model.longitude)); +// MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); +// //2.计算距离 +// CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + NSMutableDictionary * Dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"我的位置",@"startName",self.model.address,@"endName", nil]; + [TYNavSheet ShowMapNavSheetSuperView:self withLocationDic:Dic withstartCoor:CLLocationCoordinate2DMake(latitude, longitude) withendCoor:CLLocationCoordinate2DMake(self.model.latitude, self.model.longitude)]; + +} + +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + [TYNavSheet actionSheetBtnClick:buttonIndex]; +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalJianjieViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalJianjieViewController.h new file mode 100644 index 0000000..29dcb0e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalJianjieViewController.h @@ -0,0 +1,16 @@ +// +// HospitalJianjieViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalJianjieViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalJianjieViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalJianjieViewController.m new file mode 100644 index 0000000..2da1181 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalJianjieViewController.m @@ -0,0 +1,31 @@ +// +// HospitalJianjieViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import "HospitalJianjieViewController.h" + +@interface HospitalJianjieViewController () + +@end + +@implementation HospitalJianjieViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalMainViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalMainViewController.h new file mode 100644 index 0000000..86c1781 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalMainViewController.h @@ -0,0 +1,18 @@ +// +// HospitalMainViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalMainViewController : HQBaseViewController + +@property (nonatomic, strong) NSString * hospitalID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalMainViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalMainViewController.m new file mode 100644 index 0000000..042a45a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/HospitalMainViewController.m @@ -0,0 +1,505 @@ +// +// HospitalMainViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HospitalMainViewController.h" +#import "HospitalMainTableView.h" +#import "HospitalMainHeardView.h" +#import "HospitalMainDoctorCollectView.h" +#import "HospitalJianjieViewController.h" +#import "HospitalInfoModel.h" +#import "FoundExpertModel.h" +#import "EvaluatListModel.h" +#import "SearchZhuangJiaViewController.h" +#import "EvaluationListViewController.h" +#import "HospitalIntroViewController.h" +#import "TYMapNavSheet.h" +#import "ExpertMainViewController.h" + +@interface HospitalMainViewController () +{ + TYMapNavSheet * TYNavSheet; +} +@property (nonatomic, strong) HospitalMainTableView * homeTable; +@property (nonatomic, strong) UILabel * hospitalNameLabel; +@property (nonatomic, strong) UILabel * lvLabel; +@property (nonatomic, strong) UILabel * adressLabel; +@property (nonatomic, strong) UIButton * collectBtn; +@property (nonatomic, strong) UIScrollView * mainScrollView; +@property (nonatomic, strong) UIImageView * hospitalImg; +@property (nonatomic, strong) HospitalMainHeardView * heardView; +@property (nonatomic, strong) HospitalMainDoctorCollectView * collectView; +@property (nonatomic, strong) NSMutableArray * doctorArray; +@property (nonatomic, strong) NSMutableArray * evaluatArray; +@property (nonatomic, copy) NSString * hospitalName; +@property (nonatomic, copy) NSString * departmentNum; +@property (nonatomic, copy) NSString * doctorNum; + +@property (nonatomic, strong) UIImageView * locationImg; + +@property (nonatomic, strong) UIButton * mapNavButton; + +@property (nonatomic, strong) UIView * addressView; + +@property (nonatomic, strong)HospitalInfoModel * model; + + +@end + +@implementation HospitalMainViewController + +#pragma mark:懒加载 + +- (NSMutableArray *)doctorArray { + + if (!_doctorArray) { + _doctorArray = [[NSMutableArray alloc] init]; + } + return _doctorArray; +} + +- (NSMutableArray *)evaluatArray { + + if (!_evaluatArray) { + _evaluatArray = [[NSMutableArray alloc] init]; + } + return _evaluatArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.view.backgroundColor = UIColorHex(#EEEEEE); + self.navigationItem.title = @"医院主页"; + [self createUI]; + [self createData]; + [self createRoomsDoctor]; + [self createHopitalEvaluate]; +} + +- (void)createUI { + + UIView * topview = [[UIView alloc] initWithFrame:CGRectMake(0, 0.5, kScreenWidth, kRealValue(126))]; + + topview.backgroundColor = UIColorHex(#21BEBD); + + [self.view addSubview:topview]; + + + UIImageView * hospitalImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(9), 60, 60)]; + hospitalImg.layer.cornerRadius = 5.0f; + hospitalImg.layer.masksToBounds = YES; + hospitalImg.image = PLACEHOLD_IMG; + self.hospitalImg = hospitalImg; + [topview addSubview:hospitalImg]; + + + self.hospitalNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(hospitalImg.right + kRealValue(13), kRealValue(16), kScreenWidth - kRealValue(96), 17)]; + + self.hospitalNameLabel.textColor = KWhiteColor; + + self.hospitalNameLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightHeavy]; + + self.hospitalNameLabel.textAlignment = NSTextAlignmentLeft; + + self.hospitalNameLabel.text = @"---"; + + [topview addSubview:self.hospitalNameLabel]; + + + self.lvLabel = [[UILabel alloc] initWithFrame:CGRectMake(hospitalImg.right + kRealValue(13), self.hospitalNameLabel.bottom + kRealValue(16), 60, 17)]; + + self.lvLabel.textColor = UIColorHex(#21BEBD); + + self.lvLabel.backgroundColor = KWhiteColor; + + self.lvLabel.layer.cornerRadius = 5; + + self.lvLabel.layer.masksToBounds = YES; + + self.lvLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightBold]; + + self.lvLabel.textAlignment = NSTextAlignmentCenter; + + self.lvLabel.text = @"三甲甲等"; + + CGFloat w = [HQCommonUtils getLengthFromText:self.lvLabel.text andFontSize:11]; + self.lvLabel.width = w + 16; + [topview addSubview:self.lvLabel]; + + + self.addressView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(16), hospitalImg.bottom + kRealValue(17), kScreenWidth - kRealValue(32), kRealValue(44))]; + self.addressView.layer.cornerRadius = 10; + self.addressView.layer.masksToBounds = true; + self.addressView.backgroundColor = KWhiteColor; + [topview addSubview:self.addressView]; + + UIImageView * locationImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10), 19, 19)]; + locationImg.image = [UIImage imageNamed:@"hospital_location"]; + self.locationImg = locationImg; + [self.addressView addSubview:locationImg]; + + self.adressLabel = [[UILabel alloc] initWithFrame:CGRectMake(locationImg.right + kRealValue(7),kRealValue(10), self.addressView.width - kRealValue(90) , 32)]; + + self.adressLabel.textColor = CFontColor1; + + self.adressLabel.font = MEDIUMFONT(12); + + self.adressLabel.textAlignment = NSTextAlignmentLeft; + + self.adressLabel.text = @"0km | ---"; + + self.adressLabel.numberOfLines = 0; + + [self.addressView addSubview:self.adressLabel]; + + self.mapNavButton = [[UIButton alloc] initWithFrame:CGRectMake(self.addressView.right - kRealValue(66), 0, kRealValue(30), self.addressView.height)]; + [self.mapNavButton setTitle:@"导航" forState:UIControlStateNormal]; + [self.mapNavButton setTitleColor:UIColorHex(#3390FF) forState:UIControlStateNormal]; + self.mapNavButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.mapNavButton.titleLabel.font = SYSTEMFONT(12); + [self.mapNavButton addTarget:self action:@selector(mapNavLocationAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.addressView addSubview:self.mapNavButton]; + + self.collectBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(15) - 60, kRealValue(32), 60, 26)]; + self.collectBtn.backgroundColor = KWhiteColor; + [self.collectBtn setTitle:@" 关注" forState:UIControlStateNormal]; + [self.collectBtn setTitle:@"已关注" forState:UIControlStateSelected]; + + self.collectBtn.titleLabel.font = SYSTEMFONT(12); + [self.collectBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.collectBtn addTarget:self action:@selector(collectHosptal:) forControlEvents:UIControlEventTouchUpInside]; + self.collectBtn.layer.cornerRadius = 13.0; + self.collectBtn.layer.masksToBounds = true; + [topview addSubview:self.collectBtn]; + + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), self.addressView.bottom + kRealValue(17), kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight - 86)]; + self.mainScrollView.backgroundColor = KClearColor; + self.mainScrollView.showsVerticalScrollIndicator = false; + self.mainScrollView.showsHorizontalScrollIndicator = false; + [self.view addSubview:self.mainScrollView]; + + //医院简介 + self.heardView = [[HospitalMainHeardView alloc] initWithFrame:CGRectMake(0, 0, self.mainScrollView.width , 143)]; + self.heardView.layer.cornerRadius = 10; + self.heardView.layer.masksToBounds = YES; + self.heardView.backgroundColor = KWhiteColor; + MJWeakSelf + self.heardView.lookBlock = ^{ + [weakSelf lookHospitalJianjie]; + }; + [self.mainScrollView addSubview:self.heardView]; + //科室医生 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.itemSize = CGSizeMake((kScreenWidth - 30)/2,75); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(5, 0, 0, 15); + layout.minimumInteritemSpacing =0; + layout.minimumLineSpacing =0; + + self.collectView = [[HospitalMainDoctorCollectView alloc]initWithFrame:CGRectMake(0, self.heardView.bottom + kRealValue(10),kScreenWidth - kRealValue(30), 261) collectionViewLayout:layout]; + self.collectView.layer.cornerRadius = 10; + self.collectView.layer.masksToBounds = true; + self.collectView.collSelectBlock = ^(NSString * _Nonnull doctorID, NSString * _Nonnull doctorName) { + ExpertMainViewController * serarchVC = [[ ExpertMainViewController alloc] init]; +// serarchVC.departmentId = @""; +// serarchVC.departmentName = @""; +// serarchVC.sickId = @""; +// serarchVC.hospitalId = weakSelf.hospitalID; +// serarchVC.doctorName = doctorName; +// serarchVC.hospitalName = weakSelf.hospitalName; +// serarchVC.type = 2; + serarchVC.doctorId = doctorID; + [weakSelf.navigationController pushViewController:serarchVC animated:YES]; + }; + self.collectView.doctorBlock = ^{ + [weakSelf lookMoreDoctor]; + }; + [self.mainScrollView addSubview:self.collectView]; +// + self.homeTable = [[HospitalMainTableView alloc] initWithFrame:CGRectMake(0, self.collectView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), 600 ) style:UITableViewStyleGrouped]; + self.homeTable.scrollEnabled = false; + self.homeTable.layer.cornerRadius = 10; + self.homeTable.layer.masksToBounds = true; + self.homeTable.moreBlock = ^{ + EvaluationListViewController * evalVC = [[EvaluationListViewController alloc] init]; + evalVC.hospitalID = weakSelf.hospitalID; + [weakSelf.navigationController pushViewController:evalVC animated:YES]; + }; + [self.mainScrollView addSubview:self.homeTable]; + + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.homeTable.bottom + kRealValue(20)); + + + + +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"id"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"DETAILAPI" NeedToken:@""]; + + [detailApi getHospatilDetail:parmDic]; + +} + +- (void)createRoomsDoctor { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.hospitalID forKey:@"hospitalId"]; + [parmDic setObject:@"1" forKey:@"pageNo"]; + [parmDic setObject:@"6" forKey:@"pageSize"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"ROOMSAPI" NeedToken:@""]; + + [detailApi getHospatilDetailRoomsDoctor:parmDic]; +} + +//评论 +- (void)createHopitalEvaluate { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"hospitalId"]; + [parmDic setObject:@"1" forKey:@"pageNo"]; + [parmDic setObject:@"3" forKey:@"pageSize"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"EVALUATAPI" NeedToken:@""]; + + [detailApi getHospatilEvaluate:parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"DETAILAPI"]) { + + [self hiddenAllMBProgressHUD]; + + HospitalInfoModel * model = [HospitalInfoModel modelWithDictionary:response]; + self.model = model; + if (ValidStr(model.level)) { + self.lvLabel.hidden = YES; + }else + { + self.lvLabel.text = model.level; + + } + + self.hospitalNameLabel.text = model.resourceName; + self.hospitalName = model.resourceName; + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + //1.将两个经纬度点转成投影点 + MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(model.latitude,model.longitude)); + MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); + //2.计算距离 + CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + self.adressLabel.text = [NSString stringWithFormat:@"%.2fkm | %@",distance/1000,model.address]; + + CGFloat addressH = [HQCommonUtils getSpaceLabelHeight:self.adressLabel withStr:self.adressLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth:self.adressLabel.width withLineSpacing:5]; + self.adressLabel.height = addressH; + self.addressView.height = addressH + kRealValue(20); + self.locationImg.top = self.addressView.height/2 - 10; + self.mapNavButton.frame = CGRectMake(self.addressView.right - kRealValue(66), 0, kRealValue(30), self.addressView.height); + self.mainScrollView.top = self.addressView.bottom + kRealValue(10); + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.homeTable.bottom + kRealValue(20)); + if ([model.tfFollow integerValue] == 1) { + + self.collectBtn.selected = YES; + [self.collectBtn setImage:[UIImage imageWithColor:KWhiteColor] forState:UIControlStateNormal]; + + + }else + { + self.collectBtn.selected = NO; + [self.collectBtn setImage:IMAGE_NAMED(@"collectLove") forState:UIControlStateNormal]; + + + } + self.heardView.hospitalString = model.synopsis; + //图片 + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.img]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + [self.hospitalImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"hospitalNoimage"]]; + self.departmentNum = model.departmentNum; + self.doctorNum = model.doctorNum; + } + + if ([tag isEqualToString:@"ROOMSAPI"]) { + [self hiddenAllMBProgressHUD]; + NSArray * responseArray = response; + + for (NSDictionary * parmDic in responseArray) { + + DoctorListModel * model = [DoctorListModel modelWithDictionary:parmDic]; + [self.doctorArray addObject:model]; + } + NSDictionary * dic = @{@"departmentNum":[NSString stringWithFormat:@"%@",self.departmentNum],@"doctorNum":[NSString stringWithFormat:@"%@",self.doctorNum]}; + self.collectView.parmDic = dic; + if (!ValidArray(self.doctorArray)) { + self.collectView.hidden = YES; + self.collectView.height = 1; + self.homeTable.top = self.collectView.bottom + kRealValue(10); + }else + { + self.collectView.hidden = NO; + } + self.collectView.dataArray = self.doctorArray; + + } + + if ([tag isEqualToString:@"EVALUATAPI"]) { + [self hiddenAllMBProgressHUD]; + NSArray * array = response; + + for (NSDictionary * dic in array) { + + EvaluatListModel * evModel = [EvaluatListModel modelWithDictionary:dic]; + + [self.evaluatArray addObject:evModel]; + + } + if (!ValidArray(self.evaluatArray)) { + self.homeTable.hidden = YES; + }else + { + self.homeTable.hidden = NO; + } + self.homeTable.dataArray = self.evaluatArray; + } + + if ([tag isEqualToString:@"CollAPI"]) { + [self createData]; + [EasyTextView showSuccessText:response]; + } + if ([tag isEqualToString:@"cancelAPI"]) { + [self createData]; + [EasyTextView showSuccessText:response]; + + } + +} +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + +} + + +- (void)lookHospitalJianjie { + + + HospitalIntroViewController * jianjieVC = [[HospitalIntroViewController alloc] init]; + jianjieVC.hospitalID = self.hospitalID; + [self.navigationController pushViewController:jianjieVC animated:YES]; + +} + +- (void)lookMoreDoctor { + + SearchZhuangJiaViewController * serarchVC = [[ SearchZhuangJiaViewController alloc] init]; + serarchVC.departmentId = @""; + serarchVC.departmentName = @""; + serarchVC.sickId = @""; + serarchVC.hospitalId = self.hospitalID; + serarchVC.doctorName = @""; + serarchVC.hospitalName = self.hospitalName; + serarchVC.type = 2; + [self.navigationController pushViewController:serarchVC animated:YES]; + +} + +- (void)collectHosptal:(UIButton *)collBtn { + + if (collBtn.selected == YES) { + + [self showMBProgressHUDWithString:@"加载中..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"hospitalId"]; + [parmDic setObject:@"1" forKey:@"pageNo"]; + [parmDic setObject:@"3" forKey:@"pageSize"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"cancelAPI" NeedToken:@""]; + + [detailApi getCancelCollectHospatil:parmDic]; + + }else + { + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.hospitalID forKey:@"hospitalId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"CollAPI" NeedToken:@""]; + + [detailApi getCollectHospatil:parmDic]; + } + + + +} + + +- (void)mapNavLocationAction:(UIButton *)navBtn { + + TYNavSheet = [[TYMapNavSheet alloc]init]; + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + +// NSLog(@"经度:%f 纬度:%f", longitude, latitude); +// //1.将两个经纬度点转成投影点 +// MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(model.latitude,model.longitude)); +// MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); +// //2.计算距离 +// CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + NSMutableDictionary * Dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"我的位置",@"startName",self.model.address,@"endName", nil]; + [TYNavSheet ShowMapNavSheetSuperView:[HQCommonUtils getCurrentVC] withLocationDic:Dic withstartCoor:CLLocationCoordinate2DMake(latitude, longitude) withendCoor:CLLocationCoordinate2DMake(self.model.latitude, self.model.longitude)]; + +} + +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + [TYNavSheet actionSheetBtnClick:buttonIndex]; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/LookModficalFileViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/LookModficalFileViewController.h new file mode 100644 index 0000000..ea204b1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/LookModficalFileViewController.h @@ -0,0 +1,38 @@ +// +// LookModficalFileViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/27. +// + +#import "HQBaseViewController.h" +#import "QuestionDiseaseInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LookModficalFileViewController : HQBaseViewController + +@property (nonatomic, strong) QuestionDiseaseInfoModel * infomodel; + +@property (nonatomic, strong) diseaseModel * disModel; + +@property (nonatomic, strong) NSString * upID; + +@property (nonatomic, strong) NSString * downID; + +@property (nonatomic, strong) NSString * schedulingDateId; + +@property (nonatomic, strong) NSString * doctorID; + +@property (nonatomic, assign) NSInteger questionType; + +@property (nonatomic, assign) NSInteger isJump; // 2. 下一步 + +@property (nonatomic, strong) NSString * danganID; + +@property (nonatomic, assign) BOOL isEdit; // 2. 是否是编辑 + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/LookModficalFileViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/LookModficalFileViewController.m new file mode 100644 index 0000000..dcb07ff --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/LookModficalFileViewController.m @@ -0,0 +1,1040 @@ +// +// LookModficalFileViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/27. +// + +#import "LookModficalFileViewController.h" +#import "DetailTitleView.h" +#import "DetailUserInfoView.h" +#import "FileDataDeatilCenterView.h" +#import "BasicHealthInfoView.h" +#import "SelectedFileDateCenterView.h" +#import "QuestionItemTable.h" +#import "HQPhotoCollectView.h" +#import "FileDataModel.h" +#import "LookFileDataModel.h" +#import "SOSGroupIMModel.h" +#import "DoctorMainViewController.h" +#import "TZPhotoPreviewController.h" +#import +#import "TZImagePickerController.h" +#import "TZImageManager.h" +#import +#import "TZAssetModel.h" +#import "XLPhotoBrowser.h" + +#define maxPhotoesCount 9 +#define maxColumnNum 4 + +@interface LookModficalFileViewController () +{ + + + BOOL _isSelectOriginalPhoto; + +} +@property (nonatomic, strong) UIImagePickerController *imagePickerVc;//图片选择器 +@property (nonatomic, strong) UIAlertController *sheetVC;//选择框 +@property (nonatomic, strong) NSMutableArray * selectedPhotos;//选择的照片数 +@property (nonatomic, strong) NSMutableArray * selectedAssets; +@property (nonatomic, strong) NSMutableArray * againSelectPhoto; + +@property (nonatomic, strong) NSMutableArray * imageUrlArray; +@property (nonatomic, assign) NSInteger chixuTime; +@property (nonatomic, strong) DetailTitleView * titleview; + +@property (nonatomic, assign) NSInteger number; +@property (nonatomic, strong) SelectedFileDateCenterView * detailView ; +@property (nonatomic, strong) UIButton * bottomBtn ; +@property (nonatomic, strong) UIButton * useBtn ; +@property (nonatomic, strong) UIButton * saveAnduseBtn ; + + +@property (nonatomic, strong) LookFileDataModel * lookModel; + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) NSString * selectedDanganID; + +@end + +@implementation LookModficalFileViewController + +#pragma mark:懒加载 + +- (NSMutableArray *)selectedAssets +{ + if (!_selectedAssets) + { + _selectedAssets = [[NSMutableArray alloc] init]; + } + return _selectedAssets; +} + +- (NSMutableArray *)selectedPhotos +{ + if (!_selectedPhotos) + { + _selectedPhotos = [[NSMutableArray alloc] init]; + } + return _selectedPhotos; +} + +- (NSMutableArray *)imageUrlArray { + + if (!_imageUrlArray) + { + _imageUrlArray = [[NSMutableArray alloc] init]; + } + return _imageUrlArray; + +} + +- (NSMutableArray *)againSelectPhoto { + + if (!_againSelectPhoto) + { + _againSelectPhoto = [[NSMutableArray alloc] init]; + } + return _againSelectPhoto; + +} + +-(UIAlertController *)sheetVC{ + + if (!_sheetVC) { + + _sheetVC=[UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + + UIAlertAction *takePhoto=[UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self takePhoto]; + }]; + UIAlertAction *chosePhoto=[UIAlertAction actionWithTitle:@"去相册中选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self pushImagePickerController]; + }]; + UIAlertAction *cancel=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + + }]; + + [_sheetVC addAction:takePhoto]; + [_sheetVC addAction:chosePhoto]; + [_sheetVC addAction:cancel]; + } + return _sheetVC; + +} + +- (UIImagePickerController *)imagePickerVc { + if (_imagePickerVc == nil) { + _imagePickerVc = [[UIImagePickerController alloc] init]; + _imagePickerVc.delegate = self; + // set appearance / 改变相册选择页的导航栏外观 + _imagePickerVc.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor; + _imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor; + UIBarButtonItem *tzBarItem, *BarItem; + if (kiOS9Later) { + tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; + BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; + } else { + tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil]; + BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil]; + } + NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal]; + [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; + } + return _imagePickerVc; +} + +- (void)takePhoto { + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; + if ((authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)) { + // 无相机权限 做一个友好的提示 + UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的""设置-隐私-相机""中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil]; + [alert show]; + // 拍照之前还需要检查相册权限 + } else if ([[TZImageManager manager] authorizationStatusAuthorized] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 + UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的""设置-隐私-相册""中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil]; + alert.tag = 1; + [alert show]; + } else if ([[TZImageManager manager] authorizationStatusAuthorized] == 0) { // 正在弹框询问用户是否允许访问相册,监听权限状态 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + return [self takePhoto]; + }); + } else { // 调用相机 + UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; + if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { + self.imagePickerVc.sourceType = sourceType; + _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext; + [self presentViewController:_imagePickerVc animated:YES completion:nil]; + } else { + } + } +} + +#pragma mark - TZImagePickerController + +- (void)pushImagePickerController { + + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:maxPhotoesCount - self.number columnNumber:maxColumnNum delegate:self pushPhotoPickerVc:YES]; + +#pragma mark - 四类个性化设置,这些参数都可以不传,此时会走默认设置 + imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; + + // 1.设置目前已经选中的图片数组 + imagePickerVc.selectedAssets = _selectedAssets; // 目前已经选中的图片数组 + imagePickerVc.allowTakePicture =NO; // 不允许在内部显示拍照按钮 + + // 3. 设置是否可以选择视频/图片/原图 + imagePickerVc.allowPickingVideo = NO; + imagePickerVc.allowPickingImage = YES; + imagePickerVc.allowPickingOriginalPhoto = YES; + imagePickerVc.allowPickingGif = NO; + + // 4. 照片排列按修改时间升序 + imagePickerVc.sortAscendingByModificationDate = YES; + + + /// 5. 单选模式,maxImagesCount为1时才生效 + imagePickerVc.showSelectBtn = NO; + imagePickerVc.allowCrop = NO; + imagePickerVc.needCircleCrop =NO; + imagePickerVc.circleCropRadius = 100; + /* + [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) { + cropView.layer.borderColor = [UIColor redColor].CGColor; + cropView.layer.borderWidth = 2.0; + }];*/ + + //imagePickerVc.allowPreview = NO; +#pragma mark - 到这里为止 + + // You can get the photos by block, the same as by delegate. + // 你可以通过block或者代理,来得到用户选择的照片. + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { + + }]; + + [self presentViewController:imagePickerVc animated:YES completion:nil]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = UIColorHex(#F3F3F5); + self.isHidenNaviBar = false; + self.navigationItem.title = @"档案详情"; + self.number = 0; + self.isEdit = false; + [self createUI]; + [self getFileDetail]; + //网络状态监听 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(detailViewFrameChage:) + name:@"FrameChage" + object:nil]; + + + // Do any additional setup after loading the view. +} + +- (void)createUI { + + UIImageView * topImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)]; + topImage.image = [UIImage imageNamed:@"questionDetailBack"]; + [self.view addSubview:topImage]; + + + + UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight )]; + mainScrollView.showsVerticalScrollIndicator = false; + mainScrollView.showsHorizontalScrollIndicator = false; + mainScrollView.layer.cornerRadius = 8.0; + mainScrollView.layer.masksToBounds = true; + self.mainScrollView = mainScrollView; + mainScrollView.backgroundColor = KClearColor; + [self.view addSubview:mainScrollView]; + + DetailTitleView * titleview = [[DetailTitleView alloc] initWithFrame:CGRectMake(0, 0, mainScrollView.width, 33)]; + self.titleview = titleview; + [mainScrollView addSubview:titleview]; + + //个人信息 + DetailUserInfoView * infoView = [[DetailUserInfoView alloc] initWithFrame:CGRectMake(0, titleview.bottom, kScreenWidth - kRealValue(30), kRealValue(103))]; + infoView.backgroundColor = KWhiteColor; + infoView.model = self.infomodel; + [mainScrollView addSubview:infoView]; + //问题 + SelectedFileDateCenterView * detailView = [[SelectedFileDateCenterView alloc] initWithFrame:CGRectMake(0, infoView.bottom + kRealValue(10), mainScrollView.width, 500)]; + detailView.questionOneDelegate = self; + detailView.photoDelegate = self; + [mainScrollView addSubview:detailView]; + detailView.height = detailView.questionH; + detailView.layer.cornerRadius = 10; + self.detailView = detailView; + [HQCommonUtils addShadowToView:detailView]; + + + + + UIButton * bottomBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15) , detailView.bottom + kRealValue(28), self.mainScrollView.width/2 - kRealValue(30) , 35)]; + [bottomBtn addTarget:self action:@selector(editAction:) forControlEvents:UIControlEventTouchUpInside]; + bottomBtn.backgroundColor = KWhiteColor; + [bottomBtn setTitle:@"编辑" forState:UIControlStateNormal]; + bottomBtn.layer.cornerRadius = 17; + bottomBtn.layer.masksToBounds = YES; + bottomBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + bottomBtn.layer.borderWidth = 1.0; + bottomBtn.titleLabel.font = SYSTEMFONT(14); + [bottomBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.bottomBtn = bottomBtn; + [self.mainScrollView addSubview:bottomBtn]; + + + UIButton * useBtn = [[UIButton alloc] initWithFrame:CGRectMake( self.mainScrollView.width/2 + kRealValue(15) , detailView.bottom + kRealValue(28), self.mainScrollView.width/2 - kRealValue(30) , 35)]; + [useBtn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside]; + useBtn.backgroundColor = UIColorHex(#21BEBD); + [useBtn setTitle:@"直接使用" forState:UIControlStateNormal]; + useBtn.layer.cornerRadius = 17; + useBtn.layer.masksToBounds = YES; + useBtn.titleLabel.font = SYSTEMFONT(14); + [useBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.useBtn = useBtn; + [self.mainScrollView addSubview:useBtn]; + + + //保存并使用 + UIButton * saveAnduseBtn = [[UIButton alloc] initWithFrame:CGRectMake( self.mainScrollView.width/2 + kRealValue(15) , detailView.bottom + kRealValue(28), self.mainScrollView.width/2 - kRealValue(30) , 35)]; + [saveAnduseBtn addTarget:self action:@selector(saveAnduseAction) forControlEvents:UIControlEventTouchUpInside]; + saveAnduseBtn.backgroundColor = UIColorHex(#21BEBD); + [saveAnduseBtn setTitle:@"保存并使用" forState:UIControlStateNormal]; + saveAnduseBtn.layer.cornerRadius = 17; + saveAnduseBtn.centerX = self.view.centerX; + saveAnduseBtn.layer.masksToBounds = YES; + saveAnduseBtn.titleLabel.font = SYSTEMFONT(14); + [saveAnduseBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.saveAnduseBtn = saveAnduseBtn; + self.saveAnduseBtn.hidden = true; + [self.mainScrollView addSubview:saveAnduseBtn]; + + mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), bottomBtn.bottom + 50); + + if (self.isEdit == false) { + + self.detailView.userInteractionEnabled = false; + + self.detailView.isEdit = self.isEdit; + } + +} + +- (void)detailViewFrameChage:(NSNotification *)nofi { + + self.detailView.height = [nofi.object floatValue]; + self.bottomBtn.top = self.detailView.bottom + kRealValue(28); + self.useBtn.top = self.bottomBtn.top; + self.saveAnduseBtn.top = self.detailView.bottom + kRealValue(28); + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), self.bottomBtn.bottom + 50); + +} + +- (void)questionOneSelectedResult:(NSString *)result { + if ([result containsString:@"一周内"]) { + self.chixuTime = 1; + } + if ([result containsString:@"一个月内"]) { + self.chixuTime = 2; + } + if ([result containsString:@"半年内"]) { + self.chixuTime = 3; + } + if ([result containsString:@"半年以上"]) { + self.chixuTime = 4; + } + +} + + +- (void)choosePhotoCell:(NSIndexPath *)index withCollectview:(UICollectionView *)collectView withIntab:(NSInteger )tableAtNumber +{ + + if (self.selectedPhotos.count == 9) + { + return; + } + + if (index.row == _selectedPhotos.count) { + [self presentViewController:self.sheetVC animated:YES completion:nil]; + + } else { // preview photos or video / 预览照片或者视频 + + + + id asset = _selectedPhotos[index.item]; + if ([asset isKindOfClass:[NSString class]]) { + NSMutableArray * phonsArray = [[NSMutableArray alloc] init]; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,asset]; + + NSString * str1 = @"\\"; + // + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [phonsArray addObject:encodedString3]; + + XLPhotoBrowser *browser = [XLPhotoBrowser showPhotoBrowserWithImages:phonsArray currentImageIndex:0]; + browser.browserStyle = XLPhotoBrowserStyleSimple; // 微博样式 + // 自定义pageControl的一些属性 + browser.pageDotColor = [UIColor purpleColor]; ///< 此属性针对动画样式的pagecontrol无效 + browser.currentPageDotColor = [UIColor greenColor]; + browser.pageControlStyle = XLPhotoBrowserPageControlStyleClassic;///< 修改底部pagecontrol的样式为系统样式,默认是弹性动画的样式 + }else + { + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedAssets index:_selectedAssets.count - 1]; + imagePickerVc.maxImagesCount = maxPhotoesCount; + imagePickerVc.allowPickingOriginalPhoto = YES; + imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { + self.selectedPhotos = [NSMutableArray arrayWithArray:photos]; + self.selectedAssets = [NSMutableArray arrayWithArray:assets]; + _isSelectOriginalPhoto = isSelectOriginalPhoto; + self.detailView.photoArray = self.selectedPhotos; + // collectView.contentSize = CGSizeMake(self.selectedPhotos.count * ( 12 + 60), 84); + }]; + [self presentViewController:imagePickerVc animated:YES completion:nil]; + } + + } + + +} + + +#pragma mark--- UIImageImagePickerController delegate + +- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { + [picker dismissViewControllerAnimated:YES completion:nil]; + NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; + if ([type isEqualToString:@"public.image"]) { + TZImagePickerController *tzImagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; + tzImagePickerVc.sortAscendingByModificationDate = YES; + [tzImagePickerVc showProgressHUD]; + UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; + // save photo and get asset / 保存图片,获取到asset + [[TZImageManager manager] savePhotoWithImage:image completion:^(PHAsset *asset, NSError *error) { + if (error) { + [tzImagePickerVc hideProgressHUD]; + } else { + + [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:NO completion:^(TZAlbumModel *model) { + [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray *models) { + [tzImagePickerVc hideProgressHUD]; + TZAssetModel *assetModel = [models firstObject]; + if (tzImagePickerVc.sortAscendingByModificationDate) { + assetModel = [models lastObject]; + } + [self refreshCollectionViewWithAddedAsset:assetModel.asset image:image]; + }]; + }]; + } + }]; + + + } +} + + +- (void)refreshCollectionViewWithAddedAsset:(id)asset image:(UIImage *)image { + [self.selectedAssets addObject:asset]; + [self.selectedPhotos addObject:image]; + +// .pictureArray = [NSMutableArray arrayWithArray:self.selectedPhotos]; +// model.assetArray = [NSMutableArray arrayWithArray:self.selectedAssets]; +// [self.dataArray replaceObjectAtIndex:self.number withObject:model]; + self.detailView.photoArray = self.selectedPhotos; +} + +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { + if ([picker isKindOfClass:[UIImagePickerController class]]) { + [picker dismissViewControllerAnimated:YES completion:nil]; + } +} + + +#pragma mark - TZImagePickerControllerDelegate + +/// User click cancel button +/// 用户点击了取消 +- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker { +} + +// The picker should dismiss itself; when it dismissed these handle will be called. +// If isOriginalPhoto is YES, user picked the original photo. +// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:]. +// The UIImage Object in photos default width is 828px, you can set it by photoWidth property. +// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的代理方法 +// 如果isSelectOriginalPhoto为YES,表明用户选择了原图 +// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:] +// photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它 +- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto { + [self.selectedPhotos addObjectsFromArray:photos]; + [self.againSelectPhoto addObjectsFromArray:photos]; + [self.selectedAssets addObjectsFromArray:assets]; + _isSelectOriginalPhoto = isSelectOriginalPhoto; + +// [self.dataArray replaceObjectAtIndex:self.number withObject:model]; + self.detailView.photoArray = self.selectedPhotos; + // 1.打印图片名字 + [self printAssetsName:assets]; +} + + + +#pragma mark - Private + +/// 打印图片名字 +- (void)printAssetsName:(NSArray *)assets { + NSString *fileName; + for (id asset in assets) { + if ([asset isKindOfClass:[PHAsset class]]) { + PHAsset *phAsset = (PHAsset *)asset; + fileName = [phAsset valueForKey:@"filename"]; + } else if ([asset isKindOfClass:[ALAsset class]]) { + ALAsset *alAsset = (ALAsset *)asset; + fileName = alAsset.defaultRepresentation.filename;; + } + } +} + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return UIInterfaceOrientationMaskPortrait; +} + +#pragma mark===按钮点击方法 + +//删除按钮 +- (void)delectUserChoosePhoto:(NSInteger)indexTag withIntab:(NSInteger)tableAtNumber +{ + [self.selectedPhotos removeObjectAtIndex:indexTag]; + self.detailView.photoArray = self.selectedPhotos; +} + +//提交按钮 +-(void)editAction:(UIButton *)sender{ + self.isEdit = true; + self.useBtn.hidden = true; + self.bottomBtn.hidden = true; + self.saveAnduseBtn.hidden = false; + self.detailView.userInteractionEnabled = true; + self.detailView.isEdit = self.isEdit; + +} + +#pragma mark - 网络请求 + +- (void)getFileDetail { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + if (!ValidStr(self.danganID) ) { + [parmDic setObject:self.danganID forKey:@"id"]; + }else + { + [parmDic setObject:self.disModel.tfper_id forKey:@"id"]; + } + + JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"FILEDATA" NeedToken:@""]; + + [upApi GetLookModficalMemberShipFileData:parmDic]; + +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + if ([tag isEqualToString:@"FILEDATA"]) { + + LookFileDataModel * model = [LookFileDataModel modelWithDictionary:response]; + self.lookModel = model; + self.titleview.timeString = model.createTime; + if (!ValidStr(model.image)) { + NSArray * imageArray = [model.image componentsSeparatedByString:@","]; + self.number = imageArray.count; + [self.selectedPhotos addObjectsFromArray:imageArray]; + } + self.detailView.model = model; + self.detailView.photoArray = self.selectedPhotos; + self.detailView.isEdit = self.isEdit; + self.selectedDanganID = model.file_id; + [self questionOneSelectedResult:model.haveTimeValue]; + } + + if ([tag isEqualToString:@"UPLOADAPI"]) + { + + NSArray * array = response; + + [self.imageUrlArray addObjectsFromArray:array]; + [self hiddenAllMBProgressHUD]; + [self submitFileIpputData]; + } + + if ([tag isEqualToString:@"ADDFILE"]) + { + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:response]; + [self.navigationController popViewControllerAnimated:YES]; + } + if ([tag isEqualToString:@"ageinADDFILE"]) { + [self hiddenAllMBProgressHUD]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init] ; + + [parmDic setObject:self.upID forKey:@"memberId"]; + [parmDic setObject:self.doctorID forKey:@"toAccount"]; + [parmDic setObject:self.downID forKey:@"medicalRecordsId"]; + if (self.questionType == 1) { + [self showMBProgressHUDWithString:@"等待发起会话" autoHidden:NO]; + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"PICTURE" NeedToken:@""]; + [questionApi postPictureQuestionAPI:parmDic]; + + } + + if (self.questionType == 2) { + //音视频 + // schedulingDateId 时间id memberId 家庭成员id toAccount医生id contentType 2 medicalRecordsId 档案id + [self showMBProgressHUDWithString:@"预约中请等待~" autoHidden:NO]; + [parmDic setObject:@"2" forKey:@"contentType"]; + [parmDic setObject:self.schedulingDateId forKey:@"schedulingDateId"]; + + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"VIDEO" NeedToken:@""]; + [questionApi postVideoQuestionAPI:parmDic]; + } + } + if ([tag isEqualToString:@"saveAPI"]) { + + NSArray * array = response; + + [self.imageUrlArray addObjectsFromArray:array]; + + [self editFileSendQuestion]; + + + } + + + if ([tag isEqualToString:@"PICTURE"]) { + + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + NSDictionary * resDic = response; + + SOSGroupIMModel * model = [SOSGroupIMModel modelWithDictionary:response]; + + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = model.groupId; + chatVC.member = model.member; + chatVC.disModel = self.infomodel; + chatVC.pictureEnd_id = model.sosEnd_id; + chatVC.questionType = 2; + chatVC.JumpType = self.isJump; + chatVC.dangan_id = self.selectedDanganID; + chatVC.kuaisuzixun = [NSString stringWithFormat:@"%ld",self.isJump]; + chatVC.isVideo = NO; + [self.navigationController pushViewController:chatVC animated:YES]; + + } + + if ([tag isEqualToString:@"VIDEO"]) { + + NSString * resultString = response; + DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; + doctorVC.yuyue_id = resultString; + doctorVC.popType = 1; + [self.navigationController pushViewController:doctorVC animated:YES]; + } + if ([tag isEqualToString:@"loginIMAPI"]) { + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + [self sureAction]; + + } +} + +- (void)loginImAccount { + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} + +- (void)submitFileIpputData { + + + //档案名称 + if (ValidStr(self.detailView.fileNameField.text)) { + [EasyTextView showErrorText:@"请输入档案名称"]; + return; + } + NSString * fileName = self.detailView.fileNameField.text; + //本次问题持续多久 + if (self.chixuTime < 0) { + [EasyTextView showErrorText:@"请选择持续时间"]; + return; + } + //描述问题 + if (ValidStr(self.detailView.inputQuestion1View.text)) { + [EasyTextView showErrorText:@"请输入问题描述"]; + return; + } + NSString * questionString = self.detailView.inputQuestion1View.text; + //图片 + NSString * imageString; + if (self.imageUrlArray.count >0) { + + imageString = [NSString stringWithFormat:@"%@,%@",self.lookModel.image,[ self.imageUrlArray componentsJoinedByString:@","]] ; + }else + { + imageString = self.lookModel.image; + } + //是否就诊过 + if (self.detailView.jiuzhenIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否就诊过"]; + return; + } + NSString * isJiuzhen = self.detailView.jiuzhenSelected == YES ? @"1":@"0"; + //就诊过医院 + NSString * hospationString = @""; + NSString * hospationResult = @""; + if ([isJiuzhen integerValue] == 1) + { + hospationString = self.detailView.hospitalField.text ; + //诊断结果 + hospationResult = self.detailView.sicksField.text; + } + //期待得到的帮助 + NSString * helpString = self.detailView.helpInputView.text; + //是否允许专家查看体检报告 + if (self.detailView.reportIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否允许查看报告"]; + return; + } +// BOOL lookReport = self.detailView.reportSelected; + NSString * lookReport = self.detailView.reportSelected == YES ? @"1":@"0"; + +// //是否允许专家查看你的基本信息 +// if (self.detailView.healthIsAction == NO ) { +// [EasyTextView showErrorText:@"请选择是否允许专家查看基本健康信息"]; +// return; +// } +// BOOL basicHealth = self.detailView.healthSelected; + //成员id + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:fileName forKey:@"recordsName"]; + [parmDic setObject:questionString forKey:@"medicalDescribe"]; + [parmDic setObject:imageString forKey:@"image"]; + [parmDic setObject:@(self.chixuTime) forKey:@"haveTime"]; + [parmDic setObject:helpString forKey:@"desire"]; + [parmDic setObject:self.infomodel.memberId_id forKey:@"memberId"]; + [parmDic setObject:isJiuzhen forKey:@"tfLook"]; + [parmDic setObject:@"0" forKey:@"tfPermission"]; + [parmDic setObject:hospationString forKey:@"lookOffice"]; + [parmDic setObject:hospationResult forKey:@"lookMedicalName"]; + + + [self showMBProgressHUDWithString:@"档案上传中,请稍候..." autoHidden:NO]; + JKCQAPI * addApi = [[JKCQAPI alloc] init:self tag:@"ADDFILE" NeedToken:@""]; + + [addApi PostMemberShipFileData:parmDic]; + + +} +#pragma mark:直接使用 +- (void)sureAction { + + if ([[self.useBtn currentTitle] isEqualToString:@"直接使用"]) { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init] ; + + [parmDic setObject:self.upID forKey:@"memberId"]; + [parmDic setObject:self.doctorID forKey:@"toAccount"]; + [parmDic setObject:self.downID forKey:@"medicalRecordsId"]; + if (self.questionType == 1) { + self.isJump = 2; + [self showMBProgressHUDWithString:@"等待发起会话" autoHidden:NO]; + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"PICTURE" NeedToken:@""]; + [questionApi postPictureQuestionAPI:parmDic]; + + } + + if (self.questionType == 2) { + //音视频 + // schedulingDateId 时间id memberId 家庭成员id toAccount医生id contentType 2 medicalRecordsId 档案id + [self showMBProgressHUDWithString:@"预约中请等待~" autoHidden:NO]; + [parmDic setObject:@"2" forKey:@"contentType"]; + [parmDic setObject:self.schedulingDateId forKey:@"schedulingDateId"]; + + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"VIDEO" NeedToken:@""]; + [questionApi postVideoQuestionAPI:parmDic]; + } + }else //确认提交 + { + if (self.selectedPhotos.count <= 0) { + + [EasyTextView showErrorText:@"请选择图片"]; + return; + } + + if (ValidStr(self.detailView.fileNameField.text)) { + [EasyTextView showErrorText:@"请输入档案名称"]; + return; + } + NSString * fileName = self.detailView.fileNameField.text; + //本次问题持续多久 + if (self.chixuTime < 0) { + [EasyTextView showErrorText:@"请选择持续时间"]; + return; + } + //描述问题 + if (ValidStr(self.detailView.inputQuestion1View.text)) { + [EasyTextView showErrorText:@"请输入问题描述"]; + return; + } + NSString * questionString = self.detailView.inputQuestion1View.text; + //图片 + + NSString * imageString = [ self.imageUrlArray componentsJoinedByString:@","]; + //是否就诊过 + if (self.detailView.jiuzhenIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否就诊过"]; + return; + } + //就诊过医院 + //诊断结果 + //期待得到的帮助 + //是否允许专家查看体检报告 + if (self.detailView.reportIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否允许查看报告"]; + return; + } + + [self showMBProgressHUDWithString:@"上传中" autoHidden:NO]; + + [self.againSelectPhoto removeAllObjects]; + + JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"UPLOADAPI" NeedToken:@""]; + for (int i = 0; i < self.selectedPhotos.count; i ++ ) { + + if ([self.selectedPhotos[i] isKindOfClass:[NSString class]]) { + + + }else + { + [self.againSelectPhoto addObject:self.selectedPhotos[i]]; + } + } + + + [upApi postImageArrayUpload:self.againSelectPhoto withParmDic:@{@"biz":@""}.mutableCopy]; + + } +} +#pragma mark:保存并使用 +- (void)saveAnduseAction { + + self.isJump = 2; + if (ValidStr(self.detailView.fileNameField.text)) { + [EasyTextView showErrorText:@"请输入档案名称"]; + return; + } + //本次问题持续多久 + if (self.chixuTime < 0) { + [EasyTextView showErrorText:@"请选择持续时间"]; + return; + } + //描述问题 + if (ValidStr(self.detailView.inputQuestion1View.text)) { + [EasyTextView showErrorText:@"请输入问题描述"]; + return; + } + NSString * questionString = self.detailView.inputQuestion1View.text; + //图片 + NSString * imageString = [ self.imageUrlArray componentsJoinedByString:@","]; + //是否就诊过 + if (self.detailView.jiuzhenIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否就诊过"]; + return; + } + //就诊过医院 + //诊断结果 + //期待得到的帮助 + //是否允许专家查看体检报告 +// if (self.detailView.reportIsAction == NO ) { +// [EasyTextView showErrorText:@"请选择是否允许查看报告"]; +// return; +// } + + [self showMBProgressHUDWithString:@"上传中" autoHidden:NO]; + + [self.againSelectPhoto removeAllObjects]; + + if (self.selectedPhotos.count > 0) { + + JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"saveAPI" NeedToken:@""]; + [self.imageUrlArray removeAllObjects]; + for (int i = 0; i < self.selectedPhotos.count; i ++ ) { + + if ([self.selectedPhotos[i] isKindOfClass:[NSString class]]) { + + [self.imageUrlArray addObject:self.selectedPhotos[i]]; + + }else + { + [self.againSelectPhoto addObject:self.selectedPhotos[i]]; + } + } + + if (self.againSelectPhoto.count > 0) { + + [upApi postImageArrayUpload:self.againSelectPhoto withParmDic:@{@"biz":@""}.mutableCopy]; + } + else + { + [self editFileSendQuestion]; + } + }else + { + [self editFileSendQuestion]; + } +} + +- (void)editFileSendQuestion { + + //档案名称 + if (ValidStr(self.detailView.fileNameField.text)) { + [EasyTextView showErrorText:@"请输入档案名称"]; + return; + } + NSString * fileName = self.detailView.fileNameField.text; + //本次问题持续多久 + if (self.chixuTime < 0) { + [EasyTextView showErrorText:@"请选择持续时间"]; + return; + } + //描述问题 + if (ValidStr(self.detailView.inputQuestion1View.text)) { + [EasyTextView showErrorText:@"请输入问题描述"]; + return; + } + NSString * questionString = self.detailView.inputQuestion1View.text; + //图片 + NSString * imageString; + if (self.imageUrlArray.count > 0) { + imageString = [NSString stringWithFormat:@"%@",[ self.imageUrlArray componentsJoinedByString:@","]] ; + + }else + { + //图片变动 + imageString = [self.selectedPhotos componentsJoinedByString:@","]; + } + + + //是否就诊过 + if (self.detailView.jiuzhenIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否就诊过"]; + return; + } + NSString * isJiuzhen = self.detailView.jiuzhenSelected == YES ? @"1":@"0"; + //就诊过医院 + NSString * hospationString = @""; + NSString * hospationResult = @""; + if ([isJiuzhen integerValue] == 1) + { + hospationString = self.detailView.hospitalField.text ; + //诊断结果 + hospationResult = self.detailView.sicksField.text; + } + //期待得到的帮助 + NSString * helpString = self.detailView.helpInputView.text; + //是否允许专家查看体检报告 + if (self.detailView.reportIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否允许查看报告"]; + return; + } +// BOOL lookReport = self.detailView.reportSelected; + NSString * lookReport = self.detailView.reportSelected == YES ? @"1":@"0"; + +// //是否允许专家查看你的基本信息 +// if (self.detailView.healthIsAction == NO ) { +// [EasyTextView showErrorText:@"请选择是否允许专家查看基本健康信息"]; +// return; +// } +// BOOL basicHealth = self.detailView.healthSelected; + //成员id + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:fileName forKey:@"recordsName"]; + [parmDic setObject:questionString forKey:@"medicalDescribe"]; + [parmDic setObject:imageString forKey:@"image"]; + [parmDic setObject:@(self.chixuTime) forKey:@"haveTime"]; + [parmDic setObject:helpString forKey:@"desire"]; + [parmDic setObject:self.infomodel.memberId_id forKey:@"memberId"]; + [parmDic setObject:isJiuzhen forKey:@"tfLook"]; + [parmDic setObject:lookReport forKey:@"tfPermission"]; + [parmDic setObject:hospationString forKey:@"lookOffice"]; + [parmDic setObject:hospationResult forKey:@"lookMedicalName"]; + [parmDic setObject:self.disModel.tfper_id forKey:@"id"]; + + + [self showMBProgressHUDWithString:@"更新档案中,请稍候..." autoHidden:NO]; + JKCQAPI * addApi = [[JKCQAPI alloc] init:self tag:@"ageinADDFILE" NeedToken:@""]; + + [addApi PostMemberShipFileData:parmDic]; + + +} +//点击屏幕空白处 +-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + //回收键盘,两者方式 + //UITextView *textView = (UITextView*)[self.view viewWithTag:1001]; + //[textView resignFirstResponder]; + [self.view endEditing:YES]; +} + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuesstionDetailLookFileViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuesstionDetailLookFileViewController.h new file mode 100644 index 0000000..7168b14 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuesstionDetailLookFileViewController.h @@ -0,0 +1,18 @@ +// +// QuesstionDetailLookFileViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/18. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuesstionDetailLookFileViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * danganID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuesstionDetailLookFileViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuesstionDetailLookFileViewController.m new file mode 100644 index 0000000..169bad4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuesstionDetailLookFileViewController.m @@ -0,0 +1,580 @@ +// +// QuesstionDetailLookFileViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/18. +// + +#import "QuesstionDetailLookFileViewController.h" +#import "DetailTitleView.h" +#import "DetailUserInfoView.h" +#import "FileDataDeatilCenterView.h" +#import "BasicHealthInfoView.h" +#import "SelectedFileDateCenterView.h" +#import "QuestionItemTable.h" +#import "HQPhotoCollectView.h" +#import "FileDataModel.h" +#import "LookFileDataModel.h" +#import "SOSGroupIMModel.h" +#import "DoctorReportModel.h" +#import "XLPhotoBrowser.h" + +@interface QuesstionDetailLookFileViewController () + +@property (nonatomic, strong) DetailTitleView * titleview; + + +@property (nonatomic, strong) LookFileDataModel * lookModel; + +@property (nonatomic, strong) UIScrollView * mainScrollView; +@property (nonatomic, strong) DetailUserInfoView * userView ; +@property (nonatomic, strong) UIView * questionView ; +@property (nonatomic, strong) UILabel * oneAnswerLabel ; +@property (nonatomic, strong) UILabel * twoAnswerLabel; +@property (nonatomic, strong) UITextView * twoAnswerTextView ; +@property (nonatomic, strong) UITextView * fourAnswerTextView ; + +@property (nonatomic, strong) UILabel * pictureNumberLabel ; + +@property (nonatomic, strong) UIView * picShowView ; +@property (nonatomic, strong) UIView * hospationView ; +@property (nonatomic, strong) UILabel * hospationNameLabel ; +@property (nonatomic, strong) UILabel * sicksLabel; +@property (nonatomic, strong) NSMutableArray * healthArray; +@property (nonatomic, strong) UILabel * fourLabel; +@property (nonatomic, strong) UILabel * nameAnswerLabel; +@property (nonatomic, strong) UIView * healthView ; +@property (nonatomic, strong) UIView * pictureView ; +@property (nonatomic, strong) UIView * fourBackView ; + +@property (nonatomic, strong) UILabel * sickLeftLabel; +@property (nonatomic, strong) NSMutableArray * imageURLArray; + +@end + +@implementation QuesstionDetailLookFileViewController + +- (NSMutableArray *)healthArray { + + if (!_healthArray) { + _healthArray = [[NSMutableArray alloc] init]; + } + return _healthArray; + +} + +- (NSMutableArray *)imageURLArray { + + if (!_imageURLArray) { + _imageURLArray = [[NSMutableArray alloc] init]; + } + return _imageURLArray; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = UIColorHex(#E0E0E0); + self.isHidenNaviBar = false; + self.navigationItem.title = @"档案详情"; + [self createUI]; + [self getFileDetail]; + //网络状态监听 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(detailViewFrameChage:) + name:@"FrameChage" + object:nil]; + // Do any additional setup after loading the view. +} + +- (void)detailViewFrameChage:(NSNotification *)nofi { + +// self.detailView.height = [nofi.object floatValue]; +// self.bottomBtn.top = self.detailView.bottom + kRealValue(28); +// self.mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), self.bottomBtn.bottom + 50); + +} + +- (void)createUI { + + UIImageView * topImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)]; + topImage.image = [UIImage imageNamed:@"questionDetailBack"]; + [self.view addSubview:topImage]; + + + + UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight )]; + mainScrollView.showsVerticalScrollIndicator = false; + mainScrollView.showsHorizontalScrollIndicator = false; + mainScrollView.layer.cornerRadius = 8.0; + mainScrollView.layer.masksToBounds = true; + self.mainScrollView = mainScrollView; + mainScrollView.backgroundColor = KClearColor; + [self.view addSubview:mainScrollView]; + + DetailTitleView * titleview = [[DetailTitleView alloc] initWithFrame:CGRectMake(0, 0, mainScrollView.width, 33)]; + self.titleview = titleview; + [mainScrollView addSubview:titleview]; + + DetailUserInfoView * infoView = [[DetailUserInfoView alloc] initWithFrame:CGRectMake(0, titleview.bottom, kScreenWidth - kRealValue(30), kRealValue(103))]; + infoView.backgroundColor = KWhiteColor; + self.userView = infoView; + [mainScrollView addSubview:infoView]; + //问题UI + + + UIView * questionView = [[UIView alloc] initWithFrame:CGRectMake(0, infoView.bottom + kRealValue(10), mainScrollView.width, 500)]; + [mainScrollView addSubview:questionView]; + questionView.layer.cornerRadius = 10; + self.questionView = questionView; + self.questionView.backgroundColor = KWhiteColor; + [mainScrollView addSubview:self.questionView]; + + + UILabel * fileNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), kRealValue(24), mainScrollView.width - kRealValue(40), 15)]; + fileNameLabel.text = @"1.档案名称"; + fileNameLabel.textColor = CFontColor1; + fileNameLabel.font = MEDIUMFONT(14); + fileNameLabel.textAlignment = NSTextAlignmentLeft; + [questionView addSubview:fileNameLabel]; + + UILabel * nameAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,fileNameLabel.bottom + kRealValue(15), mainScrollView.width , 35)]; + nameAnswerLabel.text = @" "; + nameAnswerLabel.textColor = CFontColor1; + nameAnswerLabel.font = SYSTEMFONT(12); + nameAnswerLabel.textAlignment = NSTextAlignmentLeft; + nameAnswerLabel.backgroundColor = RGBA(128, 153, 153,0.2); + self.nameAnswerLabel = nameAnswerLabel; + [questionView addSubview:nameAnswerLabel]; + UIView * nameLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + nameLineView.backgroundColor = UIColorHex(#809999); + [nameAnswerLabel addSubview:nameLineView]; + + //问题2 + + UILabel * oneLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), nameAnswerLabel.bottom + kRealValue(24), mainScrollView.width - kRealValue(40), 15)]; + oneLabel.text = @"2.本次问题持续多久了?"; + oneLabel.textColor = CFontColor1; + oneLabel.font = MEDIUMFONT(14); + oneLabel.textAlignment = NSTextAlignmentLeft; + [questionView addSubview:oneLabel]; + + UILabel * oneAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,oneLabel.bottom + kRealValue(15), mainScrollView.width , 35)]; + oneAnswerLabel.text = @" 一周内"; + oneAnswerLabel.textColor = CFontColor1; + oneAnswerLabel.font = SYSTEMFONT(12); + oneAnswerLabel.textAlignment = NSTextAlignmentLeft; + oneAnswerLabel.backgroundColor = RGBA(128, 153, 153,0.2); + self.oneAnswerLabel = oneAnswerLabel; + [questionView addSubview:oneAnswerLabel]; + UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + leftView.backgroundColor = UIColorHex(#809999); + [oneAnswerLabel addSubview:leftView]; + + //问题3 + UILabel * questionThreeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), oneAnswerLabel.bottom + kRealValue(16), mainScrollView.width - kRealValue(40), 15)]; + questionThreeLabel.text = @"3.咨询人的问题"; + questionThreeLabel.textColor = CFontColor1; + questionThreeLabel.font = MEDIUMFONT(14); + questionThreeLabel.textAlignment = NSTextAlignmentLeft; + [questionView addSubview:questionThreeLabel]; + + self.twoAnswerTextView = [[UITextView alloc] initWithFrame:CGRectMake(kRealValue(15),questionThreeLabel.bottom + kRealValue(16), mainScrollView.width - kRealValue(30), 70)]; + self.twoAnswerTextView .text = @"--"; + self.twoAnswerTextView .textColor = CFontColor1; + self.twoAnswerTextView .font = SYSTEMFONT(12); + self.twoAnswerTextView .textAlignment = NSTextAlignmentLeft; + self.twoAnswerTextView .backgroundColor = UIColorHex(#F3F3F5); + self.twoAnswerTextView.layer.cornerRadius = 10; + self.twoAnswerTextView.editable=NO; + self.twoAnswerTextView.layer.masksToBounds = YES; + [questionView addSubview:self.twoAnswerTextView ]; + +// //照片view + UIView * pictureView = [[UIView alloc] initWithFrame:CGRectMake(0, self.twoAnswerTextView.bottom + kRealValue(16), mainScrollView.width, 100)]; + [mainScrollView addSubview:pictureView]; + self.pictureView = pictureView; + self.pictureView.backgroundColor = KWhiteColor; + [questionView addSubview:self.pictureView]; + + + UILabel * pictureLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(kRealValue(15)), 0, 125, 12)]; + pictureLabel.text = @"检查报告或者患处照片"; + pictureLabel.textColor = CFontColor1; + pictureLabel.font = SYSTEMFONT(12); + pictureLabel.textAlignment = NSTextAlignmentLeft; + [self.pictureView addSubview:pictureLabel]; + + UILabel * pictureRearLabel = [[UILabel alloc] initWithFrame:CGRectMake(pictureLabel.right + 5, 0, mainScrollView.width - kRealValue(40), 12)]; + pictureRearLabel.text = @"(仅自己和医生可见)"; + pictureRearLabel.textColor = CFontColor1; + pictureRearLabel.font = SYSTEMFONT(11); + pictureLabel.textAlignment = NSTextAlignmentLeft; + [self.pictureView addSubview:pictureRearLabel]; + + self.pictureNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(mainScrollView.width - 110,0,100, 15)]; + self.pictureNumberLabel.text = @"0/9"; + self.pictureNumberLabel.textColor = UIColorHex(#999999); + self.pictureNumberLabel.font = SYSTEMFONT(14); + self.pictureNumberLabel.textAlignment = NSTextAlignmentRight; + [self.pictureView addSubview: self.pictureNumberLabel]; + + UIView * picShowView = [[UIView alloc] initWithFrame:CGRectMake(0, self.pictureNumberLabel.bottom + 14, mainScrollView.width, 70)]; + picShowView.backgroundColor = KWhiteColor; + self.picShowView = picShowView; + [self.pictureView addSubview:picShowView]; +// + //医院view + UIView * fourBackView = [[UIView alloc] initWithFrame:CGRectMake(0, self.pictureView.bottom + kRealValue(16), mainScrollView.width, 50)]; + self.fourBackView = fourBackView; + [questionView addSubview:fourBackView]; + + + UILabel * threeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), 0, mainScrollView.width - kRealValue(40), 15)]; + threeLabel.text = @"4.咨询人是否去医院就诊过?"; + threeLabel.textColor = CFontColor1; + threeLabel.font = MEDIUMFONT(14); + threeLabel.textAlignment = NSTextAlignmentLeft; + [fourBackView addSubview:threeLabel]; + + UILabel * twoAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,threeLabel.bottom + kRealValue(16), mainScrollView.width, 35)]; + twoAnswerLabel.text = @" 就诊过"; + twoAnswerLabel.textColor = CFontColor1; + twoAnswerLabel.font = SYSTEMFONT(12); + self.twoAnswerLabel = twoAnswerLabel; + twoAnswerLabel.textAlignment = NSTextAlignmentLeft; + twoAnswerLabel.backgroundColor = RGBA(128, 153, 153, 0.2); + [fourBackView addSubview:twoAnswerLabel]; + + UIView * leftThreeView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + leftThreeView.backgroundColor = UIColorHex(#809999); + [twoAnswerLabel addSubview:leftThreeView]; +// mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), bottomBtn.bottom + 50); + + self.hospationView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(10), self.twoAnswerLabel.bottom + kRealValue(15), mainScrollView.width - kRealValue(20), 70)]; + self.hospationView.layer.cornerRadius = 10; + self.hospationView.hidden = true; + self.hospationView.layer.masksToBounds = YES; + [fourBackView addSubview: self.hospationView]; + + + + UILabel * hosLeftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(12), mainScrollView.width - kRealValue(40), 13)]; + hosLeftLabel.text = @"就诊医院及科室:"; + hosLeftLabel.textColor = UIColorHex(#666666); + hosLeftLabel.font = SYSTEMFONT(13); + hosLeftLabel.textAlignment = NSTextAlignmentLeft; + CGFloat hosW = [HQCommonUtils getLengthFromText: @"就诊医院及科室:" andFontSize:13]; + hosLeftLabel.width = hosW; + [self.hospationView addSubview:hosLeftLabel]; + + + self.hospationNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(hosLeftLabel.right + kRealValue(5), kRealValue(12), mainScrollView.width - hosW - 20, 13)]; + self.hospationNameLabel.text = @"--"; + self.hospationNameLabel.textColor = UIColorHex(#333333); + self.hospationNameLabel.font = SYSTEMFONT(14); + self.hospationNameLabel.textAlignment = NSTextAlignmentLeft; + self.hospationNameLabel.numberOfLines = 0; + [self.hospationView addSubview: self.hospationNameLabel]; + + // + UILabel * sickLeftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),hosLeftLabel.bottom + kRealValue(17), mainScrollView.width - kRealValue(40), 13)]; + sickLeftLabel.text = @"诊断的疾病名:"; + sickLeftLabel.textColor = UIColorHex(#666666); + sickLeftLabel.font = SYSTEMFONT(13); + sickLeftLabel.textAlignment = NSTextAlignmentLeft; + self.sickLeftLabel = sickLeftLabel; + CGFloat sickW = [HQCommonUtils getLengthFromText: @"诊断的疾病名:" andFontSize:13]; + sickLeftLabel.width = hosW; + [self.hospationView addSubview:sickLeftLabel]; + + + self.sicksLabel = [[UILabel alloc] initWithFrame:CGRectMake(sickLeftLabel.right + kRealValue(5), hosLeftLabel.bottom + kRealValue(17), mainScrollView.width - sickW - 20, 13)]; + self.sicksLabel.text = @"--"; + self.sicksLabel.textColor = UIColorHex(#333333); + self.sicksLabel.font = SYSTEMFONT(14); + self.sicksLabel.textAlignment = NSTextAlignmentLeft; + self.sicksLabel.numberOfLines = 0; + [self.hospationView addSubview: self.sicksLabel]; + + //得到帮助 + UILabel * fourLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), self.fourBackView.bottom + kRealValue(21), mainScrollView.width - kRealValue(40), 15)]; + fourLabel.text = @"5.咨询人期望得到的帮助?"; + fourLabel.textColor = CFontColor1; + fourLabel.font = SYSTEMFONT(14); + fourLabel.textAlignment = NSTextAlignmentLeft; + self.fourLabel = fourLabel; + [questionView addSubview:fourLabel]; + + self.fourAnswerTextView = [[UITextView alloc] initWithFrame:CGRectMake(kRealValue(20),fourLabel.bottom + kRealValue(16), mainScrollView.width - kRealValue(40), 70)]; + self.fourAnswerTextView .text = @""; + self.fourAnswerTextView .textColor = CFontColor1; + self.fourAnswerTextView .font = SYSTEMFONT(12); + self.fourAnswerTextView .textAlignment = NSTextAlignmentLeft; + self.fourAnswerTextView .backgroundColor = UIColorHex(#F3F3F5); + self.fourAnswerTextView.layer.cornerRadius = 10; + self.fourAnswerTextView.editable=NO; + self.fourAnswerTextView.layer.masksToBounds = YES; + [questionView addSubview:self.fourAnswerTextView ]; + + questionView.height = self.fourAnswerTextView.bottom + kRealValue(10); + mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), questionView.bottom + kRealValue(20)); + + self.healthView = [[UIView alloc] initWithFrame:CGRectMake(0 , questionView.bottom + kRealValue(10), mainScrollView.width, 10)]; + self.healthView.layer.cornerRadius = 10.0; + self.healthView.layer.masksToBounds = YES; + self.healthView.backgroundColor = KWhiteColor; + [mainScrollView addSubview:self.healthView]; + +} + + + +- (UIView *)createInfoView:(NSString *)leftText + leftFrame:(CGRect)frame + rightText:(NSString *)rightText { + + UIView * infoView = [[UIView alloc] initWithFrame:frame]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 15)]; + + leftLabel.text = leftText; + + CGFloat w = [HQCommonUtils getLengthFromText:leftText andFontSize:13]; + + leftLabel.font = SYSTEMFONT(13); + + leftLabel.width = w; + + leftLabel.textColor = UIColorHex(#999999); + + leftLabel.textAlignment = NSTextAlignmentLeft; + + [infoView addSubview:leftLabel]; + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftLabel.right + kRealValue(10), 0, frame.size.width - kRealValue(10), 15)]; + + rightLabel.text = rightText; + + rightLabel.font = SYSTEMFONT(13); + + leftLabel.textColor = CFontColor1; + + rightLabel.textAlignment = NSTextAlignmentLeft; + + [infoView addSubview:rightLabel]; + + + return infoView; + + +} + + +#pragma mark - 网络请求 + +- (void)getFileDetail { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + if (!ValidStr(self.danganID) ) { + [parmDic setObject:self.danganID forKey:@"id"]; + } + + JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"FILEDATA" NeedToken:@""]; + + [upApi GetLookQuestionDetailFileData:parmDic]; + +} + + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + if ([tag isEqualToString:@"FILEDATA"]) { + + DoctorReportModel * model = [DoctorReportModel modelWithDictionary:response]; + + DoctorReportRecordsModel * recordModel = [DoctorReportRecordsModel modelWithDictionary:model.conMedicalRecordsDO]; + + + self.titleview.timeString = recordModel.createTime; + self.oneAnswerLabel.text =[NSString stringWithFormat:@" %@",recordModel.haveTimeValue] ; + self.twoAnswerLabel.text = [NSString stringWithFormat:@" %@",recordModel.tfLookValue]; + self.nameAnswerLabel.text = [NSString stringWithFormat:@" %@",recordModel.recordsName]; + self.fourAnswerTextView.text = [NSString stringWithFormat:@"%@",recordModel.desire]; + self.twoAnswerTextView.text = [NSString stringWithFormat:@"%@",recordModel.medicalDescribe]; + //计算问题高度 + [self adjustTextViewHeightToFitText:self.fourAnswerTextView.text]; + + NSArray * imageArray ; + if (!ValidStr(recordModel.image)) { + imageArray = [recordModel.image componentsSeparatedByString:@","]; + } + if (imageArray.count <= 0) { + self.pictureView.hidden = true; + } + else + { + self.pictureView.hidden = false; + self.pictureView.top = self.twoAnswerTextView.bottom + kRealValue(16); + self.pictureNumberLabel.text = [NSString stringWithFormat:@"%ld/9",imageArray.count]; + CGFloat lastHeight = 0; + CGFloat pading = kRealValue(6); + CGFloat imgW = (self.mainScrollView.width - kRealValue(60) )/ 5 ; + [self.imageURLArray removeAllObjects]; + for (int i = 0 ; i < imageArray.count; i ++) { + CGFloat cow = i/5; + CGFloat lin = i%5; + UIImageView * questionImg = [[UIImageView alloc] initWithFrame:CGRectMake( kRealValue(15) + (imgW + pading) *lin , (imgW + pading) * cow, imgW, imgW)]; + questionImg.userInteractionEnabled = true; + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,imageArray[i]]; + + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [questionImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:PLACEHOLD_IMG]; + + [self.imageURLArray addObject:encodedString3]; + UIButton * btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, questionImg.width, questionImg.height)]; + btn.tag = i; + [btn addTarget:self action:@selector(lookPicture:) forControlEvents:UIControlEventTouchUpInside]; + [questionImg addSubview:btn]; + + [self.picShowView addSubview:questionImg]; + + if (i == imageArray.count - 1) { + lastHeight = questionImg.bottom; + } + } + self.picShowView.height = lastHeight; + + self.pictureView.height = self.picShowView.bottom + kRealValue(16);; + } + //布局 + if ([recordModel.tfLook integerValue] == 0) { //没就诊过 + self.hospationView.hidden = YES; + //布局 + if (self.pictureView.hidden == true) { + self.fourBackView.top = self.twoAnswerTextView.bottom + kRealValue(16); + }else + { + self.fourBackView.top = self.pictureView.bottom + kRealValue(16); + } + self.fourBackView.height = self.twoAnswerLabel.bottom + kRealValue(16); + + self.fourLabel.top = self.fourBackView.bottom + kRealValue(16); + + self.fourAnswerTextView.top = self.fourLabel.bottom + kRealValue(16); + + self.questionView.height = self.fourAnswerTextView.bottom + kRealValue(5); + + self.healthView.top = self.questionView.bottom + kRealValue(10); + + + }else + { + if (self.pictureView.hidden == true) { + + self.fourBackView.top = self.twoAnswerTextView.bottom + kRealValue(16); + }else + { + self.fourBackView.top = self.pictureView.bottom + kRealValue(16); + } + self.hospationView.hidden = false; + self.hospationView.backgroundColor = CViewBgColor; + self.sicksLabel.text = [NSString stringWithFormat:@"%@",recordModel.lookOffice]; + self.sicksLabel.height = [HQCommonUtils getSpaceLabelHeight:self.sicksLabel withStr:self.sicksLabel.text withFont:[UIFont systemFontOfSize:14] withWidth:self.sicksLabel.width withLineSpacing:5]; + + self.hospationNameLabel.text = [NSString stringWithFormat:@"%@",recordModel.lookMedicalName]; + + self.hospationNameLabel.height = [HQCommonUtils getSpaceLabelHeight:self.sicksLabel withStr:self.sicksLabel.text withFont:[UIFont systemFontOfSize:14] withWidth:self.sicksLabel.width withLineSpacing:5]; + + self.sickLeftLabel.top = self.hospationNameLabel.bottom + kRealValue(17); + + self.hospationView.height = self.sicksLabel.bottom + kRealValue(15); + self.fourBackView.height = self.hospationView.bottom + kRealValue(16); + + self.fourLabel.top = self.fourBackView.bottom + kRealValue(16); + self.fourAnswerTextView.top = self.fourLabel.bottom + kRealValue(16); + self.questionView.height = self.fourAnswerTextView.bottom + kRealValue(5); + self.healthView.top = self.questionView.bottom + kRealValue(10); + + } + self.userView.userModel = [DoctorReportFamilyInfoModel modelWithDictionary:model.conFamilyMembersDO]; + + + //健康信息 + CGFloat healthH = CGFLOAT_MIN; + + for (int i = 0 ; i < model.answer.count; i ++) { + + DoctorAnswerModel * ansModel = model.answer[i]; + + UIView * healthView = [self createInfoView:ansModel.answerKey leftFrame:CGRectMake(kRealValue(15), kRealValue(20) + 30 * i,self.healthView.width - kRealValue(30), 13) rightText:ansModel.answerValue]; + + [self.healthView addSubview:healthView]; + + if (i == model.answer.count - 1) { + healthH = healthView.bottom; + } + [self.healthArray addObject:healthView]; + } + if (model.answer.count > 0) { + self.healthView.height = healthH + kRealValue(20); + }else + { + self.healthView.height = CGFLOAT_MIN; + } + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.healthView.bottom + kRealValue(20)); + + + } + +} + +- (void)lookPicture:(UIButton *)currentBtn { + XLPhotoBrowser *browser = [XLPhotoBrowser showPhotoBrowserWithImages:self.imageURLArray currentImageIndex:currentBtn.tag]; + browser.browserStyle = XLPhotoBrowserStyleSimple; // 微博样式 + // 自定义pageControl的一些属性 + browser.pageDotColor = [UIColor purpleColor]; ///< 此属性针对动画样式的pagecontrol无效 + browser.currentPageDotColor = [UIColor greenColor]; + browser.pageControlStyle = XLPhotoBrowserPageControlStyleClassic;///< 修改底部pagecontrol的样式为系统样式,默认是弹性动画的样式 +} + + +- (void)adjustTextViewHeightToFitText:(NSString *)text { + self.fourAnswerTextView.text = text; + if (text.length == 0) { + // Set default height when there's no content + self.fourAnswerTextView.height = kRealValue(30); + } else { + CGSize maxSize = CGSizeMake(self.fourAnswerTextView.frame.size.width, CGFLOAT_MAX); + CGRect textRect = [text boundingRectWithSize:maxSize + options:NSStringDrawingUsesLineFragmentOrigin + attributes:@{NSFontAttributeName:self.fourAnswerTextView.font} + context:nil]; + + // Adjust the UITextView frame based on calculated text height + CGRect newFrame = self.fourAnswerTextView.frame; + newFrame.size.height = textRect.size.height + self.fourAnswerTextView.textContainerInset.top + self.fourAnswerTextView.textContainerInset.bottom; + self.fourAnswerTextView.height = newFrame.size.height; + } +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionMustKnowViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionMustKnowViewController.h new file mode 100644 index 0000000..9c3a7d2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionMustKnowViewController.h @@ -0,0 +1,18 @@ +// +// QuestionMustKnowViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/13. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionMustKnowViewController : HQBaseViewController + +@property (nonatomic, assign) NSInteger popType; //1 图文 0 音视频 2 用户须知 +@property (nonatomic, strong) NSString * doctorId; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionMustKnowViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionMustKnowViewController.m new file mode 100644 index 0000000..4f1f7fd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionMustKnowViewController.m @@ -0,0 +1,252 @@ +// +// QuestionMustKnowViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/13. +// + +#import "QuestionMustKnowViewController.h" +#import "SelectedQuestionViewController.h" +#import "SelectedDoctorTimeVC.h" + +@interface QuestionMustKnowViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) YYLabel * conntLabel; + +@property (nonatomic, strong) UIButton * buzaiButton; +@property (nonatomic, strong) UIButton * yiyueButton; +@property (nonatomic, strong) UIButton * qitianButton; +@property (nonatomic, strong) NSString * showID; + +@end + +@implementation QuestionMustKnowViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = UIColorHex(#EEEEEE); + self.isHidenNaviBar = false; + self.navigationItem.title = @"咨询须知"; + [self createUI]; + [self createData]; + +} + +- (void)createUI { + UIView * centerView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 10, kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight - 18)]; + centerView.backgroundColor = KWhiteColor; + centerView.layer.cornerRadius = 10.0; + centerView.layer.masksToBounds = YES; + [self.view addSubview:centerView]; + + + UIButton * readButton = [[UIButton alloc] initWithFrame:CGRectMake(10, centerView.bottom - 39 - 30, 100, 30)]; + [readButton setTitle:@"我准备好了" forState:UIControlStateNormal]; + [readButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + readButton.titleLabel.font = SYSTEMFONT(12); + readButton.layer.cornerRadius = 15.0; + readButton.layer.masksToBounds = YES; + readButton.layer.borderColor = UIColorHex(#21BEBD).CGColor; + readButton.layer.borderWidth = 1.0f; + readButton.centerX = self.view.centerX; + [readButton addTarget:self action:@selector(readOverAction) forControlEvents:UIControlEventTouchUpInside]; + [centerView addSubview:readButton]; + + // cv战士 + UIButton * monthButton = [[UIButton alloc] initWithFrame:CGRectMake(10, readButton.top - 37 -15, 150, 15)]; + [monthButton setTitle:@" 1个月内不在提醒" forState:UIControlStateNormal]; + monthButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [monthButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [monthButton setImage:[UIImage imageNamed:@"mustKnow_Nomal"] forState:UIControlStateNormal]; + [monthButton setImage:[UIImage imageNamed:@"mustKnow_Selected"] forState:UIControlStateSelected]; + monthButton.titleLabel.font = SYSTEMFONT(12); + self.yiyueButton = monthButton; + [monthButton addTarget:self action:@selector(oneMonthShow:) forControlEvents:UIControlEventTouchUpInside]; + [centerView addSubview:monthButton]; + + + UIButton * dayButton = [[UIButton alloc] initWithFrame:CGRectMake(10, monthButton.top - 13 -15, 150, 15)]; + [dayButton setTitle:@" 7日内不在提醒" forState:UIControlStateNormal]; + dayButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [dayButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [dayButton setImage:[UIImage imageNamed:@"mustKnow_Nomal"] forState:UIControlStateNormal]; + [dayButton setImage:[UIImage imageNamed:@"mustKnow_Selected"] forState:UIControlStateSelected]; + [dayButton addTarget:self action:@selector(severDayShow:) forControlEvents:UIControlEventTouchUpInside]; + dayButton.titleLabel.font = SYSTEMFONT(12); + self.qitianButton = dayButton; + + [centerView addSubview:dayButton]; + + + UIButton * yihouButton = [[UIButton alloc] initWithFrame:CGRectMake(10, dayButton.top - 13 -15, 150, 15)]; + [yihouButton setTitle:@" 以后不在提醒" forState:UIControlStateNormal]; + yihouButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [yihouButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [yihouButton setImage:[UIImage imageNamed:@"mustKnow_Nomal"] forState:UIControlStateNormal]; + [yihouButton setImage:[UIImage imageNamed:@"mustKnow_Selected"] forState:UIControlStateSelected]; + [yihouButton addTarget:self action:@selector(yihouShow:) forControlEvents:UIControlEventTouchUpInside]; + self.buzaiButton = yihouButton; + yihouButton.titleLabel.font = SYSTEMFONT(12); + [centerView addSubview:yihouButton]; + + + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), yihouButton.top - 30)]; + [centerView addSubview:self.mainScrollView]; + + + self.conntLabel = [[YYLabel alloc] initWithFrame:CGRectMake(10, 10, self.mainScrollView.width - 20, 100)]; + self.conntLabel.textAlignment = NSTextAlignmentLeft; + self.conntLabel.font = MEDIUMFONT(13); + self.conntLabel.textColor = UIColorHex(#333333); + self.conntLabel.numberOfLines = 0; + [self.mainScrollView addSubview:self.conntLabel]; + +} + + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + +// [parmDic setObject:self.memberId forKey:@"memberId"]; +// 1 图文 0 音视频 2 用户须知 + [parmDic setObject:[NSString stringWithFormat:@"%d",self.popType] forKey:@"type"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"MEMBERAPI" NeedToken:@""]; + + [detailApi getFoundPopConnetResult :parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [EasyTextView showSuccessText:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"MEMBERAPI"]) { + + + NSDictionary * resDic = response; + if ([resDic.allKeys containsObject:@"id"]) { + self.showID = [NSString stringWithFormat:@"%@",resDic[@"id"]]; + } + + if ([resDic.allKeys containsObject:@"content"]) { + NSMutableAttributedString *text = [NSMutableAttributedString new]; + // 添加文本 + NSString *title = resDic[@"content"]; + + // //富文本 + // [NSString stringWithFormat:@"%@ ",title]; + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[[NSString stringWithFormat:@"%@ ",title] dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + [text appendAttributedString:attrStr]; + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:6]; + [text addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])]; + + self.conntLabel.attributedText = text; + + CGSize maxSize = CGSizeMake(self.conntLabel.width, MAXFLOAT); + + YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:self.conntLabel.attributedText]; + self.conntLabel.textLayout = layout; + CGFloat introHeight = layout.textBoundingSize.height; + self.conntLabel.width = maxSize.width; + // 记录真正的正确高度 + self.conntLabel.height = introHeight; + // 显示文本排版结果 + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - 30, self.conntLabel.bottom); + + } + } + if([tag isEqualToString:@"NOTSHOW"]) { + + + + + if (self.popType == 1) { ////1 图文 0 音视频 2 用户须知 + SelectedQuestionViewController * questionVC = [[SelectedQuestionViewController alloc] init]; + questionVC.doctorID = self.doctorId; + questionVC.questionType = 1; + [self.navigationController pushViewController:questionVC animated:YES]; + } + if (self.popType == 0) { ////1 图文 0 音视频 2 用户须知 + SelectedDoctorTimeVC * timeVC = [[SelectedDoctorTimeVC alloc] init]; + timeVC.doctorId = self.doctorId; + [self.navigationController pushViewController:timeVC animated:YES]; + } + + + + } +} + +- (void)yihouShow:(UIButton *)yihouBtn { + + yihouBtn.selected = true; + self.qitianButton.selected = false; + self.yiyueButton.selected = false; + +} + +- (void)severDayShow:(UIButton *)severBtn { + severBtn.selected = true; + self.buzaiButton.selected = false; + self.yiyueButton.selected = false; + +} + +- (void)oneMonthShow:(UIButton *)monthBtn { + + monthBtn.selected = true; + self.buzaiButton.selected = false; + self.qitianButton.selected = false; +} + +- (void)readOverAction { + + if (self.buzaiButton.selected == false && self.qitianButton.selected == false && self.yiyueButton.selected == false) { + + [EasyTextView showErrorText:@"请选择显示时间"]; + return; + } + NSString * notShow ; + if (self.buzaiButton.selected == true) { + notShow = @"2"; + } + if (self.yiyueButton.selected == true) { + notShow = @"1"; + } + if (self.qitianButton.selected == true) { + notShow = @"0"; + } + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.showID forKey:@"id"]; + [parmDic setObject:notShow forKey:@"notShow"]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"NOTSHOW" NeedToken:@""]; + + [api getSelectedShow:parmDic]; +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionPeopleMangerVC.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionPeopleMangerVC.h new file mode 100644 index 0000000..aa676f3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionPeopleMangerVC.h @@ -0,0 +1,16 @@ +// +// QuestionPeopleMangerVC.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionPeopleMangerVC : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionPeopleMangerVC.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionPeopleMangerVC.m new file mode 100644 index 0000000..83290e5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionPeopleMangerVC.m @@ -0,0 +1,205 @@ +// +// QuestionPeopleMangerVC.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "QuestionPeopleMangerVC.h" +#import "QuestionPeopleManagerTable.h" +#import "QuestionPeopleModel.h" +#import "SelectedQuestionViewController.h" +#import "AddQuestionViewController.h" + + +@interface QuestionPeopleMangerVC () + +@property (nonatomic, strong) QuestionPeopleManagerTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@end + +@implementation QuestionPeopleMangerVC + +#pragma mark:懒加载 + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; + +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + [self.homeTable.mj_header beginRefreshing]; + +} +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = CViewBgColor; + self.isHidenNaviBar = false; + self.pageNo = 1; + self.navigationItem.title = @"咨询人管理"; + [self createUI]; + [self getData]; +} + +- (void)createUI { + + self.homeTable = [[QuestionPeopleManagerTable alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight - SafetyAreaHeight - 45) style:UITableViewStylePlain]; + self.homeTable.backgroundColor = CViewBgColor; + __weak __typeof(self) weakSelf = self; + self.homeTable.xiugaiBlcok = ^(QuestionPeopleModel * _Nullable model) { + + AddQuestionViewController * selcetVC = [[AddQuestionViewController alloc] init]; + selcetVC.questionModel = model; + [weakSelf.navigationController pushViewController:selcetVC animated:true]; + + }; + [self.view addSubview:self.homeTable]; + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + [weakSelf getData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + + [weakSelf getData]; + }]; + + UIButton * addBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 - kRealValue(140) ,kScreenHeight - kTopHeight - SafetyAreaHeight - 45 , kRealValue(130), 45)]; + [addBtn setBackgroundColor:UIColorHex(#21BEBD)]; + [addBtn setTitle:@"新增" forState:UIControlStateNormal]; + [addBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + addBtn.layer.cornerRadius = 16; + addBtn.layer.masksToBounds = true; + [addBtn addTarget:self action:@selector(addQuestionAction) forControlEvents:UIControlEventTouchUpInside]; + addBtn.titleLabel.font = MEDIUMFONT(14); + [self.view addSubview:addBtn]; + + UIButton * delectBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 + kRealValue(10) , kScreenHeight - SafetyAreaHeight - kTopHeight - 45 , addBtn.width, 45)]; + [delectBtn setBackgroundColor:UIColorHex(#FFFFFF)]; + [delectBtn setTitle:@"删除" forState:UIControlStateNormal]; + [delectBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + delectBtn.layer.cornerRadius = 16; + delectBtn.layer.masksToBounds = true; + delectBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + delectBtn.layer.borderWidth = 1; + [delectBtn addTarget:self action:@selector(delectQuestionAction) forControlEvents:UIControlEventTouchUpInside]; + delectBtn.titleLabel.font = MEDIUMFONT(14); + [self.view addSubview:delectBtn]; + + +} + +- (void)getData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * userApi = [[JKCQAPI alloc] init:self tag:@"QUSTION" NeedToken:@""]; + + [userApi getQuestionManagerList:parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_header endRefreshing]; + [self.homeTable.mj_footer endRefreshing]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_header endRefreshing]; + [self.homeTable.mj_footer endRefreshing]; + NSArray * array = response ; + if (self.pageNo == 1 ) { + + [self.dataArray removeAllObjects]; + } + if ([tag isEqualToString:@"QUSTION"]) { + [self hiddenAllMBProgressHUD]; + int i = 0; + for (NSDictionary * dic in array) { + + QuestionPeopleModel * model = [QuestionPeopleModel modelWithDictionary:dic]; + model.isSelected = NO; + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + } + if ([tag isEqualToString:@"DELECT"]) { + [self hiddenAllMBProgressHUD]; + [self.homeTable.mj_header beginRefreshing]; + [self showMBProgressHUDOnlyWithString:response]; + + } +} +#pragma mark:新增咨询人 +- (void)addQuestionAction { + + + AddQuestionViewController * selcetVC = [[AddQuestionViewController alloc] init]; + // + [self.navigationController pushViewController:selcetVC animated:true]; + +// SelectedQuestionViewController * selcetVC = [[SelectedQuestionViewController alloc] init]; +// +// [self.navigationController pushViewController:selcetVC animated:true]; +} + +- (void)delectQuestionAction { + + NSMutableArray * seleArray = [[NSMutableArray alloc] init]; + for (QuestionPeopleModel * mode in self.homeTable.dataArray) { + + if (mode.isSelected == true) { + + [seleArray addObject:mode.people_id]; + } + DLog(@"%ld",mode.isSelected); + } + [self showMBProgressHUDWithString:@"删除中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:seleArray forKey:@"param"]; + + JKCQAPI * userApi = [[JKCQAPI alloc] init:self tag:@"DELECT" NeedToken:@""]; + + [userApi delectedQuestionManagerList:parmDic]; + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionViewController.h new file mode 100644 index 0000000..8dc96c2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionViewController.h @@ -0,0 +1,16 @@ +// +// QuestionViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionViewController.m new file mode 100644 index 0000000..559ee70 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QuestionViewController.m @@ -0,0 +1,787 @@ +// +// QuestionViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import "QuestionViewController.h" +#import "HealthyQuestionTable.h" +#import "HealthyQuestionHeardView.h" +#import "QuestionPeopleMangerVC.h" +#import "FoundExpertViewController.h" +#import "DoctorMainViewController.h" +#import "DoctorRecommendModel.h" +#import "ExpertMainViewController.h" +#import "QustionRecordViewController.h" +#import "ChatViewController.h" +#import "QuesstionDetailLookFileViewController.h" +#import "SmallHelpIMDataModel.h" +#import +#import +#import +#import "PSAppInfo.h" +#import "PSCheckVersionView.h" +#import "RoomDoctorRecordsVC.h" +#import "HomeQusetionRecordsModel.h" +#import "DoctorMainViewController.h" + +@interface QuestionViewController () + +@property (nonatomic, strong) HealthyQuestionTable * homeTable; + +@property (nonatomic, assign) NSInteger page; + +@property (nonatomic, strong) PSCheckVersionView * checkVersionView; +@property (nonatomic, strong) UIView * coverView; +//定位相关 +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, strong) AMapLocationManager *locationManager; +@property (nonatomic, copy) AMapLocatingCompletionBlock completionBlock; +//定位相关 +@property (nonatomic, strong) CLLocationManager * userlocationManager; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation QuestionViewController + +- (NSMutableArray *)dataArray { + + if(!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (UIView *)coverView { + + if (!_coverView) { + _coverView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; + _coverView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5f]; + } + return _coverView; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.userlocationManager = [[CLLocationManager alloc] init]; + self.locationManager.delegate = self; + + // Request the desired authorization + [self.userlocationManager requestWhenInUseAuthorization]; + self.isHidenNaviBar = true; + //IM登录状态 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(updateHomeDate) + name:KNotificAgreeProtoocl + object:nil]; + [self createUI]; + self.page = 1; + [self verifyTokenData]; + [self initCompleteBlock]; + [self configLocationManager]; + [self reGeocodeAction]; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; + [[TUICallEngine createInstance] addObserver:self]; + + +} + +#pragma mark:校验token +- (void)verifyTokenData { + + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + // 获取应用的版本号 + HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + + if (ValidStr(user.token)) { + + [parmDic setObject:@"" forKey:@"token"]; + } + else + { + [parmDic setObject:user.token forKey:@"token"]; + } + JKCQAPI * homeRemakerApi = [[JKCQAPI alloc] init:self tag:@"verifyToken" NeedToken:@""]; + + [homeRemakerApi GetverifyToken:parmDic]; + + +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + if (!ValidStr(UserDefaultObjectForKey(@"HTTPS"))) { + [self verifyTokenData]; + } } + + +- (void)reGeocodeAction +{ + //进行单次带逆地理定位请求 + [self.locationManager requestLocationWithReGeocode:YES completionBlock:self.completionBlock]; +} + + +- (void)configLocationManager +{ + self.locationManager = [[AMapLocationManager alloc] init]; + + [self.locationManager setDelegate:self]; + + //设置期望定位精度 + [self.locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters]; + + //设置不允许系统暂停定位 + [self.locationManager setPausesLocationUpdatesAutomatically:NO]; + + //设置允许在后台定位 + [self.locationManager setAllowsBackgroundLocationUpdates:NO]; + + //设置定位超时时间 + [self.locationManager setLocationTimeout:10]; + + //设置逆地理超时时间 + [self.locationManager setReGeocodeTimeout:3]; + + //设置开启虚拟定位风险监测,可以根据需要开启 + [self.locationManager setDetectRiskOfFakeLocation:NO]; +} + +- (void)cleanUpAction +{ + //停止定位 + [self.locationManager stopUpdatingLocation]; + + [self.locationManager setDelegate:nil]; + +} + + +#pragma mark:更新 +- (void)getUpDateinfo { + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + // 获取应用的版本号 + [parmDic setObject:@"com.question.QinghaiProvince" forKey:@"pkg"]; + + JKCQAPI * homeRemakerApi = [[JKCQAPI alloc] init:self tag:@"UPVERSION" NeedToken:@""]; + [homeRemakerApi getABMUpdate:parmDic]; + + +} + +- (void)initCompleteBlock +{ + self.completionBlock = ^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) + { + if (error != nil && error.code == AMapLocationErrorLocateFailed) + { + //定位错误 +// var mCurrentLat = 34.327271 +// var mCheckToken = false +// var mCurrentLon = 108.949845 + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + [user setObject:@(108.949845) forKey:USERDEFAULLONG]; + [user setObject:@(34.327271) forKey:USERDEFAULLATITUDE]; + [user synchronize]; + return; + } + else if (error != nil + && (error.code == AMapLocationErrorReGeocodeFailed + || error.code == AMapLocationErrorTimeOut + || error.code == AMapLocationErrorCannotFindHost + || error.code == AMapLocationErrorBadURL + || error.code == AMapLocationErrorNotConnectedToInternet + || error.code == AMapLocationErrorCannotConnectToHost)) + { + //逆地理错误:在带逆地理的单次定位中,逆地理过程可能发生错误,此时location有返回值,regeocode无返回值,进行annotation的添加 + } + else if (error != nil && error.code == AMapLocationErrorRiskOfFakeLocation) + { + //存在虚拟定位的风险:此时location和regeocode没有返回值,不进行annotation的添加 + + //存在虚拟定位的风险的定位结果 + __unused CLLocation *riskyLocateResult = [error.userInfo objectForKey:@"AMapLocationRiskyLocateResult"]; + //存在外接的辅助定位设备 + __unused NSDictionary *externalAccressory = [error.userInfo objectForKey:@"AMapLocationAccessoryInfo"]; + + return; + } + else + { + //没有错误:location有返回值,regeocode是否有返回值取决于是否进行逆地理操作,进行annotation的添加 + } + //有无逆地理信息,annotationView的标题显示的字段不一样 + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + [user setObject:@(location.coordinate.longitude) forKey:USERDEFAULLONG]; + [user setObject:@(location.coordinate.latitude) forKey:USERDEFAULLATITUDE]; + [user synchronize]; + + + }; +} + +- (void)backUp { + + [self.navigationController popToRootViewControllerAnimated:YES]; + +} +- (void)createUI { + + self.homeTable = [[HealthyQuestionTable alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; + self.homeTable.backgroundColor = CViewBgColor; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_offset(0); + }]; + + self.homeTable.headDelegate = self; + kWeakSelf(self); + self.homeTable.tableBlock = ^(HomeQusetionRecordsModel * _Nonnull model) { + + //1图文 2视频 + if ([model.contentType intValue] == 2) { + + DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; + doctorVC.yuyue_id = model.records_id; + doctorVC.popType = 1; + [weakself.navigationController pushViewController:doctorVC animated:YES]; + } + if ([model.contentType intValue] == 1) { + + if ([TUILogin isUserLogined]) { + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = model.imId ; + chatVC.eableSendReport = true; + chatVC.eablehaveHelathData = false; + chatVC.navTitle = @"图文咨询"; + chatVC.isVideo = NO; + chatVC.pictureEnd_id = model.records_id; + chatVC.questionType = 2; + chatVC.medicalRecordsId = model.memberId; + if ([model.contentStatus intValue] == 5) { + chatVC.isEveal = true; + }else + { + chatVC.isEveal = false; + } + if ([model.contentStatus intValue] >=4 ) { + chatVC.endRecordType = 100; + } + [weakself.navigationController pushViewController:chatVC animated:YES]; + }else + { + [EasyTextView showErrorText:@"登录过期,请重新登录"]; + } + } + }; + + self.homeTable.lookMoreBlock = ^{ + + [weakself myQuestionAction]; + + }; + + + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + self.page = 1; + [self verifyTokenData]; + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + self.page = 1; + [self verifyTokenData]; + }]; + + //初始化一个emptyView + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImage:[UIImage imageNamed:@"noQuetionList"] + titleStr:@"暂无咨询记录" detailStr:@""]; + + //元素竖直方向的间距 + emptyView.titleLabMargin = kRealValue(5); + emptyView.contentViewY = kRealValue(450); + + emptyView.imageSize = CGSizeMake(kRealValue(101), kRealValue(60)); + //标题颜色 + emptyView.titleLabTextColor =UIColorHex(#14BEBE); + //描述字体 + emptyView.titleLabFont = [UIFont systemFontOfSize:15]; + //按钮背景色 + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; +} + +- (void)updateHomeDate { + + + if (self.homeTable) { + [self chageUrlService]; + + }else + { + [self verifyTokenData]; + [self chageUrlService]; + + } +} + + +- (void)getData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(1) forKey:@"pageNo"]; + [parmDic setObject:@(3) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"RECOMMEND" NeedToken:@""]; + + [searchApi GetQuetsionRecordsList:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} + + +#pragma mark:请求前缀 +- (void)chageUrlService { + + AFHTTPSessionManager *session=[AFHTTPSessionManager manager]; + // AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; + + session.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain", nil]; + //超时时间 + + session.requestSerializer.timeoutInterval= 30.f; + session.responseSerializer = [AFHTTPResponseSerializer serializer]; + + session.requestSerializer = [AFJSONRequestSerializer serializer]; + + session.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + + // 获取应用的版本号 + NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; + // 将版本号按照点(.)分割成数组 + NSArray * components = [version componentsSeparatedByString:@"."]; + + // 获取数组中的最后一个元素 + NSString * lastComponent = [components lastObject]; + // 如果需要将其转换为整数 + NSInteger lastNumber = [lastComponent integerValue]; + [parmDic setObject:@(lastNumber) forKey:@"version"]; + [parmDic setObject:@"com.question.QinghaiProvince" forKey:@"pkg"]; + [session GET:@"https://base.icdat.cn/v2/url" parameters:parmDic headers:@{@"X-ClientSign":@"Quarry"} progress:^(NSProgress * _Nonnull downloadProgress) { + + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + NSString * dataString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; + DLog(@"response\n%@\n",dataString); + NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding]; + + id myResult = [NSJSONSerialization JSONObjectWithData:requestData options:NSJSONReadingMutableContainers error:nil]; + //判断是否为字典 + if ([myResult isKindOfClass:[NSDictionary class]]) { + + NSDictionary *response = (NSDictionary *)myResult; + if ([response.allKeys containsObject:@"result"]) { + NSDictionary * resultDic = [response objectForKey:@"result"]; + + if ([resultDic.allKeys containsObject:@"api"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"api"] forKey:@"HTTPS"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + NSString * apiString = [resultDic objectForKey:@"api"]; + //判断是否正在审 + BOOL isExmine; + if ([apiString containsString:@"api.out.icdat.cn"]) { //正在审 + isExmine = true; + }else + { + isExmine = false; + } + [[NSUserDefaults standardUserDefaults] setObject:@(isExmine) forKey:@"isExmine"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + //版本升级 + //没在审 升级 + if (isExmine == false) { + [self getUpDateinfo]; + } + } + + if ([resultDic.allKeys containsObject:@"h5"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5"] forKey:@"IntervenH5"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + if ([resultDic.allKeys containsObject:@"h5Host"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5Host"] forKey:@"H5DevHost"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + if ([resultDic.allKeys containsObject:@"health"]) { + [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"health"] forKey:@"BASEURL"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + + [self verifyTokenData]; + + } + } + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + //请求超时 + [[NSUserDefaults standardUserDefaults] setObject:@"https://api.cqygjk.com" forKey:@"HTTPS"]; + [[NSUserDefaults standardUserDefaults] setObject:@"https://yyjk.cqygjk.com/" forKey:@"BASEURL"]; + [[NSUserDefaults standardUserDefaults] setObject:@"api.cqygjk.com" forKey:@"IntervenH5"]; + [[NSUserDefaults standardUserDefaults] setObject:@"https://api.cqygjk.com" forKey:@"H5DevHost"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + }]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECOMMEND"]) { + [self hiddenAllMBProgressHUD]; + NSArray * array = response ; + + if (self.page == 1) { + [self.dataArray removeAllObjects]; + } + + for (NSDictionary * dic in array) { + + HomeQusetionRecordsModel * model = [HomeQusetionRecordsModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + + } + self.homeTable.dataArray = self.dataArray; + + + } + if ([tag isEqualToString:@"verifyToken"]) { + + BOOL isLogin = [response boolValue]; + + if (isLogin == true) { + + [self getData]; + + } + + + + } + + if ([tag isEqualToString:@"IMAPI"]) { + [self hiddenAllMBProgressHUD]; + + NSDictionary * pamrDic = response; + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init]; + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + config.logLevel = V2TIM_LOG_INFO; + + [TUILogin login:[model.sdkAppId intValue] userID:model.userId userSig:model.userSig succ:^{ + + + } fail:^(int code, NSString *msg) { + + [EasyTextView showErrorText:msg]; + + }]; + + + + + } + if ([tag isEqualToString:@"SMALLHELP"]) { + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + [self hiddenAllMBProgressHUD]; + SmallHelpIMDataModel * model = [SmallHelpIMDataModel modelWithDictionary:response]; + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = model.groupId; + chatVC.smallHelp_id = model.small_id; + chatVC.isVideo = YES; + chatVC.eableSendReport = YES; + chatVC.eableMapTools = false; + chatVC.navTitle = @"全科医生"; + chatVC.eablehaveHelathData = YES; + chatVC.tfNew = model.tfNew; + [self.navigationController pushViewController:chatVC animated:YES]; + + } + + if ([tag isEqualToString:@"loginIMAPI"]) { + [self hiddenAllMBProgressHUD]; + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + [self smallQuestionAction]; + + } + + if ([tag isEqualToString:@"UPVERSION"]) { + + NSString * upVersion = [NSString stringWithFormat:@"%@",response] ; + + NSString * version = [NSString stringWithFormat:@"%@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]] ; + NSString *lastChar; + if (!ValidStr(version)) { + NSArray * array = [version componentsSeparatedByString:@"."]; + + if (array.count >0) { + lastChar = [NSString stringWithFormat:@"%@", [array lastObject]]; + } + NSLog(@"Last character: %@", lastChar); + + } + + /** +// * 当前版本号 +// */ +// @property (nonatomic, copy) NSString *currentVersion; +// +// /** +// * 更新版本号 +// */ +// @property (nonatomic, copy) NSString *releaseVersion; +// +// /** +// * 更新日志 +// */ +// @property (nonatomic, copy) NSString *releaseLog; +// +// /** +// * 更新时间(yyyy-MM-dd HH:mm) +// */ +// @property (nonatomic, copy) NSString *releaseDate; + + NSDictionary * dic = @{ + @"version":[NSString stringWithFormat:@"1.0.%@",upVersion] , + @"releaseNotes":@"修复已知问题,提升用户体验感!"}; + + PSAppInfo * info = [[PSAppInfo alloc] initWithDict:dic]; + + if ([upVersion intValue] > [lastChar intValue]) { + [self show:info]; + }else + { + DLog(@"不需要更新"); + } + } +} + + +- (void)show:(PSAppInfo *)info { + + if (_coverView) { return; } + + __weak typeof(self)weakSelf = self; + + self.checkVersionView = [[PSCheckVersionView alloc] + initWithAppInfo:info + confirm:^{ + [self jumpAppStoreUpdate]; + }]; + + [self.coverView addSubview:self.checkVersionView]; + [self.checkVersionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.equalTo(self.coverView).multipliedBy(0.69); + make.height.equalTo(self.coverView).multipliedBy(0.57); + make.center.equalTo(self.coverView); + }]; + [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:self.coverView]; +} + +- (void)jumpAppStoreUpdate { + + UIApplication *application = [UIApplication sharedApplication];// 打电话 + + [application openURL:[NSURL URLWithString:@"https://api.cqygjk.com/health-system/api/anon/sys/toAppDown?pkg=com.question.QinghaiProvince&type=2"] options:@{} completionHandler:nil];// + + +} + + + +- (void)loginImAccount { + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} + +#pragma mark:医生列表点击事件 + +- (void)doctorListClick:(NSString *)doctorID { + + ExpertMainViewController * mainVC = [[ExpertMainViewController alloc] init]; + mainVC.doctorId = doctorID; + [self.navigationController pushViewController:mainVC animated:YES]; +} + +#pragma mark:找专家 小助手 我的咨询 + +- (void)foundQuestionAction { + + + RoomDoctorRecordsVC * foundVC = [[RoomDoctorRecordsVC alloc] init]; + + [self.navigationController pushViewController:foundVC animated:true]; +} + +- (void)smallQuestionAction { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + [self showMBProgressHUDWithString:@"咨询中,请稍候..." autoHidden:NO]; + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"SMALLHELP" NeedToken:@""]; + + [searchApi postSmallHelpGroup:dic]; + + + +} + +- (void)myQuestionAction { + + + QustionRecordViewController * myVC = [[QustionRecordViewController alloc] init]; + + [self.navigationController pushViewController:myVC animated:true]; + + +} + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} + +- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { + switch (status) { + case kCLAuthorizationStatusNotDetermined: + // 用户还未决定是否授权 + break; + case kCLAuthorizationStatusRestricted: + // 位置服务被限制(例如家长控制) + [self handleLocationServicesRestricted]; + break; + case kCLAuthorizationStatusDenied: + // 用户拒绝了位置权限 + [self showAlertToOpenSettings]; + break; + case kCLAuthorizationStatusAuthorizedAlways: + case kCLAuthorizationStatusAuthorizedWhenInUse: + // 用户授权了位置权限 +// [self startLocationUpdates]; + break; + default: + break; + } +} + +- (void)handleLocationServicesRestricted { + // 处理位置服务受限的情况 + NSLog(@"位置服务被限制"); + [self showAlertToOpenSettings]; +} + +- (void)handleLocationServicesDenied { + // 处理位置服务被拒绝的情况 + NSLog(@"位置服务被拒绝"); + [self showAlertToOpenSettings]; +} + + + +- (void)handleLocationServicesDisabled { + // 处理设备的定位服务被禁用的情况 + NSLog(@"设备的定位服务被禁用"); + [self showAlertToOpenSettings]; +} + +- (void)showAlertToOpenSettings { + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"定位服务已关闭" + message:@"请在设置中启用定位服务" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; + if ([[UIApplication sharedApplication] canOpenURL:settingsURL]) { + [[UIApplication sharedApplication] openURL:settingsURL options:@{} completionHandler:nil]; + } + }]; + + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]; + + [alertController addAction:settingsAction]; + [alertController addAction:cancelAction]; + + [self presentViewController:alertController animated:YES completion:nil]; +} + +- (void)dealloc { + + [[NSNotificationCenter defaultCenter] removeObserver:self]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/AudioVideoRecordViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/AudioVideoRecordViewController.h new file mode 100644 index 0000000..64c6c39 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/AudioVideoRecordViewController.h @@ -0,0 +1,16 @@ +// +// AudioVideoRecordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AudioVideoRecordViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/AudioVideoRecordViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/AudioVideoRecordViewController.m new file mode 100644 index 0000000..120291d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/AudioVideoRecordViewController.m @@ -0,0 +1,229 @@ +// +// AudioVideoRecordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "AudioVideoRecordViewController.h" +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" +#import "RecordIMListDateModel.h" +#import "DoctorMainViewController.h" + +@interface AudioVideoRecordViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@end + +@implementation AudioVideoRecordViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 1; + self.type = @"3"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + // 3 1 5 + NSArray * array = @[@"进行中",@"待确认",@"已完成"]; + + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(80); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(15) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - kRealValue(110)) style:UITableViewStyleGrouped]; + self.homeTable.detailBlock = ^(NSString * _Nonnull recordID, NSString * _Nonnull imID, NSString * _Nonnull memberId, RecordIMListDateModel * _Nonnull model) { + + DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; + doctorVC.yuyue_id = recordID; + doctorVC.popType = 1; + [self.navigationController pushViewController:doctorVC animated:YES]; + }; + [self.view addSubview:self.homeTable]; + + + + [self.view addSubview:self.homeTable]; + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + + [weakSelf createData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [weakSelf createData]; + }]; + + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noData" titleStr:@"暂无数据" detailStr:@""]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = [UIColor blackColor]; + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + //按钮背景色 + emptyView.actionBtnBackGroundColor = KWhiteColor; + emptyView.actionBtnWidth = CGFLOAT_MIN; + emptyView.actionBtnHeight = CGFLOAT_MIN; + + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; + +} +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + [self.homeTable.mj_header beginRefreshing]; +} +- (void)createData { + // type : 1 图文 2 音视频 + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject: self.type forKey:@"status"]; + [parmDic setObject:@"2" forKey:@"type"]; + + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi GetQuestionRecordList:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECORD"]) { + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + RecordIMListDateModel * model = [ RecordIMListDateModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } +} + +- (void)statusChange:(UIButton *)statusBtn { + + + if (statusBtn.tag == 1000) { + self.type = @"3"; + } + if (statusBtn.tag == 1001) { + self.type = @"1"; + } + if (statusBtn.tag == 1002) { + self.type = @"5"; + } + + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + [self.homeTable.mj_header beginRefreshing]; +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/PictureRecordViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/PictureRecordViewController.h new file mode 100644 index 0000000..1414b43 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/PictureRecordViewController.h @@ -0,0 +1,16 @@ +// +// PictureRecordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PictureRecordViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/PictureRecordViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/PictureRecordViewController.m new file mode 100644 index 0000000..abe808a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/PictureRecordViewController.m @@ -0,0 +1,477 @@ +// +// PictureRecordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "PictureRecordViewController.h" +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" +#import "RecordIMListDateModel.h" +#import "DoctorMainViewController.h" +@interface PictureRecordViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; +@property (nonatomic, strong) NSMutableArray * redCountArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * groupIDArray; + +@property (nonatomic, strong) NSMutableArray * jingxingArray; + +@property (nonatomic, assign) NSInteger totalCount; + +@end + + +@implementation PictureRecordViewController + + +- (NSMutableArray *)groupIDArray { + + if (!_groupIDArray) { + + _groupIDArray = [[NSMutableArray alloc] init]; + + } + return _groupIDArray; + +} + +- (NSMutableArray *)redCountArray { + + if (!_redCountArray) { + + _redCountArray = [[NSMutableArray alloc] init]; + } + return _redCountArray; + +} +- (NSMutableArray *)jingxingArray { + + if (!_jingxingArray) { + + _jingxingArray = [[NSMutableArray alloc] init]; + + } + return _jingxingArray; + +} + + + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 0; + self.type = @"3"; + + [self createUI]; + + if ([ESCTUIManager TUIUserStatus] == false) { + + [self loginImAccount]; + } + + if ([self.type integerValue] == 3) + { + [self getChatList]; + } + else + { + [self createData]; + } + +} + +- (void)createUI { + + NSArray * array = @[@"进行中",@"已完成"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(80); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(15) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.width = kRealValue(90); + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - kRealValue(110) ) style:UITableViewStyleGrouped]; + self.homeTable.detailBlock = ^(NSString * _Nonnull recordID, NSString * _Nonnull imID, NSString * _Nonnull memberId, RecordIMListDateModel * _Nonnull model) { + + DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; + doctorVC.yuyue_id = imID; + doctorVC.popType = 1; + [self.navigationController pushViewController:doctorVC animated:YES]; + }; + [self.view addSubview:self.homeTable]; + + + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + + [weakSelf createData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [weakSelf createData]; + }]; + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - kRealValue(110)) style:UITableViewStyleGrouped]; + self.homeTable.detailBlock = ^(NSString * _Nonnull recordID, NSString * _Nonnull imID, NSString * _Nonnull memberId, RecordIMListDateModel * _Nonnull model) { + + +// DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; +// doctorVC.yuyue_id = recordID; +// [self.navigationController pushViewController:doctorVC animated:YES]; + if ([TUILogin isUserLogined]) { + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = imID ; + chatVC.eableSendReport = true; + chatVC.eablehaveHelathData = false; + chatVC.navTitle = @"图文咨询"; + chatVC.isVideo = NO; + chatVC.pictureEnd_id = model.Record_id; + chatVC.questionType = 2; + chatVC.medicalRecordsId = memberId; + if ([model.contentStatus intValue] == 5) { + chatVC.isEveal = true; + }else + { + chatVC.isEveal = false; + } + if ([model.contentStatus intValue] >=4 ) { + chatVC.endRecordType = 100; + } + [self.navigationController pushViewController:chatVC animated:YES]; + }else + { + [self loginImAccount]; + } + + }; + [self.view addSubview:self.homeTable]; + + + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 0; + if ([ESCTUIManager TUIUserStatus] == false) { + + [self loginImAccount]; + } + if ([self.type integerValue] == 3) + { + [self getChatList]; + } + else + { + [weakSelf createData]; + } + + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + if ([ESCTUIManager TUIUserStatus] == false) { + + [self loginImAccount]; + } + if ([self.type integerValue] == 3) + { + [self getChatList]; + } + else + { + [weakSelf createData]; + } + }]; + +} + +//获取腾讯im会话列表 + +- (void)getChatList { + + + V2TIMConversationListFilter *filter = [[V2TIMConversationListFilter alloc] init]; +// filter.type = V2TIM_C2C; //拉取单聊会话 + filter.type = V2TIM_GROUP; //拉取群聊会话 + [[V2TIMManager sharedInstance] getConversationListByFilter:filter nextSeq:self.pageNo count:50 succ:^(NSArray *list, uint64_t nextSeq, BOOL isFinished) { + // 获取会话列表成功,list 为会话列表 + if (self.pageNo == 0) { + [self.groupIDArray removeAllObjects]; + } + DLog(@"%@",list); + [self.redCountArray addObjectsFromArray:list]; + + for (V2TIMConversation * v2Model in list) { + [self.groupIDArray addObject: v2Model.groupID]; + + + } + [self postGroupArray:self.groupIDArray]; + } fail:^(int code, NSString *desc) { + // 获取会话列表失败 + }]; + +// //获取所以会话的未读总数 +// // filter.type = V2TIM_GROUP; //拉取群聊会话 +// +// [[V2TIMManager sharedInstance] getUnreadMessageCountByFilter:filter succ:^(UInt64 totalUnreadCount) { +// self.totalCount = totalUnreadCount; +// } fail:^(int code, NSString *desc) { +// +// }]; + +} + + +#pragma mark:上传id数组 +- (void)postGroupArray:(NSArray *)array { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:array forKey:@"imIds"]; + [self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false]; + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"GROUPID" NeedToken:@""]; + [recordApi PostGroupIDArray:parmDic]; +} + + +- (void)createData { + // type : 1 图文 2 音视频 + [self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:self.type forKey:@"status"]; + [parmDic setObject:@"1" forKey:@"type"]; + //status 1 3 4 5 //4 代评价 + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi GetQuestionRecordList:parmDic]; + //getMineQuestionRecord +} + +- (void)loginImAccount { + + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + + + +} + + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + if ([tag isEqualToString:@"RECORD"]) { + if (self.pageNo == 0) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + RecordIMListDateModel * model = [ RecordIMListDateModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } + if ([tag isEqualToString:@"IMAPI"]) { + [self hiddenAllMBProgressHUD]; + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init]; + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + // 2. 初始化 config 对象 + + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + + [TUILogin login:[model.sdkAppId intValue] userID:model.userId userSig:model.userSig succ:^{ + + [self getChatList]; + + } fail:^(int code, NSString *msg) { + + [EasyTextView showErrorText:msg]; + + }]; + + + + + } + if ([tag isEqualToString:@"GROUPID"]) { + [self hiddenAllMBProgressHUD]; + NSArray * array = response; + [self.jingxingArray removeAllObjects]; + for (NSDictionary * parmDic in array) { + + RecordIMListDateModel * model = [ RecordIMListDateModel modelWithDictionary:parmDic]; + + for (V2TIMConversation * v2Model in self.redCountArray) { + + if ([v2Model.groupID isEqualToString:model.imId]) + { + model.unredCount = v2Model.unreadCount; + } + } + + [self.jingxingArray addObject:model]; + } + self.homeTable.dataArray = self.jingxingArray; +// self.homeTable.totalCount + } +} + +- (void)statusChange:(UIButton *)statusBtn { + + [self.dataArray removeAllObjects]; + + if (statusBtn.tag == 1000) { + self.type = @"3"; //进行中 + [self getChatList]; + + } + if (statusBtn.tag == 1001) { + self.type = @"5"; //已评价 + [self createData]; + } + if (statusBtn.tag == 1002) { + self.type = @""; //全部 历史 + [self createData]; + } + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + +} + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionCompleteViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionCompleteViewController.h new file mode 100644 index 0000000..02275e9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionCompleteViewController.h @@ -0,0 +1,16 @@ +// +// QuestionCompleteViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionCompleteViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionCompleteViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionCompleteViewController.m new file mode 100644 index 0000000..0c621d3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionCompleteViewController.m @@ -0,0 +1,196 @@ +// +// QuestionCompleteViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QuestionCompleteViewController.h" +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" + +@interface QuestionCompleteViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@end + +@implementation QuestionCompleteViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 1; + self.type = @"1"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + NSArray * array = @[@"图文咨询",@"视频咨询"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(80); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(15) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.width = kRealValue(90); + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(@50); + make.bottom.left.right.mas_offset(0); + }]; + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + + [weakSelf createData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [weakSelf createData]; + }]; + +} + +- (void)createData { + // type : 1 图文 2 音视频 + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"5" forKey:@"status"]; + [parmDic setObject:self.type forKey:@"type"]; + + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi GetQuestionRecordList:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECORD"]) { + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + QuestionRecordModel * model = [QuestionRecordModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } +} + +- (void)statusChange:(UIButton *)statusBtn { + + if (statusBtn.tag == 1000) { + self.type = @"1"; + } + if (statusBtn.tag == 1001) { + self.type = @"2"; + } + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionJingxingViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionJingxingViewController.h new file mode 100644 index 0000000..b29432a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionJingxingViewController.h @@ -0,0 +1,16 @@ +// +// QuestionJingxingViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionJingxingViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionJingxingViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionJingxingViewController.m new file mode 100644 index 0000000..ed6df0a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QuestionJingxingViewController.m @@ -0,0 +1,196 @@ +// +// QuestionJingxingViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QuestionJingxingViewController.h" +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" + +@interface QuestionJingxingViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@end + +@implementation QuestionJingxingViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 1; + self.type = @"1"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + NSArray * array = @[@"图文咨询",@"视频咨询"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(80); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(15) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.width = kRealValue(90); + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(@50); + make.bottom.left.right.mas_offset(0); + }]; + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + + [weakSelf createData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [weakSelf createData]; + }]; + +} + +- (void)createData { + // type : 1 图文 2 音视频 + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"3" forKey:@"status"]; + [parmDic setObject:self.type forKey:@"type"]; + + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi GetQuestionRecordList:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECORD"]) { + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + QuestionRecordModel * model = [QuestionRecordModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } +} + +- (void)statusChange:(UIButton *)statusBtn { + + if (statusBtn.tag == 1000) { + self.type = @"1"; + } + if (statusBtn.tag == 1001) { + self.type = @"2"; + } + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionRecordViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionRecordViewController.h new file mode 100644 index 0000000..b6c59bf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionRecordViewController.h @@ -0,0 +1,16 @@ +// +// QustionRecordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QustionRecordViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionRecordViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionRecordViewController.m new file mode 100644 index 0000000..21827d5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionRecordViewController.m @@ -0,0 +1,272 @@ +// +// QustionRecordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QustionRecordViewController.h" +#import "AudioVideoRecordViewController.h" +#import "PictureRecordViewController.h" +#import "QuestionCompleteViewController.h" +#import "QustionWaitEvlaViewController.h" +#import "QuestionJingxingViewController.h" +#import "QustionWaitEvlaViewController.h" + +@interface QustionRecordViewController () + +/** 顶部控件*/ +@property (nonatomic, weak) UIScrollView *topView; +/** 下划线 */ +@property (nonatomic, weak) UIView *lineView; +/** 滚动视图 */ +@property (nonatomic, weak) UICollectionView *collectionView; +/** 当前选中的按钮 */ +@property (nonatomic, weak) UIButton *selectButton; +/** 按钮数组 */ +@property (nonatomic, strong) NSMutableArray *titleButtons; + +@end + +@implementation QustionRecordViewController + +#pragma mark - 懒加载 +- (NSMutableArray *)titleButtons { + if (_titleButtons==nil) { + _titleButtons = [NSMutableArray array]; + } + return _titleButtons; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = NO; + self.navigationItem.title = @"我的咨询"; + self.view.backgroundColor = UIColorBackground; +// [self addNavigationItemWithImageNames:@[@"backIcon@2x"] isLeft:YES target:self action:@selector(popVc) tags:@[@"100"]]; + [self createUI]; + +} + +#pragma mark:返回 +- (void)popVc +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +- (void)createUI +{ + [self setupNavgationBar]; + + // 添加底部内容view + [self setupBottomContentView]; + + // 添加所有子控制器 + [self setupAllChildViewController]; + + [self setupAllTitle]; + + // 不添加额外滚动区域 + self.automaticallyAdjustsScrollViewInsets = NO; +} + +#pragma mark - 添加所有的子控制器 +- (void)setupAllChildViewController { + + PictureRecordViewController * pictureVc = [[PictureRecordViewController alloc] init]; + pictureVc.view.backgroundColor = UIColorBackground; + pictureVc.navigationItem.title = @"图文咨询"; + [self addChildViewController:pictureVc]; + + // + AudioVideoRecordViewController * videoVc = [[AudioVideoRecordViewController alloc] init]; + videoVc.view.backgroundColor = UIColorBackground; + videoVc.navigationItem.title = @"视频咨询"; + [self addChildViewController:videoVc]; + // +// QuestionJingxingViewController * jingxingVc = [[QuestionJingxingViewController alloc] init]; +// jingxingVc.view.backgroundColor = UIColorBackground; +// jingxingVc.navigationItem.title = @"进行中"; +// [self addChildViewController:jingxingVc]; +// // +// QustionWaitEvlaViewController * evlVc = [[QustionWaitEvlaViewController alloc] init]; +// evlVc.view.backgroundColor = UIColorBackground; +// evlVc.navigationItem.title = @"待评价"; +// [self addChildViewController:evlVc]; +// // +// QuestionCompleteViewController * completeVc = [[QuestionCompleteViewController alloc] init]; +// completeVc.view.backgroundColor = UIColorBackground; +// completeVc.navigationItem.title = @"已完成"; +// [self addChildViewController:completeVc]; +} + +#pragma mark - 设置导航条内容 +- (void)setupNavgationBar { + UIScrollView *topView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 1, kScreenWidth, kRealValue(48))]; + topView.backgroundColor = [UIColor whiteColor]; + _topView = topView; + [self.view addSubview:topView]; +} + +#pragma mark - 按钮被点击 +- (void)titleClick:(UIButton *)titleButton{ + + NSInteger i = titleButton.tag; + // 重复点击标题按钮的时候,刷新当前界面 + if (titleButton == _selectButton) { + } + + [self selButton:titleButton]; + + //滚动collectionView 修改偏移量 + CGFloat offsetX = i * kScreenWidth; + _collectionView.contentOffset = CGPointMake(offsetX, 0); +} + +#pragma mark - 选中标题按钮 +- (void)selButton:(UIButton *)titleButton{ + + _selectButton.selected = NO; + titleButton.selected = YES; + _selectButton = titleButton; + + // 移动下划线的位置 + [UIView animateWithDuration:0.25 animations:^{ + _lineView.centerX = titleButton.centerX; + }]; +} + +#pragma mark - 添加标题 +- (void)setupAllTitle{ + + NSUInteger count = self.childViewControllers.count; + CGFloat btnX = 0; + CGFloat btnW = kScreenWidth/count; + CGFloat btnH = _topView.height; + for (int i = 0; i < count; i++) { + UIButton *titleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + titleButton.tag = i; + + UIViewController *vc = self.childViewControllers[i]; + [titleButton setTitle:vc.navigationItem.title forState:UIControlStateNormal]; + // 设置标题颜色 + [titleButton setTitleColor:RGBA(34, 34, 34, 1) forState:UIControlStateSelected]; + [titleButton setTitleColor:RGBA(102, 102, 102, 1) forState:UIControlStateNormal]; + + // 设置标题字体 + titleButton.titleLabel.font = MEDIUMFONT(14); + + btnX = i * btnW; + + titleButton.frame = CGRectMake(btnX, 0, btnW, btnH); + + // 监听按钮点击 + [titleButton addTarget:self action:@selector(titleClick:) forControlEvents:UIControlEventTouchUpInside]; + + [_topView addSubview:titleButton]; + + if (i == 0) { + // 添加下划线 + // 下划线宽度 = 按钮文字宽度 + // 下划线中心点x = 按钮中心点x + CGFloat h = 5; + CGFloat y = kRealValue(45) ; + UIView *lineView =[[UIView alloc] init]; + // 位置和尺寸 + lineView.height = h; + // 先计算文字尺寸,在给label去赋值 + [titleButton.titleLabel sizeToFit]; + lineView.width = kRealValue(28); + lineView.centerX = titleButton.centerX; + lineView.mj_y = y; + lineView.backgroundColor = UIColorHex(#21BEBD); + _lineView = lineView; + [_topView addSubview:lineView]; + + [self titleClick:titleButton]; + } + [self.titleButtons addObject:titleButton]; + } +} + +#pragma mark - 添加底部内容view +- (void)setupBottomContentView +{ + // 创建一个流水布局 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(kScreenWidth, kScreenHeight-44); + + // 设置水平滚动方向 + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + layout.minimumInteritemSpacing = 0; + layout.minimumLineSpacing = 0; + + // 创建UICollectionView + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0,kRealValue(48), kScreenWidth, kScreenHeight - kRealValue(48) ) collectionViewLayout:layout]; + collectionView.backgroundColor = [UIColor whiteColor]; + [self.view addSubview:collectionView]; + _collectionView = collectionView; + collectionView.scrollsToTop = NO; + collectionView.scrollEnabled = YES; + // 开启分页 + collectionView.pagingEnabled = YES; + collectionView.showsHorizontalScrollIndicator = NO; + collectionView.bounces = YES; + + // 展示cell + collectionView.dataSource = self; + collectionView.delegate = self; + + // 注册cell + [collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"COUPCELLID"]; +} + +#pragma mark - UICollectionViewDelegate +// 滚动完成的时候就会调用 +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ + // 获取角标 + NSInteger i = scrollView.contentOffset.x / kScreenWidth; + + // 获取选中标题 + UIButton *selButton = self.titleButtons[i]; + + // 选中标题 + [self selButton:selButton]; +} + +#pragma mark - UICollectionViewDataSource +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + + return self.childViewControllers.count; +} + +// 只要有新的cell出现的时候才会调用 +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"COUPCELLID" forIndexPath:indexPath]; + + // 移除之前子控制器view + [cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + // 取出对应的子控制器添加到对应cell上 + UIViewController *vc = self.childViewControllers[indexPath.row]; + + [cell.contentView addSubview:vc.view]; + + return cell; +} + + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionWaitEvlaViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionWaitEvlaViewController.h new file mode 100644 index 0000000..38e533f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionWaitEvlaViewController.h @@ -0,0 +1,16 @@ +// +// QustionWaitEvlaViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QustionWaitEvlaViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionWaitEvlaViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionWaitEvlaViewController.m new file mode 100644 index 0000000..f38c4ba --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/QusetionRecord(咨询记录)/QustionWaitEvlaViewController.m @@ -0,0 +1,196 @@ +// +// QustionWaitEvlaViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QustionWaitEvlaViewController.h" +#import "QuestionRecoredTable.h" +#import "QuestionRecordModel.h" + +@interface QustionWaitEvlaViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * type; + +@end + +@implementation QustionWaitEvlaViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + + } + return _dataArray; + +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.pageNo = 1; + self.type = @"1"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + NSArray * array = @[@"图文咨询",@"视频咨询"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(80); + for (int index = 0; index < array.count; index ++) { + + UIButton * listBtn = [[UIButton alloc] init]; + + listBtn.frame = CGRectMake(kRealValue(15) + (w + kRealValue(13)) * index , kRealValue(15), w, 27); + [listBtn setTitle:array[index] forState:UIControlStateNormal]; + [listBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [listBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [listBtn addTarget:self action:@selector(statusChange:) forControlEvents:UIControlEventTouchUpInside]; + listBtn.titleLabel.font = SYSTEMFONT(13); + listBtn.layer.cornerRadius = 14.0; + listBtn.layer.masksToBounds = true; + listBtn.tag = 1000 + index; + [self.view addSubview:listBtn]; + if (index == 0 ) { + listBtn.selected = YES; + listBtn.backgroundColor = UIColorHex(#21BEBD); + }else{ + listBtn.width = kRealValue(90); + listBtn.backgroundColor = UIColorHex(#DDDDDD); + } + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(@50); + make.bottom.left.right.mas_offset(0); + }]; + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + + [weakSelf createData]; + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [weakSelf createData]; + }]; + +} + +- (void)createData { + // type : 1 图文 2 音视频 + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"4" forKey:@"status"]; + [parmDic setObject:self.type forKey:@"type"]; + + JKCQAPI * recordApi = [[JKCQAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + [recordApi GetQuestionRecordList:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECORD"]) { + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + QuestionRecordModel * model = [QuestionRecordModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } +} + +- (void)statusChange:(UIButton *)statusBtn { + + if (statusBtn.tag == 1000) { + self.type = @"1"; + } + if (statusBtn.tag == 1001) { + self.type = @"2"; + } + for (UIButton * titBtn in self.buttonArray) { + + if (titBtn == statusBtn) { + + titBtn.selected = YES; + titBtn.backgroundColor = UIColorHex(#21BEBD); + + }else + { + titBtn.selected = NO; + titBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomDoctorRecordsVC.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomDoctorRecordsVC.h new file mode 100644 index 0000000..35996e7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomDoctorRecordsVC.h @@ -0,0 +1,16 @@ +// +// RoomDoctorRecordsVC.h +// QinghaiProject +// +// Created by Apple on 2024/7/5. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RoomDoctorRecordsVC : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomDoctorRecordsVC.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomDoctorRecordsVC.m new file mode 100644 index 0000000..59c8175 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomDoctorRecordsVC.m @@ -0,0 +1,302 @@ +// +// RoomDoctorRecordsVC.m +// QinghaiProject +// +// Created by Apple on 2024/7/5. +// + +#import "RoomDoctorRecordsVC.h" +#import "AllRoomRecordsCell.h" +#import "HomeQusetionRecordsModel.h" + +@interface RoomDoctorRecordsVC () + +@property (nonatomic, strong) UITableView * homeTable; +@property (nonatomic, strong) NSMutableArray * dataArray; +@property (nonatomic, assign) NSInteger page; +@property (nonatomic, assign) NSInteger totalCount; + + +@end + +@implementation RoomDoctorRecordsVC + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = true; + self.view.backgroundColor = CViewBgColor; + [self createUI]; + [self createData]; + +} + + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + [self.homeTable.mj_header beginRefreshing]; + +} + +- (void)createUI +{ + + UIImageView * topBackImage = [[UIImageView alloc] init]; + topBackImage.image = [UIImage imageNamed:@"roomTopImg"]; + topBackImage.userInteractionEnabled = true; + [self.view addSubview:topBackImage]; + + [topBackImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.left.right.mas_offset(0); + make.height.mas_offset(331); + }]; + + + + // 创建标题标签 + UILabel * titleLabel = [[UILabel alloc] init]; + titleLabel.textAlignment = NSTextAlignmentCenter; + titleLabel.text = @"全科医生咨询记录"; + titleLabel.textColor = KWhiteColor; + titleLabel.font = [UIFont boldSystemFontOfSize:18]; + [topBackImage addSubview:titleLabel]; + + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(kStatusBarHeight+kRealValue(15)); + make.left.right.mas_offset(0); + make.height.mas_offset(kRealValue(30)); + }]; + + // 创建左边按钮 + UIButton * backButton = [[UIButton alloc] init]; + [backButton setImage:[UIImage imageNamed:@"whiteBack_icon"] forState:UIControlStateNormal]; + [backButton addTarget:self action:@selector(backOnclick) forControlEvents:UIControlEventTouchUpInside]; + [topBackImage addSubview:backButton]; + + [backButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(kStatusBarHeight+kRealValue(15)); + make.left.mas_offset(kRealValue(15)); + make.height.width.mas_offset(kRealValue(30)); + }]; + + + + self.homeTable = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; + self.homeTable.backgroundColor = KClearColor; + [self.view addSubview:self.homeTable]; + + if (@available(iOS 11.0, *)) { + self.homeTable.estimatedRowHeight = 0; + self.homeTable.estimatedSectionFooterHeight = 0; + self.homeTable.estimatedSectionHeaderHeight = 0; + self.homeTable.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.homeTable.delegate = self; + self.homeTable.dataSource = self; + self.homeTable.separatorStyle = UITableViewCellSeparatorStyleNone; + self.homeTable.showsVerticalScrollIndicator = NO; + self.homeTable.estimatedRowHeight = 60; + self.homeTable.rowHeight = UITableViewAutomaticDimension; + [self.view addSubview:self.homeTable]; + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(kStatusBarHeight+kRealValue(60)); + make.left.right.bottom.mas_offset(0); + + }]; + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + self.page = 1; + [weakSelf createData]; + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + self.page++; + [weakSelf createData]; + }]; + + //初始化一个emptyView + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImage:[UIImage imageNamed:@"noQuetionList"] + titleStr:@"暂无咨询记录" detailStr:@""]; + + //元素竖直方向的间距 + emptyView.titleLabMargin = kRealValue(5); + emptyView.contentViewY = kRealValue(450); + + emptyView.imageSize = CGSizeMake(kRealValue(101), kRealValue(60)); + //标题颜色 + emptyView.titleLabTextColor =UIColorHex(#14BEBE); + //描述字体 + emptyView.titleLabFont = [UIFont systemFontOfSize:15]; + //按钮背景色 + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; + + V2TIMConversationListFilter *filter = [[V2TIMConversationListFilter alloc] init]; +// filter.type = V2TIM_C2C; //拉取单聊会话 + filter.type = V2TIM_GROUP; //拉取群聊会话 + + +// //获取所以会话的未读总数 +// // filter.type = V2TIM_GROUP; //拉取群聊会话 +// + [[V2TIMManager sharedInstance] getUnreadMessageCountByFilter:filter succ:^(UInt64 totalUnreadCount) { + self.totalCount = totalUnreadCount; + } fail:^(int code, NSString *desc) { + + }]; + + +} + +- (void)backOnclick { + + + [self.navigationController popViewControllerAnimated:YES]; +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.page) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"RECOMMEND" NeedToken:@""]; + [searchApi GetAllDoctorRecordsList:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"RECOMMEND"]) { + [self hiddenAllMBProgressHUD]; + NSArray * array = response ; + + if (self.page == 1) { + [self.dataArray removeAllObjects]; + } + int i = 0; + for (NSDictionary * dic in array) { + + HomeQusetionRecordsModel * model = [HomeQusetionRecordsModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + i ++; + + } + [self.homeTable reloadData];; + + } + +} + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + AllRoomRecordsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[AllRoomRecordsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.backgroundColor = KClearColor; + cell.model = self.dataArray[indexPath.section]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + HomeQusetionRecordsModel * model = self.dataArray[indexPath.section]; + + if ([TUILogin isUserLogined]) { + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = model.imId ; + chatVC.eableSendReport = true; + chatVC.eablehaveHelathData = false; + chatVC.navTitle = @"全科医生咨询"; + chatVC.isVideo = NO; + chatVC.pictureEnd_id =model.records_id ; + chatVC.questionType = 2; + chatVC.medicalRecordsId = model.memberId; + if ([model.contentStatus intValue] == 5) { + chatVC.isEveal = true; + }else + { + chatVC.isEveal = false; + } + if ([model.contentStatus intValue] >=4 ) { + chatVC.endRecordType = 100; + } + [self.navigationController pushViewController:chatVC animated:YES]; + }else + { + [EasyTextView showErrorText:@"登录过期,请重新登录!"]; + } +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return kRealValue(15); +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return kRealValue(15);; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [[UIView alloc] init]; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomSearchResultViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomSearchResultViewController.h new file mode 100644 index 0000000..0e716f0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomSearchResultViewController.h @@ -0,0 +1,18 @@ +// +// RoomSearchResultViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/10/20. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RoomSearchResultViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * keyWord; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomSearchResultViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomSearchResultViewController.m new file mode 100644 index 0000000..1396ac7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/RoomSearchResultViewController.m @@ -0,0 +1,134 @@ +// +// RoomSearchResultViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/10/20. +// + +#import "RoomSearchResultViewController.h" +#import "DoctorRoomCollectionView.h" +#import "SearchZhuangJiaViewController.h" +#import "FoundExpertModel.h" +#import "HQSearchView.h" + +@interface RoomSearchResultViewController () + +@property (nonatomic, strong) DoctorRoomCollectionView * collectView; + +@property (nonatomic, strong) NSMutableArray * dataArray; +@end + +@implementation RoomSearchResultViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.view.backgroundColor = KWhiteColor; + self.navigationItem.title = @"按科室找专家"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"输入科室名称"; + MJWeakSelf; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + if (!ValidStr(fieldtext)) { + weakSelf.keyWord = fieldtext; + [self createData]; + }else + { + [EasyTextView showErrorText:@"请输入关键字搜索"]; + } + + + }; + [self.view addSubview:seacrhView]; + + //找专家 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.itemSize = CGSizeMake((kScreenWidth - 30)/2,95); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(10, 10, 0, 10); + layout.minimumInteritemSpacing =10; + layout.minimumLineSpacing =10; + + self.collectView = [[DoctorRoomCollectionView alloc]initWithFrame:CGRectMake(0, seacrhView.bottom +8,kScreenWidth, kScreenHeight - kTopHeight - seacrhView.height - 16) collectionViewLayout:layout]; + [self.view addSubview:self.collectView]; + ; + self.collectView.roomBlock = ^(NSString * _Nonnull deparmentID, NSString * _Nonnull deparmentName) { + SearchZhuangJiaViewController * searvc = [[SearchZhuangJiaViewController alloc] init]; + searvc.departmentId = deparmentID; + searvc.departmentName = deparmentName; + searvc.sickId = @""; + searvc.hospitalId = @""; + searvc.doctorName = @""; + searvc.hospitalName = @""; + [weakSelf.navigationController pushViewController:searvc animated:YES]; + }; + +} + +- (void)createData { + + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:@"100" forKey:@"pageSize"]; + [dic setObject:@"1" forKey:@"pageNumber"]; + [dic setObject:self.keyWord forKey:@"search"]; + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"ROOMAPI" NeedToken:@""]; +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/es/searchConDepartment?search=%E5%86%85%E7%A7%91&pageNumber=1&pageSize=100 HTTP/1.1 + [searchApi getSearchRoomListData:dic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"ROOMAPI"]) { + + NSArray * array = response ; + + + + for (NSDictionary * dic in array) { + + DepartmentModel * model = [DepartmentModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.collectView.dataArray = self.dataArray; +// + } +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertSubViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertSubViewController.h new file mode 100644 index 0000000..dae9643 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertSubViewController.h @@ -0,0 +1,20 @@ +// +// FoundExpertSubViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "HQBaseViewController.h" +#import "FoundExpertSubCollection.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FoundExpertSubViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * searchWord; +@property (nonatomic, strong) FoundExpertSubCollection * collectView; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertSubViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertSubViewController.m new file mode 100644 index 0000000..495e789 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertSubViewController.m @@ -0,0 +1,108 @@ +// +// FoundExpertSubViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundExpertSubViewController.h" +#import "HQSearchView.h" +#import "FoundExpertModel.h" +#import "SearchZhuangJiaViewController.h" +@interface FoundExpertSubViewController () + + +@end + +@implementation FoundExpertSubViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + self.navigationItem.title = @"按疾病找专家"; + [self createUI]; + [self searchSikc]; +} + +- (void)createUI { + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"输入关键字"; + seacrhView.searchField.text = self.searchWord; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + + }; + [self.view addSubview:seacrhView]; + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.itemSize = CGSizeMake((kScreenWidth - 30)/2,26); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(10, 10, 0, 10); + layout.minimumInteritemSpacing =10; + layout.minimumLineSpacing =10; + MJWeakSelf + self.collectView = [[FoundExpertSubCollection alloc]initWithFrame:CGRectMake(0, seacrhView.bottom + 5,kScreenWidth, kScreenHeight - kTopHeight - 50) collectionViewLayout:layout]; + self.collectView.sickBlock = ^(SicksModel * _Nonnull model) { + SearchZhuangJiaViewController * searVC = [[SearchZhuangJiaViewController alloc] init]; + searVC.sickId = model.sick_id; + searVC.sickName = model.sicksName; + searVC.departmentId = @""; + searVC.hospitalId = @""; + searVC.doctorName = @""; + [weakSelf.navigationController pushViewController:searVC animated:YES]; + }; + [self.view addSubview:self.collectView]; +} + +#pragma mark:找疾病 +- (void)searchSikc { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:self.searchWord forKey:@"search"]; + [dic setObject:@(1) forKey:@"pageNumber"]; + [dic setObject:@(100) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"SicksSEARCH" NeedToken:@""]; + + [searchApi getSearchSicksListData:dic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"SicksSEARCH"]) { + + NSMutableArray * sickArray = [[NSMutableArray alloc] init]; + for (NSDictionary * dic in response) { + + SicksModel * model = [SicksModel modelWithDictionary:dic]; + [sickArray addObject:model]; + } + self.collectView.dataArray = sickArray; + + } + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertViewController.h new file mode 100644 index 0000000..19f3c05 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertViewController.h @@ -0,0 +1,16 @@ +// +// FoundExpertViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FoundExpertViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertViewController.m new file mode 100644 index 0000000..7be4ff0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundExpertViewController.m @@ -0,0 +1,476 @@ +// +// FoundExpertViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "FoundExpertViewController.h" +#import "HQSearchView.h" +#import "hospitalListTableView.h" +#import "HospitalInfoModel.h" +#import "DoctorRoomCollectionView.h" +#import "ZHTagListView.h" +#import "FoundExpertSubViewController.h" +#import "FoundRoomsViewController.h" +#import "FoundHospitalViewController.h" +#import "MainSearchViewController.h" +#import "FoundExpertModel.h" +#import "FoundJIBingViewController.h" +#import "SearchZhuangJiaViewController.h" +#import "HospitalMainViewController.h" +#import "SearchZhuangJiaViewController.h" + +@interface FoundExpertViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollview; + +@property (nonatomic, strong) hospitalListTableView * homeTable; + +@property (nonatomic, strong)DoctorRoomCollectionView * collectView; + +@property (nonatomic, strong) UIView * hospatilview; + +@property (nonatomic, strong) UIView * roomView; + +@property (nonatomic, strong) UIView * diseaView; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) ZHTagListView * tagList; + +@property (nonatomic, strong) UILabel * hospatilTitLabel; +@property (nonatomic, strong) UILabel * roomTitLabel; +@property (nonatomic, strong) UILabel * sickTitLabel; + +@property (nonatomic, strong) NSMutableArray * sicksDataArray; + +@end + +@implementation FoundExpertViewController + + +- (NSMutableArray *)sicksDataArray { + + if (!_sicksDataArray) { + + _sicksDataArray = [[NSMutableArray alloc] init]; + + } + return _sicksDataArray; +} + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + self.navigationItem.title = @"找专家"; + [self createUI]; + [self getFoundData]; +} + + + +- (void)createUI { + + self.mainScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + [self.view addSubview:self.mainScrollview]; + + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"请输入关键字"; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + if (ValidStr(fieldtext)) { + [self showMBProgressHUDOnlyWithString:@"请输入关键字"]; + return; + } + MainSearchViewController * searchVC = [[MainSearchViewController alloc] init]; + searchVC.keywordString = fieldtext; + [self.navigationController pushViewController:searchVC animated:YES]; + + }; + [self.mainScrollview addSubview:seacrhView]; + + // 按医院找专家视图 + [self createHospitalView]; + + // 按科室找专家 + [self createRoomView]; + + // 按疾病找专家 + [self createDoctorView]; + + // 滚动范围 + +} + +#pragma mark:按医院找专家 +- (void)createHospitalView { + + CGFloat hositalH = 200; + + self.hospatilview = [[UIView alloc] initWithFrame:CGRectMake(0, kRealValue(64), kScreenWidth, hositalH)]; + [self.mainScrollview addSubview:self.hospatilview]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 0 , 110, 15)]; + titleLabel.text = @"按医院找专家"; + titleLabel.font = MEDIUMFONT(15); + titleLabel.textAlignment = NSTextAlignmentLeft; + titleLabel.textColor = CFontColor1; + self.hospatilTitLabel = titleLabel; + [self.hospatilview addSubview:titleLabel]; + + YYLabel * moreLabel = [[YYLabel alloc]initWithFrame:CGRectMake(kScreenWidth - 130,0, 120, 17)]; + moreLabel.text = @"全部医院 "; + moreLabel.textColor = UIColorHex(#999999); + [self.hospatilview addSubview:moreLabel]; + + UIImage *image = [UIImage imageNamed:@"ic_more_info"]; + + NSMutableAttributedString * attri = [[NSMutableAttributedString alloc] initWithString:moreLabel.text]; + + NSMutableAttributedString * attachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(6, 11) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [attri appendAttributedString:attachText]; + + moreLabel.attributedText = attri; + + moreLabel.textAlignment = NSTextAlignmentRight; + + [moreLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + + [self allHospation]; + }]; +// table + self.homeTable = [[hospitalListTableView alloc] initWithFrame:CGRectMake(0, moreLabel.bottom + 10, kScreenWidth, 240) style:UITableViewStyleGrouped]; + +// self.homeTable.backgroundColor = KRedColor; + MJWeakSelf + self.homeTable.hospatalBlock = ^(NSString * _Nonnull hopsitalID, NSString * _Nonnull hopatialName) { + + HospitalMainViewController * mainVC = [[HospitalMainViewController alloc] init]; + mainVC.hospitalID = hopsitalID; + [weakSelf.navigationController pushViewController:mainVC animated:YES]; + }; + + self.homeTable.scrollEnabled =NO; + + [self.hospatilview addSubview:self.homeTable]; + + hositalH = self.homeTable.bottom; + + self.hospatilview.height = hositalH; + +} + + +- (void)createRoomView { + + + CGFloat roomH = 200; + + self.roomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.hospatilview.bottom + kRealValue(19), kScreenWidth, roomH)]; + [self.mainScrollview addSubview:self.roomView]; + + UILabel * roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 0 , 110, 15)]; + roomLabel.text = @"按科室找专家"; + roomLabel.font = MEDIUMFONT(15); + self.roomTitLabel = roomLabel; + roomLabel.textAlignment = NSTextAlignmentLeft; + roomLabel.textColor = CFontColor1; + [self.roomView addSubview:roomLabel]; + + YYLabel * allRoomLabel = [[YYLabel alloc]initWithFrame:CGRectMake(kScreenWidth - 130, 0, 120, 17)]; + allRoomLabel.text = @"全部科室 "; + allRoomLabel.textColor = UIColorHex(#999999); + [self.roomView addSubview:allRoomLabel]; + + + UIImage *image = [UIImage imageNamed:@"ic_more_info"]; + + NSMutableAttributedString * roomAttri = [[NSMutableAttributedString alloc] initWithString:allRoomLabel.text]; + + NSMutableAttributedString * roomAttachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(6, 11) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [roomAttri appendAttributedString:roomAttachText]; + + allRoomLabel.attributedText = roomAttri; + + allRoomLabel.textAlignment = NSTextAlignmentRight; + + [allRoomLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + + [self foundRoomsAction]; + }]; + + //找专家 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.itemSize = CGSizeMake((kScreenWidth - 30)/2,95); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.minimumInteritemSpacing = 10; // 设置每个单元格之间的水平间距 + layout.minimumLineSpacing = 10; // 设置每个单元格之间的垂直间距 + layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); // 设置左右边距为10 + self.collectView = [[DoctorRoomCollectionView alloc]initWithFrame:CGRectMake(0, allRoomLabel.bottom + 5,kScreenWidth, 95 * 4 + 60) collectionViewLayout:layout]; + self.collectView.scrollEnabled = NO; + [self.roomView addSubview:self.collectView]; + MJWeakSelf; + self.collectView.roomBlock = ^(NSString * _Nonnull deparmentID, NSString * _Nonnull deparmentName) { + SearchZhuangJiaViewController * searvc = [[SearchZhuangJiaViewController alloc] init]; + searvc.departmentId = deparmentID; + searvc.departmentName = deparmentName; + searvc.sickId = @""; + searvc.hospitalId = @""; + searvc.doctorName = @""; + searvc.hospitalName = @""; + [weakSelf.navigationController pushViewController:searvc animated:YES]; + }; + roomH = self.collectView.bottom + kRealValue(10); + + self.roomView.height = roomH; + +} + +#pragma mark:按疾病找专家 + +- (void)createDoctorView { + + CGFloat disH = 200; + + self.diseaView = [[UIView alloc] initWithFrame:CGRectMake(0, self.roomView.bottom + 5, kScreenWidth, disH)]; + [self.mainScrollview addSubview:self.diseaView]; + + UILabel * roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 0 , 110, 15)]; + roomLabel.text = @"按疾病找专家"; + roomLabel.font = MEDIUMFONT(15); + self.sickTitLabel = roomLabel; + roomLabel.textAlignment = NSTextAlignmentLeft; + roomLabel.textColor = CFontColor1; + [self.diseaView addSubview:roomLabel]; + + YYLabel * allRoomLabel = [[YYLabel alloc]initWithFrame:CGRectMake(kScreenWidth - 130, 0, 120, 17)]; + allRoomLabel.text = @"全部疾病 "; + allRoomLabel.textColor = UIColorHex(#999999); + [self.diseaView addSubview:allRoomLabel]; + + + UIImage *image = [UIImage imageNamed:@"ic_more_info"]; + + NSMutableAttributedString * roomAttri = [[NSMutableAttributedString alloc] initWithString:allRoomLabel.text]; + + NSMutableAttributedString * roomAttachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(6, 11) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [roomAttri appendAttributedString:roomAttachText]; + + allRoomLabel.attributedText = roomAttri; + + allRoomLabel.textAlignment = NSTextAlignmentRight; + + [allRoomLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + + [self allSickes]; + }]; + + NSMutableArray *_dataSource = @[].mutableCopy; + + ZHTagListConfiguration *config = [ZHTagListConfiguration defaultConfiguration]; + config.tagTextColor = CFontColor1; + config.tagTextMargin = 11; + config.tagHeight = 27; + config.tagTextFont = SYSTEMFONT(14); + config.tagMaxWidth = kScreenWidth; + config.tagListViewInset = UIEdgeInsetsMake(15, 15, 15, 10); + + ZHTagListView *tagList = [[ZHTagListView alloc] initWithFrame:CGRectMake(0, roomLabel.bottom, self.view.frame.size.width, 0) configuration:config tagTexts:_dataSource]; + self.tagList = tagList; + tagList.backgroundColor = KWhiteColor; + [self.diseaView addSubview:tagList]; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { +// if (idx == 6) { +// [obj setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; +// *stop = YES; +// } + }]; + [tagList setTagClickHandler:^(ZHTagListView *tagListView, NSString *tagText, NSUInteger index) { + + SicksModel * model = self.sicksDataArray[index]; + + [self selectDiseaAction:model.sicksName withID:model.sick_id]; + }]; + + disH = tagList.bottom ; + + self.diseaView.height = disH+ kRealValue(10); +} + + + +#pragma mark:请求数据 +- (void)getHospitalData { + + + NSArray * array = @[@{@"imageName":@"",@"lvString":@"二甲",@"hospitalName":@"西京医院",@"address":@"14.1km | 西安市未央凤城八路8888号"}, + @{@"imageName":@"",@"lvString":@"二甲",@"hospitalName":@"陕西省人民医院",@"address":@"14.1km | 西安市碑林区黄雁村8888号"}, + ]; + + for (NSDictionary * dic in array) { + + HospitalInfoModel * model = [HospitalInfoModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; +} + + +#pragma mark:全部医院 + +-(void)allHospation { + + FoundHospitalViewController * hospitalVC = [[FoundHospitalViewController alloc] init]; + + [self.navigationController pushViewController:hospitalVC animated:YES]; + +} + +- (void)allSickes { + + FoundJIBingViewController * jibingvC = [[FoundJIBingViewController alloc] init]; + + [self.navigationController pushViewController:jibingvC animated:YES]; + + +} +#pragma mark:寻找科室 + +- (void)foundRoomsAction { + + FoundRoomsViewController * foundVC = [[FoundRoomsViewController alloc] init]; + + [self.navigationController pushViewController:foundVC animated:true]; + +} + + +#pragma mark:疾病点击 + +- (void)selectDiseaAction:(NSString *)deparmentName withID:(NSString *)deparmentID { + +// FoundExpertSubViewController * foundVC = [[FoundExpertSubViewController alloc] init]; +// +// [self.navigationController pushViewController:foundVC animated:true]; + SearchZhuangJiaViewController * searvc = [[SearchZhuangJiaViewController alloc] init]; + searvc.departmentId = @""; + searvc.departmentName = @""; + searvc.sickName = deparmentName; + searvc.sickId = deparmentID; + searvc.hospitalId = @""; + searvc.doctorName = @""; + searvc.hospitalName = @""; + [self.navigationController pushViewController:searvc animated:YES]; + +} + +#pragma mark:数据 +- (void)getFoundData { + + [self showMBProgressHUDWithString:@"加载中..." autoHidden:NO]; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"FOUND" NeedToken:@""]; + [api getFoundExpertHomeData:dic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [self showMBProgressHUDOnlyWithString:message]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + NSDictionary * dic = response ; + if ([tag isEqualToString:@"FOUND"]) { + [self hiddenAllMBProgressHUD]; + FoundExpertModel * model = [FoundExpertModel modelWithDictionary:dic]; + + CGFloat numHeight = 0; + for (HospitalInfoModel * hosmodel in model.hospitalList) { + UILabel * lab = [[UILabel alloc] init]; + CGFloat labH = [HQCommonUtils getSpaceLabelHeight:lab withStr:hosmodel.address withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:kScreenWidth - 120 withLineSpacing:5]; + + if (ValidStr(hosmodel.keyDepartments)) { + + numHeight = numHeight + labH + 80; + + }else + { + numHeight = numHeight + labH + 100 ; + } + } + + + + self.homeTable.dataArray = model.hospitalList; + + self.hospatilTitLabel.text = [NSString stringWithFormat:@"按医院"]; + self.roomTitLabel.text = [NSString stringWithFormat:@"科室"]; + self.sickTitLabel.text = [NSString stringWithFormat:@"疾病"]; + + self.collectView.dataArray = model.DepartmentList; + + NSMutableArray * titleArray = [[NSMutableArray alloc] init]; + for (SicksModel * sicModel in model.SicksList) { + + NSString * sicks = [NSString stringWithFormat:@"%@",sicModel.sicksName]; + + [titleArray addObject:sicks]; + + [self.sicksDataArray addObject:sicModel]; + } + + self.tagList.tagDataArray = titleArray; + //布局 + self.homeTable.height = numHeight; + + self.hospatilview.height = self.homeTable.bottom; + if (model.DepartmentList.count%2 == 0) { + + self.collectView.height = model.DepartmentList.count / 2 * (73 + kRealValue(10))+ kRealValue(20); + + } + if (model.DepartmentList.count%2 != 0 ) { + + self.collectView.height = (model.DepartmentList.count / 2 + 1) * (73 + kRealValue(10)) + kRealValue(20); + + } + self.roomView.frame = CGRectMake(0, self.hospatilview.bottom + kRealValue(19), kScreenWidth, self.collectView.bottom + kRealValue(10)); + self.diseaView.frame = CGRectMake(0, self.roomView.bottom + 5, kScreenWidth, 200); + self.diseaView.height = self.tagList.bottom + kRealValue(10); + self.mainScrollview.contentSize = CGSizeMake(kScreenWidth ,self.diseaView.bottom + kRealValue(50)); + + } +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundHospitalViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundHospitalViewController.h new file mode 100644 index 0000000..4d688be --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundHospitalViewController.h @@ -0,0 +1,16 @@ +// +// FoundHospitalViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FoundHospitalViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundHospitalViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundHospitalViewController.m new file mode 100644 index 0000000..d5d17f4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundHospitalViewController.m @@ -0,0 +1,196 @@ +// +// FoundHospitalViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "FoundHospitalViewController.h" +#import "HQSearchView.h" +#import "hospitalListTableView.h" +#import "HospitalInfoModel.h" +#import "HospitalMainViewController.h" +#import "SearchZhuangJiaViewController.h" +@interface FoundHospitalViewController () + +@property (nonatomic, strong) hospitalListTableView * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNumber; +@property (nonatomic, assign) NSInteger pageSize; +@property (nonatomic, assign) BOOL isSearch; +@property (nonatomic, copy) NSString * keyword; + +@end + +@implementation FoundHospitalViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.view.backgroundColor = KWhiteColor; + self.navigationItem.title = @"按医院"; + self.pageNumber = 0; + self.isSearch = false; + [self createUI]; + [self getHospitalData]; +} + +- (void)createUI { + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"输入医院名称"; + MJWeakSelf; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + self.pageNumber = 1; + if (!ValidStr(fieldtext)) { + weakSelf.isSearch = true; + weakSelf.keyword = fieldtext; + [self searchHospital:fieldtext]; + }else + { + [EasyTextView showErrorText:@"请输入关键字搜索"]; + } + + + }; + [self.view addSubview:seacrhView]; + + self.homeTable = [[hospitalListTableView alloc] initWithFrame:CGRectMake(0, seacrhView.bottom + 10, kScreenWidth, kScreenHeight - kTopHeight - 63 ) style:UITableViewStyleGrouped]; + self.homeTable.hospatalBlock = ^(NSString * _Nonnull hopsitalID, NSString * _Nonnull hopatialName) { + +// HospitalMainViewController * mainVC = [[HospitalMainViewController alloc] init]; +// mainVC.hospitalID = hopsitalID; +// [weakSelf.navigationController pushViewController:mainVC animated:YES]; + if (weakSelf.isSearch) { + SearchZhuangJiaViewController * searVC = [[SearchZhuangJiaViewController alloc] init]; + searVC.type= 2; + searVC.departmentId = @""; + searVC.departmentName = @""; + searVC.sickId = @""; + searVC.hospitalId =hopsitalID; + searVC.doctorName = @""; + searVC.hospitalName = hopatialName; + [weakSelf.navigationController pushViewController:searVC animated:YES]; + }else + { + HospitalMainViewController * mainVC = [[HospitalMainViewController alloc] init]; + mainVC.hospitalID = hopsitalID; + [weakSelf.navigationController pushViewController:mainVC animated:YES]; + } + + }; + [self.view addSubview:self.homeTable]; + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + + weakSelf.pageNumber = 0; + if (self.isSearch== true) { + [weakSelf searchHospital:weakSelf.keyword]; + }else + { + [weakSelf getHospitalData]; + } + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNumber ++; + + if (self.isSearch== true) { + [weakSelf searchHospital:weakSelf.keyword]; + }else + { + [weakSelf getHospitalData]; + } + }]; + +} + +#pragma mark:请求数据 +- (void)getHospitalData { + + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + [dic setObject:@(20) forKey:@"pageSize"]; + [dic setObject:@(self.pageNumber) forKey:@"pageNumber"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"HospitalAPI" NeedToken:@""]; + + [searchApi getAllHospatilData:dic]; +} + +- (void)searchHospital:(NSString *)keyword { + + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + [dic setObject:@(20) forKey:@"pageSize"]; + [dic setObject:@(self.pageNumber) forKey:@"pageNumber"]; + [dic setObject:keyword forKey:@"search"]; + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"HospitalAPI" NeedToken:@""]; + + [searchApi getSearchHospatilData:dic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"HospitalAPI"]) { + + NSArray * array = response ; + + if (self.pageNumber == 1) { + + [self.dataArray removeAllObjects]; + } + + for (NSDictionary * dic in array) { + + HospitalInfoModel * model = [HospitalInfoModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundJIBingViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundJIBingViewController.h new file mode 100644 index 0000000..84dce0b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundJIBingViewController.h @@ -0,0 +1,16 @@ +// +// FoundJIBingViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FoundJIBingViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundJIBingViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundJIBingViewController.m new file mode 100644 index 0000000..f68e809 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundJIBingViewController.m @@ -0,0 +1,237 @@ +// +// FoundJIBingViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import "FoundJIBingViewController.h" +#import "FoundLeftTableView.h" +#import "FoundRightTableView.h" +#import "SearchRoomModel.h" +#import "SearchSicksModel.h" +#import "SearchZhuangJiaViewController.h" +#import "HQSearchView.h" +#import "FoundExpertSubViewController.h" + + +@interface FoundJIBingViewController () + +@property (nonatomic, strong) FoundLeftTableView * leftTable; + +@property (nonatomic, strong) FoundRightTableView * rightTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * rightDataArray; + +@property (nonatomic, strong) NSString * sicks_id; + +@property (nonatomic, copy) NSString * CustomdepartmentName; + + +@end + +@implementation FoundJIBingViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; + +} + +- (NSMutableArray *)rightDataArray { + + if (!_rightDataArray) { + + _rightDataArray = [[NSMutableArray alloc] init]; + } + + return _rightDataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"按疾病找专家"; + self.view.backgroundColor = KWhiteColor; + [self createUI]; + [self createData]; + + +} + +- (void)createUI { + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"输入疾病名称"; + MJWeakSelf; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + + FoundExpertSubViewController * foundVC = [[FoundExpertSubViewController alloc] init]; + foundVC.searchWord = fieldtext; + [weakSelf.navigationController pushViewController:foundVC animated:YES]; + + }; + [self.view addSubview:seacrhView]; + + + self.leftTable = [[FoundLeftTableView alloc] initWithFrame:CGRectMake(0, seacrhView.bottom + 10, kRealValue(160), kScreenHeight - kTopHeight -43) style:UITableViewStyleGrouped]; + self.leftTable.leftDelegate = self; + self.leftTable.backgroundColor = UIColorHex(#F3F3F3); + [self.view addSubview:self.leftTable]; + + self.rightTable = [[FoundRightTableView alloc] initWithFrame:CGRectMake(self.leftTable.right, seacrhView.bottom + 10,kScreenWidth - kRealValue(160), kScreenHeight - kTopHeight -43) style:UITableViewStyleGrouped]; + self.rightTable.rightBlock = ^(NSString * _Nonnull roomID, NSString * _Nonnull roomName) { + SearchZhuangJiaViewController * searVC = [[SearchZhuangJiaViewController alloc] init]; + searVC.sickId = roomID; + searVC.sickName = roomName; + searVC.departmentId = @""; + searVC.hospitalId = @""; + searVC.doctorName = @""; + [weakSelf.navigationController pushViewController:searVC animated:YES]; + }; + + [self.view addSubview:self.rightTable]; + +} + +#pragma mark:数据 + +- (void)createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:@"0" forKey:@"parentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"FOUND" NeedToken:@""]; + [api getSearchjibingListLeftData:dic]; + +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + NSArray * array = response ; + if ([tag isEqualToString:@"FOUND"]) { + [self hiddenAllMBProgressHUD]; + [self.dataArray removeAllObjects]; + + int i = 0; + for (NSDictionary * dic in array) { + + SearchRoomModel * model = [SearchRoomModel modelWithDictionary:dic]; + model.type = @"2"; + if (i == 0) { + model.isSelected = YES; + }else + { + model.isSelected = false; + } + [self.dataArray addObject:model]; + i ++; + } + + self.leftTable.dataArray = self.dataArray; + + if (self.dataArray.count > 0) { + + SearchRoomModel * roomModel = self.dataArray[0]; + self.sicks_id = roomModel.room_Id; + self.CustomdepartmentName = roomModel.departmentName; + [self createRightData:roomModel.room_Id]; + + } + } + + if ([tag isEqualToString:@"RightFound"]) + { + [self hiddenAllMBProgressHUD]; + [self.rightDataArray removeAllObjects]; + + NSMutableDictionary * respDic = [[NSMutableDictionary alloc] init]; + + [respDic setObject:self.sicks_id forKey:@"id"]; + NSInteger doctorNumber = 0; + for (NSDictionary * dic in array) { + + SearchSicksModel * rightModel = [SearchSicksModel modelWithDictionary:dic]; + int number = [rightModel.doctorNum intValue]; + doctorNumber = doctorNumber + number; + } + [respDic setObject:[NSString stringWithFormat:@"全部医生"] forKey:@"sicksName"]; + [respDic setObject:[NSString stringWithFormat:@"%lu",doctorNumber] forKey:@"doctorNum"]; + [respDic setObject:[NSString stringWithFormat:@"%@",self.CustomdepartmentName] forKey:@"CustomdepartmentName"]; + + NSMutableArray * customArray = [[NSMutableArray alloc] initWithArray:array]; + + [customArray insertObject:respDic atIndex:0]; + + + int i = 0 ; + + for (NSDictionary * dic in customArray) { + + SearchSicksModel * rightModel = [SearchSicksModel modelWithDictionary:dic]; + if (i == 0) { + rightModel.isSelected = YES; + }else + { + rightModel.isSelected = false; + } + [self.rightDataArray addObject:rightModel]; + i ++; + } + self.rightTable.searchType = 2; + self.rightTable.rightDataArray = self.rightDataArray; + } +} + + +- (void)createRightData:(NSString *)parentId { + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:parentId forKey:@"departmentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"RightFound" NeedToken:@""]; + [api getSearchjibingListRightData:dic]; + +} +#pragma mark: 左边点击 + +- (void)leftCellAction:(NSInteger)index { + + SearchRoomModel * model = self.dataArray[index]; + + self.sicks_id = model.room_Id; + self.CustomdepartmentName = model.departmentName; + [self createRightData:model.room_Id]; + + + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundRoomsViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundRoomsViewController.h new file mode 100644 index 0000000..c11d41f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundRoomsViewController.h @@ -0,0 +1,16 @@ +// +// FoundRoomsViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FoundRoomsViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundRoomsViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundRoomsViewController.m new file mode 100644 index 0000000..a0191eb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/FoundRoomsViewController.m @@ -0,0 +1,232 @@ +// +// FoundRoomsViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundRoomsViewController.h" +#import "HQSearchView.h" +#import "FoundRightTableView.h" +#import "FoundLeftTableView.h" +#import "SearchZhuangJiaViewController.h" +#import "SearchRoomModel.h" +#import "RoomSearchResultViewController.h" + + +@interface FoundRoomsViewController () + +@property (nonatomic, strong) FoundLeftTableView * leftTable; + +@property (nonatomic, strong) FoundRightTableView * rightTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * rightDataArray; + +@property (nonatomic, strong) NSString * parentId; + +@property (nonatomic, copy) NSString * rightCustom_id; + +@property (nonatomic, copy) NSString * doctorNumber; + +@end + +@implementation FoundRoomsViewController + + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; + +} + +- (NSMutableArray *)rightDataArray { + + if (!_rightDataArray) { + + _rightDataArray = [[NSMutableArray alloc] init]; + } + + return _rightDataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"找科室"; + self.view.backgroundColor = KWhiteColor; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"请输入科室名称"; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + RoomSearchResultViewController * resultVC = [[RoomSearchResultViewController alloc] init]; + resultVC.keyWord = fieldtext; + [self.navigationController pushViewController:resultVC animated:YES]; + [EasyTextView showText:@"发起搜索"]; + }; + [self.view addSubview:seacrhView]; + + self.leftTable = [[FoundLeftTableView alloc] initWithFrame:CGRectMake(0, seacrhView.bottom + kRealValue(10), kRealValue(160), kScreenHeight - kTopHeight - 53) style:UITableViewStyleGrouped]; + self.leftTable.leftDelegate = self; + self.leftTable.backgroundColor = UIColorHex(#F3F3F3); + [self.view addSubview:self.leftTable]; + + self.rightTable = [[FoundRightTableView alloc] initWithFrame:CGRectMake(self.leftTable.right, seacrhView.bottom + kRealValue(10),kScreenWidth - kRealValue(160), kScreenHeight - kTopHeight - 53) style:UITableViewStyleGrouped]; + MJWeakSelf + self.rightTable.rightBlock = ^(NSString * _Nonnull roomID, NSString * _Nonnull roomName) { + + SearchZhuangJiaViewController * searVC = [[SearchZhuangJiaViewController alloc] init]; + searVC.departmentId = roomID; + searVC.departmentName = roomName; + searVC.sickId = @""; + searVC.hospitalId = @""; + searVC.doctorName = @""; + [weakSelf.navigationController pushViewController:searVC animated:YES]; + }; + [self.view addSubview:self.rightTable]; + +} + +#pragma mark:数据 + +- (void)createData { + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:@"0" forKey:@"parentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"FOUND" NeedToken:@""]; + [api getSearchRoomListLeftData:dic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + NSArray * array = response ; + if ([tag isEqualToString:@"FOUND"]) { + [self.dataArray removeAllObjects]; + [self hiddenAllMBProgressHUD]; + int i = 0 ; + + NSDictionary * responDic = response; + + if ([responDic.allKeys containsObject:@"list"]) { + NSArray * array = [responDic objectForKey:@"list"]; + + for (NSDictionary * dic in array) { + + SearchRoomModel * model = [SearchRoomModel modelWithDictionary:dic]; + + if (i == 0) { + model.isSelected = YES; + }else + { + model.isSelected = false; + } + [self.dataArray addObject:model]; + i ++; + } + + self.leftTable.dataArray = self.dataArray; + + if (self.dataArray.count > 0) { + + SearchRoomModel * roomModel = self.dataArray[0]; + self.rightCustom_id = roomModel.room_Id; + self.doctorNumber = [NSString stringWithFormat:@"%@",roomModel.doctorNum]; + [self createRightData:roomModel.room_Id]; + + } + } + } + + if ([tag isEqualToString:@"RightFound"]) + { + [self.rightDataArray removeAllObjects]; + int i = 0 ; + NSDictionary * responDic = response; + + if ([responDic.allKeys containsObject:@"list"]) { + + NSArray * array = [responDic objectForKey:@"list"]; + + NSMutableDictionary * respDic = [[NSMutableDictionary alloc] init]; + + [respDic setObject:self.rightCustom_id forKey:@"id"]; + [respDic setObject:[NSString stringWithFormat:@"全部医生"] forKey:@"departmentName"]; + [respDic setObject:[NSString stringWithFormat:@"%@",self.doctorNumber] forKey:@"doctorNum"]; + NSMutableArray * customArray = [[NSMutableArray alloc] initWithArray:array]; + [customArray insertObject:respDic atIndex:0]; + + + for (NSDictionary * dic in customArray) { + + SearchRoomModel * rightModel = [SearchRoomModel modelWithDictionary:dic]; + + + if (i == 0) { + rightModel.isSelected = YES; + }else + { + rightModel.isSelected = false; + } + [self.rightDataArray addObject:rightModel]; + i ++; + } + self.rightTable.searchType = 1; + + self.rightTable.rightDataArray = self.rightDataArray; + } + } +} + + +- (void)createRightData:(NSString *)parentId { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:parentId forKey:@"parentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"RightFound" NeedToken:@""]; + [api getSearchRoomListLeftData:dic]; + +} +#pragma mark: 左边点击 + +- (void)leftCellAction:(NSInteger)index { + + SearchRoomModel * model = self.dataArray[index]; + self.rightCustom_id = model.room_Id; + self.doctorNumber = [NSString stringWithFormat:@"%@",model.doctorNum]; + [self createRightData:model.room_Id]; + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/MainSearchViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/MainSearchViewController.h new file mode 100644 index 0000000..b3ac5dc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/MainSearchViewController.h @@ -0,0 +1,18 @@ +// +// MainSearchViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/25. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MainSearchViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * keywordString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/MainSearchViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/MainSearchViewController.m new file mode 100644 index 0000000..56645e8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/MainSearchViewController.m @@ -0,0 +1,767 @@ +// +// MainSearchViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/25. +// + +#import "MainSearchViewController.h" +#import "HQSearchView.h" +#import "MainSearchTable.h" +#import "ZHTagListView.h" +#import "DoctorRoomCollectionView.h" +#import "hospitalListTableView.h" +#import "HospitalMainViewController.h" +#import "SearchZhuangjiaTable.h" +#import "SearchZhuangJiaViewController.h" +#import "HospitalMainViewController.h" +#import "ExpertMainViewController.h" +#import "QuestionMustKnowViewController.h" +#import "SelectedQuestionViewController.h" +#import "SelectedDoctorTimeVC.h" +#import "ZongheZhuangjiaTableViewCell.h" +#import "SelectedQuestionViewController.h" +#import "SelectedDoctorTimeVC.h" +#import "SearchZhuangJiaViewController.h" +@interface MainSearchViewController () + +@property (nonatomic, strong) NSMutableArray * btnArray; +@property (nonatomic, strong) NSMutableArray * lineArray; +@property (nonatomic, strong) NSMutableArray * DoctorArray; +@property (nonatomic, strong) NSMutableArray * hospatilArray; + +@property (nonatomic, strong) MainSearchTable * homeTable; +@property (nonatomic, assign) NSInteger pageNumber; +@property (nonatomic, assign) NSInteger pageSize; +@property (nonatomic, assign) NSInteger type; +@property (nonatomic, strong) HQSearchView * searchView; +@property (nonatomic, strong) UIView * jibingView; +@property (nonatomic, strong) ZHTagListView *tagList; +@property (nonatomic, strong) UIView * roomView; +@property (nonatomic, strong) DoctorRoomCollectionView * collectView; +@property (nonatomic, assign) NSInteger questionType; +@property (nonatomic, strong) NSString * doctorId; + +@property (nonatomic, strong) NSMutableArray * sickArray; + +#pragma mark:医院视图 +@property (nonatomic, strong) hospitalListTableView * hospitalView; +#pragma mark:专家 +@property (nonatomic, strong) SearchZhuangjiaTable * zhuanjiaView; +@end + +@implementation MainSearchViewController + +- (NSMutableArray *)btnArray { + + if(!_btnArray) { + _btnArray = [[NSMutableArray alloc] init]; + } + + return _btnArray; + +} + +- (NSMutableArray *)DoctorArray { + + if(!_DoctorArray) { + _DoctorArray = [[NSMutableArray alloc] init]; + } + + return _DoctorArray; + +} + +- (NSMutableArray *)sickArray { + + if(!_sickArray) { + _sickArray = [[NSMutableArray alloc] init]; + } + + return _sickArray; + +} + + +- (NSMutableArray *)hospatilArray { + + if(!_hospatilArray) { + _hospatilArray = [[NSMutableArray alloc] init]; + } + + return _hospatilArray; + +} + + +- (NSMutableArray *)lineArray { + + if(!_lineArray) { + _lineArray = [[NSMutableArray alloc] init]; + } + + return _lineArray; + +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.view.backgroundColor = KWhiteColor; + self.navigationItem.title = @"搜索"; + self.pageNumber = 1; + self.type = 1; + [self createUI]; + // Do any additional setup after loading the view. + [self createData]; +} + +- (void)createUI { + + HQSearchView * searchView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 7, kScreenWidth, 40)]; + searchView.searchField.text = self.keywordString; + searchView.searchPlacehold = @"请输入关键字"; + searchView.searchBlock = ^(NSString * _Nonnull fieldtext) { + self.keywordString = fieldtext; + [self.DoctorArray removeAllObjects]; + [self.hospatilArray removeAllObjects]; + self.pageNumber = 1; + if (self.type == 1) { + + [self createData]; + } + if (self.type == 2) { + [self searchDoctor]; + } + if (self.type == 3) { + [self searchHospatil]; + } + if (self.type == 4) { + [self searchSikc]; + } + if (self.type == 6) { + [self searchRoom ]; + } + }; + self.searchView = searchView; + [self.view addSubview:searchView]; + + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(0, searchView.bottom, kScreenWidth, 41)]; + [self.view addSubview:topView]; + + NSArray * array = @[@"综合",@"专家",@"医院",@"疾病",@"科室"]; + + for (int i = 0; i < array.count; i ++) { + + UIButton * titBtn = [[UIButton alloc] initWithFrame:CGRectMake(18 + 70 * i,kRealValue(10), 55, 28)]; + [titBtn setTitle:array[i] forState:UIControlStateNormal]; + [titBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateSelected]; + [titBtn setTitleColor:UIColorHex(#666666) forState:UIControlStateNormal]; + titBtn.titleLabel.font = SYSTEMFONT(14); + titBtn.tag = 10 + i; + titBtn.selected = i ==0 ? true:false; + [titBtn addTarget:self action:@selector(topOnClick:) forControlEvents:UIControlEventTouchUpInside]; + [topView addSubview:titBtn]; + + UIView * linV = [[UIView alloc] initWithFrame:CGRectMake(0, titBtn.bottom, 13, 2)]; + linV.backgroundColor = UIColorHex(#21BEBD); + linV.centerX = titBtn.centerX; + linV.tag = 100 + i; + [topView addSubview:linV]; + linV.hidden = i ==0 ? false:true; + + [self.btnArray addObject:titBtn]; + [self.lineArray addObject:linV]; + } + self.homeTable = [[MainSearchTable alloc] initWithFrame:CGRectMake(15, topView.bottom, kScreenWidth - 30, kScreenHeight - topView.bottom - kTopHeight) style:UITableViewStyleGrouped]; + self.homeTable.backgroundColor = KWhiteColor; + self.homeTable.zongheZhuangjiaDelegate = self; + MJWeakSelf + self.homeTable.mainBlock = ^(NSString * _Nonnull type, NSString * _Nonnull needID) { + if ([type isEqualToString:@"医生"]) { + + ExpertMainViewController * mainVC = [[ExpertMainViewController alloc] init]; + mainVC.doctorId = needID; + [weakSelf.navigationController pushViewController:mainVC animated:YES]; + + } + if ([type isEqualToString:@"医院"]) { + + HospitalMainViewController * mainVC = [[HospitalMainViewController alloc] init]; + mainVC.hospitalID = needID; + [weakSelf.navigationController pushViewController:mainVC animated:YES]; + } + }; + self.homeTable.doctorSearBlock = ^(NSString * _Nonnull deparmentID, NSString * _Nonnull deparmentName) { + SearchZhuangJiaViewController * searvc = [[SearchZhuangJiaViewController alloc] init]; + searvc.departmentId = deparmentID; + searvc.departmentName = deparmentName; + searvc.sickId = @""; + searvc.hospitalId = @""; + searvc.doctorName = @""; + searvc.hospitalName = @""; + [weakSelf.navigationController pushViewController:searvc animated:YES]; + }; + self.homeTable.sicksSearBlock = ^(SicksModel * _Nonnull model) { + [weakSelf selectDiseaAction:model.sicksName withID:model.sick_id]; + + }; + //6月6日新增更多功能不需要 +// self.homeTable.doctorBlock = ^{ +// +// UIButton * doctorBtn = [weakSelf.view viewWithTag:11]; +// +// [weakSelf topOnClick:doctorBtn]; +// +// }; +// +// self.homeTable.hospitalBlock = ^{ +// UIButton * doctorBtn = [weakSelf.view viewWithTag:12]; +// +// [weakSelf topOnClick:doctorBtn]; +// }; +// +// self.homeTable.roomsBlock = ^{ +// [weakSelf moreRoomsOnClick]; +// }; +// +// self.homeTable.sicksBlock = ^{ +// [weakSelf moreSicksOnClick]; +// }; + self.homeTable.type = 1; + [self.view addSubview:self.homeTable]; + + //专家 + + self.zhuanjiaView = [[SearchZhuangjiaTable alloc] initWithFrame:CGRectMake(0, topView.bottom, kScreenWidth,kScreenHeight - topView.bottom - kTopHeight) style:UITableViewStyleGrouped]; + self.zhuanjiaView.hidden = YES; + self.zhuanjiaView.zhuangjiaListDelegate = self; + self.zhuanjiaView.backgroundColor = KWhiteColor; + [self.view addSubview:self.zhuanjiaView]; + self.zhuanjiaView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + + weakSelf.pageNumber = 1; + + [weakSelf searchDoctor]; + + + }]; + self.zhuanjiaView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + + weakSelf.pageNumber ++; + + [weakSelf searchDoctor]; + }]; + + //医院 + self.hospitalView = [[hospitalListTableView alloc] initWithFrame:CGRectMake(0, topView.bottom, kScreenWidth, kScreenHeight - topView.bottom - kTopHeight ) style:UITableViewStyleGrouped]; + self.hospitalView.hospatalBlock = ^(NSString * _Nonnull hopsitalID, NSString * _Nonnull hopatialName) { + + HospitalMainViewController * mainVC = [[HospitalMainViewController alloc] init]; + + [weakSelf.navigationController pushViewController:mainVC animated:YES]; + }; + self.hospitalView.hidden = YES; + [self.view addSubview:self.hospitalView]; + + self.hospitalView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNumber = 1; + + [weakSelf searchHospatil]; + + + }]; + self.hospitalView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNumber ++; + + [weakSelf searchHospatil]; + }]; + + + //疾病试图 + self.jibingView = [[UIView alloc] initWithFrame:CGRectMake(0, self.searchView.bottom + 41, kScreenWidth, 100)]; + self.jibingView.hidden = YES; + [self.view addSubview:self.jibingView]; + UILabel * canselLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10) , 110, 15)]; + canselLabel.text = @"疾病"; + canselLabel.font = MEDIUMFONT(15); + canselLabel.textAlignment = NSTextAlignmentLeft; + canselLabel.textColor = CFontColor1; + [self.jibingView addSubview:canselLabel]; + + + + + NSMutableArray *_dataSource = @[ + ].mutableCopy; + + + ZHTagListConfiguration *config = [ZHTagListConfiguration defaultConfiguration]; + config.tagTextColor = CFontColor1; + config.tagTextMargin = 11; + config.tagHeight = 27; + config.tagTextFont = SYSTEMFONT(13); + config.tagListViewInset = UIEdgeInsetsMake(15, 15, 15, 10); + + ZHTagListView *tagList = [[ZHTagListView alloc] initWithFrame:CGRectMake(0, canselLabel.bottom, kScreenWidth , 0) configuration:config tagTexts:_dataSource]; + tagList.backgroundColor = KWhiteColor; + self.tagList = tagList; + [self.jibingView addSubview:tagList]; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (idx == 6) { + [obj setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; + *stop = YES; + } + }]; + [tagList setTagClickHandler:^(ZHTagListView *tagListView, NSString *tagText, NSUInteger index) { + + SicksModel * model = self.sickArray[index]; + [weakSelf selectDiseaAction:model.sicksName withID:model.sick_id]; + }]; + + //科室 + UIView * roomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.searchView.bottom + 41, kScreenWidth, 200)]; + self.roomView = roomView; + roomView.hidden = YES; + [self.view addSubview:roomView]; + + UILabel * roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10) , 110, 15)]; + roomLabel.text = @"科室"; + roomLabel.font = MEDIUMFONT(15); + roomLabel.textAlignment = NSTextAlignmentLeft; + roomLabel.textColor = CFontColor1; + [roomView addSubview:roomLabel]; + + //找专家 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); + layout.minimumLineSpacing = 10; + layout.minimumInteritemSpacing = 10; + + self.collectView = [[DoctorRoomCollectionView alloc]initWithFrame:CGRectMake(0, roomLabel.bottom + 15, kScreenWidth , 95 * 4 + 60) collectionViewLayout:layout]; + self.collectView.type = 1; + self.collectView.scrollEnabled = NO; + self.collectView.roomBlock = ^(NSString * _Nonnull deparmentID, NSString * _Nonnull deparmentName) { + + SearchZhuangJiaViewController * searvc = [[SearchZhuangJiaViewController alloc] init]; + searvc.departmentId = deparmentID; + searvc.departmentName = deparmentName; + searvc.sickId = @""; + searvc.hospitalId = @""; + searvc.doctorName = @""; + searvc.hospitalName = @""; + [weakSelf.navigationController pushViewController:searvc animated:YES]; + }; + + [roomView addSubview:self.collectView]; + + + roomView.height = self.collectView.bottom + kRealValue(10);; + +} + +- (void)topOnClick:(UIButton *)topBtn { + + for (UIButton * titBtn in self.btnArray) { + if (topBtn == titBtn) { + + titBtn.selected = true; + } + else + { + titBtn.selected = false; + } + } + + for (UIView * linV in self.lineArray) { + + if (linV.tag - 100 == topBtn.tag - 10) { + linV.hidden = false; + }else + { + linV.hidden = true; + } + } + //综合 + // 找医生 + if (topBtn.tag - 10 == 0) + { + self.type = 1; + self.pageNumber = 1; + self.jibingView.hidden = YES; + self.roomView.hidden = YES; + self.hospitalView.hidden = YES; + self.zhuanjiaView.hidden = YES; + self.homeTable.hidden = false; + [self createData]; + } + // 找医生 + if (topBtn.tag - 10 == 1) + { + self.type = 2; + self.pageNumber = 1; + self.jibingView.hidden = YES; + self.homeTable.hidden = YES; + self.hospitalView.hidden = YES; + self.roomView.hidden = YES; + self.zhuanjiaView.hidden = NO; + [self searchDoctor]; + } + // 找医院 + if (topBtn.tag - 10 == 2) + { + self.type = 3; + self.pageNumber = 1; + self.jibingView.hidden = YES; + self.homeTable.hidden = YES; + self.zhuanjiaView.hidden = YES; + self.hospitalView.hidden = NO; + self.roomView.hidden = YES; + [self searchHospatil]; + + } + // 找疾病 + if (topBtn.tag - 10 == 3 ) { + self.type = 4; + self.jibingView.hidden = false; + self.homeTable.hidden = YES; + self.roomView.hidden = YES; + self.hospitalView.hidden = YES; + self.zhuanjiaView.hidden = YES; + [self searchSikc]; + } + // 找疾病 + if (topBtn.tag - 10 == 4 ) { + self.type = 5; + self.jibingView.hidden = YES; + self.roomView.hidden = false; + self.homeTable.hidden = YES; + self.hospitalView.hidden = YES; + self.zhuanjiaView.hidden = YES; + [self searchRoom]; + } + +} + +#pragma mark:找科室 +- (void)searchRoom { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:self.searchView.searchField.text forKey:@"search"]; + [dic setObject:@(self.pageNumber) forKey:@"pageNumber"]; + [dic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"RoomSEARCH" NeedToken:@""]; + + [searchApi getSearchRoomListData:dic]; +} + +#pragma mark:找疾病 +- (void)searchSikc { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:self.keywordString forKey:@"search"]; + [dic setObject:@(self.pageNumber) forKey:@"pageNumber"]; + [dic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"SicksSEARCH" NeedToken:@""]; + + [searchApi getSearchSicksListData:dic]; +} + +#pragma mark:找专家 +- (void)searchDoctor { + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:self.keywordString forKey:@"search"]; + [dic setObject:@(self.pageNumber) forKey:@"pageNumber"]; + [dic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"DoctorSEARCH" NeedToken:@""]; + + [searchApi getSearchDoctorData:dic]; + + +} + +#pragma mark:找医院 +- (void)searchHospatil { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:self.keywordString forKey:@"search"]; + [dic setObject:@(self.pageNumber) forKey:@"pageNumber"]; + [dic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"HOSPATILSEARCH" NeedToken:@""]; + + [searchApi getSearchHospatilData:dic]; +} + + + +- (void)createData { + + [self showMBProgressHUDWithString:@"正在搜索中,请稍候..." autoHidden:false]; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + [dic setObject:self.keywordString forKey:@"search"]; + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"SEARCH" NeedToken:@""]; + + [searchApi getSearchZongheData:dic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.zhuanjiaView.mj_footer endRefreshing]; + [self.zhuanjiaView.mj_header endRefreshing]; + [self.hospitalView.mj_footer endRefreshing]; + [self.hospitalView.mj_header endRefreshing]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + + if ([tag isEqualToString:@"SEARCH"]) { + NSDictionary * dic = response ; + + FoundExpertModel * model = [FoundExpertModel modelWithDictionary:dic]; + + [self hiddenAllMBProgressHUD]; + self.homeTable.type = 1; //找专家 + self.homeTable.model = model; + + } + if ([tag isEqualToString:@"DoctorSEARCH"]) { + [self.zhuanjiaView.mj_footer endRefreshing]; + [self.zhuanjiaView.mj_header endRefreshing]; + NSArray * responseArray = response; + if (self.pageNumber == 1) { + [self.DoctorArray removeAllObjects]; + } + for (NSDictionary * resDic in responseArray) { + + DoctorListModel * model = [DoctorListModel modelWithDictionary:resDic]; + + if (!ValidStr(model.goodAt)) { + NSMutableAttributedString * att = [[NSMutableAttributedString alloc] initWithString:model.goodAt]; + NSInteger lins = [self getNumberOfLinesWithText:att andLabelWidth:kScreenWidth - 123]; + if (lins >=3) { + model.cellHeight = 300; + }else + { + UILabel * lab = [[UILabel alloc] init]; + + + CGFloat labH = [HQCommonUtils getSpaceLabelHeight:lab withStr:model.goodAt withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:kScreenWidth - 123 withLineSpacing:5]; + model.cellHeight = 120 + labH + 110; + } + }else + { + model.cellHeight = 120 + 15 + 110; + } + + [self.DoctorArray addObject:model]; + } + self.homeTable.type = 2; + + self.zhuanjiaView.dataArray = self.DoctorArray; + } + if ([tag isEqualToString:@"HOSPATILSEARCH"]) { + [self.hospitalView.mj_footer endRefreshing]; + [self.hospitalView.mj_header endRefreshing]; + NSArray * responseArray = response; + if (self.pageNumber == 1) { + [self.hospatilArray removeAllObjects]; + } + for (NSDictionary * resDic in responseArray) { + + HospitalInfoModel * model = [HospitalInfoModel modelWithDictionary:resDic]; + + [self.hospatilArray addObject:model]; + } + self.hospitalView.dataArray = self.hospatilArray; + } + + if ([tag isEqualToString:@"SicksSEARCH"]) { + + [self.sickArray removeAllObjects]; + NSMutableArray * sickNameArray = [[NSMutableArray alloc] init]; + for (NSDictionary * dic in response) { + + SicksModel * model = [SicksModel modelWithDictionary:dic]; + [sickNameArray addObject:model.sicksName]; + [self.sickArray addObject:model]; + } + self.tagList.tagDataArray = sickNameArray; + + } + + if ([tag isEqualToString:@"RoomSEARCH"]) { + + NSMutableArray * roomArray = [[NSMutableArray alloc] init]; + for (NSDictionary * dic in response) { + + DepartmentModel * model = [DepartmentModel modelWithDictionary:dic]; + [roomArray addObject:model]; + } + self.collectView.dataArray = roomArray; + + } + if ([tag isEqualToString:@"xuzhi"]) { + + NSDictionary * parmDic = response; + if ( ValidDict(parmDic)) + { + //cv大侠 + if (self.questionType == 1) //图文 + { + QuestionMustKnowViewController * questionVC = [[QuestionMustKnowViewController alloc] init]; + questionVC.doctorId = self.doctorId; + questionVC.popType = 1; //1 图文 0 音视频 2 用户须知 + [self.navigationController pushViewController:questionVC animated:YES]; + } + if (self.questionType == 2) //音视频 + { + QuestionMustKnowViewController * questionVC = [[QuestionMustKnowViewController alloc] init]; + questionVC.doctorId = self.doctorId; + questionVC.popType = 0; //1 图文 0 音视频 2 用户须知 + [self.navigationController pushViewController:questionVC animated:YES]; + } + } + else + { + if (self.questionType == 1) //图文 + { + SelectedQuestionViewController * questionVC = [[SelectedQuestionViewController alloc] init]; + questionVC.doctorID = self.doctorId; + questionVC.questionType = self.questionType ; + [self.navigationController pushViewController:questionVC animated:YES]; + } + if (self.questionType == 2) //音视频 + { + SelectedDoctorTimeVC * timeVC = [[SelectedDoctorTimeVC alloc] init]; + timeVC.doctorId = self.doctorId; + [self.navigationController pushViewController:timeVC animated:YES]; + } + } + } + +} + +#pragma mark:综合专家点击 +- (void)zongheZhuangjiaPictureAction:(NSString *)doctorID { + self.questionType = 1; + + self.doctorId = doctorID; + [self questionPictureAction:1]; + + +} + +- (void)zongheZhuangjiaVideoAction:(NSString *)doctorID { + self.doctorId = doctorID; + self.questionType = 2; + [self questionPictureAction:0]; + +} + +- (void)questionPictureAction:(NSInteger )type { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + +// [parmDic setObject:self.memberId forKey:@"memberId"]; +// 1 图文 0 音视频 2 用户须知 + [parmDic setObject:@(type) forKey:@"type"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"xuzhi" NeedToken:@""]; + + [detailApi getFoundPopConnetResult :parmDic]; + + +} +//获取文本行数 +- (int)getNumberOfLinesWithText:(NSMutableAttributedString *)text andLabelWidth:(CGFloat)width { + CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)text); + CGMutablePathRef Path = CGPathCreateMutable(); + CGPathAddRect(Path, NULL ,CGRectMake(0 , 0 , width, INT_MAX)); + CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), Path, NULL); + // 得到字串在frame中被自动分成了多少个行。 + CFArrayRef rows = CTFrameGetLines(frame); + // 实际行数 + int numberOfLines = CFArrayGetCount(rows); + CFRelease(frame); + CGPathRelease(Path); + CFRelease(framesetter); + return numberOfLines; +} + +#pragma mark:疾病点击 + +- (void)selectDiseaAction:(NSString *)deparmentName withID:(NSString *)deparmentID { + +// FoundExpertSubViewController * foundVC = [[FoundExpertSubViewController alloc] init]; +// +// [self.navigationController pushViewController:foundVC animated:true]; + SearchZhuangJiaViewController * searvc = [[SearchZhuangJiaViewController alloc] init]; + searvc.departmentId = @""; + searvc.departmentName = @""; + searvc.sickName = deparmentName; + searvc.sickId = deparmentID; + searvc.hospitalId = @""; + searvc.doctorName = @""; + searvc.hospitalName = @""; + [self.navigationController pushViewController:searvc animated:YES]; + +} + +#pragma mark:更多疾病 + +- (void)moreSicksOnClick { + + UIButton * sickBtn = [self.view viewWithTag:13]; + + [self topOnClick:sickBtn]; + +} + +- (void)moreRoomsOnClick { + + UIButton * roomBtn = [self.view viewWithTag:14]; + + [self topOnClick:roomBtn]; + +} + +//- (void)zongheZhuangjiaVideoAction:(NSString *)doctorID { +// +// self.doctorId = doctorID; +// self.questionType = 2; +// [self questionPictureAction:0]; +//} +// +//-(void)zongheZhuangjiaPictureAction:(NSString *)doctorID { +// self.questionType = 1; +// +// self.doctorId = doctorID; +// [self questionPictureAction:1]; +// +//} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/SearchZhuangJiaViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/SearchZhuangJiaViewController.h new file mode 100644 index 0000000..27c2faa --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/SearchZhuangJiaViewController.h @@ -0,0 +1,28 @@ +// +// SearchJibingViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchZhuangJiaViewController : HQBaseViewController + +@property (nonatomic, copy) NSString * doctorName; +@property (nonatomic, copy) NSString * hospitalId; +@property (nonatomic, copy) NSString * departmentId; +@property (nonatomic, copy) NSString * sickId; +@property (nonatomic, copy) NSString * tfSort; + +@property (nonatomic, assign) NSInteger type; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * sickName; +@property (nonatomic, copy) NSString * hospitalName; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/SearchZhuangJiaViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/SearchZhuangJiaViewController.m new file mode 100644 index 0000000..d059bab --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/Search(搜索页面)/SearchZhuangJiaViewController.m @@ -0,0 +1,883 @@ +// +// SearchZhuangJiaViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import "SearchZhuangJiaViewController.h" +#import "ExpertMainViewController.h" +#import "HQSearchView.h" +#import "SearchConetShowTable.h" +#import "SearchZhuangjiaTable.h" +#import "SearchRoomModel.h" +#import "FoundExpertModel.h" +#import "SearchSicksModel.h" +//筛选 +#import "AllRoomsConditionView.h" +#import "AllHospitalConditionView.h" +#import "AllSicksConditionView.h" +#import "QuestionMustKnowViewController.h" +#import "SelectedQuestionViewController.h" +#import "SelectedDoctorTimeVC.h" + +@interface SearchZhuangJiaViewController () + +@property (nonatomic, strong) NSMutableArray * buttonArray; +@property (nonatomic, strong) NSMutableArray * topButtonArray; +@property (nonatomic, strong) SearchZhuangjiaTable * homeTable; + +@property (nonatomic, assign) NSInteger pageNo; +@property (nonatomic, assign) NSInteger pageSize; +@property (nonatomic, assign) NSInteger questionType; +@property (nonatomic, strong) NSString * doctorId; + +@property (nonatomic, strong) NSMutableArray * DoctorArray; + +#pragma mark:科室 +@property (nonatomic, strong) AllRoomsConditionView * roomsView; +@property (nonatomic, strong) NSMutableArray * roomsArray; +@property (nonatomic, strong) NSMutableArray * roomsRightArray; +@property (nonatomic, strong) NSString * room_Id; + +#pragma mark:医院 +@property (nonatomic, strong) AllHospitalConditionView * hospitalView; +@property (nonatomic, strong) NSMutableArray * hospitalArray; +#pragma mark:疾病 +@property (nonatomic, strong) AllSicksConditionView * sickConditionView; +@property (nonatomic, strong) NSMutableArray * sickArray; +@property (nonatomic, strong) NSMutableArray * sickRightArray; +@property (nonatomic, strong) NSString * sick_Id; + +@end + +@implementation SearchZhuangJiaViewController + +#pragma mark:懒加载 + +- (AllRoomsConditionView *)roomsView { + + if (!_roomsView) { + + _roomsView = [[AllRoomsConditionView alloc] initWithFrame:CGRectMake(0, 78 + kRealValue(13), kScreenWidth, kScreenHeight - 78 - kRealValue(13))]; + _roomsView.roomLeftDelegate = self; + } + + return _roomsView; +} + +- (AllHospitalConditionView *)hospitalView { + + if (!_hospitalView) { + + _hospitalView = [[AllHospitalConditionView alloc] initWithFrame:CGRectMake(0, 78 + kRealValue(13), kScreenWidth, kScreenHeight - 78 - kRealValue(13))]; + _hospitalView.hospitalDelegate = self; + } + + return _hospitalView; +} + +- (AllSicksConditionView *)sickConditionView { + + if (!_sickConditionView) { + + _sickConditionView = [[AllSicksConditionView alloc] initWithFrame:CGRectMake(0, 78 + kRealValue(13), kScreenWidth, kScreenHeight - 78 - kRealValue(13))]; + _sickConditionView.sicksLeftDelegate = self; + + } + + return _sickConditionView; +} + + +- (NSMutableArray *)roomsArray { + + if (!_roomsArray) { + + _roomsArray = [[NSMutableArray alloc] init]; + } + return _roomsArray; +} + +- (NSMutableArray *)roomsRightArray { + + if (!_roomsRightArray) { + + _roomsRightArray = [[NSMutableArray alloc] init]; + } + return _roomsRightArray; +} + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + } + + return _buttonArray; +} + +- (NSMutableArray *)DoctorArray { + + if (!_DoctorArray) { + + _DoctorArray = [[NSMutableArray alloc] init]; + } + + return _DoctorArray; + +} + +- (NSMutableArray *)hospitalArray { + + if (!_hospitalArray) { + + _hospitalArray = [[NSMutableArray alloc] init]; + } + + return _hospitalArray; +} + +- (NSMutableArray *)sickArray { + + if (!_sickArray) { + + _sickArray = [[NSMutableArray alloc] init]; + } + return _sickArray; + +} + +- (NSMutableArray *)sickRightArray { + + if (!_sickRightArray) { + + _sickRightArray = [[NSMutableArray alloc] init]; + } + return _sickRightArray; + +} + +- (NSMutableArray *)topButtonArray { + + if (!_topButtonArray) { + + _topButtonArray = [[NSMutableArray alloc] init]; + } + return _topButtonArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + if (self.type == 2) { + self.navigationItem.title = self.hospitalName; + }else{ + self.navigationItem.title = @"找专家"; + } + self.pageNo = 1; + self.tfSort = @"1"; + [self createUI]; + [self createData]; + [self createRoomsData]; + [self createAllHospiatlData]; + [self createAllSicksData]; + +} + +- (void)createUI { + MJWeakSelf + HQSearchView * searchView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 7, kScreenWidth, 40)]; + searchView.searchBlock = ^(NSString * _Nonnull fieldtext) { + [weakSelf.DoctorArray removeAllObjects]; + weakSelf.doctorName = fieldtext; + [weakSelf createData]; + }; + searchView.searchPlacehold = @"请输入关键字"; + [self.view addSubview:searchView]; + + CGFloat contW = (kScreenWidth - kRealValue(60))/3; + NSArray * titleArray; + if (self.type == 2) { + + titleArray = @[@"全部科室",@"全部疾病"]; + }else + { + titleArray = @[@"全部医院",@"全部科室",@"全部疾病"]; + } + + for (int i = 0; i < titleArray.count ; i++) { + + UIButton * hospatilBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15) + (kRealValue(15) + contW) * i, searchView.bottom + kRealValue(13), contW, 31)]; + hospatilBtn.layer.cornerRadius = 5; + hospatilBtn.layer.masksToBounds = YES; + hospatilBtn.layer.borderWidth = 1.0; + hospatilBtn.layer.borderColor = UIColorHex(#DDDDDD).CGColor; + [hospatilBtn setTitle:titleArray[i] forState:UIControlStateNormal]; + [hospatilBtn setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; + [hospatilBtn setImage:[UIImage imageNamed:@"garyDown"] forState:UIControlStateNormal]; + [hospatilBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [hospatilBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateSelected]; + if (self.type == 2) { + hospatilBtn.tag = 101 + i; + }else + { + hospatilBtn.tag = 100 + i; + } + hospatilBtn.titleLabel.font = SYSTEMFONT(14); + hospatilBtn.selected = false; + [hospatilBtn addTarget:self action:@selector(contAction:) forControlEvents:UIControlEventTouchUpInside]; + [hospatilBtn setImage:[UIImage imageNamed:@"upAccow_gary"] forState:UIControlStateSelected]; + + + if(!ValidStr(self.departmentName)) { + if (i == 1) { + [hospatilBtn setTitle:self.departmentName forState:UIControlStateNormal]; + [hospatilBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + + + } + } + if(!ValidStr(self.sickName)) { + if (i == 2) { + [hospatilBtn setTitle:self.sickName forState:UIControlStateNormal]; + [hospatilBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + + + } + } + [self.view addSubview:hospatilBtn]; + [self.buttonArray addObject:hospatilBtn]; + } + + NSArray * contArray = @[@"好评优先",@"热度优先",@"回复率"]; + + for (int i = 0; i < contArray.count ; i++) { + + UIButton * homeBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/3 * i, searchView.bottom + kRealValue(13) + 50, kScreenWidth/3, 40)]; + [homeBtn setTitle:contArray[i] forState:UIControlStateNormal]; + [homeBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [homeBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateSelected]; + homeBtn.tag = 200 + i; + homeBtn.titleLabel.font = SYSTEMFONT(14); + [homeBtn addTarget:self action:@selector(topListcontAction:) forControlEvents:UIControlEventTouchUpInside]; + if (i == 0) { + homeBtn.selected = YES; + } + [self.topButtonArray addObject:homeBtn]; + [self.view addSubview:homeBtn]; + } + + + + self.homeTable = [[SearchZhuangjiaTable alloc] initWithFrame:CGRectMake(0, searchView.bottom + kRealValue(13) + 90, kScreenWidth, kScreenHeight - searchView.bottom - kRealValue(13) - 90 - kTopHeight ) style:UITableViewStyleGrouped]; + self.homeTable.zhuangjiaDelegate = self; + self.homeTable.zhuangjiaListDelegate = self; + [self.view addSubview:self.homeTable]; + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + self.pageNo = 1; + [weakSelf createData]; + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + + [weakSelf createData]; + }]; + + //初始化一个emptyView + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noDataBox" titleStr:@"暂无数据" detailStr:@""]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = [UIColor blackColor]; + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + //按钮背景色 + emptyView.actionBtnBackGroundColor = KWhiteColor; + emptyView.actionBtnWidth = CGFLOAT_MIN; + emptyView.actionBtnHeight = CGFLOAT_MIN; + + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; + + +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:self.doctorName forKey:@"doctorName"]; + [dic setObject:self.hospitalId forKey:@"hospitalId"]; + [dic setObject:self.departmentId forKey:@"departmentId"]; + [dic setObject:self.sickId forKey:@"sickId"]; + [dic setObject:self.tfSort forKey:@"tfSort"]; + [dic setObject:@(self.pageNo) forKey:@"pageNo"]; + [dic setObject:@(20) forKey:@"pageSize"]; + +// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDoctor/selectDictListByNHDS?doctorName=&hospitalId=&departmentId=27424429373915145&sickId=&tfSort=1&pageNo=1&pageSize=100 HTTP/1.1 + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"SEARCH" NeedToken:@""]; + + [searchApi getSearchConditionsData:dic]; + +} + + +#pragma mark:全部科室 + +- (void)createRoomsData { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:@"0" forKey:@"parentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"FOUND" NeedToken:@""]; + [api getSearchRoomListLeftData:dic]; + +} +#pragma mark:全部科室: 右边数据 +- (void)createRoomsRightData:(NSString *)parentId { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:parentId forKey:@"parentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"RightFound" NeedToken:@""]; + [api getSearchRoomListLeftData:dic]; + +} +#pragma mark:全部医院 + +- (void)createAllHospiatlData { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + + + JKCQAPI * searchApi = [[JKCQAPI alloc] init:self tag:@"HospitalAPI" NeedToken:@""]; + [searchApi getConnditionHospitalData:dic]; + +} +#pragma mark:全部疾病 + +- (void)createAllSicksData { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:@"0" forKey:@"parentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"SICKFOUND" NeedToken:@""]; + [api getSearchjibingListLeftData:dic]; + + +} +#pragma mark:全部疾病: 右边数据 +- (void)createSicksRightData:(NSString *)parentId { + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + [dic setObject:parentId forKey:@"departmentId"]; + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"SickRight" NeedToken:@""]; + [api getSearchjibingListRightData:dic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"SEARCH"]) { + [self hiddenAllMBProgressHUD]; + NSArray * responseArray = response; + if (self.pageNo == 1) { + [self.DoctorArray removeAllObjects]; + } + for (NSDictionary * resDic in responseArray) { + + DoctorListModel * model = [DoctorListModel modelWithDictionary:resDic]; + + [self.DoctorArray addObject:model]; + } + self.homeTable.dataArray = self.DoctorArray; + } + + + if ([tag isEqualToString:@"FOUND"]) { + NSDictionary * responDic = response ; + [self.roomsArray removeAllObjects]; + + if ([responDic.allKeys containsObject:@"list"]) { + NSArray * array = [responDic objectForKey:@"list"]; + int i = 0 ; + SearchRoomModel * customModel = [[SearchRoomModel alloc] init]; + customModel.departmentName = @"全部科室"; + customModel.room_Id = @"0"; + customModel.isSelected = true; + [self.roomsArray insertObject:customModel atIndex:0]; + + for (NSDictionary * dic in array) { + + SearchRoomModel * model = [SearchRoomModel modelWithDictionary:dic]; + +// if (i == 0) { +// model.isSelected = false; +// }else +// { + model.isSelected = false; +// } + [self.roomsArray addObject:model]; + i ++; + } + + + + self.roomsView.leftArray = self.roomsArray; + + if (self.roomsArray.count > 0) { + + SearchRoomModel * roomModel = self.roomsArray[0]; + + [self createRoomsRightData:roomModel.room_Id]; + + } + } + } + + if ([tag isEqualToString:@"RightFound"]) + { + NSDictionary * responDic = response; + if ([responDic.allKeys containsObject:@"list"]) { + + NSArray * array = [responDic objectForKey:@"list"]; + + [self.roomsRightArray removeAllObjects]; + int i = 0 ; + int doctorNumber = 0; + for (NSDictionary * dic in array) { + + SearchRoomModel * rightModel = [SearchRoomModel modelWithDictionary:dic]; +// if (i == 0) { 以前默认选中 +// rightModel.isSelected = false; +// }else +// { +// rightModel.isSelected = false; +// } + rightModel.isSelected = false; + doctorNumber = [rightModel.doctorNum intValue] + doctorNumber; + [self.roomsRightArray addObject:rightModel]; + i ++; + } + if ([self.room_Id integerValue] == 0) { + self.roomsView.searchType = 1; + SearchRoomModel * customModel = [[SearchRoomModel alloc] init]; + customModel.departmentName = @"全部医生"; + customModel.room_Id = @"0"; + customModel.doctorNum = [NSString stringWithFormat:@"%d",doctorNumber]; + [self.roomsRightArray insertObject:customModel atIndex:0]; + } + self.roomsView.rightArray = self.roomsRightArray; + } + } + //医院 + if ([tag isEqualToString:@"HospitalAPI"]) { + + NSDictionary * dic = response; + NSArray * array; + if ([dic containsObjectForKey:@"hostitalList"]) { + + array = [dic objectForKey:@"hostitalList"]; + } + + for (NSDictionary * dic in array) { + + HospitalInfoModel * model = [HospitalInfoModel modelWithDictionary:dic]; + + [self.hospitalArray addObject:model]; + } + + HospitalInfoModel * hospitalModel = [[HospitalInfoModel alloc] init]; + hospitalModel.resourceName = @"全部医院"; + hospitalModel.hositalId = @"0"; + [self.hospitalArray insertObject:hospitalModel atIndex:0]; + self.hospitalView.dataArray = self.hospitalArray; + } + + if ([tag isEqualToString:@"SICKFOUND"]) { + [self.sickArray removeAllObjects]; + NSArray * array = response; + + SearchRoomModel * customModel = [[SearchRoomModel alloc] init]; + customModel.departmentName = @"全部疾病"; + customModel.room_Id = @"0"; + customModel.isSelected = true; + [self.sickArray insertObject:customModel atIndex:0]; + int i = 0 ; + for (NSDictionary * dic in array) { + + SearchRoomModel * model = [SearchRoomModel modelWithDictionary:dic]; + +// if (i == 0) { +// model.isSelected = YES; +// +// }else +// { + model.isSelected = false; +// } + [self.sickArray addObject:model]; + i ++; + } + + + + self.sickConditionView.leftArray = self.sickArray; + + if (self.sickArray.count > 0) { + + SearchRoomModel * roomModel = self.sickArray[0]; + + [self createSicksRightData:roomModel.room_Id]; + + } + } + + if ([tag isEqualToString:@"SickRight"]) + { + NSArray * array = response ; + [self.sickRightArray removeAllObjects]; + int i = 0 ; + + for (NSDictionary * dic in array) { + + SearchSicksModel * rightModel = [SearchSicksModel modelWithDictionary:dic]; +// if (i == 0) { +// rightModel.isSelected = YES; +// }else +// { + rightModel.isSelected = false; +// } + [self.sickRightArray addObject:rightModel]; + i ++; + } + if ([self.sick_Id integerValue] == 0) { + SearchSicksModel * customModel = [[SearchSicksModel alloc] init]; + customModel.sicksName = [NSString stringWithFormat:@"全部疾病"] ; + customModel.doctorNum = [NSString stringWithFormat:@"%ld",self.sickRightArray.count] ; + + customModel.sicks_id = @"0"; + [self.sickRightArray insertObject:customModel atIndex:0]; + } + self.sickConditionView.searchType = 2; + self.sickConditionView.rightArray = self.sickRightArray; + } + if ([tag isEqualToString:@"xuzhi"]) { + + NSDictionary * parmDic = response; + if ( ValidDict(parmDic)) + { + //cv大侠 + if (self.questionType == 1) //图文 + { + QuestionMustKnowViewController * questionVC = [[QuestionMustKnowViewController alloc] init]; + questionVC.doctorId = self.doctorId; + questionVC.popType = 1; //1 图文 0 音视频 2 用户须知 + [self.navigationController pushViewController:questionVC animated:YES]; + } + if (self.questionType == 2) //音视频 + { + QuestionMustKnowViewController * questionVC = [[QuestionMustKnowViewController alloc] init]; + questionVC.doctorId = self.doctorId; + questionVC.popType = 0; //1 图文 0 音视频 2 用户须知 + [self.navigationController pushViewController:questionVC animated:YES]; + } + } + else + { + if (self.questionType == 1) //图文 + { + SelectedQuestionViewController * questionVC = [[SelectedQuestionViewController alloc] init]; + questionVC.doctorID = self.doctorId; + questionVC.questionType = self.questionType ; + [self.navigationController pushViewController:questionVC animated:YES]; + } + if (self.questionType == 2) //音视频 + { + SelectedDoctorTimeVC * timeVC = [[SelectedDoctorTimeVC alloc] init]; + timeVC.doctorId = self.doctorId; + [self.navigationController pushViewController:timeVC animated:YES]; + } + } + } +} + +- (void)topListcontAction:(UIButton *)btn { + + self.tfSort = [NSString stringWithFormat:@"%ld",btn.tag - 200 + 1]; + btn.selected = !btn.selected; + + for (UIButton * topBtn in self.topButtonArray) { + + if (topBtn == btn) { + + topBtn.selected = topBtn.selected; + }else + { + topBtn.selected = NO; + } + } + [self createData]; +} + + +- (void)contAction:(UIButton *)actionBtn { + + + + actionBtn.selected = !actionBtn.selected; + + + switch (actionBtn.tag) { + case 100: //全部医院 + { + [self.roomsView removeFromSuperview]; + [self.sickConditionView removeFromSuperview]; + + if (actionBtn.selected == true) { + [self.view addSubview:self.hospitalView]; + }else + { + [self.hospitalView removeFromSuperview]; + + } + if ([actionBtn.currentTitle containsString:@"全部"]) { + [actionBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [actionBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateSelected]; + } + } + break; + case 101: //全部科室 + { + [self.hospitalView removeFromSuperview]; + [self.sickConditionView removeFromSuperview]; + if (actionBtn.selected == true) { + [self.view addSubview:self.roomsView]; + }else + { + [self.roomsView removeFromSuperview]; + } + if ([actionBtn.currentTitle containsString:@"全部"]) { + [actionBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [actionBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateSelected]; + } + } + break; + case 102: //全部疾病 + { + [self.roomsView removeFromSuperview]; + [self.hospitalView removeFromSuperview]; + + if (actionBtn.selected == true) { + [self.view addSubview:self.sickConditionView]; + }else + { + [self.sickConditionView removeFromSuperview]; + } + if ([actionBtn.currentTitle containsString:@"全部"]) { + [actionBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + [actionBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateSelected]; + } + } + break; + + default: + break; + } + + + +} + +#pragma mark:科室左边点击 + +- (void)roomsLeftAction:(NSInteger)index { + + SearchRoomModel * model = self.roomsArray[index]; + self.room_Id = model.room_Id; + [self createRoomsRightData:model.room_Id]; +} + +- (void)roomsRightAction:(NSString *)roomID { + + self.departmentId = roomID; + if ([self.departmentId integerValue] == 0) { + self.departmentId = @""; + } + for (UIButton * conntBtn in self.buttonArray) { + + if (conntBtn.tag == 101) { + for (SearchRoomModel * model in self.roomsRightArray) { + + if ([roomID isEqualToString:model.room_Id]) { + + [conntBtn setTitle:model.departmentName forState:UIControlStateNormal]; + [conntBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + if ([conntBtn.currentTitle containsString:@"全部"]) { + [conntBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + } + conntBtn.selected = NO; + } + } + } + if (conntBtn.tag == 102) { + conntBtn.selected = false; + self.sickId = @""; + [conntBtn setTitle:@"全部科室" forState:UIControlStateNormal]; + + [conntBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + } + } + [self createData]; + [self.roomsView removeFromSuperview]; +} + +#pragma mark:疾病左边点击 + +- (void)sicksLeftAction:(NSInteger)index { + + SearchRoomModel * model = self.sickArray[index]; + + self.sick_Id = model.room_Id; + + [self createSicksRightData:model.room_Id]; + +} + +- (void)sicksRightAction:(NSString *)roomID { + + self.sickId = roomID; + if ([self.sickId integerValue] == 0) { + self.sickId = @""; + } + + for (UIButton * conntBtn in self.buttonArray) { + + + if (conntBtn.tag == 102) { + for (SearchSicksModel * model in self.sickRightArray) { + + if ([roomID isEqualToString:model.sicks_id]) { + + [conntBtn setTitle:model.sicksName forState:UIControlStateNormal]; + [conntBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + conntBtn.selected = NO; + if ([conntBtn.currentTitle containsString:@"全部"]) { + [conntBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + } + } + } + } + + + } + [self createData]; + [self.sickConditionView removeFromSuperview]; +} + +- (void)hospitalListAction:(NSString *)hospitalName withID:(NSString *)hospitalID { + + self.hospitalId = hospitalID; + if ([self.hospitalId integerValue] == 0) { + self.hospitalId = @""; + } + for (UIButton * conntBtn in self.buttonArray) { + + if (conntBtn.tag == 100) { + conntBtn.selected = false; + [conntBtn setTitle:hospitalName forState:UIControlStateNormal]; + [conntBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + if ([conntBtn.currentTitle containsString:@"全部"]) { + [conntBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + } + + } + if (conntBtn.tag == 101) { +// [conntBtn setTitle:hospitalName forState:UIControlStateNormal]; +// [conntBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [conntBtn setTitle:@"全部科室" forState:UIControlStateNormal]; + [conntBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + + self.departmentId = @""; + conntBtn.selected = false; + } + if (conntBtn.tag == 102) { +// [conntBtn setTitle:hospitalName forState:UIControlStateNormal]; +// [conntBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [conntBtn setTitle:@"全部疾病" forState:UIControlStateNormal]; + [conntBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + self.sickId = @""; + conntBtn.selected = false; + } + } + [self createData]; + [self.hospitalView removeFromSuperview]; +} + +- (void)zhuangjiaJumpDetail:(NSString *)memberID { + + ExpertMainViewController * mainVC = [[ExpertMainViewController alloc] init]; + mainVC.doctorId = memberID; + [self.navigationController pushViewController:mainVC animated:YES]; + +} + +#pragma mark:综合专家点击 +- (void)zongheZhuangjiaPictureAction:(NSString *)doctorID { + self.questionType = 1; + + self.doctorId = doctorID; + [self questionPictureAction:1]; + + +} + +- (void)zongheZhuangjiaVideoAction:(NSString *)doctorID { + self.doctorId = doctorID; + self.questionType = 2; + [self questionPictureAction:0]; + +} + +- (void)questionPictureAction:(NSInteger )type { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + +// [parmDic setObject:self.memberId forKey:@"memberId"]; +// 1 图文 0 音视频 2 用户须知 + [parmDic setObject:@(type) forKey:@"type"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"xuzhi" NeedToken:@""]; + + [detailApi getFoundPopConnetResult :parmDic]; + + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SearchMainViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SearchMainViewController.h new file mode 100644 index 0000000..885ef41 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SearchMainViewController.h @@ -0,0 +1,16 @@ +// +// SearchMainViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/10. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchMainViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SearchMainViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SearchMainViewController.m new file mode 100644 index 0000000..9c51b00 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SearchMainViewController.m @@ -0,0 +1,53 @@ +// +// SearchMainViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/10. +// + +#import "SearchMainViewController.h" +#import "HQSearchView.h" + +@interface SearchMainViewController () + +@end + +@implementation SearchMainViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + self.navigationItem.title = @"搜索"; + [self createUI]; +} + +- (void)createUI { + + HQSearchView * searchView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 7, kScreenWidth, 35)]; + + [self.view addSubview:searchView]; + + NSArray * dataArray = @[@"综合",@"专家",@"医院",@"疾病",@"科室"]; + for (int i = 0 ; i < dataArray.count ; i ++) { + + UIButton * titleBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(21) + i * 55, searchView.bottom + kRealValue(21), 50, 15)]; + [titleBtn setTitle:dataArray[i] forState:UIControlStateNormal]; + titleBtn.titleLabel.font = SYSTEMFONT(14); + [self.view addSubview:titleBtn]; + } + +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectFIleDateDetailViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectFIleDateDetailViewController.h new file mode 100644 index 0000000..d1671f9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectFIleDateDetailViewController.h @@ -0,0 +1,18 @@ +// +// SelectFIleDateDetailViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "HQBaseViewController.h" +#import "QuestionDiseaseInfoModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface SelectFIleDateDetailViewController : HQBaseViewController + +@property (nonatomic, strong) QuestionDiseaseInfoModel * infomodel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectFIleDateDetailViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectFIleDateDetailViewController.m new file mode 100644 index 0000000..e67dbc1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectFIleDateDetailViewController.m @@ -0,0 +1,636 @@ +// +// SelectFIleDateDetailViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "SelectFIleDateDetailViewController.h" +#import "DetailTitleView.h" +#import "DetailUserInfoView.h" +#import "FileDataDeatilCenterView.h" +#import "BasicHealthInfoView.h" +#import "SelectedFileDateCenterView.h" +#import "QuestionItemTable.h" +#import "HQPhotoCollectView.h" +#import "FileDataModel.h" + +#import "TZPhotoPreviewController.h" +#import +#import "TZImagePickerController.h" +#import "TZImageManager.h" +#import +#import "TZAssetModel.h" +#define maxPhotoesCount 9 +#define maxColumnNum 4 + + +@interface SelectFIleDateDetailViewController () +{ + + + BOOL _isSelectOriginalPhoto; + +} +@property (nonatomic, strong) UIImagePickerController *imagePickerVc;//图片选择器 +@property (nonatomic, strong) UIAlertController *sheetVC;//选择框 +@property (nonatomic, strong) NSMutableArray * selectedPhotos;//选择的照片数 +@property (nonatomic, strong) NSMutableArray * selectedAssets; +@property (nonatomic, strong) NSMutableArray * imageUrlArray; +@property (nonatomic, assign) NSInteger chixuTime; + +@property (nonatomic, assign) NSInteger number; +@property (nonatomic, strong) SelectedFileDateCenterView * detailView ; +@property (nonatomic, strong) UIButton * bottomBtn ; +@property (nonatomic, strong) UIScrollView * mainScrollView; +@end + +@implementation SelectFIleDateDetailViewController + +#pragma mark:懒加载 + +- (NSMutableArray *)selectedAssets +{ + if (!_selectedAssets) + { + _selectedAssets = [[NSMutableArray alloc] init]; + } + return _selectedAssets; +} + +- (NSMutableArray *)selectedPhotos +{ + if (!_selectedPhotos) + { + _selectedPhotos = [[NSMutableArray alloc] init]; + } + return _selectedPhotos; +} + +- (NSMutableArray *)imageUrlArray { + + if (!_imageUrlArray) + { + _imageUrlArray = [[NSMutableArray alloc] init]; + } + return _imageUrlArray; + +} + +-(UIAlertController *)sheetVC{ + + if (!_sheetVC) { + + _sheetVC=[UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + + UIAlertAction *takePhoto=[UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self takePhoto]; + }]; + UIAlertAction *chosePhoto=[UIAlertAction actionWithTitle:@"去相册中选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self pushImagePickerController]; + }]; + UIAlertAction *cancel=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + + }]; + + [_sheetVC addAction:takePhoto]; + [_sheetVC addAction:chosePhoto]; + [_sheetVC addAction:cancel]; + } + return _sheetVC; + +} + +- (UIImagePickerController *)imagePickerVc { + if (_imagePickerVc == nil) { + _imagePickerVc = [[UIImagePickerController alloc] init]; + _imagePickerVc.delegate = self; + // set appearance / 改变相册选择页的导航栏外观 + _imagePickerVc.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor; + _imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor; + UIBarButtonItem *tzBarItem, *BarItem; + if (kiOS9Later) { + tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; + BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; + } else { + tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil]; + BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil]; + } + NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal]; + [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; + } + return _imagePickerVc; +} + +- (void)takePhoto { + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; + if ((authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)) { + // 无相机权限 做一个友好的提示 + UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的""设置-隐私-相机""中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil]; + [alert show]; + // 拍照之前还需要检查相册权限 + } else if ([[TZImageManager manager] authorizationStatusAuthorized] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 + UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的""设置-隐私-相册""中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil]; + alert.tag = 1; + [alert show]; + } else if ([[TZImageManager manager] authorizationStatusAuthorized] == 0) { // 正在弹框询问用户是否允许访问相册,监听权限状态 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + return [self takePhoto]; + }); + } else { // 调用相机 + UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; + if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { + self.imagePickerVc.sourceType = sourceType; + _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext; + [self presentViewController:_imagePickerVc animated:YES completion:nil]; + } else { + } + } +} + +#pragma mark - TZImagePickerController + +- (void)pushImagePickerController { + + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:maxPhotoesCount columnNumber:maxColumnNum delegate:self pushPhotoPickerVc:YES]; + +#pragma mark - 四类个性化设置,这些参数都可以不传,此时会走默认设置 + imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; + + // 1.设置目前已经选中的图片数组 + imagePickerVc.selectedAssets = _selectedAssets; // 目前已经选中的图片数组 + imagePickerVc.allowTakePicture =NO; // 不允许在内部显示拍照按钮 + + // 3. 设置是否可以选择视频/图片/原图 + imagePickerVc.allowPickingVideo = NO; + imagePickerVc.allowPickingImage = YES; + imagePickerVc.allowPickingOriginalPhoto = YES; + imagePickerVc.allowPickingGif = NO; + + // 4. 照片排列按修改时间升序 + imagePickerVc.sortAscendingByModificationDate = YES; + + + /// 5. 单选模式,maxImagesCount为1时才生效 + imagePickerVc.showSelectBtn = NO; + imagePickerVc.allowCrop = NO; + imagePickerVc.needCircleCrop =NO; + imagePickerVc.circleCropRadius = 100; + /* + [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) { + cropView.layer.borderColor = [UIColor redColor].CGColor; + cropView.layer.borderWidth = 2.0; + }];*/ + + //imagePickerVc.allowPreview = NO; +#pragma mark - 到这里为止 + + // You can get the photos by block, the same as by delegate. + // 你可以通过block或者代理,来得到用户选择的照片. + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { + + }]; + + [self presentViewController:imagePickerVc animated:YES completion:nil]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = UIColorHex(#F3F3F5); + self.isHidenNaviBar = false; + self.navigationItem.title = @"档案详情"; + [self createUI]; + + //网络状态监听 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(detailViewFrameChage:) + name:@"FrameChage" + object:nil]; + // Do any additional setup after loading the view. +} + +- (void)createUI { + + UIImageView * topImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)]; + topImage.image = [UIImage imageNamed:@"questionDetailBack"]; + [self.view addSubview:topImage]; + + + + UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight )]; + mainScrollView.showsVerticalScrollIndicator = false; + mainScrollView.showsHorizontalScrollIndicator = false; + mainScrollView.layer.cornerRadius = 8.0; + mainScrollView.layer.masksToBounds = true; + self.mainScrollView = mainScrollView; + mainScrollView.backgroundColor = KClearColor; + [self.view addSubview:mainScrollView]; + + DetailTitleView * titleview = [[DetailTitleView alloc] initWithFrame:CGRectMake(0, 0, mainScrollView.width, 33)]; + [mainScrollView addSubview:titleview]; + + //个人信息 + DetailUserInfoView * infoView = [[DetailUserInfoView alloc] initWithFrame:CGRectMake(0, titleview.bottom, kScreenWidth - kRealValue(30), kRealValue(103))]; + infoView.backgroundColor = KWhiteColor; + infoView.model = self.infomodel; + [mainScrollView addSubview:infoView]; + //问题 + SelectedFileDateCenterView * detailView = [[SelectedFileDateCenterView alloc] initWithFrame:CGRectMake(0, infoView.bottom + kRealValue(10), mainScrollView.width, 500)]; + detailView.questionOneDelegate = self; + detailView.photoDelegate = self; + [mainScrollView addSubview:detailView]; + detailView.height = detailView.questionH; + detailView.layer.cornerRadius = 10; + self.detailView = detailView; + [HQCommonUtils addShadowToView:detailView]; + +// BasicHealthInfoView * healthView = [[BasicHealthInfoView alloc] initWithFrame:CGRectMake(0,detailView.bottom + kRealValue(15), kScreenWidth - kRealValue(30), kRealValue(280))]; +// healthView.backgroundColor = [UIColor whiteColor]; +// healthView.layer.cornerRadius = 10.0; +// [HQCommonUtils addShadowToView:healthView]; +// [mainScrollView addSubview:healthView]; + + + UIButton * bottomBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 - 75, detailView.bottom + kRealValue(28), 150, 35)]; + [bottomBtn addTarget:self action:@selector(sureAction:) forControlEvents:UIControlEventTouchUpInside]; + bottomBtn.backgroundColor = KWhiteColor; +// bottomBtn.centerX = self.mainScrollView.centerX; + [bottomBtn setTitle:@"提交" forState:UIControlStateNormal]; + bottomBtn.layer.cornerRadius = 17; + bottomBtn.layer.masksToBounds = YES; + bottomBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + bottomBtn.layer.borderWidth = 1.0; + bottomBtn.titleLabel.font = SYSTEMFONT(14); + [bottomBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.bottomBtn = bottomBtn; + [self.mainScrollView addSubview:bottomBtn]; + + mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), bottomBtn.bottom + 50); + + + +} + +- (void)detailViewFrameChage:(NSNotification *)nofi { + + self.detailView.height = [nofi.object floatValue]; + self.bottomBtn.top = self.detailView.bottom + kRealValue(28); + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), self.bottomBtn.bottom + 50); + +} + +- (void)questionOneSelectedResult:(NSString *)result { + if ([result containsString:@"一周内"]) { + self.chixuTime = 1; + } + if ([result containsString:@"一个月内"]) { + self.chixuTime = 2; + } + if ([result containsString:@"半年内"]) { + self.chixuTime = 3; + } + if ([result containsString:@"半年以上"]) { + self.chixuTime = 4; + } + + +} + + +- (void)choosePhotoCell:(NSIndexPath *)index withCollectview:(UICollectionView *)collectView withIntab:(NSInteger )tableAtNumber +{ + + if (self.selectedPhotos.count == 9) + { + return; + } + + if (index.row == _selectedPhotos.count) { + [self presentViewController:self.sheetVC animated:YES completion:nil]; + + } else { // preview photos or video / 预览照片或者视频 + id asset = self.selectedAssets[index.row]; + BOOL isVideo = NO; + if ([asset isKindOfClass:[PHAsset class]]) { + PHAsset *phAsset = asset; + isVideo = phAsset.mediaType == PHAssetMediaTypeVideo; + } else if ([asset isKindOfClass:[ALAsset class]]) { + ALAsset *alAsset = asset; + isVideo = [[alAsset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]; + } + if ([[asset valueForKey:@"filename"] containsString:@"GIF"]) { + return; + } else if (isVideo) { // perview video / 预览视频 + return; + } else { // preview photos / 预览照片 + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:index.row]; + imagePickerVc.maxImagesCount = maxPhotoesCount; + imagePickerVc.allowPickingOriginalPhoto = YES; + imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { + self.selectedPhotos = [NSMutableArray arrayWithArray:photos]; + self.selectedAssets = [NSMutableArray arrayWithArray:assets]; + _isSelectOriginalPhoto = isSelectOriginalPhoto; + self.detailView.photoArray = self.selectedPhotos; +// collectView.contentSize = CGSizeMake(self.selectedPhotos.count * ( 12 + 60), 84); + }]; + [self presentViewController:imagePickerVc animated:YES completion:nil]; + } + } + + +} + + +#pragma mark--- UIImageImagePickerController delegate + +- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { + [picker dismissViewControllerAnimated:YES completion:nil]; + NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; + if ([type isEqualToString:@"public.image"]) { + TZImagePickerController *tzImagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; + tzImagePickerVc.sortAscendingByModificationDate = YES; + [tzImagePickerVc showProgressHUD]; + UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; + // save photo and get asset / 保存图片,获取到asset + [[TZImageManager manager] savePhotoWithImage:image completion:^(PHAsset *asset, NSError *error) { + if (error) { + [tzImagePickerVc hideProgressHUD]; + } else { + + [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:NO completion:^(TZAlbumModel *model) { + [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray *models) { + [tzImagePickerVc hideProgressHUD]; + TZAssetModel *assetModel = [models firstObject]; + if (tzImagePickerVc.sortAscendingByModificationDate) { + assetModel = [models lastObject]; + } + [self refreshCollectionViewWithAddedAsset:assetModel.asset image:image]; + }]; + }]; + } + }]; + + + } +} + + +- (void)refreshCollectionViewWithAddedAsset:(id)asset image:(UIImage *)image { + [self.selectedAssets addObject:asset]; + [self.selectedPhotos addObject:image]; + +// .pictureArray = [NSMutableArray arrayWithArray:self.selectedPhotos]; +// model.assetArray = [NSMutableArray arrayWithArray:self.selectedAssets]; +// [self.dataArray replaceObjectAtIndex:self.number withObject:model]; + self.detailView.photoArray = self.selectedPhotos; +} + +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { + if ([picker isKindOfClass:[UIImagePickerController class]]) { + [picker dismissViewControllerAnimated:YES completion:nil]; + } +} + + +#pragma mark - TZImagePickerControllerDelegate + +/// User click cancel button +/// 用户点击了取消 +- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker { +} + +// The picker should dismiss itself; when it dismissed these handle will be called. +// If isOriginalPhoto is YES, user picked the original photo. +// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:]. +// The UIImage Object in photos default width is 828px, you can set it by photoWidth property. +// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的代理方法 +// 如果isSelectOriginalPhoto为YES,表明用户选择了原图 +// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:] +// photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它 +- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto { + self.selectedPhotos = [NSMutableArray arrayWithArray:photos]; + self.selectedAssets = [NSMutableArray arrayWithArray:assets]; + _isSelectOriginalPhoto = isSelectOriginalPhoto; + +// [self.dataArray replaceObjectAtIndex:self.number withObject:model]; + self.detailView.photoArray = self.selectedPhotos; + // 1.打印图片名字 + [self printAssetsName:assets]; +} + + + +#pragma mark - Private + +/// 打印图片名字 +- (void)printAssetsName:(NSArray *)assets { + NSString *fileName; + for (id asset in assets) { + if ([asset isKindOfClass:[PHAsset class]]) { + PHAsset *phAsset = (PHAsset *)asset; + fileName = [phAsset valueForKey:@"filename"]; + } else if ([asset isKindOfClass:[ALAsset class]]) { + ALAsset *alAsset = (ALAsset *)asset; + fileName = alAsset.defaultRepresentation.filename;; + } + } +} + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return UIInterfaceOrientationMaskPortrait; +} + +#pragma mark===按钮点击方法 + +//删除按钮 +- (void)delectUserChoosePhoto:(NSInteger)indexTag withIntab:(NSInteger)tableAtNumber +{ + [self.selectedPhotos removeObjectAtIndex:indexTag]; + self.detailView.photoArray = self.selectedPhotos; + +} + +//提交按钮 +-(void)sureAction:(UIButton *)sender{ + + + + if (ValidStr(self.detailView.fileNameField.text)) { + [EasyTextView showErrorText:@"请输入档案名称"]; + return; + } + NSString * fileName = self.detailView.fileNameField.text; + //本次问题持续多久 + if (self.chixuTime <= 0) { + [EasyTextView showErrorText:@"请选择持续时间"]; + return; + } + //描述问题 + if (ValidStr(self.detailView.inputQuestion1View.text)) { + [EasyTextView showErrorText:@"请输入问题描述"]; + return; + } + NSString * questionString = self.detailView.inputQuestion1View.text; + //图片 + + NSString * imageString = [ self.imageUrlArray componentsJoinedByString:@","]; + //是否就诊过 + if (self.detailView.jiuzhenIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否就诊过"]; + return; + } + //就诊过医院 + //诊断结果 + //期待得到的帮助 + //是否允许专家查看体检报告 +// if (self.detailView.reportIsAction == NO ) { +// [EasyTextView showErrorText:@"请选择是否允许查看报告"]; +// return; +// } + + if (self.selectedPhotos.count <= 0) { //没图片直接上传 + + [self submitFileIpputData]; + + } + + + else + { + [self showMBProgressHUDWithString:@"上传中" autoHidden:NO]; + JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"UPLOADAPI" NeedToken:@""]; + + [upApi postImageArrayUpload:self.selectedPhotos withParmDic:@{@"biz":@""} ]; + } + + + + +} +#pragma mark - 网络请求 + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"UPLOADAPI"]) + { + + NSArray * array = response; + + [self.imageUrlArray addObjectsFromArray:array]; + [self hiddenAllMBProgressHUD]; + [self submitFileIpputData]; + } + + if ([tag isEqualToString:@"ADDFILE"]) + { + [EasyTextView showSuccessText:response]; + [self hiddenAllMBProgressHUD]; + [self.navigationController popViewControllerAnimated:YES]; + } + + +} + +- (void)submitFileIpputData { + + + //档案名称 + if (ValidStr(self.detailView.fileNameField.text)) { + [EasyTextView showErrorText:@"请输入档案名称"]; + return; + } + NSString * fileName = self.detailView.fileNameField.text; + //本次问题持续多久 + if (self.chixuTime <= 0) { + [EasyTextView showErrorText:@"请选择持续时间"]; + return; + } + self.chixuTime; + //描述问题 + if (ValidStr(self.detailView.inputQuestion1View.text)) { + [EasyTextView showErrorText:@"请输入问题描述"]; + return; + } + NSString * questionString = self.detailView.inputQuestion1View.text; + //图片 + NSString * imageString ; + if (self.imageUrlArray.count > 0) { + imageString = [ self.imageUrlArray componentsJoinedByString:@","]; + }else + { + imageString=@""; + } + //是否就诊过 + if (self.detailView.jiuzhenIsAction == NO ) { + [EasyTextView showErrorText:@"请选择是否就诊过"]; + return; + } + NSString * isJiuzhen = self.detailView.jiuzhenSelected == YES ? @"1":@"0"; + //就诊过医院 + NSString * hospationString = self.detailView.hospitalField.text ; + //诊断结果 + NSString * hospationResult = self.detailView.sicksField.text; + //期待得到的帮助 + NSString * helpString = self.detailView.helpInputView.text; + //是否允许专家查看体检报告 +// if (self.detailView.reportIsAction == NO ) { +// [EasyTextView showErrorText:@"请选择是否允许查看报告"]; +// return; +// } +// BOOL lookReport = self.detailView.reportSelected; + NSString * lookReport = @"0"; + +// //是否允许专家查看你的基本信息 +// if (self.detailView.healthIsAction == NO ) { +// [EasyTextView showErrorText:@"请选择是否允许专家查看基本健康信息"]; +// return; +// } +// BOOL basicHealth = self.detailView.healthSelected; + //成员id + + [self showMBProgressHUDWithString:@"新增档案中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:fileName forKey:@"recordsName"]; + [parmDic setObject:questionString forKey:@"medicalDescribe"]; + [parmDic setObject:imageString forKey:@"image"]; + [parmDic setObject:@(self.chixuTime) forKey:@"haveTime"]; + [parmDic setObject:helpString forKey:@"desire"]; + [parmDic setObject:self.infomodel.memberId_id forKey:@"memberId"]; + [parmDic setObject:isJiuzhen forKey:@"tfLook"]; + [parmDic setObject:lookReport forKey:@"tfPermission"]; + [parmDic setObject:hospationString forKey:@"lookOffice"]; + [parmDic setObject:hospationResult forKey:@"lookMedicalName"]; + + + + JKCQAPI * addApi = [[JKCQAPI alloc] init:self tag:@"ADDFILE" NeedToken:@""]; + + [addApi PostMemberShipFileData:parmDic]; + + +} + + + +//点击屏幕空白处 +-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + //回收键盘,两者方式 + //UITextView *textView = (UITextView*)[self.view viewWithTag:1001]; + //[textView resignFirstResponder]; + [self.view endEditing:YES]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedDoctorTimeVC.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedDoctorTimeVC.h new file mode 100644 index 0000000..de49173 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedDoctorTimeVC.h @@ -0,0 +1,18 @@ +// +// SelectedDoctorTimeVC.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/21. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SelectedDoctorTimeVC : HQBaseViewController + +@property (nonatomic, copy) NSString * doctorId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedDoctorTimeVC.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedDoctorTimeVC.m new file mode 100644 index 0000000..d14f1d9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedDoctorTimeVC.m @@ -0,0 +1,488 @@ +// +// SelectedDoctorTimeVC.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/21. +// + +#import "SelectedDoctorTimeVC.h" +#import "FSXBStarRateView.h" +#import "DoctorTimeSelectedCollectView.h" +#import "ZHTagListView.h" +#import "DoctorDetailModel.h" +#import "DoctorTimeModel.h" +#import "DoctorMainViewController.h" +#import "SelectedQuestionViewController.h" + +@interface SelectedDoctorTimeVC () + +@property (nonatomic, strong) UIScrollView * mainScrollview; + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) UILabel * doctorLabel; + +@property (nonatomic, strong) UILabel * jobLabel; + +@property (nonatomic, strong) UILabel * hospitalLabel; + +@property (nonatomic, strong) FSXBStarRateView * starView; + +@property (nonatomic, strong) UIButton * collLoveBtn; + +@property (nonatomic, strong) UILabel * replyLabel; + +@property (nonatomic, strong) UILabel * satisfactionLabel; + +@property (nonatomic, strong) DoctorTimeSelectedCollectView * collectView; + +@property (nonatomic, strong) ZHTagListView * tagList; +@property (nonatomic, strong) UIImageView * starImg; +@property (nonatomic, strong) UILabel * evaluationLabel; +//@property (nonatomic, strong) UIView * hotView; +@property (nonatomic, strong) UIView * doctView; +@property (nonatomic, strong) NSString * schedulingDateId; +@end + +@implementation SelectedDoctorTimeVC + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.view.backgroundColor = KWhiteColor; + self.navigationItem.title = @"选择预约时间"; + [self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(popToVC) tags:@[@"10"]]; + [self createUI]; + [self createDoctorData]; + [self createData]; +} + +- (void)popToVC { + + [self.navigationController popViewControllerAnimated:YES]; + +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + //自定义navBar,根据当前的nav自定义 navBar + UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[HQBaseNavigationController class]]]; + //设置导航条字体颜色和大小 +// self.navigationController.navigationBar + NSDictionary *dict = [NSDictionary dictionary]; + if (@available(iOS 13.0, *)) { + // iOS 13 之后,这样设置导航条的相关属性才正确。之前的做法已失效 + dict = @{NSForegroundColorAttributeName: [UIColor tertiarySystemBackgroundColor], NSFontAttributeName: [UIFont systemFontOfSize:18]}; + UINavigationBarAppearance *navBarAppearance = [[UINavigationBarAppearance alloc]init]; + [navBarAppearance configureWithOpaqueBackground]; //Opaque: 不透明 + navBarAppearance.backgroundColor = UIColorHex(#21BEBD); + [navBarAppearance setTitleTextAttributes: dict]; + navBar.standardAppearance = navBarAppearance; + navBar.scrollEdgeAppearance = navBarAppearance; + } else { + dict = @{NSForegroundColorAttributeName: KWhiteColor, NSFontAttributeName: [UIFont systemFontOfSize:18]}; + //设置导航条背景色 + navBar.barTintColor = KWhiteColor; + [navBar setTitleTextAttributes:dict]; + } + //设置导航条不透明 + navBar.translucent = NO; + //设置除导航条以外的其他字体颜色 + [navBar setTintColor:UIColorHex(#21BEBD)]; + [navBar setBackgroundImage:[UIImage imageWithColor:UIColorHex(#21BEBD)] forBarMetrics:UIBarMetricsDefault]; + [navBar setShadowImage:[UIImage new]]; +} + +- (void)createUI { + + UIView * doctView = [[UIView alloc] initWithFrame:CGRectMake(0, 1, kScreenWidth, 137)]; + doctView.backgroundColor = UIColorHex(#21BEBD); + self.doctView = doctView; + [self.view addSubview:doctView]; + + + self.heardImage = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(10), 60, 60)]; + self.heardImage.layer.cornerRadius = 30.0f; + self.heardImage.layer.masksToBounds = true; + [doctView addSubview:self.heardImage]; + + self.doctorLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.heardImage.right + kRealValue(20), kRealValue(24), 100, 22)]; + self.doctorLabel.text = @""; + self.doctorLabel.font = BOLDSYSTEMFONT(21); + self.doctorLabel.textColor = KWhiteColor; + self.doctorLabel.textAlignment = NSTextAlignmentLeft; + CGFloat nameW = [HQCommonUtils getLengthFromText:self.doctorLabel.text andFontSize:21]; + self.doctorLabel.width = nameW + kRealValue(5); + [doctView addSubview:self.doctorLabel]; + + self.jobLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorLabel.right + kRealValue(12), kRealValue(30), 100, 13)]; + self.jobLabel.text = @""; + self.jobLabel.font = BOLDSYSTEMFONT(13); + self.jobLabel.textColor = KWhiteColor; + self.jobLabel.textAlignment = NSTextAlignmentLeft; + [doctView addSubview:self.jobLabel]; + + + self.collLoveBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(15) - 60, kRealValue(24), 60, 25)]; + self.collLoveBtn.titleLabel.font = MEDIUMFONT(12); + self.collLoveBtn.layer.cornerRadius = 13.0; + self.collLoveBtn.layer.masksToBounds = true; + [self.collLoveBtn addTarget:self action:@selector(collectHosptal:) forControlEvents:UIControlEventTouchUpInside]; + [doctView addSubview:self.collLoveBtn]; + + self.hospitalLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.heardImage.right + kRealValue(18),self.jobLabel.bottom + kRealValue(15) ,kScreenWidth - self.heardImage.right - kRealValue(30), 13)]; + self.hospitalLabel.text = @""; + self.hospitalLabel.font = BOLDSYSTEMFONT(13); + self.hospitalLabel.textColor = KWhiteColor; + self.hospitalLabel.textAlignment = NSTextAlignmentLeft; + [doctView addSubview:self.hospitalLabel]; + + NSMutableArray *_dataSource = @[ + ].mutableCopy; + + ZHTagListConfiguration *config = [ZHTagListConfiguration defaultConfiguration]; + config.tagTextColor = UIColorHex(#21BEBD); + config.tagTextMargin = 11; + config.tagHeight = 18; + config.tagTextFont = BOLDSYSTEMFONT(11); + config.tagBackColor = KWhiteColor; +// config.tagListViewInset = UIEdgeInsetsMake(15, 15, 15, 10); + + ZHTagListView *tagList = [[ZHTagListView alloc] initWithFrame:CGRectMake(self.heardImage.right + kRealValue(12) , self.hospitalLabel.bottom + kRealValue(8), kScreenWidth - kRealValue(120) , 0) configuration:config tagTexts:_dataSource]; + self.tagList = tagList; + [doctView addSubview:tagList]; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + }]; + + UIImageView * starImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(37), tagList.bottom + kRealValue(14), 15, 15)]; + starImg.image = [UIImage imageNamed:@"home_star"]; + self.starImg = starImg; + [doctView addSubview:starImg]; + + self.evaluationLabel = [[UILabel alloc] initWithFrame:CGRectMake(starImg.right + kRealValue(6), starImg.top + kRealValue(2), 50, 11)]; + self.evaluationLabel.font = SYSTEMFONT(13); + [doctView addSubview:self.evaluationLabel]; + +// UIView * hotView = [[UIView alloc] initWithFrame:CGRectMake(self.evaluationLabel.right + kRealValue(3), self.evaluationLabel.top, kRealValue(51), kRealValue(10))]; +// hotView.layer.cornerRadius = 5; +// hotView.layer.masksToBounds = YES; +// hotView.backgroundColor = UIColorHex(#ED2A26); +// self.hotView = hotView; +// [doctView addSubview:hotView]; +// +// UIView * currentHot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(51) * 0.4, kRealValue(10))]; +// currentHot.backgroundColor = UIColorHex(#FF7E31); +// currentHot.layer.cornerRadius = 5; +// currentHot.layer.masksToBounds = YES; +// [hotView addSubview:currentHot]; + + self.doctView.height = self.evaluationLabel.bottom + kRealValue(25); + + //添加滚动 + self.mainScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.doctView.bottom , kScreenWidth, kScreenHeight - self.doctView.bottom - kTopHeight)]; + [self.view addSubview:self.mainScrollview]; + +// UIView * infoView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), 87.5)]; +// infoView.backgroundColor = KWhiteColor; +// infoView.layer.cornerRadius = 10.0f; +// [HQCommonUtils addShadowToView:infoView]; +// [self.mainScrollview addSubview:infoView]; +// +// UIImageView * replayImage = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(26), kRealValue(24), kRealValue(40), kRealValue(40))]; +// replayImage.image = [UIImage imageNamed:@"repay_Icon"]; +// [infoView addSubview:replayImage]; +// +// self.replyLabel = [[UILabel alloc] initWithFrame:CGRectMake(replayImage.right + kRealValue(12), kRealValue(28), 100, 16)]; +// self.replyLabel.text = @"89%"; +// self.replyLabel.font = BOLDSYSTEMFONT(17); +// self.replyLabel.textColor = CFontColor1; +// self.replyLabel.textAlignment = NSTextAlignmentLeft; +// [infoView addSubview:self.replyLabel]; +// +// UILabel * replyShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(replayImage.right + kRealValue(12),self.replyLabel.bottom + kRealValue(8), kScreenWidth/2 - kRealValue(80), 11)]; +// replyShowLabel.text = @"24小时回复率"; +// replyShowLabel.font = MEDIUMFONT(11); +// replyShowLabel.textColor = UIColorHex(#666666); +// replyShowLabel.textAlignment = NSTextAlignmentLeft; +// [infoView addSubview:replyShowLabel]; +// +// +// UIImageView * satisfactionImage = [[UIImageView alloc] initWithFrame:CGRectMake(infoView.width/2 + kRealValue(22), kRealValue(24), kRealValue(40), kRealValue(40))]; +// satisfactionImage.image = [UIImage imageNamed:@"Satisfaction_icon"]; +// [infoView addSubview:satisfactionImage]; +// +// self.satisfactionLabel = [[UILabel alloc] initWithFrame:CGRectMake(satisfactionImage.right + kRealValue(12), kRealValue(28), 100, 16)]; +// self.satisfactionLabel.text = @"99%"; +// self.satisfactionLabel.font = BOLDSYSTEMFONT(17); +// self.satisfactionLabel.textColor = CFontColor1; +// self.satisfactionLabel.textAlignment = NSTextAlignmentLeft; +// [infoView addSubview:self.satisfactionLabel]; +// +// UILabel * satisShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(satisfactionImage.right + kRealValue(12),self.replyLabel.bottom + kRealValue(8), kScreenWidth/2 - kRealValue(80), 11)]; +// satisShowLabel.text = @"在线服务满意度"; +// satisShowLabel.font = MEDIUMFONT(11); +// satisShowLabel.textColor = UIColorHex(#666666); +// satisShowLabel.textAlignment = NSTextAlignmentLeft; +// [infoView addSubview:satisShowLabel]; +// + //选择预约时间 + + UILabel * timeTitlelabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),kRealValue(18), kScreenWidth/2, 14)]; + timeTitlelabel.text = @"选择预约时间"; + timeTitlelabel.font = BOLDSYSTEMFONT(14); + timeTitlelabel.textColor = UIColorHex(#333333); + timeTitlelabel.textAlignment = NSTextAlignmentLeft; + [self.mainScrollview addSubview:timeTitlelabel]; + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.itemSize = CGSizeMake((kScreenWidth - 48)/2,75); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(10, 15, 0, 15); + layout.minimumInteritemSpacing =6; + layout.minimumLineSpacing =6; + + self.collectView = [[DoctorTimeSelectedCollectView alloc]initWithFrame:CGRectMake(0, timeTitlelabel.bottom + kRealValue(12),kScreenWidth, kScreenHeight - kTopHeight - timeTitlelabel.bottom - kRealValue(12) - 40 ) collectionViewLayout:layout]; + self.collectView.timeDelegate = self; + [self.mainScrollview addSubview:self.collectView]; + + self.mainScrollview.contentSize = CGSizeMake(kScreenWidth, kScreenHeight - self.doctView.bottom); + + UIButton * bottomBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(31.5), kScreenHeight - kTopHeight - 30 - 40 , kScreenWidth - kRealValue(66), 40)]; + [bottomBtn setTitle:@"立即预约" forState:UIControlStateNormal]; + [bottomBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + + bottomBtn.titleLabel.font = SYSTEMFONT(14); + bottomBtn.layer.cornerRadius = 20; + bottomBtn.layer.masksToBounds = true; + bottomBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + [bottomBtn addTarget:self action:@selector(submitAppointClick) forControlEvents:UIControlEventTouchUpInside]; + bottomBtn.layer.borderWidth = 1.0f; + [self.view addSubview:bottomBtn]; +} + +- (void)createDoctorData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"DOCTORAPI" NeedToken:@""]; + + [detailApi getDoctorExpertMainData:parmDic]; + + +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * timeApi = [[JKCQAPI alloc] init:self tag:@"TimeAPI" NeedToken:@""]; + + [timeApi getExpertDoctorHaveTimeData:parmDic]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"DOCTORAPI"]) { + + [self hiddenAllMBProgressHUD]; + + NSDictionary * parmDic = response; + + DoctorDetailModel * model = [DoctorDetailModel modelWithDictionary:parmDic]; + + if ([model.tfFollow integerValue] == 1) { + [self.collLoveBtn setTitle:@"已关注" forState:UIControlStateNormal]; + [self.collLoveBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.collLoveBtn setImage:[UIImage imageWithColor:UIColor.grayColor] forState:UIControlStateNormal]; + self.collLoveBtn.backgroundColor = RGBA(221, 221, 221, 1); + self.collLoveBtn.selected = true; + + }else + { + [self.collLoveBtn setTitle:@" 关注" forState:UIControlStateNormal]; + [self.collLoveBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.collLoveBtn setImage:IMAGE_NAMED(@"collectLove") forState:UIControlStateNormal]; + self.collLoveBtn.backgroundColor = KWhiteColor ; + self.collLoveBtn.selected = false; + + } + self.doctorLabel.text = model.doctorName; + self.jobLabel.text = model.doctorTitle; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"doctorNoImage")]; + + //评分 + NSMutableAttributedString * firstPart = [[NSMutableAttributedString alloc] initWithString:@"综合评价:"]; + NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:11],NSForegroundColorAttributeName:KWhiteColor}; + [firstPart setAttributes:firstAttributes range:NSMakeRange(0,firstPart.length)]; + + NSMutableAttributedString * secondPart = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ / ",model.overallMerit]]; + NSDictionary * secondAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:KWhiteColor}; + [secondPart setAttributes:secondAttributes range:NSMakeRange(0,secondPart.length)]; + [firstPart appendAttributedString:secondPart]; + + NSMutableAttributedString * thirdPart = [[NSMutableAttributedString alloc] initWithString:@"24小时回复率:"]; + NSDictionary * thirdAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:11],NSForegroundColorAttributeName:KWhiteColor}; + [thirdPart setAttributes:thirdAttributes range:NSMakeRange(0,thirdPart.length)]; + [firstPart appendAttributedString:thirdPart]; + + NSMutableAttributedString * fourPart = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ / ",model.responseRate]]; + NSDictionary * fourAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:KWhiteColor}; + [fourPart setAttributes:fourAttributes range:NSMakeRange(0,fourPart.length)]; + [firstPart appendAttributedString:fourPart]; + + NSMutableAttributedString * fivePart = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"咨询量:%@",model.messageNum]]; + NSDictionary * fiveAttributes = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:11],NSForegroundColorAttributeName:KWhiteColor}; + [fivePart setAttributes:fiveAttributes range:NSMakeRange(0,fivePart.length)]; + [firstPart appendAttributedString:fivePart]; + + + + self.evaluationLabel.attributedText = firstPart; + + NSMutableArray * sicksArray = [[NSMutableArray alloc] init]; + + for (DoctorGoodAtSicknessModel * sicModel in model.goodAtSicknessName) { + + [sicksArray addObject:sicModel.sicksName]; + } + self.tagList.tagDataArray = sicksArray; + + self.tagList.tagDataArray = sicksArray; + //布局 + self.doctorLabel.width = [HQCommonUtils getLengthFromText:model.doctorName andFontSize:23]; + self.jobLabel.left = self.doctorLabel.right + kRealValue(12); + self.hospitalLabel.text = [NSString stringWithFormat:@"%@ %@",model.resourceName,model.departmentName]; + self.starImg.top = self.tagList.bottom + kRealValue(14); + CGSize attSize = [firstPart boundingRectWithSize:CGSizeMake(kScreenWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size; + self.evaluationLabel.frame = CGRectMake(self.starImg.right + kRealValue(6), self.starImg.top + kRealValue(2), attSize.width, 11); +// self.hotView.left = self.evaluationLabel.right + kRealValue(5); +// self.hotView.top = self.evaluationLabel.top; + self.doctView.height = self.evaluationLabel.bottom + kRealValue(25); + self.mainScrollview.frame = CGRectMake(0, self.doctView.bottom , kScreenWidth, kScreenHeight - self.doctView.bottom - kTopHeight); + self.mainScrollview.contentSize = CGSizeMake(kScreenWidth, kScreenHeight - self.doctView.bottom); + + + } + if ([tag isEqualToString:@"TimeAPI"]) { + +// NSArray * array = response; + NSMutableArray * array = [[NSMutableArray alloc] initWithArray:response]; + NSMutableArray * dataArray = [[NSMutableArray alloc] init]; + + + for (NSDictionary * dic in array) { + + DoctorTimeModel * model = [DoctorTimeModel modelWithDictionary:dic]; + model.isAppment = false; + [dataArray addObject:model]; + } + self.collectView.dataArray = dataArray; + } + if ([tag isEqualToString:@"CollAPI"]) { + + [self hiddenAllMBProgressHUD]; + [self.collLoveBtn setTitle:@"已关注" forState:UIControlStateNormal]; + [self.collLoveBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + self.collLoveBtn.backgroundColor = RGBA(221, 221, 221, 1); + [self.collLoveBtn setImage:[UIImage imageWithColor:UIColor.grayColor] forState:UIControlStateNormal]; + [EasyTextView showSuccessText:response]; + self.collLoveBtn.selected = true; + } + if ([tag isEqualToString:@"cancelAPI"]) { + [self hiddenAllMBProgressHUD]; + [self.collLoveBtn setTitle:@" 关注" forState:UIControlStateNormal]; + [self.collLoveBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [self.collLoveBtn setImage:IMAGE_NAMED(@"collectLove") forState:UIControlStateNormal]; + self.collLoveBtn.backgroundColor = KWhiteColor ; + self.collLoveBtn.selected = false; + [EasyTextView showSuccessText:response]; + + } +} + + + +- (void)collectHosptal:(UIButton *)collBtn { + + if (collBtn.selected == YES) { + + [self showMBProgressHUDWithString:@"取消关注,请稍候..." autoHidden:false ]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"cancelAPI" NeedToken:@""]; + + [detailApi getCancelCollectDoctorExpertData:parmDic]; + + }else + { + [self showMBProgressHUDWithString:@"关注中,请稍候..." autoHidden:false ]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.doctorId forKey:@"doctorId"]; + + JKCQAPI * detailApi = [[JKCQAPI alloc] init:self tag:@"CollAPI" NeedToken:@""]; + + [detailApi getCollectDoctorExpertData:parmDic]; + } +} + +- (void)doctorTimeSureAction:(NSString *)timeID { + + self.schedulingDateId = timeID; + +} + +- (void)submitAppointClick { + + if (ValidStr(self.schedulingDateId)) { + + [EasyTextView showErrorText:@"请选择预约时间"]; + return; + } + + SelectedQuestionViewController * questionVC = [[SelectedQuestionViewController alloc] init]; + questionVC.questionType = 2; + questionVC.schedulingDateId = self.schedulingDateId; + questionVC.doctorID = self.doctorId; + [self.navigationController pushViewController:questionVC animated:YES]; + + + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedQuestionViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedQuestionViewController.h new file mode 100644 index 0000000..93c57dd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedQuestionViewController.h @@ -0,0 +1,21 @@ +// +// SelectedQuestionViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SelectedQuestionViewController : HQBaseViewController + +@property (nonatomic, assign) NSInteger questionType; //1 图文 2音视频 +@property (nonatomic, copy) NSString * doctorID; +@property (nonatomic, copy) NSString * schedulingDateId; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedQuestionViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedQuestionViewController.m new file mode 100644 index 0000000..2fb7a5d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SelectedQuestionViewController.m @@ -0,0 +1,449 @@ +// +// SelectedQuestionViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "SelectedQuestionViewController.h" +#import "SelectedQuestionTableView.h" +#import "QuestionDiseaseInfoModel.h" +#import "SelectFIleDateDetailViewController.h" +#import "QuestionPeopleMangerVC.h" +#import "SelectedQuestionTypeTableCell.h" +#import "LookModficalFileViewController.h" +#import "SOSGroupIMModel.h" +#import "DoctorMainViewController.h" + +@interface SelectedQuestionViewController () + +@property (nonatomic, strong) SelectedQuestionTableView * tableView; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, assign) NSInteger isJump; + +@property (nonatomic, copy) NSString * data_ID; + +@property (nonatomic, strong) QuestionDiseaseInfoModel * disModel; +@end + +@implementation SelectedQuestionViewController + +#pragma mark:懒加载 + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + + return _dataArray; +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.pageNo = 1; + self.isHidenNaviBar = false; + self.view.backgroundColor = UIColorHex(#F4F4F4); + self.navigationItem.title = @"选择咨询人"; + [self addNavigationItemWithTitles:@[@"管理"] isLeft:NO target:self action:@selector(questionManager) tags:@[@"1000"]]; + [self createUI]; + [self getQuestionInfo]; +} +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + [self.tableView.mj_header beginRefreshing]; + +} + +- (void)createUI { + + self.tableView = [[SelectedQuestionTableView alloc] initWithFrame:CGRectMake(kRealValue(10), kRealValue(10), kScreenWidth - kRealValue(20), kScreenHeight - kTopHeight - 57 - SafetyAreaHeight) style:UITableViewStyleGrouped]; + self.tableView.backgroundColor = UIColorHex(#F4F4F4); + self.tableView.addDelegate = self; + self.tableView.diseaseDelegate = self; + self.tableView.peopleDelegate = self; + [self.view addSubview:self.tableView]; + + __weak __typeof(self) weakSelf = self; + self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + [weakSelf getQuestionInfo]; + + + }]; + self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + + [weakSelf getQuestionInfo]; + }]; + + if (self.questionType == 2) { + + UIButton * nextButton = [[UIButton alloc] initWithFrame:CGRectMake(0, kScreenHeight - kTopHeight - 22 - SafetyAreaHeight, kRealValue(150), 35)]; + [nextButton setTitle:@"下一步" forState:UIControlStateNormal]; + [nextButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + nextButton.layer.cornerRadius = 18; + nextButton.layer.masksToBounds = YES; + nextButton.layer.borderWidth = 1.0; + nextButton.layer.borderColor = UIColorHex(#21BEBD).CGColor; + nextButton.backgroundColor = KWhiteColor; + nextButton.titleLabel.font = SYSTEMFONT(14); + nextButton.centerX = self.view.centerX; + [nextButton addTarget:self action:@selector(nextAddQusetion) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:nextButton]; + + } + else + { + + UIButton * jumpButton = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 - kRealValue(170), kScreenHeight - kTopHeight - 35 - SafetyAreaHeight, kRealValue(150), 35)]; + [jumpButton setTitle:@"快速咨询" forState:UIControlStateNormal]; + [jumpButton setTitleColor:KWhiteColor forState:UIControlStateNormal]; + jumpButton.layer.cornerRadius = 18; + jumpButton.layer.masksToBounds = YES; + jumpButton.layer.borderWidth = 1.0; + jumpButton.layer.borderColor = UIColorHex(#21BEBD).CGColor; + jumpButton.backgroundColor = UIColorHex(#21BEBD); + jumpButton.titleLabel.font = SYSTEMFONT(14); + [jumpButton addTarget:self action:@selector(jumpQusetion) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:jumpButton]; + + UIButton * nextButton = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 + kRealValue(20), kScreenHeight - kTopHeight - 35 - SafetyAreaHeight, kRealValue(150), 35)]; + [nextButton setTitle:@"下一步" forState:UIControlStateNormal]; + [nextButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + nextButton.layer.cornerRadius = 18; + nextButton.layer.masksToBounds = YES; + nextButton.layer.borderWidth = 1.0; + nextButton.layer.borderColor = UIColorHex(#21BEBD).CGColor; + nextButton.backgroundColor = KWhiteColor; + nextButton.titleLabel.font = SYSTEMFONT(14); + [nextButton addTarget:self action:@selector(nextAddQusetion) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:nextButton]; + } + //初始化一个emptyView + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noDataBox" titleStr:@"暂无数据" detailStr:@""]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = [UIColor blackColor]; + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + //按钮背景色 + emptyView.actionBtnBackGroundColor = KWhiteColor; + emptyView.actionBtnWidth = CGFLOAT_MIN; + emptyView.actionBtnHeight = CGFLOAT_MIN; + + //设置空内容占位图 + self.tableView.ly_emptyView = emptyView; + + +} +#pragma mark:管理 +- (void)questionManager { + + QuestionPeopleMangerVC * mangerVC = [[QuestionPeopleMangerVC alloc] init]; + [self.navigationController pushViewController:mangerVC animated:YES]; +} + +#pragma mark:跳过 +- (void)jumpQusetion { + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + NSString * upID = @""; + NSString * onID = @""; + self.isJump = 1; + for (QuestionDiseaseInfoModel * mode in self.dataArray) { + + for (diseaseModel * subModel in mode.list) { + + if (subModel.isSelected == true) { + + upID = mode.memberId_id; + } + } + } + + [self showMBProgressHUDWithString:@"等待发起会话" autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init] ; + [parmDic setObject:@"" forKey:@"memberId"]; + [parmDic setObject:self.doctorID forKey:@"toAccount"]; + [parmDic setObject:upID forKey:@"medicalRecordsId"]; + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"PICTURE" NeedToken:@""]; + [questionApi postPictureQuestionAPI:parmDic]; +} + + +#pragma mark:下一步 +- (void)nextAddQusetion { + + //判断im是否登陆 没登录请求登录 retur + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + // + self.isJump = 2; + NSString * upID = @""; + NSString * onID = @""; + + for (QuestionDiseaseInfoModel * mode in self.dataArray) { + + for (diseaseModel * subModel in mode.list) { + + if (subModel.isSelected == true) { + + onID = subModel.tfper_id; + upID = mode.memberId_id; + self.disModel = mode; + self.disModel.memberId_id = mode.memberId_id; + self.data_ID = onID; + } + } + } + if (ValidStr(upID) || ValidStr(onID)) { + [EasyTextView showErrorText:@"请选择咨询人"]; + return; + } + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init] ; + + [parmDic setObject:upID forKey:@"memberId"]; + [parmDic setObject:self.doctorID forKey:@"toAccount"]; + [parmDic setObject:onID forKey:@"medicalRecordsId"]; + if (self.questionType == 1) { + [self showMBProgressHUDWithString:@"等待发起会话" autoHidden:NO]; + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"PICTURE" NeedToken:@""]; + [questionApi postPictureQuestionAPI:parmDic]; + + } + + if (self.questionType == 2) { + //音视频 + // schedulingDateId 时间id memberId 家庭成员id toAccount医生id contentType 2 medicalRecordsId 档案id + [self showMBProgressHUDWithString:@"预约中请等待~" autoHidden:NO]; + [parmDic setObject:@"2" forKey:@"contentType"]; + [parmDic setObject:self.schedulingDateId forKey:@"schedulingDateId"]; + + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"VIDEO" NeedToken:@""]; + [questionApi postVideoQuestionAPI:parmDic]; + } + +} + +- (void)getQuestionInfo { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init] ; + + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + + JKCQAPI * questionApi = [[JKCQAPI alloc] init:self tag:@"QUESTION" NeedToken:@""]; + + [questionApi getMembersSicksList:parmDic]; + + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self.tableView.mj_header endRefreshing]; + [self.tableView.mj_footer endRefreshing]; + [self hiddenAllMBProgressHUD]; + [EasyTextView showErrorText:message]; + + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + + if ([tag isEqualToString:@"QUESTION"]) { + [self.tableView.mj_header endRefreshing]; + [self.tableView.mj_footer endRefreshing]; + NSArray * array = response; + + if (self.pageNo == 1) { + + [self.dataArray removeAllObjects]; + } + + for (NSDictionary * dic in array) { + + + QuestionDiseaseInfoModel * model = [QuestionDiseaseInfoModel modelWithDictionary:dic]; + + model.rowHeight = 85 * model.list.count + kRealValue(10) * model.list.count; + + + [self.dataArray addObject:model]; + + + + } + + self.tableView.dataArray = self.dataArray; + } + + //判断是否的登录 + + if ([tag isEqualToString:@"PICTURE"]) { + + //判断是否的登录哦, + + [self hiddenAllMBProgressHUD]; + NSDictionary * resDic = response; + + SOSGroupIMModel * model = [SOSGroupIMModel modelWithDictionary:response]; + + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = model.groupId; + chatVC.member = model.member; + chatVC.disModel = self.disModel; + chatVC.pictureEnd_id = model.sosEnd_id; + chatVC.dangan_id = self.data_ID; + chatVC.questionType = 2; + chatVC.kuaisuzixun = [NSString stringWithFormat:@"%ld",self.isJump]; + chatVC.JumpType = self.isJump; + if (self.isJump == 1) { + chatVC.eableSendReport =false; + chatVC.eablehaveHelathData = false; + }else + { + chatVC.eableSendReport = true; + chatVC.eablehaveHelathData = false; + } + + chatVC.navTitle = @"图文咨询"; + chatVC.isVideo = NO; + chatVC.PopType = 10; + [self.navigationController pushViewController:chatVC animated:YES]; + + } + + if ([tag isEqualToString:@"VIDEO"]) { + [self hiddenAllMBProgressHUD]; + NSString * resultString = response; + DoctorMainViewController * doctorVC = [[DoctorMainViewController alloc] init]; + doctorVC.disModel = self.disModel; + doctorVC.yuyue_id = resultString; + [self.navigationController pushViewController:doctorVC animated:YES]; + } + if ([tag isEqualToString:@"loginIMAPI"]) { + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + [self nextAddQusetion]; + + } +} + +- (void)loginImAccount { + + [self showMBProgressHUDWithString:@"等待发起会话" autoHidden:NO]; + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} +#pragma mark:新增档案 + +- (void)addQuestionPeopleClick:(QuestionDiseaseInfoModel *)model { + + SelectFIleDateDetailViewController * detailVC = [[SelectFIleDateDetailViewController alloc] init]; + detailVC.infomodel = model; + [self.navigationController pushViewController:detailVC animated:YES]; + +} + +- (void)diseaseSelectedAction:(QuestionDiseaseInfoModel *)model { + + for (QuestionDiseaseInfoModel * infomodel in self.dataArray) { + + if (model == infomodel) { + + for (diseaseModel * nomalModel in infomodel.list) { + + if (nomalModel.isSelected == true) { + self.disModel = infomodel; + } + } + + }else + { + for (diseaseModel * nomalModel in infomodel.list) { + + nomalModel.isSelected = false; + } + } + } + + [self.tableView reloadData]; + + + +} + +#pragma mark:编辑修改 + +- (void)modficalFileAction:(diseaseModel *)model withQustionModel:(nonnull QuestionDiseaseInfoModel *)infoModel { + + LookModficalFileViewController * detailVC = [[LookModficalFileViewController alloc] init]; + detailVC.disModel = model; + detailVC.infomodel = infoModel; + detailVC.upID = infoModel.memberId_id; + detailVC.downID = model.tfper_id; + detailVC.questionType = self.questionType; + detailVC.schedulingDateId = self.schedulingDateId; + detailVC.doctorID = self.doctorID; + detailVC.isJump = self.isJump; + detailVC.isEdit = YES; + [self.navigationController pushViewController:detailVC animated:YES]; + + + + +} + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SmallHelpHandViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SmallHelpHandViewController.h new file mode 100644 index 0000000..93a0a0a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SmallHelpHandViewController.h @@ -0,0 +1,16 @@ +// +// SmallHelpHandViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/29. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SmallHelpHandViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SmallHelpHandViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SmallHelpHandViewController.m new file mode 100644 index 0000000..d423e70 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Controller/SmallHelpHandViewController.m @@ -0,0 +1,31 @@ +// +// SmallHelpHandViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/29. +// + +#import "SmallHelpHandViewController.h" + +@interface SmallHelpHandViewController () + +@end + +@implementation SmallHelpHandViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorDetailModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorDetailModel.h new file mode 100644 index 0000000..8da747d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorDetailModel.h @@ -0,0 +1,53 @@ +// +// DoctorDetailModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +@interface DoctorGoodAtSicknessModel : NSObject + +@property (nonatomic, copy) NSString * good_id; +@property (nonatomic, copy) NSString * sicksName; + + +@end + + +@interface DoctorDetailModel : NSObject + +@property (nonatomic, copy) NSString * doctorName; +@property (nonatomic, copy) NSString * departmentId; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * doctorStatus; +@property (nonatomic, copy) NSString * audioStatus; +@property (nonatomic, copy) NSString * tfFollow; +@property (nonatomic, copy) NSString * responseRate; +@property (nonatomic, copy) NSString * resourceId; +@property (nonatomic, copy) NSString * hospitalLevel; +@property (nonatomic, copy) NSString * goodAt; +@property (nonatomic, copy) NSString * type; +@property (nonatomic, copy) NSString * doctor_id; +@property (nonatomic, copy) NSString * doctorTitle; +@property (nonatomic, copy) NSString * degreeHeat; +@property (nonatomic, copy) NSString * tfShowFire; +@property (nonatomic, copy) NSString * messageNum; +@property (nonatomic, copy) NSString * doctorScore; +@property (nonatomic, copy) NSString * goodAtSickness; +@property (nonatomic, copy) NSString * resourceName; +@property (nonatomic, copy) NSString * overallMerit; +@property (nonatomic, copy) NSString * introduction; +@property (nonatomic, copy) NSString * photo; +@property (nonatomic, copy) NSString * doctorLabel; +@property (nonatomic, strong) NSArray * goodAtSicknessName; +@property (nonatomic, copy) NSString * experience; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorDetailModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorDetailModel.m new file mode 100644 index 0000000..1f4e27e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorDetailModel.m @@ -0,0 +1,39 @@ +// +// DoctorDetailModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import "DoctorDetailModel.h" + + +@implementation DoctorGoodAtSicknessModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"good_id" :@"id"}; + return dic; +} + +@end + + +@implementation DoctorDetailModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"doctor_id" :@"id"}; + return dic; +} + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"goodAtSicknessName":[DoctorGoodAtSicknessModel class], + + }; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorRecommendModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorRecommendModel.h new file mode 100644 index 0000000..0ce85b0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorRecommendModel.h @@ -0,0 +1,39 @@ +// +// DoctorRecommendModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +@interface QuestionDoctorListModel : NSObject + +@property (nonatomic, copy) NSString * doctorId; +@property (nonatomic, copy) NSString * doctorName; +@property (nonatomic, copy) NSString * photo; +@property (nonatomic, copy) NSString * resourceId; +@property (nonatomic, copy) NSString * resourceName; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * goodAt; +@property (nonatomic, copy) NSString * hospitalLevel; +@property (nonatomic, copy) NSString * doctorScore; +@property (nonatomic, copy) NSString * type; +@property (nonatomic, copy) NSString * departmentId; +@property (nonatomic, copy) NSString * doctorTitle; + +@end + + +@interface DoctorRecommendModel : NSObject + +@property (nonatomic, copy) NSString * haveSessioning; + +@property (nonatomic, strong) NSArray * list; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorRecommendModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorRecommendModel.m new file mode 100644 index 0000000..0f83016 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorRecommendModel.m @@ -0,0 +1,34 @@ +// +// DoctorRecommendModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import "DoctorRecommendModel.h" + +@implementation QuestionDoctorListModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"doctorId" :@"id"}; + return dic; +} + +@end + + + + +@implementation DoctorRecommendModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"list":[QuestionDoctorListModel class], + + }; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorReportModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorReportModel.h new file mode 100644 index 0000000..8f3a361 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorReportModel.h @@ -0,0 +1,140 @@ +// +// DoctorReportModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctoIMListModel : NSObject + +@property (nonatomic, strong) NSString * startTime; +@property (nonatomic, strong) NSString * endTime; +@property (nonatomic, strong) NSString * type; +@property (nonatomic, strong) NSString * startTimLong; +@property (nonatomic, strong) NSString * endTimeLong; + +@end + + +@interface DoctorAnswerModel : NSObject + +@property (nonatomic, strong) NSString * answerValue; +@property (nonatomic, strong) NSString * answerKey; + +@end + +@interface DoctorReportRecordsModel : NSObject + +@property (nonatomic, strong) NSString * recordsName; +@property (nonatomic, strong) NSString * gender; +@property (nonatomic, strong) NSString * createTime; +@property (nonatomic, strong) NSString * age; +@property (nonatomic, strong) NSString * image; +@property (nonatomic, strong) NSString * tfPermission; +@property (nonatomic, strong) NSString * medicalDescribe; +@property (nonatomic, strong) NSString * createTimeLong; +@property (nonatomic, strong) NSString * dangan_id; +@property (nonatomic, strong) NSString * haveTimeValue; +@property (nonatomic, strong) NSString * tfLook; +@property (nonatomic, strong) NSString * tfLookValue; +@property (nonatomic, strong) NSString * updateTime; +@property (nonatomic, strong) NSString * desire; +@property (nonatomic, strong) NSString * lookOffice; +@property (nonatomic, strong) NSString * lookMedicalName; + +@end + +@interface DoctorReportFamilyInfoModel : NSObject + +@property (nonatomic, strong) NSString * gender; +@property (nonatomic, strong) NSString * birthday; +@property (nonatomic, strong) NSString * groupId; +@property (nonatomic, strong) NSString * age; +@property (nonatomic, strong) NSString * name; +@property (nonatomic, strong) NSString * height; +@property (nonatomic, strong) NSString * weight; + +@end + +@interface DoctorReportConSessionModel : NSObject + +@property (nonatomic, strong) NSString * memberId; +@property (nonatomic, strong) NSString * toAccount; +@property (nonatomic, strong) NSString * fromAccount; +@property (nonatomic, strong) NSString * memberName; +@property (nonatomic, strong) NSString * memberSex; +@property (nonatomic, strong) NSString * memberAge; +@property (nonatomic, strong) NSString * medicalRecordsId; +@property (nonatomic, strong) NSString * schedulingDateId; +@property (nonatomic, strong) NSString * createTime; +@property (nonatomic, strong) NSString * sessionDate; +@property (nonatomic, strong) NSString * week; +@property (nonatomic, strong) NSString * amPm; +@property (nonatomic, strong) NSString * createTimeLong; +@property (nonatomic, strong) NSString * sessionDateLong; +@property (nonatomic, strong) NSString * contentType; +@property (nonatomic, strong) NSString * contentStatus; +@property (nonatomic, strong) NSString * doctorStartTime; +@property (nonatomic, strong) NSString * yuyue_id; +@property (nonatomic, strong) NSString * doctorStartTimeLong; +@property (nonatomic, strong) NSString * doctorEndTimeLong; +@property (nonatomic, strong) NSString * reasonType; +@property (nonatomic, strong) NSString * rejectReason; +@end + +@interface DoctorReportDoctorInfoModel : NSObject + +@property (nonatomic, strong) NSString * doctorName; +@property (nonatomic, strong) NSString * departmentId; +@property (nonatomic, strong) NSString * departmentName; +@property (nonatomic, strong) NSString * tfFollow; +@property (nonatomic, strong) NSString * responseRate; +@property (nonatomic, strong) NSString * resourceId; +@property (nonatomic, strong) NSString * conEvaluateDO; +@property (nonatomic, strong) NSString * hospitalLevel; +@property (nonatomic, strong) NSString * goodAt; +@property (nonatomic, strong) NSString * type; +@property (nonatomic, strong) NSString * goodAtSicknessName; +@property (nonatomic, strong) NSString * doctorTitle; +@property (nonatomic, strong) NSString * tfShowFire; +@property (nonatomic, strong) NSString * messageNum; + +@property (nonatomic, strong) NSString * doctorScore; +@property (nonatomic, strong) NSString * goodAtSickness; +@property (nonatomic, strong) NSString * resourceName; +@property (nonatomic, strong) NSString * introduction; +@property (nonatomic, strong) NSString * photo; +@property (nonatomic, strong) NSString * doctorLabel; +@property (nonatomic, strong) NSString * doctor_id; + +@end + +@interface DoctorConEvaluateDOModel : NSObject + +@property (nonatomic, strong) NSString * userName; +@property (nonatomic, strong) NSString * context; +@property (nonatomic, strong) NSString * time; +@property (nonatomic, strong) NSString * score; + +@end + +@interface DoctorReportModel : NSObject + +@property (nonatomic, strong) NSDictionary * conDoctorDO; +@property (nonatomic, strong) NSDictionary * conSession; +@property (nonatomic, strong) NSDictionary * conMedicalRecordsListDO; +@property (nonatomic, strong) NSDictionary * conMedicalRecordsDO; +@property (nonatomic, strong) NSDictionary * conFamilyMembersDO; +@property (nonatomic, strong) NSArray * imList; +@property (nonatomic, strong) NSDictionary * conEvaluateDO; +@property (nonatomic, strong) NSArray * answer; + +@property (nonatomic, strong) NSString * idNo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorReportModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorReportModel.m new file mode 100644 index 0000000..a9955e2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorReportModel.m @@ -0,0 +1,80 @@ +// +// DoctorReportModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/12. +// + +#import "DoctorReportModel.h" + +@implementation DoctoIMListModel + + + +@end + +@implementation DoctorAnswerModel + + +@end + + +@implementation DoctorReportRecordsModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"dangan_id" :@"id"}; + return dic; +} + +@end + + +@implementation DoctorReportFamilyInfoModel + +@end + +@implementation DoctorConEvaluateDOModel + +@end + + +@implementation DoctorReportDoctorInfoModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"doctor_id" :@"id"}; + return dic; +} + + +@end + + + +@implementation DoctorReportConSessionModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"yuyue_id" :@"id"}; + return dic; +} +@end + + + +@implementation DoctorReportModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"answer":[DoctorAnswerModel class], + @"imList":[DoctoIMListModel class], + + }; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorTimeModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorTimeModel.h new file mode 100644 index 0000000..005daee --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorTimeModel.h @@ -0,0 +1,26 @@ +// +// DoctorTimeModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorTimeModel : NSObject + +@property (nonatomic, copy) NSString * time_id; +@property (nonatomic, copy) NSString * readySchedulingNum; +@property (nonatomic, copy) NSString * type; +@property (nonatomic, copy) NSString * schedulingNum; +@property (nonatomic, copy) NSString * week; +@property (nonatomic, copy) NSString * schedulingDate; +@property (nonatomic, assign) BOOL isAppment; + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorTimeModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorTimeModel.m new file mode 100644 index 0000000..8a4e844 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/DoctorTimeModel.m @@ -0,0 +1,20 @@ +// +// DoctorTimeModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/20. +// + +#import "DoctorTimeModel.h" + +@implementation DoctorTimeModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"time_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/EvaluatListModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/EvaluatListModel.h new file mode 100644 index 0000000..5424697 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/EvaluatListModel.h @@ -0,0 +1,26 @@ +// +// EvaluatListModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface EvaluatListModel : NSObject + +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * score; +@property (nonatomic, copy) NSString * userName; +@property (nonatomic, copy) NSString * officeName; +@property (nonatomic, copy) NSString * time; +@property (nonatomic, copy) NSString * context; +@property (nonatomic, copy) NSString * sessionType; +@property (nonatomic, copy) NSString * evaluat_Id; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/EvaluatListModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/EvaluatListModel.m new file mode 100644 index 0000000..9611ed4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/EvaluatListModel.m @@ -0,0 +1,19 @@ +// +// EvaluatListModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import "EvaluatListModel.h" + +@implementation EvaluatListModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"evaluat_Id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FamilyMemberRelationModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FamilyMemberRelationModel.h new file mode 100644 index 0000000..107a83f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FamilyMemberRelationModel.h @@ -0,0 +1,22 @@ +// +// FamilyMemberRelationModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface FamilyMemberRelationModel : NSObject + +@property (nonatomic, copy) NSString * value; +@property (nonatomic, copy) NSString * text; +@property (nonatomic, copy) NSString * label; +@property (nonatomic, copy) NSString * title; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FamilyMemberRelationModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FamilyMemberRelationModel.m new file mode 100644 index 0000000..58d9889 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FamilyMemberRelationModel.m @@ -0,0 +1,12 @@ +// +// FamilyMemberRelationModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/21. +// + +#import "FamilyMemberRelationModel.h" + +@implementation FamilyMemberRelationModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FileDataModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FileDataModel.h new file mode 100644 index 0000000..66d96ea --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FileDataModel.h @@ -0,0 +1,20 @@ +// +// FileDataModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface FileDataModel : NSObject + +@property (nonatomic, strong)NSMutableArray *pictureArray; + +@property (nonatomic, strong)NSMutableArray *assetArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FileDataModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FileDataModel.m new file mode 100644 index 0000000..0cffd92 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FileDataModel.m @@ -0,0 +1,12 @@ +// +// FileDataModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "FileDataModel.h" + +@implementation FileDataModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FoundExpertModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FoundExpertModel.h new file mode 100644 index 0000000..d2bdfbb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FoundExpertModel.h @@ -0,0 +1,83 @@ +// +// FoundExpertModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import +#import "HospitalInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorListModel : NSObject + +@property (nonatomic, copy) NSString * doctorId; +@property (nonatomic, copy) NSString * doctorTitle; +@property (nonatomic, copy) NSString * goodAt; +@property (nonatomic, copy) NSString * experience; +@property (nonatomic, copy) NSString * doctorStatus; +@property (nonatomic, copy) NSString * gdId; +@property (nonatomic, copy) NSString * status; +@property (nonatomic, copy) NSString * type; +@property (nonatomic, copy) NSString * doctorName; +@property (nonatomic, copy) NSString * photo; +@property (nonatomic, copy) NSString * userScore; +@property (nonatomic, copy) NSString * responseRate;//回复率 +@property (nonatomic, copy) NSString * messageNum;//咨询量 +@property (nonatomic, copy) NSString * overallMerit;// 综合评价 +@property (nonatomic, copy) NSString * tfShowFire; +@property (nonatomic, copy) NSString * audioStatus; + + +@property (nonatomic, copy) NSString * hospitalLevel;// 综合评价 + +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, assign) CGFloat cellHeight; + +@end + + +@interface DepartmentModel : NSObject + +@property (nonatomic, copy) NSString * departmentId; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * sicks; +@property (nonatomic, copy) NSString * officeCode; +@property (nonatomic, copy) NSString * depar_id; +@property (nonatomic, copy) NSString * image; +@property (nonatomic, copy) NSString * mark; +@property (nonatomic, copy) NSString * doctorNum; + + +@end + +@interface SicksModel : NSObject + +@property (nonatomic, copy) NSString * sicksName; +@property (nonatomic, copy) NSString * sicksId; +@property (nonatomic, copy) NSString * departmentId; +@property (nonatomic, copy) NSString * sick_id; +@property (nonatomic, copy) NSString * doctorNum; + +@end + +@interface FoundExpertModel : NSObject + +@property (nonatomic, strong) NSArray *hospitalList; +@property (nonatomic, strong) NSArray *DepartmentList; +@property (nonatomic, strong) NSArray *SicksList; +@property (nonatomic, strong) NSArray *DoctorList; + + +@property (nonatomic, assign) NSInteger hospitalCount; +@property (nonatomic, assign) NSInteger DepartmentCount; +@property (nonatomic, assign) NSInteger SicksCount; + +@property (nonatomic, assign) CGFloat cellHeight; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FoundExpertModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FoundExpertModel.m new file mode 100644 index 0000000..a48008e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/FoundExpertModel.m @@ -0,0 +1,58 @@ +// +// FoundExpertModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import "FoundExpertModel.h" + + +@implementation DoctorListModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"doctorId" :@"id"}; + return dic; +} + +@end + +@implementation DepartmentModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"depar_id" :@"id"}; + return dic; +} + +@end + + +@implementation SicksModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"sick_id" :@"id"}; + return dic; +} + +@end + + +@implementation FoundExpertModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"hospitalList":[HospitalInfoModel class], + @"DepartmentList":[DepartmentModel class], + @"SicksList":[SicksModel class], + @"DoctorList":[DoctorListModel class] + + }; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HomeQusetionRecordsModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HomeQusetionRecordsModel.h new file mode 100644 index 0000000..0c907e7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HomeQusetionRecordsModel.h @@ -0,0 +1,39 @@ +// +// HomeQusetionRecordsModel.h +// QinghaiProject +// +// Created by Apple on 2024/7/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HomeQusetionRecordsModel : NSObject + +@property (nonatomic, strong) NSString * records_id; +@property (nonatomic, strong) NSString * memberId; +@property (nonatomic, strong) NSArray * toAccount; +@property (nonatomic, strong) NSString * toAccountHead; +@property (nonatomic, strong) NSString * toAccountName; +@property (nonatomic, strong) NSString * toAccountTitle; +@property (nonatomic, strong) NSString * departmentName; +@property (nonatomic, strong) NSString * resourceName; +@property (nonatomic, strong) NSString * hospitalLevel; +@property (nonatomic, strong) NSString * memberName; +@property (nonatomic, strong) NSString * memberSex; +@property (nonatomic, strong) NSString * memberAge; +@property (nonatomic, strong) NSString * imId; +@property (nonatomic, strong) NSString * contentStatus; +@property (nonatomic, strong) NSString * contentType; +@property (nonatomic, strong) NSString * medicalRecordsId; +@property (nonatomic, strong) NSString * createTime; +@property (nonatomic, strong) NSString * tfReply; +@property (nonatomic, strong) NSString * tfOwn; +@property (nonatomic, strong) NSString * createTimeLong; +@property (nonatomic, assign) NSInteger totalCount; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HomeQusetionRecordsModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HomeQusetionRecordsModel.m new file mode 100644 index 0000000..245e59a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HomeQusetionRecordsModel.m @@ -0,0 +1,19 @@ +// +// HomeQusetionRecordsModel.m +// QinghaiProject +// +// Created by Apple on 2024/7/6. +// + +#import "HomeQusetionRecordsModel.h" + +@implementation HomeQusetionRecordsModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"records_id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HospitalInfoModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HospitalInfoModel.h new file mode 100644 index 0000000..2e4a36c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HospitalInfoModel.h @@ -0,0 +1,56 @@ +// +// HospitalInfoModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalInfoModel : NSObject + +@property (nonatomic, copy) NSString * hositalId; + +@property (nonatomic, copy) NSString * resourceId; + +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, assign) CGFloat longitude; + +@property (nonatomic, assign) CGFloat latitude; + +@property (nonatomic, copy) NSString * type; + +@property (nonatomic, copy) NSString * img; + +@property (nonatomic, copy) NSString * url; + +@property (nonatomic, copy) NSString * province; + +@property (nonatomic, copy) NSString * level; +@property (nonatomic, copy) NSString * keyDepartments; +@property (nonatomic, copy) NSString * address; + +@property (nonatomic, copy) NSString * tfFollow; + +@property (nonatomic, copy) NSString * synopsis; + +@property (nonatomic, copy) NSString * doctorNum; +@property (nonatomic, copy) NSString * departmentNum; +@property (nonatomic, copy) NSString * resourceDetail; + +//知识库 +@property (nonatomic, copy) NSString * knowContent; + +@property (nonatomic, copy) NSString * knowTitle; + +@property (nonatomic, copy) NSString * knowPic; + +@property (nonatomic, copy) NSString * knowLookNumber; + +@property (nonatomic, copy) NSString * createTime; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HospitalInfoModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HospitalInfoModel.m new file mode 100644 index 0000000..66d512b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/HospitalInfoModel.m @@ -0,0 +1,18 @@ +// +// HospitalInfoModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "HospitalInfoModel.h" + +@implementation HospitalInfoModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"hositalId" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/LookFileDataModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/LookFileDataModel.h new file mode 100644 index 0000000..075cc7b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/LookFileDataModel.h @@ -0,0 +1,34 @@ +// +// LookFileDataModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LookFileDataModel : NSObject + + +@property (nonatomic, copy) NSString * file_id; +@property (nonatomic, copy) NSString * recordsName; +@property (nonatomic, copy) NSString * state; +@property (nonatomic, copy) NSString * lookOffice; +@property (nonatomic, copy) NSString * tfLookValue; +@property (nonatomic, copy) NSString * lookMedicalName; +@property (nonatomic, copy) NSString * tfLook; +@property (nonatomic, copy) NSString * haveTime; +@property (nonatomic, copy) NSString * image; +@property (nonatomic, copy) NSString * memberId; +@property (nonatomic, copy) NSString * tfPermission; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * medicalDescribe; +@property (nonatomic, copy) NSString * desire; +@property (nonatomic, copy) NSString * haveTimeValue; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/LookFileDataModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/LookFileDataModel.m new file mode 100644 index 0000000..01e0bc4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/LookFileDataModel.m @@ -0,0 +1,19 @@ +// +// LookFileDataModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/27. +// + +#import "LookFileDataModel.h" + +@implementation LookFileDataModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"file_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionBodyReportModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionBodyReportModel.h new file mode 100644 index 0000000..40d69ba --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionBodyReportModel.h @@ -0,0 +1,21 @@ +// +// QuestionBodyReportModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionBodyReportModel : NSObject + +@property (nonatomic, strong) NSString * insertdate; +@property (nonatomic, strong) NSString * tjrq; +@property (nonatomic, strong) NSString * name; +@property (nonatomic, strong) NSString * yymc; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionBodyReportModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionBodyReportModel.m new file mode 100644 index 0000000..1c6fc58 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionBodyReportModel.m @@ -0,0 +1,13 @@ +// +// QuestionBodyReportModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/19. +// + +#import "QuestionBodyReportModel.h" + +@implementation QuestionBodyReportModel + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionDiseaseInfoModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionDiseaseInfoModel.h new file mode 100644 index 0000000..695af6a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionDiseaseInfoModel.h @@ -0,0 +1,63 @@ +// +// QuestionDiseaseInfoModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/17. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +@interface diseaseModel : NSObject + +@property (nonatomic, copy) NSString * tfPermission; + +@property (nonatomic, copy) NSString * tfper_id; + +@property (nonatomic, copy) NSString * medicalDescribe; + +@property (nonatomic, copy) NSString * recordsName; + +@property (nonatomic, copy) NSString * createTime; + +@property (nonatomic, copy) NSString * name; + +@property (nonatomic, copy) NSString * image; + +@property (nonatomic, copy) NSString * gender; + +@property (nonatomic, copy) NSString * age; + +@property (nonatomic, assign) BOOL isSelected; + +@end + + + +@interface QuestionDiseaseInfoModel : NSObject + +@property (nonatomic, copy) NSString * gender; + +@property (nonatomic, copy) NSString * height; + +@property (nonatomic, copy) NSString * weight; + +@property (nonatomic, copy) NSString * age; + +@property (nonatomic, copy) NSString * familyRelation; + +@property (nonatomic, copy) NSString * name; + +@property (nonatomic, assign) CGFloat rowHeight; + +@property (nonatomic, copy) NSString * memberId_id; + + +@property (nonatomic, strong) NSArray * list; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionDiseaseInfoModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionDiseaseInfoModel.m new file mode 100644 index 0000000..ba740de --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionDiseaseInfoModel.m @@ -0,0 +1,40 @@ +// +// QuestionDiseaseInfoModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/17. +// + +#import "QuestionDiseaseInfoModel.h" + +@implementation diseaseModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"tfper_id" :@"id"}; + return dic; +} + + +@end + + + +@implementation QuestionDiseaseInfoModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"list":[diseaseModel class] + }; +} + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"memberId_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionItemModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionItemModel.h new file mode 100644 index 0000000..7810ae8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionItemModel.h @@ -0,0 +1,20 @@ +// +// QuestionItemModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionItemModel : NSObject + +@property (nonatomic, strong) NSString * Title; + +@property (nonatomic, assign) bool IsSelected; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionItemModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionItemModel.m new file mode 100644 index 0000000..da357a8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionItemModel.m @@ -0,0 +1,12 @@ +// +// QuestionItemModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "QuestionItemModel.h" + +@implementation QuestionItemModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionOptionModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionOptionModel.h new file mode 100644 index 0000000..5b103a7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionOptionModel.h @@ -0,0 +1,47 @@ +// +// QuestionOptionModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +@interface QuestionOptionCustomModel : NSObject + +//@{@"radioText":key,@"itemType":optionModel.itemType,@"checked":@(false),@"value":@"0"}; +@property (nonatomic, copy) NSString * radioText; +@property (nonatomic, copy) NSString * itemType; +@property (nonatomic, assign) bool checked; +@property (nonatomic, assign) NSInteger loctaionThin; + +@property (nonatomic, copy) NSString * value; +@end + +@interface QuestionOptionChildListModel : NSObject + +@property (nonatomic, copy) NSString * option_id; +@property (nonatomic, copy) NSString * itemProblem; +@property (nonatomic, copy) NSString * itemType; +@property (nonatomic, copy) NSString * itemOptions; +@property (nonatomic, copy) NSString * answerContent; +@property (nonatomic, assign) CGFloat cellHeight; +@property (nonatomic, assign) BOOL isAppment; +@property (nonatomic, strong) NSArray * answerList; + + +@end + + +@interface QuestionOptionModel : NSObject + + +@property (nonatomic, strong) NSArray * childList; +@property (nonatomic, copy) NSString * text; +@property (nonatomic, copy) NSString * value; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionOptionModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionOptionModel.m new file mode 100644 index 0000000..d5e45e2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionOptionModel.m @@ -0,0 +1,56 @@ +// +// QuestionOptionModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import "QuestionOptionModel.h" +@implementation QuestionOptionCustomModel + + + +@end + +@implementation QuestionOptionChildListModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"answerList":[QuestionOptionCustomModel class], + + }; +} + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"option_id" :@"id"}; + return dic; +} + + + + +@end + +@implementation QuestionOptionModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"option_id" :@"id"}; + return dic; +} + + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"childList":[QuestionOptionChildListModel class], + + }; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionPeopleModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionPeopleModel.h new file mode 100644 index 0000000..995c519 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionPeopleModel.h @@ -0,0 +1,33 @@ +// +// QuestionPeopleModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionPeopleModel : NSObject + +@property (nonatomic, copy) NSString * name; + +@property (nonatomic, copy) NSString * weight; + +@property (nonatomic, copy) NSString * age; + +@property (nonatomic, copy) NSString * birthday; + +@property (nonatomic, copy) NSString * familyRelation; + +@property (nonatomic, copy) NSString * gender; + +@property (nonatomic, copy) NSString * people_id; + +@property (nonatomic, assign) BOOL isSelected; + +@property (nonatomic, copy) NSString * height; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionPeopleModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionPeopleModel.m new file mode 100644 index 0000000..29da842 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionPeopleModel.m @@ -0,0 +1,19 @@ +// +// QuestionPeopleModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "QuestionPeopleModel.h" + +@implementation QuestionPeopleModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"people_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionRecordModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionRecordModel.h new file mode 100644 index 0000000..782ff4d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionRecordModel.h @@ -0,0 +1,43 @@ +// +// QuestionRecordModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionRecordModel : NSObject + +@property (nonatomic, copy) NSString * record_id; +@property (nonatomic, copy) NSString * memberId; +@property (nonatomic, copy) NSString * toAccount; +@property (nonatomic, copy) NSString * memberName; +@property (nonatomic, copy) NSString * memberSex; +@property (nonatomic, copy) NSString * memberAge; +@property (nonatomic, copy) NSString * imId; +@property (nonatomic, copy) NSString * image; +@property (nonatomic, copy) NSString * rejectReason; +@property (nonatomic, copy) NSString * doctorStartTime; +@property (nonatomic, copy) NSString * doctorEndTime; +@property (nonatomic, copy) NSString * contentStatus; +@property (nonatomic, copy) NSString * contentType; +@property (nonatomic, copy) NSString * medicalRecordsId; +@property (nonatomic, copy) NSString * schedulingDateId; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * sessionDate; +@property (nonatomic, copy) NSString * week; +@property (nonatomic, copy) NSString * amPm; +@property (nonatomic, copy) NSString * reasonType; +@property (nonatomic, copy) NSString * toAccountHead; +@property (nonatomic, copy) NSString * toAccountTitle; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * hospitalLevel; +@property (nonatomic, copy) NSString * toAccountName; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionRecordModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionRecordModel.m new file mode 100644 index 0000000..afa6586 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/QuestionRecordModel.m @@ -0,0 +1,20 @@ +// +// QuestionRecordModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QuestionRecordModel.h" + +@implementation QuestionRecordModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"record_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/RecordIMListDateModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/RecordIMListDateModel.h new file mode 100644 index 0000000..d2b4003 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/RecordIMListDateModel.h @@ -0,0 +1,52 @@ +// +// RecordIMListDateModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/23. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RecordIMListDateModel : NSObject + + +@property (nonatomic, copy) NSString * Record_id; +@property (nonatomic, copy) NSString * rejectReason; +@property (nonatomic, copy) NSString * fromAccount; +@property (nonatomic, copy) NSString * memberName; +@property (nonatomic, copy) NSString * hospitalLevel; +@property (nonatomic, copy) NSString * contentStatus; +@property (nonatomic, copy) NSString * schedulingDateId; +@property (nonatomic, copy) NSString * amPm; +@property (nonatomic, copy) NSString * toAccountName; +@property (nonatomic, copy) NSString * memberSex; +@property (nonatomic, copy) NSString * contentType; +@property (nonatomic, copy) NSString * reasonType; + +@property (nonatomic, copy) NSString * week; +@property (nonatomic, copy) NSString * toAccount; +@property (nonatomic, copy) NSString * sessionType; +@property (nonatomic, copy) NSString * medicalRecordsId; +@property (nonatomic, copy) NSString * toAccountHead; +@property (nonatomic, copy) NSString * toAccountTitle; +@property (nonatomic, copy) NSString * createTimeLong; +@property (nonatomic, copy) NSString * tfOwn; +@property (nonatomic, copy) NSString * memberId; + +@property (nonatomic, copy) NSString * doctorStartTime; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * tfReply; +@property (nonatomic, copy) NSString * doctorEndTimeLong; +@property (nonatomic, copy) NSString * sessionDate; +@property (nonatomic, copy) NSString * imId; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * memberAge; +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, assign) NSInteger unredCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/RecordIMListDateModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/RecordIMListDateModel.m new file mode 100644 index 0000000..ec88848 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/RecordIMListDateModel.m @@ -0,0 +1,19 @@ +// +// RecordIMListDateModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/23. +// + +#import "RecordIMListDateModel.h" + +@implementation RecordIMListDateModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"Record_id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SOSGroupIMModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SOSGroupIMModel.h new file mode 100644 index 0000000..8a815d9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SOSGroupIMModel.h @@ -0,0 +1,25 @@ +// +// SOSGroupIMModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SOSGroupIMModel : NSObject + +@property (nonatomic, copy) NSString * groupId; +@property (nonatomic, strong) NSArray * member; +@property (nonatomic, copy) NSString * resultcCreateGroup; +@property (nonatomic, copy) NSString * tfNew; +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * resultcAccountImport; +@property (nonatomic, copy) NSString * sosEnd_id; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SOSGroupIMModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SOSGroupIMModel.m new file mode 100644 index 0000000..b2135f1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SOSGroupIMModel.m @@ -0,0 +1,19 @@ +// +// SOSGroupIMModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/4. +// + +#import "SOSGroupIMModel.h" + +@implementation SOSGroupIMModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"sosEnd_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchRoomModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchRoomModel.h new file mode 100644 index 0000000..991f83b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchRoomModel.h @@ -0,0 +1,26 @@ +// +// SearchRoomModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchRoomModel : NSObject + +@property (nonatomic, copy) NSString * room_Id; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * doctorNum; +@property (nonatomic, copy) NSString * sickNum; +@property (nonatomic, copy) NSString * mark; +@property (nonatomic, assign) BOOL isSelected; +@property (nonatomic, copy) NSString * secondDepartmentNum; +@property (nonatomic, copy) NSString * type; //1 科室 2疾病 +@property (nonatomic, copy) NSString * CustomdepartmentName; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchRoomModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchRoomModel.m new file mode 100644 index 0000000..6dc650f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchRoomModel.m @@ -0,0 +1,19 @@ +// +// SearchRoomModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import "SearchRoomModel.h" + +@implementation SearchRoomModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"room_Id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchSicksModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchSicksModel.h new file mode 100644 index 0000000..a4cb75b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchSicksModel.h @@ -0,0 +1,27 @@ +// +// SearchSicksModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchSicksModel : NSObject + +@property (nonatomic, copy) NSString * departmentId; +@property (nonatomic, copy) NSString * sicksName; +@property (nonatomic, copy) NSString * doctorNum; +@property (nonatomic, copy) NSString * descript; +@property (nonatomic, copy) NSString * sicks_id; + +@property (nonatomic, copy) NSString * CustomdepartmentName; + + +@property (nonatomic, assign) BOOL isSelected; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchSicksModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchSicksModel.m new file mode 100644 index 0000000..44dd93c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SearchSicksModel.m @@ -0,0 +1,19 @@ +// +// SearchSicksModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/12. +// + +#import "SearchSicksModel.h" + +@implementation SearchSicksModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"sicks_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SmallHelpIMDataModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SmallHelpIMDataModel.h new file mode 100644 index 0000000..2ee21a5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SmallHelpIMDataModel.h @@ -0,0 +1,24 @@ +// +// SmallHelpIMDataModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SmallHelpIMDataModel : NSObject + +@property (nonatomic, strong) NSString * small_id; +@property (nonatomic, strong) NSString * groupId; +@property (nonatomic, strong) NSArray * member; +@property (nonatomic, strong) NSString * resultcCreateGroup; +@property (nonatomic, strong) NSString * tfNew; +@property (nonatomic, strong) NSString * userId; +@property (nonatomic, strong) NSString * resultcAccountImport; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SmallHelpIMDataModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SmallHelpIMDataModel.m new file mode 100644 index 0000000..bcdd622 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/Model/SmallHelpIMDataModel.m @@ -0,0 +1,18 @@ +// +// SmallHelpIMDataModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/24. +// + +#import "SmallHelpIMDataModel.h" + +@implementation SmallHelpIMDataModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"small_id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/ADJumpViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/ADJumpViewController.h new file mode 100644 index 0000000..cbd93f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/ADJumpViewController.h @@ -0,0 +1,18 @@ +// +// ADJumpViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/6. +// + +#import "BaseWebViewVC.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ADJumpViewController : BaseWebViewVC + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/ADJumpViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/ADJumpViewController.m new file mode 100644 index 0000000..a196b73 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/ADJumpViewController.m @@ -0,0 +1,35 @@ +// +// ADJumpViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/6. +// + +#import "ADJumpViewController.h" + +@interface ADJumpViewController () + + + +@end + +@implementation ADJumpViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + // Do any additional setup after loading the view. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HQSearchView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HQSearchView.h new file mode 100644 index 0000000..2108b6c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HQSearchView.h @@ -0,0 +1,26 @@ +// +// HQSearchView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^searchOnclick)(NSString * fieldtext); +typedef void(^searchClearButtonOnclick)(); + +@interface HQSearchView : UIView + +@property (nonatomic, strong) NSString * searchPlacehold; + +@property (nonatomic, strong) UITextField * searchField; + +@property (nonatomic, copy) searchOnclick searchBlock; +@property (nonatomic, copy) searchClearButtonOnclick cancelBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HQSearchView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HQSearchView.m new file mode 100644 index 0000000..68f728c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HQSearchView.m @@ -0,0 +1,106 @@ +// +// HQSearchView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import "HQSearchView.h" + +@interface HQSearchView () + + +@end + +@implementation HQSearchView + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.searchField = [[UITextField alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(65), 35)]; + self.searchField.returnKeyType = UIReturnKeySearch; + self.searchField.delegate = self; + self.searchField.layer.cornerRadius = 18.0f; + self.searchField.font = SYSTEMFONT(14); + self.searchField.layer.masksToBounds = true; + self.searchField.backgroundColor = UIColorHex(#F1F1F1); + //搜索图标 + + UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 37, 35)]; + + UIImageView *view = [[UIImageView alloc] init]; + //设置图片控制器的的图片 + view.image = [UIImage imageNamed:@"searchLeftIcon"]; + //设置图片的frame + view.width = 15; + view.height = 15; + view.center= leftView.center; + //左边搜索图标的模式 + view.contentMode = UIViewContentModeCenter; + [leftView addSubview:view]; + self.searchField.leftView = leftView; + //左边搜索图标总是显示 + self.searchField.leftViewMode = UITextFieldViewModeAlways; + //右边删除所有图标 + self.searchField.clearButtonMode = UITextFieldViewModeAlways; + + [self addSubview:self.searchField]; + + UIButton * seachBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.searchField.right, 0, 50, 35)]; + [seachBtn setTitle:@"搜索" forState:UIControlStateNormal]; + seachBtn.titleLabel.font = SYSTEMFONT(13); + [seachBtn setTitleColor:CFontColor2 forState:UIControlStateNormal]; + [seachBtn addTarget:self action:@selector(searchAction) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:seachBtn]; + +} + +- (void)setSearchPlacehold:(NSString *)searchPlacehold { + + _searchPlacehold = searchPlacehold; + + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:_searchPlacehold attributes: + @{NSForegroundColorAttributeName:[UIColor grayColor], + NSFontAttributeName:SYSTEMFONT(13)} + ]; + self.searchField.attributedPlaceholder = attrString; + +} + +- (BOOL)textFieldShouldReturn:(UITextField*)theTextField { + + [theTextField resignFirstResponder]; + + if (self.searchBlock) { + + self.searchBlock(theTextField.text); + } + return YES; +} + +- (BOOL)textFieldShouldClear:(UITextField *)textField { + [textField resignFirstResponder]; + if (self.cancelBlock) { + self.cancelBlock(); + } + return YES; +} + +- (void)searchAction { + + if (self.searchBlock) { + + self.searchBlock(self.searchField.text); + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportModel.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportModel.h new file mode 100644 index 0000000..bdb729c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportModel.h @@ -0,0 +1,99 @@ +// +// HealthPhyReportModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +//新增影像报告 + + +@interface thirdResultResModel : NSObject + +@property (nonatomic, copy) NSString * third_tId; +@property (nonatomic, copy) NSString * type; + +@property (nonatomic, copy) NSString * userResultId; +@property (nonatomic, copy) NSString * peItemName; +@property (nonatomic, copy) NSString * uniItemId; +@property (nonatomic, copy) NSString * printContext; +@property (nonatomic, copy) NSString * peResult; +@property (nonatomic, copy) NSString * unit; +@property (nonatomic, copy) NSString * colour; +@property (nonatomic, copy) NSString * textFlag; + +@end + + +@interface imageItemListModel : NSObject + +@property (nonatomic, copy) NSString * imageCheckName; +@property (nonatomic, copy) NSString * imageShowUrl; +@property (nonatomic, copy) NSString * imageClass; +@property (nonatomic, copy) NSString * studyInsId; +@property (nonatomic, copy) NSString * reportContent; +@property (nonatomic, copy) NSString * reportUrl; +@property (nonatomic, copy) NSString * reportDate; +@property (nonatomic, copy) NSString * imageClassName; +@property (nonatomic, assign) CGFloat textHeight; +@property (nonatomic, assign) CGFloat cellHeight; + +@end + +@interface senResultResModel : NSObject +@property (nonatomic, copy) NSString * uniItemClassId; +@property (nonatomic, copy) NSString * uniItemClassName; +@property (nonatomic, strong) NSArray * thirdResultRes; + +@end + +@interface resultItemResListModel : NSObject + +@property (nonatomic, copy) NSString * analysisId; +@property (nonatomic, copy) NSString * analysisName; +@property (nonatomic, copy) NSString * empBirthday; +@property (nonatomic, copy) NSString * medicalYear; +@property (nonatomic, assign) NSInteger rowNumber; +@property (nonatomic, strong) NSArray * senResultRes; +@property (nonatomic, strong) NSArray * allResultArray; + + +@end + +@interface HealthPhyReportModel : NSObject + +@property (nonatomic, copy) NSString * report_id; +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * userName; +@property (nonatomic, copy) NSString * sex; +@property (nonatomic, copy) NSString * sex_dictText; +@property (nonatomic, copy) NSString * age; +@property (nonatomic, copy) NSString * card; +@property (nonatomic, copy) NSString * mobilePhone; +@property (nonatomic, copy) NSString * peQueueDate; +@property (nonatomic, copy) NSString * empBirthday; +@property (nonatomic, copy) NSString * medicalYear; +@property (nonatomic, copy) NSString * suggest; +@property (nonatomic, copy) NSString * conclusion; +@property (nonatomic, copy) NSString * email; +@property (nonatomic, copy) NSString * empNativeplace; +@property (nonatomic, copy) NSString * hospitalName; + + +@property (nonatomic, assign) BOOL zhangkaiSug; +@property (nonatomic, assign) BOOL zhangkaiCon; + + + +@property (nonatomic, strong) NSArray * resultItemResList; + +@property (nonatomic, strong) NSArray * imageItemList; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportModel.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportModel.m new file mode 100644 index 0000000..294a636 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportModel.m @@ -0,0 +1,80 @@ +// +// HealthPhyReportModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import "HealthPhyReportModel.h" + +@implementation thirdResultResModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"third_tId" :@"id"}; + return dic; +} + + +@end + +@implementation imageItemListModel + + + +@end + +@implementation senResultResModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + + @"thirdResultRes":[thirdResultResModel class] + }; +} + + + +@end + + +@implementation resultItemResListModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"senResultRes":[senResultResModel class], + @"allResultArray":[thirdResultResModel class] + }; + +} + + + +@end + +@implementation HealthPhyReportModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"report_id" :@"id"}; + return dic; +} + + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"resultItemResList":[resultItemResListModel class], + @"imageItemList":[imageItemListModel class] + }; +} + + + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportTableView.h new file mode 100644 index 0000000..66e3d3a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportTableView.h @@ -0,0 +1,21 @@ +// +// HealthPhyReportTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import +#import "HealthPhyReportModel.h" +#import "HealthSugReportTableViewCell.h" +#import "imageReportTableViewCell.h" +NS_ASSUME_NONNULL_BEGIN + +@interface HealthPhyReportTableView : UITableView + +@property (nonatomic, strong) HealthPhyReportModel * model; +@property (nonatomic, copy) AudioPlayOnClickBlock audioBlock; +@property (nonatomic, copy) lookUserReport lookBlock; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportTableView.m new file mode 100644 index 0000000..ce37494 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthPhyReportTableView.m @@ -0,0 +1,371 @@ +// +// HealthPhyReportTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import "HealthPhyReportTableView.h" +#import "HealthPhyReportModel.h" +#import "SickNameTopTableViewCell.h" +#import "SickNameSubTableViewCell.h" +#import "imageReportTableViewCell.h" +@interface HealthPhyReportTableView () + + +@end + +@implementation HealthPhyReportTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; +} + + +- (void)setModel:(HealthPhyReportModel *)model { + + _model = model; + + [self reloadData]; + + +} + +- (void)setAudioBlock:(AudioPlayOnClickBlock)audioBlock { + _audioBlock = audioBlock; +} + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + if (section == 0) { + return 6; + + } + if (section == 1) { + if ( ValidStr(self.model.conclusion)) { + return 0; + } + + } + if (section == 2) { + if ( ValidStr(self.model.suggest)) { + return 0; + } + + } + if (section == 3) { + if (self.model.imageItemList.count >= 1) { + + return self.model.imageItemList.count; + } + else + { + return 0; + } + } + if (section > 3 + self.model.imageItemList.count ) { + + resultItemResListModel * itemModel = self.model.resultItemResList[section - 4]; + DLog(@"%ld----------%ld",section,itemModel.rowNumber); + return itemModel.rowNumber; + + } + return 1; + +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + //顶部个人信息-结论-建议 + 影像报告 + 体检结果 + + + return 4 + self.model.resultItemResList.count; + + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.section == 0) { + + UITableViewCell * infoCell = [tableView dequeueReusableCellWithIdentifier:@"INFOCELL"]; + + if (!infoCell) { + infoCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"INFOCELL"]; + } + infoCell.selectionStyle = UITableViewCellSelectionStyleNone; + NSArray * array; + if (self.model) { + NSString * name = [NSString stringWithFormat:@"姓名:%@",self.model.userName]; + NSString * sex = [NSString stringWithFormat:@"性别:%@",self.model.sex_dictText]; + NSString * card = [NSString stringWithFormat:@"身份证号:%@",self.model.card]; + NSString * bir = [NSString stringWithFormat:@"出生日期:%@",self.model.empBirthday]; + NSString * time = [NSString stringWithFormat:@"体检日期:%@",self.model.peQueueDate]; + NSString * hospital = [NSString stringWithFormat:@"体检医院:%@",self.model.hospitalName]; + array = @[name,sex,card,bir,time,hospital]; + infoCell.textLabel.text = array[indexPath.row]; + infoCell.textLabel.font = SYSTEMFONT(13); + } + + return infoCell; + + } + + + if (indexPath.section == 1 || indexPath.section == 2 ) + { + HealthSugReportTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"SUGCELL"]; + + if (!cell) { + + cell = [[HealthSugReportTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SUGCELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.zhankaiBlock = ^{ + [self reloadData]; + }; + cell.audioBlock = self.audioBlock; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + if (indexPath.section == 1) { + cell.cellTitleString = @"体检结论"; + cell.conModel = self.model; + } + if (indexPath.section == 2) { + cell.cellTitleString = @"体检建议"; + cell.sugModel = self.model; + } + return cell; + } + if (indexPath.section == 3) { + + imageReportTableViewCell * imgcell = [tableView dequeueReusableCellWithIdentifier:@"IMAGECELL"]; + + if (!imgcell) { + + imgcell = [[imageReportTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"IMAGECELL"]; + } + imgcell.model = self.model.imageItemList[indexPath.row]; + imgcell.lookBlock = ^(NSString * _Nonnull lookUrl) { + self.lookBlock(lookUrl); + }; + imgcell.selectionStyle = UITableViewCellSelectionStyleNone; + return imgcell; + } + else { + resultItemResListModel * itemModel = self.model.resultItemResList[indexPath.section - 4]; + + thirdResultResModel * thirdModel = itemModel.allResultArray[indexPath.row]; + + if ([thirdModel.type integerValue] == 2) { // 2是标题 // 1是内容 + + SickNameTopTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"TABTITLECELL"]; + + if (!cell) { + + cell = [[SickNameTopTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TABTITLECELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.model = thirdModel; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + + }else + { + SickNameSubTableViewCell * subcell = [tableView dequeueReusableCellWithIdentifier:@"CELLID"]; + + if (!subcell) { + + subcell = [[SickNameSubTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELLID"]; + } + subcell.model = thirdModel; + subcell.selectionStyle = UITableViewCellSelectionStyleNone; + return subcell; + } + } +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + if (section == 1) + { + return kRealValue(10); + } + if (section>= 3) + { + return kRealValue(30); + } + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} +// +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + if (indexPath.section == 0) { + + return kRealValue(30); + + } + + + if (indexPath.section == 1) + { + if ( ValidStr(self.model.conclusion)) { + return CGFLOAT_MIN; + } + if ( !ValidStr(self.model.conclusion) && self.model.zhangkaiCon == false) { + + return 150; + } + if (self.model.conclusion && self.model.zhangkaiCon == true ) { + + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[self.model.conclusion dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + // 查询文本排版结果 + // 计算文本尺寸YYTextLayout + CGSize maxSize = CGSizeMake(kScreenWidth - kRealValue(30) , MAXFLOAT); + YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:attrStr]; + CGFloat introHeight = layout.textBoundingSize.height; + // 记录真正的正确高度 + // 显示文本排版结果 + return introHeight + 100; + } + + } + if (indexPath.section == 2) + { + if ( ValidStr(self.model.suggest)) { + return CGFLOAT_MIN; + } + if ( !ValidStr(self.model.suggest) && self.model.zhangkaiSug == false) { + + return 150; + } + if (self.model.suggest && self.model.zhangkaiSug == true) { + + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[self.model.suggest dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + // 查询文本排版结果 + // 计算文本尺寸YYTextLayout + CGSize maxSize = CGSizeMake(kScreenWidth - kRealValue(30) , MAXFLOAT); + YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:attrStr]; + CGFloat introHeight = layout.textBoundingSize.height; + // 记录真正的正确高度 + // 显示文本排版结果 + return introHeight + 100; + } + + } + if (indexPath.section == 3) + { + if ( self.model.imageItemList.count >= 1 ) { + imageItemListModel * imageModel = self.model.imageItemList[indexPath.row]; + //kRealValue(15) + 16 标题高度 + 文本框高度 + return kRealValue(30) + 16 + imageModel.cellHeight + kRealValue(10); + }else + { + return CGFLOAT_MIN; + } + } + if (indexPath.section > 3) { +// + resultItemResListModel * itemModel = self.model.resultItemResList[indexPath.section - 4]; + + thirdResultResModel * thirdModel = itemModel.allResultArray[indexPath.row]; + + if ([thirdModel.type integerValue] == 2) { + kRealValue(80); + + } + if ([thirdModel.type integerValue] == 1) { + + + return kRealValue(40); + } + + } + + return kRealValue(80);; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + if (section == 1) { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + sectionHeardView.backgroundColor = CViewBgColor; + return sectionHeardView; + } + + if (section == 3) { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(30))]; + sectionHeardView.backgroundColor = KWhiteColor; + UILabel * secLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(0), 100, kRealValue(30))]; + secLabel.textAlignment = NSTextAlignmentLeft; + secLabel.font = BOLDSYSTEMFONT(15); + secLabel.textColor = CFontColor1; + secLabel.text = @"影像报告"; + [sectionHeardView addSubview:secLabel]; + return sectionHeardView; + } + if (section >3) { + resultItemResListModel * itemModel = self.model.resultItemResList[section - 4]; + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(30))]; + sectionHeardView.backgroundColor = KWhiteColor; + UILabel * secLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(0), 100, kRealValue(30))]; + secLabel.textAlignment = NSTextAlignmentLeft; + secLabel.font = BOLDSYSTEMFONT(15); + secLabel.textColor = CFontColor1; + secLabel.text = itemModel.analysisName; + [sectionHeardView addSubview:secLabel]; + return sectionHeardView; + } + + + + return [[UIView alloc] init]; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthSugReportTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthSugReportTableViewCell.h new file mode 100644 index 0000000..4c7b6c6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthSugReportTableViewCell.h @@ -0,0 +1,34 @@ +// +// HealthSugReportTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import +#import "HealthPhyReportModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^zhankaiSHowBlock)(); +typedef void(^AudioPlayOnClickBlock)(NSInteger audioTag); + + +@interface HealthSugReportTableViewCell : UITableViewCell + +@property (nonatomic, copy) NSString * htmlString; + +@property (nonatomic, copy) NSString * cellTitleString; + + + +@property (nonatomic, strong) HealthPhyReportModel * sugModel; +@property (nonatomic, strong) HealthPhyReportModel * conModel; + + +@property (nonatomic, copy) zhankaiSHowBlock zhankaiBlock; +@property (nonatomic, copy) AudioPlayOnClickBlock audioBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthSugReportTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthSugReportTableViewCell.m new file mode 100644 index 0000000..dc27775 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/HealthSugReportTableViewCell.m @@ -0,0 +1,223 @@ +// +// HealthSugReportTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import "HealthSugReportTableViewCell.h" + + +@interface HealthSugReportTableViewCell () + +@property (nonatomic, strong) YYLabel * jielunLabel; +@property (nonatomic, strong) UIView * leftView; +@property (nonatomic, strong) UILabel * titleLabel; +@property (nonatomic, strong) UIButton * showButton; +@property (nonatomic, strong) UIButton * aduioPlayBtn; + +@end + +@implementation HealthSugReportTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.leftView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(18), 2, kRealValue(13))]; + self.leftView.backgroundColor = KRedColor; + [self.contentView addSubview:self.leftView]; + + + UIButton * aduioPlayBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(75),kRealValue(10), kRealValue(60), kRealValue(25))];; + [aduioPlayBtn setTitle:@" 播放" forState:UIControlStateNormal]; + aduioPlayBtn.titleLabel.font = SYSTEMFONT(12); + [aduioPlayBtn setImage:[UIImage imageNamed:@"audioPlayIcon"] forState:UIControlStateNormal]; + [aduioPlayBtn setImage:[UIImage imageNamed:@"audioPlayIcon"] forState:UIControlStateSelected]; + [aduioPlayBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + aduioPlayBtn.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + aduioPlayBtn.selected = false; + self.aduioPlayBtn = aduioPlayBtn; + [aduioPlayBtn addTarget:self action:@selector(palyAudioAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.contentView addSubview:aduioPlayBtn]; + + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftView.right + kRealValue(10), kRealValue(16), 200, 16)]; + self.titleLabel.font = BOLDSYSTEMFONT(15); + self.titleLabel.textAlignment = NSTextAlignmentLeft; + self.titleLabel.textColor = UIColorHex(#333333); + [self.contentView addSubview:self.titleLabel]; + + + self.jielunLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kRealValue(15), self.titleLabel.bottom + kRealValue(8), kScreenWidth - kRealValue(30), 70)]; + self.jielunLabel.textAlignment = NSTextAlignmentLeft; + self.jielunLabel.font = MEDIUMFONT(13); + self.jielunLabel.textColor = UIColorHex(#333333); + self.jielunLabel.numberOfLines = 4; + // 显示文本排版结果 + [self.contentView addSubview:self.jielunLabel]; + + self.showButton = [[UIButton alloc] initWithFrame:CGRectMake(0, self.jielunLabel.bottom + kRealValue(1), kScreenWidth - kRealValue(30), kRealValue(25))];; + [self.showButton setTitle:@"展开" forState:UIControlStateNormal]; + self.showButton.titleLabel.font = SYSTEMFONT(12); + [self.showButton setImage:[UIImage imageNamed:@"downArrow_icon"] forState:UIControlStateNormal]; + [self.showButton setImage:[UIImage imageNamed:@"upAccow_gary"] forState:UIControlStateSelected]; + [self.showButton setTitleColor:CFontColor2 forState:UIControlStateNormal]; + self.showButton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft; + self.showButton.selected = false; + [self.showButton addTarget:self action:@selector(showMoreOnclick:) forControlEvents:UIControlEventTouchUpInside]; + [self.contentView addSubview:self.showButton]; + + +} + +- (void)setCellTitleString:(NSString *)cellTitleString { + + _cellTitleString = cellTitleString; + + self.titleLabel.text = cellTitleString; + + if ([_cellTitleString isEqualToString:@"体检结论"]) { + + self.leftView.backgroundColor = UIColorHex(#DA180F); + }else + { + self.leftView.backgroundColor = UIColorHex(#F6C60A); + + } +} + +- (void)setSugModel:(HealthPhyReportModel *)sugModel { + + _sugModel = sugModel; + + self.showButton.tag = 100; + self.aduioPlayBtn.tag = 400; + self.showButton.selected = _sugModel.zhangkaiSug; + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[_sugModel.suggest dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + self.jielunLabel.attributedText =attrStr; + + // 查询文本排版结果 + // 计算文本尺寸YYTextLayout + CGSize maxSize = CGSizeMake(kScreenWidth - kRealValue(30) , MAXFLOAT); + + YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:self.jielunLabel.attributedText]; + self.jielunLabel.textLayout = layout; + CGFloat introHeight = layout.textBoundingSize.height; + self.jielunLabel.width = maxSize.width; + // 记录真正的正确高度 + self.jielunLabel.height = introHeight; + // 显示文本排版结果 + + if (introHeight > 70 && _sugModel.zhangkaiSug == false) { + introHeight = 70; + self.jielunLabel.numberOfLines = 4; + }else + { + self.jielunLabel.numberOfLines = 0; + + } + self.jielunLabel.height = introHeight; + self.showButton.top = self.jielunLabel.bottom + kRealValue(2); + + + + + + +} +-(void)setConModel:(HealthPhyReportModel *)conModel { + + _conModel = conModel; + + self.showButton.tag = 200; + self.aduioPlayBtn.tag = 500; + self.showButton.selected = _conModel.zhangkaiCon; + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[_conModel.conclusion dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + self.jielunLabel.attributedText =attrStr; + + // 查询文本排版结果 + // 计算文本尺寸YYTextLayout + CGSize maxSize = CGSizeMake(kScreenWidth - kRealValue(30) , MAXFLOAT); + + YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:self.jielunLabel.attributedText]; + self.jielunLabel.textLayout = layout; + CGFloat introHeight = layout.textBoundingSize.height; + self.jielunLabel.width = maxSize.width; + // 记录真正的正确高度 + self.jielunLabel.height = introHeight; + // 显示文本排版结果 + + if (introHeight > 70 && _conModel.zhangkaiCon == false) { + introHeight = 75; + self.jielunLabel.numberOfLines = 4; + }else + { + self.jielunLabel.numberOfLines = 0; + + + } + self.jielunLabel.height = introHeight; + self.showButton.top = self.jielunLabel.bottom + kRealValue(2); + + + +} + +- (void)showMoreOnclick:(UIButton *)showBtn { + + showBtn.selected = !showBtn.selected; + + if (showBtn.tag == 100) { + _sugModel.zhangkaiSug = showBtn.selected; + if (_sugModel.zhangkaiSug == false) { + [showBtn setTitle:@"展开" forState:UIControlStateNormal]; + }else { + [showBtn setTitle:@"收起" forState:UIControlStateNormal]; + } + } + if (showBtn.tag == 200) { + _conModel.zhangkaiCon = showBtn.selected; + if (_sugModel.zhangkaiCon == false) { + [showBtn setTitle:@"展开" forState:UIControlStateNormal]; + }else { + [showBtn setTitle:@"收起" forState:UIControlStateNormal]; + } + } + if (self.zhankaiBlock) { + self.zhankaiBlock(); + } +} + +- (void)palyAudioAction:(UIButton *)audioBtn { + + //400) { //体检结论 + + if (self.audioBlock) { + self.audioBlock(audioBtn.tag); + } + // 500) { //体检建议 +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/LookReportImageViewController.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/LookReportImageViewController.h new file mode 100644 index 0000000..fc77983 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/LookReportImageViewController.h @@ -0,0 +1,23 @@ +// +// LookReportImageViewController.h +// EscortProject +// +// Created by Apple on 2024/2/26. +// + +#import "BaseWebViewVC.h" +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LookReportImageViewController : HQBaseViewController + +@property (nonatomic, strong) NSString * webTitle; + +@property (nonatomic, strong) NSString * webUrl; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/LookReportImageViewController.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/LookReportImageViewController.m new file mode 100644 index 0000000..ed3f4ca --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/LookReportImageViewController.m @@ -0,0 +1,173 @@ +// +// LookReportImageViewController.m +// EscortProject +// +// Created by Apple on 2024/2/26. +// + +#import "LookReportImageViewController.h" + +@interface LookReportImageViewController () + +@property (nonatomic, strong)NSURL *originalUrl; +@property (nonatomic, copy)NSString *videoUrl; +@property (nonatomic, copy)NSString *messageType; +@property (nonatomic, strong) WKWebView * wkWebView; + +@end + +@implementation LookReportImageViewController + + +#pragma mark - LifeCycle +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + self.isHidenNaviBar = false; + [self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backVC) tags:@[@""]]; + + if (self.webTitle) { + self.navigationItem.title = self.webTitle; + } + [self.view addSubview:self.wkWebView]; + [self webViewRequest]; +} + +- (void)backVC { + + [self.navigationController popViewControllerAnimated:YES]; +} + + + +- (void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + _wkWebView.navigationDelegate = nil; + _wkWebView.UIDelegate = nil; + //清除cookies + NSHTTPCookie *cookie; + NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + for (cookie in [storage cookies]) { + [storage deleteCookie:cookie]; + } + [[NSURLCache sharedURLCache] removeAllCachedResponses]; + [self clearWebViewCache]; +} + + +#pragma mark 懒加载 +-(WKWebView *)wkWebView{ + if (!_wkWebView) { + + NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width,initial-scale=1,minimum-scale=0.25,maximum-scale=2,user-scalable=yes'); document.getElementsByTagName('head')[0].appendChild(meta); var imgs = document.getElementsByTagName('img');for (var i in imgs){imgs[i].style.maxWidth='100%';imgs[i].style.height='auto';}"; + + + WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; + WKUserContentController *wkUController = [[WKUserContentController alloc] init]; + [wkUController addUserScript:wkUScript]; + WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; + wkWebConfig.userContentController = wkUController; + + _wkWebView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) configuration:wkWebConfig]; + _wkWebView.allowsBackForwardNavigationGestures = true; + } + return _wkWebView; +} + + +- (void)webViewRequest{ + NSString *urlString = self.webUrl; + [self hiddenAllMBProgressHUD]; + if (urlString.length > 0) { + [self showMBProgressHUDOnlyWithString:@"加载中"]; + NSURL *url = [NSURL URLWithString:urlString]; + NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; + if (self.wkWebView) { + [self.wkWebView loadRequest:urlRequest]; + } + } +} + + + + +#pragma mark - WKNavigationDelegate +- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{ + +} + +#pragma mark - WKScriptMessageHandler +- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { + [self hiddenAllMBProgressHUD]; + if (!navigationAction.targetFrame.isMainFrame) { + [webView loadRequest:navigationAction.request]; + } + return nil; +} + +- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{ + if (!self.webTitle) { + self.title = @"加载中..."; + } + +} + +- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{ + [self hiddenAllMBProgressHUD]; + + if (!self.webTitle) { + self.title = webView.title; + } + +} + +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(nonnull NSError *)error{ + [self hiddenAllMBProgressHUD]; +} + + +#pragma mark - 自定义 +- (void)onBackClicked{ + if ( self.wkWebView.canGoBack){ + [self.wkWebView goBack]; + } else { + [self clearWebViewCache]; + } +} + +- (void)clearWebViewCache{ + if (iOS9Later) { + NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes]; + NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0]; + [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{ + NSLog(@"-----clear webView cache success------"); + }]; + } else { + NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; + NSString *cookiesFolderPath = [libraryPath stringByAppendingString:@"/Cookies"]; + NSError *errors; + [[NSFileManager defaultManager] removeItemAtPath:cookiesFolderPath error:&errors]; + if (!errors) { + NSLog(@"-----clear wkWebView cache success------"); + } + } +} +- (NSString *)URLEncodedString:(NSString *)urlString{ + NSString *encodePath ; + if (!IOS7) { + encodePath = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + }else{ + encodePath = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + }return encodePath; +} + + +#pragma mark - SETTER + +- (void)setWebUrl:(NSString *)webUrl{ + _webUrl = webUrl; + [self webViewRequest]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameSubTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameSubTableViewCell.h new file mode 100644 index 0000000..3dc5836 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameSubTableViewCell.h @@ -0,0 +1,19 @@ +// +// SickNameSubTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import +#import "HealthPhyReportModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SickNameSubTableViewCell : UITableViewCell + +@property (nonatomic, strong) thirdResultResModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameSubTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameSubTableViewCell.m new file mode 100644 index 0000000..4da9430 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameSubTableViewCell.m @@ -0,0 +1,221 @@ +// +// SickNameSubTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import "SickNameSubTableViewCell.h" + + +@interface SickNameSubTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; +@property (nonatomic, strong) UILabel * resultLabel; +@property (nonatomic, strong) UILabel * danweiLabel; +@property (nonatomic, strong) UILabel * caokaoLabel; +@property (nonatomic, strong) UIButton * detailBtn; +@property (nonatomic, strong) UIView * popbackView; +@end + +@implementation SickNameSubTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + + + UIView * headView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kRealValue(40))]; + headView.backgroundColor =KWhiteColor; + [self.contentView addSubview:headView]; + + + + UILabel * nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kRealValue(127), kRealValue(40))]; + nameLabel.text = @""; + nameLabel.textAlignment = NSTextAlignmentCenter; + nameLabel.font = SYSTEMFONT(13); + nameLabel.numberOfLines = 2; + self.nameLabel = nameLabel; + [headView addSubview:nameLabel]; + + CGFloat tabWidth = (kScreenWidth - kRealValue(30) - kRealValue(127) - 4)/3; + + UIView * lin_left = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, nameLabel.height)]; + lin_left.backgroundColor = CLineColor; + [headView addSubview:lin_left]; + + UIView * linName = [[UIView alloc] initWithFrame:CGRectMake(nameLabel.right, 0, 1, nameLabel.height)]; + linName.backgroundColor = CLineColor; + [headView addSubview:linName]; + + UILabel * reslutLabel = [[UILabel alloc] initWithFrame:CGRectMake(linName.right , 0, tabWidth, kRealValue(40))]; + reslutLabel.text = @""; + reslutLabel.textAlignment = NSTextAlignmentCenter; + reslutLabel.font = SYSTEMFONT(13); + reslutLabel.textColor = UIColorHex(#333333); + self.resultLabel = reslutLabel; + reslutLabel.userInteractionEnabled = true; + [headView addSubview:reslutLabel]; + + self.detailBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, tabWidth - 20, 20)]; + [self.detailBtn setTitle:@"详情" forState:UIControlStateNormal]; + [self.detailBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.detailBtn.titleLabel.font = MEDIUMFONT(13); + self.detailBtn.layer.cornerRadius = 5; + self.detailBtn.backgroundColor = RGBA(33, 190, 189, 0.5); + [self.detailBtn addTarget:self action:@selector(showResultDetail) forControlEvents:UIControlEventTouchUpInside]; + [reslutLabel addSubview:self.detailBtn]; + + UIView * resName = [[UIView alloc] initWithFrame:CGRectMake(reslutLabel.right, 0, 1, nameLabel.height)]; + resName.backgroundColor = CLineColor; + [headView addSubview:resName]; + + UILabel * danweiLabel = [[UILabel alloc] initWithFrame:CGRectMake(resName.right, 0, tabWidth, kRealValue(40))]; + danweiLabel.text = @""; + danweiLabel.textAlignment = NSTextAlignmentCenter; + danweiLabel.font = SYSTEMFONT(13); + danweiLabel.textColor = UIColorHex(#333333); + self.danweiLabel = danweiLabel; + [headView addSubview:danweiLabel]; + + UIView * danweiLine = [[UIView alloc] initWithFrame:CGRectMake(danweiLabel.right, 0, 1, nameLabel.height)]; + danweiLine.backgroundColor = CLineColor; + [headView addSubview:danweiLine]; + + UILabel * zhiLabel = [[UILabel alloc] initWithFrame:CGRectMake(danweiLine.right, 0, tabWidth, kRealValue(40))]; + zhiLabel.text = @""; + zhiLabel.textAlignment = NSTextAlignmentCenter; + zhiLabel.textColor = UIColorHex(#333333); + zhiLabel.font = SYSTEMFONT(13); + self.caokaoLabel = zhiLabel; + [headView addSubview:zhiLabel]; + + UIView * lin_right = [[UIView alloc] initWithFrame:CGRectMake(zhiLabel.right, 0, 1, nameLabel.height)]; + lin_right.backgroundColor = CLineColor; + [headView addSubview:lin_right]; + + UIView * lin_bottom = [[UIView alloc] initWithFrame:CGRectMake(0, zhiLabel.bottom - 1, kScreenWidth - kRealValue(30), 1)]; + lin_bottom.backgroundColor = CLineColor; + [headView addSubview:lin_bottom]; +} + +- (void)setModel:(thirdResultResModel *)model { + + _model = model; + + if (ValidStr(_model.peResult)) { + _model.peResult = @"/"; + } + if (ValidStr(_model.unit)) { + _model.unit = @"/"; + } + if (ValidStr(_model.printContext)) { + _model.printContext = @"/"; + } + if (ValidStr(_model.peItemName)) { + _model.peItemName = @"/"; + } + self.nameLabel.text = _model.peItemName; + + + if (_model.peResult.length >= 5) { + + self.resultLabel.text =@""; + self.detailBtn.hidden = false; + }else + { + self.resultLabel.text = _model.peResult; + self.detailBtn.hidden = true; + } + self.danweiLabel.text = _model.unit; + self.caokaoLabel.text = _model.printContext; + + + if ([_model.colour integerValue] == 1) { + + self.nameLabel.textColor = UIColorHex(#DA180F); + self.resultLabel.textColor = UIColorHex(#DA180F); + self.danweiLabel.textColor = UIColorHex(#DA180F); + self.caokaoLabel.textColor = UIColorHex(#DA180F); + }else + { + self.nameLabel.textColor = UIColorHex(#333333); + self.resultLabel.textColor = UIColorHex(#333333); + self.danweiLabel.textColor = UIColorHex(#333333); + self.caokaoLabel.textColor = UIColorHex(#333333); + } + +} + +- (void)showResultDetail { + + + UIView * popbackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + self.popbackView = popbackView; + popbackView.backgroundColor = RGBA(0, 0, 0, 0.5); + + + + UIScrollView * centerView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(154), kScreenWidth - kRealValue(30), 200)]; + centerView.backgroundColor = KWhiteColor; + centerView.layer.cornerRadius = 10.0; + [popbackView addSubview:centerView]; + + UILabel * connteLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, centerView.width - 20, 50)]; + connteLabel.text = [NSString stringWithFormat:@"%@",self.model.peResult] ; + connteLabel.numberOfLines = 0; + connteLabel.font = SYSTEMFONT(14); + connteLabel.textAlignment = NSTextAlignmentLeft; + connteLabel.textColor = CFontColor1; + [centerView addSubview:connteLabel]; + + CGFloat h = [HQCommonUtils getSpaceLabelHeight:connteLabel withStr:connteLabel.text withFont:[UIFont systemFontOfSize:14] withWidth:connteLabel.width withLineSpacing:5]; + + connteLabel.height = h; + + centerView.height = h + 69; + + if (h > kScreenHeight - kRealValue(180)) { + + centerView.height = kRealValue(450); + centerView.contentSize = CGSizeMake(centerView.width, h); + } + + UIButton * sureBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15), centerView.bottom- 15, kScreenWidth - kRealValue(30), 49)]; + [sureBtn setTitle:@"确定" forState:UIControlStateNormal]; + sureBtn.titleLabel.font = SYSTEMFONT(13); + sureBtn.backgroundColor = KWhiteColor; + sureBtn.layer.cornerRadius = 10; + [sureBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [sureBtn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside]; + [popbackView addSubview:sureBtn]; + + + [kAppWindow addSubview:popbackView]; +} + +- (void)sureAction { + + [self.popbackView removeFromSuperview]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameTopTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameTopTableViewCell.h new file mode 100644 index 0000000..4161780 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameTopTableViewCell.h @@ -0,0 +1,23 @@ +// +// SickNameTopTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import +#import "HealthPhyReportModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^onekeyQuestionBlock)(NSString * itemID); + +@interface SickNameTopTableViewCell : UITableViewCell + +@property (nonatomic, strong) thirdResultResModel * model; +@property (nonatomic, copy) onekeyQuestionBlock itemBlock; +@property (nonatomic, copy) NSString * uniItemClassId; +@property (nonatomic, assign) NSInteger questionType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameTopTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameTopTableViewCell.m new file mode 100644 index 0000000..992c08b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/SickNameTopTableViewCell.m @@ -0,0 +1,134 @@ +// +// SickNameTopTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import "SickNameTopTableViewCell.h" + +@interface SickNameTopTableViewCell () + +@property (nonatomic, strong ) UILabel * sickNameLabel; +@property (nonatomic, strong ) YYLabel * oneKeyLabel; + +@end + +@implementation SickNameTopTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + UIView * linV = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(15), 2, kRealValue(13))]; + linV.backgroundColor = UIColorHex(#21BEBD); + [self.contentView addSubview:linV]; + + self.sickNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(linV.right + kRealValue(10), kRealValue(15), 100, 16)]; + self.sickNameLabel.textAlignment = NSTextAlignmentLeft; + self.sickNameLabel.font = BOLDSYSTEMFONT(15); + self.sickNameLabel.textColor = CFontColor1; + [self.contentView addSubview:self.sickNameLabel]; + + self.oneKeyLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(15) - 130 , kRealValue(15), 130, 16)]; + self.oneKeyLabel.textAlignment = NSTextAlignmentRight; + self.oneKeyLabel.font = BOLDSYSTEMFONT(13); + self.oneKeyLabel.textColor = KRedColor; + self.oneKeyLabel.text = @"专家库一键咨询 >"; + self.oneKeyLabel.hidden = true; + [self.oneKeyLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [self doctorQuestion]; + }]; + [self.contentView addSubview:self.oneKeyLabel]; + + UIView * headView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.sickNameLabel.bottom + kRealValue(12), kScreenWidth - kRealValue(30), kRealValue(40))]; + headView.backgroundColor = RGBA(33, 190, 189, 0.5); + [self.contentView addSubview:headView]; + + UILabel * nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kRealValue(127), kRealValue(40))]; + nameLabel.text = @"名称"; + nameLabel.textAlignment = NSTextAlignmentCenter; + nameLabel.font = SYSTEMFONT(13); + [headView addSubview:nameLabel]; + + CGFloat tabWidth = (kScreenWidth - kRealValue(30) - kRealValue(127) - 4)/3; + + UIView * linName = [[UIView alloc] initWithFrame:CGRectMake(nameLabel.right, 0, 1, nameLabel.height)]; + linName.backgroundColor = CLineColor; + [headView addSubview:linName]; + + UILabel * reslutLabel = [[UILabel alloc] initWithFrame:CGRectMake(linName.right , 0, tabWidth, kRealValue(40))]; + reslutLabel.text = @"结果"; + reslutLabel.textAlignment = NSTextAlignmentCenter; + reslutLabel.font = SYSTEMFONT(13); + [headView addSubview:reslutLabel]; + + UIView * resName = [[UIView alloc] initWithFrame:CGRectMake(reslutLabel.right, 0, 1, nameLabel.height)]; + resName.backgroundColor = CLineColor; + [headView addSubview:resName]; + + UILabel * danweiLabel = [[UILabel alloc] initWithFrame:CGRectMake(resName.right, 0, tabWidth, kRealValue(40))]; + danweiLabel.text = @"单位"; + danweiLabel.textAlignment = NSTextAlignmentCenter; + danweiLabel.font = SYSTEMFONT(13); + [headView addSubview:danweiLabel]; + + UIView * danweiLine = [[UIView alloc] initWithFrame:CGRectMake(danweiLabel.right, 0, 1, nameLabel.height)]; + danweiLine.backgroundColor = CLineColor; + [headView addSubview:danweiLine]; + + UILabel * zhiLabel = [[UILabel alloc] initWithFrame:CGRectMake(danweiLine.right, 0, tabWidth, kRealValue(40))]; + zhiLabel.text = @"参考值"; + zhiLabel.textAlignment = NSTextAlignmentCenter; + zhiLabel.font = SYSTEMFONT(13); + [headView addSubview:zhiLabel]; +} + +- (void)setModel:(thirdResultResModel *)model { + + _model = model; + + self.sickNameLabel.text = _model.peItemName; + +} + + +- (void)doctorQuestion { + + if (self.itemBlock) { + + self.itemBlock(self.model.third_tId); + } +} + +- (void)setQuestionType:(NSInteger)questionType { + + _questionType = questionType; + + if (_questionType == 2) { + self.oneKeyLabel.hidden = false; + }else + { + self.oneKeyLabel.hidden = true; + } + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/imageReportTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/imageReportTableViewCell.h new file mode 100644 index 0000000..4b64a86 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/imageReportTableViewCell.h @@ -0,0 +1,22 @@ +// +// imageReportTableViewCell.h +// EscortProject +// +// Created by Apple on 2024/2/23. +// + +#import +#import "HealthPhyReportModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookUserReport)(NSString * lookUrl); + +@interface imageReportTableViewCell : UITableViewCell + +@property (nonatomic, strong) imageItemListModel * model; + +@property (nonatomic, copy) lookUserReport lookBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/imageReportTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/imageReportTableViewCell.m new file mode 100644 index 0000000..7ef1794 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/OtherFile/imageReportTableViewCell.m @@ -0,0 +1,235 @@ +// +// imageReportTableViewCell.m +// EscortProject +// +// Created by Apple on 2024/2/23. +// + +#import "imageReportTableViewCell.h" + +@interface imageReportTableViewCell () + +@property (nonatomic, strong) UILabel * reportLabel; + +@property (nonatomic, strong) UIView * reportConetView; + +@property (nonatomic, strong) UILabel * resultLabel; + +@property (nonatomic, strong) UIView * conteLineView; + +@property (nonatomic, strong) NSMutableArray * buttonArray; +@property (nonatomic, strong) NSMutableArray * reportArray; +@property (nonatomic, strong) NSMutableArray * imageArray; + + +@end + +@implementation imageReportTableViewCell + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + } + return _buttonArray; +} + +- (NSMutableArray *)reportArray { + + if (!_reportArray) { + + _reportArray = [[NSMutableArray alloc] init]; + } + return _reportArray; +} + +- (NSMutableArray *)imnageArray { + + if (!_imageArray) { + + _imageArray = [[NSMutableArray alloc] init]; + } + return _imageArray; +} +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + + +- (void)createUI { + + UIView * linV = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(15), 2, kRealValue(13))]; + linV.backgroundColor = UIColorHex(#21BEBD); + [self.contentView addSubview:linV]; + + self.reportLabel = [[UILabel alloc] initWithFrame:CGRectMake(linV.right + kRealValue(10), kRealValue(15), kScreenWidth - kRealValue(20), 16)]; + self.reportLabel.textAlignment = NSTextAlignmentLeft; + self.reportLabel.font = BOLDSYSTEMFONT(15); + self.reportLabel.textColor = CFontColor1; + self.reportLabel.text = @"--"; + [self.contentView addSubview:self.reportLabel]; + + self.reportConetView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15),self.reportLabel.bottom + kRealValue(15), kScreenWidth - kRealValue(30), kRealValue(13))]; + self.reportConetView.backgroundColor = RGBA(245, 247, 251, 1); + [self.contentView addSubview:self.reportConetView]; + + self.resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(15), self.reportConetView.width - kRealValue(32), 13)]; + self.resultLabel.textAlignment = NSTextAlignmentLeft; + self.resultLabel.font = MEDIUMFONT(13); + self.resultLabel.textColor = CFontColor1; + self.resultLabel.numberOfLines = 0; + self.resultLabel.text = @"--"; + [self.reportConetView addSubview:self.resultLabel]; + + self.conteLineView = [[UIView alloc] initWithFrame:CGRectMake(0,self.resultLabel.bottom + kRealValue(38), self.reportConetView.width, kRealValue(1))]; + self.conteLineView.backgroundColor = UIColorHex(#E7EAF2); + [self.reportConetView addSubview:self.conteLineView]; + +} + +- (void)setModel:(imageItemListModel *)model { + + _model = model; + + self.reportLabel.text = _model.imageCheckName; + + self.resultLabel.text = _model.reportContent; + + self.resultLabel.height = _model.textHeight; + + if (_model.textHeight < 13) { + + self.conteLineView.top = self.resultLabel.bottom + kRealValue(38); + self.reportConetView.height = kRealValue(15) + 13 + kRealValue(38) + kRealValue(44); + } + else + { + self.conteLineView.top = self.resultLabel.bottom + kRealValue(18); + self.reportConetView.height = kRealValue(15) + _model.textHeight + kRealValue(18) + kRealValue(44); + + } + + + + + + + + for (UIButton * toolsBtn in self.buttonArray) { + [toolsBtn removeFromSuperview]; + } + [self.buttonArray removeAllObjects]; + [self.imnageArray removeAllObjects]; + [self.reportArray removeAllObjects]; + + //原始报告 + CGFloat buttonW = (self.reportConetView.width - kRealValue(75) )/ 4; //1行最多4个 + + NSArray * yuanshiArray = [_model.reportUrl componentsSeparatedByString:@","]; + [self.reportArray addObjectsFromArray:yuanshiArray]; + CGFloat lastX = 0; + for (int i = 0 ; i < yuanshiArray.count; i ++) { + + UIButton * lookYuanshi = [[UIButton alloc] initWithFrame:CGRectMake(self.reportConetView.width - kRealValue(15) - (buttonW + kRealValue(15)) * i, self.conteLineView.bottom + kRealValue(6), kRealValue(80), kRealValue(30))]; + [lookYuanshi setTitle:@"原始报告" forState:UIControlStateNormal]; + lookYuanshi.titleLabel.font = SYSTEMFONT(13); + lookYuanshi.layer.cornerRadius = 15.0; + lookYuanshi.layer.borderWidth = 1.0; + [lookYuanshi setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + lookYuanshi.layer.borderColor = UIColorHex(#21BEBD).CGColor; + lookYuanshi.layer.masksToBounds = true; + lookYuanshi.tag = 2000+ i; + [self.buttonArray addObject:lookYuanshi]; + + } + //影像原片 + NSArray * yingxiangArray = [_model.imageShowUrl componentsSeparatedByString:@","]; + [self.imageArray addObjectsFromArray:yingxiangArray]; + for (int i = 0 ; i < yingxiangArray.count; i ++) { + + UIButton * lookyingxiang = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15) - (buttonW + kRealValue(15)) * i, self.conteLineView.bottom + kRealValue(6), kRealValue(80), kRealValue(30))]; + [lookyingxiang setTitle:@"影像原片" forState:UIControlStateNormal]; + lookyingxiang.titleLabel.font = SYSTEMFONT(13); + lookyingxiang.layer.cornerRadius = 15.0; + lookyingxiang.layer.borderWidth = 1.0; + lookyingxiang.layer.borderColor = UIColorHex(#21BEBD).CGColor; + lookyingxiang.layer.masksToBounds = true; + [lookyingxiang setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + + lookyingxiang.tag = 1000+ i; + [self.buttonArray addObject:lookyingxiang]; + } + + + + //布局多组按钮 + //一行的列数 + NSInteger cols = 4; + //label大小 + CGFloat labW = buttonW ; + CGFloat labH = kRealValue(30); + CGFloat pading = kRealValue(15); + //每一行的间距 + CGFloat rowMargin = kRealValue(15); + for (int index = 0; index < self.buttonArray.count ; index ++) { + //所在列 + NSInteger col = index % cols; + //所在行 + NSInteger row = index / cols; + + CGFloat shopX = col * (labW + rowMargin); + CGFloat shopY = row * (labH + rowMargin); + UIButton * toolsBtn = self.buttonArray[index]; + toolsBtn.frame = CGRectMake(self.reportConetView.width - shopX - pading - buttonW , self.conteLineView.bottom + kRealValue(6) + shopY, labW, labH); + if (index == self.buttonArray.count - 1) { + lastX = toolsBtn.bottom + kRealValue(7); + } + [toolsBtn addTarget:self action:@selector(lookImageReport:) forControlEvents:UIControlEventTouchUpInside]; + [self.reportConetView addSubview:toolsBtn]; + + } + self.reportConetView.height = lastX; + +} + +- (void)lookImageReport:(UIButton *)lookBtn { + + NSLog(@"%d",lookBtn.tag); + //影片原像 + if (lookBtn.tag < 2000) { + + if (self.lookBlock) { + self.lookBlock(self.imageArray[lookBtn.tag - 1000]); + } + + }else //原始报告 + { + if (self.lookBlock) { + self.lookBlock(self.reportArray[lookBtn.tag - 2000]); + } + } + + + + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/AppointmentInfoView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/AppointmentInfoView.h new file mode 100644 index 0000000..61b465e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/AppointmentInfoView.h @@ -0,0 +1,40 @@ +// +// AppointmentInfoView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import +#import "DoctorReportModel.h" +#import "QuestionBodyReportModel.h" +//#import "PhyscialReportListModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^appointmentBlock)(); +//typedef void(^lookReportBlock)(PhyscialReportListModel * reportModel); + +@interface AppointmentInfoView : UIView + +@property (nonatomic, assign) CGFloat infoH; + +@property (nonatomic, strong) DoctorReportModel * model; + +@property (nonatomic, copy) appointmentBlock lookBlock; + +//@property (nonatomic, copy) lookReportBlock reportBlock; + + +//@property (nonatomic, strong) DoctorReportFamilyInfoModel * familyModel; +// +//@property (nonatomic, strong) DoctorReportRecordsModel * recordModel; +// +//@property (nonatomic, strong) DoctorReportModel * answerModel; + +@property (nonatomic, assign) BOOL isQuxiao; + +//@property (nonatomic, strong) PhyscialReportListModel * bodyModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/AppointmentInfoView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/AppointmentInfoView.m new file mode 100644 index 0000000..d2bf2da --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/AppointmentInfoView.m @@ -0,0 +1,314 @@ +// +// AppointmentInfoView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import "AppointmentInfoView.h" + +@interface AppointmentInfoView () + +@property (nonatomic, strong) UILabel * peopleNameLabel; + +@property (nonatomic, strong) UILabel * sexLabel; + +@property (nonatomic, strong) UILabel * ageLabel; + +@property (nonatomic, strong) UILabel * createTimeLabel; + +@property (nonatomic, strong) UILabel * fileLabel; + +@property (nonatomic, strong) UILabel * upTimeLabel; + +@property (nonatomic, strong) UILabel * hospatilLabel; + +@property (nonatomic, strong) UILabel * healthTitleLabel; + +@property (nonatomic, strong) UILabel * reportLabel; + +@property (nonatomic, strong) YYLabel * lookMoreLabel; + +@property (nonatomic, strong) NSMutableArray * healthArray; + +@property (nonatomic, strong) UIView * heathLineV ; + +@property (nonatomic, strong) UIImageView * statusImage ; + +@property (nonatomic, strong) UIView * healthInfoView ; + +@property (nonatomic, strong) UIView * phyReportView ; + +@end + + +@implementation AppointmentInfoView + + +- (NSMutableArray *)healthArray { + + if (!_healthArray ) { + + _healthArray = [[NSMutableArray alloc] init]; + } + return _healthArray; +} + + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), kRealValue(24), 100, 14)]; + titleLabel.text = @"预约人信息"; + titleLabel.font = BOLDSYSTEMFONT(14); + titleLabel.textColor = CFontColor1; + titleLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:titleLabel]; + + self.statusImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.width - kRealValue(20) - 62, kRealValue(9), 62, 48)]; + self.statusImage.image = [UIImage imageNamed:@"cancalSuccess"]; + self.statusImage.hidden = YES; + [self addSubview:self.statusImage]; + + //姓名 + self.peopleNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14),titleLabel.bottom + kRealValue(18), (self.width - kRealValue(26))/3, 13)]; + self.peopleNameLabel.text = @"姓名:"; + self.peopleNameLabel.font = MEDIUMFONT(13); + self.peopleNameLabel.textColor = CFontColor1; + self.peopleNameLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.peopleNameLabel]; + + //性别 + self.sexLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.peopleNameLabel.right, titleLabel.bottom + kRealValue(18), (self.width - kRealValue(26))/3, 13)]; + self.sexLabel.text = @"性别:-"; + self.sexLabel.font = MEDIUMFONT(13); + self.sexLabel.textColor = CFontColor1; + self.sexLabel.textAlignment = NSTextAlignmentCenter; + [self addSubview:self.sexLabel]; + + //年龄 + self.ageLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.sexLabel.right, titleLabel.bottom + kRealValue(18), (self.width - kRealValue(26))/3, 13)]; + self.ageLabel.text = @"年龄:"; + self.ageLabel.font = MEDIUMFONT(13); + self.ageLabel.textColor = CFontColor1; + self.ageLabel.textAlignment = NSTextAlignmentCenter; + [self addSubview:self.ageLabel]; + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(0, self.ageLabel.bottom + kRealValue(17), self.width, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:linv]; + + UILabel * fileTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14),linv.bottom + kRealValue(24), 50, 14)]; + fileTitleLabel.text = @"档案"; + fileTitleLabel.font = BOLDSYSTEMFONT(14); + fileTitleLabel.textColor = CFontColor1; + fileTitleLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:fileTitleLabel]; + + self.createTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(fileTitleLabel.right, linv.bottom + kRealValue(25), self.width - fileTitleLabel.right -kRealValue(10) , 12)]; + self.createTimeLabel.text = @"生成时间:"; + self.createTimeLabel.font = MEDIUMFONT(11); + self.createTimeLabel.textColor = UIColorHex(#999999); + self.createTimeLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:self.createTimeLabel]; + + + + self.fileLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(25), fileTitleLabel.bottom + kRealValue(18), self.width - kRealValue(50), 14)]; + self.fileLabel.text = @"--"; + self.fileLabel.font = MEDIUMFONT(13); + self.fileLabel.textColor = UIColorHex(#333333); + self.fileLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.fileLabel]; + + YYLabel * allRoomLabel = [[YYLabel alloc]initWithFrame:CGRectMake(self.width - 130, self.fileLabel.bottom + kRealValue(14), 120, 17)]; + allRoomLabel.text = @"查看详情 >"; + allRoomLabel.textColor = UIColorHex(#3390FF); + allRoomLabel.font = SYSTEMFONT(11); + allRoomLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:allRoomLabel]; + + [allRoomLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + + [self lookFileDetail]; + }]; + + UIView * fileLview = [[UIView alloc] initWithFrame:CGRectMake(0, self.fileLabel.bottom + kRealValue(44), self.width, 1)]; + fileLview.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:fileLview]; + + //基本健康信息view + self.healthInfoView = [[UIView alloc] initWithFrame:CGRectMake(0, self.fileLabel.bottom + 28, self.width, 10)]; + [self addSubview:self.healthInfoView]; + + + UILabel * healthTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), kRealValue(30), 100, 14)]; + healthTitleLabel.text = @"基本健康信息"; + healthTitleLabel.font = BOLDSYSTEMFONT(14); + healthTitleLabel.textColor = CFontColor1; + self.healthTitleLabel = healthTitleLabel; + healthTitleLabel.textAlignment = NSTextAlignmentLeft; + [self.healthInfoView addSubview:healthTitleLabel]; + +// +// NSArray * infoArray = @[@[@"饮食习惯:",@"重油 爱吃辣"],@[@"烟酒习惯:",@"不抽烟 爱喝酒"],@[@"既往史:",@"肾虚"],@[@"家族史:",@"无"],@[@"过敏史:",@"青霉素过敏"],@[@"用药史:",@"六味地黄丸"]]; +// +// for (int i = 0 ; i < 6; i ++) { +// +// UIView * healthView = [self createInfoView:infoArray[i][0] leftFrame:CGRectMake(kRealValue(15), healthTitleLabel.bottom + kRealValue(20) + 30 * i, self.width - kRealValue(30), 13) rightText:infoArray[i][1]]; +// +// [self addSubview:healthView]; +// +// if (i == 5) { +// healthH = healthView.bottom; +// } +// } + +// //体检报告view +// //基本健康信息view + self.phyReportView = [[UIView alloc] initWithFrame:CGRectMake(0, self.healthInfoView.bottom + kRealValue(17), self.width, 50)]; + [self addSubview:self.phyReportView]; + + self.phyReportView.hidden = YES; + self.phyReportView.height = CGFLOAT_MIN; + self.infoH = self.healthInfoView.bottom + kRealValue(20); + +} + +- (void)lookFileDetail { + + if (self.lookBlock) { + + self.lookBlock(); + } + +} + + + +- (UIView *)createInfoView:(NSString *)leftText + leftFrame:(CGRect)frame + rightText:(NSString *)rightText { + + UIView * infoView = [[UIView alloc] initWithFrame:frame]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 15)]; + + leftLabel.text = leftText; + + leftLabel.font = SYSTEMFONT(13); + + leftLabel.textColor = UIColorHex(#999999); + + leftLabel.textAlignment = NSTextAlignmentLeft; + + [infoView addSubview:leftLabel]; + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftLabel.right + kRealValue(10), 0, frame.size.width - kRealValue(10), 15)]; + + rightLabel.text = rightText; + + rightLabel.font = SYSTEMFONT(13); + + leftLabel.textColor = CFontColor1; + + rightLabel.textAlignment = NSTextAlignmentLeft; + + [infoView addSubview:rightLabel]; + + + return infoView; + + +} + + + + +- (void)setIsQuxiao:(BOOL)isQuxiao { + + _isQuxiao = isQuxiao; + + self.statusImage.hidden = !isQuxiao; +} + + +- (void)setModel:(DoctorReportModel *)model { + _model = model; + + DoctorReportRecordsModel * recordModel = [DoctorReportRecordsModel modelWithDictionary:_model.conMedicalRecordsListDO] ; + DoctorReportFamilyInfoModel * familyModel = [DoctorReportFamilyInfoModel modelWithDictionary:_model.conFamilyMembersDO]; + + //预约人信息 + if (!ValidStr(familyModel.name)) { + self.peopleNameLabel.text = [NSString stringWithFormat:@"姓名:%@",familyModel.name] ; + } + if (!ValidStr(familyModel.age)) { + self.ageLabel.text = [NSString stringWithFormat:@"年龄:%@",familyModel.age]; + + } + NSString * sexString = [familyModel.gender integerValue] == 1 ? @"女":@"男"; + self.sexLabel.text = [NSString stringWithFormat:@"性别:%@",sexString]; + + //档案 + if (!ValidStr(recordModel.updateTime)) { + self.createTimeLabel.text = [NSString stringWithFormat:@"更新时间:%@",recordModel.updateTime]; + + } + if (!ValidStr(recordModel.medicalDescribe)) { + self.fileLabel.text = [NSString stringWithFormat:@"问题描述:%@",recordModel.medicalDescribe] ; + + }else + { + self.fileLabel.text = [NSString stringWithFormat:@"问题描述:%@",@"-"] ; + + } + + + //问题列表 + [self.healthArray removeAllObjects]; + + + + if (_model.answer.count <=0 ) { + self.healthTitleLabel.hidden = true; + self.healthInfoView.height = CGFLOAT_MIN; + }else + { + self.self.healthTitleLabel.hidden = false; + + for (int i = 0 ; i < _model.answer.count; i ++) { + + DoctorAnswerModel * model = _model.answer[i]; + + UIView * healthView = [self createInfoView:[NSString stringWithFormat:@"%@:",model.answerKey] leftFrame:CGRectMake(kRealValue(15), self.healthTitleLabel.bottom + kRealValue(20) + 30 * i, self.width - kRealValue(30), 13) rightText:model.answerValue]; + + [self.healthInfoView addSubview:healthView]; + + if (i == _model.answer.count - 1) { + self.healthInfoView.height = healthView.bottom; + } + [self.healthArray addObject:healthView]; + } + self.phyReportView.top = self.healthInfoView.bottom; + } + + //体检报告 + if ([recordModel.tfPermission integerValue] != 1 ) { //1 有体检报告 0 没 + + self.phyReportView.hidden = YES; + self.phyReportView.height = CGFLOAT_MIN; + self.infoH = self.healthInfoView.bottom + kRealValue(20); + } +} + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllHospitalConditionView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllHospitalConditionView.h new file mode 100644 index 0000000..a1c8e1e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllHospitalConditionView.h @@ -0,0 +1,26 @@ +// +// AllHospitalConditionView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol hospitalListDeleage + +- (void)hospitalListAction:(NSString *)hospitalName withID:(NSString *)hospitalID; + +@end + +@interface AllHospitalConditionView : UIView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, weak)id hospitalDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllHospitalConditionView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllHospitalConditionView.m new file mode 100644 index 0000000..e5e5627 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllHospitalConditionView.m @@ -0,0 +1,56 @@ +// +// AllHospitalConditionView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/13. +// + +#import "AllHospitalConditionView.h" +#import "SearchConetShowTable.h" + +@interface AllHospitalConditionView () + +@property (nonatomic, strong) SearchConetShowTable * contTable; + + +@end + +@implementation AllHospitalConditionView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.backgroundColor =RGBA(0, 0, 0, 0.3); + self.contTable = [[SearchConetShowTable alloc] initWithFrame:CGRectMake(0, 0 , kScreenWidth, kRealValue(300)) style:UITableViewStylePlain]; + MJWeakSelf + self.contTable.hosBlock = ^(NSString * _Nonnull hospitalName, NSString * _Nonnull hospitalID) { + if ([weakSelf.hospitalDelegate respondsToSelector:@selector(hospitalListAction:withID:)]) + { + [weakSelf.hospitalDelegate hospitalListAction:hospitalName withID:hospitalID]; + } + }; + [self addSubview:self.contTable]; +} + +- (void)setDataArray:(NSArray *)dataArray { + _dataArray = dataArray; + self.contTable.dataArray = _dataArray; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllRoomsConditionView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllRoomsConditionView.h new file mode 100644 index 0000000..67a6ab2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllRoomsConditionView.h @@ -0,0 +1,31 @@ +// +// AllRoomsConditionView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol roosConditionProtocol + +- (void)roomsLeftAction:(NSInteger)index; +- (void)roomsRightAction:(NSString *)roomID; + +@end + +@interface AllRoomsConditionView : UIView + +@property (nonatomic, strong) NSArray * leftArray; + +@property (nonatomic, strong) NSArray * rightArray; + +@property (nonatomic, assign) NSInteger searchType; + +@property (nonatomic, weak)id roomLeftDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllRoomsConditionView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllRoomsConditionView.m new file mode 100644 index 0000000..3ed12f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllRoomsConditionView.m @@ -0,0 +1,102 @@ +// +// AllRoomsConditionView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/13. +// + +#import "AllRoomsConditionView.h" +#import "FoundRightTableView.h" +#import "FoundLeftTableView.h" + + +@interface AllRoomsConditionView () + +@property (nonatomic, strong) FoundLeftTableView * leftTable; + +@property (nonatomic, strong) FoundRightTableView * rightTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * rightDataArray; + +@end + + + +@implementation AllRoomsConditionView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + + + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + self.backgroundColor = RGBA(0, 0, 0, 0.5); + self.leftTable = [[FoundLeftTableView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(160),kRealValue(300)) style:UITableViewStyleGrouped]; + self.leftTable.leftDelegate = self; + self.leftTable.backgroundColor = UIColorHex(#F3F3F3); + [self addSubview:self.leftTable]; + + self.rightTable = [[FoundRightTableView alloc] initWithFrame:CGRectMake(self.leftTable.right, 0,kScreenWidth - kRealValue(160), kRealValue(300)) style:UITableViewStyleGrouped]; + MJWeakSelf + self.rightTable.rightBlock = ^(NSString * _Nonnull roomId ,NSString * _Nonnull roomName) { + + if ([weakSelf.roomLeftDelegate respondsToSelector:@selector(roomsRightAction:)]) { + + [weakSelf.roomLeftDelegate roomsRightAction:roomId]; + } + + }; + [self addSubview:self.rightTable]; + + +} + +- (void)setLeftArray:(NSArray *)leftArray { + _leftArray = leftArray; + self.leftTable.dataArray = _leftArray; + +} + +- (void)setRightArray:(NSArray *)rightArray { + + _rightArray = rightArray; + + self.rightTable.rightDataArray = _rightArray; +} + +- (void)setSearchType:(NSInteger)searchType { + + _searchType =searchType; + + self.rightTable.searchType = _searchType; + +} +#pragma mark: 左边点击 + +- (void)leftCellAction:(NSInteger)index { + + if ([self.roomLeftDelegate respondsToSelector:@selector(roomsLeftAction:)]) { + + [self.roomLeftDelegate roomsLeftAction:index]; + } + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllSicksConditionView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllSicksConditionView.h new file mode 100644 index 0000000..97079a7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllSicksConditionView.h @@ -0,0 +1,32 @@ +// +// AllSicksConditionView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol sicksConditionProtocol + +- (void)sicksLeftAction:(NSInteger)index; +- (void)sicksRightAction:(NSString *)roomID; + +@end + +@interface AllSicksConditionView : UIView + +@property (nonatomic, strong) NSArray * leftArray; + +@property (nonatomic, strong) NSArray * rightArray; + +@property (nonatomic, assign) NSInteger searchType; + +@property (nonatomic, weak)id sicksLeftDelegate; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllSicksConditionView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllSicksConditionView.m new file mode 100644 index 0000000..b8c0664 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/ConditionsView(条件筛选)/AllSicksConditionView.m @@ -0,0 +1,95 @@ +// +// AllSicksConditionView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/13. +// + +#import "AllSicksConditionView.h" +#import "FoundRightTableView.h" +#import "FoundLeftTableView.h" + + +@interface AllSicksConditionView () + +@property (nonatomic, strong) FoundLeftTableView * leftTable; + +@property (nonatomic, strong) FoundRightTableView * rightTable; + +@end + +@implementation AllSicksConditionView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + self.backgroundColor = RGBA(0, 0, 0, 0.5); + self.leftTable = [[FoundLeftTableView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(160),kRealValue(300)) style:UITableViewStyleGrouped]; + self.leftTable.leftDelegate = self; + self.leftTable.backgroundColor = UIColorHex(#F3F3F3); + [self addSubview:self.leftTable]; + + self.rightTable = [[FoundRightTableView alloc] initWithFrame:CGRectMake(self.leftTable.right, 0,kScreenWidth - kRealValue(160), kRealValue(300)) style:UITableViewStyleGrouped]; + MJWeakSelf + self.rightTable.rightBlock = ^(NSString * _Nonnull roomID, NSString * _Nonnull roomName) { + if ([weakSelf.sicksLeftDelegate respondsToSelector:@selector(sicksRightAction:)]) { + + [weakSelf.sicksLeftDelegate sicksRightAction:roomID]; + } + }; + + [self addSubview:self.rightTable]; + + +} + +- (void)setLeftArray:(NSArray *)leftArray { + _leftArray = leftArray; + self.leftTable.dataArray = _leftArray; + +} + +- (void)setRightArray:(NSArray *)rightArray { + + _rightArray = rightArray; + + self.rightTable.rightDataArray = _rightArray; +} + +- (void)setSearchType:(NSInteger)searchType { + + _searchType =searchType; + + self.rightTable.searchType = _searchType; + +} +#pragma mark: 左边点击 + +- (void)leftCellAction:(NSInteger)index { + + if ([self.sicksLeftDelegate respondsToSelector:@selector(sicksLeftAction:)]) { + + [self.sicksLeftDelegate sicksLeftAction:index]; + } + + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/BasicHealthInfoView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/BasicHealthInfoView.h new file mode 100644 index 0000000..71c6cae --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/BasicHealthInfoView.h @@ -0,0 +1,16 @@ +// +// BasicHealthInfoView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BasicHealthInfoView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/BasicHealthInfoView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/BasicHealthInfoView.m new file mode 100644 index 0000000..647d89e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/BasicHealthInfoView.m @@ -0,0 +1,70 @@ +// +// BasicHealthInfoView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "BasicHealthInfoView.h" + +@implementation BasicHealthInfoView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; +} + + +- (void)createUI { + + + NSArray * leftArray = @[@"饮食习惯:",@"烟酒习惯:",@"既往史:",@"家族史:",@"过敏史:",@"用药史:"]; + NSArray * rightArray = @[@"重油 重辣 重盐",@"爱抽烟 爱喝酒",@"无",@"高血压,糖尿病",@"花生过敏",@"敌敌畏"]; + + for (int i = 0; i < leftArray.count; i ++) { + + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(20) + 47 * i, 100, 13)]; + leftLabel.text =leftArray[i]; + leftLabel.font = MEDIUMFONT(13); + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.textColor = UIColorHex(#666666); + CGFloat w = [HQCommonUtils getLengthFromText:leftLabel.text andFontSize:13]; + leftLabel.width = w; + [self addSubview:leftLabel]; + + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftLabel.right, leftLabel.top, self.width - leftLabel.right, 13)]; + rightLabel.text =rightArray[i]; + rightLabel.font = MEDIUMFONT(13); + rightLabel.textAlignment = NSTextAlignmentLeft; + rightLabel.textColor = UIColorHex(#333333); + [self addSubview:rightLabel]; + if (i > 0) { + UIView * linView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 47 * i, self.width - kRealValue(30), 1)]; + linView.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:linView]; + } + + + } + + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailTitleView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailTitleView.h new file mode 100644 index 0000000..ea771f7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailTitleView.h @@ -0,0 +1,18 @@ +// +// DetailTitleView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DetailTitleView : UIView + +@property (nonatomic, copy) NSString * timeString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailTitleView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailTitleView.m new file mode 100644 index 0000000..5d79b7c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailTitleView.m @@ -0,0 +1,68 @@ +// +// DetailTitleView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import "DetailTitleView.h" + +@interface DetailTitleView () + +@property (nonatomic, strong) UILabel * timeLabel; + +@end + +@implementation DetailTitleView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + + UIImageView * headImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, 33)]; + headImg.image = IMAGE_NAMED(@"userinfoTitleImg"); + [self addSubview:headImg]; + + UIImageView * leftImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(16), 10, 15, 15)]; + leftImg.image = IMAGE_NAMED(@"questionLeft_icon"); + [headImg addSubview:leftImg]; + + UILabel * titleLabel = [[UILabel alloc] init]; + titleLabel.frame = CGRectMake(leftImg.right + kRealValue(7),10 , 80, 14); + titleLabel.textAlignment = NSTextAlignmentLeft; + titleLabel.text = @"咨询人信息"; + titleLabel.font = BOLDSYSTEMFONT(14); + [self addSubview:titleLabel]; + + self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake( headImg.width/2 - kRealValue(10) , 8 , headImg.width/2 -kRealValue(10) , 15)]; + self.timeLabel.text = @"--"; + self.timeLabel.font = SYSTEMFONT(10); + self.timeLabel.textAlignment = NSTextAlignmentRight; + self.timeLabel.textColor = KWhiteColor; + [headImg addSubview:self.timeLabel]; +} + +- (void)setTimeString:(NSString *)timeString { + + _timeString = timeString; + + self.timeLabel.text = [NSString stringWithFormat:@"生成时间:%@",_timeString]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailUserInfoView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailUserInfoView.h new file mode 100644 index 0000000..480e6d8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailUserInfoView.h @@ -0,0 +1,21 @@ +// +// DetailUserInfoView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import +#import "QuestionDiseaseInfoModel.h" +#import "DoctorReportModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface DetailUserInfoView : UIView + +@property (nonatomic, strong) QuestionDiseaseInfoModel * model; + +@property (nonatomic, strong) DoctorReportFamilyInfoModel * userModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailUserInfoView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailUserInfoView.m new file mode 100644 index 0000000..28f97a7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/DetailUserInfoView.m @@ -0,0 +1,153 @@ +// +// DetailUserInfoView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import "DetailUserInfoView.h" + +@interface DetailUserInfoView () + + +@end + +@implementation DetailUserInfoView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; + +} + +- (void)createUI { + + NSArray * array = @[@"",@"",@"",@"",@""]; + //一行的列数 + NSInteger cols = 3; + //label大小 + CGFloat labW = (self.width - kRealValue(40) ) / 3 ; + CGFloat labH = 20; + CGFloat pading = kRealValue(10); + //每一行的间距 + CGFloat rowMargin = kRealValue(20); + for (int i = 0; i < array.count; i ++) { + //所在列 + NSInteger col = i % cols; + //所在行 + NSInteger row = i / cols; + + CGFloat shopX = col * (labW ); + CGFloat shopY = row * (labH + rowMargin); + UILabel * nameLabel = [[UILabel alloc] init]; + nameLabel.frame = CGRectMake( kRealValue(20) + shopX + pading ,kRealValue(23) + shopY, labW, labH); + nameLabel.textAlignment = NSTextAlignmentLeft; + nameLabel.text = array[i]; + nameLabel.font = SYSTEMFONT(13); + nameLabel.tag = 100+ i; + [self addSubview:nameLabel]; + + } + UIView * lineV = [[UIView alloc] initWithFrame:CGRectMake(0, self.height, self.width, 1)]; + lineV.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:lineV]; +} + +- (void)setModel:(QuestionDiseaseInfoModel *)model { + + _model = model; + + UILabel * namelabel = [self viewWithTag:100] ; + + namelabel.text =[NSString stringWithFormat:@"姓名:%@", _model.name]; + + UILabel * sexlabel = [self viewWithTag:101] ; + if ([_model.gender integerValue] == 1) { + sexlabel.text =[NSString stringWithFormat:@"性别:%@", @"女"]; + + }else + { + sexlabel.text =[NSString stringWithFormat:@"性别:%@", @"男"]; + } + + UILabel * agelabel = [self viewWithTag:102] ; + + agelabel.text = [NSString stringWithFormat:@"年龄:%@岁", _model.age]; + + UILabel * heightlabel = [self viewWithTag:103] ; + + + if (!ValidStr(_model.height)) { + + heightlabel.text =[NSString stringWithFormat:@"身高:%@cm", _model.height]; + }else + { + heightlabel.text =[NSString stringWithFormat:@"身高:%@cm", @"--"]; + } + + UILabel * weightlabel = [self viewWithTag:104] ; + if (!ValidStr(_model.weight)) { + weightlabel.text =[NSString stringWithFormat:@"体重:%@kg", _model.weight]; + }else + { + weightlabel.text =[NSString stringWithFormat:@"体重:%@kg", @"--"]; + } + +} + +- (void)setUserModel:(DoctorReportFamilyInfoModel *)userModel { + + _userModel = userModel; + + UILabel * namelabel = [self viewWithTag:100] ; + + namelabel.text =[NSString stringWithFormat:@"姓名:%@", _userModel.name]; + + UILabel * sexlabel = [self viewWithTag:101] ; + if ([_userModel.gender integerValue] == 1) { + sexlabel.text =[NSString stringWithFormat:@"性别:%@", @"女"]; + + }else + { + sexlabel.text =[NSString stringWithFormat:@"性别:%@", @"男"]; + } + + UILabel * agelabel = [self viewWithTag:102] ; + + agelabel.text = [NSString stringWithFormat:@"年龄:%@岁", _userModel.age]; + + UILabel * heightlabel = [self viewWithTag:103] ; + + if (!ValidStr(_userModel.height)) { + + heightlabel.text =[NSString stringWithFormat:@"身高:%@cm", _userModel.height]; + } + else + { + heightlabel.text =[NSString stringWithFormat:@"身高:%@cm", @"--"]; + } + UILabel * weightlabel = [self viewWithTag:104] ; + if (!ValidStr(_userModel.weight)) { + weightlabel.text =[NSString stringWithFormat:@"体重:%@kg", _userModel.weight]; + } + else + { + weightlabel.text =[NSString stringWithFormat:@"体重:%@kg", @"--"]; + } + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/FileDataDeatilCenterView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/FileDataDeatilCenterView.h new file mode 100644 index 0000000..70d82c7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/FileDataDeatilCenterView.h @@ -0,0 +1,18 @@ +// +// FileDataDeatilCenterView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface FileDataDeatilCenterView : UIView + +@property (nonatomic, assign) CGFloat questionH; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/FileDataDeatilCenterView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/FileDataDeatilCenterView.m new file mode 100644 index 0000000..13d48c5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/FileDataDeatilCenterView.m @@ -0,0 +1,221 @@ +// +// FileDataDeatilCenterView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "FileDataDeatilCenterView.h" +#import "QuestionItemTable.h" + +@interface FileDataDeatilCenterView () + +@property (nonatomic, strong) UILabel * firstQuestionLabel; + +@property (nonatomic, strong) UILabel * firstAnswerLabel; + +@property (nonatomic, strong) UILabel * secendQuestionLabel; + +@property (nonatomic, strong) UILabel * secendAnswerLabel; + +@property (nonatomic, strong) UILabel * thirdQuestionLabel; + +@property (nonatomic, strong) UILabel * thirdAnswerLabel; + +@property (nonatomic, strong) UILabel * fourthQuestionLabel; + +@property (nonatomic, strong) UILabel * fourthAnswerLabel; + +@property (nonatomic, strong) UILabel * fifthQuestionLabel; + +@property (nonatomic, strong) UILabel * fifthAnswerLabel; + +@property (nonatomic, strong) UIView * hospatilView; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * disNameLabel; + +@property (nonatomic, strong) UIView * pictureView; + +@property (nonatomic, strong) QuestionItemTable * homeTable; + + +@end + + +@implementation FileDataDeatilCenterView + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; +} + +- (void)createUI { + + self.backgroundColor = KWhiteColor; + //第一个问题 + self.firstQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), kRealValue(24), self.width - kRealValue(30), 14)]; + self.firstQuestionLabel.text = @"1.本次问题持续多久了?"; + self.firstQuestionLabel.font = BOLDSYSTEMFONT(14); + self.firstQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.firstQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.firstQuestionLabel]; + + UIView * firstView = [[UIView alloc] initWithFrame:CGRectMake(0, self.firstQuestionLabel.bottom + kRealValue(15), self.width, 35)]; + firstView.backgroundColor = UIColorHex(#EFEFEF); + [self addSubview:firstView]; + + UIView * lineOne = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + lineOne.backgroundColor = UIColorHex(#809999); + [firstView addSubview:lineOne]; + + //如果用做展示 + self.firstAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(lineOne.right + kRealValue(45), 0, self.width - kRealValue(48), 35)]; + self.firstAnswerLabel.text = @"A 一周内"; + self.firstAnswerLabel.font = MEDIUMFONT(12); + self.firstAnswerLabel.textAlignment = NSTextAlignmentLeft; + self.firstAnswerLabel.textColor = UIColorHex(#333333); + [firstView addSubview:self.firstAnswerLabel]; + + + //第二个问题 + self.secendQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), firstView.bottom + kRealValue(15), self.width - kRealValue(30), 14)]; + self.secendQuestionLabel.text = @"2.咨询人的问题"; + self.secendQuestionLabel.font = BOLDSYSTEMFONT(14); + self.secendQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.secendQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.secendQuestionLabel]; + + UIView * twoView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(10), self.secendQuestionLabel.bottom + kRealValue(15), self.width - kRealValue(20), 70)]; + twoView.backgroundColor = UIColorHex(#EFEFEF); + twoView.layer.cornerRadius = 10; + twoView.layer.masksToBounds = true; + [self addSubview:twoView]; + + self.secendAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(25), 11, twoView.width - kRealValue(50), 35)]; + self.secendAnswerLabel.text = @"最近一段时间睡眠不足,总是自己醒"; + self.secendAnswerLabel.numberOfLines = 0; + self.secendAnswerLabel.font = MEDIUMFONT(12); + self.secendAnswerLabel.textAlignment = NSTextAlignmentLeft; + self.secendAnswerLabel.textColor = UIColorHex(#333333); + + self.secendAnswerLabel.height = [HQCommonUtils getSpaceLabelHeight:self.secendAnswerLabel withStr:self.secendAnswerLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth:twoView.width - kRealValue(50) withLineSpacing:5.0]; + [twoView addSubview:self.secendAnswerLabel]; + //图片 + self.pictureView = [[UIView alloc] initWithFrame:CGRectMake(0, twoView.bottom + kRealValue(12), self.width, 110)]; + [self addSubview: self.pictureView]; + + UILabel * pictureLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(10), 0, 140, 35)]; + pictureLabel.text = @"检查报告或者患处照片"; + pictureLabel.font = MEDIUMFONT(12); + pictureLabel.textAlignment = NSTextAlignmentLeft; + pictureLabel.textColor = UIColorHex(#666666); + [self.pictureView addSubview:pictureLabel]; + + UILabel * showLabel = [[UILabel alloc] initWithFrame:CGRectMake(140, 0, 100, 35)]; + showLabel.text = @"(仅自己和医生可见)"; + showLabel.font = MEDIUMFONT(11); + showLabel.textAlignment = NSTextAlignmentLeft; + showLabel.textColor = UIColorHex(#333333); + [self.pictureView addSubview:showLabel]; + + UILabel * numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width - 10 - 50, 0, 50, 35)]; + numberLabel.text = @"4/8"; + numberLabel.font = MEDIUMFONT(11); + numberLabel.textAlignment = NSTextAlignmentRight; + numberLabel.textColor = UIColorHex(#333333); + [self.pictureView addSubview:numberLabel]; + + UIScrollView * pictScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(pictureLabel.left, pictureLabel.bottom, self.width - kRealValue(20), 62)]; + [self.pictureView addSubview:pictScrollView]; + + for (int i = 0 ; i < 4; i ++) { + + UIImageView * picView = [[UIImageView alloc] initWithFrame:CGRectMake(66 * i, 0 , 60, 60)]; + picView.backgroundColor = [UIColor greenColor]; + picView.layer.cornerRadius = 5.0; + picView.layer.masksToBounds = true; + [pictScrollView addSubview:picView]; + + } + + //第三个问题 + self.thirdQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20),self.pictureView.bottom + kRealValue(10), self.width - kRealValue(30), 14)]; + self.thirdQuestionLabel.text = @"3.咨询人是否去医院就诊过?"; + self.thirdQuestionLabel.font = BOLDSYSTEMFONT(14); + self.thirdQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.thirdQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.thirdQuestionLabel]; + + UIView * thirdView = [[UIView alloc] initWithFrame:CGRectMake(0, self.thirdQuestionLabel.bottom + kRealValue(15), self.width, 35)]; + thirdView.backgroundColor = UIColorHex(#EFEFEF); + [self addSubview:thirdView]; + + UIView * linethird = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + linethird.backgroundColor = UIColorHex(#809999); + [thirdView addSubview:linethird]; + + self.thirdQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(lineOne.right + kRealValue(45), 0, self.width - kRealValue(48), 35)]; + self.thirdQuestionLabel.text = @"A 就诊过"; + self.thirdQuestionLabel.font = MEDIUMFONT(12); + self.thirdQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.thirdQuestionLabel.textColor = UIColorHex(#333333); + [thirdView addSubview:self.thirdQuestionLabel]; + + // + + + + self.hospatilView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(8), thirdView.bottom + kRealValue(16), self.width - kRealValue(16), 67)]; + self.hospatilView.backgroundColor = UIColorHex(#EFEFEF); + self.hospatilView.layer.cornerRadius = 10; + self.hospatilView.layer.masksToBounds = true; + [self addSubview:self.hospatilView]; + + self.roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(lineOne.right + kRealValue(45), kRealValue(12), self.width - kRealValue(48), 13)]; + self.roomLabel.text = @"就诊医院及科室:西京医院神内外科"; + self.roomLabel.font = MEDIUMFONT(12); + self.roomLabel.textAlignment = NSTextAlignmentLeft; + self.roomLabel.textColor = UIColorHex(#333333); + [self.hospatilView addSubview:self.roomLabel]; + + self.disNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(lineOne.right + kRealValue(45), self.roomLabel.bottom + kRealValue(17) , self.width - kRealValue(48), 13)]; + self.disNameLabel.text = @"就诊医院及科室:西京医院神内外科"; + self.disNameLabel.font = MEDIUMFONT(12); + self.disNameLabel.textAlignment = NSTextAlignmentLeft; + self.disNameLabel.textColor = UIColorHex(#333333); + [self.hospatilView addSubview:self.disNameLabel]; + //第4个问题 + self.fourthQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), self.hospatilView.bottom + kRealValue(21), self.width - kRealValue(30), 14)]; + self.fourthQuestionLabel.text = @"4.咨询人期望得到的帮助?"; + self.fourthQuestionLabel.font = BOLDSYSTEMFONT(14); + self.fourthQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.fourthQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.fourthQuestionLabel]; + + UIView *fourView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(10), self.fourthQuestionLabel.bottom + kRealValue(15), self.width - kRealValue(20), 70)]; + fourView.backgroundColor = UIColorHex(#EFEFEF); + fourView.layer.cornerRadius = 10; + fourView.layer.masksToBounds = true; + [self addSubview:fourView]; + + self.fourthAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(25), 11, fourView.width - kRealValue(50), 35)]; + self.fourthAnswerLabel.text = @"如何改善睡眠"; + self.fourthAnswerLabel.numberOfLines = 0; + self.fourthAnswerLabel.font = MEDIUMFONT(12); + self.fourthAnswerLabel.textAlignment = NSTextAlignmentLeft; + self.fourthAnswerLabel.textColor = UIColorHex(#333333); + self.fourthAnswerLabel.height = [HQCommonUtils getSpaceLabelHeight:self.secendAnswerLabel withStr:self.secendAnswerLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth:twoView.width - kRealValue(50) withLineSpacing:5.0]; + [fourView addSubview:self.fourthAnswerLabel]; + + self.questionH = fourView.bottom + kRealValue(20); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoCollectView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoCollectView.h new file mode 100644 index 0000000..148cacf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoCollectView.h @@ -0,0 +1,31 @@ +// +// HQPhotoCollectView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import +#import "HQPhotoPostCollectionViewCell.h" + +NS_ASSUME_NONNULL_BEGIN +@protocol XMPhotoCollectViewProtocol + +- (void)choosePhotoCell:(NSIndexPath *)index withCollectview:(UICollectionView *)collectView withIntab:(NSInteger )tableAtNumber; + +- (void)delectUserChoosePhoto:(NSInteger)indexTag withIntab:(NSInteger )tableAtNumber; + +@end + +@interface HQPhotoCollectView : UICollectionView +@property (nonatomic, strong)NSArray * photoArray; +@property (nonatomic, strong)NSArray * assetArray; +@property (nonatomic, assign)NSInteger tableIndex; +@property (nonatomic, strong) HQPhotoPostCollectionViewCell * photocell; +@property (nonatomic, weak)id photoDelegate; + +@property (nonatomic, assign )BOOL isEdit; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoCollectView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoCollectView.m new file mode 100644 index 0000000..bafe02b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoCollectView.m @@ -0,0 +1,144 @@ +// +// HQPhotoCollectView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "HQPhotoCollectView.h" + +@interface HQPhotoCollectView() + + + +@end + +@implementation HQPhotoCollectView + +- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout +{ + if (self = [super initWithFrame:frame collectionViewLayout:layout]) + { + [self createUI]; + } + return self; +} +- (void)createUI +{ + self.delegate = self; + self.dataSource = self; + self.backgroundColor = KWhiteColor; + self.showsHorizontalScrollIndicator = NO; + self.alwaysBounceVertical = YES; + self.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag; + [self registerClass:[HQPhotoPostCollectionViewCell class] forCellWithReuseIdentifier:@"SDPhotoCell"]; + + +} + +- (void)setPhotoArray:(NSArray *)photoArray +{ + _photoArray = photoArray; + [self reloadData]; +} +- (void)setAssetArray:(NSArray *)assetArray +{ + _assetArray = assetArray; + [self reloadData]; +} + +- (void)setIsEdit:(BOOL)isEdit { + + _isEdit = isEdit; + [self reloadData]; +} + +- (void)setPhotoDelegate:(id)photoDelegate { + + _photoDelegate = photoDelegate; + [self reloadData]; +} + + +#pragma mark UICollectionView delegate 与 datasource +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + + return self.photoArray.count + 1; +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + + HQPhotoPostCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"SDPhotoCell" forIndexPath:indexPath]; + cell.imageView.image = [UIImage imageNamed:@"add"]; + + if (indexPath.row == self.photoArray.count) { + if (self.photoArray.count == 9 ) + { + cell.imageView.hidden = YES; + } + + cell.deleteBtn.hidden = YES; + } + else + { + + if ([self.photoArray[indexPath.row] isKindOfClass:[NSString class]]) { + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,self.photoArray[indexPath.row]]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:PLACEHOLD_IMG]; + + if (self.isEdit == true) { + cell.deleteBtn.hidden = false; + } + else + { + cell.deleteBtn.hidden = true; + } + + }else + { + cell.imageView.image = self.photoArray[indexPath.row]; + } +// + cell.asset = self.assetArray[indexPath.row]; + if (self.isEdit == true) { + cell.deleteBtn.hidden = false; + } + else + { + cell.deleteBtn.hidden = true; + } + } + cell.deleteBtn.tag = indexPath.row+10; + self.photocell = cell; + [cell.deleteBtn addTarget:self action:@selector(deleteBtnClik:) forControlEvents:UIControlEventTouchUpInside]; + + return cell; +} + +- (void)deleteBtnClik:(UIButton *)prictureBtn +{ + + if ([self.photoDelegate respondsToSelector:@selector(delectUserChoosePhoto: withIntab:)]) + { + [self.photoDelegate delectUserChoosePhoto:prictureBtn.tag-10 withIntab:self.tableIndex]; + } +} + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + + if ([self.photoDelegate respondsToSelector:@selector(choosePhotoCell: withCollectview: withIntab:)]) + { + [self.photoDelegate choosePhotoCell:indexPath withCollectview:self withIntab:self.tableIndex]; + } + +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoPostCollectionViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoPostCollectionViewCell.h new file mode 100644 index 0000000..4c522a4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoPostCollectionViewCell.h @@ -0,0 +1,27 @@ +// +// HQPhotoPostCollectionViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQPhotoPostCollectionViewCell : UICollectionViewCell + +@property (nonatomic, strong) UIImageView *imageView; + +@property (nonatomic, strong) UIButton *deleteBtn; + +@property (nonatomic, assign) NSInteger row; + +@property (nonatomic, strong) id asset; + + +- (UIView *)snapshotView; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoPostCollectionViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoPostCollectionViewCell.m new file mode 100644 index 0000000..8b84803 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/HQPhotoPostCollectionViewCell.m @@ -0,0 +1,73 @@ +// +// HQPhotoPostCollectionViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "HQPhotoPostCollectionViewCell.h" +#import +#import +//#import "TZImagePickerController/TZImagePickerController.h" + + +@implementation HQPhotoPostCollectionViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + _imageView = [[UIImageView alloc] init]; + _imageView.contentMode = UIViewContentModeScaleAspectFill; + _imageView.userInteractionEnabled = YES; + [self addSubview:_imageView]; + self.clipsToBounds = YES; + + + _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + [_deleteBtn setImage:[UIImage imageNamed:@"delect"] forState:UIControlStateNormal]; + _deleteBtn.frame = CGRectMake(self.width - 20, -5, 20, 20); + [self addSubview:_deleteBtn]; + + } + return self; +} +- (void)layoutSubviews { + [super layoutSubviews]; + _imageView.frame = self.bounds; + +} + +- (void)setAsset:(id)asset { + _asset = asset; +} + +- (void)setRow:(NSInteger)row { + _row = row; + _deleteBtn.tag = row; +} + + +- (UIView *)snapshotView { + UIView *snapshotView = [[UIView alloc]init]; + + UIView *cellSnapshotView = nil; + if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)]) { + cellSnapshotView = [self snapshotViewAfterScreenUpdates:NO]; + } else { + CGSize size = CGSizeMake(self.bounds.size.width + 20, self.bounds.size.height + 20); + UIGraphicsBeginImageContextWithOptions(size, self.opaque, 0); + [self.layer renderInContext:UIGraphicsGetCurrentContext()]; + UIImage * cellSnapshotImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + cellSnapshotView = [[UIImageView alloc]initWithImage:cellSnapshotImage]; + } + + snapshotView.frame = CGRectMake(0, 0, cellSnapshotView.frame.size.width, cellSnapshotView.frame.size.height); + cellSnapshotView.frame = CGRectMake(0, 0, cellSnapshotView.frame.size.width, cellSnapshotView.frame.size.height); + + [snapshotView addSubview:cellSnapshotView]; + return snapshotView; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTable.h new file mode 100644 index 0000000..4ff485b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTable.h @@ -0,0 +1,26 @@ +// +// QuestionItemTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import +#import "QuestionItemTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN +@protocol questionOneProtocol + +- (void)questionOneSelectedResult:(NSString *)result; + +@end + +@interface QuestionItemTable : UITableView + +@property (nonatomic , strong) NSArray * dataArray; + +@property (nonatomic, weak)id questionOneDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTable.m new file mode 100644 index 0000000..3d53309 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTable.m @@ -0,0 +1,134 @@ +// +// QuestionItemTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "QuestionItemTable.h" + +@interface QuestionItemTable () + +@end + +@implementation QuestionItemTable + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + return self; +} + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + [self reloadData]; +} + +- (void)setQuestionOneDelegate:(id)questionOneDelegate { + + _questionOneDelegate = questionOneDelegate; + +} + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + return 35; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + QuestionItemTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[QuestionItemTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.model = self.dataArray[indexPath.row]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + QuestionItemModel * model = self.dataArray[indexPath.row]; + + for (QuestionItemModel * subModel in self.dataArray ) { + + if (subModel == model) { + subModel.IsSelected = YES; + }else + { + subModel.IsSelected = NO; + } + } + + if ([self.questionOneDelegate respondsToSelector:@selector(questionOneSelectedResult:)]) { + + [self.questionOneDelegate questionOneSelectedResult:model.Title]; + } + + [self reloadData]; + +} + + + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTableViewCell.h new file mode 100644 index 0000000..fba3520 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTableViewCell.h @@ -0,0 +1,19 @@ +// +// QuestionItemTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import +#import "QuestionItemModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionItemTableViewCell : UITableViewCell + +@property (nonatomic, strong) QuestionItemModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTableViewCell.m new file mode 100644 index 0000000..a46e0f6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/QuestionItemTableViewCell.m @@ -0,0 +1,108 @@ +// +// QuestionItemTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "QuestionItemTableViewCell.h" + +@interface QuestionItemTableViewCell () + +@property (nonatomic, strong) UIView * backView; +@property (nonatomic, strong) UIView * lineView; +@property (nonatomic, strong) UILabel * itemLabel; +@property (nonatomic, strong) UIButton * selectBtn; + +@end + +@implementation QuestionItemTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + [self.contentView addSubview:self.backView]; + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_offset(0); + make.top.mas_offset(0); + make.height.mas_offset(35); + }]; + + self.lineView = [[UIView alloc] init]; + self.lineView.backgroundColor = UIColorHex(#21BEBD); + [self.backView addSubview:self.lineView]; + + [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(0); + make.width.mas_offset(3); + make.top.bottom.mas_offset(0); + }]; + + self.itemLabel = [[UILabel alloc] init]; + self.itemLabel.textColor = CFontColor1; + self.itemLabel.font = MEDIUMFONT(12); + self.itemLabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.itemLabel]; + + [self.itemLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@45); + make.top.bottom.mas_offset(0); + make.right.mas_offset(-15); + }]; + [self.itemLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.selectBtn = [[UIButton alloc] init]; + [self.backView addSubview:self.selectBtn ]; + + [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-23); + make.top.mas_offset(10); + make.height.width.mas_offset(14); + }]; + + + +} + +- (void)setModel:(QuestionItemModel *)model { + + _model = model; + + self.itemLabel.text = model.Title; + + if (_model.IsSelected == YES) { + + [self.selectBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateNormal]; + self.lineView.hidden = false; + self.backView.backgroundColor = RGBA(33, 190, 189, 0.5); + }else + { + [self.selectBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; + self.lineView.hidden = true; + self.backView.backgroundColor = KClearColor; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/SelectedFileDateCenterView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/SelectedFileDateCenterView.h new file mode 100644 index 0000000..3ec7ce9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/SelectedFileDateCenterView.h @@ -0,0 +1,49 @@ +// +// SelectedFileDateCenterView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import +#import "QuestionItemTable.h" +#import "UIPlaceHolderTextView.h" +#import "HQPhotoCollectView.h" +#import "LookFileDataModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SelectedFileDateCenterView : UIView + +@property (nonatomic, strong) LookFileDataModel * model; +@property (nonatomic, assign) CGFloat questionH; +@property (nonatomic, strong)NSArray * photoArray; +@property (nonatomic, strong)NSArray * assetArray; + +@property (nonatomic, weak)id questionOneDelegate; +@property (nonatomic, strong) UIPlaceHolderTextView * inputQuestion1View; +@property (nonatomic, strong) UIPlaceHolderTextView * helpInputView; +@property (nonatomic, weak)id photoDelegate; + +@property (nonatomic, strong) UITextField * fileNameField; +@property (nonatomic, assign) NSInteger chixuTime;//患病时间1一周内2一月内3半年内4半年以上 +@property (nonatomic, strong) UITextField * hospitalField; +@property (nonatomic, strong) UITextField * sicksField; + +//是否点击了 就诊选择 +@property (nonatomic, assign) BOOL jiuzhenIsAction; +//是否点击了 查看报告 +@property (nonatomic, assign) BOOL reportIsAction; +//是否点击了 查看健康 +@property (nonatomic, assign) BOOL healthIsAction; + +@property (nonatomic, assign) BOOL jiuzhenSelected; +@property (nonatomic, assign) BOOL reportSelected; +@property (nonatomic, assign) BOOL healthSelected; + +@property (nonatomic, assign) BOOL isEdit; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/SelectedFileDateCenterView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/SelectedFileDateCenterView.m new file mode 100644 index 0000000..9f39fe4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DataDetail(档案详情)/SelectedFileDateCenterView.m @@ -0,0 +1,618 @@ +// +// SelectedFileDateCenterView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/19. +// + +#import "SelectedFileDateCenterView.h" +#import "QuestionItemModel.h" +#import "HQPhotoCollectView.h" + +#define marginEdge 12 +#define imageWidth 60 +#define imageHeight 60 +@interface SelectedFileDateCenterView () + +@property (nonatomic, strong) UILabel * firstQuestionLabel; + +@property (nonatomic, strong) UILabel * firstAnswerLabel; + +@property (nonatomic, strong) UILabel * secendQuestionLabel; + +@property (nonatomic, strong) UILabel * secendAnswerLabel; + +@property (nonatomic, strong) YYLabel * thirdQuestionLabel; + +@property (nonatomic, strong) UILabel * thirdAnswerLabel; + +@property (nonatomic, strong) UILabel * fourthQuestionLabel; + +@property (nonatomic, strong) UILabel * fourthAnswerLabel; + +@property (nonatomic, strong) UILabel * fifthQuestionLabel; + +@property (nonatomic, strong) UILabel * fifthAnswerLabel; + +@property (nonatomic, strong) UIView * hospatilView; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * disNameLabel; + +@property (nonatomic, strong) UILabel * numberLabel; + + +@property (nonatomic, strong) UIView * pictureView; +@property (nonatomic, strong) UIView * eigLine; +@property (nonatomic, strong) UIView * linejiben; +@property (nonatomic, strong) UIView * eigView; +@property (nonatomic, strong) UIView * jibenView; + +@property (nonatomic, strong) UIView *fiveView; +@property (nonatomic, strong) UIView *linefive; +@property (nonatomic, strong) UIView *sixLine; +@property (nonatomic, strong) UIView *sixView; +@property (nonatomic, strong) UIView *thirdView; +@property (nonatomic, strong) UIView *foureViewLine; +@property (nonatomic, strong) UIView * linethird; +@property (nonatomic, strong) UIView * foureView; + +@property (nonatomic, strong) UIView * qidaiView; +@property (nonatomic, strong) UIView * reportView; + +@property (nonatomic, strong) QuestionItemTable * homeTable; + + +@property (nonatomic, strong) HQPhotoCollectView * collectView; + +@property (nonatomic, strong) UIButton * oneUpButton; +@property (nonatomic, strong) UIButton * oneDownButton; +@property (nonatomic, strong) UIButton * twoUpButton; +@property (nonatomic, strong) UIButton * twoDownButton; +@property (nonatomic, strong) UIButton * threeUpButton; +@property (nonatomic, strong) UIButton * threeDownButton; + + + +@end + + +@implementation SelectedFileDateCenterView + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + self.jiuzhenIsAction = NO; + self.reportIsAction = NO; + self.healthIsAction = NO; + [self createUI]; + + } + + return self; +} + +- (void)createUI { + + self.backgroundColor = KWhiteColor; + + //档案名称 + UILabel * fileName = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), kRealValue(24), self.width - kRealValue(30), 14)]; + fileName.text = @"1.档案名称"; + fileName.font = BOLDSYSTEMFONT(14); + fileName.textAlignment = NSTextAlignmentLeft; + fileName.textColor = UIColorHex(#333333); + [self addSubview:fileName]; + + self.fileNameField = [[UITextField alloc] initWithFrame:CGRectMake(kRealValue(20), fileName.bottom + kRealValue(16), self.width - kRealValue(40), 44)]; + self.fileNameField.backgroundColor = UIColorHex(#EFEFEF); + self.fileNameField.placeholder = @"请输入您的档案名称便于您的理解使用"; + self.fileNameField.layer.cornerRadius = 10; + self.fileNameField.layer.masksToBounds = YES; + self.fileNameField.font = MEDIUMFONT(14); + UIView *leftView = [[UIView alloc] init]; + leftView.width = 10; + self.fileNameField.leftViewMode = UITextFieldViewModeAlways; + self.fileNameField.leftView = leftView; + [self addSubview:self.fileNameField]; + + + //第一个问题 + self.firstQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), self.fileNameField.bottom + kRealValue(22), self.width - kRealValue(30), 14)]; + self.firstQuestionLabel.text = @"2.本次问题持续多久了?"; + self.firstQuestionLabel.font = BOLDSYSTEMFONT(14); + self.firstQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.firstQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.firstQuestionLabel]; + + //如果选择 + NSArray * array = @[@{@"Title":@"A 一周内",@"IsSelected":@NO},@{@"Title":@"B 一个月内",@"IsSelected":@NO},@{@"Title":@"C 半年内",@"IsSelected":@NO},@{@"Title":@"D 半年以上",@"IsSelected":@NO}]; + NSMutableArray * modelArray = [[NSMutableArray alloc] init]; + for (NSDictionary * parmDic in array) { + + QuestionItemModel * model = [QuestionItemModel modelWithDictionary:parmDic]; + + [modelArray addObject:model]; + } + + self.homeTable = [[QuestionItemTable alloc] initWithFrame:CGRectMake(0, self.firstQuestionLabel.bottom + kRealValue(10), self.width, 35 * 4) style:UITableViewStylePlain]; + self.homeTable.dataArray = modelArray; + self.homeTable.questionOneDelegate = self; + self.homeTable.scrollEnabled = YES; + [self addSubview:self.homeTable]; + + + + //第二个问题 + self.secendQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), self.homeTable.bottom + kRealValue(15), self.width - kRealValue(30), 14)]; + self.secendQuestionLabel.text = @"3.请描述您的问题"; + self.secendQuestionLabel.font = BOLDSYSTEMFONT(14); + self.secendQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.secendQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.secendQuestionLabel]; + + + self.inputQuestion1View = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(20), self.secendQuestionLabel.bottom + kRealValue(17), self.width - kRealValue(40) , 120)]; + self.inputQuestion1View.backgroundColor = UIColorHex(#F3F3F5); + self.inputQuestion1View.layer.cornerRadius = 10; + self.inputQuestion1View.layer.masksToBounds = true; +// self.inputQuestion1View.placeholder = @""; + self.inputQuestion1View.font = MEDIUMFONT(12); + [self addSubview:self.inputQuestion1View]; + //图片 + self.pictureView = [[UIView alloc] initWithFrame:CGRectMake(0, self.inputQuestion1View.bottom + kRealValue(12), self.width, 110)]; + [self addSubview: self.pictureView]; + + UILabel * pictureLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(10), 0, 165, 35)]; + pictureLabel.text = @"上传检查报告或者患处照片"; + pictureLabel.font = MEDIUMFONT(12); + pictureLabel.textAlignment = NSTextAlignmentLeft; + pictureLabel.textColor = UIColorHex(#666666); + [self.pictureView addSubview:pictureLabel]; + + UILabel * showLabel = [[UILabel alloc] initWithFrame:CGRectMake(155, 0, 100, 35)]; + showLabel.text = @"(仅自己和医生可见)"; + showLabel.font = MEDIUMFONT(11); + showLabel.textAlignment = NSTextAlignmentLeft; + showLabel.textColor = UIColorHex(#333333); + [self.pictureView addSubview:showLabel]; + + UILabel * numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width - 10 - 50, 0, 50, 35)]; + numberLabel.text = @"0/9"; + numberLabel.font = MEDIUMFONT(11); + numberLabel.textAlignment = NSTextAlignmentRight; + numberLabel.textColor = UIColorHex(#333333); + self.numberLabel = numberLabel; + [self.pictureView addSubview:numberLabel]; + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(imageWidth, imageHeight); + layout.minimumInteritemSpacing = marginEdge; + layout.minimumLineSpacing = marginEdge; + layout.scrollDirection=UICollectionViewScrollDirectionHorizontal; + layout.sectionInset=UIEdgeInsetsMake(10, 0, marginEdge, 0); + + self.collectView = [[HQPhotoCollectView alloc] initWithFrame:CGRectMake(pictureLabel.left, pictureLabel.bottom, self.width - kRealValue(20), 84) collectionViewLayout:layout]; + [self.pictureView addSubview:self.collectView]; + + //第三个问题 + self.thirdQuestionLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kRealValue(20),self.pictureView.bottom + kRealValue(10), self.width - kRealValue(30), 14)]; + self.thirdQuestionLabel.text = @"4.咨询人是否去医院就诊过?"; + self.thirdQuestionLabel.font = BOLDSYSTEMFONT(14); + self.thirdQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.thirdQuestionLabel.textColor = UIColorHex(#333333); + [self addSubview:self.thirdQuestionLabel]; + + UIView * thirdView = [[UIView alloc] initWithFrame:CGRectMake(0, self.thirdQuestionLabel.bottom + kRealValue(15), self.width, 35)]; + self.thirdView = thirdView; + thirdView.backgroundColor = KClearColor; + [self addSubview:thirdView]; + + UIView * linethird = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + linethird.backgroundColor =KClearColor; + self.linethird = linethird; + self.linethird.hidden = YES; + [thirdView addSubview:linethird]; + + UIButton * oneUpBtn = [[UIButton alloc] initWithFrame:CGRectMake(thirdView.right - 23 - 14, 10, 14, 14)]; + [oneUpBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateSelected]; + [oneUpBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; + self.oneUpButton = oneUpBtn; + oneUpBtn.selected = false; + [thirdView addSubview:oneUpBtn]; + + YYLabel * quguoLabel = [[YYLabel alloc] initWithFrame:CGRectMake(linethird.right + kRealValue(25), 0, self.width - kRealValue(48), 35)]; + quguoLabel.text = @"A 就诊过"; + quguoLabel.font = MEDIUMFONT(12); + quguoLabel.textAlignment = NSTextAlignmentLeft; + quguoLabel.textColor = UIColorHex(#333333);\ + [quguoLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [self questionHospatial]; + }]; + [thirdView addSubview:quguoLabel]; + + +// + UIView * foureView = [[UIView alloc] initWithFrame:CGRectMake(0, thirdView.bottom, self.width, 35)]; + foureView.backgroundColor = KClearColor; + self.foureView = foureView; + [self addSubview:foureView]; + + UIView * foureViewLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3, 35)]; + foureViewLine.backgroundColor = UIColorHex(#21BEBD); + foureViewLine.hidden = YES; + self.foureViewLine = foureViewLine; + [foureView addSubview:foureViewLine]; + + UIButton * oneDownBtn = [[UIButton alloc] initWithFrame:CGRectMake(thirdView.right - 23 - 14 , 10, 14, 14)]; + [oneDownBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateSelected]; + [oneDownBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; + oneDownBtn.selected = false; + self.oneDownButton = oneDownBtn; + [foureView addSubview:oneDownBtn]; + + YYLabel * meiLabel = [[YYLabel alloc] initWithFrame:CGRectMake(linethird.right + kRealValue(25), 0, self.width - kRealValue(48), 35)]; + meiLabel.text = @"B 没就诊过"; + meiLabel.font = MEDIUMFONT(12); + meiLabel.textAlignment = NSTextAlignmentLeft; + meiLabel.textColor = UIColorHex(#333333); + [foureView addSubview:meiLabel]; + [meiLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [self meiJiuzhengAction]; + }]; + + + + self.hospatilView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(8), foureView.bottom, self.width - kRealValue(16), 80)]; + self.hospatilView.backgroundColor = UIColorHex(#EFEFEF); + self.hospatilView.layer.cornerRadius = 10; + self.hospatilView.layer.masksToBounds = true; + self.hospatilView.hidden = YES; + [self addSubview:self.hospatilView]; +// + + + UIView * hospitalLeft = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(10),10, 100, 25)]; + hospitalLeft.backgroundColor = UIColorHex(#EFEFEF); + self.roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,100, 25)]; + self.roomLabel.text = @"就诊医院及科室:"; + self.roomLabel.font = MEDIUMFONT(12); + self.roomLabel.textAlignment = NSTextAlignmentLeft; + self.roomLabel.textColor = UIColorHex(#333333); + self.roomLabel.backgroundColor = UIColorHex(#EFEFEF); + [hospitalLeft addSubview:self.roomLabel]; + [self.hospatilView addSubview:hospitalLeft]; + UIView * yiyuanLeft = [[UIView alloc] initWithFrame:CGRectMake(0,10, kRealValue(8), 25)]; + yiyuanLeft.backgroundColor = KClearColor; + + self.hospitalField = [[UITextField alloc] initWithFrame:CGRectMake(self.roomLabel.right + kRealValue(8), kRealValue(10), self.hospatilView.width - kRealValue(20) - 100, 25)]; + self.hospitalField.leftViewMode = UITextFieldViewModeAlways; +// self.hospitalField.leftView = hospitalLeft; + self.hospitalField.font = MEDIUMFONT(12); + self.hospitalField.backgroundColor = KWhiteColor; + self.hospitalField.leftView.backgroundColor = UIColorHex(#333333); + self.hospitalField.layer.cornerRadius = 10; + self.hospitalField.layer.masksToBounds = true; + self.hospitalField.leftView = yiyuanLeft; + [self.hospatilView addSubview:self.hospitalField]; +// + UIView * roomLeft = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(10), self.roomLabel.bottom + kRealValue(20), 100, 25)]; + roomLeft.backgroundColor = UIColorHex(#EFEFEF); + self.disNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0 , 100, 25)]; + self.disNameLabel.text = @"诊断的疾病名:"; + self.disNameLabel.font = MEDIUMFONT(12); + self.disNameLabel.textAlignment = NSTextAlignmentLeft; + self.disNameLabel.textColor = UIColorHex(#333333); + self.disNameLabel.backgroundColor = UIColorHex(#EFEFEF); + + UIView * keshiLeft = [[UIView alloc] initWithFrame:CGRectMake(0,10, kRealValue(8), 25)]; + keshiLeft.backgroundColor = KClearColor; + + [roomLeft addSubview:self.disNameLabel]; + [self.hospatilView addSubview:roomLeft]; + + self.sicksField = [[UITextField alloc] initWithFrame:CGRectMake(self.roomLabel.right + kRealValue(8), self.roomLabel.bottom + kRealValue(20), self.hospatilView.width - kRealValue(20)-100, 25)]; + self.sicksField.leftViewMode = UITextFieldViewModeAlways; + self.sicksField.backgroundColor = KWhiteColor; + self.sicksField.leftView.backgroundColor = UIColorHex(#333333); + self.sicksField.layer.cornerRadius = 10; + self.sicksField.layer.masksToBounds = true; + self.sicksField.font = MEDIUMFONT(12); + self.sicksField.leftView = keshiLeft; + [self.hospatilView addSubview:self.sicksField]; + +// //第4个问题 + + self.qidaiView = [[UIView alloc] initWithFrame:CGRectMake(0, self.foureView.bottom + kRealValue(21), self.width, 14 + 120 + kRealValue(15))]; + [self addSubview:self.qidaiView]; + + self.fourthQuestionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20), 0, self.width - kRealValue(30), 14)]; + self.fourthQuestionLabel.text = @"5.期望得到的帮助?"; + self.fourthQuestionLabel.font = BOLDSYSTEMFONT(14); + self.fourthQuestionLabel.textAlignment = NSTextAlignmentLeft; + self.fourthQuestionLabel.textColor = UIColorHex(#333333); + [self.qidaiView addSubview:self.fourthQuestionLabel]; + + + self.helpInputView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(20), self.fourthQuestionLabel.bottom + kRealValue(15), self.width - kRealValue(40), 120)]; + self.helpInputView.placeholder = @"请输入您的诉求"; + self.helpInputView.font = MEDIUMFONT(12); + self.helpInputView.backgroundColor = UIColorHex(#F3F3F5); + self.helpInputView.layer.cornerRadius = 10; + self.helpInputView.layer.masksToBounds = true; + self.helpInputView.textColor = UIColorHex(#333333); + self.helpInputView.delegate = self; + [self.qidaiView addSubview:self.helpInputView]; + // 第5个问题。 青海项目不需要 + + self.reportView = [[UIView alloc] initWithFrame:CGRectMake(0, self.qidaiView.bottom + kRealValue(21), self.width, 28 + 140 + kRealValue(30) )]; + [self addSubview:self.reportView]; + + + self.reportView.height = kRealValue(15); + + self.questionH = self.reportView.bottom + kRealValue(10); +} + +- (void)setPhotoArray:(NSArray *)photoArray { + + _photoArray = photoArray; + self.numberLabel.text = [NSString stringWithFormat:@"%lu/9",(unsigned long)_photoArray.count]; + + _collectView.photoArray = _photoArray; +// _collectView.contentSize = CGSizeMake(_photoArray.count * 60, 84); +} + +- (void)setQuestionOneDelegate:(id)questionOneDelegate { + + _questionOneDelegate = questionOneDelegate; + + self.homeTable.questionOneDelegate = _questionOneDelegate; + +} + +- (void)setPhotoDelegate:(id)photoDelegate { + + _photoDelegate = photoDelegate; + + self.collectView.photoDelegate = _photoDelegate; + +} + +- (void)setIsEdit:(BOOL)isEdit { + + _isEdit = isEdit; + + self.collectView.isEdit = _isEdit; + +} + +#pragma mark:健康信息点击 +- (void)healthInfoAction { + + self.healthIsAction= YES; + self.healthSelected = false; + + self.eigLine.hidden = false; + self.linejiben.hidden = YES; + self.threeUpButton.selected = false; + self.threeDownButton.selected = YES; + self.eigView.backgroundColor = RGBA(33, 190, 189, 0.5); + self.jibenView.backgroundColor = KClearColor; +} + +- (void)healthInfoUpAction { + + self.healthIsAction= YES; + self.healthSelected = YES; + + self.eigLine.hidden = YES; + self.linejiben.hidden = false; + self.threeUpButton.selected = YES; + self.threeDownButton.selected = false; + self.jibenView.backgroundColor = RGBA(33, 190, 189, 0.5); + self.eigView.backgroundColor = KClearColor; +} +//第五个问题 +- (void)questionFive { + + self.reportSelected = true; + self.reportIsAction = YES; + + self.linefive.hidden = false; + self.sixLine.hidden = YES; + self.fiveView.backgroundColor = RGBA(33, 190, 189, 0.5); + self.sixView.backgroundColor = KClearColor; + self.twoUpButton.selected = YES; + self.twoDownButton.selected = false; +} + +- (void)questionFiveNo { + + self.reportSelected = false; + self.reportIsAction = YES; + + self.linefive.hidden = YES; + self.sixLine.hidden = false; + self.sixView.backgroundColor = RGBA(33, 190, 189, 0.5); + self.fiveView.backgroundColor = KClearColor; + self.twoDownButton.selected = YES; + self.twoUpButton.selected = false; +} + +- (void)questionHospatial { + + self.jiuzhenSelected = true; + self.jiuzhenIsAction = YES; + + self.thirdView.backgroundColor = RGBA(33, 190, 189, 0.5); + self.foureView.backgroundColor = KClearColor; + self.linethird.hidden = false; + self.foureViewLine.hidden = YES; + self.oneUpButton.selected = YES; + self.oneDownButton.selected = false; + self.hospatilView.hidden = false; + self.qidaiView.frame = CGRectMake(0, self.hospatilView.bottom + kRealValue(21), self.width , 14 + self.helpInputView.bottom + kRealValue(15)); + self.reportView.frame = CGRectMake(0, self.qidaiView.bottom + kRealValue(21), self.width, 28 + 140 + kRealValue(30) ); + self.reportView.height = self.sixView.bottom + kRealValue(10); + self.questionH = self.reportView.bottom + kRealValue(10); + KPostNotification(@"FrameChage", @(self.questionH)); + +} + +- (void)meiJiuzhengAction { + + self.jiuzhenSelected = false; + self.jiuzhenIsAction = YES; + + self.foureView.backgroundColor = RGBA(33, 190, 189, 0.5); + self.thirdView.backgroundColor = KClearColor; + self.linethird.hidden = true; + self.foureViewLine.hidden = false; + self.oneUpButton.selected = false; + self.oneDownButton.selected = true; + self.hospatilView.hidden = true; + self.qidaiView.frame = CGRectMake(0, self.foureView.bottom + kRealValue(21), self.width, 14 + self.helpInputView.bottom + kRealValue(15)); + self.reportView.frame = CGRectMake(0, self.qidaiView.bottom + kRealValue(21), self.width, 28 + 140 + kRealValue(30) ); + self.reportView.height = self.sixView.bottom + kRealValue(10); + self.questionH = self.reportView.bottom + kRealValue(10); + KPostNotification(@"FrameChage", @(self.questionH)); +} + +- (void)setModel:(LookFileDataModel *)model { + + _model = model; + + + [self createHaveTimeView:[_model.haveTime integerValue]]; + + self.fileNameField.text = _model.recordsName; + self.inputQuestion1View.text = _model.medicalDescribe; + self.helpInputView.text = _model.desire; + [self adjustTextViewHeightToFitText:self.helpInputView.text]; + NSArray * imageArray = [_model.image componentsSeparatedByString:@","]; + self.collectView.photoArray = imageArray; + if ([_model.tfLook integerValue] == 1) // 1 就诊过 + { + [self questionHospatial]; + self.hospitalField.text = _model.lookOffice; + self.sicksField.text = _model.lookMedicalName; + + } + if ([_model.tfLook integerValue] == 0) // 1 就诊过 + { + [self meiJiuzhengAction]; + } + + + if ([_model.tfPermission integerValue] == 1) // 1 体检报告 + { + [self questionFive]; + + + } + if ([_model.tfPermission integerValue] == 0) // 1 体检报告 + { + [self questionFiveNo]; + } + +} +- (void)textViewDidChange:(UITextView *)textView { + [self adjustTextViewHeightToFitText:textView.text]; + self.qidaiView.height = textView.bottom + kRealValue(20); + self.questionH = self.qidaiView.bottom + kRealValue(10); + KPostNotification(@"FrameChage", @(self.questionH)); +} + +- (void)adjustTextViewHeightToFitText:(NSString *)text { + self.helpInputView.text = text; + + if (text.length == 0) { + // Set default height when there's no content + CGRect defaultFrame = self.helpInputView.frame; + defaultFrame.size.height = 120; + self.helpInputView.frame = defaultFrame; + } else { + CGSize maxSize = CGSizeMake(self.helpInputView.frame.size.width, CGFLOAT_MAX); + CGRect textRect = [text boundingRectWithSize:maxSize + options:NSStringDrawingUsesLineFragmentOrigin + attributes:@{NSFontAttributeName:self.helpInputView.font} + context:nil]; + + // Adjust the UITextView frame based on calculated text height + CGRect newFrame = self.helpInputView.frame; + newFrame.size.height = textRect.size.height + self.helpInputView.textContainerInset.top + self.helpInputView.textContainerInset.bottom; + if (newFrame.size.height > 120) { + + }else + { + newFrame.size.height = 120 + self.helpInputView.textContainerInset.top + self.helpInputView.textContainerInset.bottom; + } + self.helpInputView.frame = newFrame; + } +} + +- (void)createHaveTimeView:(NSInteger)type { + + switch (type) { + case 1: + { + NSArray * array = @[@{@"Title":@"A 一周内",@"IsSelected":@YES},@{@"Title":@"B 一个月内",@"IsSelected":@NO},@{@"Title":@"C 半年内",@"IsSelected":@NO},@{@"Title":@"D 半年以上",@"IsSelected":@NO}]; + NSMutableArray * modelArray = [[NSMutableArray alloc] init]; + for (NSDictionary * parmDic in array) { + + QuestionItemModel * model = [QuestionItemModel modelWithDictionary:parmDic]; + + [modelArray addObject:model]; + } + self.homeTable.dataArray = modelArray; + } + break; + case 2: + { + NSArray * array = @[@{@"Title":@"A 一周内",@"IsSelected":@NO},@{@"Title":@"B 一个月内",@"IsSelected":@YES},@{@"Title":@"C 半年内",@"IsSelected":@NO},@{@"Title":@"D 半年以上",@"IsSelected":@NO}]; + NSMutableArray * modelArray = [[NSMutableArray alloc] init]; + for (NSDictionary * parmDic in array) { + + QuestionItemModel * model = [QuestionItemModel modelWithDictionary:parmDic]; + + [modelArray addObject:model]; + } + self.homeTable.dataArray = modelArray; + } + break; + case 3: + { + NSArray * array = @[@{@"Title":@"A 一周内",@"IsSelected":@NO},@{@"Title":@"B 一个月内",@"IsSelected":@NO},@{@"Title":@"C 半年内",@"IsSelected":@YES},@{@"Title":@"D 半年以上",@"IsSelected":@NO}]; + NSMutableArray * modelArray = [[NSMutableArray alloc] init]; + for (NSDictionary * parmDic in array) { + + QuestionItemModel * model = [QuestionItemModel modelWithDictionary:parmDic]; + + [modelArray addObject:model]; + } + self.homeTable.dataArray = modelArray; + } + break; + case 4: + { + NSArray * array = @[@{@"Title":@"A 一周内",@"IsSelected":@NO},@{@"Title":@"B 一个月内",@"IsSelected":@NO},@{@"Title":@"C 半年内",@"IsSelected":@NO},@{@"Title":@"D 半年以上",@"IsSelected":@YES}]; + NSMutableArray * modelArray = [[NSMutableArray alloc] init]; + for (NSDictionary * parmDic in array) { + + QuestionItemModel * model = [QuestionItemModel modelWithDictionary:parmDic]; + + [modelArray addObject:model]; + } + self.homeTable.dataArray = modelArray; + } + break; + + default: + break; + } + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTable.h new file mode 100644 index 0000000..e516882 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTable.h @@ -0,0 +1,22 @@ +// +// DoctorEvaluationTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +typedef void(^lookMoreEvaluation)(void); + +@interface DoctorEvaluationTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + + +@property (nonatomic, copy) lookMoreEvaluation moreBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTable.m new file mode 100644 index 0000000..53f38b7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTable.m @@ -0,0 +1,151 @@ +// +// DoctorEvaluationTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import "DoctorEvaluationTable.h" +#import "DoctorEvaluationTableViewCell.h" +#import "HospitalMainHeardView.h" +#import "HospitalEvaluationTableViewCell.h" +#import "HospatilIntroduceTableViewCell.h" +#import "EvaluationTitleTableViewCell.h" + + +@interface DoctorEvaluationTable () + +@property (nonatomic, strong) HospitalMainHeardView * headView; + +@end + +@implementation DoctorEvaluationTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.backgroundColor = KClearColor; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count + 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + if (indexPath.row == 0) { + + EvaluationTitleTableViewCell * titleCell = [tableView dequeueReusableCellWithIdentifier:@"TitleCELL"]; + + if (!titleCell) { + + titleCell = [[EvaluationTitleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TitleCELL"]; + } + + titleCell.selectionStyle = UITableViewCellSelectionStyleNone; + titleCell.moreBlock = ^{ + self.moreBlock(); + }; + return titleCell; + + }else + { + DoctorEvaluationTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"EVALUATIONCELL"]; + + if (!cell) { + + cell = [[DoctorEvaluationTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"EVALUATIONCELL"]; + } + + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.model = self.dataArray[indexPath.row - 1]; + return cell; + } + + + return UITableViewCell.new; + + + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0)]; + + hearView.backgroundColor = KClearColor; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTableViewCell.h new file mode 100644 index 0000000..7ed6402 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTableViewCell.h @@ -0,0 +1,19 @@ +// +// DoctorEvaluationTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import +#import "EvaluatListModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorEvaluationTableViewCell : UITableViewCell + +@property (nonatomic, strong) EvaluatListModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTableViewCell.m new file mode 100644 index 0000000..35d94d0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorEvaluationTableViewCell.m @@ -0,0 +1,150 @@ +// +// DoctorEvaluationTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/16. +// + +#import "DoctorEvaluationTableViewCell.h" + + +#import "FSXBStarRateView.h" + + +@interface DoctorEvaluationTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) FSXBStarRateView * starview; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * evaluatLabel; + +@property (nonatomic, strong) UILabel * typeLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@end + +@implementation DoctorEvaluationTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + + } + return self; +} + +- (void)createUI { + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.text = @"匿名用户"; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(14); + make.top.mas_offset(15); + make.height.mas_offset(14); + + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.starview = [[FSXBStarRateView alloc] initWithFrame:CGRectMake(0, 20, 100, 15) numberOfStars:5 rateStyle:HalfStar isAnination:YES finish:^(CGFloat currentScore) { + NSLog(@"%.2f",currentScore); + }]; + self.starview.enable = YES; + self.starview.currentScore = 3; + [self.contentView addSubview:self.starview]; + + [self.starview mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel.mas_right).offset(8); + make.top.mas_equalTo(self.nameLabel); + make.height.mas_offset(15); + make.width.mas_offset(100); + }]; +// self.roomLabel = [[UILabel alloc] init]; +// self.roomLabel.textColor = UIColorHex(#3390FF); +// self.roomLabel.font = MEDIUMFONT(12); +// self.roomLabel.text = @""; +// self.roomLabel.textAlignment = NSTextAlignmentRight; +// [self.contentView addSubview:self.roomLabel]; +// +// [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.right.mas_offset(-16); +// make.top.mas_offset(15); +// make.height.mas_offset(14); +// +// }]; +// [self.roomLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.font = MEDIUMFONT(12); + self.timeLabel.text = @"2023-01-15"; + self.timeLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.contentView).offset(-15); + make.top.mas_equalTo(@15); + make.width.mas_offset(200); + make.height.mas_offset(14); + + }]; + + + self.evaluatLabel = [[UILabel alloc] init]; + self.evaluatLabel.textColor = UIColorHex(#999999); + self.evaluatLabel.font = SYSTEMFONT(12); + self.evaluatLabel.text = @""; + self.evaluatLabel.numberOfLines = 0; + self.evaluatLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.evaluatLabel]; + + [self.evaluatLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-16); + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(15); + make.bottom.mas_equalTo(-11); + }]; + + [self.evaluatLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + +} + +- (void)setModel:(EvaluatListModel *)model { + + _model = model; + //1 图文 2音 + self.evaluatLabel.text = _model.context; + CGFloat currentSocore = [_model.score floatValue]; + self.starview.currentScore =currentSocore; + self.timeLabel.text = _model.time; + self.nameLabel.text = _model.userName; +// if (!ValidStr(_model.officeName)) { +// self.roomLabel.text = _model.officeName; +// +// } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorInfoTopView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorInfoTopView.h new file mode 100644 index 0000000..02652d7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorInfoTopView.h @@ -0,0 +1,27 @@ +// +// DoctorInfoTopView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import +#import "DoctorReportModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^userCollectCurrentDoctorBlock)(DoctorReportDoctorInfoModel * doctorModel); + +@interface DoctorInfoTopView : UIView + +//@property (nonatomic, strong) DoctorReportDoctorInfoModel * doctorModel; +//@property (nonatomic, strong) DoctorReportConSessionModel * sessionModel; +@property (nonatomic, strong) DoctorReportModel * model; +@property (nonatomic, assign) CGFloat doctorinfoHeight; + +@property (nonatomic, assign) bool isJujue; + +@property (nonatomic, copy) userCollectCurrentDoctorBlock collectBlock; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorInfoTopView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorInfoTopView.m new file mode 100644 index 0000000..83bed1e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorInfoTopView.m @@ -0,0 +1,531 @@ +// +// DoctorInfoTopView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import "DoctorInfoTopView.h" +#import "NSDate+BRPickerView.h" +@interface DoctorInfoTopView () + +@property (nonatomic, strong) UIImageView * heardImage; +@property (nonatomic, strong) NSMutableArray * labsArray; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * jobLabel; + +@property (nonatomic, strong) UILabel * hospatilLabel; + +@property (nonatomic, strong) UILabel * depmentLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * questionTypeLabel; + +@property (nonatomic, strong) UILabel * starTimeLabel; + +@property (nonatomic, strong) UIButton * collectBtn; + +@property (nonatomic, strong) UIView * starTimeView ; //开始时间视图 +@property (nonatomic, strong) UIView * jujueView ; //拒绝视图 +@property (nonatomic, strong) UIView * cancelQuestionView ; //取消视图 +@property (nonatomic, strong) UIView * questionRecordView ; //咨询记录 + + +@property (nonatomic, strong) UILabel * jujueyuanyinLab ; //拒绝原因 +@property (nonatomic, strong) UILabel * jujueBeizhuLab ; //拒绝备注 +@property (nonatomic, strong) UILabel * beizhuLabel ; //拒绝备注 +@property (nonatomic, strong) UILabel * recordStarLabel ; //拒绝备注 + + + +@property (nonatomic, strong) UILabel * cancelTimeLabel ; //取消时间 + + +@end + +@implementation DoctorInfoTopView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +#pragma mark:懒加载 +- (NSMutableArray *)labsArray { + + if (!_labsArray) { + + _labsArray = [[NSMutableArray alloc] init]; + } + return _labsArray; +} + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; +} + +- (void)createUI { + + self.heardImage = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(15), 60, 60)]; + self.heardImage.layer.cornerRadius = 30; + self.heardImage.layer.masksToBounds = YES; + [self addSubview:self.heardImage]; + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.heardImage.right + kRealValue(20), kRealValue(24), 100, 22)]; + self.nameLabel.text = @""; + self.nameLabel.font = BOLDSYSTEMFONT(21); + self.nameLabel.textColor = CFontColor1; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + CGFloat nameW = [HQCommonUtils getLengthFromText:self.nameLabel.text andFontSize:21]; + self.nameLabel.width = nameW + kRealValue(5); + [self addSubview:self.nameLabel]; + + self.jobLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameLabel.right + kRealValue(12), kRealValue(30), 100, 13)]; + self.jobLabel.text = @""; + self.jobLabel.font = BOLDSYSTEMFONT(13); + self.jobLabel.textColor = CFontColor1; + self.jobLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.jobLabel]; + + + self.collectBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width - kRealValue(15) - 60, kRealValue(24), 60, 25)]; + self.collectBtn.backgroundColor = UIColorHex(#21BEBD); + [self.collectBtn setTitle:@"关注" forState:UIControlStateNormal]; + self.collectBtn.titleLabel.font = SYSTEMFONT(12); + [self.collectBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.collectBtn.layer.cornerRadius = 13.0; + self.collectBtn.layer.masksToBounds = true; + [self.collectBtn addTarget:self action:@selector(userCollectDoctor) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:self.collectBtn]; + + self.hospatilLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.heardImage.right + kRealValue(18),self.jobLabel.bottom + kRealValue(18) ,self.width - self.heardImage.right - kRealValue(30), 13)]; + self.hospatilLabel.text = @""; + self.hospatilLabel.font = BOLDSYSTEMFONT(13); + self.hospatilLabel.textColor = CFontColor1; + self.hospatilLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.hospatilLabel]; + + UIView * lineV = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.heardImage.bottom + kRealValue(15), self.width - kRealValue(30), 1)]; + lineV.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:lineV]; + + UILabel * leftTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),lineV.bottom + kRealValue(15), 100, 14)]; + leftTimeLabel.text = @"预约时间"; + leftTimeLabel.font = MEDIUMFONT(14); + leftTimeLabel.textColor = CFontColor1; + leftTimeLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:leftTimeLabel]; + + self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width - 300 - 19,lineV.bottom + kRealValue(15), 300, 13)]; + self.timeLabel.text = @""; + self.timeLabel.font = BOLDSYSTEMFONT(13); + self.timeLabel.textColor = CFontColor1; + self.timeLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:self.timeLabel]; + + UILabel * leftTypeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),leftTimeLabel.bottom + kRealValue(13), 100, 14)]; + leftTypeLabel.text = @"预约类型"; + leftTypeLabel.font = MEDIUMFONT(14); + leftTypeLabel.textColor = CFontColor1; + leftTypeLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:leftTypeLabel]; + + self.questionTypeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width - 300 - 19, self.timeLabel.bottom + kRealValue(13), 300, 14)]; + self.questionTypeLabel.text = @""; + self.questionTypeLabel.font = BOLDSYSTEMFONT(13); + self.questionTypeLabel.textColor = CFontColor1; + self.questionTypeLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:self.questionTypeLabel]; + + //从这里开始不一样 + + UIView * starTimeView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.questionTypeLabel.bottom + kRealValue(16), self.width - kRealValue(30), 30)]; + self.starTimeView = starTimeView; + starTimeView.hidden = YES; + [self addSubview:starTimeView]; + + UIView * lineType = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, self.width - kRealValue(30), 1)]; + lineType.backgroundColor = UIColorHex(#E0E0E0); + [starTimeView addSubview:lineType]; + + UILabel * starLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,lineType.bottom + kRealValue(13), 100, 14)]; + starLabel.text = @"开始时间"; + starLabel.font = MEDIUMFONT(14); + starLabel.textColor = CFontColor1; + starLabel.textAlignment = NSTextAlignmentLeft; + [starTimeView addSubview:starLabel]; + + self.starTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(starTimeView.width - 300 - 15, lineType.bottom + kRealValue(13), 300, 22)]; + self.starTimeLabel.text = @""; + self.starTimeLabel.font = BOLDSYSTEMFONT(13); + self.starTimeLabel.textColor = CFontColor1; + self.starTimeLabel.textAlignment = NSTextAlignmentRight; + [starTimeView addSubview:self.starTimeLabel]; + starTimeView.height = starLabel.bottom + kRealValue(10); + self.starTimeView.hidden = YES; + // 1 拒绝 + + UIView * jujueView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.questionTypeLabel.bottom + kRealValue(13), self.width - kRealValue(30), 30)]; + self.jujueView = jujueView; + jujueView.hidden = true; + [self addSubview:jujueView]; + + UILabel * jujueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,1, 100, 14)]; + jujueLabel.text = @"拒绝原因"; + jujueLabel.font = MEDIUMFONT(14); + jujueLabel.textColor = CFontColor1; + jujueLabel.textAlignment = NSTextAlignmentLeft; + [jujueView addSubview:jujueLabel]; + + UILabel * jujueyuanyinLab = [[UILabel alloc] initWithFrame:CGRectMake(jujueLabel.right + 10, 0, jujueView.width - 20 - jujueLabel.width, 15)]; + jujueyuanyinLab.text = @""; + jujueyuanyinLab.font = BOLDSYSTEMFONT(13); + self.jujueyuanyinLab = jujueyuanyinLab; + self.jujueyuanyinLab.numberOfLines = 0; + jujueyuanyinLab.textColor = CFontColor1; + jujueyuanyinLab.textAlignment = NSTextAlignmentRight; + [jujueView addSubview:jujueyuanyinLab]; + + + UILabel * beizhuLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,jujueLabel.bottom + kRealValue(13), 100, 14)]; + beizhuLabel.text = @"拒绝备注"; + beizhuLabel.font = MEDIUMFONT(14); + beizhuLabel.textColor = CFontColor1; + beizhuLabel.textAlignment = NSTextAlignmentLeft; + self.beizhuLabel = beizhuLabel; + [jujueView addSubview:beizhuLabel]; + + self.jujueBeizhuLab = [[UILabel alloc] initWithFrame:CGRectMake(beizhuLabel.right + 10, jujueyuanyinLab.bottom + 1, jujueView.width - 20 - jujueLabel.width, 22)]; + self.jujueBeizhuLab.text = @""; + self.jujueBeizhuLab.font = BOLDSYSTEMFONT(13); + self.jujueBeizhuLab.numberOfLines = 0; + self.jujueBeizhuLab.textColor = CFontColor1; + self.jujueBeizhuLab.textAlignment = NSTextAlignmentRight; + [jujueView addSubview:self.jujueBeizhuLab]; +// + + // 取消 + self.cancelQuestionView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.questionTypeLabel.bottom + kRealValue(16), self.width - kRealValue(30), 30)]; + [self addSubview:self.cancelQuestionView]; + + UIView * cancellineType = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, self.width - kRealValue(30), 1)]; + cancellineType.backgroundColor = UIColorHex(#E0E0E0); + [self.cancelQuestionView addSubview:cancellineType]; + + UILabel * cancelStarLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,cancellineType.bottom + kRealValue(13), 100, 14)]; + cancelStarLabel.text = @"预计开始时间"; + cancelStarLabel.font = MEDIUMFONT(14); + cancelStarLabel.textColor = CFontColor1; + cancelStarLabel.textAlignment = NSTextAlignmentLeft; + [self.cancelQuestionView addSubview:cancelStarLabel]; + + UILabel * openLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,cancelStarLabel.bottom + kRealValue(13), 150, 12)]; + openLabel.text = @"请打开APP并保证网络流畅"; + openLabel.font = MEDIUMFONT(11); + openLabel.textColor = UIColorHex(#999999); + openLabel.textAlignment = NSTextAlignmentLeft; + [self.cancelQuestionView addSubview:openLabel]; + + self.cancelTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width - 300 - 19, cancellineType.bottom + kRealValue(13), 300, 22)]; + self.cancelTimeLabel.text = @""; + self.cancelTimeLabel.font = BOLDSYSTEMFONT(13); + self.cancelTimeLabel.textColor = UIColorHex(#999999); + self.cancelTimeLabel.textAlignment = NSTextAlignmentRight; + [self.cancelQuestionView addSubview:self.cancelTimeLabel]; + //中划线 + NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]}; + NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString: self.cancelTimeLabel.text attributes:attribtDic]; + // 赋值 + self.cancelTimeLabel.attributedText = attribtStr; + + self.cancelQuestionView.height = openLabel.bottom + kRealValue(10); + + //咨询记录 + + self.questionRecordView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.starTimeView.bottom + kRealValue(10), self.width - kRealValue(30), 30)]; + self.questionRecordView.backgroundColor = KWhiteColor; + [self addSubview:self.questionRecordView]; + + UIView * reocerdlineType = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.questionRecordView.width , 1)]; + reocerdlineType.backgroundColor = UIColorHex(#E0E0E0); + [self.questionRecordView addSubview:reocerdlineType]; + + UILabel * recordStarLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,reocerdlineType.bottom + kRealValue(13), 100, 14)]; + recordStarLabel.text = @"咨询记录"; + recordStarLabel.font = MEDIUMFONT(14); + recordStarLabel.textColor = CFontColor1; + recordStarLabel.textAlignment = NSTextAlignmentLeft; + self.recordStarLabel = recordStarLabel; + [self.questionRecordView addSubview:recordStarLabel]; + + // 赋值 + self.questionRecordView.height = recordStarLabel.bottom + kRealValue(10); + + + + self.doctorinfoHeight = self.cancelQuestionView.bottom + kRealValue(15); +} + + +- (void)setModel:(DoctorReportModel *)model { + _model = model; + + DoctorReportConSessionModel * sessionModel = [DoctorReportConSessionModel modelWithDictionary:_model.conSession] ; + + DoctorReportDoctorInfoModel * doctorModel = [DoctorReportDoctorInfoModel modelWithDictionary:_model.conDoctorDO] ; + + //医生信息 + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,doctorModel.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"doctorNoImage")]; + self.nameLabel.text = doctorModel.doctorName; + + CGFloat nameW = [HQCommonUtils getLengthFromText:self.nameLabel.text andFontSize:21]; + self.nameLabel.width = nameW + kRealValue(5); + self.jobLabel.text = doctorModel.doctorTitle; + self.jobLabel.frame = CGRectMake(self.nameLabel.right + kRealValue(12), kRealValue(30), 100, 13); + + if (ValidStr(doctorModel.resourceName) && ValidStr(doctorModel.departmentName) ) { + + self.hospatilLabel.text = @""; + }else + { + if (ValidStr(doctorModel.resourceName) ||ValidStr(doctorModel.departmentName) ) { + if (ValidStr(doctorModel.resourceName)) { + self.hospatilLabel.text = [NSString stringWithFormat:@"%@",doctorModel.departmentName]; + } + if (ValidStr(doctorModel.departmentName)) { + self.hospatilLabel.text = [NSString stringWithFormat:@"%@",doctorModel.resourceName]; + } + } + else + { + self.hospatilLabel.text = [NSString stringWithFormat:@"%@ %@",doctorModel.resourceName,doctorModel.departmentName]; + } + } + + + if([doctorModel.tfFollow integerValue] == 1) { + + [self.collectBtn setTitle:@"已关注" forState:UIControlStateNormal]; + [self.collectBtn setTitleColor:CFontColor2 forState:UIControlStateNormal]; + [self.collectBtn setBackgroundColor:CViewBgColor]; + [self.collectBtn setImage:[UIImage imageWithColor:CViewBgColor] forState:UIControlStateNormal]; + + }else + { + [self.collectBtn setImage:IMAGE_NAMED(@"detail_collect") forState:UIControlStateNormal]; + } + //状态数据 + NSString * timeString = [HQCommonUtils getTimeFromTimestamp:[sessionModel.sessionDateLong integerValue] andDateFormat:@"YYYY年MM月dd日"]; + NSString * weekString; + NSArray * weekArray = @[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周天"]; + NSString * amString = [sessionModel.amPm integerValue] == 1 ? @"下午":@"上午"; + if ( [sessionModel.week integerValue] >= 1) { + weekString = weekArray[[sessionModel.week integerValue] - 1]; + } + self.timeLabel.text = [NSString stringWithFormat:@"%@ %@ %@",timeString,weekString,amString]; + NSString * typeString = [sessionModel.contentType integerValue] == 1 ? @"图文咨询":@"视频咨询"; + self.questionTypeLabel.text = typeString; + + + //预约状态 1待确认 2待开始 3已开始 4待评价 5已完成 + // 6 拒绝 7取消 8 超时 + if ( [sessionModel.contentStatus integerValue] == 6) { //拒绝 + + self.jujueView.hidden = false; + self.starTimeView.hidden = true; + self.cancelQuestionView.hidden = true; + self.jujueyuanyinLab.text = sessionModel.reasonType; + self.jujueBeizhuLab.text = sessionModel.rejectReason; + CGFloat labH = [HQCommonUtils getSpaceLabelHeight: self.jujueyuanyinLab withStr:self.jujueyuanyinLab.text withFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium] withWidth: self.jujueyuanyinLab.width withLineSpacing:2]; + + CGFloat beizhulabH = [HQCommonUtils getSpaceLabelHeight: self.jujueBeizhuLab withStr:self.jujueBeizhuLab.text withFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium] withWidth: self.jujueyuanyinLab.width withLineSpacing:2]; + + //布局 + self.jujueView.top = self.questionTypeLabel.bottom + kRealValue(16); + self.jujueyuanyinLab.top = 1; + self.jujueBeizhuLab.height = beizhulabH; + self.jujueBeizhuLab.top = self.jujueyuanyinLab.bottom + kRealValue(16); + self.beizhuLabel.top = self.jujueyuanyinLab.bottom + kRealValue(16); + self.jujueView.height = self.beizhuLabel.bottom+ 15; + self.doctorinfoHeight = self.jujueView.bottom + kRealValue(15); + self.questionRecordView.top = self.jujueView.bottom; + self.questionRecordView.height = 10; + self.questionRecordView.hidden = YES; + self.questionRecordView.backgroundColor = KWhiteColor; + self.doctorinfoHeight = self.questionRecordView.bottom + kRealValue(12); + self.recordStarLabel.hidden = true; +// NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]}; +// NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString: self.timeLabel.text attributes:attribtDic]; +// // 类型 +// NSDictionary * typeattribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]}; +// NSMutableAttributedString * typeattribtStr = [[NSMutableAttributedString alloc]initWithString: self.questionTypeLabel.text attributes:typeattribtDic]; +// self.timeLabel.attributedText = typeattribtStr; +// self.doctorinfoHeight = self.questionTypeLabel.bottom + kRealValue(15); + } + if ( [sessionModel.contentStatus integerValue] == 1 || [sessionModel.contentStatus integerValue] == 2) { //待确认 + + self.jujueView.hidden = true ; + self.starTimeView.hidden = true; + self.cancelQuestionView.hidden = true; + self.questionRecordView.hidden = YES; + if ( ValidStr(sessionModel.doctorStartTime)) { //如果医生开始时间为空 那么不显示 + + self.starTimeView.hidden = true; + }else + { + self.starTimeView.hidden = false; + self.starTimeLabel.text = [HQCommonUtils getTimeFromTimestamp:[sessionModel.sessionDateLong integerValue] andDateFormat:@"YYYY年MM月dd日 HH:mm"]; + } + + self.doctorinfoHeight = self.questionTypeLabel.bottom + kRealValue(15); + } + if ( [sessionModel.contentStatus integerValue] == 7) { //取消 + + self.jujueView.hidden = YES; + self.starTimeView.hidden = YES; + self.cancelQuestionView.hidden = false; + self.questionRecordView.hidden = YES; + self.jujueyuanyinLab.text = doctorModel.responseRate; + CGFloat labH = [HQCommonUtils getSpaceLabelHeight: self.jujueyuanyinLab withStr:self.jujueyuanyinLab.text withFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium] withWidth: self.jujueyuanyinLab.width withLineSpacing:5]; + self.jujueyuanyinLab.height = labH; + self.jujueView.hidden = YES; + self.doctorinfoHeight = self.questionTypeLabel.bottom + kRealValue(15); + } + if ( [sessionModel.contentStatus integerValue] == 3 || [sessionModel.contentStatus integerValue] == 4 || [sessionModel.contentStatus integerValue] == 5) { //在线咨询 + for (UILabel * currentlab in self.labsArray) { + + [currentlab removeFromSuperview]; + } + [self.labsArray removeAllObjects]; + + self.jujueView.hidden = true ; + self.starTimeView.hidden = false; + self.cancelQuestionView.hidden = true; + + if ( ValidStr(sessionModel.doctorStartTime)) { //如果医生开始时间为空 那么不显示 + + self.starTimeView.hidden = true; + }else + { + self.starTimeView.hidden = false; + NSString * doctorStar = [HQCommonUtils getTimeFromTimestamp:[sessionModel.doctorStartTimeLong integerValue] andDateFormat:@"YYYY年MM月dd日 HH:mm"]; + NSString * doctorend = [HQCommonUtils getTimeFromTimestamp:[sessionModel.doctorEndTimeLong integerValue] andDateFormat:@"HH:mm"]; + + self.starTimeLabel.text = [NSString stringWithFormat:@"%@~%@",doctorStar,doctorend]; + } + + NSArray * recordArray = _model.imList; + CGFloat height = 30; + for (int i = 0 ; i < recordArray.count; i ++) { + + DoctoIMListModel * imModel = recordArray[i]; + + + UILabel * recordLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 45 + 25 * i, self.questionRecordView.width, 20)]; + recordLabel.textAlignment = NSTextAlignmentLeft; + recordLabel.font = SYSTEMFONT(14); + NSString * questionType = @""; + NSString * timeString; + if (ValidStr(imModel.startTime) || ValidStr(imModel.endTime)) { + + timeString = @"时长:--"; + }else + { + timeString = [self dateTimeDifferenceWithStartTime:imModel.startTime endTime:imModel.endTime]; + } + if ([imModel.type intValue] == 2) { + questionType = @"视频咨询"; + recordLabel.text = [NSString stringWithFormat:@"%@:%@ %@",questionType,imModel.startTime,timeString]; + }else + { + questionType = @"约定时间"; + NSString * doctorStar = [HQCommonUtils getTimeFromTimestamp:[imModel.startTimLong integerValue] andDateFormat:@"YYYY-MM-dd HH:mm"]; + NSString * doctorend = [HQCommonUtils getTimeFromTimestamp:[imModel.endTimeLong integerValue] andDateFormat:@"HH:mm"]; + recordLabel.text = [NSString stringWithFormat:@"%@:%@~%@",questionType,doctorStar,doctorend]; + } + recordLabel.textColor = CFontColor1; + + + + + if (i == recordArray.count - 1) { + + height = recordLabel.bottom; + self.questionRecordView.height = recordLabel.bottom; + } + [self.questionRecordView addSubview:recordLabel]; + [self.labsArray addObject:recordLabel]; + } + + + self.doctorinfoHeight = self.questionRecordView.bottom + kRealValue(15); + } + + +} + + +-(NSString *)dateTimeDifferenceWithStartTime:(NSString *)startTime endTime:(NSString *)endTime{ + NSDateFormatter *date = [[NSDateFormatter alloc]init]; + [date setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSDate *startD =[date dateFromString:startTime]; + NSDate *endD = [date dateFromString:endTime]; + NSTimeInterval start = [startD timeIntervalSince1970]*1; + NSTimeInterval end = [endD timeIntervalSince1970]*1; + NSTimeInterval value = end - start; + int second = (int)value %60;//秒 + int minute = (int)value /60%60; + int house = (int)value % (24 * 3600)/3600; + int day = (int)value / (24 * 3600); + NSString *str; + if (day != 0) { + str = [NSString stringWithFormat:@"时长:%d天%d小时%d分%d秒",day,house,minute,second]; + }else if (day==0 && house != 0) { + str = [NSString stringWithFormat:@"时长:%d小时%d分%d秒",house,minute,second]; + }else if (day== 0 && house== 0 && minute!=0) { + str = [NSString stringWithFormat:@"时长:%d分%d秒",minute,second]; + }else{ + str = [NSString stringWithFormat:@"时长:%d秒",second]; + } + + return str; +} + +- (void)userCollectDoctor { + + DoctorReportDoctorInfoModel * doctorModel = [DoctorReportDoctorInfoModel modelWithDictionary:self.model.conDoctorDO] ; + if (self.collectBlock) { + + self.collectBlock(doctorModel); + } + + +} +///将时间戳转为日期时间 + +/// @param timestamp 时间戳 + +/// @param dateFormat 日期样式 YYYY-MM-dd HH:mm:ss + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionView.h new file mode 100644 index 0000000..8d18fb4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionView.h @@ -0,0 +1,21 @@ +// +// DoctorRoomCollectionView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^roomCollectViewBlock)(NSString * deparmentID,NSString * deparmentName); + +@interface DoctorRoomCollectionView : UICollectionView + +@property (nonatomic, strong) NSArray * dataArray; +@property (nonatomic, assign) NSInteger type; //1 是搜索专家页的collectview +@property (nonatomic, copy) roomCollectViewBlock roomBlock; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionView.m new file mode 100644 index 0000000..edd9d6a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionView.m @@ -0,0 +1,105 @@ +// +// DoctorRoomCollectionView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "DoctorRoomCollectionView.h" +#import "DoctorRoomCollectionViewCell.h" + + + + +@interface DoctorRoomCollectionView () + + + + +@end +@implementation DoctorRoomCollectionView + + +- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout +{ + if (self = [super initWithFrame:frame collectionViewLayout:layout]) + { + [self createUI]; + } + return self; +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; + +} + +- (void)setType:(NSInteger)type { + _type = type; + [self reloadData]; +} + + +- (void)createUI +{ + self.delegate = self; + self.dataSource = self; + self.backgroundColor = KWhiteColor; + self.showsHorizontalScrollIndicator = NO; + [self registerClass:[DoctorRoomCollectionViewCell class] forCellWithReuseIdentifier:@"roomCell"]; + + +} + +-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ + return 1; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section +{ + // NSLog(@"guguiiuigiuggiuugi%ld",_productArr.count); + + return self.dataArray.count; +} + + + +-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + DoctorRoomCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"roomCell" forIndexPath:indexPath]; + + cell.backgroundColor = KWhiteColor; + cell.layer.shadowColor = [UIColor colorWithWhite:0 alpha:0.3].CGColor; // 将黑色改为灰色,并降低不透明度 + cell.layer.shadowOffset = CGSizeMake(0, 2); + cell.layer.shadowOpacity = 0.5; // 提高不透明度 + cell.layer.shadowRadius = 3; + cell.layer.masksToBounds = NO; + cell.model = self.dataArray[indexPath.item]; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath +{ + + return CGSizeMake((kScreenWidth - 30)/2,73); + +} + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath +{ + DepartmentModel * model = self.dataArray[indexPath.item]; + + if (self.roomBlock) { + + self.roomBlock(model.depar_id, model.departmentName); + } + +} + +- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { + + return UIEdgeInsetsMake(10, 10, 10, 10); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionViewCell.h new file mode 100644 index 0000000..0380371 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionViewCell.h @@ -0,0 +1,19 @@ +// +// DoctorRoomCollectionViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import +#import "FoundExpertModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorRoomCollectionViewCell : UICollectionViewCell + +@property (nonatomic, strong) DepartmentModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionViewCell.m new file mode 100644 index 0000000..0e51de6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorRoomCollectionViewCell.m @@ -0,0 +1,116 @@ +// +// DoctorRoomCollectionViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "DoctorRoomCollectionViewCell.h" + +@interface DoctorRoomCollectionViewCell () + + +@property (nonatomic, strong) UIImageView * roomImage; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * roomSubLabel; + +@property (nonatomic, strong) UILabel * doctorLabel; + +@end + +@implementation DoctorRoomCollectionViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + + self.roomImage = [[UIImageView alloc] init]; + self.roomImage.image = IMAGE_NAMED(@"placeholdIMG"); + self.roomImage.layer.cornerRadius = 15.0; + self.roomImage.layer.masksToBounds = YES; + [self addSubview:self.roomImage]; + + [self.roomImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(12); + make.top.mas_offset(21); + make.width.height.mas_offset(30); + }]; + + self.roomLabel = [[UILabel alloc] init]; + self.roomLabel.textColor = CFontColor1; + self.roomLabel.font = BOLDSYSTEMFONT(14); + self.roomLabel.text = @"妇产科"; + self.roomLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.roomLabel]; + + [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.roomImage.mas_right).offset(8); + make.right.mas_equalTo(@-10); + make.top.mas_offset(18); + make.height.mas_offset(14); + }]; + + self.roomSubLabel = [[UILabel alloc] init]; + self.roomSubLabel.font = BOLDSYSTEMFONT(14); + self.roomSubLabel.text = @""; + self.roomSubLabel.numberOfLines = 2; + self.roomSubLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.roomSubLabel]; + + [self.roomSubLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@14); + make.right.mas_equalTo(@-10); + make.top.mas_equalTo(self.roomImage.mas_bottom).offset(10); + }]; + + [self.roomSubLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.doctorLabel = [[UILabel alloc] init]; + self.doctorLabel.font = SYSTEMFONT(14); + self.doctorLabel.text = @""; + self.doctorLabel.textColor = UIColorHex(#333333); + self.doctorLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.doctorLabel]; + + [self.doctorLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@0); + make.left.mas_equalTo(self.roomLabel); + make.height.mas_offset(15); + make.bottom.mas_equalTo(@-12); + }]; + + +} + + +- (void)setModel:(DepartmentModel *)model { + _model = model; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.image]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + [self.roomImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"roomPlaceholder")]; +// self.roomSubLabel.text = _model.mark; + self.roomLabel.text =_model.departmentName; + self.doctorLabel.attributedText = [HQCommonUtils firstString:@"有" firstColor:CFontColor2 firstSize:14 secondString:[NSString stringWithFormat:@"%@",_model.doctorNum] secondColor:UIColorHex(#21BEBD) secondSize:14 thirdString:@"名专家" thirdColor:CFontColor2 thirdSize:14]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorSelectTimeCollectionCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorSelectTimeCollectionCell.h new file mode 100644 index 0000000..b66d1b4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorSelectTimeCollectionCell.h @@ -0,0 +1,19 @@ +// +// DoctorSelectTimeCollectionCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/21. +// + +#import +#import "DoctorTimeModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorSelectTimeCollectionCell : UICollectionViewCell + +@property (nonatomic, strong) DoctorTimeModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorSelectTimeCollectionCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorSelectTimeCollectionCell.m new file mode 100644 index 0000000..97ed870 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorSelectTimeCollectionCell.m @@ -0,0 +1,145 @@ +// +// DoctorSelectTimeCollectionCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/21. +// + +#import "DoctorSelectTimeCollectionCell.h" + + +@interface DoctorSelectTimeCollectionCell () + +@property (nonatomic, strong) UILabel * monthLabel; + +@property (nonatomic, strong) UILabel * weakLabel; + +@property (nonatomic, strong) UILabel * statusLabel; + +@end + + + + +@implementation DoctorSelectTimeCollectionCell + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + self.monthLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(11), self.width, 14)]; + self.monthLabel.text = @"05/07"; + self.monthLabel.textColor = CFontColor1; + self.monthLabel.font = SYSTEMFONT(13); + self.monthLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.monthLabel]; + + self.weakLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.monthLabel.bottom + kRealValue(5), self.width, 14)]; + self.weakLabel.text = @"周五上午"; + self.weakLabel.textColor = CFontColor1; + self.weakLabel.font = BOLDSYSTEMFONT(13); + self.weakLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.weakLabel]; + + self.statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,self.weakLabel.bottom + kRealValue(11), self.width, 14)]; + self.statusLabel.text = @"可预约"; + self.statusLabel.textColor = CFontColor1; + self.statusLabel.font = MEDIUMFONT(11); + self.statusLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.statusLabel]; + + +} + +- (void)setModel:(DoctorTimeModel *)model { + + _model = model; + + + if ([model.schedulingNum integerValue] - [model.readySchedulingNum integerValue] > 0) { + NSInteger lastNumber = [model.schedulingNum integerValue] - [model.readySchedulingNum integerValue]; + self.statusLabel.text = [NSString stringWithFormat:@"剩余%ld",lastNumber] ; + self.backgroundColor = KWhiteColor; + self.layer.cornerRadius = 10.0f; + self.layer.masksToBounds = YES; + self.layer.borderColor = UIColorHex(#999999).CGColor; + self.layer.borderWidth = 1.0f; + self.backgroundColor = KWhiteColor; + + }else + { + self.statusLabel.text = @"不可约"; + self.backgroundColor = UIColorHex(#DDDDDD); + self.layer.cornerRadius = 10.0f; + self.layer.masksToBounds = YES; + self.layer.borderColor = KWhiteColor.CGColor; + } + + + if (_model.isAppment == true) { + + if ([model.schedulingNum integerValue] - [model.readySchedulingNum integerValue] > 0) { + self.backgroundColor = UIColorHex(#21BEBD); + self.monthLabel.textColor = KWhiteColor; + self.statusLabel.textColor = KWhiteColor; + self.weakLabel.textColor = KWhiteColor; + self.layer.borderColor = KClearColor.CGColor; + + }else + { + self.backgroundColor = UIColorHex(#DDDDDD); + self.monthLabel.textColor = UIColorHex(#333333); + self.statusLabel.textColor = UIColorHex(#666666); + self.weakLabel.textColor = UIColorHex(#333333); + self.layer.cornerRadius = 10.0f; + self.layer.masksToBounds = YES; + self.layer.borderColor = KWhiteColor.CGColor; + } + + + + + } + if (_model.isAppment == false) { + + if ([model.schedulingNum integerValue] - [model.readySchedulingNum integerValue] > 0) { + + self.backgroundColor = KWhiteColor; + self.monthLabel.textColor = UIColorHex(#333333); + self.statusLabel.textColor = UIColorHex(#666666); + self.weakLabel.textColor = UIColorHex(#333333); + + }else + { + self.backgroundColor = UIColorHex(#DDDDDD); + self.layer.cornerRadius = 10.0f; + self.layer.masksToBounds = YES; + self.monthLabel.textColor = UIColorHex(#333333); + self.statusLabel.textColor = UIColorHex(#666666); + self.weakLabel.textColor = UIColorHex(#333333); + self.layer.borderColor = KWhiteColor.CGColor; + } + + } + NSArray * array = @[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周天"]; + NSString * aftenString = [_model.type integerValue] == 0 ? @"上午":@"下午"; + + if (!ValidStr(_model.week)) { + NSInteger weekInt = [_model.week integerValue] - 1; + self.weakLabel.text = [NSString stringWithFormat:@"%@%@",array[weekInt],aftenString]; + + } + + self.monthLabel.text = [NSString stringWithFormat:@"%@",_model.schedulingDate]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorStatusView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorStatusView.h new file mode 100644 index 0000000..8a5a723 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorStatusView.h @@ -0,0 +1,24 @@ +// +// DoctorStatusView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorStatusView : UIView + +@property (nonatomic, assign) BOOL isSelected; + +@property (nonatomic, assign) BOOL isLast; + +@property (nonatomic, assign) NSInteger lastType; + +@property (nonatomic, copy) NSString * statusString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorStatusView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorStatusView.m new file mode 100644 index 0000000..a662cef --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorStatusView.m @@ -0,0 +1,120 @@ +// +// DoctorStatusView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import "DoctorStatusView.h" + + +@interface DoctorStatusView () + +@property (nonatomic, strong) UIButton * statusBtn; + +@property (nonatomic, strong) UILabel * statusLabel; + +@property (nonatomic, strong) UILabel * numberLabel; + + +@property (nonatomic, strong) UIImageView * statusView; + +@property (nonatomic, strong) UIView * lineView; + +@end + + +@implementation DoctorStatusView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.statusBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(5), 0, kRealValue(38), kRealValue(38))]; + [self.statusBtn setImage:[UIImage imageNamed:@"statusTop_nomal"] forState:UIControlStateNormal]; + [self.statusBtn setImage:[UIImage imageNamed:@"statusTop_selected"] forState:UIControlStateSelected]; + [self addSubview:self.statusBtn]; + + + self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(5), 0, kRealValue(38), kRealValue(38))]; + self.numberLabel.textAlignment = NSTextAlignmentCenter; + self.numberLabel.font = SYSTEMFONT(13); + self.numberLabel.text = @"1"; + self.numberLabel.textColor = UIColorHex(#21BEBD); + [self addSubview:self.numberLabel]; + + + self.statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.statusBtn.bottom + 8, 60, 13)]; + self.statusLabel.textAlignment = NSTextAlignmentLeft; + self.statusLabel.font = SYSTEMFONT(13); + self.statusLabel.text = @"在线咨询"; + self.statusLabel.textColor = KWhiteColor; + [self addSubview:self.statusLabel]; + + self.statusView = [[UIImageView alloc] initWithFrame:CGRectMake(self.statusBtn.right + kRealValue(8) , kRealValue(13), 20, 7)]; + self.statusView.image = [UIImage imageNamed:@"line_selected"]; + self.statusView.hidden = true; + [self addSubview:self.statusView]; + + self.lineView = [[UIImageView alloc] initWithFrame:CGRectMake(self.statusBtn.right , kRealValue(19), kRealValue(24), 2)]; + self.lineView.backgroundColor = KWhiteColor; + self.lineView.hidden = true; + [self addSubview:self.lineView]; + +} + +- (void)setIsSelected:(BOOL)isSelected { + + _isSelected = isSelected; + + if (_isSelected) { + self.statusBtn.selected = true; + self.statusView.hidden = false; + self.lineView.hidden = true; + self.statusLabel.textColor = KWhiteColor; + } + else { + self.statusBtn.selected = false; + self.statusView.hidden = true; + self.lineView.hidden = false; + self.statusLabel.textColor = UIColorHex(#FBFBFB); + } +} + + +- (void)setLastType:(NSInteger)lastType { + + _lastType = lastType; + + if (_lastType == 4) { + self.lineView.hidden = YES; + self.statusView.hidden = YES; + } + self.numberLabel.text = [NSString stringWithFormat:@"%ld",_lastType + 1]; + +} + +- (void)setStatusString:(NSString *)statusString { + + _statusString = statusString; + + self.statusLabel.text = _statusString; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorTimeSelectedCollectView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorTimeSelectedCollectView.h new file mode 100644 index 0000000..cb15f78 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorTimeSelectedCollectView.h @@ -0,0 +1,27 @@ +// +// DoctorTimeSelectedCollectView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol DoctorTimeSelectedProtocol + +- (void)doctorTimeSureAction:(NSString *)timeID; + +@end + +@interface DoctorTimeSelectedCollectView : UICollectionView + + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, weak)id timeDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorTimeSelectedCollectView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorTimeSelectedCollectView.m new file mode 100644 index 0000000..218674d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/DoctorTimeSelectedCollectView.m @@ -0,0 +1,128 @@ +// +// DoctorTimeSelectedCollectView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/21. +// + +#import "DoctorTimeSelectedCollectView.h" +#import "DoctorSelectTimeCollectionCell.h" + +@interface DoctorTimeSelectedCollectView () + + + + +@end + + +@implementation DoctorTimeSelectedCollectView + + +- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout +{ + if (self = [super initWithFrame:frame collectionViewLayout:layout]) + { + [self createUI]; + } + return self; +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; + +} + + +- (void)createUI +{ + self.delegate = self; + self.dataSource = self; + self.backgroundColor = KWhiteColor; + self.showsHorizontalScrollIndicator = NO; + [self registerClass:[DoctorSelectTimeCollectionCell class] forCellWithReuseIdentifier:@"timeCell"]; + [self registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"footer"]; + + +} + +-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ + return 1; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section +{ + // NSLog(@"guguiiuigiuggiuugi%ld",_productArr.count); + return self.dataArray.count; +} + + + +-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + DoctorSelectTimeCollectionCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"timeCell" forIndexPath:indexPath]; + + cell.model = self.dataArray[indexPath.item]; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath +{ + + return CGSizeMake((kScreenWidth - 48 )/4,75); + +} + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath +{ + + DoctorTimeModel * model = self.dataArray[indexPath.item]; + + if ([model.schedulingNum integerValue] - [model.readySchedulingNum integerValue] <= 0) { + + return; + + } + else + { + + for (DoctorTimeModel * subModel in self.dataArray) { + + if (subModel == model) { + subModel.isAppment = YES; + }else + { + subModel.isAppment = false; + } + } + } + + if ([self.timeDelegate respondsToSelector:@selector(doctorTimeSureAction:)]) { + + [self.timeDelegate doctorTimeSureAction:model.time_id ]; + } + + [self reloadData]; + +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { + return CGSizeMake(kScreenWidth, 40); +} + +- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ + + UICollectionReusableView * footerer = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"footer"forIndexPath:indexPath]; + + UILabel * heardLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, kRealValue(15), kScreenWidth - 30, 20)]; + heardLabel.text = @"预约须知(预约即代表统一以下规则):1、预约不收取任何额外费用; 2、停诊将短信通知,请保持手机畅通。"; + heardLabel.numberOfLines = 0; + heardLabel.textColor = UIColorHex(#999999); + CGFloat h = [HQCommonUtils getSpaceLabelHeight:heardLabel withStr:heardLabel.text withFont:[UIFont systemFontOfSize:12] withWidth:kScreenWidth - kRealValue(30) withLineSpacing:5]; + heardLabel.height = h; + heardLabel.font = SYSTEMFONT(12); + [footerer addSubview:heardLabel]; + footerer.backgroundColor = KWhiteColor; + return footerer; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/EvaluationListTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/EvaluationListTableView.h new file mode 100644 index 0000000..0776e66 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/EvaluationListTableView.h @@ -0,0 +1,20 @@ +// +// EvaluationListTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface EvaluationListTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, assign) NSInteger type; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/EvaluationListTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/EvaluationListTableView.m new file mode 100644 index 0000000..a0c73f8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/EvaluationListTableView.m @@ -0,0 +1,138 @@ +// +// EvaluationListTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/14. +// + +#import "EvaluationListTableView.h" +#import "HospitalEvaluationTableViewCell.h" +#import "DoctorEvaluationTableViewCell.h" + +@interface EvaluationListTableView () + + +@end + +@implementation EvaluationListTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + +- (void)setType:(NSInteger)type { + _type = type; + [self reloadData]; +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + if (self.type == 2) { + + DoctorEvaluationTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"DOCTORCELL"]; + + if (!cell) { + + cell = [[DoctorEvaluationTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DOCTORCELL"]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.model = self.dataArray[indexPath.row]; + return cell; + + }else + { + HospitalEvaluationTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"EVALUATIONCELL"]; + + if (!cell) { + + cell = [[HospitalEvaluationTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"EVALUATIONCELL"]; + } + + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.model = self.dataArray[indexPath.row]; + return cell; + } + return UITableViewCell.new; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + +} + +-(CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0)]; + + hearView.backgroundColor = KClearColor; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollection.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollection.h new file mode 100644 index 0000000..d1689e4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollection.h @@ -0,0 +1,22 @@ +// +// FoundExpertSubCollection.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import +#import "FoundExpertModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^sicksOnClickBlock)(SicksModel * model); + +@interface FoundExpertSubCollection : UICollectionView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) sicksOnClickBlock sickBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollection.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollection.m new file mode 100644 index 0000000..76def83 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollection.m @@ -0,0 +1,113 @@ +// +// FoundExpertSubCollection.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundExpertSubCollection.h" +#import "FoundExpertSubCollectionViewCell.h" + + +@interface FoundExpertSubCollection () + + + + +@end + +@implementation FoundExpertSubCollection + + +- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout +{ + if (self = [super initWithFrame:frame collectionViewLayout:layout]) + { + [self createUI]; + } + return self; +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; + +} + + +- (void)createUI +{ + self.delegate = self; + self.dataSource = self; + self.backgroundColor = KWhiteColor; + [self registerClass:[FoundExpertSubCollectionViewCell class] forCellWithReuseIdentifier:@"foundCell"]; + [self registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"]; + + +} + +-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ + + return 1; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section +{ + // NSLog(@"guguiiuigiuggiuugi%ld",_productArr.count); + return self.dataArray.count; +} + + + +-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + + SicksModel * model = self.dataArray[indexPath.item]; + + FoundExpertSubCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"foundCell" forIndexPath:indexPath]; + + cell.backgroundColor = KWhiteColor; + + cell.layer.cornerRadius = 13.0f; + cell.layer.masksToBounds = YES; + cell.layer.borderColor = UIColorHex(#BBBBBB).CGColor; + cell.layer.borderWidth = 1.0f; + cell.diseaLabel.text = model.sicksName; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath +{ + + return CGSizeMake((kScreenWidth - 30)/2,26); + +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { + return CGSizeMake(kScreenWidth, 30); +} + + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath +{ + SicksModel * model = self.dataArray[indexPath.item]; + if (self.sickBlock) { + self.sickBlock(model); + } + +} + +- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ +// NSArray * array = @[@"常见病",@"皮肤性病",@"慢性病",@"职业病"]; +// + UICollectionReusableView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"forIndexPath:indexPath]; + + UILabel * heardLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10), kScreenWidth, 20)]; +// heardLabel.text = array[indexPath.section]; + heardLabel.textColor = CFontColor1; + heardLabel.font = SYSTEMFONT(15); + [header addSubview:heardLabel]; + header.backgroundColor = KWhiteColor; + return header; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollectionViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollectionViewCell.h new file mode 100644 index 0000000..d0bc1bf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollectionViewCell.h @@ -0,0 +1,18 @@ +// +// FoundExpertSubCollectionViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface FoundExpertSubCollectionViewCell : UICollectionViewCell + +@property (nonatomic, strong) UILabel * diseaLabel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollectionViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollectionViewCell.m new file mode 100644 index 0000000..c00f5a2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundExpertSubCollectionViewCell.m @@ -0,0 +1,40 @@ +// +// FoundExpertSubCollectionViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundExpertSubCollectionViewCell.h" + + + +@implementation FoundExpertSubCollectionViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; +} + +- (void)createUI { + + self.diseaLabel = [[UILabel alloc] init]; + self.diseaLabel.textColor = CFontColor1; + self.diseaLabel.font = MEDIUMFONT(13); + self.diseaLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.diseaLabel]; + + [self.diseaLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.right.mas_offset(0); + make.bottom.mas_offset(0); + }]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundLeftTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundLeftTableView.h new file mode 100644 index 0000000..290df57 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundLeftTableView.h @@ -0,0 +1,26 @@ +// +// FoundLeftTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol foundLeftCellDelegate + +- (void)leftCellAction:(NSInteger)index; + +@end + +@interface FoundLeftTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, weak)id leftDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundLeftTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundLeftTableView.m new file mode 100644 index 0000000..042e756 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundLeftTableView.m @@ -0,0 +1,147 @@ +// +// FoundLeftTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundLeftTableView.h" +#import "FoundRoomsTableViewCell.h" + + + +@interface FoundLeftTableView () + + +@end + +@implementation FoundLeftTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.backgroundColor = KWhiteColor; +} + + + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} +// +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + + return 40; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + + FoundRoomsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[FoundRoomsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + + cell.model = self.dataArray[indexPath.row]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + SearchRoomModel * model = self.dataArray[indexPath.row]; + + for (SearchRoomModel * subModel in self.dataArray) { + if (subModel == model) { + subModel.isSelected = true; + } + else + { + subModel.isSelected = false; + } + } + + if ([self.leftDelegate respondsToSelector:@selector(leftCellAction:)]) { + + [self.leftDelegate leftCellAction:indexPath.row]; + + } + [self reloadData]; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0)]; + + hearView.backgroundColor = KRedColor; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRightTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRightTableView.h new file mode 100644 index 0000000..3268626 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRightTableView.h @@ -0,0 +1,24 @@ +// +// FoundRightTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^rightTableActionBlock)(NSString * roomID , NSString *roomName ); + +@interface FoundRightTableView : UITableView + +@property (nonatomic, strong) NSArray * rightDataArray; + +@property (nonatomic, copy) rightTableActionBlock rightBlock; + +@property (nonatomic, assign) NSInteger searchType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRightTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRightTableView.m new file mode 100644 index 0000000..b4df4bb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRightTableView.m @@ -0,0 +1,195 @@ +// +// FoundRightTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundRightTableView.h" +#import "FoundRoomsTableViewCell.h" + + + +@interface FoundRightTableView () + + +@end + +@implementation FoundRightTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + self.showsVerticalScrollIndicator = NO; + self.backgroundColor = KWhiteColor; +} + + + + +- (void)setRightDataArray:(NSArray *)rightDataArray { + + _rightDataArray = rightDataArray; + + [self reloadData]; + +} + +- (void)setSearchType:(NSInteger)searchType { + + _searchType = searchType; + + [self reloadData]; +} + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.rightDataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} +// +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + + return 45; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + + + + FoundRoomsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[FoundRoomsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + + if (self.searchType == 2) { + cell.sickModel = self.rightDataArray[indexPath.row] ; + + } + if (self.searchType == 1) { + cell.rightModel = self.rightDataArray[indexPath.row] ; + + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (self.searchType == 1) { + SearchRoomModel * model = self.rightDataArray[indexPath.row]; + + for (SearchRoomModel * subModel in self.rightDataArray) { + if (subModel == model) { + subModel.isSelected = true; + } + else + { + subModel.isSelected = false; + } + } + + if (self.rightBlock) { + if ([model.departmentName containsString:@"全部医生"]) { + self.rightBlock(model.room_Id,@"全部科室"); + }else + { + self.rightBlock(model.room_Id,model.departmentName); + + } + + } + } + + if (self.searchType == 2) { + SearchSicksModel * sickmodel = self.rightDataArray[indexPath.row]; + + for (SearchSicksModel * subModel in self.rightDataArray) { + if (subModel == sickmodel) { + subModel.isSelected = true; + } + else + { + subModel.isSelected = false; + } + } + + if (self.rightBlock) { + + if ([sickmodel.sicksName containsString:@"全部医生"]) { + self.rightBlock(sickmodel.sicks_id,sickmodel.CustomdepartmentName); + }else + { + self.rightBlock(sickmodel.sicks_id,sickmodel.sicksName); + + } + } + } + [self reloadData]; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0)]; + + hearView.backgroundColor = KRedColor; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRoomsTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRoomsTableViewCell.h new file mode 100644 index 0000000..2ba6ead --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRoomsTableViewCell.h @@ -0,0 +1,21 @@ +// +// FoundRoomsTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import +#import "SearchRoomModel.h" +#import "SearchSicksModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface FoundRoomsTableViewCell : UITableViewCell + +@property (nonatomic, strong) SearchRoomModel * model; +@property (nonatomic, strong) SearchRoomModel * rightModel; +@property (nonatomic, strong) SearchSicksModel * sickModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRoomsTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRoomsTableViewCell.m new file mode 100644 index 0000000..f576032 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/FoundRoomsTableViewCell.m @@ -0,0 +1,118 @@ +// +// FoundRoomsTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/19. +// + +#import "FoundRoomsTableViewCell.h" + +@interface FoundRoomsTableViewCell () + +@property (nonatomic, strong) UIView * backView; + + +@property (nonatomic, strong) UILabel * roomLabel; + +@end + +@implementation FoundRoomsTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + + [self.contentView addSubview:self.backView]; + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.left.right.mas_offset(0); + }]; + + self.roomLabel = [[UILabel alloc] init]; + + self.roomLabel.font = MEDIUMFONT(12); + + self.roomLabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.roomLabel]; + + [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(kRealValue(30)); + make.right.bottom.top.mas_offset(0); + }]; + +} + +- (void)setModel:(SearchRoomModel *)model { + + _model = model; + + self.roomLabel.text = [NSString stringWithFormat:@"%@",_model.departmentName] ; + + self.roomLabel.textColor = UIColorHex(#666666); + + + if (_model.isSelected) { + self.backView.backgroundColor = KWhiteColor; + }else + { + self.backView.backgroundColor = UIColorHex(#F3F3F3); + } + +} + +- (void)setRightModel:(SearchRoomModel *)rightModel { + + _rightModel = rightModel; + + + + self.roomLabel.text = [NSString stringWithFormat:@"%@(%@)",_rightModel.departmentName,_rightModel.doctorNum] ; + + if (_rightModel.isSelected) { + + self.roomLabel.textColor = UIColorHex(#21BEBD); + }else + { + self.roomLabel.textColor = UIColorHex(#666666); + } + +} + +- (void)setSickModel:(SearchSicksModel *)sickModel { + + _sickModel = sickModel; + + self.roomLabel.text = [NSString stringWithFormat:@"%@(%@)",_sickModel.sicksName,_sickModel.doctorNum]; + + if (_sickModel.isSelected) { + + self.roomLabel.textColor = UIColorHex(#21BEBD); + }else + { + self.roomLabel.textColor = UIColorHex(#666666); + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyDoctorTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyDoctorTableViewCell.h new file mode 100644 index 0000000..de69cf3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyDoctorTableViewCell.h @@ -0,0 +1,18 @@ +// +// HealthyDoctorTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "DoctorRecommendModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface HealthyDoctorTableViewCell : UITableViewCell + +@property (nonatomic, strong) QuestionDoctorListModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyDoctorTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyDoctorTableViewCell.m new file mode 100644 index 0000000..38b54a0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyDoctorTableViewCell.m @@ -0,0 +1,214 @@ +// +// HealthyDoctorTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "HealthyDoctorTableViewCell.h" + +@interface HealthyDoctorTableViewCell() + +@property (nonatomic, strong) UIImageView * doctorImg; + +@property (nonatomic, strong) UILabel * namelabel; + +@property (nonatomic, strong) UILabel * introduceLabel; + +@property (nonatomic, strong) UIButton * statusBtn; + +@property (nonatomic, strong) UILabel * lvlabel; + +@property (nonatomic, strong) UILabel * hospationLabel; + +@end + + +@implementation HealthyDoctorTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.doctorImg = [[UIImageView alloc] init]; + self.doctorImg.layer.cornerRadius = 25; + self.doctorImg.layer.masksToBounds = true; + [self.contentView addSubview:self.doctorImg]; + + [self.doctorImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(15); + make.width.height.mas_offset(50); + }]; + + + self.namelabel = [[UILabel alloc] init]; + self.namelabel.textColor = CFontColor1; + self.namelabel.font = BOLDSYSTEMFONT(14); + self.namelabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.namelabel]; + + [self.namelabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(8); + make.top.mas_offset(15); + make.height.mas_offset(15); + }]; + [self.namelabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.statusBtn = [[UIButton alloc] init]; +// [self.statusBtn setTitle:@"历史咨询" forState:UIControlStateNormal]; +// [self.statusBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; +// self.statusBtn.layer.cornerRadius = 4.0f; +// self.statusBtn.layer.masksToBounds = YES; +// self.statusBtn.layer.borderWidth = 1.0f; +// self.statusBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; +// self.statusBtn.titleLabel.font = MEDIUMFONT(10); + [self.contentView addSubview:self.statusBtn ]; + [self.statusBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(15); + make.height.mas_offset(17); + make.width.mas_offset(60); + }]; + + + self.lvlabel = [[UILabel alloc] init]; + self.lvlabel.text = @""; + self.lvlabel.textColor = KWhiteColor; + self.lvlabel.backgroundColor = UIColorHex(#21BEBD); + self.lvlabel.layer.cornerRadius = 3.0f; + self.lvlabel.layer.masksToBounds = YES; + self.lvlabel.layer.borderWidth = 1.0f; + self.lvlabel.layer.borderColor = UIColorHex(#21BEBD).CGColor; + self.lvlabel.font = MEDIUMFONT(12); + self.lvlabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.lvlabel]; + + [self.lvlabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel.mas_left); + make.top.mas_equalTo(self.namelabel.mas_bottom).offset(10); + make.width.mas_offset(55); + make.height.mas_offset(15); + }]; + + self.hospationLabel = [[UILabel alloc] init]; + self.hospationLabel.text = @""; + self.hospationLabel.textColor = UIColorHex(#666666); + self.hospationLabel.font = MEDIUMFONT(13); + self.hospationLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.hospationLabel]; + + [self.hospationLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvlabel.mas_right).offset(10); + make.top.mas_equalTo(self.lvlabel.mas_top).offset(2); + make.height.mas_offset(13); + }]; + [self.hospationLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + //新增 + + + + self.introduceLabel = [[UILabel alloc] init]; + self.introduceLabel.text = @""; + self.introduceLabel.textColor = UIColorHex(#666666); + self.introduceLabel.font = MEDIUMFONT(13); + self.introduceLabel.textAlignment = NSTextAlignmentLeft; + self.introduceLabel.numberOfLines = 3 ; + self.introduceLabel.lineBreakMode = NSLineBreakByTruncatingTail; // 超过三行时截断尾部显示省略号 + [self.contentView addSubview:self.introduceLabel]; + + [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(8); + make.right.mas_offset(-17); + make.top.mas_equalTo(self.lvlabel.mas_bottom).offset(12); + }]; + [self.introduceLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + UIView * linv = [[UIView alloc] init]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self.contentView addSubview:linv]; + + [linv mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.right.mas_offset(-15); + make.height.mas_equalTo(@1); + make.top.mas_equalTo(self.introduceLabel.mas_bottom).offset(15); + make.bottom.mas_equalTo(2); + }]; +} + +- (void)setModel:(QuestionDoctorListModel *)model { + _model = model; + + if(ValidStr(_model.hospitalLevel) ) { + self.lvlabel.hidden = YES; + + }else + { + self.lvlabel.hidden = false; + self.lvlabel.text = _model.hospitalLevel; + } + + if (ValidStr(_model.departmentName)) { + + _model.departmentName = @""; + + } + + self.namelabel.attributedText = [HQCommonUtils firstString:[NSString stringWithFormat:@"%@ ",_model.doctorName] firstColor:UIColorHex(#333333) firstSize:14 secondString:[NSString stringWithFormat:@" %@",_model.doctorTitle] secondColor:UIColorHex(#333333) secondSize:13 thirdString:[NSString stringWithFormat:@" %@",_model.departmentName] thirdColor:UIColorHex(#333333) thirdSize:13]; + + self.hospationLabel.text = [NSString stringWithFormat:@" %@ ",_model.resourceName]; + + self.introduceLabel.text = [NSString stringWithFormat:@"擅长:%@",_model.goodAt]; + + UIFont *font = self.introduceLabel.font; + CGFloat lineHeight = font.lineHeight; + CGFloat maxHeight = lineHeight * 3; + + // 判断视图是否已经加载 + if ([self isViewLoaded:self.introduceLabel]) { + [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.lessThanOrEqualTo(@(maxHeight)); + }]; + } else { + NSLog(@"customView 还未加载到父视图中"); + } + + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; +} + +- (BOOL)isViewLoaded:(UIView *)view { + // 通过检查视图的 superview 属性来判断是否加载 + return view.superview != nil; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionHeardView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionHeardView.h new file mode 100644 index 0000000..ad7f6c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionHeardView.h @@ -0,0 +1,32 @@ +// +// HealthyQuestionHeardView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol questionToolsProtocl + +- (void)foundQuestionAction; + +- (void)smallQuestionAction; + +- (void)myQuestionAction; + + +@end + +@interface HealthyQuestionHeardView : UIView + +@property (nonatomic, assign) CGFloat h; + +@property (nonatomic, weak)id headDelegate; +@property (nonatomic, copy) NSString * haveSessioning; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionHeardView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionHeardView.m new file mode 100644 index 0000000..c9640ab --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionHeardView.m @@ -0,0 +1,171 @@ +// +// HealthyQuestionHeardView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "HealthyQuestionHeardView.h" +#import "SDCycleScrollView.h" +#import "HealthyToolsView.h" + +@interface HealthyQuestionHeardView () + +@property (nonatomic, strong) SDCycleScrollView * adTitleView; +@property (nonatomic, strong) UIView * redRadioView; +@end + +@implementation HealthyQuestionHeardView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kStatusBarHeight + kRealValue(18))]; + topView.backgroundColor = UIColorHex(#14BEBE); + [self addSubview:topView]; + + UILabel * detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 ,kStatusBarHeight , kScreenWidth, kRealValue(18))]; + detailLabel.text = @"健康咨询"; + detailLabel.font = MEDIUMFONT(18); + detailLabel.textColor = KWhiteColor; + detailLabel.textAlignment = NSTextAlignmentCenter; + [topView addSubview:detailLabel]; + + UIImageView * backImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, topView.bottom - 1, kScreenWidth, kRealValue(288))]; + backImage.image = [UIImage imageNamed:@"topBackImg"]; + [self addSubview:backImage]; + +// +// UILabel * questionLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(39), kRealValue(100), MAXFLOAT, 17)]; +// +// questionLabel.text = @"油田健康咨询"; +// +// questionLabel.font = BOLDSYSTEMFONT(17); +// +// questionLabel.textColor = KWhiteColor; +// +// questionLabel.textAlignment = NSTextAlignmentLeft; +//// +// CGSize labeSize = [questionLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading attributes: @{NSFontAttributeName:BOLDSYSTEMFONT(17)} context:nil].size; +// +// +// questionLabel.frame = CGRectMake(kRealValue(39), kRealValue(90), labeSize.width, 17); +// +// [backImage addSubview:questionLabel]; +// +// + + +// +// UIImageView * titleImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(17) - kRealValue(201), backImage.bottom - 115, kRealValue(201), 115)]; +// titleImage.image = [UIImage imageNamed:@"questionTitleImg"]; +// [self addSubview:titleImage]; + +// UIView * adBackView = [[UIView alloc] initWithFrame:CGRectMake(0, backImage.bottom, kScreenWidth, 35)]; +// adBackView.backgroundColor = RGBA(84, 236, 203, 0.1); +// [self addSubview:adBackView]; +// +// self.adTitleView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(kRealValue(17.5), 0, kScreenWidth - kRealValue(27), 35) delegate:self placeholderImage:nil]; +// self.adTitleView .scrollDirection = UICollectionViewScrollDirectionVertical; +// self.adTitleView .onlyDisplayText = YES; +// self.adTitleView.titleLabelBackgroundColor = KClearColor; +// self.adTitleView.titleLabelTextFont = MEDIUMFONT(13); +// self.adTitleView.titleLabelTextColor = RGBA(33, 190, 189, 1); +// NSMutableArray *titlesArray = [NSMutableArray new]; +// [titlesArray addObject:@"体检通知📢:您预约了明天的体检别忘了哟!"]; +// self.adTitleView .titlesGroup = [titlesArray copy]; +// [self.adTitleView disableScrollGesture]; +// [adBackView addSubview:self.adTitleView ]; + + // + NSArray * toolsArray = @[@"allRoomDoctor",@"myQuestionHome"]; +// NSArray * colorArray = @[UIColorHex(#E7FFF6),UIColorHex(#E7FBFF),UIColorHex(#EAEFFF)]; +// NSArray * detailArray = @[@"全科医生咨询",@"专科医生咨询",@"您进行中的咨询"]; + + CGFloat toolsW = ( kScreenWidth - kRealValue(40) ) / 2; + + for (int i = 0; i < toolsArray.count; i ++) { + + HealthyToolsView * healthyView = [[HealthyToolsView alloc] initWithFrame:CGRectMake(kRealValue(15) + (toolsW + kRealValue(8)) * i , backImage.bottom - kRealValue(13) - kRealValue(126), toolsW, kRealValue(126))]; + healthyView.layer.cornerRadius = 10.0f; + healthyView.layer.masksToBounds = true; + healthyView.imageString = toolsArray[i]; + [self addSubview:healthyView]; + + + UIButton * btn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15) + (toolsW + kRealValue(8)) * i , backImage.bottom - kRealValue(13) - kRealValue(126), toolsW, kRealValue(126))]; + [btn addTarget:self action:@selector(toolsAction:) forControlEvents:UIControlEventTouchUpInside]; + btn.tag = 100 + i ; + [self addSubview:btn]; + + } + + self.h = backImage.bottom; + + self.height = self.h; +} + +- (void)toolsAction:(UIButton *)btn { + + switch (btn.tag) { + case 100: + { + if ([self.headDelegate respondsToSelector:@selector(smallQuestionAction)]) { + + [self.headDelegate smallQuestionAction]; + } + } + break; + case 101: + { + //新增全科咨询记录 + if ([self.headDelegate respondsToSelector:@selector(foundQuestionAction)]) { + + [self.headDelegate foundQuestionAction]; + } + } + break; + case 102: + { + if ([self.headDelegate respondsToSelector:@selector(myQuestionAction)]) { + + [self.headDelegate myQuestionAction]; + } + } + break; + + default: + break; + } +} + +- (void)setHaveSessioning:(NSString *)haveSessioning { + _haveSessioning = haveSessioning; + if ([_haveSessioning integerValue] != 0) { + self.redRadioView.hidden = false; + }else + { + self.redRadioView.hidden = YES; + + } + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionTable.h new file mode 100644 index 0000000..9bed3d1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionTable.h @@ -0,0 +1,29 @@ +// +// HealthyQuestionTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "HealthyQuestionHeardView.h" +#import "HomeQusetionRecordsModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^doctorBlock)(HomeQusetionRecordsModel * model); +typedef void(^lookMoreDoctorBlock)(); + +@interface HealthyQuestionTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) doctorBlock tableBlock; +@property (nonatomic, copy) lookMoreDoctorBlock lookMoreBlock; + +@property (nonatomic, weak)id headDelegate; + +@property (nonatomic, copy) NSString * haveSessioning; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionTable.m new file mode 100644 index 0000000..ec4c31d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyQuestionTable.m @@ -0,0 +1,180 @@ +// +// HealthyQuestionTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "HealthyQuestionTable.h" +#import "HealthyDoctorTableViewCell.h" +#import "HealthyQuestionHeardView.h" +#import "QustionHomeRecordsCell.h" + +@interface HealthyQuestionTable () + +@property (nonatomic, strong) HealthyQuestionHeardView * heardView; + +@end + +@implementation HealthyQuestionTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableHeaderView = [self createHeardView]; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + +- (void)setHeadDelegate:(id)headDelegate { + + _headDelegate = headDelegate; + + self.heardView.headDelegate = _headDelegate; + +} + +- (UIView *)createHeardView { + + HealthyQuestionHeardView * heardView = [[HealthyQuestionHeardView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(332))]; + + self.heardView = heardView; + + heardView.headDelegate = self.headDelegate; + + heardView.height = heardView.h; + + return heardView; + + +} + +- (void)setHaveSessioning:(NSString *)haveSessioning { + _haveSessioning = haveSessioning; + self.heardView.haveSessioning = _haveSessioning; + +} +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + + QustionHomeRecordsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[QustionHomeRecordsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.model = self.dataArray[indexPath.row]; + cell.backgroundColor = CViewBgColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + HomeQusetionRecordsModel * model = self.dataArray[indexPath.row]; + + if (self.tableBlock) { + + self.tableBlock(model); + } + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return kRealValue(48); +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(45))]; + sectionHeardView.backgroundColor = CViewBgColor; + + UILabel * todayLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(16), 190, 16)]; + + todayLabel.text = @"专家咨询记录"; + + todayLabel.textAlignment = NSTextAlignmentLeft; + + todayLabel.textColor = CFontColor1; + + todayLabel.font = BOLDSYSTEMFONT(16); + + [sectionHeardView addSubview:todayLabel]; + + YYLabel * morelabel = [[YYLabel alloc] initWithFrame:CGRectMake(kScreenWidth - 165 , kRealValue(17), 150, 15)]; + + morelabel.text = @"更多 >"; + morelabel.textAlignment = NSTextAlignmentRight; + morelabel.textColor = UIColorHex(#999999); + morelabel.font = SYSTEMFONT(14); + MJWeakSelf + [morelabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + if (self.lookMoreBlock) { + self.lookMoreBlock(); + } + }]; + [sectionHeardView addSubview:morelabel]; + + return sectionHeardView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyToolsView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyToolsView.h new file mode 100644 index 0000000..a46268d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyToolsView.h @@ -0,0 +1,24 @@ +// +// HealthyToolsView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HealthyToolsView : UIView + +@property (nonatomic, copy) NSString * nameString; + +@property (nonatomic, copy) NSString * detailString; + +@property (nonatomic, copy) NSString * imageString; + +@property (nonatomic, strong) UIColor * backColor; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyToolsView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyToolsView.m new file mode 100644 index 0000000..7bfa93e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HealthyToolsView.m @@ -0,0 +1,86 @@ +// +// HealthyToolsView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "HealthyToolsView.h" + +@interface HealthyToolsView () + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * detailLabel; + +@property (nonatomic, strong) UIImageView * toolsImage; + +@end + + + +@implementation HealthyToolsView + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; +} + +- (void)createUI { + +// self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(8), kRealValue(17), 90, 13)]; +// self.nameLabel.text = @""; +// self.nameLabel.textColor = CFontColor1; +// self.nameLabel.font = BOLDSYSTEMFONT(14); +// self.nameLabel.textAlignment = NSTextAlignmentLeft; +// [self addSubview:self.nameLabel]; +// +// self.detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(8), self.nameLabel.bottom + kRealValue(9), self.width - kRealValue(16), 13)]; +// self.detailLabel.text = @""; +// self.detailLabel.textColor = UIColorHex(#666666); +// self.detailLabel.font = MEDIUMFONT(13); +// self.detailLabel.textAlignment = NSTextAlignmentLeft; +// [self addSubview:self.detailLabel]; + + self.toolsImage = [[UIImageView alloc] initWithFrame:CGRectMake(0 , 0, self.width, self.height)]; + [self addSubview:self.toolsImage]; + +} + +- (void)setBackColor:(UIColor *)backColor { + + _backColor = backColor; + + self.backgroundColor = _backColor; +} + +- (void)setNameString:(NSString *)nameString { + + _nameString = nameString; + + self.nameLabel.text = _nameString; + +} + +- (void)setDetailString:(NSString *)detailString { + + _detailString = detailString; + + self.detailLabel.text = _detailString; +} + +- (void)setImageString:(NSString *)imageString { + + _imageString = imageString; + + self.toolsImage.image = [UIImage imageNamed:_imageString]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalListTableCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalListTableCell.h new file mode 100644 index 0000000..4eaea61 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalListTableCell.h @@ -0,0 +1,19 @@ +// +// HospitalListTableCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import +#import "HospitalListTableCell.h" +#import "HospitalInfoModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalListTableCell : UITableViewCell + +@property (nonatomic , strong) HospitalInfoModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalListTableCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalListTableCell.m new file mode 100644 index 0000000..c5396af --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalListTableCell.m @@ -0,0 +1,352 @@ +// +// HospitalListTableCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "HospitalListTableCell.h" +#import "UILabel+ChangeLineSpaceAndWordSpace.h" +#import "TYMapNavSheet.h" + + +@interface HospitalListTableCell () +{ + TYMapNavSheet * TYNavSheet; +} + +@property (nonatomic, strong) UIView * backView; + +@property (nonatomic, strong) UIImageView * hospitalImage; + +@property (nonatomic, strong) UILabel * lvLabel; + +@property (nonatomic, strong) UILabel * hospitalName; + +@property (nonatomic, strong) UILabel * addressLabel; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * discanceLabel; + +@property (nonatomic, strong) UIButton * mapNavButton; + +@property (nonatomic, strong) UIImageView * locatImg; +@end + +@implementation HospitalListTableCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; + +} + + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + self.backView.backgroundColor = KWhiteColor; + [self.contentView addSubview:self.backView]; + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.mas_offset(5); + make.bottom.mas_offset(-5); + }]; + + self.hospitalImage = [[UIImageView alloc] init]; + self.hospitalImage.layer.cornerRadius = 10.0f; + self.hospitalImage.layer.masksToBounds = true; + self.hospitalImage.contentMode = UIViewContentModeScaleAspectFill; + [self.backView addSubview:self.hospitalImage]; + + [self.hospitalImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(10); + make.width.height.mas_offset(63); + make.top.mas_offset(15); + }]; + + self.lvLabel = [[UILabel alloc] init]; + self.lvLabel.layer.cornerRadius = 3.0f; + self.lvLabel.layer.masksToBounds = true; + self.lvLabel.text = @"二甲"; + self.lvLabel.textColor = KWhiteColor; + self.lvLabel.backgroundColor = UIColorHex(#21BEBD); + self.lvLabel.textAlignment = NSTextAlignmentCenter; + self.lvLabel.font = MEDIUMFONT(9); + [UILabel changeWordSpaceForLabel:self.lvLabel WithSpace:2]; + [self.backView addSubview:self.lvLabel]; + + [self.lvLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.hospitalImage.mas_right).offset(10); + make.top.mas_offset(20); + make.height.mas_offset(15); + + }]; + + [self.lvLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.hospitalName = [[UILabel alloc] init]; + self.hospitalName.text = @"生命科学专科医院"; + self.hospitalName.font = BOLDSYSTEMFONT(14); + self.hospitalName.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.hospitalName]; + + [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvLabel.mas_right).offset(10); + make.right.mas_offset(-30); + make.top.mas_offset(20); + make.height.mas_offset(15); + + }]; + + + + self.roomLabel = [[UILabel alloc] init]; + self.roomLabel.text = @"重点科室:眼科、病理科"; + self.roomLabel.font = MEDIUMFONT(12); + self.roomLabel.textAlignment = NSTextAlignmentLeft; + self.roomLabel.textColor = CFontColor1; + [self.backView addSubview:self.roomLabel]; + + [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.hospitalImage.mas_right).offset(10); + make.right.mas_offset(-30); + make.top.mas_equalTo(self.hospitalName.mas_bottom).offset(5); + make.height.mas_offset(15); + + }]; + + + UIImageView * locatImg = [[UIImageView alloc] init]; + self.locatImg = locatImg; + locatImg.image = [UIImage imageNamed:@"hospatilAddress"]; + + [self.backView addSubview:locatImg]; + + [locatImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.hospitalImage.mas_right).offset(10); + make.width.mas_offset(10); + make.top.mas_equalTo(self.roomLabel.mas_bottom).offset(10); + make.height.mas_offset(12); + + }]; + + + self.discanceLabel = [[UILabel alloc] init]; + self.discanceLabel.text = @"km"; + self.discanceLabel.font = MEDIUMFONT(13); + self.discanceLabel.textAlignment = NSTextAlignmentLeft; + self.discanceLabel.textColor = CFontColor1; + [self.backView addSubview:self.discanceLabel]; + + [self.discanceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(locatImg.mas_right).offset(10); + make.top.mas_equalTo(locatImg.mas_top).offset(-1); + make.height.mas_offset(15); + + }]; + + [self.discanceLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.mapNavButton = [[UIButton alloc] init]; + [self.mapNavButton setTitle:@"导航" forState:UIControlStateNormal]; + [self.mapNavButton setTitleColor:UIColorHex(#3390FF) forState:UIControlStateNormal]; + self.mapNavButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.mapNavButton.titleLabel.font = SYSTEMFONT(12); + [self.mapNavButton addTarget:self action:@selector(mapNavLocationAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.mapNavButton]; + + [self.mapNavButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.discanceLabel.mas_right).offset(8); + make.width.mas_offset(60); + make.top.mas_equalTo(locatImg.mas_top).offset(-3); + make.height.mas_offset(20); + }]; + + + self.addressLabel = [[UILabel alloc] init]; + self.addressLabel.text = @"1111111"; + self.addressLabel.font = MEDIUMFONT(13); + self.addressLabel.textColor = UIColorHex(#999999); + self.addressLabel.numberOfLines = 0; + [self.backView addSubview:self.addressLabel]; + + [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.hospitalImage.mas_right).offset(10); + make.right.mas_offset(-20); + make.top.mas_equalTo(self.locatImg.mas_bottom).offset(10); + make.bottom.mas_equalTo(self.backView.mas_bottom); + }]; + + [self.addressLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + + [self.backView mas_updateConstraints:^(MASConstraintMaker *make) { + + make.bottom.mas_equalTo(self.addressLabel.mas_bottom).offset(20); + }]; +} + + +- (void)setModel:(HospitalInfoModel *)model { + + _model = model; + + self.hospitalName.text = _model.resourceName; + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.img]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.hospitalImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"hospitalNoimage")]; + + if (ValidStr(_model.level)) { + self.lvLabel.hidden = YES; + [self.hospitalName mas_updateConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.hospitalImage.mas_right).offset(10); + make.right.mas_offset(-30); + make.top.mas_equalTo(self.hospitalName.mas_bottom).offset(10); + make.height.mas_offset(15); + + }]; + + }else + { + self.lvLabel.hidden = NO; + + self.lvLabel.text = [NSString stringWithFormat:@" %@ ",_model.level]; + + + } +// + if (ValidStr(_model.keyDepartments)) { + self.roomLabel.hidden = true; + [self.locatImg mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.hospitalName.mas_bottom).offset(10); + }]; + }else{ + self.roomLabel.hidden = false; + self.roomLabel.text = [NSString stringWithFormat:@"重点科室:%@",_model.keyDepartments]; + [self.locatImg mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.roomLabel.mas_bottom).offset(10); + }]; + } +// +// if (ValidStr(_model.keyDepartments)) { +// +// self.roomLabel.hidden = true; +// self.locatImg.top = self.hospitalName.bottom + 10; +// self.discanceLabel.top = self.locatImg.top; +// self.mapNavButton.top = self.locatImg.top; +// self.addressLabel.top = self.locatImg.bottom + 7; +// +// }else +// { +// self.roomLabel.hidden = false; +// self.roomLabel.text = _model.keyDepartments; +// self.locatImg.top = self.roomLabel.bottom + 10; +// self.discanceLabel.top = self.locatImg.top; +// self.mapNavButton.top = self.locatImg.top; +// self.addressLabel.top = self.locatImg.bottom + 7; +// } +// + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + NSLog(@"经度:%f 纬度:%f", longitude, latitude); + //1.将两个经纬度点转成投影点 + MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(_model.latitude,_model.longitude)); + MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); + //2.计算距离 + CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + NSLog(@"距离:%f", distance); + self.discanceLabel.text = [NSString stringWithFormat:@"%.2fkm",distance/1000]; + + + if (ValidStr(_model.address)) { + self.addressLabel.hidden = true; + [self.backView mas_updateConstraints:^(MASConstraintMaker *make) { + + make.bottom.mas_equalTo(self.hospitalImage.mas_bottom).offset(5); + }]; + + }else + { + self.addressLabel.hidden = false; + self.addressLabel.text = [NSString stringWithFormat:@"%@",_model.address]; + +// CGFloat labH = [HQCommonUtils getSpaceLabelHeight: self.addressLabel withStr:self.addressLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:kScreenWidth - 110 withLineSpacing:5]; +// [self.addressLabel mas_updateConstraints:^(MASConstraintMaker *make) { +// make.height.mas_offset(labH); +// }]; + [self.backView mas_updateConstraints:^(MASConstraintMaker *make) { + + make.bottom.mas_equalTo(self.addressLabel.mas_bottom).offset(5); + }]; + } +} + +- (void)mapNavLocationAction:(UIButton *)navBtn { + + TYNavSheet = [[TYMapNavSheet alloc]init]; + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + +// NSLog(@"经度:%f 纬度:%f", longitude, latitude); +// //1.将两个经纬度点转成投影点 +// MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(model.latitude,model.longitude)); +// MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); +// //2.计算距离 +// CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + NSMutableDictionary * Dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"我的位置",@"startName",self.model.address,@"endName", nil]; + [TYNavSheet ShowMapNavSheetSuperView:[HQCommonUtils getCurrentVC] withLocationDic:Dic withstartCoor:CLLocationCoordinate2DMake(latitude, longitude) withendCoor:CLLocationCoordinate2DMake(self.model.latitude, self.model.longitude)]; + +} + +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + [TYNavSheet actionSheetBtnClick:buttonIndex]; +} + + + + +- (void)layoutIfNeeded { + [super layoutIfNeeded]; + + self.backView.layer.cornerRadius = 4.0f; + self.backView.layer.masksToBounds = YES; + self.backView.layer.shadowColor = [UIColor grayColor].CGColor; +// self.layer.shadowOffset = CGSizeMake(3, 3);//有偏移量的情况,默认向右向下有阴影 + self.backView.layer.shadowOffset = CGSizeZero; //设置偏移量为0,四周都有阴影 + self.backView.layer.shadowRadius = 3.0f;//阴影半径,默认3 + self.backView.layer.shadowOpacity = 0.3f;//阴影透明度,默认0 + self.backView.layer.masksToBounds = NO; + self.backView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds cornerRadius:self.backView.layer.cornerRadius].CGPath; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTiitleTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTiitleTableViewCell.h new file mode 100644 index 0000000..34c5283 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTiitleTableViewCell.h @@ -0,0 +1,16 @@ +// +// EvaluationTiitleTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface EvaluationTiitleTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTiitleTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTiitleTableViewCell.m new file mode 100644 index 0000000..50d451f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTiitleTableViewCell.m @@ -0,0 +1,64 @@ +// +// EvaluationTiitleTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "EvaluationTiitleTableViewCell.h" + +@implementation EvaluationTiitleTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + UILabel * titLabel = [[UILabel alloc] init]; + titLabel.font = BOLDSYSTEMFONT(16); + titLabel.textAlignment = NSTextAlignmentLeft; + titLabel.text = @"患者评价"; + [self.contentView addSubview:titLabel]; + + [titLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.width.mas_offset(100); + make.height.mas_offset(16); + make.top.mas_offset(23); + make.bottom.mas_offset(10); + }]; + + YYLabel * moreEvaLabel = [[YYLabel alloc] init]; + moreEvaLabel.text = @"更多评价 >"; + moreEvaLabel.textColor = UIColorHex(#999999); + moreEvaLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:moreEvaLabel]; + + [moreEvaLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-16); + make.width.mas_offset(100); + make.height.mas_offset(14); + make.top.bottom.mas_offset(23); + }]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTitleTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTitleTableViewCell.h new file mode 100644 index 0000000..fd4f53a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTitleTableViewCell.h @@ -0,0 +1,20 @@ +// +// EvaluationTitleTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookMoreEvaluation)(void); + +@interface EvaluationTitleTableViewCell : UITableViewCell + +@property (nonatomic, copy) lookMoreEvaluation moreBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTitleTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTitleTableViewCell.m new file mode 100644 index 0000000..83b6b34 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/EvaluationTitleTableViewCell.m @@ -0,0 +1,85 @@ +// +// EvaluationTitleTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import "EvaluationTitleTableViewCell.h" + +@implementation EvaluationTitleTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + + +- (void)createUI { + + UILabel * heardLabel = [[UILabel alloc] init]; + heardLabel.text = @"用户评价"; + heardLabel.textColor = UIColorHex(#333333); + heardLabel.font = BOLDSYSTEMFONT(16); + [self.contentView addSubview:heardLabel]; + + [heardLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(13); + make.height.mas_offset(16); + make.top.mas_offset(23); + make.bottom.mas_offset(-16); + }]; + + YYLabel * moreLabel = [[YYLabel alloc]init]; + moreLabel.text = @"更多评价 "; + + [self.contentView addSubview:moreLabel]; + + [moreLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-16); + make.height.mas_offset(16); + make.top.mas_offset(23); + make.bottom.mas_offset(-16); + }]; + + UIImage *image = [UIImage imageNamed:@"ic_more_info"]; + + NSMutableAttributedString * attri = [[NSMutableAttributedString alloc] initWithString:moreLabel.text]; + + NSMutableAttributedString * attachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(6, 11) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [attri appendAttributedString:attachText]; + + moreLabel.attributedText = attri; + + moreLabel.textAlignment = NSTextAlignmentRight; + + moreLabel.font = MEDIUMFONT(13); + moreLabel.textColor = UIColorHex(#999999); + + MJWeakSelf + [moreLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + if (weakSelf.moreBlock) { + + weakSelf.moreBlock(); + } + + }]; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilDoctorCollectionViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilDoctorCollectionViewCell.h new file mode 100644 index 0000000..80895f7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilDoctorCollectionViewCell.h @@ -0,0 +1,19 @@ +// +// HospatilDoctorCollectionViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import +#import "FoundExpertModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HospatilDoctorCollectionViewCell : UICollectionViewCell + +@property (nonatomic, strong) DoctorListModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilDoctorCollectionViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilDoctorCollectionViewCell.m new file mode 100644 index 0000000..3cce6be --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilDoctorCollectionViewCell.m @@ -0,0 +1,106 @@ +// +// HospatilDoctorCollectionViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import "HospatilDoctorCollectionViewCell.h" + +@interface HospatilDoctorCollectionViewCell () + + +@property (nonatomic, strong) UIImageView * doctorImage; + +@property (nonatomic, strong) UILabel * doctorName; + +@property (nonatomic, strong) UILabel * jobLabel; + +@end + +@implementation HospatilDoctorCollectionViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + + self.doctorImage = [[UIImageView alloc] init]; + self.doctorImage.image = IMAGE_NAMED(@"placeholdIMG"); + self.doctorImage.layer.cornerRadius = 25; + self.doctorImage.layer.masksToBounds = YES; + [self addSubview:self.doctorImage]; + + [self.doctorImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.top.mas_offset(15); + make.width.height.mas_offset(50); + }]; + + self.doctorName = [[UILabel alloc] init]; + self.doctorName.textColor = CFontColor1; + self.doctorName.font = BOLDSYSTEMFONT(14); + self.doctorName.text = @"张大夫"; + self.doctorName.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.doctorName]; + + [self.doctorName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImage.mas_right).offset(9); + make.top.mas_offset(15); + make.height.mas_offset(14); + }]; + [self.doctorName setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + + self.jobLabel = [[UILabel alloc] init]; + self.jobLabel.textColor = UIColorHex(#333333); + self.jobLabel.font = BOLDSYSTEMFONT(14); + self.jobLabel.text = @"主任医师 内科"; + self.jobLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.jobLabel]; + + [self.jobLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorName); + make.top.mas_equalTo(self.doctorName.mas_bottom).offset(10); + }]; + + [self.jobLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + +} + +- (void)setModel:(DoctorListModel *)model { + + _model = model; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + [self.doctorImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"doctorNoImage")]; + self.doctorName.text = _model.doctorName; + if (!ValidStr(_model.departmentName)) { + self.jobLabel.text = [NSString stringWithFormat:@"%@ %@",_model.doctorTitle,_model.departmentName]; + + }else + { + self.jobLabel.text = [NSString stringWithFormat:@"%@",_model.doctorTitle]; + } + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilIntroduceTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilIntroduceTableViewCell.h new file mode 100644 index 0000000..db82c77 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilIntroduceTableViewCell.h @@ -0,0 +1,16 @@ +// +// HospatilIntroduceTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HospatilIntroduceTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilIntroduceTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilIntroduceTableViewCell.m new file mode 100644 index 0000000..f762728 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospatilIntroduceTableViewCell.m @@ -0,0 +1,74 @@ +// +// HospatilIntroduceTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HospatilIntroduceTableViewCell.h" + +@implementation HospatilIntroduceTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + UILabel * locationLabel = [[UILabel alloc] init]; + + locationLabel.text = @"医院简介"; + + locationLabel.font = BOLDSYSTEMFONT(16); + + locationLabel.textColor = CFontColor1; + + [self.contentView addSubview:locationLabel]; + + [locationLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.top.mas_offset(15); + make.width.mas_offset(100); + make.height.mas_offset(16); + }]; + + UILabel * disanceLabel = [[UILabel alloc] init]; + + disanceLabel.text = @"西京医院坐落在美丽的古都西安,为第四军医大学第一附属医院,前身是1939年延安抗战岁月里诞生的中央医院,1954年与原第五军医大学附属医院合并。2017年转隶空军。 [1] 医院始终秉承践行宗旨、救死扶伤的“使命文化”,勇于争先、不断超越的“创新文化”,精益求精、追求卓越的“精品文化”,公平竞争、和谐发展的“阳光文化”,锐意进取、创新发展,先后获全国百佳医院、全国百姓放心示范医院、全国拥政爱民模范单位、全国抗震救灾英雄集体、全军医院建设先进单位、全军为部队服务先进医院、总后先进师旅团单位和总后先进党委等殊荣。在国内权威部门发布的全国医院综合排名中,医院综合实力跻身全国五强,院名被国家工商总局认定为中国驰名商标。"; + + disanceLabel.font = BOLDSYSTEMFONT(16); + + disanceLabel.textColor = CFontColor1; + + disanceLabel.numberOfLines = 0; + + [self.contentView addSubview:disanceLabel]; + + [disanceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.top.mas_equalTo(locationLabel.mas_bottom).offset(16); + make.right.mas_offset(-16); + make.bottom.mas_offset(-10); + }]; + [disanceLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; +} + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalEvaluationTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalEvaluationTableViewCell.h new file mode 100644 index 0000000..148a986 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalEvaluationTableViewCell.h @@ -0,0 +1,19 @@ +// +// HospitalEvaluationTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import +#import "EvaluatListModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalEvaluationTableViewCell : UITableViewCell + +@property (nonatomic, strong) EvaluatListModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalEvaluationTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalEvaluationTableViewCell.m new file mode 100644 index 0000000..cff8c33 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalEvaluationTableViewCell.m @@ -0,0 +1,160 @@ +// +// HospitalEvaluationTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HospitalEvaluationTableViewCell.h" +#import "FSXBStarRateView.h" + + +@interface HospitalEvaluationTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) FSXBStarRateView * starview; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * evaluatLabel; + +@property (nonatomic, strong) UILabel * typeLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@end + +@implementation HospitalEvaluationTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + + } + return self; +} + +- (void)createUI { + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.text = @"匿名用户"; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(14); + make.top.mas_offset(15); + make.height.mas_offset(14); + + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.starview = [[FSXBStarRateView alloc] initWithFrame:CGRectMake(0, 20, 100, 15) numberOfStars:5 rateStyle:HalfStar isAnination:YES finish:^(CGFloat currentScore) { + NSLog(@"%.2f",currentScore); + }]; + self.starview.enable = YES; + self.starview.currentScore = 3; + [self.contentView addSubview:self.starview]; + + [self.starview mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel.mas_right).offset(8); + make.top.mas_equalTo(self.nameLabel); + make.height.mas_offset(15); + make.width.mas_offset(100); + }]; + self.roomLabel = [[UILabel alloc] init]; + self.roomLabel.textColor = UIColorHex(#3390FF); + self.roomLabel.font = MEDIUMFONT(12); + self.roomLabel.text = @""; + self.roomLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.roomLabel]; + + [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(15); + make.height.mas_offset(14); + + }]; + [self.roomLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + +// self.typeLabel = [[UILabel alloc] init]; +// self.typeLabel.textColor = UIColorHex(#999999); +// self.typeLabel.font = MEDIUMFONT(12); +// self.typeLabel.text = @"王先生 图文咨询"; +// self.typeLabel.textAlignment = NSTextAlignmentLeft; +// [self.contentView addSubview:self.typeLabel]; +// +// [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// +// make.left.mas_offset(15); +// make.bottom.mas_offset(-17); +// make.height.mas_offset(14); +// }]; +// [self.typeLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.font = MEDIUMFONT(12); + self.timeLabel.text = @"2023-01-15"; + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-16); + make.bottom.mas_equalTo(@-17); + make.height.mas_offset(14); + + }]; + + + self.evaluatLabel = [[UILabel alloc] init]; + self.evaluatLabel.textColor = UIColorHex(#999999); + self.evaluatLabel.font = MEDIUMFONT(12); + self.evaluatLabel.text = @""; + self.evaluatLabel.numberOfLines = 0; + self.evaluatLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.evaluatLabel]; + + [self.evaluatLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-16); + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(15); + make.bottom.mas_equalTo(self.timeLabel.mas_top).offset(-11); + }]; + + [self.evaluatLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + +} + +- (void)setModel:(EvaluatListModel *)model { + + _model = model; + //1 图文 2音 + self.evaluatLabel.text = _model.context; + self.starview.currentScore = [_model.score floatValue]; + self.timeLabel.text = _model.time; + self.nameLabel.text = _model.userName; + if (!ValidStr(_model.officeName)) { + self.roomLabel.text = _model.officeName; + + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalLocationTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalLocationTableViewCell.h new file mode 100644 index 0000000..a9554d4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalLocationTableViewCell.h @@ -0,0 +1,19 @@ +// +// HospitalLocationTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalLocationTableViewCell : UITableViewCell + +@property (nonatomic, strong) MAMapView * mapView ; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalLocationTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalLocationTableViewCell.m new file mode 100644 index 0000000..99d55c7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalLocationTableViewCell.m @@ -0,0 +1,118 @@ +// +// HospitalLocationTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HospitalLocationTableViewCell.h" + +@interface HospitalLocationTableViewCell () + + +@end + +@implementation HospitalLocationTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + UILabel * locationLabel = [[UILabel alloc] init]; + + locationLabel.text = @"医院位置"; + + locationLabel.font = BOLDSYSTEMFONT(16); + + locationLabel.textColor = CFontColor1; + + [self.contentView addSubview:locationLabel]; + + [locationLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.top.mas_offset(15); + make.width.mas_offset(100); + make.height.mas_offset(16); + }]; + + // ///初始化地图 + self.mapView = [[MAMapView alloc] init]; // 开启定位 + + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.showsCompass = YES; //设置成NO表示关闭指南针;YES表示显示指南针 + self.mapView.compassOrigin = CGPointMake(self.mapView.compassOrigin.x, 222); + self.mapView.showsScale = YES; //设置成NO表示不显示比例尺;YES表示显示比例尺 + self.mapView.delegate = self; + [self.contentView addSubview:self.mapView]; + MAUserLocationRepresentation *r = [[MAUserLocationRepresentation alloc] init]; + r.showsAccuracyRing = YES;///精度圈是否显示,默认YES + r.showsHeadingIndicator = YES;///是否显示方向指示(MAUserTrackingModeFollowWithHeading模式开启)。默认为YES + r.enablePulseAnnimation = YES;///内部蓝色圆点是否使用律动效果, 默认YES +// r.image = [UIImage imageNamed:@"你的图片"]; ///定位图标, 与蓝色原点互斥 + [self.mapView updateUserLocationRepresentation:r]; + + [self.mapView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.top.mas_equalTo(locationLabel.mas_bottom).offset(16); + make.height.mas_offset(132); + make.right.mas_offset(-16); + }]; + + UILabel * disanceLabel = [[UILabel alloc] init]; + + disanceLabel.text = @"北京市西城区西什库大街8号"; + + disanceLabel.font = BOLDSYSTEMFONT(16); + + disanceLabel.textColor = CFontColor1; + + [self.contentView addSubview:disanceLabel]; + + [disanceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(16); + make.top.mas_equalTo(self.mapView.mas_bottom).offset(16); + make.height.mas_offset(13); + make.right.mas_offset(-16); + make.bottom.mas_offset(-10); + }]; +} +#pragma mark - MAMapViewDelegate + +- (void)mapViewRequireLocationAuth:(CLLocationManager *)locationManager +{ + [locationManager requestAlwaysAuthorization]; +} + + +- (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated +{ +} + + +- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation +{ + if (updatingLocation) + { + NSLog(@"userlocation :%@", userLocation.location); + } +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainDoctorCollectView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainDoctorCollectView.h new file mode 100644 index 0000000..f53dbe4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainDoctorCollectView.h @@ -0,0 +1,25 @@ +// +// HospitalMainDoctorCollectView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookMoreDocotorBlock)(void); +typedef void(^DcotorDetailBlock)(NSString * doctorID, NSString * doctorName); + +@interface HospitalMainDoctorCollectView : UICollectionView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) lookMoreDocotorBlock doctorBlock; +@property (nonatomic, copy) DcotorDetailBlock collSelectBlock; + +@property (nonatomic, copy) NSDictionary * parmDic; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainDoctorCollectView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainDoctorCollectView.m new file mode 100644 index 0000000..3195bd2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainDoctorCollectView.m @@ -0,0 +1,150 @@ +// +// HospitalMainDoctorCollectView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/1. +// + +#import "HospitalMainDoctorCollectView.h" +#import "HospatilDoctorCollectionViewCell.h" + + +@interface HospitalMainDoctorCollectView () + + +@property (nonatomic, strong) UILabel * sectLabel; + +@end + +@implementation HospitalMainDoctorCollectView + + +- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout +{ + if (self = [super initWithFrame:frame collectionViewLayout:layout]) + { + [self createUI]; + } + return self; +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; + +} + +- (void)setParmDic:(NSDictionary *)parmDic { + + _parmDic = parmDic; + NSString * keshiNumer = _parmDic[@"departmentNum"]; + NSString *yishengNumer = _parmDic[@"doctorNum"]; + if (ValidStr(keshiNumer)) { + keshiNumer = @"-"; + } + if (ValidStr(yishengNumer)) { + yishengNumer = @"-"; + } + self.sectLabel.text =[NSString stringWithFormat:@"(%@个科室%@位专家)",keshiNumer,yishengNumer]; + [self reloadData]; +} + + +- (void)createUI +{ + self.delegate = self; + self.dataSource = self; + self.backgroundColor = KWhiteColor; + [self registerClass:[HospatilDoctorCollectionViewCell class] forCellWithReuseIdentifier:@"foundCell"]; + [self registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"]; + + +} + +-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ + + return 1; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section +{ + // NSLog(@"guguiiuigiuggiuugi%ld",_productArr.count); + return self.dataArray.count; +} + + + +-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + HospatilDoctorCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"foundCell" forIndexPath:indexPath]; + + cell.backgroundColor = KWhiteColor; + cell.model = self.dataArray[indexPath.item]; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath +{ + + return CGSizeMake((kScreenWidth - 60)/2,75); + +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { + return CGSizeMake(kScreenWidth, 30); +} + + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath +{ + DoctorListModel * model = self.dataArray[indexPath.item]; + if (self.collSelectBlock) { + self.collSelectBlock(model.doctorId, model.doctorName); + } + +} + +- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ + + UICollectionReusableView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"forIndexPath:indexPath]; + + UILabel * heardLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10), kScreenWidth, 20)]; + heardLabel.text = @"科室医生"; + heardLabel.textColor = UIColorHex(#333333); + heardLabel.font = BOLDSYSTEMFONT(16); + CGFloat w = [HQCommonUtils getLengthFromText:heardLabel.text andFontSize:16]; + heardLabel.width = w; + [header addSubview:heardLabel]; + + UILabel * lastLabel = [[UILabel alloc] initWithFrame:CGRectMake(heardLabel.right, kRealValue(10), kScreenWidth, 20)]; + self.sectLabel = lastLabel; + lastLabel.textColor = UIColorHex(#666666); + lastLabel.font = BOLDSYSTEMFONT(11); + [header addSubview:lastLabel]; + + YYLabel * moreLabel = [[YYLabel alloc]initWithFrame:CGRectMake(kScreenWidth - 170,kRealValue(10), 120, 17)]; + moreLabel.text = @"查看全部 "; + moreLabel.textColor = UIColorHex(#999999); + [header addSubview:moreLabel]; + + UIImage *image = [UIImage imageNamed:@"ic_more_info"]; + + NSMutableAttributedString * attri = [[NSMutableAttributedString alloc] initWithString:moreLabel.text]; + + NSMutableAttributedString * attachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(6, 11) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [attri appendAttributedString:attachText]; + + moreLabel.attributedText = attri; + + moreLabel.textAlignment = NSTextAlignmentRight; + + MJWeakSelf + [moreLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + + weakSelf.doctorBlock(); + }]; + + header.backgroundColor = KWhiteColor; + return header; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainHeardView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainHeardView.h new file mode 100644 index 0000000..b91b3a5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainHeardView.h @@ -0,0 +1,22 @@ +// +// HospitalMainHeardView.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import + +typedef void(^lookHospitalJianjie)(void); +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalMainHeardView : UIView + +@property (nonatomic, copy) lookHospitalJianjie lookBlock; + +@property (nonatomic, copy) NSString * hospitalString; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainHeardView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainHeardView.m new file mode 100644 index 0000000..e645ef6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainHeardView.m @@ -0,0 +1,131 @@ +// +// HospitalMainHeardView.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HospitalMainHeardView.h" +#import "YYLabel.h" +#import "NSAttributedString+YYText.h" + +@interface HospitalMainHeardView () + +@property (nonatomic,strong) YYLabel *label;; + +@end + +@implementation HospitalMainHeardView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + UILabel * titLabel = [[UILabel alloc] initWithFrame:CGRectMake(17, 18.5, 100, 16)]; + titLabel.font = BOLDSYSTEMFONT(16); + titLabel.textColor = UIColorHex(#333333); + titLabel.text = @"医院简介"; + titLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:titLabel]; + + NSMutableAttributedString *text = [NSMutableAttributedString new]; +// // 添加文本 +// NSString *title = @""; + +// [text appendAttributedString:[[NSAttributedString alloc] initWithString:title attributes:nil]]; +// NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; +// [paragraphStyle setLineSpacing:6]; +// [text addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])]; +// + text.font = MEDIUMFONT(13) ; + _label = [YYLabel new]; + _label.userInteractionEnabled = YES; + _label.numberOfLines = 4; + _label.textVerticalAlignment = YYTextVerticalAlignmentTop; + _label.frame = CGRectMake(17 ,titLabel.bottom + 15 , self.width-34,80); + _label.attributedText = text; + [self addSubview:_label]; + // 添加全文 +// [self addSeeMoreButton]; + + +} + +- (void)setHospitalString:(NSString *)hospitalString { + _hospitalString = hospitalString; + + NSMutableAttributedString *text = [NSMutableAttributedString new]; + // 添加文本 + NSString *title = _hospitalString; + + // //富文本 +// [NSString stringWithFormat:@"%@ ",title]; + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[[NSString stringWithFormat:@"%@ ",title] dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; + + [text appendAttributedString:attrStr]; + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:6]; + [text addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])]; + + _label.attributedText = text; + + [self addSeeMoreButton]; + +} + + + + +#pragma mark - 添加全文 +- (void)addSeeMoreButton { + + __weak __typeof(self) weakSelf = self; + + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"...查看全部>"]; + + YYTextHighlight *hi = [YYTextHighlight new]; + [hi setColor:[UIColor colorWithRed:0.578 green:0.790 blue:1.000 alpha:1.000]]; + + hi.tapAction = ^(UIView *containerView,NSAttributedString *text,NSRange range, CGRect rect) { + + // 点击全文回调 + YYLabel *label = weakSelf.label; + weakSelf.lookBlock(); + [label sizeToFit]; + }; + + + [text setColor:UIColorHex(#3390FF) range:[text.string rangeOfString:@"查看全部>"]]; + [text setTextHighlight:hi range:[text.string rangeOfString:@"查看全部>"]]; + text.font = _label.font; + + YYLabel *seeMore = [YYLabel new]; + seeMore.attributedText = text; + [seeMore sizeToFit]; + + NSAttributedString *truncationToken = [NSAttributedString attachmentStringWithContent:seeMore contentMode:UIViewContentModeCenter attachmentSize:seeMore.frame.size alignToFont:text.font alignment:YYTextVerticalAlignmentCenter]; + + _label.truncationToken = truncationToken; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainTableView.h new file mode 100644 index 0000000..bf61adf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainTableView.h @@ -0,0 +1,26 @@ +// +// HospitalMainTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import +#import "HospitalLocationTableViewCell.h" +#import "EvaluationTiitleTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookMoreEvaluation)(void); + +@interface HospitalMainTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, strong) HospitalLocationTableViewCell * disCell ; + +@property (nonatomic, copy) lookMoreEvaluation moreBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainTableView.m new file mode 100644 index 0000000..ec2b14e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/HospitalMain/HospitalMainTableView.m @@ -0,0 +1,150 @@ +// +// HospitalMainTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "HospitalMainTableView.h" +#import "HospitalMainHeardView.h" +#import "HospitalEvaluationTableViewCell.h" +#import "HospatilIntroduceTableViewCell.h" +#import "EvaluationTitleTableViewCell.h" + + +@interface HospitalMainTableView () + +@property (nonatomic, strong) HospitalMainHeardView * headView; + +@end + +@implementation HospitalMainTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.backgroundColor = KClearColor; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count + 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + if (indexPath.row == 0) { + + EvaluationTitleTableViewCell * titleCell = [tableView dequeueReusableCellWithIdentifier:@"TitleCELL"]; + + if (!titleCell) { + + titleCell = [[EvaluationTitleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TitleCELL"]; + } + + titleCell.selectionStyle = UITableViewCellSelectionStyleNone; + titleCell.moreBlock = ^{ + self.moreBlock(); + }; + return titleCell; + + }else + { + HospitalEvaluationTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"EVALUATIONCELL"]; + + if (!cell) { + + cell = [[HospitalEvaluationTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"EVALUATIONCELL"]; + } + + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.model = self.dataArray[indexPath.row - 1]; + return cell; + } + + + return UITableViewCell.new; + + + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0)]; + + hearView.backgroundColor = KClearColor; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchExpertTableCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchExpertTableCell.h new file mode 100644 index 0000000..10f3df6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchExpertTableCell.h @@ -0,0 +1,29 @@ +// +// MainSearchExpertTableCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/25. +// + +#import +#import "FoundExpertModel.h" +NS_ASSUME_NONNULL_BEGIN + + +@protocol zhuangjiaListProtocol + +- (void)zongheZhuangjiaPictureAction:(NSString *)doctorID; +- (void)zongheZhuangjiaVideoAction:(NSString *)doctorID; + +@end + +@interface MainSearchExpertTableCell : UITableViewCell + +@property (nonatomic, strong) DoctorListModel * doctorModel; + +@property (nonatomic, weak)id zhuangjiaListDelegate; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchExpertTableCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchExpertTableCell.m new file mode 100644 index 0000000..d41a2db --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchExpertTableCell.m @@ -0,0 +1,398 @@ +// +// MainSearchExpertTableCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/25. +// + +#import "MainSearchExpertTableCell.h" + +@interface MainSearchExpertTableCell () + +@property (nonatomic, strong) UIView * backView; +@property (nonatomic, strong) UIImageView * doctorImg; + +@property (nonatomic, strong) UILabel * namelabel; + +@property (nonatomic, strong) UILabel * currentLabel; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * introduceLabel; + +@property (nonatomic, strong) UIButton * statusBtn; + +@property (nonatomic, strong) UILabel * lvlabel; + +@property (nonatomic, strong) UILabel * hospationLabel; + +@property (nonatomic, strong) UIButton * pictureButton; + +@property (nonatomic, strong) UIButton * videoButton; + +@property (nonatomic, strong) UILabel * toolsLabel; + +@property (nonatomic, strong) UIImageView * hotImage; + +@end + +@implementation MainSearchExpertTableCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + [self.contentView addSubview:self.backView]; + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.mas_offset(0); + make.bottom.mas_offset(10); + }]; + + + self.doctorImg = [[UIImageView alloc] init]; + self.doctorImg.layer.cornerRadius = 25; + self.doctorImg.layer.masksToBounds = true; + [self.backView addSubview:self.doctorImg]; + + [self.doctorImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(10); + make.width.height.mas_offset(50); + }]; + + + + self.namelabel = [[UILabel alloc] init]; + self.namelabel.text = @"张医生"; + self.namelabel.textColor = CFontColor1; + self.namelabel.font = BOLDSYSTEMFONT(14); + self.namelabel.textAlignment = NSTextAlignmentLeft; + self.namelabel.attributedText = [HQCommonUtils firstString:@"张医生 " firstColor:UIColorHex(#333333) firstSize:14 secondString:@" 主任医师" secondColor:UIColorHex(#333333) secondSize:13 thirdString:@" 内科 " thirdColor:UIColorHex(#333333) thirdSize:13]; + [self.backView addSubview:self.namelabel]; + + [self.namelabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(8); + make.top.mas_offset(10); + make.height.mas_offset(15); + }]; + [self.namelabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.roomLabel = [[UILabel alloc] init]; + self.roomLabel.text = @""; + self.roomLabel.textColor = CFontColor1; + self.roomLabel.font = BOLDSYSTEMFONT(14); + self.roomLabel.textAlignment = NSTextAlignmentLeft; +// self.roomLabel.attributedText = [HQCommonUtils firstString:@"张医生 " firstColor:UIColorHex(#333333) firstSize:14 secondString:@" 主任医师" secondColor:UIColorHex(#333333) secondSize:13 thirdString:@" 内科 " thirdColor:UIColorHex(#333333) thirdSize:13]; + [self.backView addSubview:self.roomLabel]; + + [self.roomLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(8); + make.top.mas_equalTo(self.namelabel.mas_bottom).offset(10); + make.height.mas_offset(15); + }]; + [self.roomLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + + self.statusBtn = [[UIButton alloc] init]; + [self.statusBtn setTitle:@"历史咨询" forState:UIControlStateNormal]; + [self.statusBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.statusBtn.layer.cornerRadius = 4.0f; + self.statusBtn.layer.masksToBounds = YES; + self.statusBtn.titleLabel.font = MEDIUMFONT(10); + self.statusBtn.backgroundColor = RGBA(33, 190, 189, 0.5); + [self.backView addSubview:self.statusBtn ]; + [self.statusBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(10); + make.height.mas_offset(17); + make.width.mas_offset(60); + }]; + + + self.lvlabel = [[UILabel alloc] init]; + self.lvlabel.font = MEDIUMFONT(12); + self.lvlabel.textColor = KWhiteColor; + self.lvlabel.backgroundColor = UIColorHex(#21BEBD); + self.lvlabel.layer.cornerRadius = 3.0f; + self.lvlabel.layer.masksToBounds = YES; + [self.backView addSubview:self.lvlabel]; + + [self.lvlabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel.mas_left); + make.top.mas_equalTo(self.roomLabel.mas_bottom).offset(10); + make.height.mas_offset(15); + }]; + [self.lvlabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.hospationLabel = [[UILabel alloc] init]; + self.hospationLabel.text = @" -- "; + self.hospationLabel.textColor = UIColorHex(#666666); + self.hospationLabel.font = MEDIUMFONT(13); + self.hospationLabel.textAlignment = NSTextAlignmentCenter; + [self.backView addSubview:self.hospationLabel]; + + [self.hospationLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvlabel.mas_right).offset(10); + make.top.mas_equalTo(self.lvlabel.mas_top); + make.height.mas_offset(13); + }]; + [self.hospationLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + //新增 + + + self.introduceLabel = [[UILabel alloc] init]; + self.introduceLabel.text = @"擅长:神经内科疾病的治疗,尤其擅长以脑血管、老年痴呆症、老年抑郁症等神经内科常见病的诊疗及研究"; + self.introduceLabel.textColor = UIColorHex(#666666); + self.introduceLabel.font = MEDIUMFONT(13); + self.introduceLabel.textAlignment = NSTextAlignmentLeft; + self.introduceLabel.numberOfLines = 3 ; + [self.backView addSubview:self.introduceLabel]; + + [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(8); + make.right.mas_offset(-17); + make.top.mas_equalTo(self.lvlabel.mas_bottom).offset(10); +// make.height.greaterThanOrEqualTo(@(60)); + }]; + [self.introduceLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + + +// UIImageView * hotImage = [[UIImageView alloc] init]; +// hotImage.image = IMAGE_NAMED(@"doctorHot"); +// self.hotImage = hotImage; +// [self.backView addSubview:hotImage]; + +// [self.hotImage mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.mas_equalTo(self.introduceLabel.mas_left); +// make.top.mas_equalTo(self.introduceLabel.mas_bottom).offset(14); +// make.width.mas_equalTo(14); +// make.height.mas_offset(15); +// }]; + //新增 + self.toolsLabel = [[UILabel alloc] init]; + self.toolsLabel.text = @"综合评价:-- / 回复率:-- / 咨询量:--"; + self.toolsLabel.textColor = UIColorHex(#666666); + self.toolsLabel.font = MEDIUMFONT(11); + self.toolsLabel.textAlignment = NSTextAlignmentLeft; + self.toolsLabel.numberOfLines = 2; + [self.backView addSubview:self.toolsLabel]; + + [self.toolsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(8); + make.right.mas_offset(-17); + make.top.mas_equalTo(self.introduceLabel.mas_bottom).offset(14); + }]; + + [self.toolsLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + UIView * linv = [[UIView alloc] init]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self.backView addSubview:linv]; + + [linv mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.right.mas_offset(-15); + make.height.mas_equalTo(@1); + make.top.mas_equalTo(self.toolsLabel.mas_bottom).offset(17); + }]; + + self.pictureButton = [[UIButton alloc] init]; + [self.pictureButton setTitle:@"图文咨询" forState:UIControlStateNormal]; + [self.pictureButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.pictureButton.titleLabel.font = MEDIUMFONT(13); + self.pictureButton.backgroundColor = KWhiteColor; + [self.pictureButton addTarget:self action:@selector(pictureQustionAction) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.pictureButton ]; + + [self.pictureButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_equalTo(linv.mas_bottom).offset(5); + make.height.mas_offset(40); + make.width.mas_equalTo(linv.mas_width).multipliedBy(0.5); + }]; + + UIView * cowlinv = [[UIView alloc] init]; + cowlinv.backgroundColor = UIColorHex(#E0E0E0); + [self.backView addSubview:cowlinv]; + + [cowlinv mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.pictureButton.mas_right); + make.width.mas_offset(1); + make.height.mas_equalTo(38); + make.top.mas_equalTo(linv.mas_bottom).offset(2); + }]; + + self.videoButton = [[UIButton alloc] init]; + [self.videoButton setTitle:@"视频咨询" forState:UIControlStateNormal]; + [self.videoButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.videoButton.titleLabel.font = MEDIUMFONT(13); + self.videoButton.backgroundColor = KWhiteColor; + [self.videoButton addTarget:self action:@selector(videoQustionAction) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.videoButton ]; + [self.videoButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.pictureButton.mas_right).offset(1); + make.top.mas_equalTo(linv.mas_bottom).offset(5); + make.height.mas_offset(40); + make.width.mas_equalTo(linv.mas_width).multipliedBy(0.5); + + }]; + + [self.backView mas_updateConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.mas_offset(10); + make.bottom.mas_equalTo(self.pictureButton.mas_bottom).offset(4); + }]; + [self.backView mas_updateConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.mas_offset(10); + make.bottom.mas_equalTo(self.videoButton.mas_bottom).offset(4); + }]; +// [HQCommonUtils addShadowToView:self.backView]; +} + +- (void)setDoctorModel:(DoctorListModel *)doctorModel { + + _doctorModel = doctorModel; + self.introduceLabel.text = [NSString stringWithFormat:@"擅长:%@", _doctorModel.goodAt]; + self.namelabel.text = self.doctorModel.doctorName; + self.roomLabel.text = [NSString stringWithFormat:@"%@ %@",self.doctorModel.doctorTitle,self.doctorModel.departmentName]; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_doctorModel.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"doctorNoImage")]; + + self.toolsLabel.text = [NSString stringWithFormat:@" 综合评价:%@ / 回复率:%.1f%% / 咨询量:%@",_doctorModel.overallMerit,[_doctorModel.responseRate floatValue],_doctorModel.messageNum]; + self.hospationLabel.text = self.doctorModel.resourceName; + + if (ValidStr(_doctorModel.hospitalLevel)) { + self.lvlabel.backgroundColor = KWhiteColor; + + }else + { + self.lvlabel.backgroundColor = UIColorHex(#21BEBD); + + self.lvlabel.text = [NSString stringWithFormat:@" %@ ",_doctorModel.hospitalLevel]; + + +// self.lvlabel.width = [HQCommonUtils getLengthFromTe + } + if (ValidStr(_doctorModel.tfShowFire)) { + + }else + { + NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:self.toolsLabel.text]; + [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] range:NSMakeRange(0, [self.toolsLabel.text length])]; + NSTextAttachment *icon = [[NSTextAttachment alloc] init]; + UIImage *iconImage = [UIImage imageNamed:@"doctorHot"]; + [icon setBounds:CGRectMake(0, -3, 15, 15)]; + [icon setImage:iconImage]; + NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:icon]; + [attrStr insertAttributedString:string atIndex:0]; + self.toolsLabel.attributedText = attrStr; + } + + if (ValidStr(_doctorModel.tfShowFire)) { + + }else + { + + + } + if(ValidStr(_doctorModel.type)) { + + self.statusBtn.hidden = true; + }else { + self.statusBtn.hidden = false; + } + + //判断是否开始服务 + if ([_doctorModel.doctorStatus intValue] != 3) { //非停诊 + if ([_doctorModel.audioStatus intValue] == 1) { //开启 + + [self.videoButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.videoButton.backgroundColor = KWhiteColor; + self.videoButton.userInteractionEnabled = true; + + }else + { + [self.videoButton setTitleColor:UIColor.grayColor forState:UIControlStateNormal]; + self.videoButton.userInteractionEnabled = false;; + } + + } + else{ + self.videoButton.userInteractionEnabled = false; + [self.videoButton setTitleColor:UIColor.grayColor forState:UIControlStateNormal]; + [self.pictureButton setTitleColor:UIColor.grayColor forState:UIControlStateNormal]; + + self.pictureButton.userInteractionEnabled = false; + } + + + + self.backView.backgroundColor = KWhiteColor; + self.backView.layer.cornerRadius = 4.0f; + self.backView.layer.masksToBounds = YES; + self.backView.layer.shadowColor = [UIColor grayColor].CGColor; +// self.layer.shadowOffset = CGSizeMake(3, 3);//有偏移量的情况,默认向右向下有阴影 + self.backView.layer.shadowOffset = CGSizeZero; //设置偏移量为0,四周都有阴影 + self.backView.layer.shadowRadius = 3.0f;//阴影半径,默认3 + self.backView.layer.shadowOpacity = 0.3f;//阴影透明度,默认0 + self.backView.layer.masksToBounds = NO; + + +} + +- (void)videoQustionAction { + + if ([self.zhuangjiaListDelegate respondsToSelector:@selector(zongheZhuangjiaVideoAction:)]) { + + [self.zhuangjiaListDelegate zongheZhuangjiaVideoAction:self.doctorModel.doctorId]; + } + + +} + +- (void)pictureQustionAction { + + if ([self.zhuangjiaListDelegate respondsToSelector:@selector(zongheZhuangjiaPictureAction:)]) { + + [self.zhuangjiaListDelegate zongheZhuangjiaPictureAction:self.doctorModel.doctorId]; + } + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchTable.h new file mode 100644 index 0000000..094923b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchTable.h @@ -0,0 +1,53 @@ +// +// MainSearchTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/25. +// + +#import +#import "FoundExpertModel.h" +#import "ZongheZhuangjiaTableViewCell.h" +#import "DoctorRoomCollectionView.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^mainSearchCellOnClick)(NSString * type, NSString * needID); + +typedef void(^searcMoreHospitalMoreBlcok)(); + +typedef void(^searcMoreDoctorMoreBlcok)(); + +typedef void(^searcMoreSicksMoreBlcok)(); + +typedef void(^searcMoreRoomsMoreBlcok)(); + +typedef void(^searcMoreRoomsMoreBlcok)(); + +typedef void(^searcSicksRelustBlcok)(SicksModel * model); + +@interface MainSearchTable : UITableView + +@property (nonatomic, strong) NSArray * docotorArray; +@property (nonatomic, assign) NSInteger type; // 1 综合 2 专家 3 医院 +@property (nonatomic, strong) FoundExpertModel * model; +@property (nonatomic, strong) NSArray * HospitalArray; +@property (nonatomic, copy) mainSearchCellOnClick mainBlock; + +@property (nonatomic, copy) searcMoreHospitalMoreBlcok hospitalBlock; + +@property (nonatomic, copy) searcMoreDoctorMoreBlcok doctorBlock; + +@property (nonatomic, copy) searcMoreSicksMoreBlcok sicksBlock; + +@property (nonatomic, copy) searcMoreRoomsMoreBlcok roomsBlock; + + +@property (nonatomic, weak)id zongheZhuangjiaDelegate; + +@property (nonatomic, copy) roomCollectViewBlock doctorSearBlock; + +@property (nonatomic, copy) searcSicksRelustBlcok sicksSearBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchTable.m new file mode 100644 index 0000000..3bdcf2a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/MainSearchTable.m @@ -0,0 +1,724 @@ +// +// MainSearchTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/25. +// + +#import "MainSearchTable.h" +#import "MainSearchExpertTableCell.h" +#import "HospitalListTableCell.h" +#import "ZHTagListView.h" +#import "DoctorRoomCollectionView.h" +#import "searchHospatilCellTableViewCell.h" +#import "ZongheZhuangjiaTableViewCell.h" + +@interface MainSearchTable () + +@property (nonatomic, assign) CGFloat footH; +@property (nonatomic, strong) DoctorRoomCollectionView * collectView; +@property (nonatomic, strong) ZHTagListView *tagList; +@property (nonatomic, strong) UIView * roomView; +@property (nonatomic, strong) UILabel * roomLabel; +@property (nonatomic, strong) UILabel * canselLabel; +@property (nonatomic, strong) UIView * headerView; +//@property (nonatomic, strong) UIButton * moreRoomBtn; +//@property (nonatomic, strong) UIButton * moreBtn; + + +@end + +@implementation MainSearchTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.tableFooterView.height = self.footH; + self.estimatedRowHeight = 60; + self.backgroundColor = CViewBgColor; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (UIView *)createFooterView { + + UIView * headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 100)]; + self.headerView = headerView; + UILabel * canselLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(18) , 110, 15)]; + canselLabel.text = @"疾病"; + self.canselLabel = canselLabel; + canselLabel.font = MEDIUMFONT(15); + canselLabel.textAlignment = NSTextAlignmentLeft; + canselLabel.textColor = CFontColor1; + [headerView addSubview:canselLabel]; + //6.6日新增 暂不要 +// UIButton * moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width - kRealValue(15) - 60, kRealValue(10), 60, 16)]; +// [moreBtn setTitle:@"更多 >" forState:UIControlStateNormal]; +// +// [moreBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; +// +// moreBtn.titleLabel.font = SYSTEMFONT(14); +// +// [moreBtn addTarget:self action:@selector(moreSicksOnClick) forControlEvents:UIControlEventTouchUpInside]; +// self.moreBtn = moreBtn; +// [headerView addSubview:moreBtn]; + + + NSMutableArray *_dataSource = @[ + ].mutableCopy; + + ZHTagListConfiguration *config = [ZHTagListConfiguration defaultConfiguration]; + config.tagTextColor = CFontColor1; + config.tagTextMargin = 11; + config.tagHeight = 27; + config.tagTextFont = SYSTEMFONT(13); + config.tagListViewInset = UIEdgeInsetsMake(15, 15, 15, 10); + + ZHTagListView *tagList = [[ZHTagListView alloc] initWithFrame:CGRectMake(0, canselLabel.bottom, kScreenWidth - 30, 0) configuration:config tagTexts:_dataSource]; + tagList.backgroundColor = KWhiteColor; + self.tagList = tagList; + [headerView addSubview:tagList]; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (idx == 6) { + [obj setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; + *stop = YES; + } + }]; + [tagList setTagClickHandler:^(ZHTagListView *tagListView, NSString *tagText, NSUInteger index) { + + [self selectDiseaAction:index]; + }]; + + + + UIView * roomView = [[UIView alloc] initWithFrame:CGRectMake(0, tagList.bottom + kRealValue(10), kScreenWidth, 200)]; + self.roomView = roomView; + [headerView addSubview:roomView]; + + UILabel * roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 0 , 110, 15)]; + roomLabel.text = @"科室"; + self.roomLabel = roomLabel; + roomLabel.font = MEDIUMFONT(15); + roomLabel.textAlignment = NSTextAlignmentLeft; + roomLabel.textColor = CFontColor1; + [roomView addSubview:roomLabel]; + //6.6日新增 暂不要 +// UIButton * moreRoomBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width - kRealValue(15) - 60, 0, 60, 16)]; +// [moreRoomBtn setTitle:@"更多 >" forState:UIControlStateNormal]; +// +// [moreRoomBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; +// +// moreRoomBtn.titleLabel.font = SYSTEMFONT(14); +// self.moreRoomBtn = moreRoomBtn; +// [moreRoomBtn addTarget:self action:@selector(moreRoomsOnClick) forControlEvents:UIControlEventTouchUpInside]; +// +// [roomView addSubview:moreRoomBtn]; + //找专家 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; + layout.itemSize = CGSizeMake((kScreenWidth - 30)/2,95); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); +// layout.minimumLineSpacing = 10; +// layout.minimumInteritemSpacing = 10; + + self.collectView = [[DoctorRoomCollectionView alloc]initWithFrame:CGRectMake(0, roomLabel.bottom + 15, kScreenWidth , 95 * 4 + 60) collectionViewLayout:layout]; + self.collectView.type = 1; + self.collectView.scrollEnabled = NO; + self.collectView.roomBlock = self.doctorSearBlock; + [roomView addSubview:self.collectView]; + + + roomView.height = self.collectView.bottom + kRealValue(10);; + + headerView.height = tagList.bottom + roomView.height + kRealValue(160); + + self.footH = headerView.height; + + return headerView; +} + + +- (void)selectDiseaAction:(int)index { + + SicksModel * sicModel = _model.SicksList[index]; + if (self.sicksSearBlock) { + self.sicksSearBlock(sicModel); + } + + +} + + +- (void)setDocotorArray:(NSArray *)docotorArray { + _docotorArray = docotorArray; + [self reloadData]; +} + +- (void)setHospitalArray:(NSArray *)HospitalArray { + _HospitalArray = HospitalArray; + [self reloadData]; + +} + +- (void)setType:(NSInteger)type { + _type = type; + if (_type == 2 || _type == 3) { + self.tableFooterView = [[UIView alloc] init];; + }else + { + self.tableFooterView = [self createFooterView]; + + } + [self reloadData]; +} + +- (void)setModel:(FoundExpertModel *)model { + + _model = model; + self.collectView.dataArray = self.model.DepartmentList; + + NSMutableArray * titleArray = [[NSMutableArray alloc] init]; + for (SicksModel * sicModel in model.SicksList) { + + [titleArray addObject:sicModel.sicksName]; + } + + if (model.SicksList.count == 0) { + self.canselLabel.hidden = YES; +// self.moreBtn.hidden =YES; + }else + { + self.canselLabel.hidden = false; +// self.moreBtn.hidden =false; + } + if (model.DepartmentList.count == 0) { + self.roomLabel.hidden = YES; +// self.moreRoomBtn.hidden = YES; + } + else + { + self.roomLabel.hidden = false; +// self.moreRoomBtn.hidden = false; + } + self.tagList.tagDataArray = titleArray; + + self.roomView.height = self.collectView.bottom + kRealValue(10);; + + self.roomView.frame = CGRectMake(0, self.tagList.bottom + kRealValue(10), kScreenWidth, self.roomView.height); + + self.headerView.height = self.roomView.bottom + kRealValue(10); + [self reloadData]; + +} + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + //其实用枚举更好 页面写完早 但是要快不如判断 + if (self.type == 1) { //综合 + if (section == 0) { + return self.model.DoctorList.count; + } + if (section == 1) { + + return self.model.hospitalList.count; + } + } + if (self.type == 2) + { + return self.docotorArray.count; + } + if (self.type == 3) + { + return self.HospitalArray.count; + } + + return 5; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + + if (self.type == 1 ) { + return 2; + } + return 1; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + // 是0加载专家 + + if (self.type == 1) { //综合 + + if (indexPath.section == 0) { + static NSString * cellID = @"cellID"; + + ZongheZhuangjiaTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[ZongheZhuangjiaTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.doctorModel = self.model.DoctorList[indexPath.row]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.backgroundColor = KWhiteColor; + cell.zongheZhuangjiaDelegate = self.zongheZhuangjiaDelegate; + return cell; + } + + if (indexPath.section == 1) { + + searchHospatilCellTableViewCell * hospcell = [tableView dequeueReusableCellWithIdentifier:@"HOSPITALCELL"]; + + if (!hospcell) { + + hospcell = [[searchHospatilCellTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HOSPITALCELL"]; + } + hospcell.selectionStyle = UITableViewCellSelectionStyleNone; + hospcell.model = self.model.hospitalList[indexPath.row]; + return hospcell; + } + } + if (self.type == 2) { //专家 + + static NSString * cellID = @"cellID"; + + ZongheZhuangjiaTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[ZongheZhuangjiaTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.doctorModel = self.docotorArray[indexPath.row]; + cell.backgroundColor = KClearColor; + cell.zongheZhuangjiaDelegate = self.zongheZhuangjiaDelegate; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + + } + + if (self.type == 3) { //医院 + + searchHospatilCellTableViewCell * hospcell = [tableView dequeueReusableCellWithIdentifier:@"HOSPITALCELL"]; + + if (!hospcell) { + + hospcell = [[searchHospatilCellTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HOSPITALCELL"]; + } + hospcell.selectionStyle = UITableViewCellSelectionStyleNone; + hospcell.model = self.HospitalArray[indexPath.row]; + return hospcell; + + } + return UITableViewCell.new; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (self.type == 1) { + + if (self.model.DoctorList.count > 0 && self.model.hospitalList.count > 0) { + + if (indexPath.section == 0) { + + DoctorListModel * doctormodel = self.model.DoctorList[indexPath.row]; + CGFloat h = 30; + + if (!ValidStr(doctormodel.goodAt)) { + NSMutableAttributedString * expanceString = [[NSMutableAttributedString alloc] initWithString:doctormodel.goodAt]; + UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, kScreenWidth - 127, 10)]; + + if ( !ValidStr(doctormodel.goodAt) ) { + int currentLins = [self getNumberOfLinesWithText:expanceString andLabelWidth: kScreenWidth - 127]; + + if (currentLins < 3) { + h = [HQCommonUtils getSpaceLabelHeight:lab withStr:doctormodel.goodAt withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:lab.width withLineSpacing:5]; + }else + { + h = 60; + } + + } + + return kRealValue(110) + h + kRealValue(85); + } + return kRealValue(110) + h + kRealValue(85); + } + if (indexPath.section == 1) { + + HospitalInfoModel * hosmodel = self.model.hospitalList[indexPath.row]; + + UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(83, 0, kScreenWidth - 120, 10)]; + + lab.text = hosmodel.address; + + CGFloat labH = [HQCommonUtils getSpaceLabelHeight:lab withStr:hosmodel.address withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:kScreenWidth - 120 withLineSpacing:5]; + + if (ValidStr(hosmodel.keyDepartments)) { + + return 85 + labH; + }else + { + return 110 + labH; + } + } + } + + if (self.model.DoctorList.count == 0 && self.model.hospitalList.count == 0 ) + { + return CGFLOAT_MIN; + } + + if ( (self.model.DoctorList.count > 0 && self.model.hospitalList.count == 0) || (self.model.DoctorList.count == 0 && self.model.hospitalList.count > 0) ) + { + if (self.model.DoctorList.count > 0 && self.model.hospitalList.count == 0) { + + if (indexPath.section == 0) { + + DoctorListModel * doctormodel = self.model.DoctorList[indexPath.row]; + CGFloat h = 30.0; + + if (!ValidStr(doctormodel.goodAt)) { + NSMutableAttributedString * expanceString = [[NSMutableAttributedString alloc] initWithString:doctormodel.goodAt]; + UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, kScreenWidth - 127, 10)]; + + if ( !ValidStr(doctormodel.goodAt) ) { + int currentLins = [self getNumberOfLinesWithText:expanceString andLabelWidth: kScreenWidth - 127]; + + if (currentLins < 3) { + h = [HQCommonUtils getSpaceLabelHeight:lab withStr:doctormodel.goodAt withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:lab.width withLineSpacing:5]; + }else + { + h = 60; + } + + } + + return kRealValue(110) + h + kRealValue(85); + } + return kRealValue(110) + h + kRealValue(85); + + }else + { + return CGFLOAT_MIN; + } + + } + if (self.model.DoctorList.count == 0 && self.model.hospitalList.count > 0) { + + if (indexPath.section == 0) { + return CGFLOAT_MIN; + }else + { + HospitalInfoModel * hosmodel = self.model.hospitalList[indexPath.row]; + + UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(83, 0, kScreenWidth - 120, 10)]; + + lab.text = hosmodel.address; + + CGFloat labH = [HQCommonUtils getSpaceLabelHeight:lab withStr:hosmodel.address withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:kScreenWidth - 120 withLineSpacing:5]; + + if (ValidStr(hosmodel.keyDepartments)) { + + return 85 + labH; + }else + { + return 110 + labH; + } + + } + + } + + } + } + if (self.type == 2) { + DoctorListModel * doctormodel = self.docotorArray[indexPath.row]; + CGFloat h = 30; + if (!ValidStr(doctormodel.goodAt)) { + NSMutableAttributedString * expanceString = [[NSMutableAttributedString alloc] initWithString:doctormodel.goodAt]; + UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, kScreenWidth - 127, 10)]; + + if ( !ValidStr(doctormodel.goodAt) ) { + int currentLins = [self getNumberOfLinesWithText:expanceString andLabelWidth: kScreenWidth - 127]; + + if (currentLins < 3) { + h = [HQCommonUtils getSpaceLabelHeight:lab withStr:doctormodel.goodAt withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:lab.width withLineSpacing:5]; + }else + { + h = 60; + } + + } + return kRealValue(110) + h + kRealValue(70); + } + return kRealValue(110) + h + kRealValue(70); + } + + if (self.type == 3) { + HospitalInfoModel * hosmodel = self.model.hospitalList[indexPath.row]; + + UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(83, 0, kScreenWidth - 120, 10)]; + + lab.text = hosmodel.address; + + CGFloat labH = [HQCommonUtils getSpaceLabelHeight:lab withStr:hosmodel.address withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:kScreenWidth - 120 withLineSpacing:5]; + + if (ValidStr(hosmodel.keyDepartments)) { + + return 85 + labH; + }else + { + return 110 + labH; + } + } + return 10; + +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + if (indexPath.section == 0) { + + DoctorListModel * doctorModel = self.model.DoctorList[indexPath.row]; + + if (self.mainBlock) { + self.mainBlock(@"医生", doctorModel.doctorId); + } + } + + + if (indexPath.section == 1) { + + HospitalInfoModel * hosmodel = self.model.hospitalList[indexPath.row]; + + if (self.mainBlock) { + self.mainBlock(@"医院", hosmodel.hositalId); + } + } + + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + if (self.type == 1) { + if (self.model.DoctorList.count > 0 && self.model.hospitalList.count > 0) { + + return kRealValue(40); + } + + if (self.model.DoctorList.count == 0 && self.model.hospitalList.count == 0 ) + { + return CGFLOAT_MIN; + } + + if ( (self.model.hospitalList.count > 0 && self.model.DoctorList.count == 0) || (self.model.hospitalList.count == 0 && self.model.DoctorList.count > 0) ) + { + + if (self.model.hospitalList.count > 0 && self.model.DoctorList.count == 0) { + + if (section == 0) { + + return CGFLOAT_MIN; + } + if (section == 1) { + + return kRealValue(40); + } + } + if (self.model.hospitalList.count == 0 && self.model.DoctorList.count > 0) { + + if (section == 0) { + return kRealValue(40); + } + if (section == 1) { + + return CGFLOAT_MIN; + } + } + } + } + if (self.type == 2 || self.type == 3) { + return kRealValue(40); + } + return kRealValue(40); +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, kRealValue(40))]; + sectionHeardView.backgroundColor = KClearColor; + + UILabel * todayLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10), 90, 16)]; + todayLabel.textAlignment = NSTextAlignmentLeft; + + todayLabel.textColor = CFontColor1; + + todayLabel.font = BOLDSYSTEMFONT(16); + + [sectionHeardView addSubview:todayLabel]; + + +// UIButton * moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(sectionHeardView.width - kRealValue(15) - 60, kRealValue(10), 60, 16)]; +// [moreBtn setTitle:@"更多 >" forState:UIControlStateNormal]; +// +// [moreBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; +// +// moreBtn.titleLabel.font = SYSTEMFONT(14); +// +// todayLabel.font = BOLDSYSTEMFONT(16); +// +// [sectionHeardView addSubview:moreBtn]; + + if (self.type == 1) { + if (self.model.DoctorList.count > 0 && self.model.hospitalList.count > 0) { + + if (section == 0) { + todayLabel.text = @"专家"; +// [moreBtn addTarget:self action:@selector(doctoreMoreClick) forControlEvents:UIControlEventTouchUpInside]; + + return sectionHeardView; + } + if (section == 1) { + todayLabel.text = @"医院"; +// [moreBtn addTarget:self action:@selector(hospitalMoreClick) forControlEvents:UIControlEventTouchUpInside]; + + return sectionHeardView; + } + } + + if (self.model.DoctorList.count == 0 && self.model.hospitalList.count == 0 ) + { + return [UIView new]; + } + + if ( (self.model.hospitalList.count > 0 && self.model.DoctorList.count == 0) || (self.model.hospitalList.count == 0 && self.model.DoctorList.count > 0) ) + { + + if (self.model.hospitalList.count > 0 && self.model.DoctorList.count == 0) { + + if (section == 0) { + return [UIView new];; + } + if (section == 1) { + todayLabel.text = @"医院"; +// [moreBtn addTarget:self action:@selector(hospitalMoreClick) forControlEvents:UIControlEventTouchUpInside]; + + } + } + if (self.model.hospitalList.count == 0 && self.model.DoctorList.count > 0) { + + if (section == 0) { + todayLabel.text = @"专家"; +// [moreBtn addTarget:self action:@selector(doctoreMoreClick) forControlEvents:UIControlEventTouchUpInside]; + + + } + if (section == 1) { + + return [UIView new]; + } + } + } + } + if (self.type == 2) { + todayLabel.text = @"专家"; + } + if (self.type == 3) { + todayLabel.text = @"医院"; + } + + return sectionHeardView; + + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + +//获取文本行数 +- (int)getNumberOfLinesWithText:(NSMutableAttributedString *)text andLabelWidth:(CGFloat)width { + CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)text); + CGMutablePathRef Path = CGPathCreateMutable(); + CGPathAddRect(Path, NULL ,CGRectMake(0 , 0 , width, INT_MAX)); + CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), Path, NULL); + // 得到字串在frame中被自动分成了多少个行。 + CFArrayRef rows = CTFrameGetLines(frame); + // 实际行数 + int numberOfLines = CFArrayGetCount(rows); + CFRelease(frame); + CGPathRelease(Path); + CFRelease(framesetter); + return numberOfLines; +} + +- (void)doctoreMoreClick { + + if (self.doctorBlock) { + + self.doctorBlock(); + } + + +} + +- (void)hospitalMoreClick { + + if (self.hospitalBlock) { + + self.hospitalBlock(); + } + +} + +- (void)moreSicksOnClick { + + if (self.sicksBlock) { + + self.sicksBlock(); + } + +} +- (void)moreRoomsOnClick { + + if (self.roomsBlock) { + + self.roomsBlock(); + } + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchConetShowTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchConetShowTable.h new file mode 100644 index 0000000..6e39f03 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchConetShowTable.h @@ -0,0 +1,22 @@ +// +// SearchConetShowTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^hospitalListBlcok)(NSString * hospitalName, NSString * hospitalID); + +@interface SearchConetShowTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) hospitalListBlcok hosBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchConetShowTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchConetShowTable.m new file mode 100644 index 0000000..5937741 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchConetShowTable.m @@ -0,0 +1,125 @@ +// +// SearchConetShowTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import "SearchConetShowTable.h" +#import "SearchShowUpTableViewCell.h" + + +@interface SearchConetShowTable () + +@property (nonatomic, assign) CGFloat footH; + +@end + +@implementation SearchConetShowTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + SearchShowUpTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"CELLID"]; + + if (!cell) { + + cell = [[SearchShowUpTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELLID"]; + } + + cell.model = self.dataArray[indexPath.row]; + + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + HospitalInfoModel * model = self.dataArray[indexPath.row]; + + if (self.hosBlock) { + + self.hosBlock(model.resourceName, model.hositalId); + } + + +} + + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + return kRealValue(43); + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + return [[UIView alloc] init]; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchShowUpTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchShowUpTableViewCell.h new file mode 100644 index 0000000..bbf0d18 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchShowUpTableViewCell.h @@ -0,0 +1,19 @@ +// +// SearchShowUpTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import +#import "HospitalInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchShowUpTableViewCell : UITableViewCell + +@property (nonatomic, strong) HospitalInfoModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchShowUpTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchShowUpTableViewCell.m new file mode 100644 index 0000000..7d49a38 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchShowUpTableViewCell.m @@ -0,0 +1,57 @@ +// +// SearchShowUpTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + + +#import "SearchShowUpTableViewCell.h" + +@interface SearchShowUpTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; + +@end + + +@implementation SearchShowUpTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(30), 0, kScreenWidth - kRealValue(30), kRealValue(43))];; + self.nameLabel.textColor = UIColorHex(#666666); + self.nameLabel.textAlignment = NSTextAlignmentLeft; + self.nameLabel.font = SYSTEMFONT(12); + [self.contentView addSubview:self.nameLabel]; + +} + +- (void)setModel:(HospitalInfoModel *)model { + + _model = model; + self.nameLabel.text = _model.resourceName; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchZhuangjiaTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchZhuangjiaTable.h new file mode 100644 index 0000000..7962bd0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchZhuangjiaTable.h @@ -0,0 +1,28 @@ +// +// SearchZhuangjiaTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import +#import "MainSearchExpertTableCell.h" + +@protocol zhuangjiaProtocol + +- (void)zhuangjiaJumpDetail:(NSString *)memberID; + +@end + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchZhuangjiaTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, weak)id zhuangjiaDelegate; +@property (nonatomic, weak)id zhuangjiaListDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchZhuangjiaTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchZhuangjiaTable.m new file mode 100644 index 0000000..2b81cb3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/SearchZhuangjiaTable.m @@ -0,0 +1,127 @@ +// +// SearchZhuangjiaTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/26. +// + +#import "SearchZhuangjiaTable.h" +#import "HospitalListTableCell.h" +#import "ZHTagListView.h" +#import "DoctorRoomCollectionView.h" + +@interface SearchZhuangjiaTable () + +@end + +@implementation SearchZhuangjiaTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + MainSearchExpertTableCell * cell = [tableView dequeueReusableCellWithIdentifier:@"ZHUANJIACELL"]; + + if (!cell) { + + cell = [[MainSearchExpertTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ZHUANJIACELL"]; + } + cell.doctorModel = self.dataArray[indexPath.section]; + cell.zhuangjiaListDelegate = self.zhuangjiaListDelegate; + cell.backgroundColor = KClearColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} +// +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { +// +// DoctorListModel * doctormodel = self.dataArray[indexPath.section]; +// +// return doctormodel.cellHeight; +// +//} + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + DoctorListModel * doctorModel = self.dataArray[indexPath.section]; + + if ([self.zhuangjiaDelegate respondsToSelector:@selector(zhuangjiaJumpDetail:)]) { + + [self.zhuangjiaDelegate zhuangjiaJumpDetail:doctorModel.doctorId]; + } +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return kRealValue(10); +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [[UIView alloc] init]; + + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/ZongheZhuangjiaTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/ZongheZhuangjiaTableViewCell.h new file mode 100644 index 0000000..b4df2ea --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/ZongheZhuangjiaTableViewCell.h @@ -0,0 +1,29 @@ +// +// ZongheZhuangjiaTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/21. +// + +#import +#import "FoundExpertModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol zongHeZhuangjiaProtocol + +- (void)zongheZhuangjiaPictureAction:(NSString *)doctorID; +- (void)zongheZhuangjiaVideoAction:(NSString *)doctorID; + +@end + + +@interface ZongheZhuangjiaTableViewCell : UITableViewCell + +@property (nonatomic, strong) DoctorListModel * doctorModel; + +@property (nonatomic, weak)id zongheZhuangjiaDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/ZongheZhuangjiaTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/ZongheZhuangjiaTableViewCell.m new file mode 100644 index 0000000..5bda6b0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/MainSearchView/ZongheZhuangjiaTableViewCell.m @@ -0,0 +1,387 @@ +// +// ZongheZhuangjiaTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/21. +// + +#import "ZongheZhuangjiaTableViewCell.h" + + + +@interface ZongheZhuangjiaTableViewCell () + +@property (nonatomic, strong) UIView * backView; +@property (nonatomic, strong) UIView * superBackView; + +@property (nonatomic, strong) UIImageView * doctorImg; + +@property (nonatomic, strong) UILabel * namelabel; +@property (nonatomic, strong) UILabel * currentLabel; + +@property (nonatomic, strong) UILabel * introduceLabel; + +@property (nonatomic, strong) UIButton * statusBtn; + +@property (nonatomic, strong) UILabel * lvlabel; + +@property (nonatomic, strong) UILabel * hospationLabel; + +@property (nonatomic, strong) UILabel * roomLabel; + + +@property (nonatomic, strong) UIButton * pictureButton; + +@property (nonatomic, strong) UIButton * videoButton; + +@property (nonatomic, strong) UILabel * toolsLabel; + +@property (nonatomic, strong) UIImageView * hotImage; + +@property (nonatomic, strong) UIView * linvView; +@property (nonatomic, strong) UIView * cowlinv; + +@end + +@implementation ZongheZhuangjiaTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + + self.superBackView = [[UIView alloc] initWithFrame:CGRectMake(15, 0, kScreenWidth - 60, 100)]; + self.superBackView.layer.shadowColor = [UIColor lightGrayColor].CGColor; + self.superBackView.layer.shadowOffset = CGSizeMake(0,0.5); + self.superBackView.layer.shadowOpacity = 0.6; + self.superBackView.layer.shadowRadius = 1.0; + self.superBackView.clipsToBounds = NO; + [self.contentView addSubview:self.superBackView]; + + self.backView = [[UIView alloc] initWithFrame:CGRectMake(0, 1, kScreenWidth - 60, 100)]; + self.backView.layer.shadowColor = [UIColor lightGrayColor].CGColor; + self.backView.layer.shadowOffset = CGSizeMake(0,0.5); + self.backView.layer.shadowOpacity = 0.6; + self.backView.layer.shadowRadius = 1.0; + self.backView.clipsToBounds = NO; + [self.superBackView addSubview:self.backView]; + + + + self.doctorImg = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 50, 50)]; + self.doctorImg.layer.cornerRadius = 25; + self.doctorImg.layer.masksToBounds = true; + [self.backView addSubview:self.doctorImg]; + + + + self.namelabel = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorImg.right + 8, 10, self.backView.width - self.doctorImg.right -30, 15)]; + self.namelabel.text = @"张医生"; + self.namelabel.textColor = CFontColor1; + self.namelabel.font = BOLDSYSTEMFONT(14); + self.namelabel.textAlignment = NSTextAlignmentLeft; +// self.namelabel.attributedText = [HQCommonUtils firstString:@"张医生 " firstColor:UIColorHex(#333333) firstSize:14 secondString:@" 主任医师" secondColor:UIColorHex(#333333) secondSize:13 thirdString:@" 内科 " thirdColor:UIColorHex(#333333) thirdSize:13]; + [self.backView addSubview:self.namelabel]; + + + self.statusBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.backView.width - 70, 15, 60, 17)]; + [self.statusBtn setTitle:@"历史咨询" forState:UIControlStateNormal]; + [self.statusBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.statusBtn.layer.cornerRadius = 4.0f; + self.statusBtn.layer.masksToBounds = YES; + self.statusBtn.backgroundColor = RGBA(33, 190, 189, 0.5); + self.statusBtn.titleLabel.font = MEDIUMFONT(10); + [self.backView addSubview:self.statusBtn ]; + + + self.roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorImg.right + 8, self.namelabel.bottom + 10 , self.backView.width - self.doctorImg.right -30, 15)]; + self.roomLabel.text = @""; + self.roomLabel.textColor = CFontColor2; + self.roomLabel.font = BOLDSYSTEMFONT(12); + self.roomLabel.textAlignment = NSTextAlignmentLeft; +// self.namelabel.attributedText = [HQCommonUtils firstString:@"张医生 " firstColor:UIColorHex(#333333) firstSize:14 secondString:@" 主任医师" secondColor:UIColorHex(#333333) secondSize:13 thirdString:@" 内科 " thirdColor:UIColorHex(#333333) thirdSize:13]; + [self.backView addSubview:self.roomLabel]; + + + +// 1818954 + + self.lvlabel = [[UILabel alloc] initWithFrame:CGRectMake(self.namelabel.left, self.roomLabel.bottom + 8, 30, 15)]; + + self.lvlabel.textColor = KWhiteColor; + self.lvlabel.backgroundColor = UIColorHex(#21BEBD); + self.lvlabel.layer.cornerRadius = 3.0f; + self.lvlabel.layer.masksToBounds = YES; + self.lvlabel.layer.borderWidth = 1.0f; + self.lvlabel.layer.borderColor = UIColorHex(#21BEBD).CGColor; + self.lvlabel.font = MEDIUMFONT(10); + self.lvlabel.textAlignment = NSTextAlignmentCenter; + [self.backView addSubview:self.lvlabel]; + +// [self.lvlabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.hospationLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.lvlabel.right + 10, self.roomLabel.bottom + 8, self.backView.width - self.lvlabel.right - 15, 13)]; + self.hospationLabel.text = @" 西京医院 "; + self.hospationLabel.textColor = UIColorHex(#666666); + self.hospationLabel.font = MEDIUMFONT(13); + self.hospationLabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.hospationLabel]; + + //新增 + + self.introduceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.doctorImg.right + 8, self.lvlabel.bottom + 12, _backView.width - self.doctorImg.right - 20, 20)]; + self.introduceLabel.text = @"擅长:"; + self.introduceLabel.textColor = UIColorHex(#666666); + self.introduceLabel.font = MEDIUMFONT(13); + self.introduceLabel.textAlignment = NSTextAlignmentLeft; + self.introduceLabel.numberOfLines = 3 ; + [self.backView addSubview:self.introduceLabel]; + + + //新增 + +// UIImageView * hotImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.introduceLabel.left, self.introduceLabel.bottom + 17, 14, 15)]; +// hotImage.image = IMAGE_NAMED(@"doctorHot"); +// self.hotImage = hotImage; +// [self.backView addSubview:hotImage]; + + + self.toolsLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.introduceLabel.left, self.introduceLabel.bottom + 10, self.introduceLabel.width + kRealValue(10), 40)]; + self.toolsLabel.text = @"综合评价:5.0 / 回复率:99% / 咨询量:3323"; + self.toolsLabel.textColor = UIColorHex(#666666); + self.toolsLabel.font = MEDIUMFONT(13); + self.toolsLabel.textAlignment = NSTextAlignmentLeft; + self.toolsLabel.numberOfLines = 2; + [self.backView addSubview:self.toolsLabel]; + + + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(15, self.toolsLabel.bottom + 17, _backView.width - 30, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + self.linvView = linv; + [self.backView addSubview:linv]; + + self.pictureButton = [[UIButton alloc] initWithFrame:CGRectMake(15, linv.bottom + 5, linv.width / 2, 40)]; + [self.pictureButton setTitle:@"图文咨询" forState:UIControlStateNormal]; + [self.pictureButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.pictureButton.titleLabel.font = MEDIUMFONT(13); + self.pictureButton.backgroundColor = KWhiteColor; + [self.pictureButton addTarget:self action:@selector(pictureQuestionAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.pictureButton ]; + + + self.videoButton = [[UIButton alloc] initWithFrame:CGRectMake(self.pictureButton.right, self.pictureButton.top, self.pictureButton.width, self.pictureButton.height)]; + [self.videoButton setTitle:@"视频咨询" forState:UIControlStateNormal]; + [self.videoButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.videoButton.titleLabel.font = MEDIUMFONT(13); + self.videoButton.backgroundColor = KWhiteColor; + [self.videoButton addTarget:self action:@selector(videoQuestionAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.videoButton ]; + + UIView * cowlinv = [[UIView alloc] initWithFrame:CGRectMake( self.pictureButton.right, self.pictureButton.top,1 , 40)]; + cowlinv.backgroundColor = UIColorHex(#E0E0E0); + self.cowlinv = cowlinv; + [self.backView addSubview:cowlinv]; + + [HQCommonUtils addShadowToView:self.backView]; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + } + + +- (void)setDoctorModel:(DoctorListModel *)doctorModel { + + _doctorModel = doctorModel; + + + self.namelabel.text = [NSString stringWithFormat:@"%@",self.doctorModel.doctorName]; + + self.roomLabel.text = [NSString stringWithFormat:@"%@ %@",self.doctorModel.doctorTitle,self.doctorModel.departmentName]; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_doctorModel.photo]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"doctorNoImage")]; + + self.toolsLabel.text = [NSString stringWithFormat:@" 综合评价:%@ / 回复率:%.1f%% / 咨询量:%@",_doctorModel.overallMerit,[_doctorModel.responseRate floatValue] * 100,_doctorModel.messageNum]; + self.hospationLabel.text = self.doctorModel.resourceName; + + if (ValidStr(_doctorModel.hospitalLevel)) { + + self.lvlabel.hidden = YES; + self.hospationLabel.left = self.namelabel.left; + + }else + { + self.lvlabel.hidden = NO; + + self.lvlabel.text = [NSString stringWithFormat:@" %@ ",_doctorModel.hospitalLevel]; + + + + [UILabel changeWordSpaceForLabel:self.lvlabel WithSpace:2]; + + self.lvlabel.width = [HQCommonUtils getLengthFromText:self.lvlabel.text andFontSize:11] + kRealValue(8); + self.hospationLabel.left = self.lvlabel.right + 10; + + } + //布局 + if (!ValidStr(_doctorModel.goodAt)) { + NSMutableAttributedString * goodatString = [[NSMutableAttributedString alloc] initWithString:_doctorModel.goodAt]; + self.introduceLabel.attributedText = goodatString ; + } + else + { + self.introduceLabel.text = @"擅长:"; + } + int currentLins = 0 ; + + if (!ValidStr(_doctorModel.goodAt)) { + NSMutableAttributedString * goodatString = [[NSMutableAttributedString alloc] initWithString:_doctorModel.goodAt]; + currentLins =[self getNumberOfLinesWithText:goodatString andLabelWidth: kScreenWidth - 127]; + } + if (currentLins < 3) { + self.introduceLabel.height = [HQCommonUtils getSpaceLabelHeight:self.introduceLabel withStr:_doctorModel.goodAt withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth: kScreenWidth - 127 withLineSpacing:5]; + }else + { + self.introduceLabel.height = 60; + } + + + if (ValidStr(_doctorModel.tfShowFire)) { + + }else + { + NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:self.toolsLabel.text]; + [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] range:NSMakeRange(0, [self.toolsLabel.text length])]; + NSTextAttachment *icon = [[NSTextAttachment alloc] init]; + UIImage *iconImage = [UIImage imageNamed:@"doctorHot"]; + [icon setBounds:CGRectMake(0, -3, 15, 15)]; + [icon setImage:iconImage]; + NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:icon]; + [attrStr insertAttributedString:string atIndex:0]; + self.toolsLabel.attributedText = attrStr; + } + self.toolsLabel.top = self.introduceLabel.bottom + 10; + self.linvView.top = self.toolsLabel.bottom + 14; + + self.cowlinv.top = self.linvView.bottom + 5; + self.pictureButton.top = self.linvView.bottom + 5; + self.videoButton.top = self.linvView.bottom + 5; + self.backView.height = self.videoButton.bottom; + self.superBackView.height = self.backView.bottom + kRealValue(10); + self.backView.backgroundColor = KWhiteColor; + self.backView.layer.cornerRadius = 4.0f; + self.backView.layer.masksToBounds = YES; + self.backView.layer.shadowColor = [UIColor grayColor].CGColor; +// self.layer.shadowOffset = CGSizeMake(3, 3);//有偏移量的情况,默认向右向下有阴影 + self.backView.layer.shadowOffset = CGSizeZero; //设置偏移量为0,四周都有阴影 + self.backView.layer.shadowRadius = 1.0f;//阴影半径,默认3 + self.backView.layer.shadowOpacity = 0.3f;//阴影透明度,默认0 + self.backView.layer.masksToBounds = NO; + self.videoButton.userInteractionEnabled = true; + self.pictureButton.userInteractionEnabled = true; + //判断是否开始服务 + if ([_doctorModel.doctorStatus intValue] != 3) { //非停诊 + if ([_doctorModel.audioStatus intValue] == 1) { //开启 + + [self.videoButton setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + self.videoButton.backgroundColor = KWhiteColor; + self.videoButton.userInteractionEnabled = true; + + }else + { + [self.videoButton setTitleColor:UIColor.grayColor forState:UIControlStateNormal]; + self.videoButton.userInteractionEnabled = false; + } + + } + else{ + self.videoButton.userInteractionEnabled = false; + [self.videoButton setTitleColor:UIColor.grayColor forState:UIControlStateNormal]; + [self.pictureButton setTitleColor:UIColor.grayColor forState:UIControlStateNormal]; + + self.pictureButton.userInteractionEnabled = false; + } + + // 设置阴影路径,仅在底部 + // 可选:设置圆角 + +// UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, kScreenWidth - 127, 10)]; +// CGFloat h = 0; +// if (!ValidStr(self.doctorModel.goodAt) ) { +// h = [HQCommonUtils getSpaceLabelHeight:lab withStr:self.doctorModel.goodAt withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:lab.width withLineSpacing:1]; +// } + if(ValidStr(_doctorModel.type)) { + + self.statusBtn.hidden = true; + }else { + self.statusBtn.hidden = false; + } + self.backView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds cornerRadius:self.backView.layer.cornerRadius].CGPath; + +} + + +- (void)pictureQuestionAction:(UIButton *)picBtn { + + if ([self.zongheZhuangjiaDelegate respondsToSelector:@selector(zongheZhuangjiaPictureAction:)]) { + + [self.zongheZhuangjiaDelegate zongheZhuangjiaPictureAction:self.doctorModel.doctorId]; + } + +} + +- (void)videoQuestionAction:(UIButton *)videoBtn { + + if ([self.zongheZhuangjiaDelegate respondsToSelector:@selector(zongheZhuangjiaVideoAction:)]) { + + [self.zongheZhuangjiaDelegate zongheZhuangjiaVideoAction:self.doctorModel.doctorId]; + } + +} + +//获取文本行数 +- (int)getNumberOfLinesWithText:(NSMutableAttributedString *)text andLabelWidth:(CGFloat)width { + CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)text); + CGMutablePathRef Path = CGPathCreateMutable(); + CGPathAddRect(Path, NULL ,CGRectMake(0 , 0 , width, INT_MAX)); + CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), Path, NULL); + // 得到字串在frame中被自动分成了多少个行。 + CFArrayRef rows = CTFrameGetLines(frame); + // 实际行数 + int numberOfLines = CFArrayGetCount(rows); + CFRelease(frame); + CGPathRelease(Path); + CFRelease(framesetter); + return numberOfLines; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/PopView/PopupView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/PopView/PopupView.h new file mode 100644 index 0000000..7132b78 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/PopView/PopupView.h @@ -0,0 +1,21 @@ +// +// PopupView.h +// QinghaiProject +// +// Created by Apple on 2024/7/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^PopupViewTapHandler)(void); + +@interface PopupView : UIView + +@property (nonatomic, copy) PopupViewTapHandler tapHandler; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/PopView/PopupView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/PopView/PopupView.m new file mode 100644 index 0000000..b8c7bd5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/PopView/PopupView.m @@ -0,0 +1,131 @@ + +// +// PopupView.h +// QinghaiProject +// +// Created by Apple on 2024/7/6. +// + +#import "PopupView.h" + + +@implementation PopupView + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + [self setupView]; + } + return self; +} + +- (void)setupView { + self.backgroundColor = [UIColor clearColor]; // 设置为透明以显示阴影效果 + + CAShapeLayer *shapeLayer = [CAShapeLayer layer]; + shapeLayer.path = [self createPopupPath].CGPath; + shapeLayer.fillColor = [UIColor whiteColor].CGColor; + + // 设置阴影 + shapeLayer.shadowColor = [UIColor blackColor].CGColor; + shapeLayer.shadowOpacity = 0.3; + shapeLayer.shadowOffset = CGSizeMake(0, 2); + shapeLayer.shadowRadius = 4; + shapeLayer.shadowPath = [self createPopupPath].CGPath; // 使用路径作为阴影路径 + + [self.layer insertSublayer:shapeLayer atIndex:0]; + + // 添加点击手势 + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)]; + [self addGestureRecognizer:tapGesture]; + + // 添加“更多记录”标签 + UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; + label.text = @"更多记录"; + label.font = SYSTEMFONT(13); + label.textColor = [UIColor blackColor]; + label.textAlignment = NSTextAlignmentCenter; + [self addSubview:label]; + + // 设置标签约束 + label.translatesAutoresizingMaskIntoConstraints = NO; + [NSLayoutConstraint activateConstraints:@[ + [label.centerXAnchor constraintEqualToAnchor:self.centerXAnchor], + [label.centerYAnchor constraintEqualToAnchor:self.centerYAnchor] + ]]; +} + +- (UIBezierPath *)createPopupPath { + CGFloat width = self.bounds.size.width; + CGFloat height = self.bounds.size.height; + CGFloat triangleHeight = 10.0; + CGFloat triangleWidth = 20.0; + CGFloat cornerRadius = 10.0; + CGFloat triangleOffset = 10.0; // 箭头距离右边的距离 + + UIBezierPath *path = [UIBezierPath bezierPath]; + + // 从左下角开始 + [path moveToPoint:CGPointMake(0, height - cornerRadius)]; + + // 左下角圆角 + [path addArcWithCenter:CGPointMake(cornerRadius, height - cornerRadius) + radius:cornerRadius + startAngle:M_PI + endAngle:M_PI_2 + clockwise:NO]; + + // 底边 + [path addLineToPoint:CGPointMake(width - cornerRadius, height)]; + + // 右下角圆角 + [path addArcWithCenter:CGPointMake(width - cornerRadius, height - cornerRadius) + radius:cornerRadius + startAngle:M_PI_2 + endAngle:0 + clockwise:NO]; + + // 右边 + [path addLineToPoint:CGPointMake(width, cornerRadius)]; + + // 右上角圆角 + [path addArcWithCenter:CGPointMake(width - cornerRadius, cornerRadius) + radius:cornerRadius + startAngle:0 + endAngle:-M_PI_2 + clockwise:NO]; + + // 顶边,直到箭头左边的位置 + [path addLineToPoint:CGPointMake(width - triangleWidth - triangleOffset, 0)]; + + // 箭头的左边 + [path addLineToPoint:CGPointMake(width - triangleOffset - triangleWidth / 2, -triangleHeight)]; + + // 箭头的右边 + [path addLineToPoint:CGPointMake(width - triangleOffset, 0)]; + + // 顶边剩余的部分 + [path addLineToPoint:CGPointMake(cornerRadius, 0)]; + + // 左上角圆角 + [path addArcWithCenter:CGPointMake(cornerRadius, cornerRadius) + radius:cornerRadius + startAngle:-M_PI_2 + endAngle:M_PI + clockwise:NO]; + + // 左边 + [path addLineToPoint:CGPointMake(0, height - cornerRadius)]; + + [path closePath]; + + return path; +} + +- (void)handleTap { + if (self.tapHandler) { + self.tapHandler(); + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionAddPeopleTableCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionAddPeopleTableCell.h new file mode 100644 index 0000000..06348d7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionAddPeopleTableCell.h @@ -0,0 +1,27 @@ +// +// QuestionAddPeopleTableCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/17. +// + +#import +#import "QuestionDiseaseInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol addQuestionDelegate + +- (void)addQuestionPeopleClick:(QuestionDiseaseInfoModel *)model; + +@end + +@interface QuestionAddPeopleTableCell : UITableViewCell + +@property (nonatomic, strong) QuestionDiseaseInfoModel * userModel; + +@property (nonatomic, weak)id addDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionAddPeopleTableCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionAddPeopleTableCell.m new file mode 100644 index 0000000..3c0fb71 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionAddPeopleTableCell.m @@ -0,0 +1,75 @@ +// +// QuestionAddPeopleTableCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/17. +// + +#import "QuestionAddPeopleTableCell.h" + +@implementation QuestionAddPeopleTableCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + UIButton * addBtn = [[UIButton alloc] init]; + + [addBtn setTitle:@" 新增档案" forState:UIControlStateNormal]; + +// [addBtn setImage:[UIImage imageNamed:@"addQuestionPeople"] forState:UIControlStateNormal]; + + [addBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + + [addBtn addTarget:self action:@selector(addQuetsionClick) forControlEvents:UIControlEventTouchUpInside]; + + addBtn.titleLabel.font = MEDIUMFONT(14); + + [self.contentView addSubview:addBtn]; + + [addBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(@0); + make.top.mas_offset(5); + make.height.mas_offset(48); + }]; + + +} + +- (void)setUserModel:(QuestionDiseaseInfoModel *)userModel { + + _userModel = userModel; + + +} + +- (void)addQuetsionClick { + + if ([self.addDelegate respondsToSelector:@selector(addQuestionPeopleClick:)]) { + + [self.addDelegate addQuestionPeopleClick:self.userModel]; + + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/AllRoomRecordsCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/AllRoomRecordsCell.h new file mode 100644 index 0000000..47f5255 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/AllRoomRecordsCell.h @@ -0,0 +1,17 @@ +// +// AllRoomRecordsCell.h +// QinghaiProject +// +// Created by Apple on 2024/7/6. +// + +#import +#import "HomeQusetionRecordsModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AllRoomRecordsCell : UITableViewCell +@property (nonatomic, strong) HomeQusetionRecordsModel * model; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/AllRoomRecordsCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/AllRoomRecordsCell.m new file mode 100644 index 0000000..8dcc1b5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/AllRoomRecordsCell.m @@ -0,0 +1,223 @@ +// +// AllRoomRecordsCell.m +// QinghaiProject +// +// Created by Apple on 2024/7/6. +// + +#import "AllRoomRecordsCell.h" + +@interface AllRoomRecordsCell () + + +@property (nonatomic, strong) UIView * backView; + +@property (nonatomic, strong) UIView * typeView; + +@property (nonatomic, strong) UIImageView * doctorImg; + +@property (nonatomic, strong) UILabel * namelabel; +@property (nonatomic, strong) UILabel * typelabel; + +@property (nonatomic, strong) UILabel * introduceLabel; + +@property (nonatomic, strong) UIImageView * questionTypeImg; + +@property (nonatomic, strong) UILabel * lvlabel; + +@property (nonatomic, strong) UILabel * hospationLabel; + +@property (nonatomic, strong) UILabel * questionName; + +@property (nonatomic, strong) UILabel * questionTime; + +@property (nonatomic, strong) UIButton * questionStatusBtn; + + +@property (nonatomic, strong) UILabel * numlabel; + +@end + +@implementation AllRoomRecordsCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style + reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + self.backView.layer.cornerRadius = 15; + self.backView.layer.masksToBounds = true; + self.backView.backgroundColor = KWhiteColor; + [self.contentView addSubview:self.backView]; +// + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(18); + make.right.mas_offset(-18); + make.top.mas_offset(0); + make.bottom.mas_offset(15); + }]; +// + + self.doctorImg = [[UIImageView alloc] init]; + self.doctorImg.layer.cornerRadius = 30; + self.doctorImg.layer.masksToBounds = true; + [self.backView addSubview:self.doctorImg]; + + [self.doctorImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(15); + make.width.height.mas_offset(60); + }]; + + + self.namelabel = [[UILabel alloc] init]; + self.namelabel.textColor = CFontColor1; + self.namelabel.font = BOLDSYSTEMFONT(14); + self.namelabel.text = @"全科医生"; + self.namelabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.namelabel]; + + [self.namelabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(15); + make.top.mas_offset(22); + make.height.mas_offset(15); + }]; + [self.namelabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + + self.questionStatusBtn = [[UIButton alloc] init]; + [self.questionStatusBtn setBackgroundImage:[UIImage imageNamed:@"recordsStatusEnd"] forState:UIControlStateNormal] ; //pictureTypeIcon + self.questionStatusBtn.titleLabel.font = MEDIUMFONT(13); + [self.backView addSubview:self.questionStatusBtn ]; + + [self.questionStatusBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_offset(61); + make.height.mas_offset(26); + make.right.mas_offset(-2); + make.top.mas_offset(2); + }]; + + + + self.questionTime = [[UILabel alloc] init]; + self.questionTime.text = @"xx-xx-xx"; + self.questionTime.textColor = UIColorHex(#96A0A0); + self.questionTime.font = MEDIUMFONT(12); + self.questionTime.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.questionTime]; + + [self.questionTime mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel); + make.top.mas_equalTo(self.namelabel.mas_bottom).offset(15); + make.height.mas_offset(13); + }]; + + [self.questionTime setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + self.numlabel = [[UILabel alloc] init]; + self.numlabel.textColor = CFontColor1; + self.numlabel.font = SYSTEMFONT(10); + self.numlabel.text = @"1"; + self.numlabel.backgroundColor = UIColorHex(#21BEBD); + self.numlabel.textColor = KWhiteColor; + self.numlabel.textAlignment = NSTextAlignmentCenter; + self.numlabel.layer.cornerRadius = 6; + self.numlabel.layer.masksToBounds = true; + [self.backView addSubview:self.numlabel]; + + + + [self.numlabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.backView.mas_right).offset(-15); + make.bottom.mas_equalTo(self.doctorImg.mas_bottom); + make.height.width.mas_offset(12); + }]; + [self.namelabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(18); + make.right.mas_offset(-18); + make.top.mas_offset(15); + make.bottom.mas_equalTo(self.doctorImg.mas_bottom).offset(15); + }]; + + + +} + + +- (void)setModel:(HomeQusetionRecordsModel *)model { + _model = model; + self.numlabel.hidden = true; +// if (_model.totalCount == 0) { +// self.numlabel.hidden = true; +// }else +// { +// self.numlabel.hidden = false; +// self.numlabel.text = [NSString stringWithFormat:@"%ld",model.totalCount]; +// } + + if (ValidStr(_model.toAccountName)) { + + self.namelabel.text = @"全科医生"; + } + else + { + self.namelabel.text =[NSString stringWithFormat:@"%@",_model.toAccountName] ; + } + if ([model.contentStatus integerValue] <= 3) { //小于等于3 进行中 其他的 结束 + + + [self.questionStatusBtn setTitle:@"进行中" forState:UIControlStateNormal]; + [self.questionStatusBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.questionStatusBtn setBackgroundImage:[UIImage imageNamed:@"recordStatusIng"] forState:UIControlStateNormal] ; \ + } + if ([model.contentStatus integerValue] > 3) { //小于等于3 进行中 其他的 结束 + + [self.questionStatusBtn setTitle:@"已完成" forState:UIControlStateNormal]; + [self.questionStatusBtn setTitleColor:UIColorHex(#96A0A0) forState:UIControlStateNormal]; + [self.questionStatusBtn setBackgroundImage:[UIImage imageNamed:@"recordsStatusEnd"] forState:UIControlStateNormal] ; \ + } + + self.questionTime.text = [NSString stringWithFormat:@"%@",_model.createTime]; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.toAccountHead]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; +} + + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/QustionHomeRecordsCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/QustionHomeRecordsCell.h new file mode 100644 index 0000000..8510995 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/QustionHomeRecordsCell.h @@ -0,0 +1,20 @@ +// +// QustionHomeRecordsCell.h +// QinghaiProject +// +// Created by Apple on 2024/7/5. +// + +#import +#import "HomeQusetionRecordsModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QustionHomeRecordsCell : UITableViewCell + +@property (nonatomic, strong) HomeQusetionRecordsModel * model; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/QustionHomeRecordsCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/QustionHomeRecordsCell.m new file mode 100644 index 0000000..6299f55 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionChange/QustionHomeRecordsCell.m @@ -0,0 +1,331 @@ +// +// QustionHomeRecordsCell.m +// QinghaiProject +// +// Created by Apple on 2024/7/5. +// + +#import "QustionHomeRecordsCell.h" + +@interface QustionHomeRecordsCell () + + +@property (nonatomic, strong) UIView * backView; + +@property (nonatomic, strong) UIView * typeView; + +@property (nonatomic, strong) UIImageView * doctorImg; + +@property (nonatomic, strong) UILabel * namelabel; +@property (nonatomic, strong) UILabel * typelabel; + +@property (nonatomic, strong) UILabel * introduceLabel; + +@property (nonatomic, strong) UIImageView * questionTypeImg; + +@property (nonatomic, strong) UILabel * lvlabel; + +@property (nonatomic, strong) UILabel * hospationLabel; + +@property (nonatomic, strong) UILabel * questionName; + +@property (nonatomic, strong) UILabel * questionTime; + +@property (nonatomic, strong) UIButton * questionStatusBtn; +@end + +@implementation QustionHomeRecordsCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style + reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + self.backView.layer.cornerRadius = 15; + self.backView.layer.masksToBounds = true; + self.backView.backgroundColor = KWhiteColor; + [self.contentView addSubview:self.backView]; +// + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(18); + make.right.mas_offset(-18); + make.top.mas_offset(0); + make.bottom.mas_offset(15); + }]; +// + + self.doctorImg = [[UIImageView alloc] init]; + self.doctorImg.layer.cornerRadius = 30; + self.doctorImg.layer.masksToBounds = true; + [self.backView addSubview:self.doctorImg]; + + [self.doctorImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(15); + make.width.height.mas_offset(60); + }]; + + + self.namelabel = [[UILabel alloc] init]; + self.namelabel.textColor = CFontColor1; + self.namelabel.font = BOLDSYSTEMFONT(14); + self.namelabel.text = @"--"; + self.namelabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.namelabel]; + + [self.namelabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImg.mas_right).offset(15); + make.top.mas_offset(22); + make.height.mas_offset(15); + }]; + [self.namelabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + //类型判断 + self.typeView = [[UIView alloc] init]; + self.typeView.layer.cornerRadius = 2.5; + self.typeView.layer.masksToBounds = true; + self.typeView.backgroundColor = RGBA(7, 194, 143, 0.5); + [self.backView addSubview:self.typeView]; + + [self.typeView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel.mas_right).offset(10); + make.top.mas_offset(20); + make.height.mas_offset(18); + make.width.mas_offset(67); + }]; + + + self.questionTypeImg = [[UIImageView alloc] init]; + self.questionTypeImg.image = [UIImage imageNamed:@"videoTypeIcon"]; //pictureTypeIcon + self.questionTypeImg.size = CGSizeMake(18, 18); + self.questionTypeImg.contentMode = UIViewContentModeLeft; + [self.typeView addSubview:self.questionTypeImg ]; + + [self.questionTypeImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_offset(18); + make.left.top.mas_offset(0); + }]; + + self.questionStatusBtn = [[UIButton alloc] init]; + [self.questionStatusBtn setBackgroundImage:[UIImage imageNamed:@"recordStatusIng"] forState:UIControlStateNormal] ; //pictureTypeIcon + self.questionStatusBtn.contentMode = UIViewContentModeLeft; + self.questionStatusBtn.titleLabel.font = MEDIUMFONT(13); + [self.backView addSubview:self.questionStatusBtn ]; + + [self.questionStatusBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_offset(61); + make.height.mas_offset(26); + make.right.top.mas_offset(2); + }]; + + + self.typelabel = [[UILabel alloc] init]; + self.typelabel.text = @"图文咨询"; + self.typelabel.textColor =UIColorHex(#07C28F); + self.typelabel.font = MEDIUMFONT(10); + self.typelabel.textAlignment = NSTextAlignmentRight; + [self.typeView addSubview:self.typelabel]; + + [self.typelabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-5); + make.top.bottom.mas_equalTo(@0); + make.right.mas_equalTo(self.questionTypeImg.mas_right); + }]; + + + self.lvlabel = [[UILabel alloc] init]; + self.lvlabel.text = @""; + self.lvlabel.textColor = UIColorHex(#FF972F); + self.lvlabel.backgroundColor = UIColorHex(#FFF8ED); + self.lvlabel.layer.cornerRadius = 3.0f; + self.lvlabel.layer.masksToBounds = YES; + self.lvlabel.font = MEDIUMFONT(12); + self.lvlabel.textAlignment = NSTextAlignmentCenter; + [self.backView addSubview:self.lvlabel]; + + [self.lvlabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel.mas_left); + make.top.mas_equalTo(self.namelabel.mas_bottom).offset(19); + make.width.mas_offset(60); + make.height.mas_offset(17); + }]; + + self.hospationLabel = [[UILabel alloc] init]; + self.hospationLabel.text = @"--"; + self.hospationLabel.textColor = UIColorHex(#96A0A0); + self.hospationLabel.font = MEDIUMFONT(12); + self.hospationLabel.numberOfLines = 2; + self.hospationLabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.hospationLabel]; + + [self.hospationLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvlabel.mas_right).offset(10); + make.top.mas_equalTo(self.lvlabel.mas_top).offset(2); + make.right.mas_offset(-15); + }]; + [self.hospationLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + //新增 + + + UIView * linv = [[UIView alloc] init]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self.backView addSubview:linv]; + + [linv mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(@15); + make.right.mas_offset(-15); + make.height.mas_equalTo(@1); + make.top.mas_equalTo(self.hospationLabel.mas_bottom).offset(23); + }]; + + self.questionName = [[UILabel alloc] init]; + self.questionName.text = @"咨询人:"; + self.questionName.textColor = UIColorHex(#96A0A0); + self.questionName.font = MEDIUMFONT(12); + self.questionName.numberOfLines = 2; + self.questionName.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.questionName]; + + [self.questionName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@15); + make.top.mas_equalTo(linv.mas_bottom).offset(15); + make.height.mas_offset(13); + }]; + [self.questionName setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.questionTime = [[UILabel alloc] init]; + self.questionTime.text = @"xx-xx-xx"; + self.questionTime.textColor = UIColorHex(#96A0A0); + self.questionTime.font = MEDIUMFONT(12); + self.questionTime.textAlignment = NSTextAlignmentRight; + [self.backView addSubview:self.questionTime]; + + [self.questionTime mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-15); + make.top.mas_equalTo(linv.mas_bottom).offset(15); + make.height.mas_offset(13); + }]; + [self.questionTime setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(18); + make.right.mas_offset(-18); + make.top.mas_offset(15); + make.bottom.mas_equalTo(self.questionTime.mas_bottom).offset(16); + }]; + + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_offset(0); + make.bottom.mas_equalTo(self.backView.mas_bottom).offset(15); + }]; + +} + +- (void)setModel:(HomeQusetionRecordsModel *)model { + _model = model; + +// + if ([model.contentType integerValue] == 2) { + + self.typelabel.text = @"视频咨询"; + self.typelabel.textColor = UIColorHex(#3365DF); + self.typeView.backgroundColor = RGBA(51, 101, 223, 0.3); + self.questionTypeImg.image = [UIImage imageNamed:@"videoTypeIcon"]; //pictureTypeIcon + } + if ([model.contentType integerValue] == 1) { + + self.typelabel.text = @"图文咨询"; + self.typelabel.textColor =UIColorHex(#07C28F); + self.typeView.backgroundColor = RGBA(7, 194, 143, 0.3); + self.questionTypeImg.image = [UIImage imageNamed:@"pictureTypeIcon"]; // + } + + if ([model.contentStatus integerValue] <= 3) { //小于等于3 进行中 其他的 结束 + + + [self.questionStatusBtn setTitle:@"进行中" forState:UIControlStateNormal]; + [self.questionStatusBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.questionStatusBtn setBackgroundImage:[UIImage imageNamed:@"recordStatusIng"] forState:UIControlStateNormal] ; \ + } + if ([model.contentStatus integerValue] > 3) { //小于等于3 进行中 其他的 结束 + + [self.questionStatusBtn setTitle:@"已完成" forState:UIControlStateNormal]; + [self.questionStatusBtn setTitleColor:UIColorHex(#96A0A0) forState:UIControlStateNormal]; + [self.questionStatusBtn setBackgroundImage:[UIImage imageNamed:@"recordsStatusEnd"] forState:UIControlStateNormal] ; \ + } + if(ValidStr(_model.hospitalLevel) ) { + self.lvlabel.hidden = YES; + [self.hospationLabel mas_updateConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel); + make.top.mas_equalTo(self.namelabel.mas_bottom).offset(19); + make.right.mas_offset(-15); + }]; + [self.hospationLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + + }else + { + self.lvlabel.hidden = false; + self.lvlabel.text = _model.hospitalLevel; + + + [self.lvlabel mas_updateConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.namelabel.mas_left); + make.top.mas_equalTo(self.namelabel.mas_bottom).offset(19); + make.width.mas_offset(60); + make.height.mas_offset(17); + }]; + + [self.hospationLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvlabel.mas_right).offset(10); + make.top.mas_equalTo(self.lvlabel.mas_top).offset(2); + make.right.mas_offset(-15); + }]; + [self.hospationLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + } + + self.namelabel.text = [NSString stringWithFormat:@" %@ ",_model.toAccountName]; + + self.hospationLabel.text = [NSString stringWithFormat:@" %@ ",_model.resourceName]; + + self.questionName.text = [NSString stringWithFormat:@"咨询人:%@ ",_model.memberName]; + + self.questionTime.text = [NSString stringWithFormat:@" %@ ",_model.createTime]; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.toAccountHead]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableView.h new file mode 100644 index 0000000..2f2aec3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableView.h @@ -0,0 +1,31 @@ +// +// QuestionDiseaseTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionDiseaseInfoModel.h" +#import "QuestionDiseaseTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol questionDiseaseDelegate + +- (void)diseaseSelectedAction:(QuestionDiseaseInfoModel *)model; + +@end + +@interface QuestionDiseaseTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, strong) QuestionDiseaseInfoModel * subModel; + +@property (nonatomic, weak)id diseaseDelegate; +@property (nonatomic, weak) id peopleDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableView.m new file mode 100644 index 0000000..6d4ef29 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableView.m @@ -0,0 +1,160 @@ +// +// QuestionDiseaseTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "QuestionDiseaseTableView.h" + + +@interface QuestionDiseaseTableView () + + +@end + +@implementation QuestionDiseaseTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.scrollEnabled = false; + self.rowHeight = UITableViewAutomaticDimension; +} + + +- (void)setPeopleDelegate:(id)peopleDelegate { + _peopleDelegate = peopleDelegate; + +} + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + +- (void)setSubModel:(QuestionDiseaseInfoModel *)subModel { + + _subModel = subModel; + + [self reloadData]; + +} + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + QuestionDiseaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[QuestionDiseaseTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.model = self.dataArray[indexPath.section]; + cell.infoModel = self.subModel; + cell.peopleDelegate = self.peopleDelegate; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + diseaseModel * model = self.dataArray[indexPath.section]; + + for (diseaseModel * subModel in self.dataArray) { + + if (subModel == model) { + subModel.isSelected = !subModel.isSelected; + } + else + { + subModel.isSelected = false; + } + + } + + if ([self.diseaseDelegate respondsToSelector:@selector(diseaseSelectedAction:)]) { + + + [self.diseaseDelegate diseaseSelectedAction:self.subModel]; + + } + [self reloadData]; + + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(10); + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} +// +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + return 85; +} + + + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableViewCell.h new file mode 100644 index 0000000..67b02dd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableViewCell.h @@ -0,0 +1,28 @@ +// +// QuestionDiseaseTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionDiseaseInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol questionPeoplelistDelegate + +- (void)modficalFileAction:(diseaseModel *)model withQustionModel:(QuestionDiseaseInfoModel *)infoModel; + +@end + +@interface QuestionDiseaseTableViewCell : UITableViewCell + +@property (nonatomic, strong) diseaseModel * model; +@property (nonatomic, strong) QuestionDiseaseInfoModel * infoModel; +@property (nonatomic, assign) id peopleDelegate; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableViewCell.m new file mode 100644 index 0000000..b768a25 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionDiseaseTableViewCell.m @@ -0,0 +1,149 @@ +// +// QuestionDiseaseTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "QuestionDiseaseTableViewCell.h" + +@interface QuestionDiseaseTableViewCell () + +@property (nonatomic, strong) UIButton * chooseBtn ; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * desLabel; + +@property (nonatomic, strong) UIView * backView; + +@property (nonatomic, strong) UIButton * modficalBtn ; + +@end + +@implementation QuestionDiseaseTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; + +} + +- (void)createUI { + + self.backView = [[UIView alloc] init]; + self.backView.backgroundColor = UIColorHex(#F4F4F4); + self.backView.layer.cornerRadius = 5.0f; + self.backView.layer.masksToBounds = true; + [self.contentView addSubview:self.backView]; + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(10); + make.right.mas_offset(-10); + make.height.mas_offset(85); + make.top.mas_offset(0); + }]; + + + self.chooseBtn = [[UIButton alloc] init]; + [self.chooseBtn setImage:[UIImage imageNamed:@"choose_nomal"] forState:UIControlStateNormal]; + [self.chooseBtn setImage:[UIImage imageNamed:@"choose_Selected"] forState:UIControlStateSelected]; + self.chooseBtn.userInteractionEnabled = NO; + [self.backView addSubview:self.chooseBtn]; + + [self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(10); + make.top.mas_offset(28); + make.width.height.mas_offset(14); + }]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.text = @"感冒"; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.textColor = CFontColor1; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.chooseBtn.mas_right).offset(17); + make.top.mas_offset(15); + make.height.mas_offset(14); + make.right.mas_offset(-20); + }]; + + self.desLabel = [[UILabel alloc] init]; + self.desLabel.text = @"最近总是肚子不舒服,总是半夜肚子疼。感觉肚子有些凉,最近没有去过医院"; + self.desLabel.font = MEDIUMFONT(13); + self.desLabel.textColor = UIColorHex(#999999); + self.desLabel.textAlignment = NSTextAlignmentLeft; + self.desLabel.numberOfLines = 2; + [self.backView addSubview:self.desLabel]; + + [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel); + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(8); + make.right.mas_offset(-20); + make.bottom.mas_offset(-13); + }]; + + [self.desLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.modficalBtn = [[UIButton alloc] init]; +// [self.modficalBtn setTitle:@"修改/查看" forState:UIControlStateNormal]; + self.modficalBtn.backgroundColor = KClearColor; + [self.modficalBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [self.modficalBtn addTarget:self action:@selector(modficalAction) forControlEvents:UIControlEventTouchUpInside]; + self.modficalBtn.titleLabel.font = SYSTEMFONT(14); + [self.backView addSubview:self.modficalBtn]; + + [self.modficalBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-20); + make.top.mas_offset(0); + make.bottom.mas_offset(0); + make.left.mas_offset(50); + }]; + +} + +- (void)setModel:(diseaseModel *)model { + + _model = model; + + self.nameLabel.text = model.medicalDescribe; + + self.desLabel.text = model.recordsName; + + self.chooseBtn.selected = model.isSelected; + +} + +- (void)setInfoModel:(QuestionDiseaseInfoModel *)infoModel { + + _infoModel = infoModel; + +} + +- (void)modficalAction { + + if ([self.peopleDelegate respondsToSelector:@selector(modficalFileAction:withQustionModel:)]) { + self.model.isSelected = true; + [self.peopleDelegate modficalFileAction:self.model withQustionModel:self.infoModel]; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTable.h new file mode 100644 index 0000000..a30b39d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTable.h @@ -0,0 +1,18 @@ +// +// QuestionPeopleManagerTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionPeopleManagerTableCell.h" +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionPeopleManagerTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; +@property (nonatomic, copy) peopleModeficBlock xiugaiBlcok; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTable.m new file mode 100644 index 0000000..56ff8b9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTable.m @@ -0,0 +1,121 @@ +// +// QuestionPeopleManagerTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "QuestionPeopleManagerTable.h" +#import "QuestionPeopleManagerTableCell.h" +#import "QuestionPeopleModel.h" + +@interface QuestionPeopleManagerTable () + + +@end + +@implementation QuestionPeopleManagerTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return self.dataArray.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + QuestionPeopleModel * model = self.dataArray[indexPath.row]; + + static NSString * cellID = @"cellID"; + + QuestionPeopleManagerTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[QuestionPeopleManagerTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.backgroundColor = KWhiteColor; + cell.model = model; + cell.xiugaiBlock = self.xiugaiBlcok; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + QuestionPeopleModel * model = self.dataArray[indexPath.row]; + model.isSelected = !model.isSelected; +// for (QuestionPeopleModel * subModel in self.dataArray) { +// +// if (subModel == model) { +// subModel.isSelected = true; +// }else +// { +// subModel.isSelected = false; +// } +// +// } + [self reloadData]; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + + + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTableCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTableCell.h new file mode 100644 index 0000000..edaa9d6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTableCell.h @@ -0,0 +1,22 @@ +// +// QuestionPeopleManagerTableCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionPeopleModel.h" + +typedef void(^peopleModeficBlock)(QuestionPeopleModel * _Nullable model ); + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionPeopleManagerTableCell : UITableViewCell + +@property (nonatomic, strong) QuestionPeopleModel * model; + +@property (nonatomic, copy) peopleModeficBlock xiugaiBlock; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTableCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTableCell.m new file mode 100644 index 0000000..f044f32 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionPeopleManagerTableCell.m @@ -0,0 +1,138 @@ +// +// QuestionPeopleManagerTableCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "QuestionPeopleManagerTableCell.h" + + +@interface QuestionPeopleManagerTableCell () + +@property (nonatomic, strong) UIButton * chooseBtn; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * infoLabel; + +@property (nonatomic, strong) UIButton * xiugaiBtn; + +@end + +@implementation QuestionPeopleManagerTableCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.chooseBtn = [[UIButton alloc] init]; + [self.chooseBtn setImage:[UIImage imageNamed:@"choose_nomal"] forState:UIControlStateNormal]; + [self.chooseBtn setImage:[UIImage imageNamed:@"choose_Selected"] forState:UIControlStateSelected]; + self.chooseBtn.userInteractionEnabled = NO; + [self.contentView addSubview:self.chooseBtn]; + + [self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(30); + make.top.mas_offset(28); + make.width.height.mas_offset(14); + }]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.text = @"--"; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.textColor = CFontColor1; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.chooseBtn.mas_right).offset(17); + make.top.mas_offset(15); + make.height.mas_offset(14); + make.right.mas_offset(-20); + }]; + + self.infoLabel = [[UILabel alloc] init]; + self.infoLabel.text = @"--"; + self.infoLabel.font = MEDIUMFONT(14); + self.infoLabel.textColor = UIColorHex(#999999); + self.infoLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.infoLabel]; + + [self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel); + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(15); + make.height.mas_offset(14); + make.right.mas_offset(-20); + }]; + + UIView * linv = [[UIView alloc] init]; + linv.backgroundColor = UIColorHex(#EEEEEE); + [self.contentView addSubview:linv]; + + [linv mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@15); + make.top.mas_equalTo(self.infoLabel.mas_bottom).offset(24); + make.height.mas_offset(1); + make.right.mas_offset(-15); + make.bottom.mas_offset(1); + }]; + + self.xiugaiBtn = [[UIButton alloc] init]; + [self.xiugaiBtn setImage:[UIImage imageNamed:@"peoplexiugai"] forState:UIControlStateNormal]; + [self.xiugaiBtn addTarget:self action:@selector(xiugaiAction) forControlEvents:UIControlEventTouchUpInside]; + [self.contentView addSubview:self.xiugaiBtn]; + + [self.xiugaiBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(@26); + make.width.height.mas_offset(22); + make.right.mas_offset(-30); + }]; + +} + +- (void)setModel:(QuestionPeopleModel *)model { + + _model = model; + + self.nameLabel.text = _model.name; + + NSString * sex = [_model.gender integerValue] == 1 ? @"女":@"男"; + + NSString * birthday = @""; + if (!ValidStr(_model.birthday)) { + + birthday = [_model.birthday substringToIndex:10]; + } + self.infoLabel.text = [NSString stringWithFormat:@"%@/%@岁  %@",sex,_model.age,birthday]; + + self.chooseBtn.selected = _model.isSelected; + +} + +- (void)xiugaiAction { + + if (self.xiugaiBlock) { + self.xiugaiBlock(_model); + } +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecordTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecordTableViewCell.h new file mode 100644 index 0000000..359c912 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecordTableViewCell.h @@ -0,0 +1,19 @@ +// +// QuestionRecordTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import +#import "RecordIMListDateModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionRecordTableViewCell : UITableViewCell + +@property (nonatomic, strong) RecordIMListDateModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecordTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecordTableViewCell.m new file mode 100644 index 0000000..fbd47f7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecordTableViewCell.m @@ -0,0 +1,288 @@ +// +// QuestionRecordTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QuestionRecordTableViewCell.h" + +@interface QuestionRecordTableViewCell () + +@property (nonatomic, strong) UIImageView * doctorImage; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * lvLabel; + +@property (nonatomic, strong) UILabel * hospitalLabel; + +@property (nonatomic, strong) UILabel * typeLabel; + +@property (nonatomic, strong) UILabel * peopleLabel; + +@property (nonatomic, strong) UILabel * statusLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@end + +@implementation QuestionRecordTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + + } + + return self; + +} + +- (void)createUI { + + UIView * backView = [[UIView alloc] init]; + backView.backgroundColor = KWhiteColor; + backView.layer.cornerRadius = 10.0; + backView.layer.masksToBounds = true; + [self.contentView addSubview:backView]; + [backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(0); + make.right.mas_offset(-15); + make.bottom.mas_offset(-14); + }]; + + self.doctorImage = [[UIImageView alloc] init]; + self.doctorImage.layer.cornerRadius = 25.0f; + self.doctorImage.layer.masksToBounds = YES; + [backView addSubview:self.doctorImage]; + + [self.doctorImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(11); + make.top.mas_offset(15); + make.height.width.mas_offset(50); + }]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.text = @"张大夫"; + self.nameLabel.font = SYSTEMFONT(14); + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [backView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.doctorImage.mas_right).offset(9); + make.top.mas_offset(15); + make.height.mas_offset(14); + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.statusLabel = [[UILabel alloc] init]; + self.statusLabel.text = @""; + self.statusLabel.font = MEDIUMFONT(14); + self.statusLabel.textColor = UIColorHex(#16C716); + self.statusLabel.textAlignment = NSTextAlignmentRight; + [backView addSubview:self.statusLabel]; + + [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(37); + make.right.mas_offset(-14); + make.height.mas_offset(14); + make.width.mas_offset(70); + }]; + + self.lvLabel = [[UILabel alloc] init]; + self.lvLabel.text = @"三甲"; + self.lvLabel.font = SYSTEMFONT(10); + self.lvLabel.textColor = KWhiteColor; + self.lvLabel.backgroundColor = UIColorHex(#21BEBD); + self.lvLabel.textAlignment = NSTextAlignmentCenter; + self.lvLabel.layer.cornerRadius = 3.0f; + self.lvLabel.layer.masksToBounds = YES; + [backView addSubview:self.lvLabel]; + + [self.lvLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(10); + make.left.mas_equalTo(self.nameLabel.mas_left); + make.height.mas_offset(13); + }]; + [self.lvLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.hospitalLabel = [[UILabel alloc] init]; + self.hospitalLabel.font = MEDIUMFONT(13); + self.hospitalLabel.textColor =UIColorHex(#333333); + self.hospitalLabel.textAlignment = NSTextAlignmentCenter; + [backView addSubview:self.hospitalLabel]; + + [self.hospitalLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(10); + make.left.mas_equalTo(self.lvLabel.mas_right).offset(5); + make.height.mas_offset(13); + }]; + [self.hospitalLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + UIView * linv = [[UIView alloc] init]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [backView addSubview:linv]; + + [linv mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.doctorImage.mas_bottom).offset(16); + make.left.right.mas_equalTo(@0); + make.height.mas_offset(1); + }]; + + self.typeLabel = [[UILabel alloc] init]; + self.typeLabel.font = MEDIUMFONT(11); +// self.typeLabel.textColor =UIColorHex(#21BEBD); +// self.typeLabel.layer.cornerRadius = 5.0f; +// self.typeLabel.layer.masksToBounds = YES; +// self.typeLabel.layer.borderWidth = 1.0f; + self.typeLabel.layer.borderColor = UIColorHex(#21BEBD).CGColor; + self.typeLabel.textAlignment = NSTextAlignmentCenter; + self.typeLabel.text = @""; + [backView addSubview:self.typeLabel]; + + [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(linv.mas_bottom).offset(18); + make.right.mas_equalTo(@-11); + make.height.mas_offset(21); + make.width.mas_offset(85); + }]; + + self.peopleLabel = [[UILabel alloc] init]; + self.peopleLabel.font = MEDIUMFONT(13); + self.peopleLabel.numberOfLines = 0; + self.peopleLabel.textColor = UIColorHex(#333333); + self.peopleLabel.textAlignment = NSTextAlignmentLeft; + [backView addSubview:self.peopleLabel]; + + [self.peopleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(linv.mas_bottom).offset(16); + make.left.mas_equalTo(@15); + make.right.mas_equalTo(self.typeLabel.mas_left).offset(8); + make.height.mas_offset(12); + }]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.font = MEDIUMFONT(13); + self.timeLabel.numberOfLines = 0; + self.timeLabel.textColor = UIColorHex(#333333); + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [backView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.peopleLabel.mas_bottom).offset(10); + make.left.mas_equalTo(@15); + make.right.mas_equalTo(self.typeLabel.mas_left).offset(8); + make.height.mas_offset(12); + }]; + + + [backView mas_updateConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(0); + make.right.mas_offset(-15); + make.bottom.mas_equalTo(self.timeLabel.mas_bottom).offset(14); + }]; + + + +} + +- (void)setModel:(RecordIMListDateModel *)model { + + _model = model; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.toAccountHead]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"doctorNoImage")]; + + self.nameLabel.attributedText = [HQCommonUtils firstString:_model.toAccountName firstColor:UIColorHex(#333333) firstSize:14 secondString:[NSString stringWithFormat:@" %@",_model.toAccountTitle] secondColor:UIColorHex(#333333) secondSize:13 thirdString:[NSString stringWithFormat:@" %@",_model.departmentName] thirdColor:UIColorHex(#333333) thirdSize:13]; + + if(ValidStr(_model.hospitalLevel) ) { + self.lvLabel.hidden = YES; + + }else + { + self.lvLabel.hidden = false; + self.lvLabel.text = [NSString stringWithFormat:@" %@ ", _model.hospitalLevel] ; + } + self.hospitalLabel.text = [NSString stringWithFormat:@" %@ ", _model.resourceName] ; + if (ValidStr(_model.departmentName)) { + + _model.departmentName = @""; + + } + self.peopleLabel.text = [NSString stringWithFormat:@"就诊人:%@",_model.memberName]; + self.timeLabel.text = [NSString stringWithFormat:@"%@",_model.createTime]; +// if ([_model.contentType integerValue] == 1) { +// self.typeLabel.text = @"图文咨询"; +// } +// if ([_model.contentType integerValue] == 2) { +// self.typeLabel.text = @"音视频咨询"; +// } + + if ([_model.contentType integerValue] == 1) + { + if ([_model.contentStatus integerValue] == 3 && _model.unredCount > 0) + { + self.statusLabel.text = @"待回复"; + }else + { + self.statusLabel.text = @""; + } + }else + { + if ([_model.contentStatus integerValue] == 1) { + self.statusLabel.text = @"待确认"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.contentStatus integerValue] == 2) { + self.statusLabel.text = @"待开始"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.contentStatus integerValue] == 3) { + self.statusLabel.text = @"已开始"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.contentStatus integerValue] == 4) { + self.statusLabel.text = @"待评价"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.contentStatus integerValue] == 5) { + self.statusLabel.text = @"已完成"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.contentStatus integerValue] == 6) { + self.statusLabel.text = @"拒绝"; + self.statusLabel.textColor = UIColorHex(#16C716); + } + if ([_model.contentStatus integerValue] == 7) { + self.statusLabel.text = @"取消"; + self.statusLabel.textColor = CFontColor2; + } + } + + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecoredTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecoredTable.h new file mode 100644 index 0000000..0e33b9c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecoredTable.h @@ -0,0 +1,25 @@ +// +// QuestionRecoredTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import +#import "RecordIMListDateModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookDetailBlock)(NSString * recordID,NSString * imID,NSString * memberId, RecordIMListDateModel * model); + +@interface QuestionRecoredTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) lookDetailBlock detailBlock; + +@property (nonatomic, assign) NSInteger totalCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecoredTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecoredTable.m new file mode 100644 index 0000000..22fe184 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/QuestionRecordView(咨询view)/QuestionRecoredTable.m @@ -0,0 +1,134 @@ +// +// QuestionRecoredTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/28. +// + +#import "QuestionRecoredTable.h" +#import "QuestionRecordTableViewCell.h" + +@interface QuestionRecoredTable () + + +@end + + +@implementation QuestionRecoredTable + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.backgroundColor = UIColor.clearColor; + self.showsVerticalScrollIndicator = false; + self.showsHorizontalScrollIndicator = false; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + + [self reloadData]; +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 1; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + QuestionRecordTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[QuestionRecordTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.model= self.dataArray[indexPath.section]; + cell.backgroundColor = KClearColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + + + +} +//每行高度 +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +//{ +// return kRealValue(77); +//} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(5); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +//组头 --- 组尾 + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + + return [UIView new]; + +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + + UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + + + return footerView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + RecordIMListDateModel * model= self.dataArray[indexPath.section]; + + if (self.detailBlock) { + self.detailBlock(model.Record_id,model.imId,model.memberId,model); + } +} + + +@end + + + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionFirstTableCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionFirstTableCell.h new file mode 100644 index 0000000..fd2a2a3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionFirstTableCell.h @@ -0,0 +1,18 @@ +// +// SelectedQuestionFirstTableCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionDiseaseInfoModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface SelectedQuestionFirstTableCell : UITableViewCell + +@property (nonatomic, strong) QuestionDiseaseInfoModel * userModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionFirstTableCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionFirstTableCell.m new file mode 100644 index 0000000..4c0475f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionFirstTableCell.m @@ -0,0 +1,140 @@ +// +// SelectedQuestionFirstTableCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "SelectedQuestionFirstTableCell.h" + +@interface SelectedQuestionFirstTableCell () + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * ageLabel; + +@property (nonatomic, strong) UIImageView * sexImage; + +@property (nonatomic, strong) UILabel * infoLabel; + +@end + +@implementation SelectedQuestionFirstTableCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.text = @"--"; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(21); + make.height.mas_offset(13); + + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + self.ageLabel = [[UILabel alloc] init]; + self.ageLabel.font = MEDIUMFONT(14); + self.ageLabel.text = @"-- 岁"; + self.ageLabel.textColor = UIColorHex(#999999); + self.ageLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.ageLabel]; + + [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel.mas_right).offset(9); + make.top.mas_offset(22); + make.height.mas_offset(13); + + }]; + [self.ageLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + self.sexImage = [[UIImageView alloc] init]; + self.sexImage.image = [UIImage imageNamed:@"MasculineMark"]; + self.sexImage.contentMode = UIViewContentModeScaleAspectFit; + [self.contentView addSubview:self.sexImage]; + + [self.sexImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.ageLabel.mas_right).offset(9); + make.top.mas_offset(22); + make.width.mas_offset(14); + make.height.mas_offset(16); + + }]; + + self.infoLabel = [[UILabel alloc] init]; + self.infoLabel.font = MEDIUMFONT(14); + self.infoLabel.text = @"172cm / 80kg"; + self.infoLabel.textColor = UIColorHex(#999999); + self.infoLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.infoLabel]; + + [self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-17); + make.top.mas_offset(19); + make.height.mas_offset(16); + + }]; + + [self.infoLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + UIView * linv = [[UIView alloc] init]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self.contentView addSubview:linv]; + + [linv mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.left.mas_equalTo(@0); + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(16); + make.height.mas_offset(1); + }]; + +} + +- (void)setUserModel:(QuestionDiseaseInfoModel *)userModel { + + _userModel = userModel; + + self.nameLabel.text = userModel.name; + + self.ageLabel.text = [NSString stringWithFormat:@"%@岁",userModel.age]; + + if ([userModel.gender integerValue] == 2) { + self.sexImage.image = [UIImage imageNamed:@"MasculineMark"]; + } + if ([userModel.gender integerValue] == 1) { + self.sexImage.image = [UIImage imageNamed:@"FeminineSymbol"]; + } + + self.infoLabel.text = [NSString stringWithFormat:@"%@cm/%@kg",userModel.height,userModel.weight]; + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTableView.h new file mode 100644 index 0000000..df84af3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTableView.h @@ -0,0 +1,24 @@ +// +// SelectedQuestionTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionAddPeopleTableCell.h" +#import "SelectedQuestionTypeTableCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SelectedQuestionTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, weak)id addDelegate; +@property (nonatomic, weak)id diseaseDelegate; +@property (nonatomic, weak) id peopleDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTableView.m new file mode 100644 index 0000000..da433e1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTableView.m @@ -0,0 +1,270 @@ +// +// SelectedQuestionTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "SelectedQuestionTableView.h" +#import "SelectedQuestionFirstTableCell.h" +#import "SelectedQuestionTypeTableCell.h" +#import "QuestionDiseaseInfoModel.h" + + +@interface SelectedQuestionTableView () + + +@end + +@implementation SelectedQuestionTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + + + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + +- (void)setAddDelegate:(id)addDelegate { + + _addDelegate = addDelegate; + +} + +- (void)setDiseaseDelegate:(id)diseaseDelegate { + _diseaseDelegate = diseaseDelegate; + +} + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 3; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + QuestionDiseaseInfoModel * model = self.dataArray[indexPath.section]; + + if (indexPath.row == 0) { + return 50; + } + if (indexPath.row == 1) { + + return model.rowHeight; + } + if (indexPath.row == 2) { + return 48; + } + return 50; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + if (indexPath.row == 0 ) { + + SelectedQuestionFirstTableCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[SelectedQuestionFirstTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + + cell.userModel = self.dataArray[indexPath.section]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + } + + if (indexPath.row == 1 ) { + + SelectedQuestionTypeTableCell * typeCell = [tableView dequeueReusableCellWithIdentifier:@"DISID"]; + + if (!typeCell) { + + typeCell = [[SelectedQuestionTypeTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DISID"]; + } + typeCell.dataArray = [self.dataArray[indexPath.section] list]; + typeCell.subModel = self.dataArray[indexPath.section]; + typeCell.selectionStyle = UITableViewCellSelectionStyleNone; + typeCell.diseaseDelegate = self.diseaseDelegate; + typeCell.peopleDelegate = self.peopleDelegate; + return typeCell; + } + + + if (indexPath.row == 2 ) { + + QuestionAddPeopleTableCell * cell = [tableView dequeueReusableCellWithIdentifier:@"ADDCELLID"]; + + if (!cell) { + + cell = [[QuestionAddPeopleTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ADDCELLID"]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.userModel = self.dataArray[indexPath.section]; + cell.addDelegate = self.addDelegate; + return cell; + } + return nil; +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return kRealValue(10); +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + sectionHeardView.backgroundColor = UIColorHex(#F4F4F4); + return sectionHeardView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + +- (void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath + +{ + + if([cell respondsToSelector:@selector(tintColor)]) { + + if(tableView ==self) { + + CGFloat cornerRadius =5.f; + + cell.backgroundColor=UIColor.clearColor; + + CAShapeLayer * layer = [[CAShapeLayer alloc]init]; + + CGMutablePathRef pathRef = CGPathCreateMutable(); + + CGRect bounds = CGRectInset(cell.bounds,0,0); + + BOOL addLine =NO; + + if(indexPath.row==0&& indexPath.row== [tableView numberOfRowsInSection:indexPath.section]-1) { + + CGPathAddRoundedRect(pathRef,nil, bounds, cornerRadius, cornerRadius); + + }else if(indexPath.row==0) { + + CGPathMoveToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMaxY(bounds)); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMinY(bounds),CGRectGetMidX(bounds),CGRectGetMinY(bounds), cornerRadius); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMinY(bounds),CGRectGetMaxX(bounds),CGRectGetMidY(bounds), cornerRadius); + + CGPathAddLineToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMaxY(bounds)); + + addLine =YES; + + }else if(indexPath.row== [tableView numberOfRowsInSection:indexPath.section]-1) { + + CGPathMoveToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMinY(bounds)); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMinX(bounds),CGRectGetMaxY(bounds),CGRectGetMidX(bounds),CGRectGetMaxY(bounds), cornerRadius); + + CGPathAddArcToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMaxY(bounds),CGRectGetMaxX(bounds),CGRectGetMidY(bounds), cornerRadius); + + CGPathAddLineToPoint(pathRef,nil,CGRectGetMaxX(bounds),CGRectGetMinY(bounds)); + + }else{ + + CGPathAddRect(pathRef,nil, bounds); + + addLine =YES; + + } + + layer.path= pathRef; + + CFRelease(pathRef); + + layer.fillColor= [UIColor colorWithWhite:1.f alpha:0.8f].CGColor; + + if(addLine ==YES) { + + CALayer* lineLayer = [[CALayer alloc]init]; + + CGFloat lineHeight = (1.f/ [UIScreen mainScreen].scale); + + lineLayer.frame=CGRectMake(CGRectGetMinX(bounds)+10, bounds.size.height-lineHeight, bounds.size.width-10, lineHeight); + + lineLayer.backgroundColor= tableView.separatorColor.CGColor; + + [layer addSublayer:lineLayer]; + + } + + UIView*testView = [[UIView alloc]initWithFrame:bounds]; + + [testView.layer insertSublayer:layer atIndex:0]; + + testView.backgroundColor=UIColor.clearColor; + + cell.backgroundView= testView; + + } + + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTypeTableCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTypeTableCell.h new file mode 100644 index 0000000..781b531 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTypeTableCell.h @@ -0,0 +1,23 @@ +// +// SelectedQuestionTypeTableCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import +#import "QuestionDiseaseTableView.h" +#import "QuestionDiseaseInfoModel.h" +#import "QuestionDiseaseTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SelectedQuestionTypeTableCell : UITableViewCell +@property (nonatomic, strong) QuestionDiseaseInfoModel * subModel; +@property (nonatomic, strong) NSArray * dataArray; +@property (nonatomic, weak)id diseaseDelegate; +@property (nonatomic, weak) id peopleDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTypeTableCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTypeTableCell.m new file mode 100644 index 0000000..d23b9e1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/SelectedQuestionTypeTableCell.m @@ -0,0 +1,79 @@ +// +// SelectedQuestionTypeTableCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/14. +// + +#import "SelectedQuestionTypeTableCell.h" + +@interface SelectedQuestionTypeTableCell () + +@property (nonatomic, strong) QuestionDiseaseTableView * tableView; + +@end + +@implementation SelectedQuestionTypeTableCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + self.tableView = [[QuestionDiseaseTableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + self.tableView.backgroundColor = [UIColor whiteColor]; + [self.contentView addSubview:self.tableView]; + + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(0); + make.right.mas_offset(0); + make.top.mas_offset(0); + make.bottom.mas_offset(5); + }]; +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + + self.tableView.dataArray = _dataArray; +} + +- (void)setDiseaseDelegate:(id)diseaseDelegate { + _diseaseDelegate = diseaseDelegate; + + self.tableView.diseaseDelegate = _diseaseDelegate; +} + +- (void)setPeopleDelegate:(id)peopleDelegate { + _peopleDelegate = peopleDelegate; + self.tableView.peopleDelegate = _peopleDelegate; +} + +- (void)setSubModel:(QuestionDiseaseInfoModel *)subModel { + _subModel = subModel; + self.tableView.subModel = _subModel; + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/UserInfoHealthPopView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/UserInfoHealthPopView.h new file mode 100644 index 0000000..b6d6874 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/UserInfoHealthPopView.h @@ -0,0 +1,28 @@ +// +// UserInfoHealthPopView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + + +@protocol userInfoPopDelegate + +- (void)jumpOnclick; + +- (void)wanshanOnclick; + +@end + +@interface UserInfoHealthPopView : UIView + +@property (nonatomic, weak)id popDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/UserInfoHealthPopView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/UserInfoHealthPopView.m new file mode 100644 index 0000000..a3ab04e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/UserInfoHealthPopView.m @@ -0,0 +1,88 @@ +// +// UserInfoHealthPopView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/21. +// + +#import "UserInfoHealthPopView.h" + +@implementation UserInfoHealthPopView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.backgroundColor = RGBA(0, 0, 0, 0.5); + + UIView * cenetrView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(57), kRealValue(230), kScreenWidth - kRealValue(114), kRealValue(140))]; + cenetrView.backgroundColor = KWhiteColor; + cenetrView.layer.cornerRadius = 10; + cenetrView.layer.masksToBounds = YES; + [self addSubview:cenetrView]; + + UILabel * popLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(40), cenetrView.width, 14)]; + popLabel.text = @"是否继续完善个人基本健康信息?"; + popLabel.font = BOLDSYSTEMFONT(14); + popLabel.textColor = UIColorHex(#333333); + popLabel.textAlignment = NSTextAlignmentCenter; + [cenetrView addSubview:popLabel]; + + UIButton * jumpBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, cenetrView.height - 48 , cenetrView.width/2, 48)]; + [jumpBtn setTitle:@"跳过" forState:UIControlStateNormal]; + [jumpBtn setTitleColor:UIColorHex(#666666) forState:UIControlStateNormal]; + [jumpBtn addTarget:self action:@selector(jumpAction) forControlEvents:UIControlEventTouchUpInside]; + jumpBtn.titleLabel.font = MEDIUMFONT(13); + [cenetrView addSubview:jumpBtn]; + + UIButton * wanshanBtn = [[UIButton alloc] initWithFrame:CGRectMake(cenetrView.width/2, cenetrView.height - 48 , cenetrView.width/2, 48)]; + [wanshanBtn setTitle:@"去完善" forState:UIControlStateNormal]; + [wanshanBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + wanshanBtn.titleLabel.font = BOLDSYSTEMFONT(13); + [wanshanBtn addTarget:self action:@selector(wanshanAction) forControlEvents:UIControlEventTouchUpInside]; + [cenetrView addSubview:wanshanBtn]; + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(0, jumpBtn.top, cenetrView.width, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [cenetrView addSubview:linv]; + + UIView * cowLinv = [[UIView alloc] initWithFrame:CGRectMake(cenetrView.width/2, jumpBtn.top, 1, 48)]; + cowLinv.backgroundColor = UIColorHex(#E0E0E0); + [cenetrView addSubview:cowLinv]; + +} + +- (void)jumpAction { + + if ([self.popDelegate respondsToSelector:@selector(jumpOnclick)]) { + + [self.popDelegate jumpOnclick]; + } + +} + +- (void)wanshanAction { + + if ([self.popDelegate respondsToSelector:@selector(wanshanOnclick)]) { + + [self.popDelegate wanshanOnclick]; + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/evaluationPopView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/evaluationPopView.h new file mode 100644 index 0000000..b5501d4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/evaluationPopView.h @@ -0,0 +1,21 @@ +// +// evaluationPopView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^evaluationPop)(CGFloat starNumber, BOOL isSecrect, NSString * evaluationString); + +@interface evaluationPopView : UIView + +@property (nonatomic, copy) evaluationPop popBlock; +@property (nonatomic, strong) UIView * evaluationView; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/evaluationPopView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/evaluationPopView.m new file mode 100644 index 0000000..ec7feb1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/evaluationPopView.m @@ -0,0 +1,147 @@ +// +// evaluationPopView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/20. +// + +#import "evaluationPopView.h" +#import "FSXBStarRateView.h" +#import "UIPlaceHolderTextView.h" + +@interface evaluationPopView () + +@property (nonatomic,strong)UIPlaceHolderTextView * evaluationTextView; + +@property (nonatomic, assign) BOOL isSercet; + +@property (nonatomic, copy) NSString * evaluationString; + +@property (nonatomic, assign) CGFloat starNumber; + + +@end + +@implementation evaluationPopView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + UIView * backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + + backView.backgroundColor = RGBA(0, 0, 0, 0.5); + + [self addSubview:backView]; + + UIView * tapView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kRealValue(327))]; + [tapView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]]; + [backView addSubview:tapView]; + + UIView * evalView = [[UIView alloc] init]; + evalView.frame = CGRectMake(0, kScreenHeight - kRealValue(327), kScreenWidth, kRealValue(327)); + evalView.backgroundColor = KWhiteColor; + evalView.transform = CGAffineTransformMakeTranslation(0, kRealValue(327)); + self.evaluationView = evalView; + [evalView clipCornerWithView:evalView andTopLeft:YES andTopRight:YES andBottomLeft:NO andBottomRight:NO]; + [backView addSubview:evalView]; + + //让view从上往下消失 + [UIView animateWithDuration:0.5 animations:^{ + evalView.transform = CGAffineTransformMakeTranslation(0,0); + } completion:^(BOOL finished) { + }]; + + UILabel * evTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(21), evalView.width, kRealValue(14))]; + evTitleLabel.text = @"综合评分"; + evTitleLabel.font = SYSTEMFONT(14); + evTitleLabel.textAlignment = NSTextAlignmentCenter; + [evalView addSubview:evTitleLabel]; + + FSXBStarRateView * starView = [[FSXBStarRateView alloc] initWithFrame:CGRectMake(kRealValue(80), evTitleLabel.bottom + kRealValue(24), kScreenWidth - kRealValue(160), kRealValue(25)) numberOfStars:5 rateStyle:HalfStar isAnination:YES finish:^(CGFloat currentScore) { + NSLog(@"%.2f",currentScore); + self.starNumber = currentScore; + }]; + + starView.enable = YES; + [evalView addSubview:starView]; + + self.evaluationTextView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(15), starView.bottom + kRealValue(20), kScreenWidth - kRealValue(30), kRealValue(120))]; + self.evaluationTextView.placeholder = @"请对本次的服务进行评价,用一段话来说下感受。您的评价可以给更多的人参考"; + self.evaluationTextView.backgroundColor = RGBA(243, 243, 245, 1); + self.evaluationTextView.delegate = self; + self.evaluationTextView.layer.cornerRadius = 10.0f; + self.evaluationTextView.font = SYSTEMFONT(13); + [evalView addSubview:self.evaluationTextView]; + + UIButton * chooseBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(15), self.evaluationTextView.bottom + kRealValue(10), 80, 13)]; + [chooseBtn setImage:[UIImage imageNamed:@"popChoose_normal"] forState:UIControlStateNormal]; + [chooseBtn setImage:[UIImage imageNamed:@"popChoose_selected"] forState:UIControlStateSelected]; + [chooseBtn setTitle:@" 匿名评价" forState:UIControlStateNormal]; + [chooseBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + [chooseBtn addTarget:self action:@selector(secretEvaluation:) forControlEvents:UIControlEventTouchUpInside]; + chooseBtn.titleLabel.font = SYSTEMFONT(12); + [evalView addSubview:chooseBtn]; + + UIButton * submitBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(47), evalView.height - kRealValue(60) , kScreenWidth - kRealValue(94), kRealValue(40))]; + submitBtn.backgroundColor = RGBA(33, 190, 189, 1); + submitBtn.layer.cornerRadius = 20; + submitBtn.layer.masksToBounds = true; + [submitBtn setTitle:@"提交" forState:UIControlStateNormal]; + [submitBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + submitBtn.titleLabel.font = MEDIUMFONT(14); + [submitBtn addTarget:self action:@selector(submitAction) forControlEvents:UIControlEventTouchUpInside]; + [evalView addSubview:submitBtn]; + +} + +- (void)secretEvaluation:(UIButton *)secretBtn { + + secretBtn.selected = !secretBtn.selected; + + self.isSercet = secretBtn.selected; + +} + +- (void)submitAction { + + if (self.starNumber <= 0) { + + [EasyTextView showText:@"请打分后提交"]; + return; + } + self.evaluationString = self.evaluationTextView.text; + if (ValidStr(self.evaluationString)) { + [EasyTextView showText:@"请输入您的评语后提交"]; + return; + } + self.popBlock(self.starNumber, self.isSercet, self.evaluationString); + +} + +- (void)tap:(UITapGestureRecognizer *)recognizer +{ + + [self removeFromSuperview]; +} + +- (void)textViewDidChange:(UITextView *)textView { + + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/BasicHealthTable.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/BasicHealthTable.h new file mode 100644 index 0000000..b614386 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/BasicHealthTable.h @@ -0,0 +1,19 @@ +// +// BasicHealthTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^footSaveActionBlcok)(NSArray * array); + +@interface BasicHealthTable : UITableView +@property (nonatomic, strong) NSArray * dataArray; +@property (nonatomic, copy) footSaveActionBlcok saveBlock; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/BasicHealthTable.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/BasicHealthTable.m new file mode 100644 index 0000000..0be9f27 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/BasicHealthTable.m @@ -0,0 +1,237 @@ +// +// BasicHealthTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import "BasicHealthTable.h" +#import "HealthTypeOneTableViewCell.h" +#import "HealthTypeTwoTableViewCell.h" +#import "QuestionOptionModel.h" +@interface BasicHealthTable () + + +@end + +@implementation BasicHealthTable + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + self.tableFooterView = [self createFootView]; +} + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + QuestionOptionModel * model = self.dataArray[section]; + + return model.childList.count; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + QuestionOptionModel * model = self.dataArray[indexPath.section]; + + QuestionOptionChildListModel * childModel = model.childList[indexPath.row]; + + if ([childModel.itemType isEqualToString:@"1"] || [childModel.itemType isEqualToString:@"2"] ) { + + HealthTypeOneTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"HEALTHONE"] ; + + if (!cell) { + + cell = [[HealthTypeOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HEALTHONE"]; + } + cell.model = childModel; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + } + + if ([childModel.itemType isEqualToString:@"4"]) { +// QuestionOptionModel * model = self.dataArray[section]; + +// return model.childList.count; + HealthTypeTwoTableViewCell * oneCell = [tableView dequeueReusableCellWithIdentifier:@"HEALTHTWO"] ; + + if (!oneCell) { + + oneCell = [[HealthTypeTwoTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HEALTHTWO"]; + } + oneCell.selectionStyle = UITableViewCellSelectionStyleNone; + oneCell.model = childModel; + oneCell.changeBlock = ^(QuestionOptionChildListModel * _Nonnull model) { + [self beginUpdates]; + [self endUpdates]; + + }; + + if (indexPath.row == model.childList.count -1) { + oneCell.isHideLine = true; + }else + { + oneCell.isHideLine = false; + } + + return oneCell; + } + + + return UITableViewCell.new; + +} + + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + QuestionOptionModel * model = self.dataArray[indexPath.section]; + + QuestionOptionChildListModel * childModel = model.childList[indexPath.row]; + + NSArray * array = [childModel.itemOptions componentsSeparatedByString:@","]; + + if ([childModel.itemType isEqualToString:@"4"]) { + + if (childModel.cellHeight <= 0) { + return array.count * (32 + kRealValue(15)) + childModel.cellHeight + kRealValue(15); + }else + { + return childModel.cellHeight; + } + + + }else{ + + if (array.count%2 == 0) + { + + return kRealValue(10) + array.count/2 * 35 + kRealValue(15) ; + + }else + { + return kRealValue(10) + (array.count/2 + 1) * 35 + kRealValue(15) ; + } + } + + + return kRealValue(100); +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + +} + +-(CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return kRealValue(45); +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(45))]; + + hearView.backgroundColor = UIColorHex(#EFEFEF); + + QuestionOptionModel * model = self.dataArray[section]; + + UILabel * labe = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), 0, 200, kRealValue(45))]; + labe.text = model.text; + labe.textColor = UIColorHex(#333333); + labe.font = BOLDSYSTEMFONT(16); + labe.textAlignment = NSTextAlignmentLeft; + [hearView addSubview:labe]; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + +- (UIView *)createFootView { + + UIView * footView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)]; + + UILabel * tishiLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(20) , kScreenWidth - kRealValue(30), 30)]; + + + tishiLabel.text = @"温馨提示:咨询人姓名、证件信息用于平台审核,不会外传。请输入正确的咨询人姓名和证件号码。"; + tishiLabel.numberOfLines = 0; + tishiLabel.font = SYSTEMFONT(12); + tishiLabel.textColor = UIColorHex(#999999); + CGFloat h = [HQCommonUtils getSpaceLabelHeight:tishiLabel withStr:tishiLabel.text withFont: SYSTEMFONT(12) withWidth:kScreenWidth withLineSpacing:2]; + tishiLabel.height = h ; + [footView addSubview:tishiLabel]; + //保存按钮 + + UIButton * saveBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(48), tishiLabel.bottom + 60 , kScreenWidth - kRealValue(96), 40)]; + [saveBtn setTitle:@"保存" forState:UIControlStateNormal]; + saveBtn.titleLabel.font = SYSTEMFONT(14); + saveBtn.layer.cornerRadius = 20.0f; + saveBtn.layer.masksToBounds = true; + saveBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + saveBtn.layer.borderWidth = 1.0f; + saveBtn.backgroundColor = KWhiteColor; + [saveBtn addTarget:self action:@selector(saveInfo) forControlEvents:UIControlEventTouchUpInside]; + [saveBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [footView addSubview:saveBtn]; + return footView; +} + +- (void)saveInfo { + + if (self.saveBlock) { + self.saveBlock(self.dataArray); + } + +} + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeOneTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeOneTableViewCell.h new file mode 100644 index 0000000..883898f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeOneTableViewCell.h @@ -0,0 +1,19 @@ +// +// HealthTypeOneTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import +#import "QuestionOptionModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HealthTypeOneTableViewCell : UITableViewCell + +@property (nonatomic, strong) QuestionOptionChildListModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeOneTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeOneTableViewCell.m new file mode 100644 index 0000000..bac8e7c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeOneTableViewCell.m @@ -0,0 +1,188 @@ +// +// HealthTypeOneTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import "HealthTypeOneTableViewCell.h" + +@interface HealthTypeOneTableViewCell () + +@property (nonatomic, strong) UILabel * leftLabel; +@property (nonatomic, strong) NSMutableArray * optionLabelArray; +@property (nonatomic, strong) NSMutableArray * lineArray; +@property (nonatomic, strong) UIButton * lastButton; + +@end + + + + +@implementation HealthTypeOneTableViewCell + +- (NSMutableArray *)lineArray { + + if (!_lineArray ) { + + _lineArray = [[NSMutableArray alloc] init]; + } + return _lineArray; + +} + +- (NSMutableArray *)optionLabelArray { + + if (!_optionLabelArray) { + + _optionLabelArray = [[NSMutableArray alloc] init]; + } + return _optionLabelArray; + +} + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(16), kRealValue(135), 13)]; + self.leftLabel.text = @"身高"; + self.leftLabel.textAlignment = NSTextAlignmentLeft; + self.leftLabel.font = SYSTEMFONT(13); + self.leftLabel.textColor = UIColorHex(#666666); + [self.contentView addSubview:self.leftLabel]; + + + +} + +- (void)setModel:(QuestionOptionChildListModel *)model { + + _model = model; + + self.leftLabel.text = _model.itemProblem; + + + + + for (UIButton * btn in self.optionLabelArray) { + + [btn removeFromSuperview]; + } + [self.optionLabelArray removeAllObjects]; + + + // 创建排序描述符 + NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"loctaionThin" ascending:YES]; + + // 对模型数组进行排序 + NSArray *sortedArray = [ _model.answerList sortedArrayUsingDescriptors:@[sortDescriptor]]; + + // 输出排序后的模型数组 + for (QuestionOptionCustomModel * customModel in _model.answerList) { + NSLog(@"Value: %ld", customModel.loctaionThin); + + } + + for (int i = 0; i < sortedArray.count; i ++) { + + QuestionOptionCustomModel * customModel = sortedArray[i]; + + CGFloat cow = i/2; + + CGFloat lin = i%2; + + CGFloat Hspace = kRealValue(16); + + CGFloat labW = (kScreenWidth - kRealValue(135))/2; + + UIButton * subBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.leftLabel.right + lin * labW, kRealValue(10) + cow * (30 + Hspace), labW, 35)]; + [subBtn setTitle:customModel.radioText forState:UIControlStateNormal]; + [subBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + subBtn.titleLabel.font = SYSTEMFONT(13); + subBtn.selected = customModel.checked; + [subBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; + [subBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateSelected]; + subBtn.titleEdgeInsets = UIEdgeInsetsMake(0, subBtn.imageView.width + 10, 0, 0); + subBtn.imageEdgeInsets = UIEdgeInsetsMake(0, kRealValue(10), 0, 0); + if ([customModel.value integerValue] != 0) { + subBtn.selected = true; + }else + { + subBtn.selected = false; + } + [subBtn addTarget:self action:@selector(optionAction:) forControlEvents:UIControlEventTouchUpInside]; + subBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + if (i == model.answerList.count - 1) { + self.lastButton = subBtn; + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(0,subBtn.bottom + kRealValue(5),kScreenWidth, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + [self.contentView addSubview:linv]; + [self.lineArray addObject:linv]; + } + [self.contentView addSubview:subBtn]; + [self.optionLabelArray addObject:subBtn]; + } + + +} + + +- (void)optionAction:(UIButton *)btn { + + self.model.isAppment = true; + + if ([_model.itemType integerValue] == 1)//型[1单选,2多选,3文本,4单选加文本] + { + int i = 0; + for (UIButton * subBtn in self.optionLabelArray) { + QuestionOptionCustomModel * custommodel = self.model.answerList[i]; + if (subBtn == btn) { + subBtn.selected = YES; + custommodel.checked = true; + custommodel.value = @"1"; + self.model.answerContent = custommodel.radioText; + }else + { + custommodel.value = @"0"; + custommodel.checked = false; + subBtn.selected = NO; + } + i++; + } + } + if ([_model.itemType integerValue] == 2)//型[1单选,2多选,3文本,4单选加文本] + { + int i = 0; + for (UIButton * subBtn in self.optionLabelArray) { + + if (subBtn == btn) { + subBtn.selected = !btn.selected; + QuestionOptionCustomModel * custommodel = self.model.answerList[i]; + custommodel.checked = true; + } + i++; + } + } + self.model.isAppment = true; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeTwoTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeTwoTableViewCell.h new file mode 100644 index 0000000..9218099 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeTwoTableViewCell.h @@ -0,0 +1,22 @@ +// +// HealthTypeTwoTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import +#import "QuestionOptionModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^changeTextBlock)(QuestionOptionChildListModel * model); + +@interface HealthTypeTwoTableViewCell : UITableViewCell +@property (nonatomic, strong) QuestionOptionChildListModel * model; +@property (nonatomic, strong) UITextView * optionField; +@property (nonatomic, copy) changeTextBlock changeBlock; +@property (nonatomic, assign) BOOL isHideLine; + +@end +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeTwoTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeTwoTableViewCell.m new file mode 100644 index 0000000..a93127f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/healethOptionsView(健康选项)/HealthTypeTwoTableViewCell.m @@ -0,0 +1,341 @@ +// +// HealthTypeTwoTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/25. +// + +#import "HealthTypeTwoTableViewCell.h" + + +@interface HealthTypeTwoTableViewCell () + +@property (nonatomic, strong) UILabel * leftLabel; +@property (nonatomic, strong) NSMutableArray * buttonArray; +@property (nonatomic, strong) NSMutableArray * lineArray; +@property (nonatomic, strong) NSMutableArray * fileArray; +@property (nonatomic, strong) UIView * linv; +@property (nonatomic, strong) UIButton * oneBtn; +@property (nonatomic, strong) UIButton * twoBtn; + +@end + + + +@implementation HealthTypeTwoTableViewCell + +- (NSMutableArray *)fileArray { + + if (!_fileArray) { + _fileArray = [[NSMutableArray alloc] init]; + } + return _fileArray; + +} +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + _buttonArray = [[NSMutableArray alloc] init]; + } + return _buttonArray; +} + +- (UITextView *)optionField { + + if (!_optionField) { + _optionField = [[UITextView alloc] init]; + } + return _optionField; +} + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(16), kRealValue(135), 13)]; + self.leftLabel.text = @"过敏史"; + self.leftLabel.textAlignment = NSTextAlignmentLeft; + self.leftLabel.font = SYSTEMFONT(13); + self.leftLabel.textColor = UIColorHex(#666666); + [self.contentView addSubview:self.leftLabel]; + +// UIButton * subBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.leftLabel.right , kRealValue(10), 100, 35)]; +// [subBtn setTitle:@"无" forState:UIControlStateNormal]; +// [subBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; +// subBtn.titleLabel.font = SYSTEMFONT(13); +// [subBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; +// [subBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateSelected]; +// subBtn.titleEdgeInsets = UIEdgeInsetsMake(0, subBtn.imageView.width + 10, 0, 0); +// subBtn.imageEdgeInsets = UIEdgeInsetsMake(0, kRealValue(10), 0, 0); +// self.oneBtn = subBtn; +// subBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; +// +// [subBtn addTarget:self action:@selector(optionOnesAction:) forControlEvents:UIControlEventTouchUpInside]; +// [self.contentView addSubview:subBtn]; +// +// UIButton * haveBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.leftLabel.right , subBtn.bottom + kRealValue(15), 70, 35)]; +// [haveBtn setTitle:@"有" forState:UIControlStateNormal]; +// [haveBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; +// haveBtn.titleLabel.font = SYSTEMFONT(13); +// [haveBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; +// [haveBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateSelected]; +// haveBtn.titleEdgeInsets = UIEdgeInsetsMake(0, haveBtn.imageView.width + 10, 0, 0); +// haveBtn.imageEdgeInsets = UIEdgeInsetsMake(0, kRealValue(10), 0, 0); +// haveBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; +// [haveBtn addTarget:self action:@selector(optionTwoesAction:) forControlEvents:UIControlEventTouchUpInside]; +// self.twoBtn = haveBtn; +// [self.contentView addSubview:haveBtn]; +// +// self.optionField = [[UITextField alloc] initWithFrame:CGRectMake(haveBtn.right + kRealValue(10), subBtn.bottom + kRealValue(20), kScreenWidth - haveBtn.right - kRealValue(20), 30)]; +// self.optionField.placeholder = @"请输入详细信息"; +// self.optionField.font = SYSTEMFONT(13); +// self.optionField.layer.cornerRadius = 5; +// self.optionField.layer.masksToBounds = YES; +// self.optionField.layer.borderWidth = 1.0; +// self.optionField.layer.borderColor = UIColorHex(#CCCCCC).CGColor; +// [self.contentView addSubview:self.optionField]; +// +// UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(0,self.optionField.bottom + kRealValue(7),kScreenWidth, 1)]; +// linv.backgroundColor = UIColorHex(#E0E0E0); +// [self.contentView addSubview:linv]; +} + +- (void)setModel:(QuestionOptionChildListModel *)model { + + _model = model; + self.leftLabel.text = _model.itemProblem; + +// NSData *jsonData = [_model.itemOptions dataUsingEncoding:NSUTF8StringEncoding]; +// +// NSDictionary * dictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil]; +// +// NSMutableArray * dicArray = [[NSMutableArray alloc] init]; +// +// [dictionary enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) { +// +// [dicArray addObject:[NSString stringWithFormat:@"%@:%@",key,obj]]; +// +// }]; + + UIButton * lastBtn; + + for (UIButton * btn in self.buttonArray) { + [btn removeFromSuperview]; + } + [self.buttonArray removeAllObjects]; + QuestionOptionCustomModel * customModel; + for (int i = 0 ; i < model.answerList.count; i ++) { + + QuestionOptionCustomModel * subModel = model.answerList[i]; + + UIButton * subBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.leftLabel.right , kRealValue(10) + (35 + kRealValue(15))* i , 70, 35)]; +// NSString * matString =subModel.radioText; +// NSArray * matArray = [matString componentsSeparatedByString:@":"]; + [subBtn setTitle:subModel.radioText forState:UIControlStateNormal]; + [subBtn setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; + subBtn.titleLabel.font = SYSTEMFONT(13); + [subBtn setImage:[UIImage imageNamed:@"physcialType_nomal"] forState:UIControlStateNormal]; + [subBtn setImage:[UIImage imageNamed:@"physcialType_selected"] forState:UIControlStateSelected]; + subBtn.titleEdgeInsets = UIEdgeInsetsMake(0, subBtn.imageView.width + 10, 0, 0); + subBtn.imageEdgeInsets = UIEdgeInsetsMake(0, kRealValue(10), 0, 0); + subBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [subBtn addTarget:self action:@selector(optionOnesAction:) forControlEvents:UIControlEventTouchUpInside]; + subBtn.selected = subModel.checked; + subBtn.tag = 100 + i; + [self.contentView addSubview:subBtn]; + if ([subModel.value intValue] != 0) { + subBtn.selected = true; + }else + { + subBtn.selected = false; + } + [self.buttonArray addObject:subBtn]; + + if (i == model.answerList.count - 1) { + + lastBtn = subBtn; + customModel = model.answerList[i]; + } + + + + } + self.optionField.frame = CGRectMake(lastBtn.right + kRealValue(5), lastBtn.top, kScreenWidth - lastBtn.right - kRealValue(20), kRealValue(30)); + self.optionField.font = SYSTEMFONT(13); + self.optionField.layer.cornerRadius = 5; + self.optionField.layer.masksToBounds = YES; + self.optionField.layer.borderWidth = 1.0; + self.optionField.layer.borderColor = UIColorHex(#CCCCCC).CGColor; + self.optionField.delegate = self; + + [self.contentView addSubview:self.optionField]; + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(0,self.optionField.bottom + kRealValue(7),kScreenWidth, 1)]; + linv.backgroundColor = UIColorHex(#E0E0E0); + self.linv = linv; + [self.contentView addSubview:linv]; + + if (!ValidStr(_model.answerContent)) { + self.optionField.text = _model.answerContent; + NSString *text = self.optionField.text; + UIFont *font = [UIFont systemFontOfSize:13.0]; // 或者你可以使用你想要的字体 + + CGSize constraintSize = CGSizeMake(self.optionField.width, MAXFLOAT); // 宽度可以是你的标签的宽度,高度设置为一个足够大的值 + + NSDictionary *attributes = @{NSFontAttributeName: font}; + CGRect textRect = [text boundingRectWithSize:constraintSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil]; + + CGFloat textHeight = CGRectGetHeight(textRect); + NSLog(@"Text Height: %f", textHeight); + if (textHeight < kRealValue(30)) { + + self.optionField.height = kRealValue(30); + _model.cellHeight = self.linv.bottom + kRealValue(10); + + }else + { + self.optionField.height = textHeight; + _model.cellHeight = self.linv.bottom + kRealValue(10); + } + self.linv.top = self.optionField.bottom + kRealValue(7); + } + + + +} + +- (void)optionOnesAction:(UIButton *)onesBtn { + self.model.isAppment = true; + if ([_model.itemType integerValue] == 1 || [_model.itemType integerValue] == 4)//型[1单选,2多选,3文本,4单选加文本] + { + int i = 0; + for (UIButton * subBtn in self.buttonArray) { + + if (subBtn == onesBtn) { + subBtn.selected = YES; + QuestionOptionCustomModel * custommodel = self.model.answerList[i]; + custommodel.checked = true; + custommodel.value = @"1"; + if ([[subBtn currentTitle] isEqualToString:@"无"]) + { + if ([_model.itemType integerValue] == 4) { + // + + + } + } + else + { + self.model.answerContent = self.optionField.text; + + } + + }else + { + QuestionOptionCustomModel * custommodel = self.model.answerList[i]; + custommodel.checked = false; + custommodel.value = @"0"; + self.model.answerContent = @""; + subBtn.selected = NO; + } + i++; + } + } + if ([_model.itemType integerValue] == 2)//型[1单选,2多选,3文本,4单选加文本] + { + int i = 0; + for (UIButton * subBtn in self.buttonArray) { + + if (subBtn == onesBtn) { + QuestionOptionCustomModel * custommodel = self.model.answerList[i]; + custommodel.checked = true; + subBtn.selected = !onesBtn.selected; + } + i++; + } + } + + +} + +- (void)textViewDidChange:(UITextView *)textView { + + UIButton * lastBtn = [self viewWithTag:100 + self.model.answerList.count - 1 ]; + + for (UIButton * subBtn in self.buttonArray) { + + if (subBtn == lastBtn) { + subBtn.selected = true; + + }else + { + subBtn.selected = false; + } + } + QuestionOptionCustomModel * custommodel = self.model.answerList[lastBtn.tag - 100]; + + for (QuestionOptionCustomModel * subModel in self.model.answerList) { + + if (custommodel == subModel) { + subModel.value = @"1"; + }else + { + subModel.value = @"0"; + } + + } + self.model.answerContent = self.optionField.text; + NSString *text = self.optionField.text; + UIFont *font = [UIFont systemFontOfSize:13.0]; // + + CGSize constraintSize = CGSizeMake(self.optionField.width, MAXFLOAT); // 宽度可以是你的标签的宽度,高度设置为一个足够大的值 + + NSDictionary *attributes = @{NSFontAttributeName: font}; + CGRect textRect = [text boundingRectWithSize:constraintSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil]; + + CGFloat textHeight = CGRectGetHeight(textRect) + kRealValue(8); + NSLog(@"Text Height: %f", textHeight); + if (textHeight <= kRealValue(30)) { + + self.optionField.height = kRealValue(30); + self.model.cellHeight = self.linv.bottom + kRealValue(10); + + }else + { + self.optionField.height = textHeight; + self.model.cellHeight = self.linv.bottom + kRealValue(10); + } + self.linv.top = self.optionField.bottom + kRealValue(7); + + if (self.changeBlock) { + self.changeBlock(self.model); + } +} +- (void)setIsHideLine:(BOOL)isHideLine { + + _isHideLine = isHideLine; + + self.linv.hidden = _isHideLine; + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/hospitalListTableView.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/hospitalListTableView.h new file mode 100644 index 0000000..c86beaa --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/hospitalListTableView.h @@ -0,0 +1,22 @@ +// +// hospitalListTableView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^hospatilListAction)(NSString * hopsitalID,NSString * hopatialName); + +@interface hospitalListTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) hospatilListAction hospatalBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/hospitalListTableView.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/hospitalListTableView.m new file mode 100644 index 0000000..8741172 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/hospitalListTableView.m @@ -0,0 +1,129 @@ +// +// hospitalListTableView.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/18. +// + +#import "hospitalListTableView.h" +#import "HospitalListTableCell.h" + +@interface hospitalListTableView () + + +@end + +@implementation hospitalListTableView + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style +{ + if (self = [super initWithFrame:frame style:style]) + { + [self createUI]; + } + return self; +} + + +- (void)createUI +{ + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.showsVerticalScrollIndicator = NO; + self.backgroundColor = KWhiteColor; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; +} + + + + +- (void)setDataArray:(NSArray *)dataArray +{ + _dataArray = dataArray; + [self reloadData]; +} + + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 1; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.dataArray.count; + +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + + + static NSString * cellID = @"cellID"; + + + HospitalListTableCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; + + if (!cell) { + + cell = [[HospitalListTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + } + + cell.model = self.dataArray[indexPath.section]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + HospitalInfoModel * model = self.dataArray[indexPath.section]; + if (self.hospatalBlock) { + + self.hospatalBlock(model.hositalId,model.resourceName); + } + +} + +- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return CGFLOAT_MIN; +} + +// +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UIView * hearView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0)]; + + hearView.backgroundColor = KRedColor; + + return hearView; + +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [[UIView alloc] init]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/searchHospatilCellTableViewCell.h b/XinjiangProject/XinjiangProject/Project/Qusetion/View/searchHospatilCellTableViewCell.h new file mode 100644 index 0000000..d6f162a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/searchHospatilCellTableViewCell.h @@ -0,0 +1,19 @@ +// +// searchHospatilCellTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/20. +// + +#import +#import "HospitalInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface searchHospatilCellTableViewCell : UITableViewCell + +@property (nonatomic , strong) HospitalInfoModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/Qusetion/View/searchHospatilCellTableViewCell.m b/XinjiangProject/XinjiangProject/Project/Qusetion/View/searchHospatilCellTableViewCell.m new file mode 100644 index 0000000..7cd8a92 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/Qusetion/View/searchHospatilCellTableViewCell.m @@ -0,0 +1,257 @@ +// +// searchHospatilCellTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/20. +// + +#import "searchHospatilCellTableViewCell.h" + +#import "UILabel+ChangeLineSpaceAndWordSpace.h" +#import "TYMapNavSheet.h" + + +@interface searchHospatilCellTableViewCell () +{ + TYMapNavSheet * TYNavSheet; +} + +@property (nonatomic, strong) UIView * backView; + +@property (nonatomic, strong) UIImageView * hospitalImage; + +@property (nonatomic, strong) UILabel * lvLabel; + +@property (nonatomic, strong) UILabel * hospitalName; + +@property (nonatomic, strong) UILabel * addressLabel; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * discanceLabel; + +@property (nonatomic, strong) UIButton * mapNavButton; + +@property (nonatomic, strong) UIImageView * locatImg; + +@end + +@implementation searchHospatilCellTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; + +} + + +- (void)createUI { + + self.backView = [[UIView alloc] initWithFrame:CGRectMake(15, 5, kScreenWidth - 60, 110)]; + self.backView.backgroundColor = KWhiteColor; + [self.contentView addSubview:self.backView]; + + self.hospitalImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 15, 63, 63)]; + self.hospitalImage.layer.cornerRadius = 10.0f; + self.hospitalImage.layer.masksToBounds = true; + self.hospitalImage.contentMode = UIViewContentModeScaleAspectFill; + [self.backView addSubview:self.hospitalImage]; + + + + self.lvLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.hospitalImage.right + 10, 20, 20, 15)]; + self.lvLabel.layer.cornerRadius = 3.0f; + self.lvLabel.layer.masksToBounds = true; + self.lvLabel.text = @"二甲"; + self.lvLabel.textColor = KWhiteColor; + self.lvLabel.backgroundColor = UIColorHex(#21BEBD); + self.lvLabel.textAlignment = NSTextAlignmentCenter; + self.lvLabel.font = MEDIUMFONT(9); + [UILabel changeWordSpaceForLabel:self.lvLabel WithSpace:2]; + [self.backView addSubview:self.lvLabel]; + + + + self.hospitalName = [[UILabel alloc] initWithFrame:CGRectMake(self.lvLabel.right, 20, self.backView.width - self.lvLabel.right - 10 , 15)]; + self.hospitalName.text = @"生命科学专科医院"; + self.hospitalName.font = BOLDSYSTEMFONT(14); + self.hospitalName.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.hospitalName]; + + + + + self.roomLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.hospitalImage.right + 10, self.hospitalName.bottom + 10, self.backView.width - 63 - 30 , 15)]; + self.roomLabel.text = @"重点科室:眼科、病理科"; + self.roomLabel.font = MEDIUMFONT(13); + self.roomLabel.textAlignment = NSTextAlignmentLeft; + self.roomLabel.textColor = CFontColor1; + [self.backView addSubview:self.roomLabel]; + + + + UIImageView * locatImg = [[UIImageView alloc] initWithFrame:CGRectMake(self.hospitalImage.right + 10, self.hospitalImage.bottom - 18, 10, 12)]; + locatImg.image = [UIImage imageNamed:@"hospatilAddress"]; + self.locatImg = locatImg; + [self.backView addSubview:locatImg]; + + + self.discanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(locatImg.right + 10, locatImg.top - 1, 60, 15)]; + self.discanceLabel.text = @"km"; + self.discanceLabel.font = MEDIUMFONT(13); + self.discanceLabel.textAlignment = NSTextAlignmentLeft; + self.discanceLabel.textColor = CFontColor1; + [self.backView addSubview:self.discanceLabel]; + + + + self.mapNavButton = [[UIButton alloc] initWithFrame:CGRectMake(self.discanceLabel.right + 8, locatImg.top - 3, 60, 20)]; + [self.mapNavButton setTitle:@"导航" forState:UIControlStateNormal]; + [self.mapNavButton setTitleColor:UIColorHex(#3390FF) forState:UIControlStateNormal]; + self.mapNavButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.mapNavButton.titleLabel.font = SYSTEMFONT(12); + [self.mapNavButton addTarget:self action:@selector(mapNavLocationAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.mapNavButton]; + + self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.hospitalImage.right + 10 , self.hospitalImage.bottom + 7 , self.backView.width - self.hospitalImage.right - 25, 15)]; + self.addressLabel.font = MEDIUMFONT(13); + self.addressLabel.textColor = UIColorHex(#999999); + self.addressLabel.numberOfLines = 2 ; + [self.backView addSubview:self.addressLabel]; + + + +} + + +- (void)setModel:(HospitalInfoModel *)model { + + _model = model; + + self.hospitalName.text = _model.resourceName; + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_model.img]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + [self.hospitalImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:IMAGE_NAMED(@"hospitalNoimage")]; + + if (ValidStr(_model.level)) { + self.lvLabel.hidden = YES; + self.hospitalName.left = self.hospitalImage.right + 10; + + + }else + { + self.lvLabel.hidden = NO; + self.lvLabel.text = [NSString stringWithFormat:@" %@ ",_model.level]; + self.lvLabel.width = [HQCommonUtils getLengthFromText:self.lvLabel.text andFontSize:12]; + self.hospitalName.left = self.lvLabel.right + 10; + + + } + + if (ValidStr(_model.keyDepartments)) { + + self.roomLabel.hidden = true; + self.locatImg.top = self.hospitalName.bottom + 10; + self.discanceLabel.top = self.locatImg.top; + self.mapNavButton.top = self.locatImg.top; + self.addressLabel.top = self.locatImg.bottom + 7; + + }else + { + self.roomLabel.hidden = false; + self.roomLabel.text = _model.keyDepartments; + self.locatImg.top = self.roomLabel.bottom + 10; + self.discanceLabel.top = self.locatImg.top; + self.mapNavButton.top = self.locatImg.top; + self.addressLabel.top = self.locatImg.bottom + 7; + } + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + NSLog(@"经度:%f 纬度:%f", longitude, latitude); + //1.将两个经纬度点转成投影点 + MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(_model.latitude,_model.longitude)); + MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); + //2.计算距离 + CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + NSLog(@"距离:%f", distance); + self.discanceLabel.text = [NSString stringWithFormat:@"%.2fkm",distance/1000]; + + + self.discanceLabel.width = [HQCommonUtils getLengthFromText:self.discanceLabel.text andFontSize:13] + 10; + self.mapNavButton.left = self.discanceLabel.right + 2; + + self.addressLabel.text = [NSString stringWithFormat:@"%@",_model.address]; + CGFloat labH = [HQCommonUtils getSpaceLabelHeight: self.addressLabel withStr:self.addressLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:self.addressLabel.width withLineSpacing:5]; + self.addressLabel.height = labH; + self.backView.top = 5; + self.backView.height = self.addressLabel.bottom + 7; + + +} + +- (void)mapNavLocationAction:(UIButton *)navBtn { + + TYNavSheet = [[TYMapNavSheet alloc]init]; + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + +// NSLog(@"经度:%f 纬度:%f", longitude, latitude); +// //1.将两个经纬度点转成投影点 +// MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(model.latitude,model.longitude)); +// MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitude,longitude)); +// //2.计算距离 +// CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2); + NSMutableDictionary * Dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"我的位置",@"startName",self.model.address,@"endName", nil]; + [TYNavSheet ShowMapNavSheetSuperView:[HQCommonUtils getCurrentVC] withLocationDic:Dic withstartCoor:CLLocationCoordinate2DMake(latitude, longitude) withendCoor:CLLocationCoordinate2DMake(self.model.latitude, self.model.longitude)]; + +} + +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + [TYNavSheet actionSheetBtnClick:buttonIndex]; +} + + + + +- (void)layoutIfNeeded { + [super layoutIfNeeded]; + + self.backView.layer.cornerRadius = 4.0f; + self.backView.layer.masksToBounds = YES; + self.backView.layer.shadowColor = [UIColor grayColor].CGColor; +// self.layer.shadowOffset = CGSizeMake(3, 3);//有偏移量的情况,默认向右向下有阴影 + self.backView.layer.shadowOffset = CGSizeZero; //设置偏移量为0,四周都有阴影 + self.backView.layer.shadowRadius = 3.0f;//阴影半径,默认3 + self.backView.layer.shadowOpacity = 0.3f;//阴影透明度,默认0 + self.backView.layer.masksToBounds = NO; + self.backView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds cornerRadius:self.backView.layer.cornerRadius].CGPath; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Controller/SosCenterViewController.h b/XinjiangProject/XinjiangProject/Project/SOS/Controller/SosCenterViewController.h new file mode 100644 index 0000000..513cd46 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Controller/SosCenterViewController.h @@ -0,0 +1,16 @@ +// +// SosCenterViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SosCenterViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Controller/SosCenterViewController.m b/XinjiangProject/XinjiangProject/Project/SOS/Controller/SosCenterViewController.m new file mode 100644 index 0000000..674a336 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Controller/SosCenterViewController.m @@ -0,0 +1,996 @@ +// +// SosCenterViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import "SosCenterViewController.h" +#import "POIAnnotation.h" +#import "CustomAnnotationView.h" +#import "XMButton.h" +#import +#import "LXSegmentTitleView.h" +#import "SOSCenterModel.h" +#import +#import +#import +#import "SOSAddressView.h" +#import "SOSGroupIMModel.h" +#import "TYMapNavSheet.h" +#import "HealthInterveneHomeModel.h" +#import "AEDNetWrokModel.h" + +@interface SosCenterViewController () +{ + TYMapNavSheet * TYNavSheet; + +} +@property (nonatomic, strong) MAMapView * mapView ; + +@property (nonatomic, strong) UIView * grapView ; + +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, strong) AMapLocationManager *locationManager; +@property (nonatomic, copy) AMapLocatingCompletionBlock completionBlock; + + +@property (nonatomic, strong) LXSegmentTitleView *titleView; + +@property(strong, nonatomic) NSArray *titles; + +@property(strong, nonatomic) NSMutableArray * titlesArray; +@property(strong, nonatomic) NSMutableArray * ponisArray; +@property (strong, nonatomic) SOSCenterModel * model; +//经纬度 +@property (assign, nonatomic) CGFloat Longitude; +@property (assign, nonatomic) CGFloat latitude; +@property (copy, nonatomic) NSString * type; +// +@property (nonatomic, strong) SOSAddressView * addressView; + +@property (nonatomic, strong) SOSResourcesModel * resourceModel; + +@property (assign, nonatomic) NSInteger selecetIndex; + +@property (strong, nonatomic) NSMutableArray * hospitalArray; + +@property (strong, nonatomic) NSMutableArray * AedArray; + +@property (strong, nonatomic) NSMutableArray * carArray; + +@end + +@implementation SosCenterViewController + +- (NSMutableArray *)carArray { + + if (!_carArray) { + + _carArray = [[NSMutableArray alloc] init]; + } + return _carArray; +} + +- (NSMutableArray *)hospitalArray { + + if (!_hospitalArray) { + + _hospitalArray = [[NSMutableArray alloc] init]; + } + return _hospitalArray; +} + +- (NSMutableArray *)AedArray { + + if (!_AedArray) { + + _AedArray = [[NSMutableArray alloc] init]; + } + return _AedArray; + + +} + +- (NSMutableArray *)titlesArray { + + if (!_titlesArray) { + + _titlesArray = [[NSMutableArray alloc] init]; + } + return _titlesArray; +} + +- (NSMutableArray *)ponisArray { + + if (!_ponisArray) { + + _ponisArray = [[NSMutableArray alloc] init]; + } + return _ponisArray; +} + +- (SOSAddressView *)addressView { + + if (!_addressView) { + + _addressView = [[SOSAddressView alloc] initWithFrame:CGRectMake(kRealValue(15), kScreenHeight - kTopHeight - kRealValue(130), kScreenWidth - kRealValue(30), kRealValue(110))]; + _addressView.addressDelegate = self; + _addressView.backgroundColor = KWhiteColor; + + } + return _addressView; +} + +- (void)showBottomBtn { + + self.grapView.hidden = false; + +} +- (void)configLocationManager +{ + self.locationManager = [[AMapLocationManager alloc] init]; + + [self.locationManager setDelegate:self]; + + //设置期望定位精度 + [self.locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; + + //设置不允许系统暂停定位 + [self.locationManager setPausesLocationUpdatesAutomatically:NO]; + + //设置允许在后台定位 + [self.locationManager setAllowsBackgroundLocationUpdates:NO]; + + //设置定位超时时间 + [self.locationManager setLocationTimeout:10]; + + //设置逆地理超时时间 + [self.locationManager setReGeocodeTimeout:3]; + + //设置开启虚拟定位风险监测,可以根据需要开启 + [self.locationManager setDetectRiskOfFakeLocation:NO]; +} + +- (void)cleanUpAction +{ + //停止定位 + [self.locationManager stopUpdatingLocation]; + + [self.locationManager setDelegate:nil]; + +} + +- (void)reGeocodeAction +{ + [self.mapView removeAnnotations:self.mapView.annotations]; + + //进行单次带逆地理定位请求 + [self.locationManager requestLocationWithReGeocode:YES completionBlock:self.completionBlock]; +} + +- (void)initCompleteBlock +{ + __weak SosCenterViewController *weakSelf = self; + self.completionBlock = ^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) + { + if (error != nil && error.code == AMapLocationErrorLocateFailed) + { + //定位错误:此时location和regeocode没有返回值,不进行annotation的添加 + return; + } + else if (error != nil + && (error.code == AMapLocationErrorReGeocodeFailed + || error.code == AMapLocationErrorTimeOut + || error.code == AMapLocationErrorCannotFindHost + || error.code == AMapLocationErrorBadURL + || error.code == AMapLocationErrorNotConnectedToInternet + || error.code == AMapLocationErrorCannotConnectToHost)) + { + //逆地理错误:在带逆地理的单次定位中,逆地理过程可能发生错误,此时location有返回值,regeocode无返回值,进行annotation的添加 + } + else if (error != nil && error.code == AMapLocationErrorRiskOfFakeLocation) + { + //存在虚拟定位的风险:此时location和regeocode没有返回值,不进行annotation的添加 + + //存在虚拟定位的风险的定位结果 + __unused CLLocation *riskyLocateResult = [error.userInfo objectForKey:@"AMapLocationRiskyLocateResult"]; + //存在外接的辅助定位设备 + __unused NSDictionary *externalAccressory = [error.userInfo objectForKey:@"AMapLocationAccessoryInfo"]; + + return; + } + else + { + //没有错误:location有返回值,regeocode是否有返回值取决于是否进行逆地理操作,进行annotation的添加 + } + + //根据定位信息,添加annotation + MAPointAnnotation *annotation = [[MAPointAnnotation alloc] init]; + [annotation setCoordinate:location.coordinate]; + + //有无逆地理信息,annotationView的标题显示的字段不一样 + if (regeocode) + { + [annotation setTitle:[NSString stringWithFormat:@"%@", regeocode.formattedAddress]]; + [annotation setSubtitle:[NSString stringWithFormat:@"%@-%@-%.2fm", regeocode.citycode, regeocode.adcode, location.horizontalAccuracy]]; + } + else + { + [annotation setTitle:[NSString stringWithFormat:@"lat:%f;lon:%f;", location.coordinate.latitude, location.coordinate.longitude]]; + [annotation setSubtitle:[NSString stringWithFormat:@"accuracy:%.2fm", location.horizontalAccuracy]]; + } + self.Longitude = location.coordinate.longitude; + self.latitude = location.coordinate.latitude; + [self getResourceDataWithType:@"1" Longitude:self.Longitude withLatitude:self.latitude]; + + SosCenterViewController *strongSelf = weakSelf; + [strongSelf addAnnotationToMapView:annotation]; + }; +} + +- (void)addAnnotationToMapView:(id)annotation +{ + [self.mapView addAnnotation:annotation]; + [self.mapView showAnnotations:self.mapView.annotations edgePadding:UIEdgeInsetsMake(100, 100, 100, 100) animated:YES]; + [self.mapView setCenterCoordinate:annotation.coordinate animated:YES]; +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.type = @"0"; + self.selecetIndex = 0; + self.navigationItem.title = @"应急就医"; + self.view.backgroundColor = KWhiteColor; + TYNavSheet = [[TYMapNavSheet alloc]init]; + [self initMapView]; +// [self initCompleteBlock]; +// [self configLocationManager]; +// [self reGeocodeAction]; + + self.titleView = [[LXSegmentTitleView alloc] initWithFrame:CGRectMake(0 , 0 , kScreenWidth , kRealValue(35))]; + self.titleView.itemMinMargin = 15.f; + self.titleView.delegate = self; + self.titleView.titleNormalColor = CFontColor1; + self.titleView.titleSelectedColor = KWhiteColor; + self.titleView.btnNormalColor = KClearColor; + self.titleView.btnSelectedColor = UIColorHex(#21BEBD); + self.titleView.backgroundColor = KWhiteColor; + self.titleView.indicatorColor = KWhiteColor; + [self.view addSubview:self.titleView]; + + UIView * grapView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight - kTopHeight - kRealValue(170), kScreenWidth,kRealValue(170))]; + grapView.backgroundColor = RGBA(0, 0, 0, 0.1); + self.grapView = grapView; + self.grapView.hidden = false; + [self.view addSubview:grapView]; + + + + + XMButton * callBtn = [[XMButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 - 70 - kRealValue(33), grapView.height - StatusBar_Height - kRealValue(80) , kRealValue(70), kRealValue(70))]; + callBtn.style = SDButtonStyleTop; + callBtn.backgroundColor = KWhiteColor; + callBtn.layer.cornerRadius = 35.0f; + callBtn.layer.masksToBounds = true; + [callBtn setTitle:@"120" forState:UIControlStateNormal]; + callBtn.titleLabel.font = SYSTEMFONT(12); + [callBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal]; + [callBtn setImage:[UIImage imageNamed:@"callHospation"] forState:UIControlStateNormal]; + [callBtn addTarget:self action:@selector(callHospationAction) forControlEvents:UIControlEventTouchUpInside]; + callBtn.imageW = 22; + callBtn.imageH = 20; + callBtn.imageY = 19; + callBtn.imageX = 24; + callBtn.interval = 5; + [grapView addSubview:callBtn]; + + XMButton * sosBtn = [[XMButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 + kRealValue(33), callBtn.top , kRealValue(70), kRealValue(70))]; + sosBtn.style = SDButtonStyleTop; + sosBtn.backgroundColor = KWhiteColor; + sosBtn.layer.cornerRadius = 35.0f; + sosBtn.layer.masksToBounds = true; + [sosBtn setTitle:@"应急就医" forState:UIControlStateNormal]; + sosBtn.titleLabel.font = SYSTEMFONT(11); + [sosBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal]; + [sosBtn setImage:[UIImage imageNamed:@"callSoSIcon"] forState:UIControlStateNormal]; + [sosBtn addTarget:self action:@selector(callSoSAction) forControlEvents:UIControlEventTouchUpInside]; + sosBtn.imageW = 22; + sosBtn.imageH = 21; + sosBtn.imageY = 19; + sosBtn.imageX = 24; + sosBtn.interval = 5; + [grapView addSubview:sosBtn]; + + self.titles = @[@"油田医院",@"合作医院",@"医疗点",@"AED",@"救护车"]; + self.titleView.segmentTitles = self.titles; + [self.titleView reloadData]; +} + +- (void)initMapView { + if (self.mapView == nil) { + [AMapServices sharedServices].enableHTTPS = YES; + // ///初始化地图 + self.mapView = [[MAMapView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.showsCompass = YES; //设置成NO表示关闭指南针;YES表示显示指南针 + self.mapView.compassOrigin = CGPointMake(self.mapView.compassOrigin.x, 222); + self.mapView.showsScale = YES; //设置成NO表示不显示比例尺;YES表示显示比例尺 + self.mapView.delegate = self; + ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码 + _mapView.scaleOrigin= CGPointMake(_mapView.scaleOrigin.x, kRealValue(45)); //设置比例尺位置 + + + [self.view addSubview:self.mapView]; + + + self.mapView.showsUserLocation = YES; + self.mapView.userTrackingMode = MAUserTrackingModeFollow; + + //1.2、新增点A + +// //将目标经纬度设置为地图中心店 + MAUserLocationRepresentation *r = [[MAUserLocationRepresentation alloc] init]; + r.showsAccuracyRing = YES;///精度圈是否显示,默认YES + r.showsHeadingIndicator = YES;///是否显示方向指示(MAUserTrackingModeFollowWithHeading模式开启)。默认为YES + r.enablePulseAnnimation = YES;///内部蓝色圆点是否使用律动效果, 默认YES + r.image = [UIImage imageNamed:@"myLocationIcon"]; ///定位图标, 与蓝色原点互斥 + [self.mapView updateUserLocationRepresentation:r]; + + } + +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + [self getResourceDataWithType:@"1" Longitude:longitude withLatitude:latitude]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + // 开启定位 + self.mapView.showsUserLocation = YES; + self.mapView.userTrackingMode = MAUserTrackingModeFollow; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; +} + +#pragma mark: 拨打120 + +- (void)callHospationAction { + + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(longitude) forKey:@"longitude"]; + [parmDic setObject:@(latitude) forKey:@"latitude"]; + [parmDic setObject:@"0" forKey:@"callType"]; + [parmDic setObject:self.type forKey:@"resourceId"]; + + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"CALLAPI" NeedToken:@""]; + [sosApi PostSoSPhoneEmergency:parmDic]; + + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://120"] options:nil completionHandler:^(BOOL success) { + + }]; +} + +#pragma mark:应急点击 +- (void)callSoSAction { + + [self showMBProgressHUDWithString:@"应急发起中,请稍候..." autoHidden:false]; + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(longitude) forKey:@"longitude"]; + [parmDic setObject:@(latitude) forKey:@"latitude"]; + [parmDic setObject:@"0" forKey:@"name"]; + + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"GroupAPI" NeedToken:@""]; + [sosApi getSoSCreateGroupChat:parmDic]; + +} + +#pragma mark - AMapLocationManager Delegate + +- (void)amapLocationManager:(AMapLocationManager *)manager doRequireLocationAuth:(CLLocationManager *)locationManager +{ + [locationManager requestAlwaysAuthorization]; +} + + +#pragma mark - MAMapViewDelegate + +- (void)mapViewRequireLocationAuth:(CLLocationManager *)locationManager +{ + [locationManager requestAlwaysAuthorization]; +} + + +- (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated +{ +} + +#pragma mark:定位失败 +- (void)mapView:(MAMapView *)mapView didFailToLocateUserWithError:(NSError *)error { + +} + + +#pragma mark:更新位置 +- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation +{ + if (updatingLocation) + { + DLog(@"userlocation :%f", userLocation.location.coordinate.latitude); + self.Longitude = userLocation.location.coordinate.longitude; + self.latitude = userLocation.location.coordinate.latitude; + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; +// [self.mapView setCenterCoordinate: userLocation.location.coordinate animated:YES]; + + [user setObject:@(userLocation.location.coordinate.longitude) forKey:USERDEFAULLONG]; + [user setObject:@(userLocation.location.coordinate.latitude) forKey:USERDEFAULLATITUDE]; + [user synchronize]; +// [self getResourceDataWithType:@"0" Longitude:self.Longitude withLatitude:self.latitude]; + +// [self getResourceDataWithType:self.type Longitude:self.Longitude withLatitude:self.latitude]; + } +} + +#pragma mark - LXSegmentTitleViewDataSource + +- (NSArray *)segmentTitlesOfSegmentTitleView:(LXSegmentTitleView *)segmentView { + + return self.titles; +} + +- (void)segmentTitleView:(LXSegmentTitleView *)segmentView selectedIndex:(NSInteger)selectedIndex lastSelectedIndex:(NSInteger)lastSelectedIndex { + + self.mapView.showsUserLocation = YES; + self.mapView.userTrackingMode = MAUserTrackingModeFollow; + self.selecetIndex = selectedIndex + 1; + if (self.selecetIndex == 1 || self.selecetIndex == 2) + { + [self getResourceDataWithType:[NSString stringWithFormat:@"%ld",self.selecetIndex] Longitude:self.Longitude withLatitude:self.latitude]; + [self.addressView removeFromSuperview]; + } + if (self.selecetIndex ==3) { + [self.hospitalArray removeAllObjects]; + [self NearbyHospitalData]; + [self.addressView removeFromSuperview]; + } + if (self.selecetIndex ==4) { + [self.AedArray removeAllObjects]; + [self NearbyAEDEquipmentData]; + [self.addressView removeFromSuperview]; + } + + if (self.selecetIndex ==5) { + [self.AedArray removeAllObjects]; + [self NearbySoSCarInf0Data]; + [self.addressView removeFromSuperview]; + } + + +} + + +#pragma mark:请求医疗点数据 +- (void)NearbyHospitalData { + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:[NSString stringWithFormat:@"%f",longitude] forKey:@"longitude"]; + [parmDic setObject:[NSString stringWithFormat:@"%f",latitude] forKey:@"latitude"]; + [parmDic setObject:[NSString stringWithFormat:@"%d",100000] forKey:@"radiusRange"]; + [parmDic setObject:@"" forKey:@"name"]; + [parmDic setObject:@(5) forKey:@"resourceNum"]; + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"HOSPITALAPI" NeedToken:@""]; + [sosApi getNearbyHomePageHospitalPoint:parmDic]; + +} +#pragma mark:请求医疗点数据 +- (void)NearbyAEDEquipmentData { + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:[NSString stringWithFormat:@"%f",longitude] forKey:@"longitude"]; + [parmDic setObject:[NSString stringWithFormat:@"%f",latitude] forKey:@"latitude"]; + [parmDic setObject:[NSString stringWithFormat:@"%d",100000] forKey:@"radiusRange"]; + [parmDic setObject:@"" forKey:@"aedNum"]; + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"AEDEQAPI" NeedToken:@""]; + [sosApi getNearbyAEDEquipmentqNumber:parmDic]; + +} + +#pragma mark:请求救护车数据 +- (void)NearbySoSCarInf0Data { + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:[NSString stringWithFormat:@"%f",longitude] forKey:@"longitude"]; + [parmDic setObject:[NSString stringWithFormat:@"%f",latitude] forKey:@"latitude"]; + [parmDic setObject:[NSString stringWithFormat:@"%d",100000] forKey:@"radiusRange"]; + + JKCQAPI * sosApi = [[JKCQAPI alloc] init:self tag:@"SOSCARAPI" NeedToken:@""]; + [sosApi getSoSCarInfoLocationHome:parmDic]; + +} + + +- (void)getResourceDataWithType:(NSString *)type + Longitude:(CGFloat)longitude + withLatitude:(CGFloat)latitude{ + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:type forKey:@"type"]; + + [parmDic setObject:@(longitude) forKey:@"longitude"]; + + [parmDic setObject:@(latitude) forKey:@"latitude"]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"RESOURCES" NeedToken:@""]; + [api GetSoSHomePageResources:parmDic]; + +} + +#pragma mark:网络请求 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [EasyTextView showErrorText:message]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"RESOURCES"]) + { + NSDictionary * parmDic = response; + + SOSCenterModel * model = [SOSCenterModel modelWithDictionary:parmDic]; + self.model = model; + + NSMutableArray * poiAnnotations = [[NSMutableArray alloc] init]; + [self.mapView removeAnnotations:self.mapView.annotations]; + [self.ponisArray removeAllObjects]; + // 获取用户位置 + MAUserLocation *userLocation = self.mapView.userLocation; + if (userLocation) { + [self.ponisArray addObject:userLocation]; + } + for (SOSResourcesModel * resourceModel in model.resources) { + + MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; + pointAnnotation.coordinate = CLLocationCoordinate2DMake(resourceModel.latitude, resourceModel.longitude); + pointAnnotation.title = resourceModel.name; + pointAnnotation.subtitle = resourceModel.address; + [poiAnnotations addObject:pointAnnotation]; + [self addAnnotationToMapView:pointAnnotation]; + [self.ponisArray addObject:pointAnnotation]; + } + } + if ([tag isEqualToString:@"CALLAPI"]) { + NSDictionary * dic = response; + + + } + if ([tag isEqualToString:@"GroupAPI"]) { + NSDictionary * dic = response; + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + + + SOSGroupIMModel * model = [SOSGroupIMModel modelWithDictionary:dic]; + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.isVideo = YES; + chatVC.eableSendReport = true; + chatVC.eablehaveHelathData = true ; + chatVC.chatID = model.groupId; + chatVC.tfNew = model.tfNew; + chatVC.member = model.member; + chatVC.sosEnd_id = model.sosEnd_id; + chatVC.navTitle = @"应急中心"; + chatVC.questionType = 1; + [self.navigationController pushViewController:chatVC animated:YES]; + [self hiddenAllMBProgressHUD]; + + } + if ([tag isEqualToString:@"loginIMAPI"]) { + + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + [self callSoSAction]; + } + + if([tag isEqualToString:@"HOSPITALAPI"]) { + + NSArray * responseArray = response; + + NSMutableArray * poiAnnotations = [[NSMutableArray alloc] init]; + [self.mapView removeAnnotations:self.mapView.annotations]; + [self.ponisArray removeAllObjects]; + // 获取用户位置 + MAUserLocation *userLocation = self.mapView.userLocation; + if (userLocation) { + [self.ponisArray addObject:userLocation]; + } + for (NSDictionary * dic in responseArray) { + + HealthInterveneHomeModel * hospitalModel = [HealthInterveneHomeModel modelWithDictionary:dic]; + [self.hospitalArray addObject:hospitalModel]; + + MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; + pointAnnotation.coordinate = CLLocationCoordinate2DMake(hospitalModel.latitude, hospitalModel.longitude); + pointAnnotation.title = hospitalModel.name; + pointAnnotation.subtitle = hospitalModel.address; + [poiAnnotations addObject:pointAnnotation]; + [self addAnnotationToMapView:pointAnnotation]; + [self.ponisArray addObject:pointAnnotation]; + } + + + } + if ([tag isEqualToString:@"AEDEQAPI"]) { + + NSArray * responseArray = response; + + NSMutableArray * poiAnnotations = [[NSMutableArray alloc] init]; + [self.mapView removeAnnotations:self.mapView.annotations]; + [self.ponisArray removeAllObjects]; + // 获取用户位置 + MAUserLocation *userLocation = self.mapView.userLocation; + if (userLocation) { + [self.ponisArray addObject:userLocation]; + } + + for (NSDictionary * dic in responseArray) { + + AEDNetWrokModel * aedModel = [AEDNetWrokModel modelWithDictionary:dic]; + [self.AedArray addObject:aedModel]; + + MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; + pointAnnotation.coordinate = CLLocationCoordinate2DMake(aedModel.latitude, aedModel.longitude); + pointAnnotation.title = aedModel.name; + pointAnnotation.subtitle = aedModel.installAddress; + [poiAnnotations addObject:pointAnnotation]; + [self addAnnotationToMapView:pointAnnotation]; + [self.ponisArray addObject:pointAnnotation]; + } + + } + if ([tag isEqualToString:@"SOSCARAPI"]) { + + NSArray * responseArray = response; + + NSMutableArray * poiAnnotations = [[NSMutableArray alloc] init]; + [self.mapView removeAnnotations:self.mapView.annotations]; + [self.ponisArray removeAllObjects]; + // 获取用户位置 + MAUserLocation *userLocation = self.mapView.userLocation; + if (userLocation) { + [self.ponisArray addObject:userLocation]; + } + + for (NSDictionary * dic in responseArray) { + + SOSResourcesModel * aedModel = [SOSResourcesModel modelWithDictionary:dic]; + [self.carArray addObject:aedModel]; + + MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; + pointAnnotation.coordinate = CLLocationCoordinate2DMake(aedModel.latitude, aedModel.longitude); + pointAnnotation.title = aedModel.departCode; + pointAnnotation.subtitle = aedModel.licensePlateNumber; + [poiAnnotations addObject:pointAnnotation]; + [self addAnnotationToMapView:pointAnnotation]; + [self.ponisArray addObject:pointAnnotation]; + } + + + } + + + +} + +- (void)loginImAccount { + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + [self.mapView showAnnotations:self.ponisArray edgePadding:UIEdgeInsetsMake(100, 100, 100, 100) animated:YES]; + //用户当前位置大头针 + if ([annotation isKindOfClass:[MAUserLocation class]]) + { + static NSString *userLocationStyleReuseIndetifier = @"userLocationStyleReuseIndetifier"; + + MAAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:userLocationStyleReuseIndetifier]; + + if (annotationView == nil) + { + annotationView = [[MAAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:userLocationStyleReuseIndetifier]; + } + + annotationView.canShowCallout = true; + annotationView.image = [UIImage imageNamed:@"myLocationIcon"]; + annotationView.frame = CGRectMake(0, 0, 50, 50); + + return annotationView; + } + + if ([annotation isKindOfClass:[MAPointAnnotation class]]) + { + static NSString *reuseIndetifier = @"annotationReuseIndetifier"; + MAAnnotationView *annotationView = (MAAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseIndetifier]; + if (annotationView == nil) + { + annotationView = [[MAAnnotationView alloc] initWithAnnotation:annotation + reuseIdentifier:reuseIndetifier]; + } + if (self.selecetIndex == 3) { + + for (HealthInterveneHomeModel * hospitalModel in self.hospitalArray) { + + if (annotation.coordinate.longitude == hospitalModel.longitude && annotation.coordinate.latitude == hospitalModel.latitude) { + annotationView.image = [UIImage imageNamed:@"medicalAnnitation"]; + } + } + + // 使用动画效果将点显示在屏幕内 + [annotationView setSelected:false animated:YES]; + //设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView.centerOffset = CGPointMake(0, -18); + return annotationView; + } + if (self.selecetIndex == 4) { + + for (AEDNetWrokModel * aedModel in self.AedArray) { + + if (annotation.coordinate.longitude == aedModel.longitude && annotation.coordinate.latitude == aedModel.latitude) { + annotationView.image = [UIImage imageNamed:@"AEDIcon"]; + } + } + // 使用动画效果将点显示在屏幕内 + [annotationView setSelected:false animated:YES]; + //设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView.centerOffset = CGPointMake(0, -18); + return annotationView; + + } + //救护车 + if (self.selecetIndex == 5) { + + for (SOSResourcesModel * aedModel in self.carArray) { + + if (annotation.coordinate.longitude == aedModel.longitude && annotation.coordinate.latitude == aedModel.latitude) { + annotationView.image = [UIImage imageNamed:@"sosCard"]; + } + } + // 使用动画效果将点显示在屏幕内 + [annotationView setSelected:false animated:YES]; + //设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView.centerOffset = CGPointMake(0, -18); + return annotationView; + + } + else + { + for (SOSResourcesModel * resourceModel in self.model.resources) { + + if (annotation.coordinate.longitude == resourceModel.longitude && annotation.coordinate.latitude == resourceModel.latitude) { + if ([resourceModel.type integerValue]== 1) { + annotationView.image = [UIImage imageNamed:@"youtianHosoital"]; + } + if ([resourceModel.type integerValue]== 2) { + annotationView.image = [UIImage imageNamed:@"hezuoHospital"]; + } + if ([resourceModel.type integerValue]== 3) { + annotationView.image = [UIImage imageNamed:@"medicalAnnitation"]; + } + if ([resourceModel.type integerValue]== 4) { + annotationView.image = [UIImage imageNamed:@"AEDIcon"]; + } + if ([resourceModel.type integerValue]== 5) { + annotationView.image = [UIImage imageNamed:@"sosCard"]; + } + if ([resourceModel.type integerValue]== 6) { + annotationView.image = [UIImage imageNamed:@"sosPeople"]; + } + + } + } + // 使用动画效果将点显示在屏幕内 + [annotationView setSelected:false animated:YES]; + //设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView.centerOffset = CGPointMake(0, -18); + + return annotationView; + } + + + } + return nil; +} + +- (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view +{ + + self.grapView.hidden = true; + + + if (self.selecetIndex == 3) { //医疗点 + + for (HealthInterveneHomeModel * hospitalModel in self.hospitalArray) { + + if (view.annotation.coordinate.longitude == hospitalModel.longitude && view.annotation.coordinate.latitude == hospitalModel.latitude) { + + SOSResourcesModel * resourceModel = [[SOSResourcesModel alloc] init]; + + resourceModel.address = hospitalModel.address; + resourceModel.name = hospitalModel.name; + resourceModel.mobile = hospitalModel.mobile; + resourceModel.latitude = hospitalModel.latitude; + resourceModel.longitude = hospitalModel.longitude; + + self.addressView.resourceModel = resourceModel; + self.resourceModel = resourceModel; + [self.mapView addSubview:self.addressView]; + } + } + return; + + } + if (self.selecetIndex == 4) { //aed + + for (AEDNetWrokModel * aedModel in self.AedArray) { + + if (view.annotation.coordinate.longitude == aedModel.longitude && view.annotation.coordinate.latitude == aedModel.latitude) { + + HealthInterveneAEDModel * subAedModel = [[HealthInterveneAEDModel alloc] init]; + + subAedModel.resourceAddress = aedModel.installAddress; + subAedModel.resourceName = aedModel.name; + subAedModel.principalPhone = aedModel.chargeFirstMobile; + self.addressView.aedModel = subAedModel; + + SOSResourcesModel * resourceModel = [[SOSResourcesModel alloc] init]; + resourceModel.address = aedModel.installAddress; + resourceModel.name = aedModel.name; + resourceModel.mobile = aedModel.chargeFirstMobile; + resourceModel.latitude = aedModel.latitude; + resourceModel.longitude = aedModel.longitude; + self.resourceModel = resourceModel; + [self.mapView addSubview:self.addressView]; + } + } + return; + + } + if (self.selecetIndex == 5) { + + for (SOSResourcesModel * aedModel in self.carArray) { + + if (view.annotation.coordinate.longitude == aedModel.longitude && view.annotation.coordinate.latitude == aedModel.latitude) { + + SOSResourcesModel * resourceModel = [[SOSResourcesModel alloc] init]; + resourceModel.address = aedModel.licensePlateNumber; + resourceModel.name = aedModel.departCode; + resourceModel.latitude = aedModel.latitude; + resourceModel.longitude = aedModel.longitude; + self.resourceModel = resourceModel; + self.addressView.resourceModel = resourceModel; + [self.mapView addSubview:self.addressView]; + } + } + return; + + } + for (SOSResourcesModel * resourceModel in self.model.resources) { + + + if (view.annotation.coordinate.longitude == resourceModel.longitude && view.annotation.coordinate.latitude == resourceModel.latitude) { + + self.addressView.resourceModel = resourceModel; + self.resourceModel = resourceModel; + [self.mapView addSubview:self.addressView]; + } + + } + +// } +} + +- (void)addressNavLocataion { + + NSUserDefaults * user = [NSUserDefaults standardUserDefaults]; + CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue]; + CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue]; + + + + NSMutableDictionary * Dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"我的位置",@"startName",self.resourceModel.address,@"endName", nil]; + [TYNavSheet ShowMapNavSheetSuperView:self withLocationDic:Dic withstartCoor:CLLocationCoordinate2DMake(latitude, longitude) withendCoor:CLLocationCoordinate2DMake(self.resourceModel.latitude, self.resourceModel.longitude)]; + +} + +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + [TYNavSheet actionSheetBtnClick:buttonIndex]; +} + +- (void)resourcePhoneOnclick:(NSString *)phoneNumber { + + + [[UIApplication sharedApplication] openURL:[NSURL URLWithString: [NSString stringWithFormat:@"tel://%@",phoneNumber]] options:nil completionHandler:^(BOOL success) { + + }]; +} +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/AEDNetWrokModel.h b/XinjiangProject/XinjiangProject/Project/SOS/Model/AEDNetWrokModel.h new file mode 100644 index 0000000..a0bde6e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/AEDNetWrokModel.h @@ -0,0 +1,75 @@ +// +// AEDNetWrokModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface AEDNetWrokModel : NSObject + +@property (nonatomic, copy) NSString * aed_id; +@property (nonatomic, copy) NSString * routerStatus_dictText; +@property (nonatomic, copy) NSString * installAddressImg; +@property (nonatomic, copy) NSString * manageDepartName; +@property (nonatomic, copy) NSString * installAddress; +@property (nonatomic, copy) NSString * batteryStatus; + +@property (nonatomic, copy) NSString * handleExplain; +@property (nonatomic, copy) NSString * videoHandle; +@property (nonatomic, copy) NSString * aedAnnexStatus; +@property (nonatomic, copy) NSString * chargeFirstMobile; +@property (nonatomic, copy) NSString * manageUserName; +@property (nonatomic, copy) NSString * routerSerialNum; + +@property (nonatomic, copy) NSString * manageUserId; +@property (nonatomic, copy) NSString * secondDepartName; +@property (nonatomic, copy) NSString * hostModel; +@property (nonatomic, copy) NSString * hostSerialNum; +@property (nonatomic, copy) NSString * delFlag; +@property (nonatomic, copy) NSString * annex; + + +@property (nonatomic, copy) NSString * batteryModel; +@property (nonatomic, copy) NSString * updateBy; +@property (nonatomic, copy) NSString * checkStatus_dictText; +@property (nonatomic, copy) NSString * routerModel; +@property (nonatomic, copy) NSString * name; +@property (nonatomic, copy) NSString * updateTime; + +@property (nonatomic, copy) NSString * electrodeSheetValidTime; +@property (nonatomic, copy) NSString * createBy; +@property (nonatomic, copy) NSString * departName; +@property (nonatomic, copy) NSString * manageDepartCode; +@property (nonatomic, assign) long distance; +@property (nonatomic, copy) NSString * aedImg; + +@property (nonatomic, assign) double longitude; +@property (nonatomic, copy) NSString * manageUserMobile; +@property (nonatomic, assign) double latitude; +@property (nonatomic, copy) NSString * departCode; + +@property (nonatomic, copy) NSString * electrodeSheetStatus; +@property (nonatomic, copy) NSString * batteryStatus_dictText; +@property (nonatomic, assign) NSInteger coverUserNum; + +@property (nonatomic, copy) NSString * chargeSecond; +@property (nonatomic, copy) NSString * chargeSecondMobile; + +@property (nonatomic, copy) NSString * checkStatus; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * mfrsName; +@property (nonatomic, copy) NSString * warrantyEndDate; +@property (nonatomic, copy) NSString * warrantyStartDate; +@property (nonatomic, copy) NSString * chargeFirst; +@property (nonatomic, copy) NSString * routerStatus; +@property (nonatomic, copy) NSString * electrodeSheetStatus_dictText; +@property (nonatomic, copy) NSString * mfrsMobile; +@property (nonatomic, copy) NSString * memo; +@property (nonatomic, assign) NSInteger batteryVoltage; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/AEDNetWrokModel.m b/XinjiangProject/XinjiangProject/Project/SOS/Model/AEDNetWrokModel.m new file mode 100644 index 0000000..c336526 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/AEDNetWrokModel.m @@ -0,0 +1,19 @@ +// +// AEDNetWrokModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/19. +// + +#import "AEDNetWrokModel.h" + +@implementation AEDNetWrokModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"aed_id" :@"id"}; + return dic; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneAEDModel.h b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneAEDModel.h new file mode 100644 index 0000000..61566c7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneAEDModel.h @@ -0,0 +1,36 @@ +// +// HealthInterveneAEDModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HealthInterveneAEDModel : NSObject + +@property (nonatomic, copy) NSString * aed_id; +@property (nonatomic, copy) NSString * resourceAddress; +@property (nonatomic, copy) NSString * principalName; +@property (nonatomic, copy) NSString * principalPhone; +@property (nonatomic, copy) NSString * updateBy; +@property (nonatomic, copy) NSString * resourceDesc; + +@property (nonatomic, copy) NSString * resourceType; +@property (nonatomic, assign) double longitude; +@property (nonatomic, copy) NSString * delFlag; +@property (nonatomic, assign) double latitude; +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, copy) NSString * resourceImg; +@property (nonatomic, copy) NSString * resourceNo; +@property (nonatomic, assign) long distance; + +@property (nonatomic, strong) NSArray * assoSymtomIds; +@property (nonatomic, copy) NSString * status; +@property (nonatomic, copy) NSString * createBy; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneAEDModel.m b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneAEDModel.m new file mode 100644 index 0000000..95b0558 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneAEDModel.m @@ -0,0 +1,19 @@ +// +// HealthInterveneAEDModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/19. +// + +#import "HealthInterveneAEDModel.h" + +@implementation HealthInterveneAEDModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"aed_id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneHomeModel.h b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneHomeModel.h new file mode 100644 index 0000000..b8138aa --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneHomeModel.h @@ -0,0 +1,56 @@ +// +// HealthInterveneHomeModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/9/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HealthInterveneHomeModel : NSObject + +@property (nonatomic, copy) NSString * tit; +@property (nonatomic, copy) NSString * healthImg; +@property (nonatomic, copy) NSString * des; +@property (nonatomic, copy) NSString * currentData; +@property (nonatomic, copy) NSString * backImg; +@property (nonatomic, copy) NSString * type; + +//医院 +@property (nonatomic, copy) NSString * status; +@property (nonatomic, copy) NSString * status_dictText; +@property (nonatomic, copy) NSString * delFlag; +@property (nonatomic, copy) NSString * createBy; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * updateBy; +@property (nonatomic, copy) NSString * updateTime; +@property (nonatomic, copy) NSString * memo; +@property (nonatomic, copy) NSString * detail_id; +@property (nonatomic, copy) NSString * name; +@property (nonatomic, copy) NSString * address; +@property (nonatomic, copy) NSString * mobile; +@property (nonatomic, assign) double longitude; +@property (nonatomic, assign) double latitude; +@property (nonatomic, copy) NSString * aidrange; +@property (nonatomic, copy) NSString * gdId; +@property (nonatomic, copy) NSString * url; +@property (nonatomic, copy) NSString * level; +@property (nonatomic, copy) NSString * img; +@property (nonatomic, copy) NSString * hospitalId; +@property (nonatomic, copy) NSString * hospitalName; +@property (nonatomic, copy) NSString * departCode; +@property (nonatomic, copy) NSString * departName; +@property (nonatomic, copy) NSString * adminUser; +@property (nonatomic, copy) NSString * setUpTime; +@property (nonatomic, copy) NSString * medicalStaffNum; +@property (nonatomic, copy) NSString * radiationNum; +@property (nonatomic, copy) NSString * ambulanceNum; +@property (nonatomic, copy) NSString * radiationDepart; +@property (nonatomic, strong) NSArray * radiationDepartList; +@property (nonatomic, copy) NSString * distance; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneHomeModel.m b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneHomeModel.m new file mode 100644 index 0000000..c2c12f7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/HealthInterveneHomeModel.m @@ -0,0 +1,18 @@ +// +// HealthInterveneHomeModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/9/12. +// + +#import "HealthInterveneHomeModel.h" + +@implementation HealthInterveneHomeModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"detail_id" :@"id"}; + return dic; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/SOSCenterModel.h b/XinjiangProject/XinjiangProject/Project/SOS/Model/SOSCenterModel.h new file mode 100644 index 0000000..a487965 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/SOSCenterModel.h @@ -0,0 +1,54 @@ +// +// SOSCenterModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SOSTitleModel : NSObject + +@property (nonatomic, copy) NSString * title; + +@property (nonatomic, copy) NSString * value; + + +@end + +@interface SOSResourcesModel : NSObject + +@property (nonatomic, copy) NSString * province; +@property (nonatomic, copy) NSString * gdId; +@property (nonatomic, assign) double latitude; +@property (nonatomic, copy) NSString * city; +@property (nonatomic, copy) NSString * name; +@property (nonatomic, copy) NSString * type; +@property (nonatomic, copy) NSString * level; +@property (nonatomic, assign) double longitude; +@property (nonatomic, copy) NSString * distance; +@property (nonatomic, copy) NSString * reaourceID; +@property (nonatomic, copy) NSString * address; +@property (nonatomic, copy) NSString * img; +@property (nonatomic, copy) NSString * mobile; +@property (nonatomic, copy) NSString * licensePlateNumber; + +@property (nonatomic, copy) NSString * departCode; + + +@property (nonatomic, copy) NSString * driverName; + + +@end + + +@interface SOSCenterModel : NSObject + +@property (nonatomic, strong) NSArray * resources; +@property (nonatomic, strong) NSArray * dicts; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Model/SOSCenterModel.m b/XinjiangProject/XinjiangProject/Project/SOS/Model/SOSCenterModel.m new file mode 100644 index 0000000..e878ed9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/Model/SOSCenterModel.m @@ -0,0 +1,36 @@ +// +// SOSCenterModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/13. +// + +#import "SOSCenterModel.h" + +@implementation SOSTitleModel + + +@end + +@implementation SOSResourcesModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"reaourceID" :@"id"}; + return dic; +} + +@end + +@implementation SOSCenterModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"resources":[SOSResourcesModel class], + @"dicts":[SOSTitleModel class] + }; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/SOS/View/SOSAddressView.h b/XinjiangProject/XinjiangProject/Project/SOS/View/SOSAddressView.h new file mode 100644 index 0000000..645d28b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/View/SOSAddressView.h @@ -0,0 +1,34 @@ +// +// SOSAddressView.h +// EscortProject +// +// Created by 仁康信息 on 2023/6/2. +// + +#import +#import "SOSCenterModel.h" +#import "HealthInterveneAEDModel.h" +NS_ASSUME_NONNULL_BEGIN + +@protocol SoSBottomProtocol + +- (void)addressNavLocataion; + +- (void)resourcePhoneOnclick:(NSString *)phoneNumber; + +- (void)showBottomBtn; + +@end + +@interface SOSAddressView : UIView + +@property (nonatomic, strong) SOSResourcesModel * resourceModel; + +@property (nonatomic, strong) HealthInterveneAEDModel * aedModel; + + +@property (nonatomic, weak)id addressDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/SOS/View/SOSAddressView.m b/XinjiangProject/XinjiangProject/Project/SOS/View/SOSAddressView.m new file mode 100644 index 0000000..b62db61 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/SOS/View/SOSAddressView.m @@ -0,0 +1,224 @@ +// +// SOSAddressView.m +// EscortProject +// +// Created by 仁康信息 on 2023/6/2. +// + +#import "SOSAddressView.h" + + +@interface SOSAddressView () + +@property (nonatomic, strong) UILabel * lvLabel; +@property (nonatomic, strong) UILabel * hospitalName; +@property (nonatomic, strong) UILabel * phoneLabel; +@property (nonatomic, strong) UILabel * addressLabel; + + +@end + + +@implementation SOSAddressView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.layer.cornerRadius = 10; + self.layer.masksToBounds = true; + self.lvLabel = [[UILabel alloc] init]; + self.lvLabel.layer.cornerRadius = 3.0f; + self.lvLabel.layer.masksToBounds = true; + self.lvLabel.text = @"--"; + self.lvLabel.textColor = KWhiteColor; + self.lvLabel.backgroundColor = UIColorHex(#21BEBD); + self.lvLabel.textAlignment = NSTextAlignmentCenter; + self.lvLabel.font = MEDIUMFONT(9); + self.lvLabel.hidden = true; + [self addSubview:self.lvLabel]; + + [self.lvLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(kRealValue(18)); + make.width.mas_offset(60); + make.top.mas_offset(20); + make.height.mas_offset(16); + + }]; + + self.hospitalName = [[UILabel alloc] init]; + self.hospitalName.text = @"--"; + self.hospitalName.font = BOLDSYSTEMFONT(14); + self.hospitalName.textColor = UIColorHex(#333333); + self.hospitalName.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.hospitalName]; + + [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvLabel.mas_right).offset(10); + make.right.mas_offset(-30); + make.top.mas_offset(20); + make.height.mas_offset(15); + + }]; + + self.phoneLabel = [[UILabel alloc] init]; + self.phoneLabel.text = @"--"; + self.phoneLabel.font = MEDIUMFONT(13); + self.phoneLabel.textColor = UIColorHex(#999999); + self.phoneLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.phoneLabel]; + + [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(kRealValue(15)); + make.right.mas_offset(-30); + make.top.mas_equalTo(self.lvLabel.mas_bottom).offset(12); + make.height.mas_offset(15); + + }]; + + + self.addressLabel = [[UILabel alloc] init]; + self.addressLabel.text = @"--km | ---"; + self.addressLabel.font = MEDIUMFONT(13); + self.addressLabel.textColor = UIColorHex(#999999); + [self addSubview:self.addressLabel]; + + [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(kRealValue(18)); + make.right.mas_offset(kRealValue(-15)); + make.top.mas_equalTo(self.phoneLabel.mas_bottom).offset(10); + make.bottom.mas_offset(-10); + }]; + + [self.addressLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + UIButton * closeBtn = [[UIButton alloc] init]; + [closeBtn setImage:IMAGE_NAMED(@"close_icon") forState:UIControlStateNormal]; + [closeBtn addTarget:self action:@selector(closePopView) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:closeBtn]; + + [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(kRealValue(-15)); + make.top.mas_equalTo(@10); + make.width.height.mas_offset(20); + }]; + + UIButton * navBtn = [[UIButton alloc] init]; + [navBtn setImage:IMAGE_NAMED(@"address_NavLoctaion") forState:UIControlStateNormal]; + [navBtn addTarget:self action:@selector(navLocationView) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:navBtn]; + + [navBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(kRealValue(-21)); + make.top.mas_equalTo(self.hospitalName.mas_bottom).offset(4); + make.width.height.mas_offset(26); + }]; + + UIButton * samllPhoneBtn = [[UIButton alloc] init]; + [samllPhoneBtn setImage:IMAGE_NAMED(@"address_phone") forState:UIControlStateNormal]; + [samllPhoneBtn addTarget:self action:@selector(LocationPhoneView) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:samllPhoneBtn]; + + [samllPhoneBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(navBtn.mas_left).offset(-14); + make.top.mas_equalTo(self.hospitalName.mas_bottom).offset(4); + make.width.height.mas_offset(26); + }]; +} + +- (void)setResourceModel:(SOSResourcesModel *)resourceModel { + _resourceModel = resourceModel; + if ( !ValidStr(_resourceModel.level) ) { + self.lvLabel.hidden = false; + self.lvLabel.text = _resourceModel.level; + [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.lvLabel.mas_right).offset(10); + make.right.mas_offset(-30); + make.top.mas_offset(20); + make.height.mas_offset(15); + + }]; + }else + { + [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(kRealValue(18)); + make.right.mas_offset(-30); + make.top.mas_offset(20); + make.height.mas_offset(15); + + }]; + } + self.addressLabel.text = _resourceModel.address; + self.hospitalName.text = _resourceModel.name; + self.phoneLabel.text = _resourceModel.mobile; +} +- (void)setAedModel:(HealthInterveneAEDModel *)aedModel { + + _aedModel = aedModel; + [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(kRealValue(18)); + make.right.mas_offset(-30); + make.top.mas_offset(20); + make.height.mas_offset(15); + + }]; + self.addressLabel.text = [NSString stringWithFormat:@"%.2f | %@",_aedModel.distance / 1000.0, _aedModel.resourceAddress] ; + self.hospitalName.text = _aedModel.resourceName; + self.phoneLabel.text = _aedModel.principalPhone; + +} + +- (void)navLocationView { + + if ([self.addressDelegate respondsToSelector:@selector(addressNavLocataion)]) { + + [self.addressDelegate addressNavLocataion]; + } + +} + +- (void)LocationPhoneView { + + if ([self.addressDelegate respondsToSelector:@selector(resourcePhoneOnclick:)]) { + + if (self.resourceModel) { + [self.addressDelegate resourcePhoneOnclick:self.resourceModel.mobile]; + + } + if (self.aedModel ) { + [self.addressDelegate resourcePhoneOnclick:self.aedModel.principalPhone]; + + } + } + + +} + + +- (void)closePopView { + + if ([self.addressDelegate respondsToSelector:@selector(showBottomBtn)]) { + + [self.addressDelegate showBottomBtn]; + } + + [self removeFromSuperview]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatDoctorInfoModel.h b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatDoctorInfoModel.h new file mode 100644 index 0000000..db9c7ae --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatDoctorInfoModel.h @@ -0,0 +1,19 @@ +// +// ChatDoctorInfoModel.h +// QinghaiProject +// +// Created by Apple on 2024/8/22. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface ChatDoctorInfoModel : NSObject +@property (nonatomic, copy) NSString * memo; +@property (nonatomic, copy) NSString * faceUrl; +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * userName; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatDoctorInfoModel.m b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatDoctorInfoModel.m new file mode 100644 index 0000000..0b7da27 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatDoctorInfoModel.m @@ -0,0 +1,12 @@ +// +// ChatDoctorInfoModel.m +// QinghaiProject +// +// Created by Apple on 2024/8/22. +// + +#import "ChatDoctorInfoModel.h" + +@implementation ChatDoctorInfoModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatList/ChatListViewController.h b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatList/ChatListViewController.h new file mode 100644 index 0000000..ff38eef --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatList/ChatListViewController.h @@ -0,0 +1,16 @@ +// +// ChatListViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ChatListViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatList/ChatListViewController.m b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatList/ChatListViewController.m new file mode 100644 index 0000000..9826250 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatList/ChatListViewController.m @@ -0,0 +1,65 @@ +// +// ChatListViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "ChatListViewController.h" +#import "TUIConversationListController.h" +#import "TUIC2CChatViewController.h" +#import "TUIConversationCell.h" +#import "ChatViewController.h" + +@interface ChatListViewController () + +@end + +@implementation ChatListViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + TUIConversationListController *vc = [[TUIConversationListController alloc] init]; + vc.delegate = self; + // 把 TUIConversationListController 添加到自己的 ViewController + [self addChildViewController:vc]; + [self.view addSubview:vc.view]; + +} + +//会话列表代理 + +- (void)conversationListController:(TUIConversationListController *)conversationController + didSelectConversation:(TUIConversationCell *)conversation +{ + + // 会话列表点击事件,通常是打开聊天界面 + TUIConversationCellData * data11 = conversation; +// // 创建会话信息 + + ChatViewController * chatVC = [[ChatViewController alloc] init]; + if (!ValidStr(data11.userID)) { + chatVC.chatID = data11.userID; + chatVC.isGroupID = false; + + }else + { + chatVC.chatID = data11.groupID; + chatVC.isGroupID = YES; + } + chatVC.navTitle = data11.title; + [self.navigationController pushViewController:chatVC animated:true]; +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h new file mode 100644 index 0000000..8f4a7c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h @@ -0,0 +1,68 @@ +// +// ChatViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "HQBaseViewController.h" +#import "QuestionDiseaseInfoModel.h" + +//#import "TUIBaseChatViewController.h" +NS_ASSUME_NONNULL_BEGIN + +@interface ChatViewController : HQBaseViewController + +@property (nonatomic, strong) NSString * chatID; + +@property (nonatomic, assign) BOOL isGroupID; + +@property (nonatomic, copy) NSString * navTitle; + +@property (nonatomic, copy) NSString * tfNew;//当前应急单是否新的 1新的发起视频 0旧的不变 + +@property (nonatomic, strong) NSArray * member; + +@property (nonatomic, assign) BOOL isVideo;; + +//应急单 +@property (nonatomic, copy) NSString * sosEnd_id;//当前应急单是否新的 1新的发起视频 0旧的不变 +//咨询健康档案模型 +@property (nonatomic, strong) QuestionDiseaseInfoModel * disModel; +//档案ID +@property (nonatomic, strong) NSString * dangan_id; +//个人信息模型 + +//1 应急 2 图文咨询 3 音视频咨询 + +@property (nonatomic, assign) NSInteger questionType; +@property (nonatomic, copy) NSString * pictureEnd_id; +@property (nonatomic, copy) NSString * smallHelp_id; + +@property (nonatomic, assign) NSInteger JumpType; + +//是否有发送报告 +@property (nonatomic, assign) BOOL eableSendReport; +//是否有地图 +@property (nonatomic, assign) BOOL eableMapTools; +//是否有健康档案 +@property (nonatomic, assign) BOOL eablehaveHelathData; + + +//从哪来去哪里 +@property (nonatomic, assign) NSInteger PopType; + +//是否是结束入口进入 +@property (nonatomic, assign) NSInteger endRecordType; + +@property (nonatomic, copy) NSString * kuaisuzixun; + +// +@property (nonatomic, copy) NSString * medicalRecordsId; + +////是否评价过 +@property (nonatomic, assign) BOOL isEveal; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m new file mode 100644 index 0000000..08e8ae7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m @@ -0,0 +1,948 @@ +// +// ChatViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "ChatViewController.h" +#import "TUIC2CChatViewController.h" +#import "TUIMessageDataProvider.h" +#import "TUIChatDataProvider.h" +#import "ChatMapViewController.h" +#import +#import "evaluationPopView.h" +#import "EndSystemSoSCell.h" +#import "DoctorIDCardMessageCell.h" +#import "healthDataCustomCell.h" +#import "ExpertMainViewController.h" +#import "SendHealthDataViewController.h" +#import "CurrentLocationViewController.h" +#import "TUITextMessageCellData.h" +#import "QuestionViewController.h" +#import "SendReportModel.h" +#import "QuesstionDetailLookFileViewController.h" +#import "TUIGroupChatViewController.h" +#import "UIImage+RoundedCorner.h" +#import +#import "LookFileDataModel.h" +#import "PopupView.h" +#import "CustomTUIBaseMessageController.h" +#import "DoctorHomePageDetailVC.h" + + +//自定义map +#define BussinessID_CustomMap @"TIMLocationElem" +//自定义评论 +#define BussinessID_CustomReview @"CustomReview" +//自定义档案 +#define BussinessID_CustomHealthData @"archives" +//自定义医生名片 +#define BussinessID_CustomDoctorCard @"business_card" + + +@class TUIChatDataProvider; + +@interface ChatViewController () + +@property (nonatomic, strong) TUIC2CChatViewController *vc; +@property (nonatomic, strong) TUIGroupChatViewController * groupvc; + +@property (nonatomic, strong) evaluationPopView * popView; + +@property (nonatomic, assign) CGFloat starNumber; +@property (nonatomic, strong) NSString * evlationConnte; +@property (nonatomic, strong) PopupView *popupView; +@property (nonatomic, strong) UIView *backgroundView; +@property (nonatomic, strong) NSString * userID; + +//定位相关 +@property (nonatomic, strong) CLLocationManager *locationManager; + +@property (nonatomic, copy) NSString * doctorCardID; + +@end + +@implementation ChatViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.title = self.navTitle; + // self 为 id + self.view.backgroundColor = CViewBgColor; + + [self addNavigationItemWithImageNames:@[@"sangedian"] isLeft:false target:self action:@selector(foundMoreHistory) tags:@[@"1000"]]; + // 启用侧滑返回手势 +// self.navigationController.interactivePopGestureRecognizer.delegate = self; +// self.navigationController.interactivePopGestureRecognizer.enabled = YES; +// +// // 创建自定义手势识别器 +// UIScreenEdgePanGestureRecognizer *panGesture = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)]; +// panGesture.edges = UIRectEdgeLeft; +// [self.view addGestureRecognizer:panGesture]; + + [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; + [[TUICallEngine createInstance] addObserver:self]; + [[V2TIMManager sharedInstance] addConversationListener:self]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShowAction:) name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHideAction:) name:UIKeyboardWillHideNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendReportMessage:) name:@"sendReport" object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendHealthMessage:) name:@"sendHealth" object:nil]; + + [self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backUp) tags:@[@200]]; + + TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init]; + HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + + // TUIC2CChatViewController + TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init]; + //发送 + self.vc = vc; + vc.messageController.delegate = self; + [vc setConversationData:data]; + // 显示翻译按钮 +// TUIChatConfig.defaultConfig.enableTextTranslation = YES; + //不显示视频和语音 + [TUIChatConfig defaultConfig].enableVideoCall = self.isVideo; // YES:开启,NO:关闭 + [TUIChatConfig defaultConfig].enableAudioCall = self.isVideo; // YES:开启,NO:关闭 + [TUIChatConfig defaultConfig].backgroudColor = CViewBgColor; + + //是否显示发送报告 + [TUIChatConfig defaultConfig].enableSendReportCall = true; + [TUIChatConfig defaultConfig].enableSendHealthDataCall = self.eablehaveHelathData; + [TUIChatConfig defaultConfig].enableMapCall = self.eableMapTools; + [TUIChatConfig defaultConfig].isEvealCell = self.isEveal; // YES:开启,NO:关闭 + + + TUIConfig *config = [TUIConfig defaultConfig]; + config.avatarType = TAvatarTypeRounded; + // 修改默认头像 + if ([user.sex integerValue] == 1) { //女[] + config.defaultAvatarImage = [UIImage imageNamed:@"heard_woman"]; + }else + { + config.defaultAvatarImage = [UIImage imageNamed:@"heard_man"]; + } + + // 修改默认群组头像 + // 禁用群组九宫格头像 + config.enableGroupGridAvatar = NO; + + // 设置发送文字消息的字体和颜色 +// [TUITextMessageCellData setOutgoingTextFont:[UIFont systemFontOfSize:15]]; +// [TUITextMessageCellData setOutgoingTextColor:[UIColor blackColor]]; +// // 设置接收文字消息的字体和颜色 +// [TUITextMessageCellData setIncommingTextFont:[UIFont systemFontOfSize:15]]; +// [TUITextMessageCellData setIncommingTextColor:[UIColor blueColor]]; + UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkgHL")]; + UIImage * gOutgoingHighlightedBubble = + [TUIChatDynamicImage(@"chat_bubble_send_img", defaultImage) resizableImageWithCapInsets:UIEdgeInsetsFromString(@"{12,12,12,12}") + resizingMode:UIImageResizingModeStretch]; + UIImage *whiteImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkgHL")]; + + + UIImage * whiteimg = [[UIImage imageWithColor:KWhiteColor] resizableImageWithCapInsets:UIEdgeInsetsFromString(@"{12,12,12,12}") resizingMode:UIImageResizingModeStretch]; + UIImage *roundedImage = [whiteimg roundCornersWithRadius:20.0f]; + + // 设置发送气泡,包括普通状态和选中状态 + [TUIBubbleMessageCellData setOutgoingBubble:roundedImage]; + [TUIBubbleMessageCellData setOutgoingHighlightedBubble:roundedImage]; + + // 设置接收气泡,包括普通状态和选中状态 + [TUIBubbleMessageCellData setIncommingBubble:gOutgoingHighlightedBubble]; + [TUIBubbleMessageCellData setIncommingHighlightedBubble:gOutgoingHighlightedBubble]; + + // 把 TUIC2CChatViewController 添加到自己的 ViewController + + if( self.isGroupID == false) { + data.userID = self.chatID; + TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init]; + self.vc = vc; + vc.messageController.delegate = self; + [vc setConversationData:data]; + [self addChildViewController:vc]; + self.view.backgroundColor = UIColorHex(#EEEEEE); + [self.view addSubview:vc.view]; + vc.needScrollToBottom = true; + vc.customDelegate = self; + } + else + { + data.groupID = self.chatID; + TUIGroupChatViewController * vc = [[TUIGroupChatViewController alloc] init]; + self.groupvc = vc; + vc.messageController.delegate = self; + [vc setConversationData:data]; + [self addChildViewController:vc]; + self.view.backgroundColor = UIColorHex(#EEEEEE); + [self.view addSubview:vc.view]; + vc.needScrollToBottom = true; + vc.customDelegate = self; + + } +// self.view.backgroundColor = UIColorHex(#EEEEEE); + if ([self.tfNew integerValue] == 1) { + + [ESCTUIManager sendGroupVideo:self.chatID withUserIdList:self.member]; + } + //主动发送一条消息 + //如果点击跳过进入 不操作 非跳过 发送健康档案 2=非跳过 + if (self.JumpType == 2 && self.questionType == 2) { + + [self sendQuestionInfoMessage]; + } + + if (self.endRecordType == 100) { + if( self.isGroupID == false) { + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + + } +// [self ChatsendReview]; + +} + + +- (void)foundMoreHistory { + + + [EasyTextView showInfoText:@"功能待完善"]; + +// if (!self.popupView) { +// CGFloat popupWidth = 80.0; +// CGFloat popupHeight = 40.0; +// CGRect popupFrame = CGRectMake((self.view.bounds.size.width - popupWidth) - kRealValue(15), 10, popupWidth, popupHeight); +// +// // 创建透明背景视图 +// self.backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; +// self.backgroundView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5]; +// [self.view addSubview:self.backgroundView]; +// +// // 添加点击手势以隐藏弹窗 +// UITapGestureRecognizer *backgroundTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hidePopup)]; +// [self.backgroundView addGestureRecognizer:backgroundTapGesture]; +// +// self.popupView = [[PopupView alloc] initWithFrame:popupFrame]; +// __weak typeof(self) weakSelf = self; +// self.popupView.tapHandler = ^{ +// [weakSelf handlePopupTap]; +// }; +// +// [self.view addSubview:self.popupView]; +// } else { +// self.popupView.hidden = NO; +// self.backgroundView.hidden = NO; +// } +} +#pragma mark:医生详情 +- (void)chatSelectedHeardImg:(TUIMessageCell *)cell { + if (!cell.messageData.innerMessage.isSelf) + { + NSString * userID = cell.messageData.innerMessage.sender; + self.userID = userID; + [self getIsSmallHelp:userID]; + + } + +} + +- (void)getIsSmallHelp:(NSString *)userid { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:userid forKey:@"helpId"]; + JKCQAPI * smallApi = [[JKCQAPI alloc] init:self tag:@"smallAPI" NeedToken:@""]; + [smallApi GetisSmallHelp:parmDic]; + +} + +- (void)hidePopup { + self.popupView.hidden = YES; + self.backgroundView.hidden = YES; +} + +- (void)handlePopupTap { + NSLog(@"PopupView tapped"); + [self hidePopup]; + CustomTUIBaseMessageController * customVC = [[CustomTUIBaseMessageController alloc] init]; + customVC.groupID = self.chatID; + [self.navigationController pushViewController:customVC animated:YES]; +} + + +-(void)backUp { + + [self.navigationController popViewControllerAnimated:YES]; +} + +#pragma mark:跳转到地图选择页 +- (void)jumpChatMapView { + + self.locationManager = [[CLLocationManager alloc] init]; + self.locationManager.delegate = self; + + +} + +#pragma mark:结束咨询 + +- (void)sendChatEndQuestionAction { + + ////1 应急 2 图文咨询 3 音视频咨询 小助手 + if (self.questionType == 1) { + + } + if (self.questionType == 2) { + [self showMBProgressHUDWithString:@"正在结束本次会话" autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.pictureEnd_id forKey:@"id"]; + JKCQAPI * endApi = [[JKCQAPI alloc] init:self tag:@"ENDPICTUREAPI" NeedToken:@""]; + [endApi GetEndPictureEndIMQuestion:parmDic]; + } + if (!ValidStr(self.smallHelp_id)) { + [self showMBProgressHUDWithString:@"正在结束本次会话" autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.smallHelp_id forKey:@"id"]; + JKCQAPI * endApi = [[JKCQAPI alloc] init:self tag:@"ENDPICTUREAPI" NeedToken:@""]; + [endApi GetEndPictureEndIMQuestion:parmDic]; + } +} + +#pragma mark:发送健康档案 + +//主动发一条消息:健康档案 带联系人数据 +- (void)sendQuestionInfoMessage { + //直接请求档案详情 + [self getFileDetail]; + +} + +- (void)getFileDetail { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + if (!ValidStr(self.dangan_id) ) { + [parmDic setObject:self.dangan_id forKey:@"id"]; + } + + JKCQAPI * upApi = [[JKCQAPI alloc] init:self tag:@"FILEDATA" NeedToken:@""]; + + [upApi GetLookModficalMemberShipFileData:parmDic]; + +} + +- (void)questionChatSendHealthData { + SendHealthDataViewController * senVC = [[SendHealthDataViewController alloc] init]; + if ([self.kuaisuzixun intValue] == 1) { + senVC.memberId_id = @""; + }else + { + senVC.memberId_id = self.disModel.memberId_id; + } + if (!ValidStr(self.medicalRecordsId)) //我的咨询跳转来的 + { + senVC.memberId_id = self.medicalRecordsId; + } + + [self.navigationController pushViewController:senVC animated:YES]; + + +} +- (void)lookLocationDetail:(TUIMessageCell *)cel { + +// DLog(@"%@",cel.messageData.innerMessage.locationElem.longitude); + + CurrentLocationViewController * currVC = [[CurrentLocationViewController alloc] init]; + currVC.longitude = cel.messageData.innerMessage.locationElem.longitude; + currVC.latitude = cel.messageData.innerMessage.locationElem.latitude; + [self.navigationController pushViewController:currVC animated:YES]; + +} +#pragma mark:发送个人名片 +- (void)ChatsendDoctorIDCard { + NSDictionary * parmdic = @{BussinessID:BussinessID_CustomDoctorCard}; + NSData * messagedata = [NSJSONSerialization dataWithJSONObject:parmdic options:0 error:nil]; + V2TIMMessage * message = [[V2TIMManager sharedInstance] createCustomMessage:messagedata]; + if( self.isGroupID == false) { + [self.vc sendMessage:message]; + }else + { + [self.groupvc sendMessage:message]; + } +} + + +#pragma mark:发送体检报告 +- (void)ChatsendReview { + + +} + + +- (void)onRecvC2CCustomMessage:(NSString *)msgID sender:(V2TIMUserInfo *)info customData:(NSData *)data +{ + id myResult = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; + + + +} + +- (void)onRecvGroupCustomMessage:(NSString *)msgID groupID:(NSString *)groupID sender:(V2TIMGroupMemberInfo *)info customData:(NSData *)data { + + id myResult = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; + + + if ([myResult isKindOfClass:[NSDictionary class]]) { + + NSDictionary *response = (NSDictionary *)myResult; + SendReportModel * model = [SendReportModel modelWithDictionary:response]; + + if ([model.businessID isEqualToString:@"system"]) { + if( self.isGroupID == false) { + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + } + } + + + +} +/// 收到 C2C 文本消息 +- (void)onRecvC2CTextMessage:(NSString *)msgID sender:(V2TIMUserInfo *)info text:(NSString *)text{ + + + +} +#pragma mark:发起评价 +- (void)chatevlationDoctorStarView:(TUIMessageCell *)cell{ +// DLog(@"-----------%@",@"我是评价"); + + if ([cell isKindOfClass:EndSystemSoSCell.class]) { + EndSystemSoSCell * endCell = cell; + if (endCell.reviewBtn.hidden == false) { + evaluationPopView * popView = [[evaluationPopView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + self.popView = popView; + popView.popBlock = ^(CGFloat starNumber, BOOL isSecrect, NSString * _Nonnull evaluationString) { + NSString * niming = isSecrect == YES? @"1":@"0"; + self.starNumber = starNumber; + self.evlationConnte = evaluationString; + [self doctorSourceWithStarNumaber:starNumber withContext:evaluationString isKnow:niming]; + }; + [[UIApplication sharedApplication].keyWindow addSubview:popView]; + } + } + + if ([cell isKindOfClass:DoctorIDCardMessageCell.class]) { + + DoctorIDCardMessageCell * endCell = cell; + //7月6日新增 点击判断 + + // 获取当前日期和时间 + NSDate *currentDate = endCell.messageData.innerMessage.timestamp; + + // 获取自1970年1月1日以来的时间间隔(以秒为单位) + NSTimeInterval timeInterval = [currentDate timeIntervalSince1970]; + + // 将时间间隔转换为10位时间戳 + NSInteger tenDigitTimestamp = (NSInteger)timeInterval; + + // 打印结果 + [self getDocotorInfo:tenDigitTimestamp]; + + + self.doctorCardID = endCell.cardId; + + + } + + if ([cell isKindOfClass:healthDataCustomCell.class]) { + healthDataCustomCell * healthCell = cell; + + QuesstionDetailLookFileViewController * experVC= [[QuesstionDetailLookFileViewController alloc] init]; + experVC.danganID = healthCell.fileId; + [self.navigationController pushViewController:experVC animated:YES]; + } +} + +- (void)getDocotorInfo:(long)sendTime{ + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(sendTime) forKey:@"sendTime"]; + + JKCQAPI * endApi = [[JKCQAPI alloc] init:self tag:@"TIME" NeedToken:@""]; + [endApi GetDoctoresExpireTime:parmDic]; + +} + +#pragma mark:网络请求 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"ENDSOSAPI"]) + { + [self hiddenAllMBProgressHUD]; + NSDictionary * parmDic = response; + if( self.isGroupID == false) { + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + } + if ([tag isEqualToString:@"TIME"]) + { + NSString * isExpired =[NSString stringWithFormat:@"%@",response] ; + + if ([isExpired integerValue]== 0) { + ExpertMainViewController * experVC= [[ExpertMainViewController alloc] init]; + experVC.doctorId = self.doctorCardID; + [self.navigationController pushViewController:experVC animated:YES]; + }else + { + [EasyTextView showErrorText:@"医生信息已过期"]; + } + + } + + if ([tag isEqualToString:@"ENDPICTUREAPI"]) { + [self hiddenAllMBProgressHUD]; + if( self.isGroupID == false) { + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + } + if ([tag isEqualToString:@"DoctorSource"]) { + [EasyTextView showSuccessText:response]; + [self hiddenAllMBProgressHUD]; + [self.popView removeFromSuperview]; + [self backUp]; + + } + + if ([tag isEqualToString:@"loginIMAPI"]) { + [self hiddenAllMBProgressHUD]; + NSDictionary * pamrDic = response; + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic]; + + IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init]; + iminfoModel.IMInfo = pamrDic; + [HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo]; + + // 1. 从即时通信 IM 控制台获取应用 SDKAppID。 + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + } + + if ([tag isEqualToString:@"FILEDATA"]) { + + NSDictionary * parmDic = response; + LookFileDataModel * model = [LookFileDataModel modelWithDictionary:parmDic]; + + [self sendFileDetail:model]; + + + } + if ([tag isEqualToString:@"smallAPI"]) { + + bool isSmallHelp = [response boolValue]; + + + if (isSmallHelp == true) { + + DoctorHomePageDetailVC * vc = [[DoctorHomePageDetailVC alloc] init]; + vc.userID = self.userID; + [self.navigationController pushViewController:vc animated:YES]; + } + } + } + + +- (void)sendFileDetail:(LookFileDataModel *)model { + NSString * sexString; + NSString * ageString; + NSString * nameString; + NSString * memberId; + if (self.disModel) { //顶部个人信息 + // //性别 + sexString = [self.disModel.gender integerValue] == 1 ?@"女":@"男"; + //年龄 + ageString = [NSString stringWithFormat:@"%@",self.disModel.age]; + //姓名 + nameString = [NSString stringWithFormat:@"%@",self.disModel.name]; + //id + memberId = [NSString stringWithFormat:@"%@",self.disModel.memberId_id]; + } + //档案信息 + NSString * tf_id; + if (self.JumpType == 1) { + tf_id = @""; + } + else{ + tf_id = model.file_id; + } + //症状描述 + NSString * siksDesString = model.medicalDescribe; + //图片数组 + + NSMutableArray * imageArray = [[NSMutableArray alloc] init]; + + + NSString *imageString = model.image; + NSArray *listImageArray; + + if (imageString.length == 0) { + // 如果字符串为空,直接返回空数组 + listImageArray = @[]; + } else { + // 移除末尾的逗号 + if ([imageString hasSuffix:@","]) { + imageString = [imageString substringToIndex:imageString.length - 1]; + } + + // 分割字符串并过滤空字符串 + listImageArray = [[imageString componentsSeparatedByString:@","] + filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF != ''"]]; + } + +// NSArray * listImageArray = [model.image componentsSeparatedByString:@","]; + + for (int i = 0 ; i < listImageArray.count; i ++) { + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,listImageArray[i]]; + + + NSString * str1 = @"\\"; + + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:encodedString3 forKey:@"bigImageUrl"]; + [parmDic setObject:encodedString3 forKey:@"thumbnailUrl"]; + + [imageArray addObject:parmDic]; + + } + + + NSDictionary * parmdic = @{BussinessID:BussinessID_CustomHealthData, + @"gender":sexString, + @"age":ageString, + @"name":nameString, + @"symptomDescription":siksDesString, + @"imageList":imageArray, + @"archivesId":tf_id}; + NSData * messagedata = [NSJSONSerialization dataWithJSONObject:parmdic options:0 error:nil]; + V2TIMMessage * message = [[V2TIMManager sharedInstance] createCustomMessage:messagedata]; + if( self.isGroupID == false) { + [self.vc sendMessage:message]; + }else + { + [self.groupvc sendMessage:message]; + } + + +} + +- (void)doctorSourceWithStarNumaber:(CGFloat)starNumer withContext:(NSString *)connet isKnow:(NSString *)isNiming{ + + [self showMBProgressHUDWithString:@"评价中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(starNumer) forKey:@"score"]; + [parmDic setObject:connet forKey:@"context"]; + [parmDic setObject:self.pictureEnd_id forKey:@"sessionId"]; + [parmDic setObject:isNiming forKey:@"tfUnknow"]; + + JKCQAPI * endApi = [[JKCQAPI alloc] init:self tag:@"DoctorSource" NeedToken:@""]; + [endApi PostQustionDoctorScore:parmDic]; + +} +- (void)sendReportMessage:(NSNotification *)note { + + + +} + +- (void)sendHealthMessage:(NSNotification *)note { + + diseaseModel * model = note.object; + if (model) { + //性别 + NSString * sexString = [self.disModel.gender integerValue] == 1 ?@"女":@"男"; + //年龄 + NSString * ageString = [NSString stringWithFormat:@"%@",model.age]; + //姓名 + NSString * nameString = [NSString stringWithFormat:@"%@",model.name]; + //id + NSString * memberId = [NSString stringWithFormat:@"%@",model.tfper_id]; + + //症状描述 + NSString * siksDesString = @""; + //图片数组 + NSMutableArray * imageArray = [[NSMutableArray alloc] init]; + + NSString *imageString = model.image; + NSArray *listImageArray; + + if (imageString.length == 0) { + // 如果字符串为空,直接返回空数组 + listImageArray = @[]; + } else { + // 移除末尾的逗号 + if ([imageString hasSuffix:@","]) { + imageString = [imageString substringToIndex:imageString.length - 1]; + } + + // 分割字符串并过滤空字符串 + listImageArray = [[imageString componentsSeparatedByString:@","] + filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF != ''"]]; + } + for (int i = 0 ; i < listImageArray.count; i ++) { + + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,listImageArray[i]]; + + + NSString * str1 = @"\\"; + + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:encodedString3 forKey:@"bigImageUrl"]; + [parmDic setObject:encodedString3 forKey:@"thumbnailUrl"]; + + [imageArray addObject:parmDic]; + } + siksDesString = model.medicalDescribe; + + + NSDictionary * parmdic = @{BussinessID:BussinessID_CustomHealthData,@"gender":sexString,@"age":ageString,@"name":nameString,@"symptomDescription":siksDesString,@"imageList":imageArray,@"archivesId":memberId}; + NSData * messagedata = [NSJSONSerialization dataWithJSONObject:parmdic options:0 error:nil]; + V2TIMMessage * message = [[V2TIMManager sharedInstance] createCustomMessage:messagedata]; + if( self.isGroupID == false) { + [self.vc sendMessage:message]; + }else + { + [self.groupvc sendMessage:message]; + } + } +} +#pragma mark - 键盘处理 + +/** + * 键盘即将隐藏 + */ +- (void)keyboardWillHideAction:(NSNotification *)note +{ + + // 1.键盘弹出需要的时间 + CGFloat duration = [note.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + + // 2.动画 + [UIView animateWithDuration:duration animations:^{ + self.popView.evaluationView.frame = CGRectMake(0, kScreenHeight - kRealValue(327), kScreenWidth, kRealValue(327)); + }]; +} + +/** + * 键盘即将弹出 + */ +- (void)keyboardWillShowAction:(NSNotification *)note +{ + + // 1.键盘弹出需要的时间 + CGFloat duration = [note.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + + // 2.动画 + [UIView animateWithDuration:duration animations:^{ + // 取出键盘高度 + CGRect keyboardF = [note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; + CGFloat keyboardH = keyboardF.size.height - 40; +// if (_ThreeInch) { +// self.view.transform = CGAffineTransformMakeTranslation(0, - keyboardH); +// } else { +// self.view.transform = CGAffineTransformMakeTranslation(0, - 50); +// } + self.popView.evaluationView.frame = CGRectMake(0, kScreenHeight - kRealValue(327) - keyboardH, kScreenWidth, kRealValue(327)); + + }]; +} + +- (void)loginImAccount { + + JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + if( self.isGroupID == false) { + self.vc.needScrollToBottom = true; + } + else + { + + self.groupvc .needScrollToBottom = true; + } +} +/* + #pragma mark - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + +} + +- (void)updateConversation:(NSArray *)convList { + +} + + +- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { + switch (status) { + case kCLAuthorizationStatusNotDetermined: + // 用户还未决定是否授权 + [self handleLocationServicesRestricted]; + break; + case kCLAuthorizationStatusRestricted: + // 位置服务被限制(例如家长控制) + [self handleLocationServicesRestricted]; + break; + case kCLAuthorizationStatusDenied: + // 用户拒绝了位置权限 + [self showAlertToOpenSettings]; + break; + case kCLAuthorizationStatusAuthorizedAlways: + case kCLAuthorizationStatusAuthorizedWhenInUse: + // 用户授权了位置权限 + [self handleLocationServicesAuthorized]; + break; + default: + } +} + +- (void)handleLocationServicesRestricted { + // 处理位置服务受限的情况 + NSLog(@"位置服务被限制"); + [self showAlertToOpenSettings]; +} + +- (void)handleLocationServicesDenied { + // 处理位置服务被拒绝的情况 + NSLog(@"位置服务被拒绝"); + [self showAlertToOpenSettings]; +} + + + +- (void)handleLocationServicesDisabled { + // 处理设备的定位服务被禁用的情况 + NSLog(@"设备的定位服务被禁用"); + [self showAlertToOpenSettings]; +} + +- (void)showAlertToOpenSettings { + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"定位服务已关闭" + message:@"请在设置中启用定位服务" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; + if ([[UIApplication sharedApplication] canOpenURL:settingsURL]) { + [[UIApplication sharedApplication] openURL:settingsURL options:@{} completionHandler:nil]; + } + }]; + + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]; + + [alertController addAction:settingsAction]; + [alertController addAction:cancelAction]; + + [self presentViewController:alertController animated:YES completion:nil]; +} + +- (void)handleLocationServicesAuthorized { + // 处理授权成功的情况(例如,开始更新位置信息) + ChatMapViewController * mapVC = [[ChatMapViewController alloc] init]; + MJWeakSelf + mapVC.mapBlcok = ^(CLLocationCoordinate2D coordinate) { + V2TIMMessage * message = [[V2TIMManager sharedInstance] createLocationMessage:@"位置" longitude:coordinate.longitude latitude:coordinate.latitude]; + if( self.isGroupID == false) { + [weakSelf.vc sendMessage:message]; + }else + { + [weakSelf.groupvc sendMessage:message]; + } + }; + [self.navigationController pushViewController:mapVC animated:YES]; + + +} + +//// 手势处理方法 +//- (void)handlePanGesture:(UIScreenEdgePanGestureRecognizer *)gesture { +// if (gesture.state == UIGestureRecognizerStateEnded) { +// NSArray *viewControllers = self.navigationController.viewControllers; +// UIViewController *targetViewController = nil; +// +// // 查找导航堆栈中的目标视图控制器 +// for (UIViewController *vc in viewControllers) { +// if ([vc isKindOfClass:[QuestionViewController class]]) { +// targetViewController = vc; +// break; +// } +// } +// +// if (targetViewController) { +// // 如果找到目标视图控制器,则弹出到该视图控制器 +// [self.navigationController popToViewController:targetViewController animated:YES]; +// } else { +// // 如果没有找到目标视图控制器,则返回到上一页 +// [self.navigationController popViewControllerAnimated:YES]; +// } +// } +//} + +//// UIGestureRecognizerDelegate 方法 +//- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { +// // 确保只有在不是根视图控制器时才启用手势 +// return self.navigationController.viewControllers.count > 1; +//} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/ChatMapViewController.h b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/ChatMapViewController.h new file mode 100644 index 0000000..11568d5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/ChatMapViewController.h @@ -0,0 +1,20 @@ +// +// ChatMapViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/5. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^sendUserSoSLocation)(CLLocationCoordinate2D coordinate); + +@interface ChatMapViewController : HQBaseViewController + +@property (nonatomic, copy) sendUserSoSLocation mapBlcok; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/ChatMapViewController.m b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/ChatMapViewController.m new file mode 100644 index 0000000..cb6d73e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/ChatMapViewController.m @@ -0,0 +1,152 @@ +// +// ChatMapViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/5. +// + +#import "ChatMapViewController.h" + +@interface ChatMapViewController () +{ + CLLocationCoordinate2D coordinate; +} +@property (nonatomic, strong) MAMapView *mapView; +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, assign) BOOL userFirstLoca; +@end + +@implementation ChatMapViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"选择位置"; + self.view.backgroundColor = KWhiteColor; + // Do any additional setup after loading the view. + [self createUI]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + [self.mapView setCompassImage:[UIImage imageNamed:@"compass"]]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + // 开启定位 + self.mapView.showsUserLocation = YES; + self.mapView.userTrackingMode = MAUserTrackingModeFollow; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + [self.mapView setCompassImage:nil]; +} + +- (void)createUI { + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.zoomLevel = 17; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.userTrackingMode = MAUserTrackingModeFollow; + [self.view addSubview:self.mapView]; + self.search.delegate = self; + self.mapView.delegate = self; + [self addNavigationItemWithTitles:@[@"发送"] isLeft:NO target:self action:@selector(sendMapmessate) tags:@[@"100"]]; + +} + +- (void)sendMapmessate { + + if (self.mapBlcok) { + self.mapBlcok(coordinate); + } + [self.navigationController popViewControllerAnimated:YES]; + + +} + +#pragma mark - MAMapviewDelegate +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[MAPointAnnotation class]]) + { + + } + + return nil; +} + +#pragma mark - MAMapViewDelegate + +- (void)mapViewRequireLocationAuth:(CLLocationManager *)locationManager +{ + [locationManager requestAlwaysAuthorization]; +} + + +- (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated +{ +} + + +- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation +{ + // 目的是只用第一次定位的数据,即用户的初始位置 + if (self.userFirstLoca == NO) { + self.userFirstLoca = YES; +// self.userFirstCoor = userLocation.location.coordinate; + coordinate = userLocation.location.coordinate; + MAPointAnnotation *ann = [[MAPointAnnotation alloc] init]; + ann.coordinate = userLocation.location.coordinate; + //固定Annotation并放置地图中心点 + ann.lockedToScreen = YES; + ann.lockedScreenPoint = CGPointMake(mapView.center.x, mapView.center.y); + [mapView addAnnotation:ann]; + } +} + +/* 地图移动结束后调用此接口 */ +- (void)mapView:(MAMapView *)mapView mapDidMoveByUser:(BOOL)wasUserAction +{ + // 将指定view坐标系的坐标转换为经纬度 + CLLocationCoordinate2D moveCoor = [mapView convertPoint:CGPointMake(mapView.center.x, mapView.center.y-64) toCoordinateFromView:mapView]; + + // 通过坐标点得到经纬度,从而进行反地理编码 + AMapReGeocodeSearchRequest *rego = [[AMapReGeocodeSearchRequest alloc] init]; + // 是否返回扩展信(因为我们需要得到附近地理位置信息,所以设为YES) + rego.requireExtension = YES; + rego.location = [AMapGeoPoint locationWithLatitude:moveCoor.latitude longitude:moveCoor.longitude]; + [self.search AMapReGoecodeSearch:rego]; +} + +/* 逆地理编码查询回调函数 */ +- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response +{ + // reGeodeVC就是一个简单的tableView布局,数据来源就是response.regeocode.pois +} + +/* 这个是reGeodeVC点击tableViewCell的回调 */ +#pragma mark - ReGeocodeDelegate +-(void)selectAMapAPI:(AMapPOI *)poi +{ + // 将地图的中心点移至poi点 + [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(poi.location.latitude, poi.location.longitude) animated:YES]; +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/CurrentLocationViewController.h b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/CurrentLocationViewController.h new file mode 100644 index 0000000..2ef951f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/CurrentLocationViewController.h @@ -0,0 +1,21 @@ +// +// CurrentLocationViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface CurrentLocationViewController : HQBaseViewController + +@property (nonatomic, assign) double longitude; + +@property (nonatomic, assign) double latitude; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/CurrentLocationViewController.m b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/CurrentLocationViewController.m new file mode 100644 index 0000000..2097fd0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/CurrentLocationViewController.m @@ -0,0 +1,138 @@ +// +// CurrentLocationViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import "CurrentLocationViewController.h" + +@interface CurrentLocationViewController () +{ + CLLocationCoordinate2D coordinate; +} +@property (nonatomic, strong) MAMapView *mapView; +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, assign) BOOL userFirstLoca; + +@end + +@implementation CurrentLocationViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"我的位置"; + self.view.backgroundColor = KWhiteColor; + // Do any additional setup after loading the view. + [self createUI]; +} + + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + +// [self.mapView setCompassImage:[UIImage imageNamed:@"pin"]]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + [self.mapView setCompassImage:nil]; +} + +- (void)createUI { + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.zoomLevel = 17; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + // 设置中心点时带动画效果 + [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(self.latitude, self.longitude) animated:YES]; + + [self.view addSubview:self.mapView]; + self.search.delegate = self; + self.mapView.delegate = self; + + MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; + pointAnnotation.coordinate = CLLocationCoordinate2DMake(self.latitude, self.longitude); + [_mapView addAnnotation:pointAnnotation]; + +} + +#pragma mark - MAMapviewDelegate +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[MAPointAnnotation class]]) + { + static NSString *pointReuseIndentifier = @"pointReuseIndentifier"; + MAPinAnnotationView*annotationView = (MAPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndentifier]; + if (annotationView == nil) + { + annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndentifier]; + } + annotationView.canShowCallout= YES; //设置气泡可以弹出,默认为NO + annotationView.animatesDrop = YES; //设置标注动画显示,默认为NO + annotationView.draggable = YES; //设置标注可以拖动,默认为NO + annotationView.pinColor = MAPinAnnotationColorPurple; + annotationView.centerOffset = CGPointMake(0, -18); +// annotationView.image = [UIImage imageNamed:@"pin"]; + return annotationView; + } + return nil; +} +#pragma mark - MAMapViewDelegate + +- (void)mapViewRequireLocationAuth:(CLLocationManager *)locationManager +{ + [locationManager requestAlwaysAuthorization]; +} + + +- (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated +{ +} + + +- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation +{ + +} + +/* 地图移动结束后调用此接口 */ +- (void)mapView:(MAMapView *)mapView mapDidMoveByUser:(BOOL)wasUserAction +{ + +} + +/* 逆地理编码查询回调函数 */ +- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response +{ + // reGeodeVC就是一个简单的tableView布局,数据来源就是response.regeocode.pois +} + +/* 这个是reGeodeVC点击tableViewCell的回调 */ +#pragma mark - ReGeocodeDelegate +-(void)selectAMapAPI:(AMapPOI *)poi +{ + // 将地图的中心点移至poi点 + [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(self.latitude, self.longitude) animated:YES]; +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/SendHealthDataViewController.h b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/SendHealthDataViewController.h new file mode 100644 index 0000000..fdef8c7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/SendHealthDataViewController.h @@ -0,0 +1,18 @@ +// +// SendHealthDataViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SendHealthDataViewController : HQBaseViewController + +@property (nonatomic, strong) NSString * memberId_id; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/SendHealthDataViewController.m b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/SendHealthDataViewController.m new file mode 100644 index 0000000..78cd308 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Controller/SendHealthDataViewController.m @@ -0,0 +1,110 @@ +// +// SendHealthDataViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "SendHealthDataViewController.h" +#import "SendHealthDataTable.h" +#import "QuestionDiseaseInfoModel.h" + + +@interface SendHealthDataViewController () + +@property (nonatomic, strong) SendHealthDataTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation SendHealthDataViewController + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.navigationItem.title = @"健康档案"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + self.homeTable = [[SendHealthDataTable alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStyleGrouped]; + MJWeakSelf; + self.homeTable.healthBlcok = ^(diseaseModel * _Nonnull phyModel) { + KPostNotification(@"sendHealth", phyModel); + [weakSelf.navigationController popViewControllerAnimated:YES]; + }; + [self.view addSubview:self.homeTable]; + +} + +- (void)createData { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.memberId_id forKey:@"memberId"]; + + JKCQAPI * api = [[JKCQAPI alloc] init:self tag:@"HEALTHDATA" NeedToken:nil]; + + [api getsendHealthDataReportAPI:parmDic]; +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"HEALTHDATA"]) { + + NSArray * array = response; + + for (NSDictionary * parm in array) { + + diseaseModel * model = [diseaseModel modelWithDictionary:parm]; + + [self.dataArray addObject:model]; + } + if (self.dataArray.count < 1) { + + EasyAlertView *alertView = [EasyAlertView alertViewWithTitle:@"提示" subtitle:@"暂无健康档案" AlertViewType:AlertViewTypeSystemAlert config:nil]; + [alertView addAlertItem:^EasyAlertItem *{ + + return [EasyAlertItem itemWithTitle:@"确定" type:AlertItemTypeCustom callback:^(EasyAlertView *showview, long index) { + + [self.navigationController popViewControllerAnimated:YES]; + + }]; + }]; + [alertView showAlertView]; + + } + self.homeTable.dataArray = self.dataArray; + } +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.h new file mode 100644 index 0000000..c988d64 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.h @@ -0,0 +1,24 @@ +// +// DoctiorIDCardCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/8. +// + +#import "TUIMessageCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctiorIDCardCellData : TUIMessageCellData + +@property (nonatomic, copy) NSString * cardId; +@property (nonatomic, copy) NSString * doctorName; +@property (nonatomic, copy) NSString * organization; +@property (nonatomic, copy) NSString * departmentName; +@property (nonatomic, copy) NSString * doctorTitle; +@property (nonatomic, copy) NSString * doctorHeadImg; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.m new file mode 100644 index 0000000..b1b5008 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.m @@ -0,0 +1,44 @@ +// +// DoctiorIDCardCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/8. +// + +#import "DoctiorIDCardCellData.h" + +@implementation DoctiorIDCardCellData + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + DoctiorIDCardCellData *cellData = [[DoctiorIDCardCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; +// cellData.lation = [param[@"lation"] floatValue]; + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + cellData.doctorName = [NSString stringWithFormat:@"%@",param[@"doctorName"]] ; + cellData.doctorTitle = [NSString stringWithFormat:@"%@",param[@"doctorTitle"]] ; + cellData.doctorHeadImg = [NSString stringWithFormat:@"%@",param[@"doctorHeadImg"]] ; + cellData.cardId = [NSString stringWithFormat:@"%@",param[@"cardId"]] ; + cellData.organization = [NSString stringWithFormat:@"%@",param[@"organization"]] ; + cellData.departmentName = [NSString stringWithFormat:@"%@",param[@"departmentName"]] ; + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + + CGFloat textMaxWidth = 245.f; + + CGSize size = CGSizeMake(textMaxWidth, 106); + return size; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.h new file mode 100644 index 0000000..dc1b0e7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.h @@ -0,0 +1,28 @@ +// +// DoctorIDCardMessageCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/8. +// + +#import "TUIMessageCell.h" +#import "DoctiorIDCardCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorIDCardMessageCell : TUIMessageCell + +@property (nonatomic, strong) UIImageView * doctorImg; +@property (nonatomic, strong) UILabel * doctorNameLabel; +@property (nonatomic, strong) UILabel * jobLabel; +@property (nonatomic, strong) UILabel * hospatilLabel; +@property (nonatomic, strong) UILabel * bottomLabel; +@property (nonatomic, strong) NSString * cardId; +@property (nonatomic, strong) NSDate * msgTime; + +- (void)fillWithData:(DoctiorIDCardCellData *)data; // 绘制 UI + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.m new file mode 100644 index 0000000..9a0f69c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.m @@ -0,0 +1,129 @@ +// +// DoctorIDCardMessageCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/8. +// + +#import "DoctorIDCardMessageCell.h" + +@implementation DoctorIDCardMessageCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = KWhiteColor; + self.doctorImg = [[UIImageView alloc] init]; + self.doctorImg.layer.cornerRadius = 10; + [self.container addSubview:self.doctorImg]; + + self.doctorNameLabel = [[UILabel alloc] init]; + self.doctorNameLabel.text = @"张医生"; + self.doctorNameLabel.font = SYSTEMFONT(14); + self.doctorNameLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.doctorNameLabel]; + + self.jobLabel = [[UILabel alloc] init]; + self.jobLabel.text = @"张医生"; + self.jobLabel.font = SYSTEMFONT(14); + self.jobLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.jobLabel]; + + self.hospatilLabel = [[UILabel alloc] init]; + self.hospatilLabel.text = @"西京医院 - 消化科"; + self.hospatilLabel.font = SYSTEMFONT(14); + self.hospatilLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.hospatilLabel]; + + self.bottomLabel = [[UILabel alloc] init]; + self.bottomLabel.text = @"个人名片"; + self.bottomLabel.font = SYSTEMFONT(12); + self.bottomLabel.textColor = UIColorHex(#999999); + self.bottomLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.bottomLabel]; +} + + +- (void)fillWithData:(DoctiorIDCardCellData *)data { + + [super fillWithData:data]; + self.doctorNameLabel.text = data.doctorName; + self.jobLabel.text = data.doctorTitle; +// self.messageData = data.timestamp; + if (ValidStr(data.departmentName)) { + + self.hospatilLabel.text = [NSString stringWithFormat:@"%@",data.organization]; + + }else + { + self.hospatilLabel.text = [NSString stringWithFormat:@"%@ - %@",data.organization,data.departmentName]; + + } + self.bottomLabel.text = @"个人名片"; + + self.cardId = data.cardId; + + + if ([data.doctorHeadImg containsString:@"https"]) { + NSString * photo = [NSString stringWithFormat:@"%@",data.doctorHeadImg]; + NSString * str1 = @"\\"; + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; + + } + else + { + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,data.doctorHeadImg]; + + NSString * str1 = @"\\"; + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; + } + +} + + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat w = [HQCommonUtils getLengthFromText:self.doctorNameLabel.text andFontSize:14]; + + self.doctorImg.frame = CGRectMake(14, 18, 50, 50); + self.doctorNameLabel.frame = CGRectMake(self.doctorImg.right + 14, 18, w, 20); + self.jobLabel.frame = CGRectMake(self.doctorNameLabel.right + 2, 18, self.container.width - 80, 20); + + self.hospatilLabel.frame = CGRectMake(self.doctorNameLabel.left, self.doctorNameLabel.bottom + 10, self.container.width - 80, 20); + + UIView * linv = [[UIView alloc] initWithFrame:CGRectMake(10, self.doctorImg.bottom + 10, self.container.width, 1)]; + linv.backgroundColor = UIColorHex(#EFEFEF); + [self.container addSubview:linv]; + + self.bottomLabel.frame = CGRectMake(10, linv.bottom + 8, 200, 12); +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCell.h new file mode 100644 index 0000000..5fa025a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCell.h @@ -0,0 +1,25 @@ +// +// CompleteReviewCell.h +// QinghaiProject +// +// Created by Apple on 2024/5/20. +// + +#import "TUIMessageCell.h" +#import "CompleteReviewCellData.h" +NS_ASSUME_NONNULL_BEGIN + +@interface CompleteReviewCell : TUIMessageCell + + +@property (nonatomic, strong) UILabel * systemTitleLabel; +@property (nonatomic, strong) UILabel * commantLabel; +@property (nonatomic, strong) UIButton * reviewBtn; +//@property (nonatomic, weak)id evlationDelegate; +@property (nonatomic, assign) BOOL isEveal; + +- (void)fillWithData:(CompleteReviewCellData *)data; // 绘制 UI + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCell.m new file mode 100644 index 0000000..5880995 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCell.m @@ -0,0 +1,90 @@ +// +// CompleteReviewCell.m +// QinghaiProject +// +// Created by Apple on 2024/5/20. +// + +#import "CompleteReviewCell.h" + +@implementation CompleteReviewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + + + [self createUI]; + + } + + return self; +} + +- (void)createUI { + + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = KWhiteColor; + + + self.systemTitleLabel = [[UILabel alloc] init]; + self.systemTitleLabel.text = @"系统消息"; + self.systemTitleLabel.font = SYSTEMFONT(14); + self.systemTitleLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.systemTitleLabel]; + + self.commantLabel = [[UILabel alloc] init]; + self.commantLabel.text = @""; + self.commantLabel.font = SYSTEMFONT(14); + self.commantLabel.textAlignment = NSTextAlignmentLeft; + self.commantLabel.numberOfLines = 0; + [self.container addSubview:self.commantLabel]; + + +} + + +- (void)fillWithData:(CompleteReviewCellData *)data { + + [super fillWithData:data]; + + self.systemTitleLabel.text = data.title;; + self.commantLabel.text = data.content; +} + + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat h = [HQCommonUtils getSpaceLabelHeight:self.commantLabel withStr:self.commantLabel.text withFont:[UIFont systemFontOfSize:14] withWidth:self.container.width - 14 withLineSpacing:2]; + + self.systemTitleLabel.frame = CGRectMake(14, 18, 245 - 28, 20); + self.commantLabel.frame = CGRectMake( 14, self.systemTitleLabel.bottom + 10, 245 - 28, h); + self.reviewBtn.layer.cornerRadius = 12; + self.reviewBtn.layer.masksToBounds = YES; + self.reviewBtn.frame = CGRectMake(self.container.width/2 - 30, self.commantLabel.bottom + 14, 60, 30); + +} + +- (void)evlationDoctor { + + if ([self.delegate respondsToSelector:@selector(evlationDoctorStarView)]) { + + [self.delegate evlationDoctorStarView]; + } + +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCellData.h new file mode 100644 index 0000000..2ab043b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCellData.h @@ -0,0 +1,20 @@ +// +// CompleteReviewCellData.h +// QinghaiProject +// +// Created by Apple on 2024/5/20. +// + +#import "TUIMessageCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface CompleteReviewCellData : TUIMessageCellData + +@property (nonatomic, copy) NSString * title; +@property (nonatomic, copy) NSString * content; +@property (nonatomic, assign) long type; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCellData.m new file mode 100644 index 0000000..42b2dc9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/CompleteReviewCellData.m @@ -0,0 +1,42 @@ +// +// CompleteReviewCellData.m +// QinghaiProject +// +// Created by Apple on 2024/5/20. +// + +#import "CompleteReviewCellData.h" + +@implementation CompleteReviewCellData + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + CompleteReviewCellData *cellData = [[CompleteReviewCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.title = @"系统消息" ; + cellData.content = @"您已完成评价,无需再次评价" ; + + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + UILabel * commanLabel = [[UILabel alloc] init]; + CGFloat h = [HQCommonUtils getSpaceLabelHeight:commanLabel withStr:self.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2]; + CGFloat textMaxWidth = 245.f; + CGFloat textMaxHeight = h + 100; + + CGSize size = CGSizeMake(textMaxWidth, textMaxHeight); + return size; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.h new file mode 100644 index 0000000..6d9ae6a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.h @@ -0,0 +1,21 @@ +// +// EndSystemCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/10. +// + +#import "TUIMessageCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EndSystemCellData : TUIMessageCellData + +@property (nonatomic, copy) NSString * title; +@property (nonatomic, copy) NSString * content; +@property (nonatomic, assign) long type; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.m new file mode 100644 index 0000000..6ca284f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.m @@ -0,0 +1,43 @@ +// +// EndSystemCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/10. +// + +#import "EndSystemCellData.h" + +@implementation EndSystemCellData + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + EndSystemCellData *cellData = [[EndSystemCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.title = [NSString stringWithFormat:@"%@",param[@"title"]] ; + cellData.content = [NSString stringWithFormat:@"%@",param[@"content"]] ; + cellData.type = [param[@"type"] longValue]; + + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + UILabel * commanLabel = [[UILabel alloc] init]; + CGFloat h = [HQCommonUtils getSpaceLabelHeight:commanLabel withStr:self.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2]; + CGFloat textMaxWidth = 245.f; + CGFloat textMaxHeight = h + 100; + + CGSize size = CGSizeMake(textMaxWidth, textMaxHeight); + return size; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.h new file mode 100644 index 0000000..61e9cab --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.h @@ -0,0 +1,31 @@ +// +// EndSystemSoSCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/10. +// + +#import "TUIMessageCell.h" +#import "EndSystemCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +//@protocol evlationActionProtocol +// +//- (void)evlationDoctorStarView; +// +//@end + +@interface EndSystemSoSCell : TUIMessageCell + +@property (nonatomic, strong) UILabel * systemTitleLabel; +@property (nonatomic, strong) UILabel * commantLabel; +@property (nonatomic, strong) UIButton * reviewBtn; +//@property (nonatomic, weak)id evlationDelegate; +@property (nonatomic, assign) BOOL isEveal; + +- (void)fillWithData:(EndSystemCellData *)data; // 绘制 UI + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.m new file mode 100644 index 0000000..728183d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.m @@ -0,0 +1,126 @@ +// +// EndSystemSoSCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/10. +// + +#import "EndSystemSoSCell.h" + +@implementation EndSystemSoSCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + + + [self createUI]; + + } + + return self; +} + +- (void)createUI { + + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = KWhiteColor; + + + self.systemTitleLabel = [[UILabel alloc] init]; + self.systemTitleLabel.text = @"系统消息"; + self.systemTitleLabel.font = SYSTEMFONT(14); + self.systemTitleLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.systemTitleLabel]; + + self.commantLabel = [[UILabel alloc] init]; + self.commantLabel.text = @""; + self.commantLabel.font = SYSTEMFONT(14); + self.commantLabel.textAlignment = NSTextAlignmentLeft; + self.commantLabel.numberOfLines = 0; + [self.container addSubview:self.commantLabel]; + + self.reviewBtn = [[UIButton alloc] init]; + [self.reviewBtn setTitle:@"去评价" forState:UIControlStateNormal]; + [self.reviewBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.reviewBtn.backgroundColor = UIColorHex(#21BEBD); + self.reviewBtn.titleLabel.font = SYSTEMFONT(12); + self.reviewBtn.hidden = false; + [self.reviewBtn addTarget:self action:@selector(evlationDoctor) forControlEvents:UIControlEventTouchUpInside]; + [self.container addSubview:self.reviewBtn]; +} + + +- (void)fillWithData:(EndSystemCellData *)data { + + [super fillWithData:data]; + if ([data.avatarUrl.absoluteString isEqualToString:@""] || data.avatarUrl == nil ) { + [self.avatarView setImage:[UIImage imageNamed:@"heard_man"]]; + } + else + { + [self.avatarView sd_setImageWithURL:data.avatarUrl placeholderImage:DefaultAvatarImage]; + + } + + if ([TUIChatConfig defaultConfig].isEvealCell == true) { + self.reviewBtn.backgroundColor = UIColor.grayColor; + self.reviewBtn.userInteractionEnabled = false; + if (data.type == 2) { + self.reviewBtn.hidden = false; + }else + { + self.reviewBtn.hidden = true; + } + } + else + { + //1用戶咨詢專家 2 專家咨詢小助手 + if (data.type == 2) { + self.reviewBtn.hidden = false; + }else + { + self.reviewBtn.hidden = true; + } + } + + self.systemTitleLabel.text = data.title;; + self.commantLabel.text = data.content; +} + + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat h = [HQCommonUtils getSpaceLabelHeight:self.commantLabel withStr:self.commantLabel.text withFont:[UIFont systemFontOfSize:14] withWidth:self.container.width - 14 withLineSpacing:2]; + + self.systemTitleLabel.frame = CGRectMake(14, 18, 245 - 28, 20); + self.commantLabel.frame = CGRectMake( 14, self.systemTitleLabel.bottom + 10, 245 - 28, h); + self.reviewBtn.layer.cornerRadius = 12; + self.reviewBtn.layer.masksToBounds = YES; + self.reviewBtn.frame = CGRectMake(self.container.width/2 - 30, self.commantLabel.bottom + 14, 60, 30); + +} + +- (void)evlationDoctor { + + if ([self.delegate respondsToSelector:@selector(evlationDoctorStarView)]) { + + [self.delegate evlationDoctorStarView]; + } + +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.h new file mode 100644 index 0000000..151d9ee --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.h @@ -0,0 +1,21 @@ +// +// chatPictureCollectionViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import +#import "healthDataCustomCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface chatPictureCollectionViewCell : UICollectionViewCell + +@property (nonatomic, strong) UIImageView * pictureImage; + +- (void)fillWithData:(healthDataCustomCellData *)data; // 绘制 UI + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.m new file mode 100644 index 0000000..9151f11 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.m @@ -0,0 +1,30 @@ +// +// chatPictureCollectionViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "chatPictureCollectionViewCell.h" + +@implementation chatPictureCollectionViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + + if(self = [super initWithFrame:frame]) { + [self createUI]; + } + return self; +} + +- (void)createUI { + + self.pictureImage = [[UIImageView alloc] init]; +// self.pictureImage.frame = CGRectMake(0, 0, (230 -10) /2, (230 -10) /2); + [self.contentView addSubview:self.pictureImage]; + [self.pictureImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.offset(0); + }]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.h new file mode 100644 index 0000000..73103de --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.h @@ -0,0 +1,29 @@ +// +// healthDataCustomCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "TUIMessageCell.h" + +NS_ASSUME_NONNULL_BEGIN + + +@interface healthDataCustomCell : TUIMessageCell + +@property (nonatomic, strong) UILabel * questionNameLab; + +@property (nonatomic, strong) UILabel * sexLabel; + +@property (nonatomic, strong) UILabel * illnessLabel; + +@property (nonatomic, strong) UICollectionView * pictureView; + +@property (nonatomic, strong) NSMutableArray * imageDataArray; + +@property (nonatomic, copy) NSString * fileId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.m new file mode 100644 index 0000000..7cb2276 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.m @@ -0,0 +1,211 @@ +// +// healthDataCustomCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "healthDataCustomCell.h" +#import "chatPictureCollectionViewCell.h" + + + +@implementation healthDataCustomCell + +- (NSMutableArray *)imageDataArray { + + if (!_imageDataArray) { + + _imageDataArray = [[NSMutableArray alloc] init]; + } + return _imageDataArray; +} + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + return self; +} + +- (void)createUI { + //姓名 + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = KWhiteColor; + self.questionNameLab = [[UILabel alloc] init]; + self.questionNameLab.font = SYSTEMFONT(15); + self.questionNameLab.textColor = CFontColor1; + [self.container addSubview:self.questionNameLab]; + //性别 + self.sexLabel = [[UILabel alloc] init]; + self.sexLabel.font = SYSTEMFONT(13); + self.sexLabel.textColor = CFontColor2; + [self.container addSubview:self.sexLabel]; + //病情描述 + self.illnessLabel = [[UILabel alloc] init]; + self.illnessLabel.font = SYSTEMFONT(15); + self.illnessLabel.textColor = CFontColor1; + self.illnessLabel.numberOfLines = 0; + [self.container addSubview:self.illnessLabel]; + //图片 + UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc]init]; + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); // 设置 section 的边距 + layout.minimumInteritemSpacing = 10; // 设置单元格之间的水平间距 + layout.minimumLineSpacing = 10; // 设置单元格之间的垂直间距 + + self.pictureView = [[UICollectionView alloc]initWithFrame:CGRectMake(0,46,260,200) collectionViewLayout:layout]; + self.pictureView.delegate = self; + self.pictureView.dataSource = self; + self.pictureView.showsHorizontalScrollIndicator = NO; + self.pictureView.scrollEnabled = true; + [self.container addSubview:self.pictureView]; + + [self.pictureView registerClass:[chatPictureCollectionViewCell class] forCellWithReuseIdentifier:@"collectID"]; +} + +-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ + return 1; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + + return self.imageDataArray.count; + +} + + +-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + + chatPictureCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collectID" forIndexPath:indexPath]; + + NSDictionary * imageDic = self.imageDataArray[indexPath.item]; + + NSString * imageUrl = @""; + if ([imageDic.allKeys containsObject:@"bigImageUrl"]) { + imageUrl = [imageDic objectForKey:@"bigImageUrl"]; + } + [cell.pictureImage sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:PLACEHOLD_IMG]; + cell.backgroundColor = [UIColor whiteColor]; + DLog(@"%ld",indexPath.row); + return cell; +} +//- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath +//{ +// if (self.imageDataArray.count == 1) { +// +// return CGSizeMake(215,215);; +// } +// +// +// return CGSizeMake((235 -10) /2,(235 - 10) /2); +// +//} + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + + + CGFloat padding = 10; + CGFloat cellWidth = (collectionView.frame.size.width - (padding * 3)) / 2; // 计算单元格宽度 + if (self.imageDataArray.count == 1) { + + cellWidth = (collectionView.frame.size.width - (padding * 2)) ; + } + else{ + CGFloat cellWidth = (collectionView.frame.size.width - (padding * 3)) / 2; // 计算单元格宽度 + } + return CGSizeMake(cellWidth, cellWidth); // 示例:单元格为正方形 +} +//赋值 + +- (void)fillWithData:(healthDataCustomCellData *)data; +{ + [super fillWithData:data]; + [self.imageDataArray removeAllObjects]; + diseaseModel * model = [[diseaseModel alloc] init]; + if (data.model.list.count > 0) { + model = data.model.list[0]; + } + + self.questionNameLab.text = [NSString stringWithFormat:@"姓名:%@",data.name]; + self.sexLabel.text = [NSString stringWithFormat:@"%@ | %@岁",data.gender,data.age] ; + self.illnessLabel.text = [NSString stringWithFormat:@"症状描述:%@",data.symptomDescription]; + + if (data.imageList.count >=5) { + + for (int i = 0 ; i < 4; i++) { + + [self.imageDataArray addObject:data.imageList[i]]; + } + + }else if (data.imageList.count <5) + { + [self.imageDataArray addObjectsFromArray:data.imageList]; + } + + [self.pictureView reloadData]; + self.fileId = data.fileId; +} + +// 设置控件坐标 +- (void)layoutSubviews +{ + [super layoutSubviews]; + + CGRect rect = [self.illnessLabel.text boundingRectWithSize:CGSizeMake(245, MAXFLOAT) + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } + context:nil]; + + + + self.questionNameLab.mm_sizeToFit().mm_top(10).mm_left(10).mm_width([HQCommonUtils getLengthFromText:self.questionNameLab.text andFontSize:15]).mm_height(16); + + self.sexLabel.mm_top(self.questionNameLab.mm_y + self.questionNameLab.mm_h + 15).mm_left(10).mm_width(100).mm_height(16); + + self.illnessLabel.mm_top(self.sexLabel.mm_h + 16 + self.sexLabel.mm_y).mm_left(10).mm_width(245).mm_height(rect.size.height); + + CGFloat pictureH = 0.01; + if (self.imageDataArray.count == 0) { + + self.pictureView.hidden = true; + pictureH = CGFLOAT_MIN; + + } + if (self.imageDataArray.count == 1) { + + pictureH = 260 ; // 计算单元格宽度 + } + if (self.imageDataArray.count == 2) { + + pictureH = (260 - 30)/2 ; + } + if (self.imageDataArray.count > 2) { + + pictureH = 260; + } + + self.pictureView.mm_top(self.illnessLabel.mm_y + self.illnessLabel.mm_h + 20).mm_width(self.container.mm_w).mm_height(pictureH); + + +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.h new file mode 100644 index 0000000..b5c8dea --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.h @@ -0,0 +1,31 @@ +// +// healthDataCustomCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "TUIMessageCellData.h" +#import "QuestionDiseaseInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface healthDataCustomCellData : TUIMessageCellData + +@property (nonatomic, strong) NSString * name; + +@property (nonatomic, strong) NSString * gender; + +@property (nonatomic, strong) NSString * age; + +@property (nonatomic, strong) NSString * symptomDescription; + +@property (nonatomic, strong) NSArray * imageList; + +@property (nonatomic, strong) QuestionDiseaseInfoModel * model; + +@property (nonatomic, copy) NSString * fileId; +@end + + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.m new file mode 100644 index 0000000..5cfb9d2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.m @@ -0,0 +1,71 @@ +// +// healthDataCustomCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "healthDataCustomCellData.h" +#import "QuestionDiseaseInfoModel.h" + +@implementation healthDataCustomCellData + ++ (healthDataCustomCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + healthDataCustomCellData *cellData = [[healthDataCustomCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.name = [NSString stringWithFormat:@"%@", param[@"name"]]; + cellData.age = [NSString stringWithFormat:@"%@", param[@"age"]]; + cellData.gender = [NSString stringWithFormat:@"%@", param[@"gender"]]; + cellData.symptomDescription = [NSString stringWithFormat:@"%@", param[@"symptomDescription"]]; + cellData.imageList = param[@"imageList"]; + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + cellData.fileId = param[@"archivesId"]; + return cellData; +} + +//+ (NSString *)getDisplayString:(V2TIMMessage *)message { +// NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; +// return param[@"illes"]; +//} + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + CGFloat pictureH = 245.f; + if (self.imageList.count == 0) { + + pictureH = 10; + } + if (self.imageList.count == 1) { + + pictureH = 260 +10; + } + if (self.imageList.count == 2) { + + pictureH = (260 - 30 )/2 + 20; + } + if (self.imageList.count > 2) { + + pictureH = 260 + 10 ; + } + CGFloat textMaxWidth = 245.f; + CGRect rect = [self.symptomDescription boundingRectWithSize:CGSizeMake(textMaxWidth, MAXFLOAT) + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } + context:nil]; + CGSize size = CGSizeMake(textMaxWidth + 15, 80 + rect.size.height + pictureH ); + + + return size; +} + + +@end + diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.h new file mode 100644 index 0000000..ffbe4f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.h @@ -0,0 +1,21 @@ +// +// sendPhysicalCustomCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "TUIMessageCell.h" +#import "sendPhysicalCustomCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface sendPhysicalCustomCell : TUIMessageCell + +@property (nonatomic, strong) UILabel * titleLabel; +@property (nonatomic, strong) UILabel * hospationLabel; + +- (void)fillWithData:(sendPhysicalCustomCellData *)data; // 绘制 UI +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.m new file mode 100644 index 0000000..558cdbd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.m @@ -0,0 +1,84 @@ +// +// sendPhysicalCustomCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "sendPhysicalCustomCell.h" + +@implementation sendPhysicalCustomCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = KWhiteColor; + + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.text = @""; + self.titleLabel.font = SYSTEMFONT(14); + self.titleLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.titleLabel]; + + self.hospationLabel = [[UILabel alloc] init]; + self.hospationLabel.text = @""; + self.hospationLabel.font = SYSTEMFONT(14); + self.hospationLabel.numberOfLines = 2; + self.hospationLabel.textAlignment = NSTextAlignmentLeft; + [self.container addSubview:self.hospationLabel]; + + +} + + +- (void)fillWithData:(sendPhysicalCustomCellData *)data { + + [super fillWithData:data]; + + self.titleLabel.text = [NSString stringWithFormat:@"%@-%@-%@岁", data.name,data.age,data.year] ; + self.hospationLabel.text = [NSString stringWithFormat:@"%@ %@年",data.hospital,data.year]; +} + + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat h = [HQCommonUtils getSpaceLabelHeight:self.hospationLabel withStr:self.hospationLabel.text withFont:[UIFont systemFontOfSize:14] withWidth:self.container.width - 14 withLineSpacing:2]; + + self.titleLabel.frame = CGRectMake(14, 18, 245 - 28, 20); + self.hospationLabel.frame = CGRectMake( 14, self.titleLabel.bottom + 10, 245 - 28, h); + + +} + +- (void)evlationDoctor { + + if ([self.delegate respondsToSelector:@selector(evlationDoctorStarView)]) { + + [self.delegate evlationDoctorStarView]; + } +} +@end + diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.h new file mode 100644 index 0000000..5aa1f5d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.h @@ -0,0 +1,26 @@ +// +// sendPhysicalCustomCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "TUIMessageCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface sendPhysicalCustomCellData : TUIMessageCellData + +@property (nonatomic, copy) NSString * reportId; +@property (nonatomic, copy) NSString * name; +@property (nonatomic, copy) NSString * gender; +@property (nonatomic, copy) NSString * hospital; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * cardNum; +@property (nonatomic, copy) NSString * year; +@property (nonatomic, copy) NSString * age; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.m new file mode 100644 index 0000000..a895575 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.m @@ -0,0 +1,39 @@ +// +// sendPhysicalCustomCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/25. +// + +#import "sendPhysicalCustomCellData.h" + +@implementation sendPhysicalCustomCellData + + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + sendPhysicalCustomCellData *cellData = [[sendPhysicalCustomCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.name = [NSString stringWithFormat:@"%@",param[@"name"]] ; + cellData.gender = [NSString stringWithFormat:@"%@",param[@"gender"]] ; + cellData.age = [NSString stringWithFormat:@"%@",param[@"age"]]; + cellData.hospital = [NSString stringWithFormat:@"%@",param[@"hospital"]] ; + cellData.createTime = [NSString stringWithFormat:@"%@",param[@"createTime"]] ; + cellData.cardNum =[NSString stringWithFormat:@"%@",param[@"cardNum"]] ; + cellData.year =[NSString stringWithFormat:@"%@",param[@"year"]] ; + return cellData; +} + +- (CGSize)contentSize +{ + + CGFloat textMaxWidth = 245.f; + CGFloat textMaxHeight = 90; + + CGSize size = CGSizeMake(textMaxWidth, textMaxHeight); + return size; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.h new file mode 100644 index 0000000..aa89cee --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.h @@ -0,0 +1,21 @@ +// +// StarMarkCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/3. +// + +#import "TUIMessageCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface StarMarkCellData : TUIMessageCellData + +@property (nonatomic, strong) NSString * reviewConnet; + +@property (nonatomic, strong) NSString * strarNumber; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.m new file mode 100644 index 0000000..beba219 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.m @@ -0,0 +1,35 @@ +// +// StarMarkCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/3. +// + +#import "StarMarkCellData.h" + +@implementation StarMarkCellData + + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + StarMarkCellData *cellData = [[StarMarkCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.reviewConnet = param[@"reviewConnet"]; + cellData.strarNumber = [NSString stringWithFormat:@"%@",param[@"strarNumber"]]; + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + +- (CGSize)contentSize +{ + UILabel * hlabel = [[UILabel alloc] init]; + CGFloat h = [HQCommonUtils getSpaceLabelHeight:hlabel withStr:self.reviewConnet withFont:[UIFont systemFontOfSize:13] withWidth: 245 - 30 withLineSpacing:5]; + CGSize size = CGSizeMake(245,h + 80); + return size; + + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.h new file mode 100644 index 0000000..31792c2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.h @@ -0,0 +1,26 @@ +// +// StarMarkCustomCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/3. +// + +#import "TUIMessageCell.h" +#import "StarMarkCellData.h" +#import "FSXBStarRateView.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface StarMarkCustomCell : TUIMessageCell +@property (nonatomic, strong) UILabel * pinglunLabel; +@property (nonatomic, strong) UILabel * pingneirongLabel; + +@property (nonatomic, strong) FSXBStarRateView * starView; +@property UIImageView * mapImage; // +- (void)fillWithData:(StarMarkCellData *)data; // 绘制 UI + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.m new file mode 100644 index 0000000..afb886e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.m @@ -0,0 +1,85 @@ +// +// StarMarkCustomCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/3. +// + +#import "StarMarkCustomCell.h" + +@implementation StarMarkCustomCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + + } + return self; +} + +- (void)createUI { + + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = CViewBgColor; + UILabel * pinglunLabel = [[UILabel alloc] init]; + pinglunLabel.text = @"服务评价"; + pinglunLabel.font = SYSTEMFONT(14); + pinglunLabel.textColor = CFontColor1; + pinglunLabel.textAlignment = NSTextAlignmentLeft; + self.pinglunLabel = pinglunLabel; + [self.container addSubview:pinglunLabel]; + + self.starView = [[FSXBStarRateView alloc] initWithFrame:CGRectMake(0, 14, 100, 14)]; + self.starView.rateStyle = 1; + [self.container addSubview:self.starView]; + + self.pingneirongLabel = [[UILabel alloc] init]; + self.pingneirongLabel.text = @" "; + self.pingneirongLabel.font = SYSTEMFONT(14); + self.pingneirongLabel.textColor = CFontColor1; + self.pingneirongLabel.numberOfLines = 0; + self.pingneirongLabel.textAlignment = NSTextAlignmentCenter; + [self.container addSubview:self.pingneirongLabel]; + +} + + +- (void)fillWithData:(StarMarkCellData *)data { + + [super fillWithData:data]; + self.starView.currentScore = [data.strarNumber floatValue]; + self.pingneirongLabel.text = data.reviewConnet; +} + + +// 设置控件坐标 +- (void)layoutSubviews +{ + [super layoutSubviews]; + + self.pinglunLabel.frame = CGRectMake(15, 15, 65, 15); + + self.starView.frame = CGRectMake(self.pinglunLabel.right + 8, 15, 110, 15); + + self.pingneirongLabel.frame = CGRectMake(15, self.pinglunLabel.bottom + 14 , self.container.width - 30, 50); + + CGFloat h = [HQCommonUtils getSpaceLabelHeight:self.pingneirongLabel withStr:self.pingneirongLabel.text withFont:[UIFont systemFontOfSize:13] withWidth: self.container.width - 30 withLineSpacing:5]; + self.pingneirongLabel.frame = CGRectMake(15, self.pinglunLabel.bottom + 14 , self.container.width - 30, h); + + +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.h new file mode 100644 index 0000000..46094da --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.h @@ -0,0 +1,19 @@ +// +// userDataInfoCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "TUIMessageCellData.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface userDataInfoCellData : TUIMessageCellData + +@property NSString *text; +@property NSString *link; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.m new file mode 100644 index 0000000..b922b12 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.m @@ -0,0 +1,44 @@ +// +// userDataInfoCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "userDataInfoCellData.h" + +@implementation userDataInfoCellData + ++ (userDataInfoCellData *)getCellData:(V2TIMMessage *)message{ + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + userDataInfoCellData *cellData = [[userDataInfoCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.text = param[@"text"]; + cellData.link = param[@"link"]; + cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + ++ (NSString *)getDisplayString:(V2TIMMessage *)message { + NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; + return param[@"text"]; +} + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + CGFloat textMaxWidth = 245.f; + CGRect rect = [self.text boundingRectWithSize:CGSizeMake(textMaxWidth, MAXFLOAT) + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } + context:nil]; + CGSize size = CGSizeMake(textMaxWidth + 15, rect.size.height + 56); + return size; +} +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.h new file mode 100644 index 0000000..74b20f6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.h @@ -0,0 +1,24 @@ +// +// userDataInfoChatCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "TUIMessageCell.h" +#import "userDataInfoCellData.h" + + + +NS_ASSUME_NONNULL_BEGIN + +@interface userDataInfoChatCell : TUIMessageCell + +@property UILabel *myTextLabel; // 展示文本 +@property UILabel *myLinkLabel; // 链接跳转文本 + +- (void)fillWithData:(userDataInfoCellData *)data; // 绘制 UI + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.m new file mode 100644 index 0000000..a4498a3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.m @@ -0,0 +1,64 @@ +// +// userDataInfoChatCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "userDataInfoChatCell.h" + +@implementation userDataInfoChatCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + _myTextLabel = [[UILabel alloc] init]; + _myTextLabel.numberOfLines = 0; + _myTextLabel.font = [UIFont systemFontOfSize:15]; + _myTextLabel.textColor = TUIChatDynamicColor(@"chat_link_message_title_color", @"#000000"); + [self.container addSubview:_myTextLabel]; + self.container.backgroundColor = [UIColor redColor]; + self.myLinkLabel = [[UILabel alloc] init]; + self.myLinkLabel.text = @""; + [self.container addSubview:_myLinkLabel]; + } + return self; +} + + +// 根据 cellData 绘制 cell +- (void)fillWithData:(userDataInfoCellData *)data; +{ + [super fillWithData:data]; + self.myTextLabel.text = data.text; +} + +// 设置控件坐标 +- (void)layoutSubviews +{ + [super layoutSubviews]; + + CGRect rect = [self.myTextLabel.text boundingRectWithSize:CGSizeMake(245, MAXFLOAT) + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } + context:nil]; + self.myTextLabel.mm_top(10).mm_left(10).mm_width(245).mm_height(rect.size.height); + self.myLinkLabel.mm_sizeToFit().mm_left(10).mm_top(self.myTextLabel.mm_y + self.myTextLabel.mm_h +15); + +// self.myTextLabel.numberOfLines = 0; +// self.myLinkLabel.mm_sizeToFit().mm_left(10).mm_bottom(10); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/DoctorHomePageDetailVC.h b/XinjiangProject/XinjiangProject/Project/TUIChat/DoctorHomePageDetailVC.h new file mode 100644 index 0000000..e7faa71 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/DoctorHomePageDetailVC.h @@ -0,0 +1,18 @@ +// +// DoctorHomePageDetailVC.h +// QinghaiProject +// +// Created by Apple on 2024/8/22. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DoctorHomePageDetailVC : HQBaseViewController + +@property (nonatomic, strong) NSString * userID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/DoctorHomePageDetailVC.m b/XinjiangProject/XinjiangProject/Project/TUIChat/DoctorHomePageDetailVC.m new file mode 100644 index 0000000..23a1340 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/DoctorHomePageDetailVC.m @@ -0,0 +1,212 @@ +// +// DoctorHomePageDetailVC.m +// QinghaiProject +// +// Created by Apple on 2024/8/22. +// + +#import "DoctorHomePageDetailVC.h" +#import "ChatDoctorInfoModel.h" + +@interface DoctorHomePageDetailVC () + +@property (nonatomic, strong) UIImageView * heardImg; +@property (nonatomic, strong) UILabel * titleLabel; + +@property (nonatomic, strong) UILabel * label; +@property (nonatomic, strong) UILabel * namelabel; +@property (nonatomic, strong) UIScrollView *scrollView; +@property (nonatomic, strong) UIView *contentView; +@end + +@implementation DoctorHomePageDetailVC + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.view.backgroundColor = UIColorHex(#EEEEEE); + self.navigationItem.title = @"全科医生主页"; + [self createUI]; + [self getSmllHelpDetailInfo]; + // Do any additional setup after loading the view. +} + +- (void)createUI { + + UIView * topView = [[UIView alloc] init]; + topView.backgroundColor = UIColorHex(#21BEBD); + [self.view addSubview:topView]; + + [topView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.mas_offset(0); + make.height.mas_offset(kRealValue(170)); + }]; + + + self.heardImg = [[UIImageView alloc] init]; + self.heardImg.layer.masksToBounds = true; + self.heardImg.layer.cornerRadius = 30; + self.heardImg.image = [UIImage imageNamed:@"nomalDetailHeard"]; + [topView addSubview:self.heardImg]; + + [self.heardImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(10); + make.left.mas_offset(17); + make.width.height.mas_offset(60); + }]; + + self.titleLabel= [[UILabel alloc] init]; + self.titleLabel.font = BOLDSYSTEMFONT(21); + self.titleLabel.textColor = KWhiteColor; + self.titleLabel.text = @"小助手"; + self.titleLabel.textAlignment = NSTextAlignmentLeft; + [topView addSubview:self.titleLabel]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(26); + make.left.mas_equalTo(self.heardImg.mas_right).offset(19); + make.right.mas_offset(-20); + }]; + // 创建并配置 UIScrollView + self.scrollView = [[UIScrollView alloc] init]; + self.scrollView.backgroundColor = [UIColor whiteColor]; + self.scrollView.layer.cornerRadius = 10; + self.scrollView.layer.masksToBounds = YES; + [self.view addSubview:self.scrollView]; + + // 创建容器视图 + self.contentView = [[UIView alloc] init]; + [self.scrollView addSubview:self.contentView]; + + // 设置容器视图的约束 + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.scrollView); + make.width.equalTo(self.scrollView.mas_width); + + }]; + + self.namelabel= [[UILabel alloc] init]; + self.namelabel.font = BOLDSYSTEMFONT(16); + self.namelabel.text = @"全科医生简介"; + self.namelabel.textColor = UIColorHex(#333333); + self.namelabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.namelabel]; + + + // 创建并配置 UILabel + self.label = [[UILabel alloc] init]; + self.label.numberOfLines = 0; // 多行显示 + self.label.textColor = UIColorHex(#333333); + // 将 UILabel 添加到容器视图 + [self.contentView addSubview:self.label]; + + // 设置 UIScrollView 和 contentView 的约束 + [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.view.mas_top).offset(93); + make.left.equalTo(self.view.mas_left).offset(15); + make.right.equalTo(self.view.mas_right).offset(-15); + }]; + + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.scrollView); + make.width.equalTo(self.scrollView.mas_width); // contentView 的宽度等于 scrollView 的宽度 + make.bottom.equalTo(self.label.mas_bottom).offset(20); // contentView 底部与 label 的底部加 20 像素 + }]; + + [self.namelabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.contentView.mas_top).offset(20); + make.left.equalTo(self.contentView.mas_left).offset(15); + make.right.equalTo(self.contentView.mas_right).offset(-15); + }]; + + // 设置 UILabel 的约束 + [self.label mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.contentView.mas_top).offset(53); + make.left.equalTo(self.contentView.mas_left).offset(20); + make.right.equalTo(self.contentView.mas_right).offset(-20); + make.bottom.equalTo(self.contentView.mas_bottom).offset(-20); // 留出底部空间 + }]; + [self updateLabelText:@"--"]; +} + +- (void)updateLabelText:(NSString *)text { + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.lineSpacing = 10; // 设置行间距 + + NSDictionary *attributes = @{ + NSParagraphStyleAttributeName: paragraphStyle, + NSFontAttributeName:[UIFont systemFontOfSize:15 weight:UIFontWeightMedium] + }; + + NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes]; + self.label.attributedText = attributedText; + + + // 强制布局更新,确保 UIScrollView 正确计算 contentSize + [self.view layoutIfNeeded]; + + // 计算 contentView 高度并更新 UIScrollView 的高度 + CGSize contentSize = [self.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; + [self.scrollView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(contentSize.height); + }]; + + // 重新布局 + [self.view layoutIfNeeded]; +} + + +- (void)getSmllHelpDetailInfo{ + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.userID forKey:@"helpId"]; + + JKCQAPI * endApi = [[JKCQAPI alloc] init:self tag:@"Detail" NeedToken:@""]; + [endApi GetSmllHelpDetail:parmDic]; + +} + +#pragma mark:网络请求 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"Detail"]) + { + NSDictionary * dic = response; + + ChatDoctorInfoModel * model = [ChatDoctorInfoModel modelWithDictionary:dic]; + + self.titleLabel.text = [NSString stringWithFormat:@"%@",model.userName]; + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.faceUrl]; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.heardImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"nomalDetailHeard"]]; + + [self updateLabelText:[NSString stringWithFormat:@"%@",model.memo]]; + } + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Model/SendReportModel.h b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/SendReportModel.h new file mode 100644 index 0000000..7e92c9c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/SendReportModel.h @@ -0,0 +1,32 @@ +// +// SendReportModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SendReportModel : NSObject + +//customData: { +// businessID = system; +// title = 应急单; +// content = 该应急单已结束; +// type = 1 +//} + +@property (nonatomic, copy) NSString * businessID; + +@property (nonatomic, copy) NSString * title; + +@property (nonatomic, copy) NSString * content; + +@property (nonatomic, copy) NSString * type; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Model/SendReportModel.m b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/SendReportModel.m new file mode 100644 index 0000000..969b1dc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/SendReportModel.m @@ -0,0 +1,12 @@ +// +// SendReportModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/24. +// + +#import "SendReportModel.h" + +@implementation SendReportModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Model/sendHealthModel.h b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/sendHealthModel.h new file mode 100644 index 0000000..0ce64af --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/sendHealthModel.h @@ -0,0 +1,16 @@ +// +// sendHealthModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface sendHealthModel : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/Model/sendHealthModel.m b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/sendHealthModel.m new file mode 100644 index 0000000..8bd8c00 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/Model/sendHealthModel.m @@ -0,0 +1,12 @@ +// +// sendHealthModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "sendHealthModel.h" + +@implementation sendHealthModel + +@end diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTable.h b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTable.h new file mode 100644 index 0000000..26f1d8b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTable.h @@ -0,0 +1,21 @@ +// +// SendHealthDataTable.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import +#import "SendHealthDataTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SendHealthDataTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) sendHealthBlcok healthBlcok; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTable.m b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTable.m new file mode 100644 index 0000000..de1cd04 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTable.m @@ -0,0 +1,129 @@ +// +// SendHealthDataTable.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "SendHealthDataTable.h" + + +@interface SendHealthDataTable () + + +@end + + +@implementation SendHealthDataTable + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + if (@available(iOS 11.0, *)) { + self.estimatedRowHeight = 0; + self.estimatedSectionFooterHeight = 0; + self.estimatedSectionHeaderHeight = 0; + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + self.delegate = self; + self.dataSource = self; + self.backgroundColor = CViewBgColor; + self.showsVerticalScrollIndicator = false; + self.showsHorizontalScrollIndicator = false; + self.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + + [self reloadData]; +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.dataArray.count; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + SendHealthDataTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[SendHealthDataTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.model= self.dataArray[indexPath.row]; + cell.backgroundColor = KWhiteColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.healthBlcok = ^(diseaseModel * _Nonnull phyModel) { + self.healthBlcok(phyModel); + }; + return cell; + + + +} +//每行高度 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return kRealValue(90); +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return CGFLOAT_MIN; +} + +//组头 --- 组尾 + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + + return [UIView new]; + +} + + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + + return [UIView new]; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + +} + + +@end + + + diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTableViewCell.h b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTableViewCell.h new file mode 100644 index 0000000..47ae8e0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTableViewCell.h @@ -0,0 +1,22 @@ +// +// SendHealthDataTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import +#import "sendHealthModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^sendHealthBlcok)(diseaseModel * phyModel); + +@interface SendHealthDataTableViewCell : UITableViewCell + +@property (nonatomic, copy) sendHealthBlcok healthBlcok; + +@property (nonatomic, strong) diseaseModel * model; +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTableViewCell.m b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTableViewCell.m new file mode 100644 index 0000000..e957cf5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/View/SendHealthDataTableViewCell.m @@ -0,0 +1,99 @@ +// +// SendHealthDataTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import "SendHealthDataTableViewCell.h" + + + +@interface SendHealthDataTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; +@property (nonatomic, strong) UILabel * desLabel; +@property (nonatomic, strong) UILabel * timeLabel; +@property (nonatomic, strong) UIButton * sendButton; + + +@end + + +@implementation SendHealthDataTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 19, kScreenWidth - 66, 14)]; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = BOLDSYSTEMFONT(14); + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.nameLabel]; + + self.desLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.nameLabel.bottom + kRealValue(15), kScreenWidth - 66, 14)]; + self.desLabel.textColor = UIColorHex(#999999); + self.desLabel.font = MEDIUMFONT(13); + self.desLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.desLabel]; + + + self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.desLabel.bottom + kRealValue(10), kScreenWidth - 66, 14)]; + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.font = MEDIUMFONT(13); + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.timeLabel]; + + self.sendButton = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - 15 - 55 , 28, 55, 26)]; + self.sendButton.backgroundColor = UIColorHex(#21BEBD); + [self.sendButton setTitle:@"发送" forState:UIControlStateNormal]; + [self.sendButton setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.sendButton.titleLabel.font = SYSTEMFONT(12); + self.sendButton.layer.cornerRadius = 13; + self.sendButton.layer.masksToBounds = YES; + [self.sendButton addTarget:self action:@selector(sendReportID) forControlEvents:UIControlEventTouchUpInside]; + [self.contentView addSubview:self.sendButton]; + +} + +- (void)sendReportID { + + if (self.healthBlcok) { + + self.healthBlcok(self.model); + } + +} + +- (void)setModel:(diseaseModel *)model { + + _model = model; + + self.nameLabel.text = [NSString stringWithFormat:@"%@",_model.recordsName]; + + self.desLabel.text = [NSString stringWithFormat:@"%@",_model.medicalDescribe]; + + self.timeLabel.text = [NSString stringWithFormat:@"更新时间%@",_model.createTime]; + +} +@end diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/Contents.json new file mode 100644 index 0000000..3ba848d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "homePageTiwen.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "homePageTiwen@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "homePageTiwen@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen.png new file mode 100644 index 0000000..975e66d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen@2x.png new file mode 100644 index 0000000..847b9ab Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen@3x.png new file mode 100644 index 0000000..c9e1f69 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageTiwen.imageset/homePageTiwen@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/Contents.json new file mode 100644 index 0000000..da9615e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "homePageXinlv.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "homePageXinlv@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "homePageXinlv@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv.png new file mode 100644 index 0000000..c975727 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv@2x.png new file mode 100644 index 0000000..7a23bf7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv@3x.png new file mode 100644 index 0000000..4df421f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXinlv.imageset/homePageXinlv@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/Contents.json new file mode 100644 index 0000000..61543d9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "homePageXueyang.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "homePageXueyang@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "homePageXueyang@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang.png new file mode 100644 index 0000000..d4819d4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang@2x.png new file mode 100644 index 0000000..8a102a1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang@3x.png new file mode 100644 index 0000000..b37464d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageXueyang.imageset/homePageXueyang@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/Contents.json new file mode 100644 index 0000000..51c043f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "homePageYali.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "homePageYali@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "homePageYali@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali.png new file mode 100644 index 0000000..d031486 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali@2x.png new file mode 100644 index 0000000..a3cff90 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali@3x.png new file mode 100644 index 0000000..beffbf4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/homePageYali.imageset/homePageYali@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/Contents.json new file mode 100644 index 0000000..f65c6d5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "sleepIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "sleepIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "sleepIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon.png new file mode 100644 index 0000000..1512b6b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon@2x.png new file mode 100644 index 0000000..08e7077 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon@3x.png new file mode 100644 index 0000000..e2bb389 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/sleepIcon.imageset/sleepIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/Contents.json new file mode 100644 index 0000000..f8dfda5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "stepNumberIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "stepNumberIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "stepNumberIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon.png new file mode 100644 index 0000000..6ec32ab Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon@2x.png new file mode 100644 index 0000000..8a820b6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon@3x.png new file mode 100644 index 0000000..f2dd171 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Monitoring/stepNumberIcon.imageset/stepNumberIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/Contents.json new file mode 100644 index 0000000..6b23319 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "HeardHistory_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "HeardHistory_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "HeardHistory_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon.png new file mode 100644 index 0000000..f1af397 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon@2x.png new file mode 100644 index 0000000..7a3db6a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon@3x.png new file mode 100644 index 0000000..3f6a976 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardHistory_icon.imageset/HeardHistory_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/Contents.json new file mode 100644 index 0000000..b9b11f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "HeardProgress_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "HeardProgress_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "HeardProgress_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon.png new file mode 100644 index 0000000..dd44e05 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon@2x.png new file mode 100644 index 0000000..d878b40 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon@3x.png new file mode 100644 index 0000000..bf0db9a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/HeardProgress_icon.imageset/HeardProgress_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Contents.json new file mode 100644 index 0000000..fcab5ce --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Seedoctor_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Seedoctor_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Seedoctor_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon.png new file mode 100644 index 0000000..b0a2aaa Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon@2x.png new file mode 100644 index 0000000..ae70921 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon@3x.png new file mode 100644 index 0000000..03ea01d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/Seedoctor_icon.imageset/Seedoctor_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/Contents.json new file mode 100644 index 0000000..736dc60 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "acccountSafety.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "acccountSafety@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "acccountSafety@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety.png new file mode 100644 index 0000000..60b2151 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety@2x.png new file mode 100644 index 0000000..beffaff Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety@3x.png new file mode 100644 index 0000000..e26b26d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/acccountSafety.imageset/acccountSafety@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/Contents.json new file mode 100644 index 0000000..215fc6c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "alreadyEveal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "alreadyEveal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "alreadyEveal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal.png new file mode 100644 index 0000000..cdc4271 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal@2x.png new file mode 100644 index 0000000..c6827e2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal@3x.png new file mode 100644 index 0000000..6514764 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/alreadyEveal.imageset/alreadyEveal@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/Contents.json new file mode 100644 index 0000000..8d2a6c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "heard_man.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "heard_man@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "heard_man@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man.png new file mode 100644 index 0000000..4ac9c77 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man@2x.png new file mode 100644 index 0000000..1846f5f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man@3x.png new file mode 100644 index 0000000..ae465fe Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_man.imageset/heard_man@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/Contents.json new file mode 100644 index 0000000..43ad165 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "heard_woman.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "heard_woman@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "heard_woman@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman.png new file mode 100644 index 0000000..dd92f57 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman@2x.png new file mode 100644 index 0000000..f0b74c9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman@3x.png new file mode 100644 index 0000000..2b03312 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/heard_woman.imageset/heard_woman@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/Contents.json new file mode 100644 index 0000000..9e26f22 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "medicalReson_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "medicalReson_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "medicalReson_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon.png new file mode 100644 index 0000000..fae6149 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon@2x.png new file mode 100644 index 0000000..dea7a00 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon@3x.png new file mode 100644 index 0000000..ed99e7a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/medicalReson_icon.imageset/medicalReson_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/Contents.json new file mode 100644 index 0000000..e584433 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "myLove_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "myLove_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "myLove_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon.png new file mode 100644 index 0000000..7f70ad2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon@2x.png new file mode 100644 index 0000000..b43a388 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon@3x.png new file mode 100644 index 0000000..7792550 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myLove_icon.imageset/myLove_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/Contents.json new file mode 100644 index 0000000..6e7ff6d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "myReport_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "myReport_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "myReport_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon.png new file mode 100644 index 0000000..e9e9691 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon@2x.png new file mode 100644 index 0000000..40052df Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon@3x.png new file mode 100644 index 0000000..c4c4621 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myReport_icon.imageset/myReport_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/Contents.json new file mode 100644 index 0000000..a4a0bf8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "myinfo_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "myinfo_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "myinfo_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon.png new file mode 100644 index 0000000..7e66d19 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon@2x.png new file mode 100644 index 0000000..71c469d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon@3x.png new file mode 100644 index 0000000..1c4300b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/myinfo_icon.imageset/myinfo_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/Contents.json new file mode 100644 index 0000000..3102e0d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "relatives_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "relatives_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "relatives_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon.png new file mode 100644 index 0000000..bc9959a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon@2x.png new file mode 100644 index 0000000..7197e61 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon@3x.png new file mode 100644 index 0000000..3424448 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/relatives_icon.imageset/relatives_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/Contents.json new file mode 100644 index 0000000..5a15efd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "waitEveal_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "waitEveal_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "waitEveal_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon.png new file mode 100644 index 0000000..8dc5c2d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon@2x.png new file mode 100644 index 0000000..001de1d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon@3x.png new file mode 100644 index 0000000..e41afc4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/MyCenetr/waitEveal_icon.imageset/waitEveal_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Contents.json new file mode 100644 index 0000000..4583514 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Satisfaction_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Satisfaction_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Satisfaction_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon.png new file mode 100644 index 0000000..6122bcb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon@2x.png new file mode 100644 index 0000000..784f336 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon@3x.png new file mode 100644 index 0000000..d9f17f9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/Satisfaction_icon.imageset/Satisfaction_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/audioPlayIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/audioPlayIcon.imageset/Contents.json new file mode 100644 index 0000000..789c703 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/audioPlayIcon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "audioPlayIcon.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/audioPlayIcon.imageset/audioPlayIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/audioPlayIcon.imageset/audioPlayIcon.png new file mode 100644 index 0000000..d34ea92 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/audioPlayIcon.imageset/audioPlayIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/Contents.json new file mode 100644 index 0000000..8b742c3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "cancalSuccess.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "cancalSuccess@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "cancalSuccess@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess.png new file mode 100644 index 0000000..c136ed4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess@2x.png new file mode 100644 index 0000000..b3777eb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess@3x.png new file mode 100644 index 0000000..403fc41 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/cancalSuccess.imageset/cancalSuccess@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/Contents.json new file mode 100644 index 0000000..43aeb6d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "delect.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "delect@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "delect@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect.png new file mode 100644 index 0000000..b0c3988 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect@2x.png new file mode 100644 index 0000000..e86f011 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect@3x.png new file mode 100644 index 0000000..f658d44 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/delect.imageset/delect@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/Contents.json new file mode 100644 index 0000000..2e51132 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "detail_collect.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "detail_collect@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "detail_collect@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect.png new file mode 100644 index 0000000..26acef2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect@2x.png new file mode 100644 index 0000000..ceeaca1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect@3x.png new file mode 100644 index 0000000..746d4f8 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/detail_collect.imageset/detail_collect@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/Contents.json new file mode 100644 index 0000000..17ad99c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "doctorHot.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "doctorHot@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "doctorHot@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot.png new file mode 100644 index 0000000..568c73e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot@2x.png new file mode 100644 index 0000000..ea88b58 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot@3x.png new file mode 100644 index 0000000..f979185 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/doctorHot.imageset/doctorHot@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/Contents.json new file mode 100644 index 0000000..cddcf1b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "foundDoctor.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "foundDoctor@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "foundDoctor@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor.png new file mode 100644 index 0000000..44b9062 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor@2x.png new file mode 100644 index 0000000..68c7f7e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor@3x.png new file mode 100644 index 0000000..b2f1adf Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/foundDoctor.imageset/foundDoctor@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/Contents.json new file mode 100644 index 0000000..a328960 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "hospatilAddress.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "hospatilAddress@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "hospatilAddress@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress.png new file mode 100644 index 0000000..e2ea61e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress@2x.png new file mode 100644 index 0000000..a0c5886 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress@3x.png new file mode 100644 index 0000000..f1331e3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/hospatilAddress.imageset/hospatilAddress@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/Contents.json new file mode 100644 index 0000000..6a2d1f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "line_selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "line_selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "line_selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected.png new file mode 100644 index 0000000..326d906 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected@2x.png new file mode 100644 index 0000000..e99276e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected@3x.png new file mode 100644 index 0000000..0735530 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/line_selected.imageset/line_selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/Contents.json new file mode 100644 index 0000000..3ad2c98 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "mustKnow_Nomal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "mustKnow_Nomal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "mustKnow_Nomal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal.png new file mode 100644 index 0000000..9b6b46c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal@2x.png new file mode 100644 index 0000000..cdfc51b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal@3x.png new file mode 100644 index 0000000..5ac3a3e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Nomal.imageset/mustKnow_Nomal@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/Contents.json new file mode 100644 index 0000000..da007a3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "mustKnow_Selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "mustKnow_Selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "mustKnow_Selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected.png new file mode 100644 index 0000000..8ba8a9e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected@2x.png new file mode 100644 index 0000000..83ad1fe Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected@3x.png new file mode 100644 index 0000000..3fcf38c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/mustKnow_Selected.imageset/mustKnow_Selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/Contents.json new file mode 100644 index 0000000..49d2c93 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "myQuestion.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "myQuestion@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "myQuestion@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion.png new file mode 100644 index 0000000..c047b3b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion@2x.png new file mode 100644 index 0000000..996110d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion@3x.png new file mode 100644 index 0000000..1f516dc Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/myQuestion.imageset/myQuestion@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/Contents.json new file mode 100644 index 0000000..3ffc957 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "pictureQuestion_Left.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "pictureQuestion_Left@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "pictureQuestion_Left@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left.png new file mode 100644 index 0000000..a1ecb14 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left@2x.png new file mode 100644 index 0000000..4a4f864 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left@3x.png new file mode 100644 index 0000000..e74e101 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/pictureQuestion_Left.imageset/pictureQuestion_Left@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/Contents.json new file mode 100644 index 0000000..a080fd0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "questionDetailBack.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "questionDetailBack@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "questionDetailBack@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack.png new file mode 100644 index 0000000..84ccda7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack@2x.png new file mode 100644 index 0000000..a30a513 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack@3x.png new file mode 100644 index 0000000..d921dd2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionDetailBack.imageset/questionDetailBack@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/Contents.json new file mode 100644 index 0000000..e1fd2b3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "questionHeardBack.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "questionHeardBack@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "questionHeardBack@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack.png new file mode 100644 index 0000000..4b9f1c6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack@2x.png new file mode 100644 index 0000000..772cc23 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack@3x.png new file mode 100644 index 0000000..bd6dec3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionHeardBack.imageset/questionHeardBack@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/Contents.json new file mode 100644 index 0000000..111cb94 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "questionLeft_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "questionLeft_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "questionLeft_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon.png new file mode 100644 index 0000000..7fd6343 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon@2x.png new file mode 100644 index 0000000..c884a0d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon@3x.png new file mode 100644 index 0000000..82f0ffe Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionLeft_icon.imageset/questionLeft_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/Contents.json new file mode 100644 index 0000000..2f9bb7b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "questionTitleImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "questionTitleImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "questionTitleImg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg.png new file mode 100644 index 0000000..b1cdcb9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg@2x.png new file mode 100644 index 0000000..81fbb76 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg@3x.png new file mode 100644 index 0000000..984171f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/questionTitleImg.imageset/questionTitleImg@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/Contents.json new file mode 100644 index 0000000..863d5d4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "readingNumber.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "readingNumber@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "readingNumber@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber.png new file mode 100644 index 0000000..77eeb74 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber@2x.png new file mode 100644 index 0000000..6b87985 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber@3x.png new file mode 100644 index 0000000..9d51509 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/readingNumber.imageset/readingNumber@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/Contents.json new file mode 100644 index 0000000..7482e44 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "repay_Icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "repay_Icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "repay_Icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon.png new file mode 100644 index 0000000..269f7d4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon@2x.png new file mode 100644 index 0000000..17d0fb9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon@3x.png new file mode 100644 index 0000000..d62990d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/repay_Icon.imageset/repay_Icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/Contents.json new file mode 100644 index 0000000..3d22844 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "reportBackImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "reportBackImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "reportBackImg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg.png new file mode 100644 index 0000000..eeda23b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg@2x.png new file mode 100644 index 0000000..b8bce1c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg@3x.png new file mode 100644 index 0000000..3da5d8b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/reportBackImg.imageset/reportBackImg@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/report_navRight.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/report_navRight.imageset/Contents.json new file mode 100644 index 0000000..3b445f0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/report_navRight.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "report_navRight.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/report_navRight.imageset/report_navRight.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/report_navRight.imageset/report_navRight.png new file mode 100644 index 0000000..c398016 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/report_navRight.imageset/report_navRight.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/Contents.json new file mode 100644 index 0000000..0e7f1e3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "rightSelectedImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "rightSelectedImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "rightSelectedImg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg.png new file mode 100644 index 0000000..90fe605 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg@2x.png new file mode 100644 index 0000000..776eecc Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg@3x.png new file mode 100644 index 0000000..70da381 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/rightSelectedImg.imageset/rightSelectedImg@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/Contents.json new file mode 100644 index 0000000..8393396 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "roomPlaceholder.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "roomPlaceholder@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "roomPlaceholder@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder.png new file mode 100644 index 0000000..a72ba58 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder@2x.png new file mode 100644 index 0000000..bf9750f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder@3x.png new file mode 100644 index 0000000..4a91b05 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/roomPlaceholder.imageset/roomPlaceholder@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/Contents.json new file mode 100644 index 0000000..3bd40db --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "samllAssistant.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "samllAssistant@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "samllAssistant@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant.png new file mode 100644 index 0000000..f04872d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant@2x.png new file mode 100644 index 0000000..b4c883d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant@3x.png new file mode 100644 index 0000000..6ff97da Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/samllAssistant.imageset/samllAssistant@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/searchRightNav.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/searchRightNav.imageset/Contents.json new file mode 100644 index 0000000..05da951 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/searchRightNav.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "searchRightNav.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/searchRightNav.imageset/searchRightNav.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/searchRightNav.imageset/searchRightNav.png new file mode 100644 index 0000000..686ceea Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/searchRightNav.imageset/searchRightNav.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/Contents.json new file mode 100644 index 0000000..c8f8644 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "selectedNomal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "selectedNomal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "selectedNomal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal.png new file mode 100644 index 0000000..1bb6d1b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal@2x.png new file mode 100644 index 0000000..a7cbc1e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal@3x.png new file mode 100644 index 0000000..88dd93c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/selectedNomal.imageset/selectedNomal@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/Contents.json new file mode 100644 index 0000000..1be0609 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "statusTop_nomal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "statusTop_nomal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "statusTop_nomal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal.png new file mode 100644 index 0000000..ea1e63d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal@2x.png new file mode 100644 index 0000000..b73462b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal@3x.png new file mode 100644 index 0000000..28bcc0d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_nomal.imageset/statusTop_nomal@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/Contents.json new file mode 100644 index 0000000..07aeb62 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "statusTop_selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "statusTop_selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "statusTop_selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected.png new file mode 100644 index 0000000..c72ba85 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected@2x.png new file mode 100644 index 0000000..cc64323 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected@3x.png new file mode 100644 index 0000000..71f7bd8 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/statusTop_selected.imageset/statusTop_selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/Contents.json new file mode 100644 index 0000000..28461f0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "videQuestion_Left.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "videQuestion_Left@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "videQuestion_Left@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left.png new file mode 100644 index 0000000..56bdd70 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left@2x.png new file mode 100644 index 0000000..96224e2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left@3x.png new file mode 100644 index 0000000..badd7e7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/Question/videQuestion_Left.imageset/videQuestion_Left@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon.png new file mode 100644 index 0000000..0765957 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon@2x.png new file mode 100644 index 0000000..72bc0fd Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon@3x.png new file mode 100644 index 0000000..7d0ec41 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/AEDIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/Contents.json new file mode 100644 index 0000000..a8df71c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/AEDIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AEDIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AEDIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AEDIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/Contents.json new file mode 100644 index 0000000..e0d0dbb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "SOSLinkagePeople.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "SOSLinkagePeople@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "SOSLinkagePeople@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople.png new file mode 100644 index 0000000..facd738 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople@2x.png new file mode 100644 index 0000000..413190b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople@3x.png new file mode 100644 index 0000000..0d8e966 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/SOSLinkagePeople.imageset/SOSLinkagePeople@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/Contents.json new file mode 100644 index 0000000..b617149 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "address_NavLoctaion.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "address_NavLoctaion@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "address_NavLoctaion@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion.png new file mode 100644 index 0000000..2ef6239 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion@2x.png new file mode 100644 index 0000000..788ebaf Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion@3x.png new file mode 100644 index 0000000..70a5995 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_NavLoctaion.imageset/address_NavLoctaion@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/Contents.json new file mode 100644 index 0000000..2a94109 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "address_phone.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "address_phone@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "address_phone@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone.png new file mode 100644 index 0000000..9506e4d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone@2x.png new file mode 100644 index 0000000..c9ec487 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone@3x.png new file mode 100644 index 0000000..fb46994 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/address_phone.imageset/address_phone@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/Contents.json new file mode 100644 index 0000000..3d89174 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "callHospation.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "callHospation@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "callHospation@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation.png new file mode 100644 index 0000000..895063f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation@2x.png new file mode 100644 index 0000000..bc1baf0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation@3x.png new file mode 100644 index 0000000..3e30d7d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callHospation.imageset/callHospation@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/Contents.json new file mode 100644 index 0000000..5fd6b83 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "callSoSIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "callSoSIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "callSoSIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon.png new file mode 100644 index 0000000..82fa45c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon@2x.png new file mode 100644 index 0000000..5381736 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon@3x.png new file mode 100644 index 0000000..83c049c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/callSoSIcon.imageset/callSoSIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/Contents.json new file mode 100644 index 0000000..0a8fff7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "garyRight.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "garyRight@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "garyRight@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight.png new file mode 100644 index 0000000..7ae571b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight@2x.png new file mode 100644 index 0000000..50f8ae4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight@3x.png new file mode 100644 index 0000000..2cbe786 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/garyRight.imageset/garyRight@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/Contents.json new file mode 100644 index 0000000..f2004f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "hezuoHospital.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "hezuoHospital@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "hezuoHospital@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital.png new file mode 100644 index 0000000..bfbb1cb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital@2x.png new file mode 100644 index 0000000..bd282c0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital@3x.png new file mode 100644 index 0000000..2e65be6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/hezuoHospital.imageset/hezuoHospital@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/Contents.json new file mode 100644 index 0000000..0f816f5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "medicalAnnitation.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "medicalAnnitation@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "medicalAnnitation@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation.png new file mode 100644 index 0000000..8c2d1f6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation@2x.png new file mode 100644 index 0000000..8a428f1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation@3x.png new file mode 100644 index 0000000..5d3dfcb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/medicalAnnitation.imageset/medicalAnnitation@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/Contents.json new file mode 100644 index 0000000..e447bb5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "myLocationIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "myLocationIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "myLocationIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon.png new file mode 100644 index 0000000..8e751ee Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon@2x.png new file mode 100644 index 0000000..a0b2189 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon@3x.png new file mode 100644 index 0000000..697c2d4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/myLocationIcon.imageset/myLocationIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/Contents.json new file mode 100644 index 0000000..9808e4f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "sosCard.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "sosCard@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "sosCard@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard.png new file mode 100644 index 0000000..bcdae04 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard@2x.png new file mode 100644 index 0000000..8ed8f50 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard@3x.png new file mode 100644 index 0000000..3bae403 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosCard.imageset/sosCard@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/Contents.json new file mode 100644 index 0000000..f8fe0e1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "sosPeople.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "sosPeople@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "sosPeople@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople.png new file mode 100644 index 0000000..86c5848 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople@2x.png new file mode 100644 index 0000000..0fba453 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople@3x.png new file mode 100644 index 0000000..02f904f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/sosPeople.imageset/sosPeople@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/Contents.json new file mode 100644 index 0000000..1c4b821 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "youtianHosoital.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "youtianHosoital@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "youtianHosoital@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital.png new file mode 100644 index 0000000..b13efa2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital@2x.png new file mode 100644 index 0000000..1628add Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital@3x.png new file mode 100644 index 0000000..c650550 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/SOS/youtianHosoital.imageset/youtianHosoital@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/Contents.json new file mode 100644 index 0000000..f4cfc78 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "endQuestionItem.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "endQuestionItem@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "endQuestionItem@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem.png new file mode 100644 index 0000000..6082e54 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem@2x.png new file mode 100644 index 0000000..dd5b3a6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem@3x.png new file mode 100644 index 0000000..34afa38 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/TUIResource/endQuestionItem.imageset/endQuestionItem@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/Contents.json new file mode 100644 index 0000000..83b2365 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "noQuestionImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "noQuestionImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "noQuestionImg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg.png new file mode 100644 index 0000000..d13cd81 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg@2x.png new file mode 100644 index 0000000..db8115f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg@3x.png new file mode 100644 index 0000000..456f411 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/noQuestionImg.imageset/noQuestionImg@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Contents.json new file mode 100644 index 0000000..5ae6f92 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Feminine Symbol.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Feminine Symbol@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Feminine Symbol@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol.png new file mode 100644 index 0000000..218809f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol@2x.png new file mode 100644 index 0000000..2b9a5a2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol@3x.png new file mode 100644 index 0000000..e39d3bb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/FeminineSymbol.imageset/Feminine Symbol@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/Contents.json new file mode 100644 index 0000000..f13f6a0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "MasculineMark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "MasculineMark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "MasculineMark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark.png new file mode 100644 index 0000000..e4ffa29 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark@2x.png new file mode 100644 index 0000000..bd21b03 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark@3x.png new file mode 100644 index 0000000..40be91e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/MasculineMark.imageset/MasculineMark@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/add.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/add.imageset/Contents.json new file mode 100644 index 0000000..f121a52 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/add.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "add@3x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/add.imageset/add@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/add.imageset/add@3x.png new file mode 100644 index 0000000..625797f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/add.imageset/add@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/Contents.json new file mode 100644 index 0000000..c499f2b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "addQuestionPeople.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "addQuestionPeople@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "addQuestionPeople@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople.png new file mode 100644 index 0000000..ab08475 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople@2x.png new file mode 100644 index 0000000..cba68a7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople@3x.png new file mode 100644 index 0000000..4f7a68b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/addQuestionPeople.imageset/addQuestionPeople@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/Contents.json new file mode 100644 index 0000000..96e1418 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "back.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "back@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "back@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back.png new file mode 100644 index 0000000..a2afc1f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back@2x.png new file mode 100644 index 0000000..2288a7f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back@3x.png new file mode 100644 index 0000000..9a96ea5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/back.imageset/back@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..5adc5fe --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_chaKeyboardButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_chaKeyboardButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/c_chaKeyboardButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/c_chaKeyboardButton.png new file mode 100644 index 0000000..2a40475 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/c_chaKeyboardButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/c_chaKeyboardButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/c_chaKeyboardButton@2x.png new file mode 100644 index 0000000..0848386 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButton.imageset/c_chaKeyboardButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..286649e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_chaKeyboardButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_chaKeyboardButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel.png new file mode 100644 index 0000000..a309280 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel@2x.png new file mode 100644 index 0000000..b5b044f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/Contents.json new file mode 100644 index 0000000..085a4a0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_chaKeyboardShiftButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_chaKeyboardShiftButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton.png new file mode 100644 index 0000000..035c844 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton@2x.png new file mode 100644 index 0000000..2af7e60 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/Contents.json new file mode 100644 index 0000000..455dea7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_chaKeyboardShiftButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_chaKeyboardShiftButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel.png new file mode 100644 index 0000000..ebe15db Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel@2x.png new file mode 100644 index 0000000..0d7ae24 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..88710e0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_charKeyboardButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_charKeyboardButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/c_charKeyboardButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/c_charKeyboardButton.png new file mode 100644 index 0000000..2a40475 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/c_charKeyboardButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/c_charKeyboardButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/c_charKeyboardButton@2x.png new file mode 100644 index 0000000..0848386 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButton.imageset/c_charKeyboardButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..64826cf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButtonSel.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_charKeyboardButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButtonSel.imageset/c_charKeyboardButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButtonSel.imageset/c_charKeyboardButtonSel@2x.png new file mode 100644 index 0000000..b5b044f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardButtonSel.imageset/c_charKeyboardButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/Contents.json new file mode 100644 index 0000000..200e41b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_charKeyboardShiftButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_charKeyboardShiftButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton.png new file mode 100644 index 0000000..035c844 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton@2x.png new file mode 100644 index 0000000..2af7e60 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/Contents.json new file mode 100644 index 0000000..75a1c11 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_charKeyboardShiftButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_charKeyboardShiftButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel.png new file mode 100644 index 0000000..ebe15db Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel@2x.png new file mode 100644 index 0000000..0d7ae24 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/Contents.json new file mode 100644 index 0000000..a33732d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_character_keyboardDeleteButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_character_keyboardDeleteButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton.png new file mode 100644 index 0000000..3be4240 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton@2x.png new file mode 100644 index 0000000..9d9778f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/Contents.json new file mode 100644 index 0000000..cb84c4e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_character_keyboardDeleteButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_character_keyboardDeleteButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel.png new file mode 100644 index 0000000..3fec22b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel@2x.png new file mode 100644 index 0000000..f36ead2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..3f24f3a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_character_keyboardSwitchButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_character_keyboardSwitchButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton.png new file mode 100644 index 0000000..c7657ec Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..fcb3e69 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..8a7395a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_character_keyboardSwitchButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_character_keyboardSwitchButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..bb30ac1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..6f47c0e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chraKeyboardButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chraKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..afe3143 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chraKeyboardButtonSel.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "c_chraKeyboardButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chraKeyboardButtonSel.imageset/c_chraKeyboardButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chraKeyboardButtonSel.imageset/c_chraKeyboardButtonSel.png new file mode 100644 index 0000000..a309280 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_chraKeyboardButtonSel.imageset/c_chraKeyboardButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/Contents.json new file mode 100644 index 0000000..027a110 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_keyboardBackground.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_keyboardBackground@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/c_keyboardBackground.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/c_keyboardBackground.png new file mode 100644 index 0000000..da5038b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/c_keyboardBackground.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/c_keyboardBackground@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/c_keyboardBackground@2x.png new file mode 100644 index 0000000..be32fda Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_keyboardBackground.imageset/c_keyboardBackground@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..ae5e4ce --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_numKeyboardButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_numKeyboardButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/c_numKeyboardButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/c_numKeyboardButton.png new file mode 100644 index 0000000..d9710bb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/c_numKeyboardButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/c_numKeyboardButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/c_numKeyboardButton@2x.png new file mode 100644 index 0000000..2b622f7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButton.imageset/c_numKeyboardButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..04721bb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_numKeyboardButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_numKeyboardButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel.png new file mode 100644 index 0000000..6a065b0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel@2x.png new file mode 100644 index 0000000..5a587d7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/Contents.json new file mode 100644 index 0000000..2a50881 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_number_keyboardDeleteButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_number_keyboardDeleteButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton.png new file mode 100644 index 0000000..dbc39d0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton@2x.png new file mode 100644 index 0000000..4374932 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/Contents.json new file mode 100644 index 0000000..618999c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_number_keyboardDeleteButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_number_keyboardDeleteButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel.png new file mode 100644 index 0000000..ebe0742 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel@2x.png new file mode 100644 index 0000000..3ef2251 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..1c24fbb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_number_keyboardSwitchButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_number_keyboardSwitchButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton.png new file mode 100644 index 0000000..4ec929a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..ba96b34 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..421bb36 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_number_keyboardSwitchButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_number_keyboardSwitchButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..6a14610 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..272e958 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..90911f5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_symbolKeyboardButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_symbolKeyboardButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton.png new file mode 100644 index 0000000..2a40475 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton@2x.png new file mode 100644 index 0000000..0848386 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..49e68f8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_symbolKeyboardButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_symbolKeyboardButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel.png new file mode 100644 index 0000000..a309280 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel@2x.png new file mode 100644 index 0000000..b5b044f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/Contents.json new file mode 100644 index 0000000..1a4e14b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_symbol_keyboardDeleteButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_symbol_keyboardDeleteButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton.png new file mode 100644 index 0000000..cb86c50 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton@2x.png new file mode 100644 index 0000000..2c72c1c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/Contents.json new file mode 100644 index 0000000..27eaadd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_symbol_keyboardDeleteButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_symbol_keyboardDeleteButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel.png new file mode 100644 index 0000000..4481b08 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel@2x.png new file mode 100644 index 0000000..8c87729 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..c1ad3c2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_symbol_keyboardSwitchButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_symbol_keyboardSwitchButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton.png new file mode 100644 index 0000000..d8cbf0e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..00b3d73 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..62eddfe --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c_symbol_keyboardSwitchButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "c_symbol_keyboardSwitchButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..7a7a8e0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..a7ebf3a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/Contents.json new file mode 100644 index 0000000..0ec1cd0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "choose_Selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "choose_Selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "choose_Selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected.png new file mode 100644 index 0000000..df3dce3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected@2x.png new file mode 100644 index 0000000..75fe2a7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected@3x.png new file mode 100644 index 0000000..8ec4da3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_Selected.imageset/choose_Selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/Contents.json new file mode 100644 index 0000000..ab5e7b9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "choose_nomal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "choose_nomal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "choose_nomal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal.png new file mode 100644 index 0000000..1112c38 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal@2x.png new file mode 100644 index 0000000..20c5a93 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal@3x.png new file mode 100644 index 0000000..6f9ecc6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/choose_nomal.imageset/choose_nomal@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/Contents.json new file mode 100644 index 0000000..3fbde50 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "collectLove.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "collectLove@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "collectLove@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove.png new file mode 100644 index 0000000..a5ed0e3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove@2x.png new file mode 100644 index 0000000..ffecacf Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove@3x.png new file mode 100644 index 0000000..a7e41f9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/collectLove.imageset/collectLove@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/Contents.json new file mode 100644 index 0000000..56ff474 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "downArrow_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "downArrow_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "downArrow_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon.png new file mode 100644 index 0000000..b828132 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon@2x.png new file mode 100644 index 0000000..04434d7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon@3x.png new file mode 100644 index 0000000..92c8cee Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/downArrow_icon.imageset/downArrow_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/Contents.json new file mode 100644 index 0000000..47cc3ef --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "fileDataTopImage.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "fileDataTopImage@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "fileDataTopImage@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage.png new file mode 100644 index 0000000..f31338c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage@2x.png new file mode 100644 index 0000000..dc6d7ed Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage@3x.png new file mode 100644 index 0000000..6ddd67b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fileDataTopImage.imageset/fileDataTopImage@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fw_close.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fw_close.imageset/Contents.json new file mode 100644 index 0000000..b964e9f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fw_close.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "fw_close.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fw_close.imageset/fw_close.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fw_close.imageset/fw_close.png new file mode 100644 index 0000000..8d21fef Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/fw_close.imageset/fw_close.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/Contents.json new file mode 100644 index 0000000..ee1ec56 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "garyBlueAccow.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "garyBlueAccow@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "garyBlueAccow@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow.png new file mode 100644 index 0000000..5cdd9dc Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow@2x.png new file mode 100644 index 0000000..bb77784 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow@3x.png new file mode 100644 index 0000000..835063f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/garyBlueAccow.imageset/garyBlueAccow@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/Contents.json new file mode 100644 index 0000000..971fa0c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "greenAccow.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "greenAccow@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "greenAccow@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow.png new file mode 100644 index 0000000..a0056c5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow@2x.png new file mode 100644 index 0000000..e43ac2d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow@3x.png new file mode 100644 index 0000000..4b09c97 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow.imageset/greenAccow@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/Contents.json new file mode 100644 index 0000000..c0c25b2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "greenAccow_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "greenAccow_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "greenAccow_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon.png new file mode 100644 index 0000000..294ddfe Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon@2x.png new file mode 100644 index 0000000..3f7c1b2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon@3x.png new file mode 100644 index 0000000..728cb1d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenAccow_icon.imageset/greenAccow_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/Contents.json new file mode 100644 index 0000000..4c32afa --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "greenSmallTime.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "greenSmallTime@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "greenSmallTime@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime.png new file mode 100644 index 0000000..158fcda Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime@2x.png new file mode 100644 index 0000000..70891b0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime@3x.png new file mode 100644 index 0000000..5b0f4d0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/greenSmallTime.imageset/greenSmallTime@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/Contents.json new file mode 100644 index 0000000..8d51a27 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "home_star.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_star@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "home_star@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star.png new file mode 100644 index 0000000..5abec7c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star@2x.png new file mode 100644 index 0000000..945595e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star@3x.png new file mode 100644 index 0000000..2054b82 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/home_star.imageset/home_star@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/Contents.json new file mode 100644 index 0000000..b7bbfde --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "homestar_gray.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "homestar_gray@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "homestar_gray@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray.png new file mode 100644 index 0000000..ba83fe5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray@2x.png new file mode 100644 index 0000000..3387381 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray@3x.png new file mode 100644 index 0000000..53f7871 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/homestar_gray.imageset/homestar_gray@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_archives.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_archives.imageset/Contents.json new file mode 100644 index 0000000..f6af7cb --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_archives.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ic_more_archives.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_archives.imageset/ic_more_archives.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_archives.imageset/ic_more_archives.png new file mode 100644 index 0000000..2338427 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_archives.imageset/ic_more_archives.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_info.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_info.imageset/Contents.json new file mode 100644 index 0000000..97d5172 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_info.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ic_more_info.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_info.imageset/ic_more_info.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_info.imageset/ic_more_info.png new file mode 100644 index 0000000..3106f7b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_info.imageset/ic_more_info.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_location.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_location.imageset/Contents.json new file mode 100644 index 0000000..17eb02c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_location.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ic_more_location.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_location.imageset/ic_more_location.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_location.imageset/ic_more_location.png new file mode 100644 index 0000000..9600b12 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_location.imageset/ic_more_location.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_medical_examination_report.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_medical_examination_report.imageset/Contents.json new file mode 100644 index 0000000..831c3aa --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_medical_examination_report.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ic_more_medical_examination_report.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_medical_examination_report.imageset/ic_more_medical_examination_report.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_medical_examination_report.imageset/ic_more_medical_examination_report.png new file mode 100644 index 0000000..3e1b78f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/ic_more_medical_examination_report.imageset/ic_more_medical_examination_report.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/Contents.json new file mode 100644 index 0000000..695e1ed --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "info_samllHeard.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "info_samllHeard@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "info_samllHeard@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard.png new file mode 100644 index 0000000..6401595 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard@2x.png new file mode 100644 index 0000000..83223dc Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard@3x.png new file mode 100644 index 0000000..d744d99 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_samllHeard.imageset/info_samllHeard@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/Contents.json new file mode 100644 index 0000000..9a65db8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "info_smallCard.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "info_smallCard@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "info_smallCard@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard.png new file mode 100644 index 0000000..2f1b9b5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard@2x.png new file mode 100644 index 0000000..c77328f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard@3x.png new file mode 100644 index 0000000..d540299 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallCard.imageset/info_smallCard@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/Contents.json new file mode 100644 index 0000000..c393515 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "info_smallDanwei.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "info_smallDanwei@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "info_smallDanwei@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei.png new file mode 100644 index 0000000..1225703 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei@2x.png new file mode 100644 index 0000000..91c996a Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei@3x.png new file mode 100644 index 0000000..98000d1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/info_smallDanwei.imageset/info_smallDanwei@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/Contents.json new file mode 100644 index 0000000..e9ffc34 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "leftAccow _Selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "leftAccow _Selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "leftAccow _Selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected.png new file mode 100644 index 0000000..3439c01 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected@2x.png new file mode 100644 index 0000000..978a462 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected@3x.png new file mode 100644 index 0000000..61b1f2e Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/leftAccow_Selected.imageset/leftAccow _Selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/Contents.json new file mode 100644 index 0000000..7fe4d69 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "login_c_character_keyboardLoginButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_c_character_keyboardLoginButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/login_c_character_keyboardLoginButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/login_c_character_keyboardLoginButton.png new file mode 100644 index 0000000..e7348b9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/login_c_character_keyboardLoginButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/login_c_character_keyboardLoginButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/login_c_character_keyboardLoginButton@2x.png new file mode 100644 index 0000000..7bd0cc7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_character_keyboardLoginButton.imageset/login_c_character_keyboardLoginButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.imageset/Contents.json new file mode 100644 index 0000000..946a5d8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "login_c_number_keyboardLoginButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.imageset/login_c_number_keyboardLoginButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.imageset/login_c_number_keyboardLoginButton.png new file mode 100644 index 0000000..0b1bfe3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.imageset/login_c_number_keyboardLoginButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.png.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.png.imageset/Contents.json new file mode 100644 index 0000000..dee846b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.png.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_c_number_keyboardLoginButton.png@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.png.imageset/login_c_number_keyboardLoginButton.png@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.png.imageset/login_c_number_keyboardLoginButton.png@2x.png new file mode 100644 index 0000000..1662888 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_number_keyboardLoginButton.png.imageset/login_c_number_keyboardLoginButton.png@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.imageset/Contents.json new file mode 100644 index 0000000..c8a26a3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "login_c_symbol_keyboardLoginButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.imageset/login_c_symbol_keyboardLoginButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.imageset/login_c_symbol_keyboardLoginButton.png new file mode 100644 index 0000000..e7348b9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.imageset/login_c_symbol_keyboardLoginButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.png.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.png.imageset/Contents.json new file mode 100644 index 0000000..82bfa8f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.png.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_c_symbol_keyboardLoginButton.png@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.png.imageset/login_c_symbol_keyboardLoginButton.png@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.png.imageset/login_c_symbol_keyboardLoginButton.png@2x.png new file mode 100644 index 0000000..7bd0cc7 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButton.png.imageset/login_c_symbol_keyboardLoginButton.png@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/Contents.json new file mode 100644 index 0000000..ff06730 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "login_c_symbol_keyboardLoginButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_c_symbol_keyboardLoginButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/login_c_symbol_keyboardLoginButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/login_c_symbol_keyboardLoginButtonSel.png new file mode 100644 index 0000000..dbaaff0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/login_c_symbol_keyboardLoginButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/login_c_symbol_keyboardLoginButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/login_c_symbol_keyboardLoginButtonSel@2x.png new file mode 100644 index 0000000..c0daa41 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardLoginButtonSel.imageset/login_c_symbol_keyboardLoginButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..5bdb044 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "login_c_symbol_keyboardSwitchButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_c_symbol_keyboardSwitchButton@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/login_c_symbol_keyboardSwitchButton.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/login_c_symbol_keyboardSwitchButton.png new file mode 100644 index 0000000..75d8f07 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/login_c_symbol_keyboardSwitchButton.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/login_c_symbol_keyboardSwitchButton@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/login_c_symbol_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..891ad32 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButton.imageset/login_c_symbol_keyboardSwitchButton@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..14169b9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "login_c_symbol_keyboardSwitchButtonSel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_c_symbol_keyboardSwitchButtonSel@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/login_c_symbol_keyboardSwitchButtonSel.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/login_c_symbol_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..dbaaff0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/login_c_symbol_keyboardSwitchButtonSel.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/login_c_symbol_keyboardSwitchButtonSel@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/login_c_symbol_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..c0daa41 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/login_c_symbol_keyboardSwitchButtonSel.imageset/login_c_symbol_keyboardSwitchButtonSel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/navBackImg.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/navBackImg.imageset/Contents.json new file mode 100644 index 0000000..4426bf8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/navBackImg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "navBackImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/navBackImg.imageset/navBackImg.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/navBackImg.imageset/navBackImg.png new file mode 100644 index 0000000..7a68360 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/navBackImg.imageset/navBackImg.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/noNetwork.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/noNetwork.imageset/Contents.json new file mode 100644 index 0000000..c7a6345 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/noNetwork.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "noNetwork@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/noNetwork.imageset/noNetwork@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/noNetwork.imageset/noNetwork@2x.png new file mode 100644 index 0000000..13c0f18 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/noNetwork.imageset/noNetwork@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/placeholdIMG.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/placeholdIMG.imageset/Contents.json new file mode 100644 index 0000000..c7967d4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/placeholdIMG.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "placeholdIMG.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/placeholdIMG.imageset/placeholdIMG.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/placeholdIMG.imageset/placeholdIMG.png new file mode 100644 index 0000000..641a563 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/placeholdIMG.imageset/placeholdIMG.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/Contents.json new file mode 100644 index 0000000..14d342d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "popChoose_normal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "popChoose_normal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "popChoose_normal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal.png new file mode 100644 index 0000000..6829bf6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal@2x.png new file mode 100644 index 0000000..c259c4b Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal@3x.png new file mode 100644 index 0000000..e4aa77f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_normal.imageset/popChoose_normal@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/Contents.json new file mode 100644 index 0000000..fee3c3e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "popChoose_selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "popChoose_selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "popChoose_selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected.png new file mode 100644 index 0000000..29d3077 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected@2x.png new file mode 100644 index 0000000..2e69b64 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected@3x.png new file mode 100644 index 0000000..8bedfa0 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/popChoose_selected.imageset/popChoose_selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/Contents.json new file mode 100644 index 0000000..9868dc2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "processNextIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "processNextIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "processNextIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon.png new file mode 100644 index 0000000..f04946c Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon@2x.png new file mode 100644 index 0000000..1668388 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon@3x.png new file mode 100644 index 0000000..196c92f Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/processNextIcon.imageset/processNextIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/Contents.json new file mode 100644 index 0000000..886e341 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "rightAccow_Selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "rightAccow_Selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "rightAccow_Selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected.png new file mode 100644 index 0000000..d9ee5ae Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected@2x.png new file mode 100644 index 0000000..7e5aee9 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected@3x.png new file mode 100644 index 0000000..8975718 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/rightAccow_Selected.imageset/rightAccow_Selected@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/Contents.json new file mode 100644 index 0000000..b69549a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "setting_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "setting_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "setting_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon.png new file mode 100644 index 0000000..04579b5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon@2x.png new file mode 100644 index 0000000..e6f9eb1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon@3x.png new file mode 100644 index 0000000..c1fb7bb Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/setting_icon.imageset/setting_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/Contents.json new file mode 100644 index 0000000..1d33df5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "upAccow_gary.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "upAccow_gary@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "upAccow_gary@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary.png new file mode 100644 index 0000000..02ec470 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary@2x.png new file mode 100644 index 0000000..07d8086 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary@3x.png new file mode 100644 index 0000000..6079e4d Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/upAccow_gary.imageset/upAccow_gary@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/Contents.json new file mode 100644 index 0000000..88b6088 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "whiteBack_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "whiteBack_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "whiteBack_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon.png new file mode 100644 index 0000000..212fc79 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon@2x.png new file mode 100644 index 0000000..79f2a20 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon@3x.png new file mode 100644 index 0000000..6b842dc Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/other/whiteBack_icon.imageset/whiteBack_icon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/Contents.json b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/Contents.json new file mode 100644 index 0000000..f6206d0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "stepNumerIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "stepNumerIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "stepNumerIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon.png new file mode 100644 index 0000000..dcde3ee Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon@2x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon@2x.png new file mode 100644 index 0000000..95be7e6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon@2x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon@3x.png b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon@3x.png new file mode 100644 index 0000000..8e39f61 Binary files /dev/null and b/XinjiangProject/XinjiangProject/Supporting Files/Assets.xcassets/stepNumerIcon.imageset/stepNumerIcon@3x.png differ diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Base.lproj/LaunchScreen.storyboard b/XinjiangProject/XinjiangProject/Supporting Files/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XinjiangProject/XinjiangProject/Supporting Files/HQConst.h b/XinjiangProject/XinjiangProject/Supporting Files/HQConst.h new file mode 100644 index 0000000..3f251e8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/HQConst.h @@ -0,0 +1,20 @@ +// +// HQConst.h +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import + +#import + +extern NSString * const LoginUserInfo; + +extern NSString * const LoginSeccess; + +extern NSString * const LogoutSeccess; + +extern NSString * const IMLoginUserInfo; + +extern NSString * const HistoryKeyword; diff --git a/XinjiangProject/XinjiangProject/Supporting Files/HQConst.m b/XinjiangProject/XinjiangProject/Supporting Files/HQConst.m new file mode 100644 index 0000000..21efe13 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/HQConst.m @@ -0,0 +1,19 @@ +// +// HQConst.m +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import "HQConst.h" + + +NSString * const LoginUserInfo = @"LoginUserInfo"; + +NSString * const LoginSeccess = @"LoginSeccess"; + +NSString * const LogoutSeccess = @"LogoutSeccess"; + +NSString * const IMLoginUserInfo = @"IMUserInfo"; + +NSString * const HistoryKeyword = @"HistoryKeyword"; diff --git a/XinjiangProject/XinjiangProject/Supporting Files/Info.plist b/XinjiangProject/XinjiangProject/Supporting Files/Info.plist new file mode 100644 index 0000000..096368c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleLocalizations + + zh + + CFBundleURLTypes + + + CFBundleTypeRole + Editor + + + CFBundleTypeRole + Editor + + + LSApplicationQueriesSchemes + + qqmap + comgooglemaps + baidumap + iosamap + + Localization native development region + China + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + + + diff --git a/XinjiangProject/XinjiangProject/Supporting Files/PrefixHeader.pch b/XinjiangProject/XinjiangProject/Supporting Files/PrefixHeader.pch new file mode 100644 index 0000000..06b4cbf --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/PrefixHeader.pch @@ -0,0 +1,86 @@ +// +// PrefixHeader.pch +// QinghaiProject +// +// Created by Apple on 2024/3/20. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch +#ifdef __OBJC__ +#import +#import + + +//全局宏 +#import "YYUtilsMacros.h" +#import "FontAndColorMacros.h" +#import "ThirdMacros.h" +#import "StatusMacros.h" +#import "HQConst.h" +#import "HQCommonUtils.h" +//基础类 +#import "AppDelegate.h" +#import "AppDelegate+AppService.h" +#import "HQBaseViewController.h" +#import "HQBaseNavigationController.h" +#import "HQBaseTabBarController.h" +#import "HQUserInfo.h" +#import "IMUserInfoModel.h" + +//分类 +#import "UIDevice+model.h" +#import "UIButton+NYS.h" +#import "UILabel+ChangeLineSpaceAndWordSpace.h" +#import "UIImage+GIF.h" +#import "UIImageView+WebCache.h" +#import "UIView+FK.h" +#import "NSString+FKTools.h" + +//第三方 +#import +#import +#import +#import +#import +#import "TUIBaseMessageControllerDelegate.h" +#import "MJRefresh.h" +#import "Masonry.h" +#import "EasyShowView.h" +#import "ErrorInfoUtility.h" +#import +#import +#import +#import "TUICommonModel.h" +//工具类 +#import "LYEmptyViewHeader.h" +#import "JKCQAPI.h" +#import "ESCTUIManager.h" +#import "XMButton.h" +#import "UIView+Effects.h" +#import "UIView+FK.h" +#import "ChatViewController.h" +#import +#import +#import "TUIMessageCellLayout.h" +#import +#import "TUIChatConversationModel.h" +#ifdef DEBUG + +#define NSLog(FORMAT, ...) fprintf(stderr, "%s:%zd\t%s\n", [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String]); + +#else + +#define NSLog(FORMAT, ...) nil + +#endif + +#endif + + + +// Include any system framework and library headers here that should be included in all compilation units. +// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. + +#endif /* PrefixHeader_pch */ + diff --git a/XinjiangProject/XinjiangProject/Supporting Files/main.m b/XinjiangProject/XinjiangProject/Supporting Files/main.m new file mode 100644 index 0000000..b81ef2a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Supporting Files/main.m @@ -0,0 +1,18 @@ +// +// main.m +// XinjiangProject +// +// Created by Apple on 2025/6/23. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.h new file mode 100755 index 0000000..94521bc --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.h @@ -0,0 +1,51 @@ +// +// BRAddressModel.h +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// 省 +@interface BRProvinceModel : NSObject +/** 省对应的code或id */ +@property (nullable, nonatomic, copy) NSString *code; +/** 省的名称 */ +@property (nullable, nonatomic, copy) NSString *name; +/** 城市数组 */ +@property (nullable, nonatomic, copy) NSArray *citylist; +/** 记录省选择的索引位置 */ +@property (nonatomic, assign) NSInteger index; + +@end + +/// 市 +@interface BRCityModel : NSObject +/** 市对应的code或id */ +@property (nullable, nonatomic, copy) NSString *code; +/** 市的名称 */ +@property (nullable, nonatomic, copy) NSString *name; +/** 地区数组 */ +@property (nullable, nonatomic, copy) NSArray *arealist; +/** 记录市选择的索引位置 */ +@property (nonatomic, assign) NSInteger index; + +@end + +/// 区 +@interface BRAreaModel : NSObject +/** 区对应的code或id */ +@property (nullable, nonatomic, copy) NSString *code; +/** 区的名称 */ +@property (nullable, nonatomic, copy) NSString *name; +/** 记录区选择的索引位置 */ +@property (nonatomic, assign) NSInteger index; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.m new file mode 100755 index 0000000..b84bc2c --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.m @@ -0,0 +1,24 @@ +// +// BRAddressModel.m +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRAddressModel.h" + +@implementation BRProvinceModel + +@end + + +@implementation BRCityModel + +@end + + +@implementation BRAreaModel + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.bundle/BRCity.json b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.bundle/BRCity.json new file mode 100755 index 0000000..d67fc79 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.bundle/BRCity.json @@ -0,0 +1,13634 @@ +[ + { + "code": "110000", + "name": "北京市", + "cityList": [ + { + "code": "110000", + "name": "北京市", + "areaList": [ + { + "code": "110101", + "name": "东城区" + }, + { + "code": "110102", + "name": "西城区" + }, + { + "code": "110105", + "name": "朝阳区" + }, + { + "code": "110106", + "name": "丰台区" + }, + { + "code": "110107", + "name": "石景山区" + }, + { + "code": "110108", + "name": "海淀区" + }, + { + "code": "110109", + "name": "门头沟区" + }, + { + "code": "110111", + "name": "房山区" + }, + { + "code": "110112", + "name": "通州区" + }, + { + "code": "110113", + "name": "顺义区" + }, + { + "code": "110114", + "name": "昌平区" + }, + { + "code": "110115", + "name": "大兴区" + }, + { + "code": "110116", + "name": "怀柔区" + }, + { + "code": "110117", + "name": "平谷区" + }, + { + "code": "110118", + "name": "密云区" + }, + { + "code": "110119", + "name": "延庆区" + } + ] + } + ] + }, + { + "code": "120000", + "name": "天津市", + "cityList": [ + { + "code": "120000", + "name": "天津市", + "areaList": [ + { + "code": "120101", + "name": "和平区" + }, + { + "code": "120102", + "name": "河东区" + }, + { + "code": "120103", + "name": "河西区" + }, + { + "code": "120104", + "name": "南开区" + }, + { + "code": "120105", + "name": "河北区" + }, + { + "code": "120106", + "name": "红桥区" + }, + { + "code": "120110", + "name": "东丽区" + }, + { + "code": "120111", + "name": "西青区" + }, + { + "code": "120112", + "name": "津南区" + }, + { + "code": "120113", + "name": "北辰区" + }, + { + "code": "120114", + "name": "武清区" + }, + { + "code": "120115", + "name": "宝坻区" + }, + { + "code": "120116", + "name": "滨海新区" + }, + { + "code": "120117", + "name": "宁河区" + }, + { + "code": "120118", + "name": "静海区" + }, + { + "code": "120119", + "name": "蓟州区" + } + ] + } + ] + }, + { + "code": "130000", + "name": "河北省", + "cityList": [ + { + "code": "130100", + "name": "石家庄市", + "areaList": [ + { + "code": "130102", + "name": "长安区" + }, + { + "code": "130104", + "name": "桥西区" + }, + { + "code": "130105", + "name": "新华区" + }, + { + "code": "130107", + "name": "井陉矿区" + }, + { + "code": "130108", + "name": "裕华区" + }, + { + "code": "130109", + "name": "藁城区" + }, + { + "code": "130110", + "name": "鹿泉区" + }, + { + "code": "130111", + "name": "栾城区" + }, + { + "code": "130121", + "name": "井陉县" + }, + { + "code": "130123", + "name": "正定县" + }, + { + "code": "130125", + "name": "行唐县" + }, + { + "code": "130126", + "name": "灵寿县" + }, + { + "code": "130127", + "name": "高邑县" + }, + { + "code": "130128", + "name": "深泽县" + }, + { + "code": "130129", + "name": "赞皇县" + }, + { + "code": "130130", + "name": "无极县" + }, + { + "code": "130131", + "name": "平山县" + }, + { + "code": "130132", + "name": "元氏县" + }, + { + "code": "130133", + "name": "赵县" + }, + { + "code": "130181", + "name": "辛集市" + }, + { + "code": "130183", + "name": "晋州市" + }, + { + "code": "130184", + "name": "新乐市" + } + ] + }, + { + "code": "130200", + "name": "唐山市", + "areaList": [ + { + "code": "130202", + "name": "路南区" + }, + { + "code": "130203", + "name": "路北区" + }, + { + "code": "130204", + "name": "古冶区" + }, + { + "code": "130205", + "name": "开平区" + }, + { + "code": "130207", + "name": "丰南区" + }, + { + "code": "130208", + "name": "丰润区" + }, + { + "code": "130209", + "name": "曹妃甸区" + }, + { + "code": "130224", + "name": "滦南县" + }, + { + "code": "130225", + "name": "乐亭县" + }, + { + "code": "130227", + "name": "迁西县" + }, + { + "code": "130229", + "name": "玉田县" + }, + { + "code": "130281", + "name": "遵化市" + }, + { + "code": "130283", + "name": "迁安市" + }, + { + "code": "130284", + "name": "滦州市" + } + ] + }, + { + "code": "130300", + "name": "秦皇岛市", + "areaList": [ + { + "code": "130302", + "name": "海港区" + }, + { + "code": "130303", + "name": "山海关区" + }, + { + "code": "130304", + "name": "北戴河区" + }, + { + "code": "130306", + "name": "抚宁区" + }, + { + "code": "130321", + "name": "青龙满族自治县" + }, + { + "code": "130322", + "name": "昌黎县" + }, + { + "code": "130324", + "name": "卢龙县" + } + ] + }, + { + "code": "130400", + "name": "邯郸市", + "areaList": [ + { + "code": "130402", + "name": "邯山区" + }, + { + "code": "130403", + "name": "丛台区" + }, + { + "code": "130404", + "name": "复兴区" + }, + { + "code": "130406", + "name": "峰峰矿区" + }, + { + "code": "130407", + "name": "肥乡区" + }, + { + "code": "130408", + "name": "永年区" + }, + { + "code": "130423", + "name": "临漳县" + }, + { + "code": "130424", + "name": "成安县" + }, + { + "code": "130425", + "name": "大名县" + }, + { + "code": "130426", + "name": "涉县" + }, + { + "code": "130427", + "name": "磁县" + }, + { + "code": "130430", + "name": "邱县" + }, + { + "code": "130431", + "name": "鸡泽县" + }, + { + "code": "130432", + "name": "广平县" + }, + { + "code": "130433", + "name": "馆陶县" + }, + { + "code": "130434", + "name": "魏县" + }, + { + "code": "130435", + "name": "曲周县" + }, + { + "code": "130481", + "name": "武安市" + } + ] + }, + { + "code": "130500", + "name": "邢台市", + "areaList": [ + { + "code": "130502", + "name": "桥东区" + }, + { + "code": "130503", + "name": "桥西区" + }, + { + "code": "130521", + "name": "邢台县" + }, + { + "code": "130522", + "name": "临城县" + }, + { + "code": "130523", + "name": "内丘县" + }, + { + "code": "130524", + "name": "柏乡县" + }, + { + "code": "130525", + "name": "隆尧县" + }, + { + "code": "130526", + "name": "任县" + }, + { + "code": "130527", + "name": "南和县" + }, + { + "code": "130528", + "name": "宁晋县" + }, + { + "code": "130529", + "name": "巨鹿县" + }, + { + "code": "130530", + "name": "新河县" + }, + { + "code": "130531", + "name": "广宗县" + }, + { + "code": "130532", + "name": "平乡县" + }, + { + "code": "130533", + "name": "威县" + }, + { + "code": "130534", + "name": "清河县" + }, + { + "code": "130535", + "name": "临西县" + }, + { + "code": "130581", + "name": "南宫市" + }, + { + "code": "130582", + "name": "沙河市" + } + ] + }, + { + "code": "130600", + "name": "保定市", + "areaList": [ + { + "code": "130602", + "name": "竞秀区" + }, + { + "code": "130606", + "name": "莲池区" + }, + { + "code": "130607", + "name": "满城区" + }, + { + "code": "130608", + "name": "清苑区" + }, + { + "code": "130609", + "name": "徐水区" + }, + { + "code": "130623", + "name": "涞水县" + }, + { + "code": "130624", + "name": "阜平县" + }, + { + "code": "130626", + "name": "定兴县" + }, + { + "code": "130627", + "name": "唐县" + }, + { + "code": "130628", + "name": "高阳县" + }, + { + "code": "130629", + "name": "容城县" + }, + { + "code": "130630", + "name": "涞源县" + }, + { + "code": "130631", + "name": "望都县" + }, + { + "code": "130632", + "name": "安新县" + }, + { + "code": "130633", + "name": "易县" + }, + { + "code": "130634", + "name": "曲阳县" + }, + { + "code": "130635", + "name": "蠡县" + }, + { + "code": "130636", + "name": "顺平县" + }, + { + "code": "130637", + "name": "博野县" + }, + { + "code": "130638", + "name": "雄县" + }, + { + "code": "130681", + "name": "涿州市" + }, + { + "code": "130682", + "name": "定州市" + }, + { + "code": "130683", + "name": "安国市" + }, + { + "code": "130684", + "name": "高碑店市" + } + ] + }, + { + "code": "130700", + "name": "张家口市", + "areaList": [ + { + "code": "130702", + "name": "桥东区" + }, + { + "code": "130703", + "name": "桥西区" + }, + { + "code": "130705", + "name": "宣化区" + }, + { + "code": "130706", + "name": "下花园区" + }, + { + "code": "130708", + "name": "万全区" + }, + { + "code": "130709", + "name": "崇礼区" + }, + { + "code": "130722", + "name": "张北县" + }, + { + "code": "130723", + "name": "康保县" + }, + { + "code": "130724", + "name": "沽源县" + }, + { + "code": "130725", + "name": "尚义县" + }, + { + "code": "130726", + "name": "蔚县" + }, + { + "code": "130727", + "name": "阳原县" + }, + { + "code": "130728", + "name": "怀安县" + }, + { + "code": "130730", + "name": "怀来县" + }, + { + "code": "130731", + "name": "涿鹿县" + }, + { + "code": "130732", + "name": "赤城县" + } + ] + }, + { + "code": "130800", + "name": "承德市", + "areaList": [ + { + "code": "130802", + "name": "双桥区" + }, + { + "code": "130803", + "name": "双滦区" + }, + { + "code": "130804", + "name": "鹰手营子矿区" + }, + { + "code": "130821", + "name": "承德县" + }, + { + "code": "130822", + "name": "兴隆县" + }, + { + "code": "130824", + "name": "滦平县" + }, + { + "code": "130825", + "name": "隆化县" + }, + { + "code": "130826", + "name": "丰宁满族自治县" + }, + { + "code": "130827", + "name": "宽城满族自治县" + }, + { + "code": "130828", + "name": "围场满族蒙古族自治县" + }, + { + "code": "130881", + "name": "平泉市" + } + ] + }, + { + "code": "130900", + "name": "沧州市", + "areaList": [ + { + "code": "130902", + "name": "新华区" + }, + { + "code": "130903", + "name": "运河区" + }, + { + "code": "130921", + "name": "沧县" + }, + { + "code": "130922", + "name": "青县" + }, + { + "code": "130923", + "name": "东光县" + }, + { + "code": "130924", + "name": "海兴县" + }, + { + "code": "130925", + "name": "盐山县" + }, + { + "code": "130926", + "name": "肃宁县" + }, + { + "code": "130927", + "name": "南皮县" + }, + { + "code": "130928", + "name": "吴桥县" + }, + { + "code": "130929", + "name": "献县" + }, + { + "code": "130930", + "name": "孟村回族自治县" + }, + { + "code": "130981", + "name": "泊头市" + }, + { + "code": "130982", + "name": "任丘市" + }, + { + "code": "130983", + "name": "黄骅市" + }, + { + "code": "130984", + "name": "河间市" + } + ] + }, + { + "code": "131000", + "name": "廊坊市", + "areaList": [ + { + "code": "131002", + "name": "安次区" + }, + { + "code": "131003", + "name": "广阳区" + }, + { + "code": "131022", + "name": "固安县" + }, + { + "code": "131023", + "name": "永清县" + }, + { + "code": "131024", + "name": "香河县" + }, + { + "code": "131025", + "name": "大城县" + }, + { + "code": "131026", + "name": "文安县" + }, + { + "code": "131028", + "name": "大厂回族自治县" + }, + { + "code": "131081", + "name": "霸州市" + }, + { + "code": "131082", + "name": "三河市" + } + ] + }, + { + "code": "131100", + "name": "衡水市", + "areaList": [ + { + "code": "131102", + "name": "桃城区" + }, + { + "code": "131103", + "name": "冀州区" + }, + { + "code": "131121", + "name": "枣强县" + }, + { + "code": "131122", + "name": "武邑县" + }, + { + "code": "131123", + "name": "武强县" + }, + { + "code": "131124", + "name": "饶阳县" + }, + { + "code": "131125", + "name": "安平县" + }, + { + "code": "131126", + "name": "故城县" + }, + { + "code": "131127", + "name": "景县" + }, + { + "code": "131128", + "name": "阜城县" + }, + { + "code": "131182", + "name": "深州市" + } + ] + } + ] + }, + { + "code": "140000", + "name": "山西省", + "cityList": [ + { + "code": "140100", + "name": "太原市", + "areaList": [ + { + "code": "140105", + "name": "小店区" + }, + { + "code": "140106", + "name": "迎泽区" + }, + { + "code": "140107", + "name": "杏花岭区" + }, + { + "code": "140108", + "name": "尖草坪区" + }, + { + "code": "140109", + "name": "万柏林区" + }, + { + "code": "140110", + "name": "晋源区" + }, + { + "code": "140121", + "name": "清徐县" + }, + { + "code": "140122", + "name": "阳曲县" + }, + { + "code": "140123", + "name": "娄烦县" + }, + { + "code": "140181", + "name": "古交市" + } + ] + }, + { + "code": "140200", + "name": "大同市", + "areaList": [ + { + "code": "140212", + "name": "新荣区" + }, + { + "code": "140213", + "name": "平城区" + }, + { + "code": "140214", + "name": "云冈区" + }, + { + "code": "140215", + "name": "云州区" + }, + { + "code": "140221", + "name": "阳高县" + }, + { + "code": "140222", + "name": "天镇县" + }, + { + "code": "140223", + "name": "广灵县" + }, + { + "code": "140224", + "name": "灵丘县" + }, + { + "code": "140225", + "name": "浑源县" + }, + { + "code": "140226", + "name": "左云县" + } + ] + }, + { + "code": "140300", + "name": "阳泉市", + "areaList": [ + { + "code": "140302", + "name": "城区" + }, + { + "code": "140303", + "name": "矿区" + }, + { + "code": "140311", + "name": "郊区" + }, + { + "code": "140321", + "name": "平定县" + }, + { + "code": "140322", + "name": "盂县" + } + ] + }, + { + "code": "140400", + "name": "长治市", + "areaList": [ + { + "code": "140403", + "name": "潞州区" + }, + { + "code": "140404", + "name": "上党区" + }, + { + "code": "140405", + "name": "屯留区" + }, + { + "code": "140406", + "name": "潞城区" + }, + { + "code": "140423", + "name": "襄垣县" + }, + { + "code": "140425", + "name": "平顺县" + }, + { + "code": "140426", + "name": "黎城县" + }, + { + "code": "140427", + "name": "壶关县" + }, + { + "code": "140428", + "name": "长子县" + }, + { + "code": "140429", + "name": "武乡县" + }, + { + "code": "140430", + "name": "沁县" + }, + { + "code": "140431", + "name": "沁源县" + } + ] + }, + { + "code": "140500", + "name": "晋城市", + "areaList": [ + { + "code": "140502", + "name": "城区" + }, + { + "code": "140521", + "name": "沁水县" + }, + { + "code": "140522", + "name": "阳城县" + }, + { + "code": "140524", + "name": "陵川县" + }, + { + "code": "140525", + "name": "泽州县" + }, + { + "code": "140581", + "name": "高平市" + } + ] + }, + { + "code": "140600", + "name": "朔州市", + "areaList": [ + { + "code": "140602", + "name": "朔城区" + }, + { + "code": "140603", + "name": "平鲁区" + }, + { + "code": "140621", + "name": "山阴县" + }, + { + "code": "140622", + "name": "应县" + }, + { + "code": "140623", + "name": "右玉县" + }, + { + "code": "140681", + "name": "怀仁市" + } + ] + }, + { + "code": "140700", + "name": "晋中市", + "areaList": [ + { + "code": "140702", + "name": "榆次区" + }, + { + "code": "140703", + "name": "太谷区" + }, + { + "code": "140721", + "name": "榆社县" + }, + { + "code": "140722", + "name": "左权县" + }, + { + "code": "140723", + "name": "和顺县" + }, + { + "code": "140724", + "name": "昔阳县" + }, + { + "code": "140725", + "name": "寿阳县" + }, + { + "code": "140727", + "name": "祁县" + }, + { + "code": "140728", + "name": "平遥县" + }, + { + "code": "140729", + "name": "灵石县" + }, + { + "code": "140781", + "name": "介休市" + } + ] + }, + { + "code": "140800", + "name": "运城市", + "areaList": [ + { + "code": "140802", + "name": "盐湖区" + }, + { + "code": "140821", + "name": "临猗县" + }, + { + "code": "140822", + "name": "万荣县" + }, + { + "code": "140823", + "name": "闻喜县" + }, + { + "code": "140824", + "name": "稷山县" + }, + { + "code": "140825", + "name": "新绛县" + }, + { + "code": "140826", + "name": "绛县" + }, + { + "code": "140827", + "name": "垣曲县" + }, + { + "code": "140828", + "name": "夏县" + }, + { + "code": "140829", + "name": "平陆县" + }, + { + "code": "140830", + "name": "芮城县" + }, + { + "code": "140881", + "name": "永济市" + }, + { + "code": "140882", + "name": "河津市" + } + ] + }, + { + "code": "140900", + "name": "忻州市", + "areaList": [ + { + "code": "140902", + "name": "忻府区" + }, + { + "code": "140921", + "name": "定襄县" + }, + { + "code": "140922", + "name": "五台县" + }, + { + "code": "140923", + "name": "代县" + }, + { + "code": "140924", + "name": "繁峙县" + }, + { + "code": "140925", + "name": "宁武县" + }, + { + "code": "140926", + "name": "静乐县" + }, + { + "code": "140927", + "name": "神池县" + }, + { + "code": "140928", + "name": "五寨县" + }, + { + "code": "140929", + "name": "岢岚县" + }, + { + "code": "140930", + "name": "河曲县" + }, + { + "code": "140931", + "name": "保德县" + }, + { + "code": "140932", + "name": "偏关县" + }, + { + "code": "140981", + "name": "原平市" + } + ] + }, + { + "code": "141000", + "name": "临汾市", + "areaList": [ + { + "code": "141002", + "name": "尧都区" + }, + { + "code": "141021", + "name": "曲沃县" + }, + { + "code": "141022", + "name": "翼城县" + }, + { + "code": "141023", + "name": "襄汾县" + }, + { + "code": "141024", + "name": "洪洞县" + }, + { + "code": "141025", + "name": "古县" + }, + { + "code": "141026", + "name": "安泽县" + }, + { + "code": "141027", + "name": "浮山县" + }, + { + "code": "141028", + "name": "吉县" + }, + { + "code": "141029", + "name": "乡宁县" + }, + { + "code": "141030", + "name": "大宁县" + }, + { + "code": "141031", + "name": "隰县" + }, + { + "code": "141032", + "name": "永和县" + }, + { + "code": "141033", + "name": "蒲县" + }, + { + "code": "141034", + "name": "汾西县" + }, + { + "code": "141081", + "name": "侯马市" + }, + { + "code": "141082", + "name": "霍州市" + } + ] + }, + { + "code": "141100", + "name": "吕梁市", + "areaList": [ + { + "code": "141102", + "name": "离石区" + }, + { + "code": "141121", + "name": "文水县" + }, + { + "code": "141122", + "name": "交城县" + }, + { + "code": "141123", + "name": "兴县" + }, + { + "code": "141124", + "name": "临县" + }, + { + "code": "141125", + "name": "柳林县" + }, + { + "code": "141126", + "name": "石楼县" + }, + { + "code": "141127", + "name": "岚县" + }, + { + "code": "141128", + "name": "方山县" + }, + { + "code": "141129", + "name": "中阳县" + }, + { + "code": "141130", + "name": "交口县" + }, + { + "code": "141181", + "name": "孝义市" + }, + { + "code": "141182", + "name": "汾阳市" + } + ] + } + ] + }, + { + "code": "150000", + "name": "内蒙古自治区", + "cityList": [ + { + "code": "150100", + "name": "呼和浩特市", + "areaList": [ + { + "code": "150102", + "name": "新城区" + }, + { + "code": "150103", + "name": "回民区" + }, + { + "code": "150104", + "name": "玉泉区" + }, + { + "code": "150105", + "name": "赛罕区" + }, + { + "code": "150121", + "name": "土默特左旗" + }, + { + "code": "150122", + "name": "托克托县" + }, + { + "code": "150123", + "name": "和林格尔县" + }, + { + "code": "150124", + "name": "清水河县" + }, + { + "code": "150125", + "name": "武川县" + } + ] + }, + { + "code": "150200", + "name": "包头市", + "areaList": [ + { + "code": "150202", + "name": "东河区" + }, + { + "code": "150203", + "name": "昆都仑区" + }, + { + "code": "150204", + "name": "青山区" + }, + { + "code": "150205", + "name": "石拐区" + }, + { + "code": "150206", + "name": "白云鄂博矿区" + }, + { + "code": "150207", + "name": "九原区" + }, + { + "code": "150221", + "name": "土默特右旗" + }, + { + "code": "150222", + "name": "固阳县" + }, + { + "code": "150223", + "name": "达尔罕茂明安联合旗" + } + ] + }, + { + "code": "150300", + "name": "乌海市", + "areaList": [ + { + "code": "150302", + "name": "海勃湾区" + }, + { + "code": "150303", + "name": "海南区" + }, + { + "code": "150304", + "name": "乌达区" + } + ] + }, + { + "code": "150400", + "name": "赤峰市", + "areaList": [ + { + "code": "150402", + "name": "红山区" + }, + { + "code": "150403", + "name": "元宝山区" + }, + { + "code": "150404", + "name": "松山区" + }, + { + "code": "150421", + "name": "阿鲁科尔沁旗" + }, + { + "code": "150422", + "name": "巴林左旗" + }, + { + "code": "150423", + "name": "巴林右旗" + }, + { + "code": "150424", + "name": "林西县" + }, + { + "code": "150425", + "name": "克什克腾旗" + }, + { + "code": "150426", + "name": "翁牛特旗" + }, + { + "code": "150428", + "name": "喀喇沁旗" + }, + { + "code": "150429", + "name": "宁城县" + }, + { + "code": "150430", + "name": "敖汉旗" + } + ] + }, + { + "code": "150500", + "name": "通辽市", + "areaList": [ + { + "code": "150502", + "name": "科尔沁区" + }, + { + "code": "150521", + "name": "科尔沁左翼中旗" + }, + { + "code": "150522", + "name": "科尔沁左翼后旗" + }, + { + "code": "150523", + "name": "开鲁县" + }, + { + "code": "150524", + "name": "库伦旗" + }, + { + "code": "150525", + "name": "奈曼旗" + }, + { + "code": "150526", + "name": "扎鲁特旗" + }, + { + "code": "150581", + "name": "霍林郭勒市" + } + ] + }, + { + "code": "150600", + "name": "鄂尔多斯市", + "areaList": [ + { + "code": "150602", + "name": "东胜区" + }, + { + "code": "150603", + "name": "康巴什区" + }, + { + "code": "150621", + "name": "达拉特旗" + }, + { + "code": "150622", + "name": "准格尔旗" + }, + { + "code": "150623", + "name": "鄂托克前旗" + }, + { + "code": "150624", + "name": "鄂托克旗" + }, + { + "code": "150625", + "name": "杭锦旗" + }, + { + "code": "150626", + "name": "乌审旗" + }, + { + "code": "150627", + "name": "伊金霍洛旗" + } + ] + }, + { + "code": "150700", + "name": "呼伦贝尔市", + "areaList": [ + { + "code": "150702", + "name": "海拉尔区" + }, + { + "code": "150703", + "name": "扎赉诺尔区" + }, + { + "code": "150721", + "name": "阿荣旗" + }, + { + "code": "150722", + "name": "莫力达瓦达斡尔族自治旗" + }, + { + "code": "150723", + "name": "鄂伦春自治旗" + }, + { + "code": "150724", + "name": "鄂温克族自治旗" + }, + { + "code": "150725", + "name": "陈巴尔虎旗" + }, + { + "code": "150726", + "name": "新巴尔虎左旗" + }, + { + "code": "150727", + "name": "新巴尔虎右旗" + }, + { + "code": "150781", + "name": "满洲里市" + }, + { + "code": "150782", + "name": "牙克石市" + }, + { + "code": "150783", + "name": "扎兰屯市" + }, + { + "code": "150784", + "name": "额尔古纳市" + }, + { + "code": "150785", + "name": "根河市" + } + ] + }, + { + "code": "150800", + "name": "巴彦淖尔市", + "areaList": [ + { + "code": "150802", + "name": "临河区" + }, + { + "code": "150821", + "name": "五原县" + }, + { + "code": "150822", + "name": "磴口县" + }, + { + "code": "150823", + "name": "乌拉特前旗" + }, + { + "code": "150824", + "name": "乌拉特中旗" + }, + { + "code": "150825", + "name": "乌拉特后旗" + }, + { + "code": "150826", + "name": "杭锦后旗" + } + ] + }, + { + "code": "150900", + "name": "乌兰察布市", + "areaList": [ + { + "code": "150902", + "name": "集宁区" + }, + { + "code": "150921", + "name": "卓资县" + }, + { + "code": "150922", + "name": "化德县" + }, + { + "code": "150923", + "name": "商都县" + }, + { + "code": "150924", + "name": "兴和县" + }, + { + "code": "150925", + "name": "凉城县" + }, + { + "code": "150926", + "name": "察哈尔右翼前旗" + }, + { + "code": "150927", + "name": "察哈尔右翼中旗" + }, + { + "code": "150928", + "name": "察哈尔右翼后旗" + }, + { + "code": "150929", + "name": "四子王旗" + }, + { + "code": "150981", + "name": "丰镇市" + } + ] + }, + { + "code": "152200", + "name": "兴安盟", + "areaList": [ + { + "code": "152201", + "name": "乌兰浩特市" + }, + { + "code": "152202", + "name": "阿尔山市" + }, + { + "code": "152221", + "name": "科尔沁右翼前旗" + }, + { + "code": "152222", + "name": "科尔沁右翼中旗" + }, + { + "code": "152223", + "name": "扎赉特旗" + }, + { + "code": "152224", + "name": "突泉县" + } + ] + }, + { + "code": "152500", + "name": "锡林郭勒盟", + "areaList": [ + { + "code": "152501", + "name": "二连浩特市" + }, + { + "code": "152502", + "name": "锡林浩特市" + }, + { + "code": "152522", + "name": "阿巴嘎旗" + }, + { + "code": "152523", + "name": "苏尼特左旗" + }, + { + "code": "152524", + "name": "苏尼特右旗" + }, + { + "code": "152525", + "name": "东乌珠穆沁旗" + }, + { + "code": "152526", + "name": "西乌珠穆沁旗" + }, + { + "code": "152527", + "name": "太仆寺旗" + }, + { + "code": "152528", + "name": "镶黄旗" + }, + { + "code": "152529", + "name": "正镶白旗" + }, + { + "code": "152530", + "name": "正蓝旗" + }, + { + "code": "152531", + "name": "多伦县" + } + ] + }, + { + "code": "152900", + "name": "阿拉善盟", + "areaList": [ + { + "code": "152921", + "name": "阿拉善左旗" + }, + { + "code": "152922", + "name": "阿拉善右旗" + }, + { + "code": "152923", + "name": "额济纳旗" + } + ] + } + ] + }, + { + "code": "210000", + "name": "辽宁省", + "cityList": [ + { + "code": "210100", + "name": "沈阳市", + "areaList": [ + { + "code": "210102", + "name": "和平区" + }, + { + "code": "210103", + "name": "沈河区" + }, + { + "code": "210104", + "name": "大东区" + }, + { + "code": "210105", + "name": "皇姑区" + }, + { + "code": "210106", + "name": "铁西区" + }, + { + "code": "210111", + "name": "苏家屯区" + }, + { + "code": "210112", + "name": "浑南区" + }, + { + "code": "210113", + "name": "沈北新区" + }, + { + "code": "210114", + "name": "于洪区" + }, + { + "code": "210115", + "name": "辽中区" + }, + { + "code": "210123", + "name": "康平县" + }, + { + "code": "210124", + "name": "法库县" + }, + { + "code": "210181", + "name": "新民市" + } + ] + }, + { + "code": "210200", + "name": "大连市", + "areaList": [ + { + "code": "210202", + "name": "中山区" + }, + { + "code": "210203", + "name": "西岗区" + }, + { + "code": "210204", + "name": "沙河口区" + }, + { + "code": "210211", + "name": "甘井子区" + }, + { + "code": "210212", + "name": "旅顺口区" + }, + { + "code": "210213", + "name": "金州区" + }, + { + "code": "210214", + "name": "普兰店区" + }, + { + "code": "210224", + "name": "长海县" + }, + { + "code": "210281", + "name": "瓦房店市" + }, + { + "code": "210283", + "name": "庄河市" + } + ] + }, + { + "code": "210300", + "name": "鞍山市", + "areaList": [ + { + "code": "210302", + "name": "铁东区" + }, + { + "code": "210303", + "name": "铁西区" + }, + { + "code": "210304", + "name": "立山区" + }, + { + "code": "210311", + "name": "千山区" + }, + { + "code": "210321", + "name": "台安县" + }, + { + "code": "210323", + "name": "岫岩满族自治县" + }, + { + "code": "210381", + "name": "海城市" + } + ] + }, + { + "code": "210400", + "name": "抚顺市", + "areaList": [ + { + "code": "210402", + "name": "新抚区" + }, + { + "code": "210403", + "name": "东洲区" + }, + { + "code": "210404", + "name": "望花区" + }, + { + "code": "210411", + "name": "顺城区" + }, + { + "code": "210421", + "name": "抚顺县" + }, + { + "code": "210422", + "name": "新宾满族自治县" + }, + { + "code": "210423", + "name": "清原满族自治县" + } + ] + }, + { + "code": "210500", + "name": "本溪市", + "areaList": [ + { + "code": "210502", + "name": "平山区" + }, + { + "code": "210503", + "name": "溪湖区" + }, + { + "code": "210504", + "name": "明山区" + }, + { + "code": "210505", + "name": "南芬区" + }, + { + "code": "210521", + "name": "本溪满族自治县" + }, + { + "code": "210522", + "name": "桓仁满族自治县" + } + ] + }, + { + "code": "210600", + "name": "丹东市", + "areaList": [ + { + "code": "210602", + "name": "元宝区" + }, + { + "code": "210603", + "name": "振兴区" + }, + { + "code": "210604", + "name": "振安区" + }, + { + "code": "210624", + "name": "宽甸满族自治县" + }, + { + "code": "210681", + "name": "东港市" + }, + { + "code": "210682", + "name": "凤城市" + } + ] + }, + { + "code": "210700", + "name": "锦州市", + "areaList": [ + { + "code": "210702", + "name": "古塔区" + }, + { + "code": "210703", + "name": "凌河区" + }, + { + "code": "210711", + "name": "太和区" + }, + { + "code": "210726", + "name": "黑山县" + }, + { + "code": "210727", + "name": "义县" + }, + { + "code": "210781", + "name": "凌海市" + }, + { + "code": "210782", + "name": "北镇市" + } + ] + }, + { + "code": "210800", + "name": "营口市", + "areaList": [ + { + "code": "210802", + "name": "站前区" + }, + { + "code": "210803", + "name": "西市区" + }, + { + "code": "210804", + "name": "鲅鱼圈区" + }, + { + "code": "210811", + "name": "老边区" + }, + { + "code": "210881", + "name": "盖州市" + }, + { + "code": "210882", + "name": "大石桥市" + } + ] + }, + { + "code": "210900", + "name": "阜新市", + "areaList": [ + { + "code": "210902", + "name": "海州区" + }, + { + "code": "210903", + "name": "新邱区" + }, + { + "code": "210904", + "name": "太平区" + }, + { + "code": "210905", + "name": "清河门区" + }, + { + "code": "210911", + "name": "细河区" + }, + { + "code": "210921", + "name": "阜新蒙古族自治县" + }, + { + "code": "210922", + "name": "彰武县" + } + ] + }, + { + "code": "211000", + "name": "辽阳市", + "areaList": [ + { + "code": "211002", + "name": "白塔区" + }, + { + "code": "211003", + "name": "文圣区" + }, + { + "code": "211004", + "name": "宏伟区" + }, + { + "code": "211005", + "name": "弓长岭区" + }, + { + "code": "211011", + "name": "太子河区" + }, + { + "code": "211021", + "name": "辽阳县" + }, + { + "code": "211081", + "name": "灯塔市" + } + ] + }, + { + "code": "211100", + "name": "盘锦市", + "areaList": [ + { + "code": "211102", + "name": "双台子区" + }, + { + "code": "211103", + "name": "兴隆台区" + }, + { + "code": "211104", + "name": "大洼区" + }, + { + "code": "211122", + "name": "盘山县" + } + ] + }, + { + "code": "211200", + "name": "铁岭市", + "areaList": [ + { + "code": "211202", + "name": "银州区" + }, + { + "code": "211204", + "name": "清河区" + }, + { + "code": "211221", + "name": "铁岭县" + }, + { + "code": "211223", + "name": "西丰县" + }, + { + "code": "211224", + "name": "昌图县" + }, + { + "code": "211281", + "name": "调兵山市" + }, + { + "code": "211282", + "name": "开原市" + } + ] + }, + { + "code": "211300", + "name": "朝阳市", + "areaList": [ + { + "code": "211302", + "name": "双塔区" + }, + { + "code": "211303", + "name": "龙城区" + }, + { + "code": "211321", + "name": "朝阳县" + }, + { + "code": "211322", + "name": "建平县" + }, + { + "code": "211324", + "name": "喀喇沁左翼蒙古族自治县" + }, + { + "code": "211381", + "name": "北票市" + }, + { + "code": "211382", + "name": "凌源市" + } + ] + }, + { + "code": "211400", + "name": "葫芦岛市", + "areaList": [ + { + "code": "211402", + "name": "连山区" + }, + { + "code": "211403", + "name": "龙港区" + }, + { + "code": "211404", + "name": "南票区" + }, + { + "code": "211421", + "name": "绥中县" + }, + { + "code": "211422", + "name": "建昌县" + }, + { + "code": "211481", + "name": "兴城市" + } + ] + } + ] + }, + { + "code": "220000", + "name": "吉林省", + "cityList": [ + { + "code": "220100", + "name": "长春市", + "areaList": [ + { + "code": "220102", + "name": "南关区" + }, + { + "code": "220103", + "name": "宽城区" + }, + { + "code": "220104", + "name": "朝阳区" + }, + { + "code": "220105", + "name": "二道区" + }, + { + "code": "220106", + "name": "绿园区" + }, + { + "code": "220112", + "name": "双阳区" + }, + { + "code": "220113", + "name": "九台区" + }, + { + "code": "220122", + "name": "农安县" + }, + { + "code": "220182", + "name": "榆树市" + }, + { + "code": "220183", + "name": "德惠市" + } + ] + }, + { + "code": "220200", + "name": "吉林市", + "areaList": [ + { + "code": "220202", + "name": "昌邑区" + }, + { + "code": "220203", + "name": "龙潭区" + }, + { + "code": "220204", + "name": "船营区" + }, + { + "code": "220211", + "name": "丰满区" + }, + { + "code": "220221", + "name": "永吉县" + }, + { + "code": "220281", + "name": "蛟河市" + }, + { + "code": "220282", + "name": "桦甸市" + }, + { + "code": "220283", + "name": "舒兰市" + }, + { + "code": "220284", + "name": "磐石市" + } + ] + }, + { + "code": "220300", + "name": "四平市", + "areaList": [ + { + "code": "220302", + "name": "铁西区" + }, + { + "code": "220303", + "name": "铁东区" + }, + { + "code": "220322", + "name": "梨树县" + }, + { + "code": "220323", + "name": "伊通满族自治县" + }, + { + "code": "220381", + "name": "公主岭市" + }, + { + "code": "220382", + "name": "双辽市" + } + ] + }, + { + "code": "220400", + "name": "辽源市", + "areaList": [ + { + "code": "220402", + "name": "龙山区" + }, + { + "code": "220403", + "name": "西安区" + }, + { + "code": "220421", + "name": "东丰县" + }, + { + "code": "220422", + "name": "东辽县" + } + ] + }, + { + "code": "220500", + "name": "通化市", + "areaList": [ + { + "code": "220502", + "name": "东昌区" + }, + { + "code": "220503", + "name": "二道江区" + }, + { + "code": "220521", + "name": "通化县" + }, + { + "code": "220523", + "name": "辉南县" + }, + { + "code": "220524", + "name": "柳河县" + }, + { + "code": "220581", + "name": "梅河口市" + }, + { + "code": "220582", + "name": "集安市" + } + ] + }, + { + "code": "220600", + "name": "白山市", + "areaList": [ + { + "code": "220602", + "name": "浑江区" + }, + { + "code": "220605", + "name": "江源区" + }, + { + "code": "220621", + "name": "抚松县" + }, + { + "code": "220622", + "name": "靖宇县" + }, + { + "code": "220623", + "name": "长白朝鲜族自治县" + }, + { + "code": "220681", + "name": "临江市" + } + ] + }, + { + "code": "220700", + "name": "松原市", + "areaList": [ + { + "code": "220702", + "name": "宁江区" + }, + { + "code": "220721", + "name": "前郭尔罗斯蒙古族自治县" + }, + { + "code": "220722", + "name": "长岭县" + }, + { + "code": "220723", + "name": "乾安县" + }, + { + "code": "220781", + "name": "扶余市" + } + ] + }, + { + "code": "220800", + "name": "白城市", + "areaList": [ + { + "code": "220802", + "name": "洮北区" + }, + { + "code": "220821", + "name": "镇赉县" + }, + { + "code": "220822", + "name": "通榆县" + }, + { + "code": "220881", + "name": "洮南市" + }, + { + "code": "220882", + "name": "大安市" + } + ] + }, + { + "code": "222400", + "name": "延边朝鲜族自治州", + "areaList": [ + { + "code": "222401", + "name": "延吉市" + }, + { + "code": "222402", + "name": "图们市" + }, + { + "code": "222403", + "name": "敦化市" + }, + { + "code": "222404", + "name": "珲春市" + }, + { + "code": "222405", + "name": "龙井市" + }, + { + "code": "222406", + "name": "和龙市" + }, + { + "code": "222424", + "name": "汪清县" + }, + { + "code": "222426", + "name": "安图县" + } + ] + } + ] + }, + { + "code": "230000", + "name": "黑龙江省", + "cityList": [ + { + "code": "230100", + "name": "哈尔滨市", + "areaList": [ + { + "code": "230102", + "name": "道里区" + }, + { + "code": "230103", + "name": "南岗区" + }, + { + "code": "230104", + "name": "道外区" + }, + { + "code": "230108", + "name": "平房区" + }, + { + "code": "230109", + "name": "松北区" + }, + { + "code": "230110", + "name": "香坊区" + }, + { + "code": "230111", + "name": "呼兰区" + }, + { + "code": "230112", + "name": "阿城区" + }, + { + "code": "230113", + "name": "双城区" + }, + { + "code": "230123", + "name": "依兰县" + }, + { + "code": "230124", + "name": "方正县" + }, + { + "code": "230125", + "name": "宾县" + }, + { + "code": "230126", + "name": "巴彦县" + }, + { + "code": "230127", + "name": "木兰县" + }, + { + "code": "230128", + "name": "通河县" + }, + { + "code": "230129", + "name": "延寿县" + }, + { + "code": "230183", + "name": "尚志市" + }, + { + "code": "230184", + "name": "五常市" + } + ] + }, + { + "code": "230200", + "name": "齐齐哈尔市", + "areaList": [ + { + "code": "230202", + "name": "龙沙区" + }, + { + "code": "230203", + "name": "建华区" + }, + { + "code": "230204", + "name": "铁锋区" + }, + { + "code": "230205", + "name": "昂昂溪区" + }, + { + "code": "230206", + "name": "富拉尔基区" + }, + { + "code": "230207", + "name": "碾子山区" + }, + { + "code": "230208", + "name": "梅里斯达斡尔族区" + }, + { + "code": "230221", + "name": "龙江县" + }, + { + "code": "230223", + "name": "依安县" + }, + { + "code": "230224", + "name": "泰来县" + }, + { + "code": "230225", + "name": "甘南县" + }, + { + "code": "230227", + "name": "富裕县" + }, + { + "code": "230229", + "name": "克山县" + }, + { + "code": "230230", + "name": "克东县" + }, + { + "code": "230231", + "name": "拜泉县" + }, + { + "code": "230281", + "name": "讷河市" + } + ] + }, + { + "code": "230300", + "name": "鸡西市", + "areaList": [ + { + "code": "230302", + "name": "鸡冠区" + }, + { + "code": "230303", + "name": "恒山区" + }, + { + "code": "230304", + "name": "滴道区" + }, + { + "code": "230305", + "name": "梨树区" + }, + { + "code": "230306", + "name": "城子河区" + }, + { + "code": "230307", + "name": "麻山区" + }, + { + "code": "230321", + "name": "鸡东县" + }, + { + "code": "230381", + "name": "虎林市" + }, + { + "code": "230382", + "name": "密山市" + } + ] + }, + { + "code": "230400", + "name": "鹤岗市", + "areaList": [ + { + "code": "230402", + "name": "向阳区" + }, + { + "code": "230403", + "name": "工农区" + }, + { + "code": "230404", + "name": "南山区" + }, + { + "code": "230405", + "name": "兴安区" + }, + { + "code": "230406", + "name": "东山区" + }, + { + "code": "230407", + "name": "兴山区" + }, + { + "code": "230421", + "name": "萝北县" + }, + { + "code": "230422", + "name": "绥滨县" + } + ] + }, + { + "code": "230500", + "name": "双鸭山市", + "areaList": [ + { + "code": "230502", + "name": "尖山区" + }, + { + "code": "230503", + "name": "岭东区" + }, + { + "code": "230505", + "name": "四方台区" + }, + { + "code": "230506", + "name": "宝山区" + }, + { + "code": "230521", + "name": "集贤县" + }, + { + "code": "230522", + "name": "友谊县" + }, + { + "code": "230523", + "name": "宝清县" + }, + { + "code": "230524", + "name": "饶河县" + } + ] + }, + { + "code": "230600", + "name": "大庆市", + "areaList": [ + { + "code": "230602", + "name": "萨尔图区" + }, + { + "code": "230603", + "name": "龙凤区" + }, + { + "code": "230604", + "name": "让胡路区" + }, + { + "code": "230605", + "name": "红岗区" + }, + { + "code": "230606", + "name": "大同区" + }, + { + "code": "230621", + "name": "肇州县" + }, + { + "code": "230622", + "name": "肇源县" + }, + { + "code": "230623", + "name": "林甸县" + }, + { + "code": "230624", + "name": "杜尔伯特蒙古族自治县" + } + ] + }, + { + "code": "230700", + "name": "伊春市", + "areaList": [ + { + "code": "230717", + "name": "伊美区" + }, + { + "code": "230718", + "name": "乌翠区" + }, + { + "code": "230719", + "name": "友好区" + }, + { + "code": "230722", + "name": "嘉荫县" + }, + { + "code": "230723", + "name": "汤旺县" + }, + { + "code": "230724", + "name": "丰林县" + }, + { + "code": "230725", + "name": "大箐山县" + }, + { + "code": "230726", + "name": "南岔县" + }, + { + "code": "230751", + "name": "金林区" + }, + { + "code": "230781", + "name": "铁力市" + } + ] + }, + { + "code": "230800", + "name": "佳木斯市", + "areaList": [ + { + "code": "230803", + "name": "向阳区" + }, + { + "code": "230804", + "name": "前进区" + }, + { + "code": "230805", + "name": "东风区" + }, + { + "code": "230811", + "name": "郊区" + }, + { + "code": "230822", + "name": "桦南县" + }, + { + "code": "230826", + "name": "桦川县" + }, + { + "code": "230828", + "name": "汤原县" + }, + { + "code": "230881", + "name": "同江市" + }, + { + "code": "230882", + "name": "富锦市" + }, + { + "code": "230883", + "name": "抚远市" + } + ] + }, + { + "code": "230900", + "name": "七台河市", + "areaList": [ + { + "code": "230902", + "name": "新兴区" + }, + { + "code": "230903", + "name": "桃山区" + }, + { + "code": "230904", + "name": "茄子河区" + }, + { + "code": "230921", + "name": "勃利县" + } + ] + }, + { + "code": "231000", + "name": "牡丹江市", + "areaList": [ + { + "code": "231002", + "name": "东安区" + }, + { + "code": "231003", + "name": "阳明区" + }, + { + "code": "231004", + "name": "爱民区" + }, + { + "code": "231005", + "name": "西安区" + }, + { + "code": "231025", + "name": "林口县" + }, + { + "code": "231081", + "name": "绥芬河市" + }, + { + "code": "231083", + "name": "海林市" + }, + { + "code": "231084", + "name": "宁安市" + }, + { + "code": "231085", + "name": "穆棱市" + }, + { + "code": "231086", + "name": "东宁市" + } + ] + }, + { + "code": "231100", + "name": "黑河市", + "areaList": [ + { + "code": "231102", + "name": "爱辉区" + }, + { + "code": "231123", + "name": "逊克县" + }, + { + "code": "231124", + "name": "孙吴县" + }, + { + "code": "231181", + "name": "北安市" + }, + { + "code": "231182", + "name": "五大连池市" + }, + { + "code": "231183", + "name": "嫩江市" + } + ] + }, + { + "code": "231200", + "name": "绥化市", + "areaList": [ + { + "code": "231202", + "name": "北林区" + }, + { + "code": "231221", + "name": "望奎县" + }, + { + "code": "231222", + "name": "兰西县" + }, + { + "code": "231223", + "name": "青冈县" + }, + { + "code": "231224", + "name": "庆安县" + }, + { + "code": "231225", + "name": "明水县" + }, + { + "code": "231226", + "name": "绥棱县" + }, + { + "code": "231281", + "name": "安达市" + }, + { + "code": "231282", + "name": "肇东市" + }, + { + "code": "231283", + "name": "海伦市" + } + ] + }, + { + "code": "232700", + "name": "大兴安岭地区", + "areaList": [ + { + "code": "232701", + "name": "漠河市" + }, + { + "code": "232721", + "name": "呼玛县" + }, + { + "code": "232722", + "name": "塔河县" + } + ] + } + ] + }, + { + "code": "310000", + "name": "上海市", + "cityList": [ + { + "code": "310000", + "name": "上海市", + "areaList": [ + { + "code": "310101", + "name": "黄浦区" + }, + { + "code": "310104", + "name": "徐汇区" + }, + { + "code": "310105", + "name": "长宁区" + }, + { + "code": "310106", + "name": "静安区" + }, + { + "code": "310107", + "name": "普陀区" + }, + { + "code": "310109", + "name": "虹口区" + }, + { + "code": "310110", + "name": "杨浦区" + }, + { + "code": "310112", + "name": "闵行区" + }, + { + "code": "310113", + "name": "宝山区" + }, + { + "code": "310114", + "name": "嘉定区" + }, + { + "code": "310115", + "name": "浦东新区" + }, + { + "code": "310116", + "name": "金山区" + }, + { + "code": "310117", + "name": "松江区" + }, + { + "code": "310118", + "name": "青浦区" + }, + { + "code": "310120", + "name": "奉贤区" + }, + { + "code": "310151", + "name": "崇明区" + } + ] + } + ] + }, + { + "code": "320000", + "name": "江苏省", + "cityList": [ + { + "code": "320100", + "name": "南京市", + "areaList": [ + { + "code": "320102", + "name": "玄武区" + }, + { + "code": "320104", + "name": "秦淮区" + }, + { + "code": "320105", + "name": "建邺区" + }, + { + "code": "320106", + "name": "鼓楼区" + }, + { + "code": "320111", + "name": "浦口区" + }, + { + "code": "320113", + "name": "栖霞区" + }, + { + "code": "320114", + "name": "雨花台区" + }, + { + "code": "320115", + "name": "江宁区" + }, + { + "code": "320116", + "name": "六合区" + }, + { + "code": "320117", + "name": "溧水区" + }, + { + "code": "320118", + "name": "高淳区" + } + ] + }, + { + "code": "320200", + "name": "无锡市", + "areaList": [ + { + "code": "320205", + "name": "锡山区" + }, + { + "code": "320206", + "name": "惠山区" + }, + { + "code": "320211", + "name": "滨湖区" + }, + { + "code": "320213", + "name": "梁溪区" + }, + { + "code": "320214", + "name": "新吴区" + }, + { + "code": "320281", + "name": "江阴市" + }, + { + "code": "320282", + "name": "宜兴市" + } + ] + }, + { + "code": "320300", + "name": "徐州市", + "areaList": [ + { + "code": "320302", + "name": "鼓楼区" + }, + { + "code": "320303", + "name": "云龙区" + }, + { + "code": "320305", + "name": "贾汪区" + }, + { + "code": "320311", + "name": "泉山区" + }, + { + "code": "320312", + "name": "铜山区" + }, + { + "code": "320321", + "name": "丰县" + }, + { + "code": "320322", + "name": "沛县" + }, + { + "code": "320324", + "name": "睢宁县" + }, + { + "code": "320381", + "name": "新沂市" + }, + { + "code": "320382", + "name": "邳州市" + } + ] + }, + { + "code": "320400", + "name": "常州市", + "areaList": [ + { + "code": "320402", + "name": "天宁区" + }, + { + "code": "320404", + "name": "钟楼区" + }, + { + "code": "320411", + "name": "新北区" + }, + { + "code": "320412", + "name": "武进区" + }, + { + "code": "320413", + "name": "金坛区" + }, + { + "code": "320481", + "name": "溧阳市" + } + ] + }, + { + "code": "320500", + "name": "苏州市", + "areaList": [ + { + "code": "320505", + "name": "虎丘区" + }, + { + "code": "320506", + "name": "吴中区" + }, + { + "code": "320507", + "name": "相城区" + }, + { + "code": "320508", + "name": "姑苏区" + }, + { + "code": "320509", + "name": "吴江区" + }, + { + "code": "320581", + "name": "常熟市" + }, + { + "code": "320582", + "name": "张家港市" + }, + { + "code": "320583", + "name": "昆山市" + }, + { + "code": "320585", + "name": "太仓市" + } + ] + }, + { + "code": "320600", + "name": "南通市", + "areaList": [ + { + "code": "320602", + "name": "崇川区" + }, + { + "code": "320611", + "name": "港闸区" + }, + { + "code": "320612", + "name": "通州区" + }, + { + "code": "320623", + "name": "如东县" + }, + { + "code": "320681", + "name": "启东市" + }, + { + "code": "320682", + "name": "如皋市" + }, + { + "code": "320684", + "name": "海门市" + }, + { + "code": "320685", + "name": "海安市" + } + ] + }, + { + "code": "320700", + "name": "连云港市", + "areaList": [ + { + "code": "320703", + "name": "连云区" + }, + { + "code": "320706", + "name": "海州区" + }, + { + "code": "320707", + "name": "赣榆区" + }, + { + "code": "320722", + "name": "东海县" + }, + { + "code": "320723", + "name": "灌云县" + }, + { + "code": "320724", + "name": "灌南县" + } + ] + }, + { + "code": "320800", + "name": "淮安市", + "areaList": [ + { + "code": "320803", + "name": "淮安区" + }, + { + "code": "320804", + "name": "淮阴区" + }, + { + "code": "320812", + "name": "清江浦区" + }, + { + "code": "320813", + "name": "洪泽区" + }, + { + "code": "320826", + "name": "涟水县" + }, + { + "code": "320830", + "name": "盱眙县" + }, + { + "code": "320831", + "name": "金湖县" + } + ] + }, + { + "code": "320900", + "name": "盐城市", + "areaList": [ + { + "code": "320902", + "name": "亭湖区" + }, + { + "code": "320903", + "name": "盐都区" + }, + { + "code": "320904", + "name": "大丰区" + }, + { + "code": "320921", + "name": "响水县" + }, + { + "code": "320922", + "name": "滨海县" + }, + { + "code": "320923", + "name": "阜宁县" + }, + { + "code": "320924", + "name": "射阳县" + }, + { + "code": "320925", + "name": "建湖县" + }, + { + "code": "320981", + "name": "东台市" + } + ] + }, + { + "code": "321000", + "name": "扬州市", + "areaList": [ + { + "code": "321002", + "name": "广陵区" + }, + { + "code": "321003", + "name": "邗江区" + }, + { + "code": "321012", + "name": "江都区" + }, + { + "code": "321023", + "name": "宝应县" + }, + { + "code": "321081", + "name": "仪征市" + }, + { + "code": "321084", + "name": "高邮市" + } + ] + }, + { + "code": "321100", + "name": "镇江市", + "areaList": [ + { + "code": "321102", + "name": "京口区" + }, + { + "code": "321111", + "name": "润州区" + }, + { + "code": "321112", + "name": "丹徒区" + }, + { + "code": "321181", + "name": "丹阳市" + }, + { + "code": "321182", + "name": "扬中市" + }, + { + "code": "321183", + "name": "句容市" + } + ] + }, + { + "code": "321200", + "name": "泰州市", + "areaList": [ + { + "code": "321202", + "name": "海陵区" + }, + { + "code": "321203", + "name": "高港区" + }, + { + "code": "321204", + "name": "姜堰区" + }, + { + "code": "321281", + "name": "兴化市" + }, + { + "code": "321282", + "name": "靖江市" + }, + { + "code": "321283", + "name": "泰兴市" + } + ] + }, + { + "code": "321300", + "name": "宿迁市", + "areaList": [ + { + "code": "321302", + "name": "宿城区" + }, + { + "code": "321311", + "name": "宿豫区" + }, + { + "code": "321322", + "name": "沭阳县" + }, + { + "code": "321323", + "name": "泗阳县" + }, + { + "code": "321324", + "name": "泗洪县" + } + ] + } + ] + }, + { + "code": "330000", + "name": "浙江省", + "cityList": [ + { + "code": "330100", + "name": "杭州市", + "areaList": [ + { + "code": "330102", + "name": "上城区" + }, + { + "code": "330103", + "name": "下城区" + }, + { + "code": "330104", + "name": "江干区" + }, + { + "code": "330105", + "name": "拱墅区" + }, + { + "code": "330106", + "name": "西湖区" + }, + { + "code": "330108", + "name": "滨江区" + }, + { + "code": "330109", + "name": "萧山区" + }, + { + "code": "330110", + "name": "余杭区" + }, + { + "code": "330111", + "name": "富阳区" + }, + { + "code": "330112", + "name": "临安区" + }, + { + "code": "330122", + "name": "桐庐县" + }, + { + "code": "330127", + "name": "淳安县" + }, + { + "code": "330182", + "name": "建德市" + } + ] + }, + { + "code": "330200", + "name": "宁波市", + "areaList": [ + { + "code": "330203", + "name": "海曙区" + }, + { + "code": "330205", + "name": "江北区" + }, + { + "code": "330206", + "name": "北仑区" + }, + { + "code": "330211", + "name": "镇海区" + }, + { + "code": "330212", + "name": "鄞州区" + }, + { + "code": "330213", + "name": "奉化区" + }, + { + "code": "330225", + "name": "象山县" + }, + { + "code": "330226", + "name": "宁海县" + }, + { + "code": "330281", + "name": "余姚市" + }, + { + "code": "330282", + "name": "慈溪市" + } + ] + }, + { + "code": "330300", + "name": "温州市", + "areaList": [ + { + "code": "330302", + "name": "鹿城区" + }, + { + "code": "330303", + "name": "龙湾区" + }, + { + "code": "330304", + "name": "瓯海区" + }, + { + "code": "330305", + "name": "洞头区" + }, + { + "code": "330324", + "name": "永嘉县" + }, + { + "code": "330326", + "name": "平阳县" + }, + { + "code": "330327", + "name": "苍南县" + }, + { + "code": "330328", + "name": "文成县" + }, + { + "code": "330329", + "name": "泰顺县" + }, + { + "code": "330381", + "name": "瑞安市" + }, + { + "code": "330382", + "name": "乐清市" + }, + { + "code": "330383", + "name": "龙港市" + } + ] + }, + { + "code": "330400", + "name": "嘉兴市", + "areaList": [ + { + "code": "330402", + "name": "南湖区" + }, + { + "code": "330411", + "name": "秀洲区" + }, + { + "code": "330421", + "name": "嘉善县" + }, + { + "code": "330424", + "name": "海盐县" + }, + { + "code": "330481", + "name": "海宁市" + }, + { + "code": "330482", + "name": "平湖市" + }, + { + "code": "330483", + "name": "桐乡市" + } + ] + }, + { + "code": "330500", + "name": "湖州市", + "areaList": [ + { + "code": "330502", + "name": "吴兴区" + }, + { + "code": "330503", + "name": "南浔区" + }, + { + "code": "330521", + "name": "德清县" + }, + { + "code": "330522", + "name": "长兴县" + }, + { + "code": "330523", + "name": "安吉县" + } + ] + }, + { + "code": "330600", + "name": "绍兴市", + "areaList": [ + { + "code": "330602", + "name": "越城区" + }, + { + "code": "330603", + "name": "柯桥区" + }, + { + "code": "330604", + "name": "上虞区" + }, + { + "code": "330624", + "name": "新昌县" + }, + { + "code": "330681", + "name": "诸暨市" + }, + { + "code": "330683", + "name": "嵊州市" + } + ] + }, + { + "code": "330700", + "name": "金华市", + "areaList": [ + { + "code": "330702", + "name": "婺城区" + }, + { + "code": "330703", + "name": "金东区" + }, + { + "code": "330723", + "name": "武义县" + }, + { + "code": "330726", + "name": "浦江县" + }, + { + "code": "330727", + "name": "磐安县" + }, + { + "code": "330781", + "name": "兰溪市" + }, + { + "code": "330782", + "name": "义乌市" + }, + { + "code": "330783", + "name": "东阳市" + }, + { + "code": "330784", + "name": "永康市" + } + ] + }, + { + "code": "330800", + "name": "衢州市", + "areaList": [ + { + "code": "330802", + "name": "柯城区" + }, + { + "code": "330803", + "name": "衢江区" + }, + { + "code": "330822", + "name": "常山县" + }, + { + "code": "330824", + "name": "开化县" + }, + { + "code": "330825", + "name": "龙游县" + }, + { + "code": "330881", + "name": "江山市" + } + ] + }, + { + "code": "330900", + "name": "舟山市", + "areaList": [ + { + "code": "330902", + "name": "定海区" + }, + { + "code": "330903", + "name": "普陀区" + }, + { + "code": "330921", + "name": "岱山县" + }, + { + "code": "330922", + "name": "嵊泗县" + } + ] + }, + { + "code": "331000", + "name": "台州市", + "areaList": [ + { + "code": "331002", + "name": "椒江区" + }, + { + "code": "331003", + "name": "黄岩区" + }, + { + "code": "331004", + "name": "路桥区" + }, + { + "code": "331022", + "name": "三门县" + }, + { + "code": "331023", + "name": "天台县" + }, + { + "code": "331024", + "name": "仙居县" + }, + { + "code": "331081", + "name": "温岭市" + }, + { + "code": "331082", + "name": "临海市" + }, + { + "code": "331083", + "name": "玉环市" + } + ] + }, + { + "code": "331100", + "name": "丽水市", + "areaList": [ + { + "code": "331102", + "name": "莲都区" + }, + { + "code": "331121", + "name": "青田县" + }, + { + "code": "331122", + "name": "缙云县" + }, + { + "code": "331123", + "name": "遂昌县" + }, + { + "code": "331124", + "name": "松阳县" + }, + { + "code": "331125", + "name": "云和县" + }, + { + "code": "331126", + "name": "庆元县" + }, + { + "code": "331127", + "name": "景宁畲族自治县" + }, + { + "code": "331181", + "name": "龙泉市" + } + ] + } + ] + }, + { + "code": "340000", + "name": "安徽省", + "cityList": [ + { + "code": "340100", + "name": "合肥市", + "areaList": [ + { + "code": "340102", + "name": "瑶海区" + }, + { + "code": "340103", + "name": "庐阳区" + }, + { + "code": "340104", + "name": "蜀山区" + }, + { + "code": "340111", + "name": "包河区" + }, + { + "code": "340121", + "name": "长丰县" + }, + { + "code": "340122", + "name": "肥东县" + }, + { + "code": "340123", + "name": "肥西县" + }, + { + "code": "340124", + "name": "庐江县" + }, + { + "code": "340181", + "name": "巢湖市" + } + ] + }, + { + "code": "340200", + "name": "芜湖市", + "areaList": [ + { + "code": "340202", + "name": "镜湖区" + }, + { + "code": "340203", + "name": "弋江区" + }, + { + "code": "340207", + "name": "鸠江区" + }, + { + "code": "340208", + "name": "三山区" + }, + { + "code": "340221", + "name": "芜湖县" + }, + { + "code": "340222", + "name": "繁昌县" + }, + { + "code": "340223", + "name": "南陵县" + }, + { + "code": "340281", + "name": "无为市" + } + ] + }, + { + "code": "340300", + "name": "蚌埠市", + "areaList": [ + { + "code": "340302", + "name": "龙子湖区" + }, + { + "code": "340303", + "name": "蚌山区" + }, + { + "code": "340304", + "name": "禹会区" + }, + { + "code": "340311", + "name": "淮上区" + }, + { + "code": "340321", + "name": "怀远县" + }, + { + "code": "340322", + "name": "五河县" + }, + { + "code": "340323", + "name": "固镇县" + } + ] + }, + { + "code": "340400", + "name": "淮南市", + "areaList": [ + { + "code": "340402", + "name": "大通区" + }, + { + "code": "340403", + "name": "田家庵区" + }, + { + "code": "340404", + "name": "谢家集区" + }, + { + "code": "340405", + "name": "八公山区" + }, + { + "code": "340406", + "name": "潘集区" + }, + { + "code": "340421", + "name": "凤台县" + }, + { + "code": "340422", + "name": "寿县" + } + ] + }, + { + "code": "340500", + "name": "马鞍山市", + "areaList": [ + { + "code": "340503", + "name": "花山区" + }, + { + "code": "340504", + "name": "雨山区" + }, + { + "code": "340506", + "name": "博望区" + }, + { + "code": "340521", + "name": "当涂县" + }, + { + "code": "340522", + "name": "含山县" + }, + { + "code": "340523", + "name": "和县" + } + ] + }, + { + "code": "340600", + "name": "淮北市", + "areaList": [ + { + "code": "340602", + "name": "杜集区" + }, + { + "code": "340603", + "name": "相山区" + }, + { + "code": "340604", + "name": "烈山区" + }, + { + "code": "340621", + "name": "濉溪县" + } + ] + }, + { + "code": "340700", + "name": "铜陵市", + "areaList": [ + { + "code": "340705", + "name": "铜官区" + }, + { + "code": "340706", + "name": "义安区" + }, + { + "code": "340711", + "name": "郊区" + }, + { + "code": "340722", + "name": "枞阳县" + } + ] + }, + { + "code": "340800", + "name": "安庆市", + "areaList": [ + { + "code": "340802", + "name": "迎江区" + }, + { + "code": "340803", + "name": "大观区" + }, + { + "code": "340811", + "name": "宜秀区" + }, + { + "code": "340822", + "name": "怀宁县" + }, + { + "code": "340825", + "name": "太湖县" + }, + { + "code": "340826", + "name": "宿松县" + }, + { + "code": "340827", + "name": "望江县" + }, + { + "code": "340828", + "name": "岳西县" + }, + { + "code": "340881", + "name": "桐城市" + }, + { + "code": "340882", + "name": "潜山市" + } + ] + }, + { + "code": "341000", + "name": "黄山市", + "areaList": [ + { + "code": "341002", + "name": "屯溪区" + }, + { + "code": "341003", + "name": "黄山区" + }, + { + "code": "341004", + "name": "徽州区" + }, + { + "code": "341021", + "name": "歙县" + }, + { + "code": "341022", + "name": "休宁县" + }, + { + "code": "341023", + "name": "黟县" + }, + { + "code": "341024", + "name": "祁门县" + } + ] + }, + { + "code": "341100", + "name": "滁州市", + "areaList": [ + { + "code": "341102", + "name": "琅琊区" + }, + { + "code": "341103", + "name": "南谯区" + }, + { + "code": "341122", + "name": "来安县" + }, + { + "code": "341124", + "name": "全椒县" + }, + { + "code": "341125", + "name": "定远县" + }, + { + "code": "341126", + "name": "凤阳县" + }, + { + "code": "341181", + "name": "天长市" + }, + { + "code": "341182", + "name": "明光市" + } + ] + }, + { + "code": "341200", + "name": "阜阳市", + "areaList": [ + { + "code": "341202", + "name": "颍州区" + }, + { + "code": "341203", + "name": "颍东区" + }, + { + "code": "341204", + "name": "颍泉区" + }, + { + "code": "341221", + "name": "临泉县" + }, + { + "code": "341222", + "name": "太和县" + }, + { + "code": "341225", + "name": "阜南县" + }, + { + "code": "341226", + "name": "颍上县" + }, + { + "code": "341282", + "name": "界首市" + } + ] + }, + { + "code": "341300", + "name": "宿州市", + "areaList": [ + { + "code": "341302", + "name": "埇桥区" + }, + { + "code": "341321", + "name": "砀山县" + }, + { + "code": "341322", + "name": "萧县" + }, + { + "code": "341323", + "name": "灵璧县" + }, + { + "code": "341324", + "name": "泗县" + } + ] + }, + { + "code": "341500", + "name": "六安市", + "areaList": [ + { + "code": "341502", + "name": "金安区" + }, + { + "code": "341503", + "name": "裕安区" + }, + { + "code": "341504", + "name": "叶集区" + }, + { + "code": "341522", + "name": "霍邱县" + }, + { + "code": "341523", + "name": "舒城县" + }, + { + "code": "341524", + "name": "金寨县" + }, + { + "code": "341525", + "name": "霍山县" + } + ] + }, + { + "code": "341600", + "name": "亳州市", + "areaList": [ + { + "code": "341602", + "name": "谯城区" + }, + { + "code": "341621", + "name": "涡阳县" + }, + { + "code": "341622", + "name": "蒙城县" + }, + { + "code": "341623", + "name": "利辛县" + } + ] + }, + { + "code": "341700", + "name": "池州市", + "areaList": [ + { + "code": "341702", + "name": "贵池区" + }, + { + "code": "341721", + "name": "东至县" + }, + { + "code": "341722", + "name": "石台县" + }, + { + "code": "341723", + "name": "青阳县" + } + ] + }, + { + "code": "341800", + "name": "宣城市", + "areaList": [ + { + "code": "341802", + "name": "宣州区" + }, + { + "code": "341821", + "name": "郎溪县" + }, + { + "code": "341823", + "name": "泾县" + }, + { + "code": "341824", + "name": "绩溪县" + }, + { + "code": "341825", + "name": "旌德县" + }, + { + "code": "341881", + "name": "宁国市" + }, + { + "code": "341882", + "name": "广德市" + } + ] + } + ] + }, + { + "code": "350000", + "name": "福建省", + "cityList": [ + { + "code": "350100", + "name": "福州市", + "areaList": [ + { + "code": "350102", + "name": "鼓楼区" + }, + { + "code": "350103", + "name": "台江区" + }, + { + "code": "350104", + "name": "仓山区" + }, + { + "code": "350105", + "name": "马尾区" + }, + { + "code": "350111", + "name": "晋安区" + }, + { + "code": "350112", + "name": "长乐区" + }, + { + "code": "350121", + "name": "闽侯县" + }, + { + "code": "350122", + "name": "连江县" + }, + { + "code": "350123", + "name": "罗源县" + }, + { + "code": "350124", + "name": "闽清县" + }, + { + "code": "350125", + "name": "永泰县" + }, + { + "code": "350128", + "name": "平潭县" + }, + { + "code": "350181", + "name": "福清市" + } + ] + }, + { + "code": "350200", + "name": "厦门市", + "areaList": [ + { + "code": "350203", + "name": "思明区" + }, + { + "code": "350205", + "name": "海沧区" + }, + { + "code": "350206", + "name": "湖里区" + }, + { + "code": "350211", + "name": "集美区" + }, + { + "code": "350212", + "name": "同安区" + }, + { + "code": "350213", + "name": "翔安区" + } + ] + }, + { + "code": "350300", + "name": "莆田市", + "areaList": [ + { + "code": "350302", + "name": "城厢区" + }, + { + "code": "350303", + "name": "涵江区" + }, + { + "code": "350304", + "name": "荔城区" + }, + { + "code": "350305", + "name": "秀屿区" + }, + { + "code": "350322", + "name": "仙游县" + } + ] + }, + { + "code": "350400", + "name": "三明市", + "areaList": [ + { + "code": "350402", + "name": "梅列区" + }, + { + "code": "350403", + "name": "三元区" + }, + { + "code": "350421", + "name": "明溪县" + }, + { + "code": "350423", + "name": "清流县" + }, + { + "code": "350424", + "name": "宁化县" + }, + { + "code": "350425", + "name": "大田县" + }, + { + "code": "350426", + "name": "尤溪县" + }, + { + "code": "350427", + "name": "沙县" + }, + { + "code": "350428", + "name": "将乐县" + }, + { + "code": "350429", + "name": "泰宁县" + }, + { + "code": "350430", + "name": "建宁县" + }, + { + "code": "350481", + "name": "永安市" + } + ] + }, + { + "code": "350500", + "name": "泉州市", + "areaList": [ + { + "code": "350502", + "name": "鲤城区" + }, + { + "code": "350503", + "name": "丰泽区" + }, + { + "code": "350504", + "name": "洛江区" + }, + { + "code": "350505", + "name": "泉港区" + }, + { + "code": "350521", + "name": "惠安县" + }, + { + "code": "350524", + "name": "安溪县" + }, + { + "code": "350525", + "name": "永春县" + }, + { + "code": "350526", + "name": "德化县" + }, + { + "code": "350527", + "name": "金门县" + }, + { + "code": "350581", + "name": "石狮市" + }, + { + "code": "350582", + "name": "晋江市" + }, + { + "code": "350583", + "name": "南安市" + } + ] + }, + { + "code": "350600", + "name": "漳州市", + "areaList": [ + { + "code": "350602", + "name": "芗城区" + }, + { + "code": "350603", + "name": "龙文区" + }, + { + "code": "350622", + "name": "云霄县" + }, + { + "code": "350623", + "name": "漳浦县" + }, + { + "code": "350624", + "name": "诏安县" + }, + { + "code": "350625", + "name": "长泰县" + }, + { + "code": "350626", + "name": "东山县" + }, + { + "code": "350627", + "name": "南靖县" + }, + { + "code": "350628", + "name": "平和县" + }, + { + "code": "350629", + "name": "华安县" + }, + { + "code": "350681", + "name": "龙海市" + } + ] + }, + { + "code": "350700", + "name": "南平市", + "areaList": [ + { + "code": "350702", + "name": "延平区" + }, + { + "code": "350703", + "name": "建阳区" + }, + { + "code": "350721", + "name": "顺昌县" + }, + { + "code": "350722", + "name": "浦城县" + }, + { + "code": "350723", + "name": "光泽县" + }, + { + "code": "350724", + "name": "松溪县" + }, + { + "code": "350725", + "name": "政和县" + }, + { + "code": "350781", + "name": "邵武市" + }, + { + "code": "350782", + "name": "武夷山市" + }, + { + "code": "350783", + "name": "建瓯市" + } + ] + }, + { + "code": "350800", + "name": "龙岩市", + "areaList": [ + { + "code": "350802", + "name": "新罗区" + }, + { + "code": "350803", + "name": "永定区" + }, + { + "code": "350821", + "name": "长汀县" + }, + { + "code": "350823", + "name": "上杭县" + }, + { + "code": "350824", + "name": "武平县" + }, + { + "code": "350825", + "name": "连城县" + }, + { + "code": "350881", + "name": "漳平市" + } + ] + }, + { + "code": "350900", + "name": "宁德市", + "areaList": [ + { + "code": "350902", + "name": "蕉城区" + }, + { + "code": "350921", + "name": "霞浦县" + }, + { + "code": "350922", + "name": "古田县" + }, + { + "code": "350923", + "name": "屏南县" + }, + { + "code": "350924", + "name": "寿宁县" + }, + { + "code": "350925", + "name": "周宁县" + }, + { + "code": "350926", + "name": "柘荣县" + }, + { + "code": "350981", + "name": "福安市" + }, + { + "code": "350982", + "name": "福鼎市" + } + ] + } + ] + }, + { + "code": "360000", + "name": "江西省", + "cityList": [ + { + "code": "360100", + "name": "南昌市", + "areaList": [ + { + "code": "360102", + "name": "东湖区" + }, + { + "code": "360103", + "name": "西湖区" + }, + { + "code": "360104", + "name": "青云谱区" + }, + { + "code": "360111", + "name": "青山湖区" + }, + { + "code": "360112", + "name": "新建区" + }, + { + "code": "360113", + "name": "红谷滩区" + }, + { + "code": "360121", + "name": "南昌县" + }, + { + "code": "360123", + "name": "安义县" + }, + { + "code": "360124", + "name": "进贤县" + } + ] + }, + { + "code": "360200", + "name": "景德镇市", + "areaList": [ + { + "code": "360202", + "name": "昌江区" + }, + { + "code": "360203", + "name": "珠山区" + }, + { + "code": "360222", + "name": "浮梁县" + }, + { + "code": "360281", + "name": "乐平市" + } + ] + }, + { + "code": "360300", + "name": "萍乡市", + "areaList": [ + { + "code": "360302", + "name": "安源区" + }, + { + "code": "360313", + "name": "湘东区" + }, + { + "code": "360321", + "name": "莲花县" + }, + { + "code": "360322", + "name": "上栗县" + }, + { + "code": "360323", + "name": "芦溪县" + } + ] + }, + { + "code": "360400", + "name": "九江市", + "areaList": [ + { + "code": "360402", + "name": "濂溪区" + }, + { + "code": "360403", + "name": "浔阳区" + }, + { + "code": "360404", + "name": "柴桑区" + }, + { + "code": "360423", + "name": "武宁县" + }, + { + "code": "360424", + "name": "修水县" + }, + { + "code": "360425", + "name": "永修县" + }, + { + "code": "360426", + "name": "德安县" + }, + { + "code": "360428", + "name": "都昌县" + }, + { + "code": "360429", + "name": "湖口县" + }, + { + "code": "360430", + "name": "彭泽县" + }, + { + "code": "360481", + "name": "瑞昌市" + }, + { + "code": "360482", + "name": "共青城市" + }, + { + "code": "360483", + "name": "庐山市" + } + ] + }, + { + "code": "360500", + "name": "新余市", + "areaList": [ + { + "code": "360502", + "name": "渝水区" + }, + { + "code": "360521", + "name": "分宜县" + } + ] + }, + { + "code": "360600", + "name": "鹰潭市", + "areaList": [ + { + "code": "360602", + "name": "月湖区" + }, + { + "code": "360603", + "name": "余江区" + }, + { + "code": "360681", + "name": "贵溪市" + } + ] + }, + { + "code": "360700", + "name": "赣州市", + "areaList": [ + { + "code": "360702", + "name": "章贡区" + }, + { + "code": "360703", + "name": "南康区" + }, + { + "code": "360704", + "name": "赣县区" + }, + { + "code": "360722", + "name": "信丰县" + }, + { + "code": "360723", + "name": "大余县" + }, + { + "code": "360724", + "name": "上犹县" + }, + { + "code": "360725", + "name": "崇义县" + }, + { + "code": "360726", + "name": "安远县" + }, + { + "code": "360727", + "name": "龙南县" + }, + { + "code": "360728", + "name": "定南县" + }, + { + "code": "360729", + "name": "全南县" + }, + { + "code": "360730", + "name": "宁都县" + }, + { + "code": "360731", + "name": "于都县" + }, + { + "code": "360732", + "name": "兴国县" + }, + { + "code": "360733", + "name": "会昌县" + }, + { + "code": "360734", + "name": "寻乌县" + }, + { + "code": "360735", + "name": "石城县" + }, + { + "code": "360781", + "name": "瑞金市" + } + ] + }, + { + "code": "360800", + "name": "吉安市", + "areaList": [ + { + "code": "360802", + "name": "吉州区" + }, + { + "code": "360803", + "name": "青原区" + }, + { + "code": "360821", + "name": "吉安县" + }, + { + "code": "360822", + "name": "吉水县" + }, + { + "code": "360823", + "name": "峡江县" + }, + { + "code": "360824", + "name": "新干县" + }, + { + "code": "360825", + "name": "永丰县" + }, + { + "code": "360826", + "name": "泰和县" + }, + { + "code": "360827", + "name": "遂川县" + }, + { + "code": "360828", + "name": "万安县" + }, + { + "code": "360829", + "name": "安福县" + }, + { + "code": "360830", + "name": "永新县" + }, + { + "code": "360881", + "name": "井冈山市" + } + ] + }, + { + "code": "360900", + "name": "宜春市", + "areaList": [ + { + "code": "360902", + "name": "袁州区" + }, + { + "code": "360921", + "name": "奉新县" + }, + { + "code": "360922", + "name": "万载县" + }, + { + "code": "360923", + "name": "上高县" + }, + { + "code": "360924", + "name": "宜丰县" + }, + { + "code": "360925", + "name": "靖安县" + }, + { + "code": "360926", + "name": "铜鼓县" + }, + { + "code": "360981", + "name": "丰城市" + }, + { + "code": "360982", + "name": "樟树市" + }, + { + "code": "360983", + "name": "高安市" + } + ] + }, + { + "code": "361000", + "name": "抚州市", + "areaList": [ + { + "code": "361002", + "name": "临川区" + }, + { + "code": "361003", + "name": "东乡区" + }, + { + "code": "361021", + "name": "南城县" + }, + { + "code": "361022", + "name": "黎川县" + }, + { + "code": "361023", + "name": "南丰县" + }, + { + "code": "361024", + "name": "崇仁县" + }, + { + "code": "361025", + "name": "乐安县" + }, + { + "code": "361026", + "name": "宜黄县" + }, + { + "code": "361027", + "name": "金溪县" + }, + { + "code": "361028", + "name": "资溪县" + }, + { + "code": "361030", + "name": "广昌县" + } + ] + }, + { + "code": "361100", + "name": "上饶市", + "areaList": [ + { + "code": "361102", + "name": "信州区" + }, + { + "code": "361103", + "name": "广丰区" + }, + { + "code": "361104", + "name": "广信区" + }, + { + "code": "361123", + "name": "玉山县" + }, + { + "code": "361124", + "name": "铅山县" + }, + { + "code": "361125", + "name": "横峰县" + }, + { + "code": "361126", + "name": "弋阳县" + }, + { + "code": "361127", + "name": "余干县" + }, + { + "code": "361128", + "name": "鄱阳县" + }, + { + "code": "361129", + "name": "万年县" + }, + { + "code": "361130", + "name": "婺源县" + }, + { + "code": "361181", + "name": "德兴市" + } + ] + } + ] + }, + { + "code": "370000", + "name": "山东省", + "cityList": [ + { + "code": "370100", + "name": "济南市", + "areaList": [ + { + "code": "370102", + "name": "历下区" + }, + { + "code": "370103", + "name": "市中区" + }, + { + "code": "370104", + "name": "槐荫区" + }, + { + "code": "370105", + "name": "天桥区" + }, + { + "code": "370112", + "name": "历城区" + }, + { + "code": "370113", + "name": "长清区" + }, + { + "code": "370114", + "name": "章丘区" + }, + { + "code": "370115", + "name": "济阳区" + }, + { + "code": "370116", + "name": "莱芜区" + }, + { + "code": "370117", + "name": "钢城区" + }, + { + "code": "370124", + "name": "平阴县" + }, + { + "code": "370126", + "name": "商河县" + } + ] + }, + { + "code": "370200", + "name": "青岛市", + "areaList": [ + { + "code": "370202", + "name": "市南区" + }, + { + "code": "370203", + "name": "市北区" + }, + { + "code": "370211", + "name": "黄岛区" + }, + { + "code": "370212", + "name": "崂山区" + }, + { + "code": "370213", + "name": "李沧区" + }, + { + "code": "370214", + "name": "城阳区" + }, + { + "code": "370215", + "name": "即墨区" + }, + { + "code": "370281", + "name": "胶州市" + }, + { + "code": "370283", + "name": "平度市" + }, + { + "code": "370285", + "name": "莱西市" + } + ] + }, + { + "code": "370300", + "name": "淄博市", + "areaList": [ + { + "code": "370302", + "name": "淄川区" + }, + { + "code": "370303", + "name": "张店区" + }, + { + "code": "370304", + "name": "博山区" + }, + { + "code": "370305", + "name": "临淄区" + }, + { + "code": "370306", + "name": "周村区" + }, + { + "code": "370321", + "name": "桓台县" + }, + { + "code": "370322", + "name": "高青县" + }, + { + "code": "370323", + "name": "沂源县" + } + ] + }, + { + "code": "370400", + "name": "枣庄市", + "areaList": [ + { + "code": "370402", + "name": "市中区" + }, + { + "code": "370403", + "name": "薛城区" + }, + { + "code": "370404", + "name": "峄城区" + }, + { + "code": "370405", + "name": "台儿庄区" + }, + { + "code": "370406", + "name": "山亭区" + }, + { + "code": "370481", + "name": "滕州市" + } + ] + }, + { + "code": "370500", + "name": "东营市", + "areaList": [ + { + "code": "370502", + "name": "东营区" + }, + { + "code": "370503", + "name": "河口区" + }, + { + "code": "370505", + "name": "垦利区" + }, + { + "code": "370522", + "name": "利津县" + }, + { + "code": "370523", + "name": "广饶县" + } + ] + }, + { + "code": "370600", + "name": "烟台市", + "areaList": [ + { + "code": "370602", + "name": "芝罘区" + }, + { + "code": "370611", + "name": "福山区" + }, + { + "code": "370612", + "name": "牟平区" + }, + { + "code": "370613", + "name": "莱山区" + }, + { + "code": "370634", + "name": "长岛县" + }, + { + "code": "370681", + "name": "龙口市" + }, + { + "code": "370682", + "name": "莱阳市" + }, + { + "code": "370683", + "name": "莱州市" + }, + { + "code": "370684", + "name": "蓬莱市" + }, + { + "code": "370685", + "name": "招远市" + }, + { + "code": "370686", + "name": "栖霞市" + }, + { + "code": "370687", + "name": "海阳市" + } + ] + }, + { + "code": "370700", + "name": "潍坊市", + "areaList": [ + { + "code": "370702", + "name": "潍城区" + }, + { + "code": "370703", + "name": "寒亭区" + }, + { + "code": "370704", + "name": "坊子区" + }, + { + "code": "370705", + "name": "奎文区" + }, + { + "code": "370724", + "name": "临朐县" + }, + { + "code": "370725", + "name": "昌乐县" + }, + { + "code": "370781", + "name": "青州市" + }, + { + "code": "370782", + "name": "诸城市" + }, + { + "code": "370783", + "name": "寿光市" + }, + { + "code": "370784", + "name": "安丘市" + }, + { + "code": "370785", + "name": "高密市" + }, + { + "code": "370786", + "name": "昌邑市" + } + ] + }, + { + "code": "370800", + "name": "济宁市", + "areaList": [ + { + "code": "370811", + "name": "任城区" + }, + { + "code": "370812", + "name": "兖州区" + }, + { + "code": "370826", + "name": "微山县" + }, + { + "code": "370827", + "name": "鱼台县" + }, + { + "code": "370828", + "name": "金乡县" + }, + { + "code": "370829", + "name": "嘉祥县" + }, + { + "code": "370830", + "name": "汶上县" + }, + { + "code": "370831", + "name": "泗水县" + }, + { + "code": "370832", + "name": "梁山县" + }, + { + "code": "370881", + "name": "曲阜市" + }, + { + "code": "370883", + "name": "邹城市" + } + ] + }, + { + "code": "370900", + "name": "泰安市", + "areaList": [ + { + "code": "370902", + "name": "泰山区" + }, + { + "code": "370911", + "name": "岱岳区" + }, + { + "code": "370921", + "name": "宁阳县" + }, + { + "code": "370923", + "name": "东平县" + }, + { + "code": "370982", + "name": "新泰市" + }, + { + "code": "370983", + "name": "肥城市" + } + ] + }, + { + "code": "371000", + "name": "威海市", + "areaList": [ + { + "code": "371002", + "name": "环翠区" + }, + { + "code": "371003", + "name": "文登区" + }, + { + "code": "371082", + "name": "荣成市" + }, + { + "code": "371083", + "name": "乳山市" + } + ] + }, + { + "code": "371100", + "name": "日照市", + "areaList": [ + { + "code": "371102", + "name": "东港区" + }, + { + "code": "371103", + "name": "岚山区" + }, + { + "code": "371121", + "name": "五莲县" + }, + { + "code": "371122", + "name": "莒县" + } + ] + }, + { + "code": "371300", + "name": "临沂市", + "areaList": [ + { + "code": "371302", + "name": "兰山区" + }, + { + "code": "371311", + "name": "罗庄区" + }, + { + "code": "371312", + "name": "河东区" + }, + { + "code": "371321", + "name": "沂南县" + }, + { + "code": "371322", + "name": "郯城县" + }, + { + "code": "371323", + "name": "沂水县" + }, + { + "code": "371324", + "name": "兰陵县" + }, + { + "code": "371325", + "name": "费县" + }, + { + "code": "371326", + "name": "平邑县" + }, + { + "code": "371327", + "name": "莒南县" + }, + { + "code": "371328", + "name": "蒙阴县" + }, + { + "code": "371329", + "name": "临沭县" + } + ] + }, + { + "code": "371400", + "name": "德州市", + "areaList": [ + { + "code": "371402", + "name": "德城区" + }, + { + "code": "371403", + "name": "陵城区" + }, + { + "code": "371422", + "name": "宁津县" + }, + { + "code": "371423", + "name": "庆云县" + }, + { + "code": "371424", + "name": "临邑县" + }, + { + "code": "371425", + "name": "齐河县" + }, + { + "code": "371426", + "name": "平原县" + }, + { + "code": "371427", + "name": "夏津县" + }, + { + "code": "371428", + "name": "武城县" + }, + { + "code": "371481", + "name": "乐陵市" + }, + { + "code": "371482", + "name": "禹城市" + } + ] + }, + { + "code": "371500", + "name": "聊城市", + "areaList": [ + { + "code": "371502", + "name": "东昌府区" + }, + { + "code": "371503", + "name": "茌平区" + }, + { + "code": "371521", + "name": "阳谷县" + }, + { + "code": "371522", + "name": "莘县" + }, + { + "code": "371524", + "name": "东阿县" + }, + { + "code": "371525", + "name": "冠县" + }, + { + "code": "371526", + "name": "高唐县" + }, + { + "code": "371581", + "name": "临清市" + } + ] + }, + { + "code": "371600", + "name": "滨州市", + "areaList": [ + { + "code": "371602", + "name": "滨城区" + }, + { + "code": "371603", + "name": "沾化区" + }, + { + "code": "371621", + "name": "惠民县" + }, + { + "code": "371622", + "name": "阳信县" + }, + { + "code": "371623", + "name": "无棣县" + }, + { + "code": "371625", + "name": "博兴县" + }, + { + "code": "371681", + "name": "邹平市" + } + ] + }, + { + "code": "371700", + "name": "菏泽市", + "areaList": [ + { + "code": "371702", + "name": "牡丹区" + }, + { + "code": "371703", + "name": "定陶区" + }, + { + "code": "371721", + "name": "曹县" + }, + { + "code": "371722", + "name": "单县" + }, + { + "code": "371723", + "name": "成武县" + }, + { + "code": "371724", + "name": "巨野县" + }, + { + "code": "371725", + "name": "郓城县" + }, + { + "code": "371726", + "name": "鄄城县" + }, + { + "code": "371728", + "name": "东明县" + } + ] + } + ] + }, + { + "code": "410000", + "name": "河南省", + "cityList": [ + { + "code": "410100", + "name": "郑州市", + "areaList": [ + { + "code": "410102", + "name": "中原区" + }, + { + "code": "410103", + "name": "二七区" + }, + { + "code": "410104", + "name": "管城回族区" + }, + { + "code": "410105", + "name": "金水区" + }, + { + "code": "410106", + "name": "上街区" + }, + { + "code": "410108", + "name": "惠济区" + }, + { + "code": "410122", + "name": "中牟县" + }, + { + "code": "410181", + "name": "巩义市" + }, + { + "code": "410182", + "name": "荥阳市" + }, + { + "code": "410183", + "name": "新密市" + }, + { + "code": "410184", + "name": "新郑市" + }, + { + "code": "410185", + "name": "登封市" + } + ] + }, + { + "code": "410200", + "name": "开封市", + "areaList": [ + { + "code": "410202", + "name": "龙亭区" + }, + { + "code": "410203", + "name": "顺河回族区" + }, + { + "code": "410204", + "name": "鼓楼区" + }, + { + "code": "410205", + "name": "禹王台区" + }, + { + "code": "410212", + "name": "祥符区" + }, + { + "code": "410221", + "name": "杞县" + }, + { + "code": "410222", + "name": "通许县" + }, + { + "code": "410223", + "name": "尉氏县" + }, + { + "code": "410225", + "name": "兰考县" + } + ] + }, + { + "code": "410300", + "name": "洛阳市", + "areaList": [ + { + "code": "410302", + "name": "老城区" + }, + { + "code": "410303", + "name": "西工区" + }, + { + "code": "410304", + "name": "瀍河回族区" + }, + { + "code": "410305", + "name": "涧西区" + }, + { + "code": "410306", + "name": "吉利区" + }, + { + "code": "410311", + "name": "洛龙区" + }, + { + "code": "410322", + "name": "孟津县" + }, + { + "code": "410323", + "name": "新安县" + }, + { + "code": "410324", + "name": "栾川县" + }, + { + "code": "410325", + "name": "嵩县" + }, + { + "code": "410326", + "name": "汝阳县" + }, + { + "code": "410327", + "name": "宜阳县" + }, + { + "code": "410328", + "name": "洛宁县" + }, + { + "code": "410329", + "name": "伊川县" + }, + { + "code": "410381", + "name": "偃师市" + } + ] + }, + { + "code": "410400", + "name": "平顶山市", + "areaList": [ + { + "code": "410402", + "name": "新华区" + }, + { + "code": "410403", + "name": "卫东区" + }, + { + "code": "410404", + "name": "石龙区" + }, + { + "code": "410411", + "name": "湛河区" + }, + { + "code": "410421", + "name": "宝丰县" + }, + { + "code": "410422", + "name": "叶县" + }, + { + "code": "410423", + "name": "鲁山县" + }, + { + "code": "410425", + "name": "郏县" + }, + { + "code": "410481", + "name": "舞钢市" + }, + { + "code": "410482", + "name": "汝州市" + } + ] + }, + { + "code": "410500", + "name": "安阳市", + "areaList": [ + { + "code": "410502", + "name": "文峰区" + }, + { + "code": "410503", + "name": "北关区" + }, + { + "code": "410505", + "name": "殷都区" + }, + { + "code": "410506", + "name": "龙安区" + }, + { + "code": "410522", + "name": "安阳县" + }, + { + "code": "410523", + "name": "汤阴县" + }, + { + "code": "410526", + "name": "滑县" + }, + { + "code": "410527", + "name": "内黄县" + }, + { + "code": "410581", + "name": "林州市" + } + ] + }, + { + "code": "410600", + "name": "鹤壁市", + "areaList": [ + { + "code": "410602", + "name": "鹤山区" + }, + { + "code": "410603", + "name": "山城区" + }, + { + "code": "410611", + "name": "淇滨区" + }, + { + "code": "410621", + "name": "浚县" + }, + { + "code": "410622", + "name": "淇县" + } + ] + }, + { + "code": "410700", + "name": "新乡市", + "areaList": [ + { + "code": "410702", + "name": "红旗区" + }, + { + "code": "410703", + "name": "卫滨区" + }, + { + "code": "410704", + "name": "凤泉区" + }, + { + "code": "410711", + "name": "牧野区" + }, + { + "code": "410721", + "name": "新乡县" + }, + { + "code": "410724", + "name": "获嘉县" + }, + { + "code": "410725", + "name": "原阳县" + }, + { + "code": "410726", + "name": "延津县" + }, + { + "code": "410727", + "name": "封丘县" + }, + { + "code": "410781", + "name": "卫辉市" + }, + { + "code": "410782", + "name": "辉县市" + }, + { + "code": "410783", + "name": "长垣市" + } + ] + }, + { + "code": "410800", + "name": "焦作市", + "areaList": [ + { + "code": "410802", + "name": "解放区" + }, + { + "code": "410803", + "name": "中站区" + }, + { + "code": "410804", + "name": "马村区" + }, + { + "code": "410811", + "name": "山阳区" + }, + { + "code": "410821", + "name": "修武县" + }, + { + "code": "410822", + "name": "博爱县" + }, + { + "code": "410823", + "name": "武陟县" + }, + { + "code": "410825", + "name": "温县" + }, + { + "code": "410882", + "name": "沁阳市" + }, + { + "code": "410883", + "name": "孟州市" + } + ] + }, + { + "code": "410900", + "name": "濮阳市", + "areaList": [ + { + "code": "410902", + "name": "华龙区" + }, + { + "code": "410922", + "name": "清丰县" + }, + { + "code": "410923", + "name": "南乐县" + }, + { + "code": "410926", + "name": "范县" + }, + { + "code": "410927", + "name": "台前县" + }, + { + "code": "410928", + "name": "濮阳县" + } + ] + }, + { + "code": "411000", + "name": "许昌市", + "areaList": [ + { + "code": "411002", + "name": "魏都区" + }, + { + "code": "411003", + "name": "建安区" + }, + { + "code": "411024", + "name": "鄢陵县" + }, + { + "code": "411025", + "name": "襄城县" + }, + { + "code": "411081", + "name": "禹州市" + }, + { + "code": "411082", + "name": "长葛市" + } + ] + }, + { + "code": "411100", + "name": "漯河市", + "areaList": [ + { + "code": "411102", + "name": "源汇区" + }, + { + "code": "411103", + "name": "郾城区" + }, + { + "code": "411104", + "name": "召陵区" + }, + { + "code": "411121", + "name": "舞阳县" + }, + { + "code": "411122", + "name": "临颍县" + } + ] + }, + { + "code": "411200", + "name": "三门峡市", + "areaList": [ + { + "code": "411202", + "name": "湖滨区" + }, + { + "code": "411203", + "name": "陕州区" + }, + { + "code": "411221", + "name": "渑池县" + }, + { + "code": "411224", + "name": "卢氏县" + }, + { + "code": "411281", + "name": "义马市" + }, + { + "code": "411282", + "name": "灵宝市" + } + ] + }, + { + "code": "411300", + "name": "南阳市", + "areaList": [ + { + "code": "411302", + "name": "宛城区" + }, + { + "code": "411303", + "name": "卧龙区" + }, + { + "code": "411321", + "name": "南召县" + }, + { + "code": "411322", + "name": "方城县" + }, + { + "code": "411323", + "name": "西峡县" + }, + { + "code": "411324", + "name": "镇平县" + }, + { + "code": "411325", + "name": "内乡县" + }, + { + "code": "411326", + "name": "淅川县" + }, + { + "code": "411327", + "name": "社旗县" + }, + { + "code": "411328", + "name": "唐河县" + }, + { + "code": "411329", + "name": "新野县" + }, + { + "code": "411330", + "name": "桐柏县" + }, + { + "code": "411381", + "name": "邓州市" + } + ] + }, + { + "code": "411400", + "name": "商丘市", + "areaList": [ + { + "code": "411402", + "name": "梁园区" + }, + { + "code": "411403", + "name": "睢阳区" + }, + { + "code": "411421", + "name": "民权县" + }, + { + "code": "411422", + "name": "睢县" + }, + { + "code": "411423", + "name": "宁陵县" + }, + { + "code": "411424", + "name": "柘城县" + }, + { + "code": "411425", + "name": "虞城县" + }, + { + "code": "411426", + "name": "夏邑县" + }, + { + "code": "411481", + "name": "永城市" + } + ] + }, + { + "code": "411500", + "name": "信阳市", + "areaList": [ + { + "code": "411502", + "name": "浉河区" + }, + { + "code": "411503", + "name": "平桥区" + }, + { + "code": "411521", + "name": "罗山县" + }, + { + "code": "411522", + "name": "光山县" + }, + { + "code": "411523", + "name": "新县" + }, + { + "code": "411524", + "name": "商城县" + }, + { + "code": "411525", + "name": "固始县" + }, + { + "code": "411526", + "name": "潢川县" + }, + { + "code": "411527", + "name": "淮滨县" + }, + { + "code": "411528", + "name": "息县" + } + ] + }, + { + "code": "411600", + "name": "周口市", + "areaList": [ + { + "code": "411602", + "name": "川汇区" + }, + { + "code": "411603", + "name": "淮阳区" + }, + { + "code": "411621", + "name": "扶沟县" + }, + { + "code": "411622", + "name": "西华县" + }, + { + "code": "411623", + "name": "商水县" + }, + { + "code": "411624", + "name": "沈丘县" + }, + { + "code": "411625", + "name": "郸城县" + }, + { + "code": "411627", + "name": "太康县" + }, + { + "code": "411628", + "name": "鹿邑县" + }, + { + "code": "411681", + "name": "项城市" + } + ] + }, + { + "code": "411700", + "name": "驻马店市", + "areaList": [ + { + "code": "411702", + "name": "驿城区" + }, + { + "code": "411721", + "name": "西平县" + }, + { + "code": "411722", + "name": "上蔡县" + }, + { + "code": "411723", + "name": "平舆县" + }, + { + "code": "411724", + "name": "正阳县" + }, + { + "code": "411725", + "name": "确山县" + }, + { + "code": "411726", + "name": "泌阳县" + }, + { + "code": "411727", + "name": "汝南县" + }, + { + "code": "411728", + "name": "遂平县" + }, + { + "code": "411729", + "name": "新蔡县" + } + ] + }, + { + "code": "419001", + "name": "济源市", + "areaList": [] + } + ] + }, + { + "code": "420000", + "name": "湖北省", + "cityList": [ + { + "code": "420100", + "name": "武汉市", + "areaList": [ + { + "code": "420102", + "name": "江岸区" + }, + { + "code": "420103", + "name": "江汉区" + }, + { + "code": "420104", + "name": "硚口区" + }, + { + "code": "420105", + "name": "汉阳区" + }, + { + "code": "420106", + "name": "武昌区" + }, + { + "code": "420107", + "name": "青山区" + }, + { + "code": "420111", + "name": "洪山区" + }, + { + "code": "420112", + "name": "东西湖区" + }, + { + "code": "420113", + "name": "汉南区" + }, + { + "code": "420114", + "name": "蔡甸区" + }, + { + "code": "420115", + "name": "江夏区" + }, + { + "code": "420116", + "name": "黄陂区" + }, + { + "code": "420117", + "name": "新洲区" + } + ] + }, + { + "code": "420200", + "name": "黄石市", + "areaList": [ + { + "code": "420202", + "name": "黄石港区" + }, + { + "code": "420203", + "name": "西塞山区" + }, + { + "code": "420204", + "name": "下陆区" + }, + { + "code": "420205", + "name": "铁山区" + }, + { + "code": "420222", + "name": "阳新县" + }, + { + "code": "420281", + "name": "大冶市" + } + ] + }, + { + "code": "420300", + "name": "十堰市", + "areaList": [ + { + "code": "420302", + "name": "茅箭区" + }, + { + "code": "420303", + "name": "张湾区" + }, + { + "code": "420304", + "name": "郧阳区" + }, + { + "code": "420322", + "name": "郧西县" + }, + { + "code": "420323", + "name": "竹山县" + }, + { + "code": "420324", + "name": "竹溪县" + }, + { + "code": "420325", + "name": "房县" + }, + { + "code": "420381", + "name": "丹江口市" + } + ] + }, + { + "code": "420500", + "name": "宜昌市", + "areaList": [ + { + "code": "420502", + "name": "西陵区" + }, + { + "code": "420503", + "name": "伍家岗区" + }, + { + "code": "420504", + "name": "点军区" + }, + { + "code": "420505", + "name": "猇亭区" + }, + { + "code": "420506", + "name": "夷陵区" + }, + { + "code": "420525", + "name": "远安县" + }, + { + "code": "420526", + "name": "兴山县" + }, + { + "code": "420527", + "name": "秭归县" + }, + { + "code": "420528", + "name": "长阳土家族自治县" + }, + { + "code": "420529", + "name": "五峰土家族自治县" + }, + { + "code": "420581", + "name": "宜都市" + }, + { + "code": "420582", + "name": "当阳市" + }, + { + "code": "420583", + "name": "枝江市" + } + ] + }, + { + "code": "420600", + "name": "襄阳市", + "areaList": [ + { + "code": "420602", + "name": "襄城区" + }, + { + "code": "420606", + "name": "樊城区" + }, + { + "code": "420607", + "name": "襄州区" + }, + { + "code": "420624", + "name": "南漳县" + }, + { + "code": "420625", + "name": "谷城县" + }, + { + "code": "420626", + "name": "保康县" + }, + { + "code": "420682", + "name": "老河口市" + }, + { + "code": "420683", + "name": "枣阳市" + }, + { + "code": "420684", + "name": "宜城市" + } + ] + }, + { + "code": "420700", + "name": "鄂州市", + "areaList": [ + { + "code": "420702", + "name": "梁子湖区" + }, + { + "code": "420703", + "name": "华容区" + }, + { + "code": "420704", + "name": "鄂城区" + } + ] + }, + { + "code": "420800", + "name": "荆门市", + "areaList": [ + { + "code": "420802", + "name": "东宝区" + }, + { + "code": "420804", + "name": "掇刀区" + }, + { + "code": "420822", + "name": "沙洋县" + }, + { + "code": "420881", + "name": "钟祥市" + }, + { + "code": "420882", + "name": "京山市" + } + ] + }, + { + "code": "420900", + "name": "孝感市", + "areaList": [ + { + "code": "420902", + "name": "孝南区" + }, + { + "code": "420921", + "name": "孝昌县" + }, + { + "code": "420922", + "name": "大悟县" + }, + { + "code": "420923", + "name": "云梦县" + }, + { + "code": "420981", + "name": "应城市" + }, + { + "code": "420982", + "name": "安陆市" + }, + { + "code": "420984", + "name": "汉川市" + } + ] + }, + { + "code": "421000", + "name": "荆州市", + "areaList": [ + { + "code": "421002", + "name": "沙市区" + }, + { + "code": "421003", + "name": "荆州区" + }, + { + "code": "421022", + "name": "公安县" + }, + { + "code": "421023", + "name": "监利县" + }, + { + "code": "421024", + "name": "江陵县" + }, + { + "code": "421081", + "name": "石首市" + }, + { + "code": "421083", + "name": "洪湖市" + }, + { + "code": "421087", + "name": "松滋市" + } + ] + }, + { + "code": "421100", + "name": "黄冈市", + "areaList": [ + { + "code": "421102", + "name": "黄州区" + }, + { + "code": "421121", + "name": "团风县" + }, + { + "code": "421122", + "name": "红安县" + }, + { + "code": "421123", + "name": "罗田县" + }, + { + "code": "421124", + "name": "英山县" + }, + { + "code": "421125", + "name": "浠水县" + }, + { + "code": "421126", + "name": "蕲春县" + }, + { + "code": "421127", + "name": "黄梅县" + }, + { + "code": "421181", + "name": "麻城市" + }, + { + "code": "421182", + "name": "武穴市" + } + ] + }, + { + "code": "421200", + "name": "咸宁市", + "areaList": [ + { + "code": "421202", + "name": "咸安区" + }, + { + "code": "421221", + "name": "嘉鱼县" + }, + { + "code": "421222", + "name": "通城县" + }, + { + "code": "421223", + "name": "崇阳县" + }, + { + "code": "421224", + "name": "通山县" + }, + { + "code": "421281", + "name": "赤壁市" + } + ] + }, + { + "code": "421300", + "name": "随州市", + "areaList": [ + { + "code": "421303", + "name": "曾都区" + }, + { + "code": "421321", + "name": "随县" + }, + { + "code": "421381", + "name": "广水市" + } + ] + }, + { + "code": "422800", + "name": "恩施土家族苗族自治州", + "areaList": [ + { + "code": "422801", + "name": "恩施市" + }, + { + "code": "422802", + "name": "利川市" + }, + { + "code": "422822", + "name": "建始县" + }, + { + "code": "422823", + "name": "巴东县" + }, + { + "code": "422825", + "name": "宣恩县" + }, + { + "code": "422826", + "name": "咸丰县" + }, + { + "code": "422827", + "name": "来凤县" + }, + { + "code": "422828", + "name": "鹤峰县" + } + ] + }, + { + "code": "429004", + "name": "仙桃市", + "areaList": [] + }, + { + "code": "429005", + "name": "潜江市", + "areaList": [] + }, + { + "code": "429006", + "name": "天门市", + "areaList": [] + }, + { + "code": "429021", + "name": "神农架林区", + "areaList": [] + } + ] + }, + { + "code": "430000", + "name": "湖南省", + "cityList": [ + { + "code": "430100", + "name": "长沙市", + "areaList": [ + { + "code": "430102", + "name": "芙蓉区" + }, + { + "code": "430103", + "name": "天心区" + }, + { + "code": "430104", + "name": "岳麓区" + }, + { + "code": "430105", + "name": "开福区" + }, + { + "code": "430111", + "name": "雨花区" + }, + { + "code": "430112", + "name": "望城区" + }, + { + "code": "430121", + "name": "长沙县" + }, + { + "code": "430181", + "name": "浏阳市" + }, + { + "code": "430182", + "name": "宁乡市" + } + ] + }, + { + "code": "430200", + "name": "株洲市", + "areaList": [ + { + "code": "430202", + "name": "荷塘区" + }, + { + "code": "430203", + "name": "芦淞区" + }, + { + "code": "430204", + "name": "石峰区" + }, + { + "code": "430211", + "name": "天元区" + }, + { + "code": "430212", + "name": "渌口区" + }, + { + "code": "430223", + "name": "攸县" + }, + { + "code": "430224", + "name": "茶陵县" + }, + { + "code": "430225", + "name": "炎陵县" + }, + { + "code": "430281", + "name": "醴陵市" + } + ] + }, + { + "code": "430300", + "name": "湘潭市", + "areaList": [ + { + "code": "430302", + "name": "雨湖区" + }, + { + "code": "430304", + "name": "岳塘区" + }, + { + "code": "430321", + "name": "湘潭县" + }, + { + "code": "430381", + "name": "湘乡市" + }, + { + "code": "430382", + "name": "韶山市" + } + ] + }, + { + "code": "430400", + "name": "衡阳市", + "areaList": [ + { + "code": "430405", + "name": "珠晖区" + }, + { + "code": "430406", + "name": "雁峰区" + }, + { + "code": "430407", + "name": "石鼓区" + }, + { + "code": "430408", + "name": "蒸湘区" + }, + { + "code": "430412", + "name": "南岳区" + }, + { + "code": "430421", + "name": "衡阳县" + }, + { + "code": "430422", + "name": "衡南县" + }, + { + "code": "430423", + "name": "衡山县" + }, + { + "code": "430424", + "name": "衡东县" + }, + { + "code": "430426", + "name": "祁东县" + }, + { + "code": "430481", + "name": "耒阳市" + }, + { + "code": "430482", + "name": "常宁市" + } + ] + }, + { + "code": "430500", + "name": "邵阳市", + "areaList": [ + { + "code": "430502", + "name": "双清区" + }, + { + "code": "430503", + "name": "大祥区" + }, + { + "code": "430511", + "name": "北塔区" + }, + { + "code": "430522", + "name": "新邵县" + }, + { + "code": "430523", + "name": "邵阳县" + }, + { + "code": "430524", + "name": "隆回县" + }, + { + "code": "430525", + "name": "洞口县" + }, + { + "code": "430527", + "name": "绥宁县" + }, + { + "code": "430528", + "name": "新宁县" + }, + { + "code": "430529", + "name": "城步苗族自治县" + }, + { + "code": "430581", + "name": "武冈市" + }, + { + "code": "430582", + "name": "邵东市" + } + ] + }, + { + "code": "430600", + "name": "岳阳市", + "areaList": [ + { + "code": "430602", + "name": "岳阳楼区" + }, + { + "code": "430603", + "name": "云溪区" + }, + { + "code": "430611", + "name": "君山区" + }, + { + "code": "430621", + "name": "岳阳县" + }, + { + "code": "430623", + "name": "华容县" + }, + { + "code": "430624", + "name": "湘阴县" + }, + { + "code": "430626", + "name": "平江县" + }, + { + "code": "430681", + "name": "汨罗市" + }, + { + "code": "430682", + "name": "临湘市" + } + ] + }, + { + "code": "430700", + "name": "常德市", + "areaList": [ + { + "code": "430702", + "name": "武陵区" + }, + { + "code": "430703", + "name": "鼎城区" + }, + { + "code": "430721", + "name": "安乡县" + }, + { + "code": "430722", + "name": "汉寿县" + }, + { + "code": "430723", + "name": "澧县" + }, + { + "code": "430724", + "name": "临澧县" + }, + { + "code": "430725", + "name": "桃源县" + }, + { + "code": "430726", + "name": "石门县" + }, + { + "code": "430781", + "name": "津市市" + } + ] + }, + { + "code": "430800", + "name": "张家界市", + "areaList": [ + { + "code": "430802", + "name": "永定区" + }, + { + "code": "430811", + "name": "武陵源区" + }, + { + "code": "430821", + "name": "慈利县" + }, + { + "code": "430822", + "name": "桑植县" + } + ] + }, + { + "code": "430900", + "name": "益阳市", + "areaList": [ + { + "code": "430902", + "name": "资阳区" + }, + { + "code": "430903", + "name": "赫山区" + }, + { + "code": "430921", + "name": "南县" + }, + { + "code": "430922", + "name": "桃江县" + }, + { + "code": "430923", + "name": "安化县" + }, + { + "code": "430981", + "name": "沅江市" + } + ] + }, + { + "code": "431000", + "name": "郴州市", + "areaList": [ + { + "code": "431002", + "name": "北湖区" + }, + { + "code": "431003", + "name": "苏仙区" + }, + { + "code": "431021", + "name": "桂阳县" + }, + { + "code": "431022", + "name": "宜章县" + }, + { + "code": "431023", + "name": "永兴县" + }, + { + "code": "431024", + "name": "嘉禾县" + }, + { + "code": "431025", + "name": "临武县" + }, + { + "code": "431026", + "name": "汝城县" + }, + { + "code": "431027", + "name": "桂东县" + }, + { + "code": "431028", + "name": "安仁县" + }, + { + "code": "431081", + "name": "资兴市" + } + ] + }, + { + "code": "431100", + "name": "永州市", + "areaList": [ + { + "code": "431102", + "name": "零陵区" + }, + { + "code": "431103", + "name": "冷水滩区" + }, + { + "code": "431121", + "name": "祁阳县" + }, + { + "code": "431122", + "name": "东安县" + }, + { + "code": "431123", + "name": "双牌县" + }, + { + "code": "431124", + "name": "道县" + }, + { + "code": "431125", + "name": "江永县" + }, + { + "code": "431126", + "name": "宁远县" + }, + { + "code": "431127", + "name": "蓝山县" + }, + { + "code": "431128", + "name": "新田县" + }, + { + "code": "431129", + "name": "江华瑶族自治县" + } + ] + }, + { + "code": "431200", + "name": "怀化市", + "areaList": [ + { + "code": "431202", + "name": "鹤城区" + }, + { + "code": "431221", + "name": "中方县" + }, + { + "code": "431222", + "name": "沅陵县" + }, + { + "code": "431223", + "name": "辰溪县" + }, + { + "code": "431224", + "name": "溆浦县" + }, + { + "code": "431225", + "name": "会同县" + }, + { + "code": "431226", + "name": "麻阳苗族自治县" + }, + { + "code": "431227", + "name": "新晃侗族自治县" + }, + { + "code": "431228", + "name": "芷江侗族自治县" + }, + { + "code": "431229", + "name": "靖州苗族侗族自治县" + }, + { + "code": "431230", + "name": "通道侗族自治县" + }, + { + "code": "431281", + "name": "洪江市" + } + ] + }, + { + "code": "431300", + "name": "娄底市", + "areaList": [ + { + "code": "431302", + "name": "娄星区" + }, + { + "code": "431321", + "name": "双峰县" + }, + { + "code": "431322", + "name": "新化县" + }, + { + "code": "431381", + "name": "冷水江市" + }, + { + "code": "431382", + "name": "涟源市" + } + ] + }, + { + "code": "433100", + "name": "湘西土家族苗族自治州", + "areaList": [ + { + "code": "433101", + "name": "吉首市" + }, + { + "code": "433122", + "name": "泸溪县" + }, + { + "code": "433123", + "name": "凤凰县" + }, + { + "code": "433124", + "name": "花垣县" + }, + { + "code": "433125", + "name": "保靖县" + }, + { + "code": "433126", + "name": "古丈县" + }, + { + "code": "433127", + "name": "永顺县" + }, + { + "code": "433130", + "name": "龙山县" + } + ] + } + ] + }, + { + "code": "440000", + "name": "广东省", + "cityList": [ + { + "code": "440100", + "name": "广州市", + "areaList": [ + { + "code": "440103", + "name": "荔湾区" + }, + { + "code": "440104", + "name": "越秀区" + }, + { + "code": "440105", + "name": "海珠区" + }, + { + "code": "440106", + "name": "天河区" + }, + { + "code": "440111", + "name": "白云区" + }, + { + "code": "440112", + "name": "黄埔区" + }, + { + "code": "440113", + "name": "番禺区" + }, + { + "code": "440114", + "name": "花都区" + }, + { + "code": "440115", + "name": "南沙区" + }, + { + "code": "440117", + "name": "从化区" + }, + { + "code": "440118", + "name": "增城区" + } + ] + }, + { + "code": "440200", + "name": "韶关市", + "areaList": [ + { + "code": "440203", + "name": "武江区" + }, + { + "code": "440204", + "name": "浈江区" + }, + { + "code": "440205", + "name": "曲江区" + }, + { + "code": "440222", + "name": "始兴县" + }, + { + "code": "440224", + "name": "仁化县" + }, + { + "code": "440229", + "name": "翁源县" + }, + { + "code": "440232", + "name": "乳源瑶族自治县" + }, + { + "code": "440233", + "name": "新丰县" + }, + { + "code": "440281", + "name": "乐昌市" + }, + { + "code": "440282", + "name": "南雄市" + } + ] + }, + { + "code": "440300", + "name": "深圳市", + "areaList": [ + { + "code": "440303", + "name": "罗湖区" + }, + { + "code": "440304", + "name": "福田区" + }, + { + "code": "440305", + "name": "南山区" + }, + { + "code": "440306", + "name": "宝安区" + }, + { + "code": "440307", + "name": "龙岗区" + }, + { + "code": "440308", + "name": "盐田区" + }, + { + "code": "440309", + "name": "龙华区" + }, + { + "code": "440310", + "name": "坪山区" + }, + { + "code": "440311", + "name": "光明区" + } + ] + }, + { + "code": "440400", + "name": "珠海市", + "areaList": [ + { + "code": "440402", + "name": "香洲区" + }, + { + "code": "440403", + "name": "斗门区" + }, + { + "code": "440404", + "name": "金湾区" + } + ] + }, + { + "code": "440500", + "name": "汕头市", + "areaList": [ + { + "code": "440507", + "name": "龙湖区" + }, + { + "code": "440511", + "name": "金平区" + }, + { + "code": "440512", + "name": "濠江区" + }, + { + "code": "440513", + "name": "潮阳区" + }, + { + "code": "440514", + "name": "潮南区" + }, + { + "code": "440515", + "name": "澄海区" + }, + { + "code": "440523", + "name": "南澳县" + } + ] + }, + { + "code": "440600", + "name": "佛山市", + "areaList": [ + { + "code": "440604", + "name": "禅城区" + }, + { + "code": "440605", + "name": "南海区" + }, + { + "code": "440606", + "name": "顺德区" + }, + { + "code": "440607", + "name": "三水区" + }, + { + "code": "440608", + "name": "高明区" + } + ] + }, + { + "code": "440700", + "name": "江门市", + "areaList": [ + { + "code": "440703", + "name": "蓬江区" + }, + { + "code": "440704", + "name": "江海区" + }, + { + "code": "440705", + "name": "新会区" + }, + { + "code": "440781", + "name": "台山市" + }, + { + "code": "440783", + "name": "开平市" + }, + { + "code": "440784", + "name": "鹤山市" + }, + { + "code": "440785", + "name": "恩平市" + } + ] + }, + { + "code": "440800", + "name": "湛江市", + "areaList": [ + { + "code": "440802", + "name": "赤坎区" + }, + { + "code": "440803", + "name": "霞山区" + }, + { + "code": "440804", + "name": "坡头区" + }, + { + "code": "440811", + "name": "麻章区" + }, + { + "code": "440823", + "name": "遂溪县" + }, + { + "code": "440825", + "name": "徐闻县" + }, + { + "code": "440881", + "name": "廉江市" + }, + { + "code": "440882", + "name": "雷州市" + }, + { + "code": "440883", + "name": "吴川市" + } + ] + }, + { + "code": "440900", + "name": "茂名市", + "areaList": [ + { + "code": "440902", + "name": "茂南区" + }, + { + "code": "440904", + "name": "电白区" + }, + { + "code": "440981", + "name": "高州市" + }, + { + "code": "440982", + "name": "化州市" + }, + { + "code": "440983", + "name": "信宜市" + } + ] + }, + { + "code": "441200", + "name": "肇庆市", + "areaList": [ + { + "code": "441202", + "name": "端州区" + }, + { + "code": "441203", + "name": "鼎湖区" + }, + { + "code": "441204", + "name": "高要区" + }, + { + "code": "441223", + "name": "广宁县" + }, + { + "code": "441224", + "name": "怀集县" + }, + { + "code": "441225", + "name": "封开县" + }, + { + "code": "441226", + "name": "德庆县" + }, + { + "code": "441284", + "name": "四会市" + } + ] + }, + { + "code": "441300", + "name": "惠州市", + "areaList": [ + { + "code": "441302", + "name": "惠城区" + }, + { + "code": "441303", + "name": "惠阳区" + }, + { + "code": "441322", + "name": "博罗县" + }, + { + "code": "441323", + "name": "惠东县" + }, + { + "code": "441324", + "name": "龙门县" + } + ] + }, + { + "code": "441400", + "name": "梅州市", + "areaList": [ + { + "code": "441402", + "name": "梅江区" + }, + { + "code": "441403", + "name": "梅县区" + }, + { + "code": "441422", + "name": "大埔县" + }, + { + "code": "441423", + "name": "丰顺县" + }, + { + "code": "441424", + "name": "五华县" + }, + { + "code": "441426", + "name": "平远县" + }, + { + "code": "441427", + "name": "蕉岭县" + }, + { + "code": "441481", + "name": "兴宁市" + } + ] + }, + { + "code": "441500", + "name": "汕尾市", + "areaList": [ + { + "code": "441502", + "name": "城区" + }, + { + "code": "441521", + "name": "海丰县" + }, + { + "code": "441523", + "name": "陆河县" + }, + { + "code": "441581", + "name": "陆丰市" + } + ] + }, + { + "code": "441600", + "name": "河源市", + "areaList": [ + { + "code": "441602", + "name": "源城区" + }, + { + "code": "441621", + "name": "紫金县" + }, + { + "code": "441622", + "name": "龙川县" + }, + { + "code": "441623", + "name": "连平县" + }, + { + "code": "441624", + "name": "和平县" + }, + { + "code": "441625", + "name": "东源县" + } + ] + }, + { + "code": "441700", + "name": "阳江市", + "areaList": [ + { + "code": "441702", + "name": "江城区" + }, + { + "code": "441704", + "name": "阳东区" + }, + { + "code": "441721", + "name": "阳西县" + }, + { + "code": "441781", + "name": "阳春市" + } + ] + }, + { + "code": "441800", + "name": "清远市", + "areaList": [ + { + "code": "441802", + "name": "清城区" + }, + { + "code": "441803", + "name": "清新区" + }, + { + "code": "441821", + "name": "佛冈县" + }, + { + "code": "441823", + "name": "阳山县" + }, + { + "code": "441825", + "name": "连山壮族瑶族自治县" + }, + { + "code": "441826", + "name": "连南瑶族自治县" + }, + { + "code": "441881", + "name": "英德市" + }, + { + "code": "441882", + "name": "连州市" + } + ] + }, + { + "code": "441900", + "name": "东莞市", + "areaList": [] + }, + { + "code": "442000", + "name": "中山市", + "areaList": [] + }, + { + "code": "445100", + "name": "潮州市", + "areaList": [ + { + "code": "445102", + "name": "湘桥区" + }, + { + "code": "445103", + "name": "潮安区" + }, + { + "code": "445122", + "name": "饶平县" + } + ] + }, + { + "code": "445200", + "name": "揭阳市", + "areaList": [ + { + "code": "445202", + "name": "榕城区" + }, + { + "code": "445203", + "name": "揭东区" + }, + { + "code": "445222", + "name": "揭西县" + }, + { + "code": "445224", + "name": "惠来县" + }, + { + "code": "445281", + "name": "普宁市" + } + ] + }, + { + "code": "445300", + "name": "云浮市", + "areaList": [ + { + "code": "445302", + "name": "云城区" + }, + { + "code": "445303", + "name": "云安区" + }, + { + "code": "445321", + "name": "新兴县" + }, + { + "code": "445322", + "name": "郁南县" + }, + { + "code": "445381", + "name": "罗定市" + } + ] + } + ] + }, + { + "code": "450000", + "name": "广西壮族自治区", + "cityList": [ + { + "code": "450100", + "name": "南宁市", + "areaList": [ + { + "code": "450102", + "name": "兴宁区" + }, + { + "code": "450103", + "name": "青秀区" + }, + { + "code": "450105", + "name": "江南区" + }, + { + "code": "450107", + "name": "西乡塘区" + }, + { + "code": "450108", + "name": "良庆区" + }, + { + "code": "450109", + "name": "邕宁区" + }, + { + "code": "450110", + "name": "武鸣区" + }, + { + "code": "450123", + "name": "隆安县" + }, + { + "code": "450124", + "name": "马山县" + }, + { + "code": "450125", + "name": "上林县" + }, + { + "code": "450126", + "name": "宾阳县" + }, + { + "code": "450127", + "name": "横县" + } + ] + }, + { + "code": "450200", + "name": "柳州市", + "areaList": [ + { + "code": "450202", + "name": "城中区" + }, + { + "code": "450203", + "name": "鱼峰区" + }, + { + "code": "450204", + "name": "柳南区" + }, + { + "code": "450205", + "name": "柳北区" + }, + { + "code": "450206", + "name": "柳江区" + }, + { + "code": "450222", + "name": "柳城县" + }, + { + "code": "450223", + "name": "鹿寨县" + }, + { + "code": "450224", + "name": "融安县" + }, + { + "code": "450225", + "name": "融水苗族自治县" + }, + { + "code": "450226", + "name": "三江侗族自治县" + } + ] + }, + { + "code": "450300", + "name": "桂林市", + "areaList": [ + { + "code": "450302", + "name": "秀峰区" + }, + { + "code": "450303", + "name": "叠彩区" + }, + { + "code": "450304", + "name": "象山区" + }, + { + "code": "450305", + "name": "七星区" + }, + { + "code": "450311", + "name": "雁山区" + }, + { + "code": "450312", + "name": "临桂区" + }, + { + "code": "450321", + "name": "阳朔县" + }, + { + "code": "450323", + "name": "灵川县" + }, + { + "code": "450324", + "name": "全州县" + }, + { + "code": "450325", + "name": "兴安县" + }, + { + "code": "450326", + "name": "永福县" + }, + { + "code": "450327", + "name": "灌阳县" + }, + { + "code": "450328", + "name": "龙胜各族自治县" + }, + { + "code": "450329", + "name": "资源县" + }, + { + "code": "450330", + "name": "平乐县" + }, + { + "code": "450381", + "name": "荔浦市" + }, + { + "code": "450332", + "name": "恭城瑶族自治县" + } + ] + }, + { + "code": "450400", + "name": "梧州市", + "areaList": [ + { + "code": "450403", + "name": "万秀区" + }, + { + "code": "450405", + "name": "长洲区" + }, + { + "code": "450406", + "name": "龙圩区" + }, + { + "code": "450421", + "name": "苍梧县" + }, + { + "code": "450422", + "name": "藤县" + }, + { + "code": "450423", + "name": "蒙山县" + }, + { + "code": "450481", + "name": "岑溪市" + } + ] + }, + { + "code": "450500", + "name": "北海市", + "areaList": [ + { + "code": "450502", + "name": "海城区" + }, + { + "code": "450503", + "name": "银海区" + }, + { + "code": "450512", + "name": "铁山港区" + }, + { + "code": "450521", + "name": "合浦县" + } + ] + }, + { + "code": "450600", + "name": "防城港市", + "areaList": [ + { + "code": "450602", + "name": "港口区" + }, + { + "code": "450603", + "name": "防城区" + }, + { + "code": "450621", + "name": "上思县" + }, + { + "code": "450681", + "name": "东兴市" + } + ] + }, + { + "code": "450700", + "name": "钦州市", + "areaList": [ + { + "code": "450702", + "name": "钦南区" + }, + { + "code": "450703", + "name": "钦北区" + }, + { + "code": "450721", + "name": "灵山县" + }, + { + "code": "450722", + "name": "浦北县" + } + ] + }, + { + "code": "450800", + "name": "贵港市", + "areaList": [ + { + "code": "450802", + "name": "港北区" + }, + { + "code": "450803", + "name": "港南区" + }, + { + "code": "450804", + "name": "覃塘区" + }, + { + "code": "450821", + "name": "平南县" + }, + { + "code": "450881", + "name": "桂平市" + } + ] + }, + { + "code": "450900", + "name": "玉林市", + "areaList": [ + { + "code": "450902", + "name": "玉州区" + }, + { + "code": "450903", + "name": "福绵区" + }, + { + "code": "450921", + "name": "容县" + }, + { + "code": "450922", + "name": "陆川县" + }, + { + "code": "450923", + "name": "博白县" + }, + { + "code": "450924", + "name": "兴业县" + }, + { + "code": "450981", + "name": "北流市" + } + ] + }, + { + "code": "451000", + "name": "百色市", + "areaList": [ + { + "code": "451002", + "name": "右江区" + }, + { + "code": "451003", + "name": "田阳区" + }, + { + "code": "451022", + "name": "田东县" + }, + { + "code": "451024", + "name": "德保县" + }, + { + "code": "451026", + "name": "那坡县" + }, + { + "code": "451027", + "name": "凌云县" + }, + { + "code": "451028", + "name": "乐业县" + }, + { + "code": "451029", + "name": "田林县" + }, + { + "code": "451030", + "name": "西林县" + }, + { + "code": "451031", + "name": "隆林各族自治县" + }, + { + "code": "451081", + "name": "靖西市" + }, + { + "code": "451082", + "name": "平果市" + } + ] + }, + { + "code": "451100", + "name": "贺州市", + "areaList": [ + { + "code": "451102", + "name": "八步区" + }, + { + "code": "451103", + "name": "平桂区" + }, + { + "code": "451121", + "name": "昭平县" + }, + { + "code": "451122", + "name": "钟山县" + }, + { + "code": "451123", + "name": "富川瑶族自治县" + } + ] + }, + { + "code": "451200", + "name": "河池市", + "areaList": [ + { + "code": "451202", + "name": "金城江区" + }, + { + "code": "451203", + "name": "宜州区" + }, + { + "code": "451221", + "name": "南丹县" + }, + { + "code": "451222", + "name": "天峨县" + }, + { + "code": "451223", + "name": "凤山县" + }, + { + "code": "451224", + "name": "东兰县" + }, + { + "code": "451225", + "name": "罗城仫佬族自治县" + }, + { + "code": "451226", + "name": "环江毛南族自治县" + }, + { + "code": "451227", + "name": "巴马瑶族自治县" + }, + { + "code": "451228", + "name": "都安瑶族自治县" + }, + { + "code": "451229", + "name": "大化瑶族自治县" + } + ] + }, + { + "code": "451300", + "name": "来宾市", + "areaList": [ + { + "code": "451302", + "name": "兴宾区" + }, + { + "code": "451321", + "name": "忻城县" + }, + { + "code": "451322", + "name": "象州县" + }, + { + "code": "451323", + "name": "武宣县" + }, + { + "code": "451324", + "name": "金秀瑶族自治县" + }, + { + "code": "451381", + "name": "合山市" + } + ] + }, + { + "code": "451400", + "name": "崇左市", + "areaList": [ + { + "code": "451402", + "name": "江州区" + }, + { + "code": "451421", + "name": "扶绥县" + }, + { + "code": "451422", + "name": "宁明县" + }, + { + "code": "451423", + "name": "龙州县" + }, + { + "code": "451424", + "name": "大新县" + }, + { + "code": "451425", + "name": "天等县" + }, + { + "code": "451481", + "name": "凭祥市" + } + ] + } + ] + }, + { + "code": "460000", + "name": "海南省", + "cityList": [ + { + "code": "460100", + "name": "海口市", + "areaList": [ + { + "code": "460105", + "name": "秀英区" + }, + { + "code": "460106", + "name": "龙华区" + }, + { + "code": "460107", + "name": "琼山区" + }, + { + "code": "460108", + "name": "美兰区" + } + ] + }, + { + "code": "460200", + "name": "三亚市", + "areaList": [ + { + "code": "460202", + "name": "海棠区" + }, + { + "code": "460203", + "name": "吉阳区" + }, + { + "code": "460204", + "name": "天涯区" + }, + { + "code": "460205", + "name": "崖州区" + } + ] + }, + { + "code": "460300", + "name": "三沙市", + "areaList": [] + }, + { + "code": "460400", + "name": "儋州市", + "areaList": [] + }, + { + "code": "469001", + "name": "五指山市", + "areaList": [] + }, + { + "code": "469002", + "name": "琼海市", + "areaList": [] + }, + { + "code": "469005", + "name": "文昌市", + "areaList": [] + }, + { + "code": "469006", + "name": "万宁市", + "areaList": [] + }, + { + "code": "469007", + "name": "东方市", + "areaList": [] + }, + { + "code": "469021", + "name": "定安县", + "areaList": [] + }, + { + "code": "469022", + "name": "屯昌县", + "areaList": [] + }, + { + "code": "469023", + "name": "澄迈县", + "areaList": [] + }, + { + "code": "469024", + "name": "临高县", + "areaList": [] + }, + { + "code": "469025", + "name": "白沙黎族自治县", + "areaList": [] + }, + { + "code": "469026", + "name": "昌江黎族自治县", + "areaList": [] + }, + { + "code": "469027", + "name": "乐东黎族自治县", + "areaList": [] + }, + { + "code": "469028", + "name": "陵水黎族自治县", + "areaList": [] + }, + { + "code": "469029", + "name": "保亭黎族苗族自治县", + "areaList": [] + }, + { + "code": "469030", + "name": "琼中黎族苗族自治县", + "areaList": [] + } + ] + }, + { + "code": "500000", + "name": "重庆市", + "cityList": [ + { + "code": "500000", + "name": "重庆市", + "areaList": [ + { + "code": "500101", + "name": "万州区" + }, + { + "code": "500102", + "name": "涪陵区" + }, + { + "code": "500103", + "name": "渝中区" + }, + { + "code": "500104", + "name": "大渡口区" + }, + { + "code": "500105", + "name": "江北区" + }, + { + "code": "500106", + "name": "沙坪坝区" + }, + { + "code": "500107", + "name": "九龙坡区" + }, + { + "code": "500108", + "name": "南岸区" + }, + { + "code": "500109", + "name": "北碚区" + }, + { + "code": "500110", + "name": "綦江区" + }, + { + "code": "500111", + "name": "大足区" + }, + { + "code": "500112", + "name": "渝北区" + }, + { + "code": "500113", + "name": "巴南区" + }, + { + "code": "500114", + "name": "黔江区" + }, + { + "code": "500115", + "name": "长寿区" + }, + { + "code": "500116", + "name": "江津区" + }, + { + "code": "500117", + "name": "合川区" + }, + { + "code": "500118", + "name": "永川区" + }, + { + "code": "500119", + "name": "南川区" + }, + { + "code": "500120", + "name": "璧山区" + }, + { + "code": "500151", + "name": "铜梁区" + }, + { + "code": "500152", + "name": "潼南区" + }, + { + "code": "500153", + "name": "荣昌区" + }, + { + "code": "500154", + "name": "开州区" + }, + { + "code": "500155", + "name": "梁平区" + }, + { + "code": "500156", + "name": "武隆区" + }, + { + "code": "500229", + "name": "城口县" + }, + { + "code": "500230", + "name": "丰都县" + }, + { + "code": "500231", + "name": "垫江县" + }, + { + "code": "500233", + "name": "忠县" + }, + { + "code": "500235", + "name": "云阳县" + }, + { + "code": "500236", + "name": "奉节县" + }, + { + "code": "500237", + "name": "巫山县" + }, + { + "code": "500238", + "name": "巫溪县" + }, + { + "code": "500240", + "name": "石柱土家族自治县" + }, + { + "code": "500241", + "name": "秀山土家族苗族自治县" + }, + { + "code": "500242", + "name": "酉阳土家族苗族自治县" + }, + { + "code": "500243", + "name": "彭水苗族土家族自治县" + } + ] + } + ] + }, + { + "code": "510000", + "name": "四川省", + "cityList": [ + { + "code": "510100", + "name": "成都市", + "areaList": [ + { + "code": "510104", + "name": "锦江区" + }, + { + "code": "510105", + "name": "青羊区" + }, + { + "code": "510106", + "name": "金牛区" + }, + { + "code": "510107", + "name": "武侯区" + }, + { + "code": "510108", + "name": "成华区" + }, + { + "code": "510112", + "name": "龙泉驿区" + }, + { + "code": "510113", + "name": "青白江区" + }, + { + "code": "510114", + "name": "新都区" + }, + { + "code": "510115", + "name": "温江区" + }, + { + "code": "510116", + "name": "双流区" + }, + { + "code": "510117", + "name": "郫都区" + }, + { + "code": "510121", + "name": "金堂县" + }, + { + "code": "510129", + "name": "大邑县" + }, + { + "code": "510131", + "name": "蒲江县" + }, + { + "code": "510132", + "name": "新津县" + }, + { + "code": "510181", + "name": "都江堰市" + }, + { + "code": "510182", + "name": "彭州市" + }, + { + "code": "510183", + "name": "邛崃市" + }, + { + "code": "510184", + "name": "崇州市" + }, + { + "code": "510185", + "name": "简阳市" + } + ] + }, + { + "code": "510300", + "name": "自贡市", + "areaList": [ + { + "code": "510302", + "name": "自流井区" + }, + { + "code": "510303", + "name": "贡井区" + }, + { + "code": "510304", + "name": "大安区" + }, + { + "code": "510311", + "name": "沿滩区" + }, + { + "code": "510321", + "name": "荣县" + }, + { + "code": "510322", + "name": "富顺县" + } + ] + }, + { + "code": "510400", + "name": "攀枝花市", + "areaList": [ + { + "code": "510402", + "name": "东区" + }, + { + "code": "510403", + "name": "西区" + }, + { + "code": "510411", + "name": "仁和区" + }, + { + "code": "510421", + "name": "米易县" + }, + { + "code": "510422", + "name": "盐边县" + } + ] + }, + { + "code": "510500", + "name": "泸州市", + "areaList": [ + { + "code": "510502", + "name": "江阳区" + }, + { + "code": "510503", + "name": "纳溪区" + }, + { + "code": "510504", + "name": "龙马潭区" + }, + { + "code": "510521", + "name": "泸县" + }, + { + "code": "510522", + "name": "合江县" + }, + { + "code": "510524", + "name": "叙永县" + }, + { + "code": "510525", + "name": "古蔺县" + } + ] + }, + { + "code": "510600", + "name": "德阳市", + "areaList": [ + { + "code": "510603", + "name": "旌阳区" + }, + { + "code": "510604", + "name": "罗江区" + }, + { + "code": "510623", + "name": "中江县" + }, + { + "code": "510681", + "name": "广汉市" + }, + { + "code": "510682", + "name": "什邡市" + }, + { + "code": "510683", + "name": "绵竹市" + } + ] + }, + { + "code": "510700", + "name": "绵阳市", + "areaList": [ + { + "code": "510703", + "name": "涪城区" + }, + { + "code": "510704", + "name": "游仙区" + }, + { + "code": "510705", + "name": "安州区" + }, + { + "code": "510722", + "name": "三台县" + }, + { + "code": "510723", + "name": "盐亭县" + }, + { + "code": "510725", + "name": "梓潼县" + }, + { + "code": "510726", + "name": "北川羌族自治县" + }, + { + "code": "510727", + "name": "平武县" + }, + { + "code": "510781", + "name": "江油市" + } + ] + }, + { + "code": "510800", + "name": "广元市", + "areaList": [ + { + "code": "510802", + "name": "利州区" + }, + { + "code": "510811", + "name": "昭化区" + }, + { + "code": "510812", + "name": "朝天区" + }, + { + "code": "510821", + "name": "旺苍县" + }, + { + "code": "510822", + "name": "青川县" + }, + { + "code": "510823", + "name": "剑阁县" + }, + { + "code": "510824", + "name": "苍溪县" + } + ] + }, + { + "code": "510900", + "name": "遂宁市", + "areaList": [ + { + "code": "510903", + "name": "船山区" + }, + { + "code": "510904", + "name": "安居区" + }, + { + "code": "510921", + "name": "蓬溪县" + }, + { + "code": "510923", + "name": "大英县" + }, + { + "code": "510981", + "name": "射洪市" + } + ] + }, + { + "code": "511000", + "name": "内江市", + "areaList": [ + { + "code": "511002", + "name": "市中区" + }, + { + "code": "511011", + "name": "东兴区" + }, + { + "code": "511024", + "name": "威远县" + }, + { + "code": "511025", + "name": "资中县" + }, + { + "code": "511083", + "name": "隆昌市" + } + ] + }, + { + "code": "511100", + "name": "乐山市", + "areaList": [ + { + "code": "511102", + "name": "市中区" + }, + { + "code": "511111", + "name": "沙湾区" + }, + { + "code": "511112", + "name": "五通桥区" + }, + { + "code": "511113", + "name": "金口河区" + }, + { + "code": "511123", + "name": "犍为县" + }, + { + "code": "511124", + "name": "井研县" + }, + { + "code": "511126", + "name": "夹江县" + }, + { + "code": "511129", + "name": "沐川县" + }, + { + "code": "511132", + "name": "峨边彝族自治县" + }, + { + "code": "511133", + "name": "马边彝族自治县" + }, + { + "code": "511181", + "name": "峨眉山市" + } + ] + }, + { + "code": "511300", + "name": "南充市", + "areaList": [ + { + "code": "511302", + "name": "顺庆区" + }, + { + "code": "511303", + "name": "高坪区" + }, + { + "code": "511304", + "name": "嘉陵区" + }, + { + "code": "511321", + "name": "南部县" + }, + { + "code": "511322", + "name": "营山县" + }, + { + "code": "511323", + "name": "蓬安县" + }, + { + "code": "511324", + "name": "仪陇县" + }, + { + "code": "511325", + "name": "西充县" + }, + { + "code": "511381", + "name": "阆中市" + } + ] + }, + { + "code": "511400", + "name": "眉山市", + "areaList": [ + { + "code": "511402", + "name": "东坡区" + }, + { + "code": "511403", + "name": "彭山区" + }, + { + "code": "511421", + "name": "仁寿县" + }, + { + "code": "511423", + "name": "洪雅县" + }, + { + "code": "511424", + "name": "丹棱县" + }, + { + "code": "511425", + "name": "青神县" + } + ] + }, + { + "code": "511500", + "name": "宜宾市", + "areaList": [ + { + "code": "511502", + "name": "翠屏区" + }, + { + "code": "511503", + "name": "南溪区" + }, + { + "code": "511504", + "name": "叙州区" + }, + { + "code": "511523", + "name": "江安县" + }, + { + "code": "511524", + "name": "长宁县" + }, + { + "code": "511525", + "name": "高县" + }, + { + "code": "511526", + "name": "珙县" + }, + { + "code": "511527", + "name": "筠连县" + }, + { + "code": "511528", + "name": "兴文县" + }, + { + "code": "511529", + "name": "屏山县" + } + ] + }, + { + "code": "511600", + "name": "广安市", + "areaList": [ + { + "code": "511602", + "name": "广安区" + }, + { + "code": "511603", + "name": "前锋区" + }, + { + "code": "511621", + "name": "岳池县" + }, + { + "code": "511622", + "name": "武胜县" + }, + { + "code": "511623", + "name": "邻水县" + }, + { + "code": "511681", + "name": "华蓥市" + } + ] + }, + { + "code": "511700", + "name": "达州市", + "areaList": [ + { + "code": "511702", + "name": "通川区" + }, + { + "code": "511703", + "name": "达川区" + }, + { + "code": "511722", + "name": "宣汉县" + }, + { + "code": "511723", + "name": "开江县" + }, + { + "code": "511724", + "name": "大竹县" + }, + { + "code": "511725", + "name": "渠县" + }, + { + "code": "511781", + "name": "万源市" + } + ] + }, + { + "code": "511800", + "name": "雅安市", + "areaList": [ + { + "code": "511802", + "name": "雨城区" + }, + { + "code": "511803", + "name": "名山区" + }, + { + "code": "511822", + "name": "荥经县" + }, + { + "code": "511823", + "name": "汉源县" + }, + { + "code": "511824", + "name": "石棉县" + }, + { + "code": "511825", + "name": "天全县" + }, + { + "code": "511826", + "name": "芦山县" + }, + { + "code": "511827", + "name": "宝兴县" + } + ] + }, + { + "code": "511900", + "name": "巴中市", + "areaList": [ + { + "code": "511902", + "name": "巴州区" + }, + { + "code": "511903", + "name": "恩阳区" + }, + { + "code": "511921", + "name": "通江县" + }, + { + "code": "511922", + "name": "南江县" + }, + { + "code": "511923", + "name": "平昌县" + } + ] + }, + { + "code": "512000", + "name": "资阳市", + "areaList": [ + { + "code": "512002", + "name": "雁江区" + }, + { + "code": "512021", + "name": "安岳县" + }, + { + "code": "512022", + "name": "乐至县" + } + ] + }, + { + "code": "513200", + "name": "阿坝藏族羌族自治州", + "areaList": [ + { + "code": "513201", + "name": "马尔康市" + }, + { + "code": "513221", + "name": "汶川县" + }, + { + "code": "513222", + "name": "理县" + }, + { + "code": "513223", + "name": "茂县" + }, + { + "code": "513224", + "name": "松潘县" + }, + { + "code": "513225", + "name": "九寨沟县" + }, + { + "code": "513226", + "name": "金川县" + }, + { + "code": "513227", + "name": "小金县" + }, + { + "code": "513228", + "name": "黑水县" + }, + { + "code": "513230", + "name": "壤塘县" + }, + { + "code": "513231", + "name": "阿坝县" + }, + { + "code": "513232", + "name": "若尔盖县" + }, + { + "code": "513233", + "name": "红原县" + } + ] + }, + { + "code": "513300", + "name": "甘孜藏族自治州", + "areaList": [ + { + "code": "513301", + "name": "康定市" + }, + { + "code": "513322", + "name": "泸定县" + }, + { + "code": "513323", + "name": "丹巴县" + }, + { + "code": "513324", + "name": "九龙县" + }, + { + "code": "513325", + "name": "雅江县" + }, + { + "code": "513326", + "name": "道孚县" + }, + { + "code": "513327", + "name": "炉霍县" + }, + { + "code": "513328", + "name": "甘孜县" + }, + { + "code": "513329", + "name": "新龙县" + }, + { + "code": "513330", + "name": "德格县" + }, + { + "code": "513331", + "name": "白玉县" + }, + { + "code": "513332", + "name": "石渠县" + }, + { + "code": "513333", + "name": "色达县" + }, + { + "code": "513334", + "name": "理塘县" + }, + { + "code": "513335", + "name": "巴塘县" + }, + { + "code": "513336", + "name": "乡城县" + }, + { + "code": "513337", + "name": "稻城县" + }, + { + "code": "513338", + "name": "得荣县" + } + ] + }, + { + "code": "513400", + "name": "凉山彝族自治州", + "areaList": [ + { + "code": "513401", + "name": "西昌市" + }, + { + "code": "513422", + "name": "木里藏族自治县" + }, + { + "code": "513423", + "name": "盐源县" + }, + { + "code": "513424", + "name": "德昌县" + }, + { + "code": "513425", + "name": "会理县" + }, + { + "code": "513426", + "name": "会东县" + }, + { + "code": "513427", + "name": "宁南县" + }, + { + "code": "513428", + "name": "普格县" + }, + { + "code": "513429", + "name": "布拖县" + }, + { + "code": "513430", + "name": "金阳县" + }, + { + "code": "513431", + "name": "昭觉县" + }, + { + "code": "513432", + "name": "喜德县" + }, + { + "code": "513433", + "name": "冕宁县" + }, + { + "code": "513434", + "name": "越西县" + }, + { + "code": "513435", + "name": "甘洛县" + }, + { + "code": "513436", + "name": "美姑县" + }, + { + "code": "513437", + "name": "雷波县" + } + ] + } + ] + }, + { + "code": "520000", + "name": "贵州省", + "cityList": [ + { + "code": "520100", + "name": "贵阳市", + "areaList": [ + { + "code": "520102", + "name": "南明区" + }, + { + "code": "520103", + "name": "云岩区" + }, + { + "code": "520111", + "name": "花溪区" + }, + { + "code": "520112", + "name": "乌当区" + }, + { + "code": "520113", + "name": "白云区" + }, + { + "code": "520115", + "name": "观山湖区" + }, + { + "code": "520121", + "name": "开阳县" + }, + { + "code": "520122", + "name": "息烽县" + }, + { + "code": "520123", + "name": "修文县" + }, + { + "code": "520181", + "name": "清镇市" + } + ] + }, + { + "code": "520200", + "name": "六盘水市", + "areaList": [ + { + "code": "520201", + "name": "钟山区" + }, + { + "code": "520203", + "name": "六枝特区" + }, + { + "code": "520221", + "name": "水城县" + }, + { + "code": "520281", + "name": "盘州市" + } + ] + }, + { + "code": "520300", + "name": "遵义市", + "areaList": [ + { + "code": "520302", + "name": "红花岗区" + }, + { + "code": "520303", + "name": "汇川区" + }, + { + "code": "520304", + "name": "播州区" + }, + { + "code": "520322", + "name": "桐梓县" + }, + { + "code": "520323", + "name": "绥阳县" + }, + { + "code": "520324", + "name": "正安县" + }, + { + "code": "520325", + "name": "道真仡佬族苗族自治县" + }, + { + "code": "520326", + "name": "务川仡佬族苗族自治县" + }, + { + "code": "520327", + "name": "凤冈县" + }, + { + "code": "520328", + "name": "湄潭县" + }, + { + "code": "520329", + "name": "余庆县" + }, + { + "code": "520330", + "name": "习水县" + }, + { + "code": "520381", + "name": "赤水市" + }, + { + "code": "520382", + "name": "仁怀市" + } + ] + }, + { + "code": "520400", + "name": "安顺市", + "areaList": [ + { + "code": "520402", + "name": "西秀区" + }, + { + "code": "520403", + "name": "平坝区" + }, + { + "code": "520422", + "name": "普定县" + }, + { + "code": "520423", + "name": "镇宁布依族苗族自治县" + }, + { + "code": "520424", + "name": "关岭布依族苗族自治县" + }, + { + "code": "520425", + "name": "紫云苗族布依族自治县" + } + ] + }, + { + "code": "520500", + "name": "毕节市", + "areaList": [ + { + "code": "520502", + "name": "七星关区" + }, + { + "code": "520521", + "name": "大方县" + }, + { + "code": "520522", + "name": "黔西县" + }, + { + "code": "520523", + "name": "金沙县" + }, + { + "code": "520524", + "name": "织金县" + }, + { + "code": "520525", + "name": "纳雍县" + }, + { + "code": "520526", + "name": "威宁彝族回族苗族自治县" + }, + { + "code": "520527", + "name": "赫章县" + } + ] + }, + { + "code": "520600", + "name": "铜仁市", + "areaList": [ + { + "code": "520602", + "name": "碧江区" + }, + { + "code": "520603", + "name": "万山区" + }, + { + "code": "520621", + "name": "江口县" + }, + { + "code": "520622", + "name": "玉屏侗族自治县" + }, + { + "code": "520623", + "name": "石阡县" + }, + { + "code": "520624", + "name": "思南县" + }, + { + "code": "520625", + "name": "印江土家族苗族自治县" + }, + { + "code": "520626", + "name": "德江县" + }, + { + "code": "520627", + "name": "沿河土家族自治县" + }, + { + "code": "520628", + "name": "松桃苗族自治县" + } + ] + }, + { + "code": "522300", + "name": "黔西南布依族苗族自治州", + "areaList": [ + { + "code": "522301", + "name": "兴义市" + }, + { + "code": "522302", + "name": "兴仁市" + }, + { + "code": "522323", + "name": "普安县" + }, + { + "code": "522324", + "name": "晴隆县" + }, + { + "code": "522325", + "name": "贞丰县" + }, + { + "code": "522326", + "name": "望谟县" + }, + { + "code": "522327", + "name": "册亨县" + }, + { + "code": "522328", + "name": "安龙县" + } + ] + }, + { + "code": "522600", + "name": "黔东南苗族侗族自治州", + "areaList": [ + { + "code": "522601", + "name": "凯里市" + }, + { + "code": "522622", + "name": "黄平县" + }, + { + "code": "522623", + "name": "施秉县" + }, + { + "code": "522624", + "name": "三穗县" + }, + { + "code": "522625", + "name": "镇远县" + }, + { + "code": "522626", + "name": "岑巩县" + }, + { + "code": "522627", + "name": "天柱县" + }, + { + "code": "522628", + "name": "锦屏县" + }, + { + "code": "522629", + "name": "剑河县" + }, + { + "code": "522630", + "name": "台江县" + }, + { + "code": "522631", + "name": "黎平县" + }, + { + "code": "522632", + "name": "榕江县" + }, + { + "code": "522633", + "name": "从江县" + }, + { + "code": "522634", + "name": "雷山县" + }, + { + "code": "522635", + "name": "麻江县" + }, + { + "code": "522636", + "name": "丹寨县" + } + ] + }, + { + "code": "522700", + "name": "黔南布依族苗族自治州", + "areaList": [ + { + "code": "522701", + "name": "都匀市" + }, + { + "code": "522702", + "name": "福泉市" + }, + { + "code": "522722", + "name": "荔波县" + }, + { + "code": "522723", + "name": "贵定县" + }, + { + "code": "522725", + "name": "瓮安县" + }, + { + "code": "522726", + "name": "独山县" + }, + { + "code": "522727", + "name": "平塘县" + }, + { + "code": "522728", + "name": "罗甸县" + }, + { + "code": "522729", + "name": "长顺县" + }, + { + "code": "522730", + "name": "龙里县" + }, + { + "code": "522731", + "name": "惠水县" + }, + { + "code": "522732", + "name": "三都水族自治县" + } + ] + } + ] + }, + { + "code": "530000", + "name": "云南省", + "cityList": [ + { + "code": "530100", + "name": "昆明市", + "areaList": [ + { + "code": "530102", + "name": "五华区" + }, + { + "code": "530103", + "name": "盘龙区" + }, + { + "code": "530111", + "name": "官渡区" + }, + { + "code": "530112", + "name": "西山区" + }, + { + "code": "530113", + "name": "东川区" + }, + { + "code": "530114", + "name": "呈贡区" + }, + { + "code": "530115", + "name": "晋宁区" + }, + { + "code": "530124", + "name": "富民县" + }, + { + "code": "530125", + "name": "宜良县" + }, + { + "code": "530126", + "name": "石林彝族自治县" + }, + { + "code": "530127", + "name": "嵩明县" + }, + { + "code": "530128", + "name": "禄劝彝族苗族自治县" + }, + { + "code": "530129", + "name": "寻甸回族彝族自治县" + }, + { + "code": "530181", + "name": "安宁市" + } + ] + }, + { + "code": "530300", + "name": "曲靖市", + "areaList": [ + { + "code": "530302", + "name": "麒麟区" + }, + { + "code": "530303", + "name": "沾益区" + }, + { + "code": "530304", + "name": "马龙区" + }, + { + "code": "530322", + "name": "陆良县" + }, + { + "code": "530323", + "name": "师宗县" + }, + { + "code": "530324", + "name": "罗平县" + }, + { + "code": "530325", + "name": "富源县" + }, + { + "code": "530326", + "name": "会泽县" + }, + { + "code": "530381", + "name": "宣威市" + } + ] + }, + { + "code": "530400", + "name": "玉溪市", + "areaList": [ + { + "code": "530402", + "name": "红塔区" + }, + { + "code": "530403", + "name": "江川区" + }, + { + "code": "530423", + "name": "通海县" + }, + { + "code": "530424", + "name": "华宁县" + }, + { + "code": "530425", + "name": "易门县" + }, + { + "code": "530426", + "name": "峨山彝族自治县" + }, + { + "code": "530427", + "name": "新平彝族傣族自治县" + }, + { + "code": "530428", + "name": "元江哈尼族彝族傣族自治县" + }, + { + "code": "530481", + "name": "澄江市" + } + ] + }, + { + "code": "530500", + "name": "保山市", + "areaList": [ + { + "code": "530502", + "name": "隆阳区" + }, + { + "code": "530521", + "name": "施甸县" + }, + { + "code": "530523", + "name": "龙陵县" + }, + { + "code": "530524", + "name": "昌宁县" + }, + { + "code": "530581", + "name": "腾冲市" + } + ] + }, + { + "code": "530600", + "name": "昭通市", + "areaList": [ + { + "code": "530602", + "name": "昭阳区" + }, + { + "code": "530621", + "name": "鲁甸县" + }, + { + "code": "530622", + "name": "巧家县" + }, + { + "code": "530623", + "name": "盐津县" + }, + { + "code": "530624", + "name": "大关县" + }, + { + "code": "530625", + "name": "永善县" + }, + { + "code": "530626", + "name": "绥江县" + }, + { + "code": "530627", + "name": "镇雄县" + }, + { + "code": "530628", + "name": "彝良县" + }, + { + "code": "530629", + "name": "威信县" + }, + { + "code": "530681", + "name": "水富市" + } + ] + }, + { + "code": "530700", + "name": "丽江市", + "areaList": [ + { + "code": "530702", + "name": "古城区" + }, + { + "code": "530721", + "name": "玉龙纳西族自治县" + }, + { + "code": "530722", + "name": "永胜县" + }, + { + "code": "530723", + "name": "华坪县" + }, + { + "code": "530724", + "name": "宁蒗彝族自治县" + } + ] + }, + { + "code": "530800", + "name": "普洱市", + "areaList": [ + { + "code": "530802", + "name": "思茅区" + }, + { + "code": "530821", + "name": "宁洱哈尼族彝族自治县" + }, + { + "code": "530822", + "name": "墨江哈尼族自治县" + }, + { + "code": "530823", + "name": "景东彝族自治县" + }, + { + "code": "530824", + "name": "景谷傣族彝族自治县" + }, + { + "code": "530825", + "name": "镇沅彝族哈尼族拉祜族自治县" + }, + { + "code": "530826", + "name": "江城哈尼族彝族自治县" + }, + { + "code": "530827", + "name": "孟连傣族拉祜族佤族自治县" + }, + { + "code": "530828", + "name": "澜沧拉祜族自治县" + }, + { + "code": "530829", + "name": "西盟佤族自治县" + } + ] + }, + { + "code": "530900", + "name": "临沧市", + "areaList": [ + { + "code": "530902", + "name": "临翔区" + }, + { + "code": "530921", + "name": "凤庆县" + }, + { + "code": "530922", + "name": "云县" + }, + { + "code": "530923", + "name": "永德县" + }, + { + "code": "530924", + "name": "镇康县" + }, + { + "code": "530925", + "name": "双江拉祜族佤族布朗族傣族自治县" + }, + { + "code": "530926", + "name": "耿马傣族佤族自治县" + }, + { + "code": "530927", + "name": "沧源佤族自治县" + } + ] + }, + { + "code": "532300", + "name": "楚雄彝族自治州", + "areaList": [ + { + "code": "532301", + "name": "楚雄市" + }, + { + "code": "532322", + "name": "双柏县" + }, + { + "code": "532323", + "name": "牟定县" + }, + { + "code": "532324", + "name": "南华县" + }, + { + "code": "532325", + "name": "姚安县" + }, + { + "code": "532326", + "name": "大姚县" + }, + { + "code": "532327", + "name": "永仁县" + }, + { + "code": "532328", + "name": "元谋县" + }, + { + "code": "532329", + "name": "武定县" + }, + { + "code": "532331", + "name": "禄丰县" + } + ] + }, + { + "code": "532500", + "name": "红河哈尼族彝族自治州", + "areaList": [ + { + "code": "532501", + "name": "个旧市" + }, + { + "code": "532502", + "name": "开远市" + }, + { + "code": "532503", + "name": "蒙自市" + }, + { + "code": "532504", + "name": "弥勒市" + }, + { + "code": "532523", + "name": "屏边苗族自治县" + }, + { + "code": "532524", + "name": "建水县" + }, + { + "code": "532525", + "name": "石屏县" + }, + { + "code": "532527", + "name": "泸西县" + }, + { + "code": "532528", + "name": "元阳县" + }, + { + "code": "532529", + "name": "红河县" + }, + { + "code": "532530", + "name": "金平苗族瑶族傣族自治县" + }, + { + "code": "532531", + "name": "绿春县" + }, + { + "code": "532532", + "name": "河口瑶族自治县" + } + ] + }, + { + "code": "532600", + "name": "文山壮族苗族自治州", + "areaList": [ + { + "code": "532601", + "name": "文山市" + }, + { + "code": "532622", + "name": "砚山县" + }, + { + "code": "532623", + "name": "西畴县" + }, + { + "code": "532624", + "name": "麻栗坡县" + }, + { + "code": "532625", + "name": "马关县" + }, + { + "code": "532626", + "name": "丘北县" + }, + { + "code": "532627", + "name": "广南县" + }, + { + "code": "532628", + "name": "富宁县" + } + ] + }, + { + "code": "532800", + "name": "西双版纳傣族自治州", + "areaList": [ + { + "code": "532801", + "name": "景洪市" + }, + { + "code": "532822", + "name": "勐海县" + }, + { + "code": "532823", + "name": "勐腊县" + } + ] + }, + { + "code": "532900", + "name": "大理白族自治州", + "areaList": [ + { + "code": "532901", + "name": "大理市" + }, + { + "code": "532922", + "name": "漾濞彝族自治县" + }, + { + "code": "532923", + "name": "祥云县" + }, + { + "code": "532924", + "name": "宾川县" + }, + { + "code": "532925", + "name": "弥渡县" + }, + { + "code": "532926", + "name": "南涧彝族自治县" + }, + { + "code": "532927", + "name": "巍山彝族回族自治县" + }, + { + "code": "532928", + "name": "永平县" + }, + { + "code": "532929", + "name": "云龙县" + }, + { + "code": "532930", + "name": "洱源县" + }, + { + "code": "532931", + "name": "剑川县" + }, + { + "code": "532932", + "name": "鹤庆县" + } + ] + }, + { + "code": "533100", + "name": "德宏傣族景颇族自治州", + "areaList": [ + { + "code": "533102", + "name": "瑞丽市" + }, + { + "code": "533103", + "name": "芒市" + }, + { + "code": "533122", + "name": "梁河县" + }, + { + "code": "533123", + "name": "盈江县" + }, + { + "code": "533124", + "name": "陇川县" + } + ] + }, + { + "code": "533300", + "name": "怒江傈僳族自治州", + "areaList": [ + { + "code": "533301", + "name": "泸水市" + }, + { + "code": "533323", + "name": "福贡县" + }, + { + "code": "533324", + "name": "贡山独龙族怒族自治县" + }, + { + "code": "533325", + "name": "兰坪白族普米族自治县" + } + ] + }, + { + "code": "533400", + "name": "迪庆藏族自治州", + "areaList": [ + { + "code": "533401", + "name": "香格里拉市" + }, + { + "code": "533422", + "name": "德钦县" + }, + { + "code": "533423", + "name": "维西傈僳族自治县" + } + ] + } + ] + }, + { + "code": "540000", + "name": "西藏自治区", + "cityList": [ + { + "code": "540100", + "name": "拉萨市", + "areaList": [ + { + "code": "540102", + "name": "城关区" + }, + { + "code": "540103", + "name": "堆龙德庆区" + }, + { + "code": "540104", + "name": "达孜区" + }, + { + "code": "540121", + "name": "林周县" + }, + { + "code": "540122", + "name": "当雄县" + }, + { + "code": "540123", + "name": "尼木县" + }, + { + "code": "540124", + "name": "曲水县" + }, + { + "code": "540127", + "name": "墨竹工卡县" + } + ] + }, + { + "code": "540200", + "name": "日喀则市", + "areaList": [ + { + "code": "540202", + "name": "桑珠孜区" + }, + { + "code": "540221", + "name": "南木林县" + }, + { + "code": "540222", + "name": "江孜县" + }, + { + "code": "540223", + "name": "定日县" + }, + { + "code": "540224", + "name": "萨迦县" + }, + { + "code": "540225", + "name": "拉孜县" + }, + { + "code": "540226", + "name": "昂仁县" + }, + { + "code": "540227", + "name": "谢通门县" + }, + { + "code": "540228", + "name": "白朗县" + }, + { + "code": "540229", + "name": "仁布县" + }, + { + "code": "540230", + "name": "康马县" + }, + { + "code": "540231", + "name": "定结县" + }, + { + "code": "540232", + "name": "仲巴县" + }, + { + "code": "540233", + "name": "亚东县" + }, + { + "code": "540234", + "name": "吉隆县" + }, + { + "code": "540235", + "name": "聂拉木县" + }, + { + "code": "540236", + "name": "萨嘎县" + }, + { + "code": "540237", + "name": "岗巴县" + } + ] + }, + { + "code": "540300", + "name": "昌都市", + "areaList": [ + { + "code": "540302", + "name": "卡若区" + }, + { + "code": "540321", + "name": "江达县" + }, + { + "code": "540322", + "name": "贡觉县" + }, + { + "code": "540323", + "name": "类乌齐县" + }, + { + "code": "540324", + "name": "丁青县" + }, + { + "code": "540325", + "name": "察雅县" + }, + { + "code": "540326", + "name": "八宿县" + }, + { + "code": "540327", + "name": "左贡县" + }, + { + "code": "540328", + "name": "芒康县" + }, + { + "code": "540329", + "name": "洛隆县" + }, + { + "code": "540330", + "name": "边坝县" + } + ] + }, + { + "code": "540400", + "name": "林芝市", + "areaList": [ + { + "code": "540402", + "name": "巴宜区" + }, + { + "code": "540421", + "name": "工布江达县" + }, + { + "code": "540422", + "name": "米林县" + }, + { + "code": "540423", + "name": "墨脱县" + }, + { + "code": "540424", + "name": "波密县" + }, + { + "code": "540425", + "name": "察隅县" + }, + { + "code": "540426", + "name": "朗县" + } + ] + }, + { + "code": "540500", + "name": "山南市", + "areaList": [ + { + "code": "540502", + "name": "乃东区" + }, + { + "code": "540521", + "name": "扎囊县" + }, + { + "code": "540522", + "name": "贡嘎县" + }, + { + "code": "540523", + "name": "桑日县" + }, + { + "code": "540524", + "name": "琼结县" + }, + { + "code": "540525", + "name": "曲松县" + }, + { + "code": "540526", + "name": "措美县" + }, + { + "code": "540527", + "name": "洛扎县" + }, + { + "code": "540528", + "name": "加查县" + }, + { + "code": "540529", + "name": "隆子县" + }, + { + "code": "540530", + "name": "错那县" + }, + { + "code": "540531", + "name": "浪卡子县" + } + ] + }, + { + "code": "540600", + "name": "那曲市", + "areaList": [ + { + "code": "540602", + "name": "色尼区" + }, + { + "code": "540621", + "name": "嘉黎县" + }, + { + "code": "540622", + "name": "比如县" + }, + { + "code": "540623", + "name": "聂荣县" + }, + { + "code": "540624", + "name": "安多县" + }, + { + "code": "540625", + "name": "申扎县" + }, + { + "code": "540626", + "name": "索县" + }, + { + "code": "540627", + "name": "班戈县" + }, + { + "code": "540628", + "name": "巴青县" + }, + { + "code": "540629", + "name": "尼玛县" + }, + { + "code": "540630", + "name": "双湖县" + } + ] + }, + { + "code": "542500", + "name": "阿里地区", + "areaList": [ + { + "code": "542521", + "name": "普兰县" + }, + { + "code": "542522", + "name": "札达县" + }, + { + "code": "542523", + "name": "噶尔县" + }, + { + "code": "542524", + "name": "日土县" + }, + { + "code": "542525", + "name": "革吉县" + }, + { + "code": "542526", + "name": "改则县" + }, + { + "code": "542527", + "name": "措勤县" + } + ] + } + ] + }, + { + "code": "610000", + "name": "陕西省", + "cityList": [ + { + "code": "610100", + "name": "西安市", + "areaList": [ + { + "code": "610102", + "name": "新城区" + }, + { + "code": "610103", + "name": "碑林区" + }, + { + "code": "610104", + "name": "莲湖区" + }, + { + "code": "610111", + "name": "灞桥区" + }, + { + "code": "610112", + "name": "未央区" + }, + { + "code": "610113", + "name": "雁塔区" + }, + { + "code": "610114", + "name": "阎良区" + }, + { + "code": "610115", + "name": "临潼区" + }, + { + "code": "610116", + "name": "长安区" + }, + { + "code": "610117", + "name": "高陵区" + }, + { + "code": "610118", + "name": "鄠邑区" + }, + { + "code": "610122", + "name": "蓝田县" + }, + { + "code": "610124", + "name": "周至县" + } + ] + }, + { + "code": "610200", + "name": "铜川市", + "areaList": [ + { + "code": "610202", + "name": "王益区" + }, + { + "code": "610203", + "name": "印台区" + }, + { + "code": "610204", + "name": "耀州区" + }, + { + "code": "610222", + "name": "宜君县" + } + ] + }, + { + "code": "610300", + "name": "宝鸡市", + "areaList": [ + { + "code": "610302", + "name": "渭滨区" + }, + { + "code": "610303", + "name": "金台区" + }, + { + "code": "610304", + "name": "陈仓区" + }, + { + "code": "610322", + "name": "凤翔县" + }, + { + "code": "610323", + "name": "岐山县" + }, + { + "code": "610324", + "name": "扶风县" + }, + { + "code": "610326", + "name": "眉县" + }, + { + "code": "610327", + "name": "陇县" + }, + { + "code": "610328", + "name": "千阳县" + }, + { + "code": "610329", + "name": "麟游县" + }, + { + "code": "610330", + "name": "凤县" + }, + { + "code": "610331", + "name": "太白县" + } + ] + }, + { + "code": "610400", + "name": "咸阳市", + "areaList": [ + { + "code": "610402", + "name": "秦都区" + }, + { + "code": "610403", + "name": "杨陵区" + }, + { + "code": "610404", + "name": "渭城区" + }, + { + "code": "610422", + "name": "三原县" + }, + { + "code": "610423", + "name": "泾阳县" + }, + { + "code": "610424", + "name": "乾县" + }, + { + "code": "610425", + "name": "礼泉县" + }, + { + "code": "610426", + "name": "永寿县" + }, + { + "code": "610428", + "name": "长武县" + }, + { + "code": "610429", + "name": "旬邑县" + }, + { + "code": "610430", + "name": "淳化县" + }, + { + "code": "610431", + "name": "武功县" + }, + { + "code": "610481", + "name": "兴平市" + }, + { + "code": "610482", + "name": "彬州市" + } + ] + }, + { + "code": "610500", + "name": "渭南市", + "areaList": [ + { + "code": "610502", + "name": "临渭区" + }, + { + "code": "610503", + "name": "华州区" + }, + { + "code": "610522", + "name": "潼关县" + }, + { + "code": "610523", + "name": "大荔县" + }, + { + "code": "610524", + "name": "合阳县" + }, + { + "code": "610525", + "name": "澄城县" + }, + { + "code": "610526", + "name": "蒲城县" + }, + { + "code": "610527", + "name": "白水县" + }, + { + "code": "610528", + "name": "富平县" + }, + { + "code": "610581", + "name": "韩城市" + }, + { + "code": "610582", + "name": "华阴市" + } + ] + }, + { + "code": "610600", + "name": "延安市", + "areaList": [ + { + "code": "610602", + "name": "宝塔区" + }, + { + "code": "610603", + "name": "安塞区" + }, + { + "code": "610621", + "name": "延长县" + }, + { + "code": "610622", + "name": "延川县" + }, + { + "code": "610625", + "name": "志丹县" + }, + { + "code": "610626", + "name": "吴起县" + }, + { + "code": "610627", + "name": "甘泉县" + }, + { + "code": "610628", + "name": "富县" + }, + { + "code": "610629", + "name": "洛川县" + }, + { + "code": "610630", + "name": "宜川县" + }, + { + "code": "610631", + "name": "黄龙县" + }, + { + "code": "610632", + "name": "黄陵县" + }, + { + "code": "610681", + "name": "子长市" + } + ] + }, + { + "code": "610700", + "name": "汉中市", + "areaList": [ + { + "code": "610702", + "name": "汉台区" + }, + { + "code": "610703", + "name": "南郑区" + }, + { + "code": "610722", + "name": "城固县" + }, + { + "code": "610723", + "name": "洋县" + }, + { + "code": "610724", + "name": "西乡县" + }, + { + "code": "610725", + "name": "勉县" + }, + { + "code": "610726", + "name": "宁强县" + }, + { + "code": "610727", + "name": "略阳县" + }, + { + "code": "610728", + "name": "镇巴县" + }, + { + "code": "610729", + "name": "留坝县" + }, + { + "code": "610730", + "name": "佛坪县" + } + ] + }, + { + "code": "610800", + "name": "榆林市", + "areaList": [ + { + "code": "610802", + "name": "榆阳区" + }, + { + "code": "610803", + "name": "横山区" + }, + { + "code": "610822", + "name": "府谷县" + }, + { + "code": "610824", + "name": "靖边县" + }, + { + "code": "610825", + "name": "定边县" + }, + { + "code": "610826", + "name": "绥德县" + }, + { + "code": "610827", + "name": "米脂县" + }, + { + "code": "610828", + "name": "佳县" + }, + { + "code": "610829", + "name": "吴堡县" + }, + { + "code": "610830", + "name": "清涧县" + }, + { + "code": "610831", + "name": "子洲县" + }, + { + "code": "610881", + "name": "神木市" + } + ] + }, + { + "code": "610900", + "name": "安康市", + "areaList": [ + { + "code": "610902", + "name": "汉滨区" + }, + { + "code": "610921", + "name": "汉阴县" + }, + { + "code": "610922", + "name": "石泉县" + }, + { + "code": "610923", + "name": "宁陕县" + }, + { + "code": "610924", + "name": "紫阳县" + }, + { + "code": "610925", + "name": "岚皋县" + }, + { + "code": "610926", + "name": "平利县" + }, + { + "code": "610927", + "name": "镇坪县" + }, + { + "code": "610928", + "name": "旬阳县" + }, + { + "code": "610929", + "name": "白河县" + } + ] + }, + { + "code": "611000", + "name": "商洛市", + "areaList": [ + { + "code": "611002", + "name": "商州区" + }, + { + "code": "611021", + "name": "洛南县" + }, + { + "code": "611022", + "name": "丹凤县" + }, + { + "code": "611023", + "name": "商南县" + }, + { + "code": "611024", + "name": "山阳县" + }, + { + "code": "611025", + "name": "镇安县" + }, + { + "code": "611026", + "name": "柞水县" + } + ] + } + ] + }, + { + "code": "620000", + "name": "甘肃省", + "cityList": [ + { + "code": "620100", + "name": "兰州市", + "areaList": [ + { + "code": "620102", + "name": "城关区" + }, + { + "code": "620103", + "name": "七里河区" + }, + { + "code": "620104", + "name": "西固区" + }, + { + "code": "620105", + "name": "安宁区" + }, + { + "code": "620111", + "name": "红古区" + }, + { + "code": "620121", + "name": "永登县" + }, + { + "code": "620122", + "name": "皋兰县" + }, + { + "code": "620123", + "name": "榆中县" + } + ] + }, + { + "code": "620200", + "name": "嘉峪关市", + "areaList": [] + }, + { + "code": "620300", + "name": "金昌市", + "areaList": [ + { + "code": "620302", + "name": "金川区" + }, + { + "code": "620321", + "name": "永昌县" + } + ] + }, + { + "code": "620400", + "name": "白银市", + "areaList": [ + { + "code": "620402", + "name": "白银区" + }, + { + "code": "620403", + "name": "平川区" + }, + { + "code": "620421", + "name": "靖远县" + }, + { + "code": "620422", + "name": "会宁县" + }, + { + "code": "620423", + "name": "景泰县" + } + ] + }, + { + "code": "620500", + "name": "天水市", + "areaList": [ + { + "code": "620502", + "name": "秦州区" + }, + { + "code": "620503", + "name": "麦积区" + }, + { + "code": "620521", + "name": "清水县" + }, + { + "code": "620522", + "name": "秦安县" + }, + { + "code": "620523", + "name": "甘谷县" + }, + { + "code": "620524", + "name": "武山县" + }, + { + "code": "620525", + "name": "张家川回族自治县" + } + ] + }, + { + "code": "620600", + "name": "武威市", + "areaList": [ + { + "code": "620602", + "name": "凉州区" + }, + { + "code": "620621", + "name": "民勤县" + }, + { + "code": "620622", + "name": "古浪县" + }, + { + "code": "620623", + "name": "天祝藏族自治县" + } + ] + }, + { + "code": "620700", + "name": "张掖市", + "areaList": [ + { + "code": "620702", + "name": "甘州区" + }, + { + "code": "620721", + "name": "肃南裕固族自治县" + }, + { + "code": "620722", + "name": "民乐县" + }, + { + "code": "620723", + "name": "临泽县" + }, + { + "code": "620724", + "name": "高台县" + }, + { + "code": "620725", + "name": "山丹县" + } + ] + }, + { + "code": "620800", + "name": "平凉市", + "areaList": [ + { + "code": "620802", + "name": "崆峒区" + }, + { + "code": "620821", + "name": "泾川县" + }, + { + "code": "620822", + "name": "灵台县" + }, + { + "code": "620823", + "name": "崇信县" + }, + { + "code": "620825", + "name": "庄浪县" + }, + { + "code": "620826", + "name": "静宁县" + }, + { + "code": "620881", + "name": "华亭市" + } + ] + }, + { + "code": "620900", + "name": "酒泉市", + "areaList": [ + { + "code": "620902", + "name": "肃州区" + }, + { + "code": "620921", + "name": "金塔县" + }, + { + "code": "620922", + "name": "瓜州县" + }, + { + "code": "620923", + "name": "肃北蒙古族自治县" + }, + { + "code": "620924", + "name": "阿克塞哈萨克族自治县" + }, + { + "code": "620981", + "name": "玉门市" + }, + { + "code": "620982", + "name": "敦煌市" + } + ] + }, + { + "code": "621000", + "name": "庆阳市", + "areaList": [ + { + "code": "621002", + "name": "西峰区" + }, + { + "code": "621021", + "name": "庆城县" + }, + { + "code": "621022", + "name": "环县" + }, + { + "code": "621023", + "name": "华池县" + }, + { + "code": "621024", + "name": "合水县" + }, + { + "code": "621025", + "name": "正宁县" + }, + { + "code": "621026", + "name": "宁县" + }, + { + "code": "621027", + "name": "镇原县" + } + ] + }, + { + "code": "621100", + "name": "定西市", + "areaList": [ + { + "code": "621102", + "name": "安定区" + }, + { + "code": "621121", + "name": "通渭县" + }, + { + "code": "621122", + "name": "陇西县" + }, + { + "code": "621123", + "name": "渭源县" + }, + { + "code": "621124", + "name": "临洮县" + }, + { + "code": "621125", + "name": "漳县" + }, + { + "code": "621126", + "name": "岷县" + } + ] + }, + { + "code": "621200", + "name": "陇南市", + "areaList": [ + { + "code": "621202", + "name": "武都区" + }, + { + "code": "621221", + "name": "成县" + }, + { + "code": "621222", + "name": "文县" + }, + { + "code": "621223", + "name": "宕昌县" + }, + { + "code": "621224", + "name": "康县" + }, + { + "code": "621225", + "name": "西和县" + }, + { + "code": "621226", + "name": "礼县" + }, + { + "code": "621227", + "name": "徽县" + }, + { + "code": "621228", + "name": "两当县" + } + ] + }, + { + "code": "622900", + "name": "临夏回族自治州", + "areaList": [ + { + "code": "622901", + "name": "临夏市" + }, + { + "code": "622921", + "name": "临夏县" + }, + { + "code": "622922", + "name": "康乐县" + }, + { + "code": "622923", + "name": "永靖县" + }, + { + "code": "622924", + "name": "广河县" + }, + { + "code": "622925", + "name": "和政县" + }, + { + "code": "622926", + "name": "东乡族自治县" + }, + { + "code": "622927", + "name": "积石山保安族东乡族撒拉族自治县" + } + ] + }, + { + "code": "623000", + "name": "甘南藏族自治州", + "areaList": [ + { + "code": "623001", + "name": "合作市" + }, + { + "code": "623021", + "name": "临潭县" + }, + { + "code": "623022", + "name": "卓尼县" + }, + { + "code": "623023", + "name": "舟曲县" + }, + { + "code": "623024", + "name": "迭部县" + }, + { + "code": "623025", + "name": "玛曲县" + }, + { + "code": "623026", + "name": "碌曲县" + }, + { + "code": "623027", + "name": "夏河县" + } + ] + } + ] + }, + { + "code": "630000", + "name": "青海省", + "cityList": [ + { + "code": "630100", + "name": "西宁市", + "areaList": [ + { + "code": "630102", + "name": "城东区" + }, + { + "code": "630103", + "name": "城中区" + }, + { + "code": "630104", + "name": "城西区" + }, + { + "code": "630105", + "name": "城北区" + }, + { + "code": "630106", + "name": "湟中区" + }, + { + "code": "630121", + "name": "大通回族土族自治县" + }, + { + "code": "630123", + "name": "湟源县" + } + ] + }, + { + "code": "630200", + "name": "海东市", + "areaList": [ + { + "code": "630202", + "name": "乐都区" + }, + { + "code": "630203", + "name": "平安区" + }, + { + "code": "630222", + "name": "民和回族土族自治县" + }, + { + "code": "630223", + "name": "互助土族自治县" + }, + { + "code": "630224", + "name": "化隆回族自治县" + }, + { + "code": "630225", + "name": "循化撒拉族自治县" + } + ] + }, + { + "code": "632200", + "name": "海北藏族自治州", + "areaList": [ + { + "code": "632221", + "name": "门源回族自治县" + }, + { + "code": "632222", + "name": "祁连县" + }, + { + "code": "632223", + "name": "海晏县" + }, + { + "code": "632224", + "name": "刚察县" + } + ] + }, + { + "code": "632300", + "name": "黄南藏族自治州", + "areaList": [ + { + "code": "632321", + "name": "同仁县" + }, + { + "code": "632322", + "name": "尖扎县" + }, + { + "code": "632323", + "name": "泽库县" + }, + { + "code": "632324", + "name": "河南蒙古族自治县" + } + ] + }, + { + "code": "632500", + "name": "海南藏族自治州", + "areaList": [ + { + "code": "632521", + "name": "共和县" + }, + { + "code": "632522", + "name": "同德县" + }, + { + "code": "632523", + "name": "贵德县" + }, + { + "code": "632524", + "name": "兴海县" + }, + { + "code": "632525", + "name": "贵南县" + } + ] + }, + { + "code": "632600", + "name": "果洛藏族自治州", + "areaList": [ + { + "code": "632621", + "name": "玛沁县" + }, + { + "code": "632622", + "name": "班玛县" + }, + { + "code": "632623", + "name": "甘德县" + }, + { + "code": "632624", + "name": "达日县" + }, + { + "code": "632625", + "name": "久治县" + }, + { + "code": "632626", + "name": "玛多县" + } + ] + }, + { + "code": "632700", + "name": "玉树藏族自治州", + "areaList": [ + { + "code": "632701", + "name": "玉树市" + }, + { + "code": "632722", + "name": "杂多县" + }, + { + "code": "632723", + "name": "称多县" + }, + { + "code": "632724", + "name": "治多县" + }, + { + "code": "632725", + "name": "囊谦县" + }, + { + "code": "632726", + "name": "曲麻莱县" + } + ] + }, + { + "code": "632800", + "name": "海西蒙古族藏族自治州", + "areaList": [ + { + "code": "632801", + "name": "格尔木市" + }, + { + "code": "632802", + "name": "德令哈市" + }, + { + "code": "632803", + "name": "茫崖市" + }, + { + "code": "632821", + "name": "乌兰县" + }, + { + "code": "632822", + "name": "都兰县" + }, + { + "code": "632823", + "name": "天峻县" + } + ] + } + ] + }, + { + "code": "640000", + "name": "宁夏回族自治区", + "cityList": [ + { + "code": "640100", + "name": "银川市", + "areaList": [ + { + "code": "640104", + "name": "兴庆区" + }, + { + "code": "640105", + "name": "西夏区" + }, + { + "code": "640106", + "name": "金凤区" + }, + { + "code": "640121", + "name": "永宁县" + }, + { + "code": "640122", + "name": "贺兰县" + }, + { + "code": "640181", + "name": "灵武市" + } + ] + }, + { + "code": "640200", + "name": "石嘴山市", + "areaList": [ + { + "code": "640202", + "name": "大武口区" + }, + { + "code": "640205", + "name": "惠农区" + }, + { + "code": "640221", + "name": "平罗县" + } + ] + }, + { + "code": "640300", + "name": "吴忠市", + "areaList": [ + { + "code": "640302", + "name": "利通区" + }, + { + "code": "640303", + "name": "红寺堡区" + }, + { + "code": "640323", + "name": "盐池县" + }, + { + "code": "640324", + "name": "同心县" + }, + { + "code": "640381", + "name": "青铜峡市" + } + ] + }, + { + "code": "640400", + "name": "固原市", + "areaList": [ + { + "code": "640402", + "name": "原州区" + }, + { + "code": "640422", + "name": "西吉县" + }, + { + "code": "640423", + "name": "隆德县" + }, + { + "code": "640424", + "name": "泾源县" + }, + { + "code": "640425", + "name": "彭阳县" + } + ] + }, + { + "code": "640500", + "name": "中卫市", + "areaList": [ + { + "code": "640502", + "name": "沙坡头区" + }, + { + "code": "640521", + "name": "中宁县" + }, + { + "code": "640522", + "name": "海原县" + } + ] + } + ] + }, + { + "code": "650000", + "name": "新疆维吾尔自治区", + "cityList": [ + { + "code": "650100", + "name": "乌鲁木齐市", + "areaList": [ + { + "code": "650102", + "name": "天山区" + }, + { + "code": "650103", + "name": "沙依巴克区" + }, + { + "code": "650104", + "name": "新市区" + }, + { + "code": "650105", + "name": "水磨沟区" + }, + { + "code": "650106", + "name": "头屯河区" + }, + { + "code": "650107", + "name": "达坂城区" + }, + { + "code": "650109", + "name": "米东区" + }, + { + "code": "650121", + "name": "乌鲁木齐县" + } + ] + }, + { + "code": "650200", + "name": "克拉玛依市", + "areaList": [ + { + "code": "650202", + "name": "独山子区" + }, + { + "code": "650203", + "name": "克拉玛依区" + }, + { + "code": "650204", + "name": "白碱滩区" + }, + { + "code": "650205", + "name": "乌尔禾区" + } + ] + }, + { + "code": "650400", + "name": "吐鲁番市", + "areaList": [ + { + "code": "650402", + "name": "高昌区" + }, + { + "code": "650421", + "name": "鄯善县" + }, + { + "code": "650422", + "name": "托克逊县" + } + ] + }, + { + "code": "650500", + "name": "哈密市", + "areaList": [ + { + "code": "650502", + "name": "伊州区" + }, + { + "code": "650521", + "name": "巴里坤哈萨克自治县" + }, + { + "code": "650522", + "name": "伊吾县" + } + ] + }, + { + "code": "652300", + "name": "昌吉回族自治州", + "areaList": [ + { + "code": "652301", + "name": "昌吉市" + }, + { + "code": "652302", + "name": "阜康市" + }, + { + "code": "652323", + "name": "呼图壁县" + }, + { + "code": "652324", + "name": "玛纳斯县" + }, + { + "code": "652325", + "name": "奇台县" + }, + { + "code": "652327", + "name": "吉木萨尔县" + }, + { + "code": "652328", + "name": "木垒哈萨克自治县" + } + ] + }, + { + "code": "652700", + "name": "博尔塔拉蒙古自治州", + "areaList": [ + { + "code": "652701", + "name": "博乐市" + }, + { + "code": "652702", + "name": "阿拉山口市" + }, + { + "code": "652722", + "name": "精河县" + }, + { + "code": "652723", + "name": "温泉县" + } + ] + }, + { + "code": "652800", + "name": "巴音郭楞蒙古自治州", + "areaList": [ + { + "code": "652801", + "name": "库尔勒市" + }, + { + "code": "652822", + "name": "轮台县" + }, + { + "code": "652823", + "name": "尉犁县" + }, + { + "code": "652824", + "name": "若羌县" + }, + { + "code": "652825", + "name": "且末县" + }, + { + "code": "652826", + "name": "焉耆回族自治县" + }, + { + "code": "652827", + "name": "和静县" + }, + { + "code": "652828", + "name": "和硕县" + }, + { + "code": "652829", + "name": "博湖县" + } + ] + }, + { + "code": "652900", + "name": "阿克苏地区", + "areaList": [ + { + "code": "652901", + "name": "阿克苏市" + }, + { + "code": "652902", + "name": "库车市" + }, + { + "code": "652922", + "name": "温宿县" + }, + { + "code": "652924", + "name": "沙雅县" + }, + { + "code": "652925", + "name": "新和县" + }, + { + "code": "652926", + "name": "拜城县" + }, + { + "code": "652927", + "name": "乌什县" + }, + { + "code": "652928", + "name": "阿瓦提县" + }, + { + "code": "652929", + "name": "柯坪县" + } + ] + }, + { + "code": "653000", + "name": "克孜勒苏柯尔克孜自治州", + "areaList": [ + { + "code": "653001", + "name": "阿图什市" + }, + { + "code": "653022", + "name": "阿克陶县" + }, + { + "code": "653023", + "name": "阿合奇县" + }, + { + "code": "653024", + "name": "乌恰县" + } + ] + }, + { + "code": "653100", + "name": "喀什地区", + "areaList": [ + { + "code": "653101", + "name": "喀什市" + }, + { + "code": "653121", + "name": "疏附县" + }, + { + "code": "653122", + "name": "疏勒县" + }, + { + "code": "653123", + "name": "英吉沙县" + }, + { + "code": "653124", + "name": "泽普县" + }, + { + "code": "653125", + "name": "莎车县" + }, + { + "code": "653126", + "name": "叶城县" + }, + { + "code": "653127", + "name": "麦盖提县" + }, + { + "code": "653128", + "name": "岳普湖县" + }, + { + "code": "653129", + "name": "伽师县" + }, + { + "code": "653130", + "name": "巴楚县" + }, + { + "code": "653131", + "name": "塔什库尔干塔吉克自治县" + } + ] + }, + { + "code": "653200", + "name": "和田地区", + "areaList": [ + { + "code": "653201", + "name": "和田市" + }, + { + "code": "653221", + "name": "和田县" + }, + { + "code": "653222", + "name": "墨玉县" + }, + { + "code": "653223", + "name": "皮山县" + }, + { + "code": "653224", + "name": "洛浦县" + }, + { + "code": "653225", + "name": "策勒县" + }, + { + "code": "653226", + "name": "于田县" + }, + { + "code": "653227", + "name": "民丰县" + } + ] + }, + { + "code": "654000", + "name": "伊犁哈萨克自治州", + "areaList": [ + { + "code": "654002", + "name": "伊宁市" + }, + { + "code": "654003", + "name": "奎屯市" + }, + { + "code": "654004", + "name": "霍尔果斯市" + }, + { + "code": "654021", + "name": "伊宁县" + }, + { + "code": "654022", + "name": "察布查尔锡伯自治县" + }, + { + "code": "654023", + "name": "霍城县" + }, + { + "code": "654024", + "name": "巩留县" + }, + { + "code": "654025", + "name": "新源县" + }, + { + "code": "654026", + "name": "昭苏县" + }, + { + "code": "654027", + "name": "特克斯县" + }, + { + "code": "654028", + "name": "尼勒克县" + } + ] + }, + { + "code": "654200", + "name": "塔城地区", + "areaList": [ + { + "code": "654201", + "name": "塔城市" + }, + { + "code": "654202", + "name": "乌苏市" + }, + { + "code": "654221", + "name": "额敏县" + }, + { + "code": "654223", + "name": "沙湾县" + }, + { + "code": "654224", + "name": "托里县" + }, + { + "code": "654225", + "name": "裕民县" + }, + { + "code": "654226", + "name": "和布克赛尔蒙古自治县" + } + ] + }, + { + "code": "654300", + "name": "阿勒泰地区", + "areaList": [ + { + "code": "654301", + "name": "阿勒泰市" + }, + { + "code": "654321", + "name": "布尔津县" + }, + { + "code": "654322", + "name": "富蕴县" + }, + { + "code": "654323", + "name": "福海县" + }, + { + "code": "654324", + "name": "哈巴河县" + }, + { + "code": "654325", + "name": "青河县" + }, + { + "code": "654326", + "name": "吉木乃县" + } + ] + }, + { + "code": "659001", + "name": "石河子市", + "areaList": [] + }, + { + "code": "659002", + "name": "阿拉尔市", + "areaList": [] + }, + { + "code": "659003", + "name": "图木舒克市", + "areaList": [] + }, + { + "code": "659004", + "name": "五家渠市", + "areaList": [] + }, + { + "code": "659005", + "name": "北屯市", + "areaList": [] + }, + { + "code": "659006", + "name": "铁门关市", + "areaList": [] + }, + { + "code": "659007", + "name": "双河市", + "areaList": [] + }, + { + "code": "659008", + "name": "可克达拉市", + "areaList": [] + }, + { + "code": "659009", + "name": "昆玉市", + "areaList": [] + }, + { + "code": "659010", + "name": "胡杨河市", + "areaList": [] + } + ] + }, + { + "code": "710000", + "name": "台湾省", + "cityList": [] + }, + { + "code": "810000", + "name": "香港特别行政区", + "cityList": [] + }, + { + "code": "820000", + "name": "澳门特别行政区", + "cityList": [] + } +] diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.h new file mode 100755 index 0000000..aab271b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.h @@ -0,0 +1,127 @@ +// +// BRAddressPickerView.h +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRBaseView.h" +#import "BRAddressModel.h" + +NS_ASSUME_NONNULL_BEGIN + +/// 地址选择器类型 +typedef NS_ENUM(NSInteger, BRAddressPickerMode) { + /** 显示【省市区】(默认) */ + BRAddressPickerModeArea, + /** 显示【省市】 */ + BRAddressPickerModeCity, + /** 显示【省】 */ + BRAddressPickerModeProvince +}; + +typedef void(^BRAddressResultBlock)(BRProvinceModel * _Nullable province, BRCityModel * _Nullable city, BRAreaModel * _Nullable area); + +@interface BRAddressPickerView : BRBaseView + +/** + ////////////////////////////////////////////////////////////////////////// + /// + /// 【用法一】 + /// 特点:灵活,扩展性强(推荐使用!) + /// + ////////////////////////////////////////////////////////////////////////*/ + +/** 地址选择器显示类型 */ +@property (nonatomic, assign) BRAddressPickerMode pickerMode; + +/** 默认选中的位置(1.传索引数组,如:@[@10, @0, @4]) */ +@property (nullable, nonatomic, copy) NSArray *selectIndexs; +/** 默认选中的位置(2.传值数组,如:@[@"浙江省", @"杭州市", @"西湖区"]) */ +@property (nullable, nonatomic, copy) NSArray *selectValues; + +/** 选择结果的回调 */ +@property (nullable, nonatomic, copy) BRAddressResultBlock resultBlock; + +/** 滚动选择时触发的回调 */ +@property (nullable, nonatomic, copy) BRAddressResultBlock changeBlock; + +/** + * 地区数据源(不传或为nil,默认就获取本地 BRCity.json 文件的数据) + * 1.可以传 JSON数组,要注意 层级结构 和 key 要与 BRCity.json 保持一致 + * 2.可以传 模型数组(NSArray * 类型),自己解析数据源 只需要注意层级结构就行 + */ +@property (nullable, nonatomic, copy) NSArray *dataSourceArr; + +/// 初始化地址选择器 +/// @param pickerMode 地址选择器显示类型 +- (instancetype)initWithPickerMode:(BRAddressPickerMode)pickerMode; + +/// 弹出选择器视图 +- (void)show; + +/// 关闭选择器视图 +- (void)dismiss; + + + + +//================================================= 华丽的分割线 ================================================= + + + + +/** + ////////////////////////////////////////////////////////////////////////// + /// + /// 【用法二】:快捷使用,直接选择下面其中的一个方法进行使用 + /// 特点:快捷,方便 + /// + ////////////////////////////////////////////////////////////////////////*/ + +/** + * 1.显示地址选择器 + * + * @param selectIndexs 默认选中的值(传索引数组,如:@[@10, @0, @4]) + * @param resultBlock 选择后的回调 + * + */ ++ (void)showAddressPickerWithSelectIndexs:(nullable NSArray *)selectIndexs + resultBlock:(nullable BRAddressResultBlock)resultBlock; + +/** + * 2.显示地址选择器 + * + * @param mode 地址选择器显示类型 + * @param selectIndexs 默认选中的值(传索引数组,如:@[@10, @0, @4]) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择后的回调 + * + */ ++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode + selectIndexs:(nullable NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRAddressResultBlock)resultBlock; + +/** + * 3.显示地址选择器 + * + * @param mode 地址选择器显示类型 + * @param dataSource 地区数据源 + * @param selectIndexs 默认选中的值(传索引数组,如:@[@10, @0, @4]) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择后的回调 + * + */ ++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode + dataSource:(nullable NSArray *)dataSource + selectIndexs:(nullable NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRAddressResultBlock)resultBlock; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.m new file mode 100755 index 0000000..f9da612 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.m @@ -0,0 +1,562 @@ +// +// BRAddressPickerView.m +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRAddressPickerView.h" +#import "NSBundle+BRPickerView.h" + +@interface BRAddressPickerView () +// 地址选择器 +@property (nonatomic, strong) UIPickerView *pickerView; +// 省模型数组 +@property(nonatomic, copy) NSArray *provinceModelArr; +// 市模型数组 +@property(nonatomic, copy) NSArray *cityModelArr; +// 区模型数组 +@property(nonatomic, copy) NSArray *areaModelArr; +// 选中的省 +@property(nonatomic, strong) BRProvinceModel *selectProvinceModel; +// 选中的市 +@property(nonatomic, strong) BRCityModel *selectCityModel; +// 选中的区 +@property(nonatomic, strong) BRAreaModel *selectAreaModel; +// 记录省选中的位置 +@property(nonatomic, assign) NSInteger provinceIndex; +// 记录市选中的位置 +@property(nonatomic, assign) NSInteger cityIndex; +// 记录区选中的位置 +@property(nonatomic, assign) NSInteger areaIndex; + +@property (nonatomic, copy) NSArray * mSelectValues; + +@end + +@implementation BRAddressPickerView + +#pragma mark - 1.显示地址选择器 ++ (void)showAddressPickerWithSelectIndexs:(NSArray *)selectIndexs + resultBlock:(BRAddressResultBlock)resultBlock { + [self showAddressPickerWithMode:BRAddressPickerModeArea dataSource:nil selectIndexs:selectIndexs isAutoSelect:NO resultBlock:resultBlock]; +} + +#pragma mark - 2.显示地址选择器 ++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode + selectIndexs:(NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRAddressResultBlock)resultBlock { + [self showAddressPickerWithMode:mode dataSource:nil selectIndexs:selectIndexs isAutoSelect:isAutoSelect resultBlock:resultBlock]; +} + + +#pragma mark - 3.显示地址选择器 ++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode + dataSource:(NSArray *)dataSource + selectIndexs:(NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRAddressResultBlock)resultBlock { + // 创建地址选择器 + BRAddressPickerView *addressPickerView = [[BRAddressPickerView alloc] initWithPickerMode:mode]; + addressPickerView.dataSourceArr = dataSource; + addressPickerView.selectIndexs = selectIndexs; + addressPickerView.isAutoSelect = isAutoSelect; + addressPickerView.resultBlock = resultBlock; + // 显示 + [addressPickerView show]; +} + +#pragma mark - 初始化地址选择器 +- (instancetype)initWithPickerMode:(BRAddressPickerMode)pickerMode { + if (self = [super init]) { + self.pickerMode = pickerMode; + } + return self; +} + +#pragma mark - 处理选择器数据 +- (void)handlerPickerData { + if (self.dataSourceArr && self.dataSourceArr.count > 0) { + id item = [self.dataSourceArr firstObject]; + // 如果传的值是解析好的模型数组 + if ([item isKindOfClass:[BRProvinceModel class]]) { + self.provinceModelArr = self.dataSourceArr; + } else { + self.provinceModelArr = [self getProvinceModelArr:self.dataSourceArr]; + } + } else { + // 如果外部没有传入地区数据源,就使用本地的数据源 + NSArray *dataSource = [self br_addressJsonArray]; + + if (!dataSource || dataSource.count == 0) { + return; + } + self.dataSourceArr = dataSource; + self.provinceModelArr = [self getProvinceModelArr:self.dataSourceArr]; + } + + // 设置默认值 + [self handlerDefaultSelectValue]; +} + +#pragma mark - 获取城市JSON数据 +- (NSArray *)br_addressJsonArray { + static NSArray *cityArray = nil; + if (!cityArray) { + // 获取 BRAddressPickerView.bundle + NSBundle *containnerBundle = [NSBundle bundleForClass:[BRAddressPickerView class]]; + NSString *bundlePath = [containnerBundle pathForResource:@"BRAddressPickerView" ofType:@"bundle"]; + NSBundle *addressPickerBundle = [NSBundle bundleWithPath:bundlePath]; + + // 获取bundle中的JSON文件 + NSString *filePath = [addressPickerBundle pathForResource:@"BRCity" ofType:@"json"]; + NSData *data = [NSData dataWithContentsOfFile:filePath]; + cityArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil]; + } + return cityArray; +} + +#pragma mark - 获取模型数组 +- (NSArray *)getProvinceModelArr:(NSArray *)dataSourceArr { + NSMutableArray *tempArr1 = [NSMutableArray array]; + for (NSDictionary *proviceDic in dataSourceArr) { + BRProvinceModel *proviceModel = [[BRProvinceModel alloc]init]; + proviceModel.code = [proviceDic objectForKey:@"code"]; + proviceModel.name = [proviceDic objectForKey:@"name"]; + proviceModel.index = [dataSourceArr indexOfObject:proviceDic]; + NSArray *cityList = [proviceDic.allKeys containsObject:@"cityList"] ? [proviceDic objectForKey:@"cityList"] : [proviceDic objectForKey:@"citylist"]; + NSMutableArray *tempArr2 = [NSMutableArray array]; + for (NSDictionary *cityDic in cityList) { + BRCityModel *cityModel = [[BRCityModel alloc]init]; + cityModel.code = [cityDic objectForKey:@"code"]; + cityModel.name = [cityDic objectForKey:@"name"]; + cityModel.index = [cityList indexOfObject:cityDic]; + NSArray *areaList = [cityDic.allKeys containsObject:@"areaList"] ? [cityDic objectForKey:@"areaList"] : [cityDic objectForKey:@"arealist"]; + NSMutableArray *tempArr3 = [NSMutableArray array]; + for (NSDictionary *areaDic in areaList) { + BRAreaModel *areaModel = [[BRAreaModel alloc]init]; + areaModel.code = [areaDic objectForKey:@"code"]; + areaModel.name = [areaDic objectForKey:@"name"]; + areaModel.index = [areaList indexOfObject:areaDic]; + [tempArr3 addObject:areaModel]; + } + cityModel.arealist = [tempArr3 copy]; + [tempArr2 addObject:cityModel]; + } + proviceModel.citylist = [tempArr2 copy]; + [tempArr1 addObject:proviceModel]; + } + return [tempArr1 copy]; +} + +#pragma mark - 设置默认选择的值 +- (void)handlerDefaultSelectValue { + __block NSString *selectProvinceName = nil; + __block NSString *selectCityName = nil; + __block NSString *selectAreaName = nil; + + if (self.mSelectValues.count > 0) { + selectProvinceName = self.mSelectValues.count > 0 ? self.mSelectValues[0] : nil; + selectCityName = self.mSelectValues.count > 1 ? self.mSelectValues[1] : nil; + selectAreaName = self.mSelectValues.count > 2 ? self.mSelectValues[2] : nil; + } + + __weak typeof(self) weakSelf = self; + + if (self.pickerMode == BRAddressPickerModeProvince || self.pickerMode == BRAddressPickerModeCity || self.pickerMode == BRAddressPickerModeArea) { + if (self.selectIndexs.count > 0) { + NSInteger provinceIndex = [self.selectIndexs[0] integerValue]; + self.provinceIndex = (provinceIndex > 0 && provinceIndex < self.provinceModelArr.count) ? provinceIndex : 0; + self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil; + } else { + self.provinceIndex = 0; + self.selectProvinceModel = self.provinceModelArr.count > 0 ? self.provinceModelArr[0] : nil; + [self.provinceModelArr enumerateObjectsUsingBlock:^(BRProvinceModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) { + if (selectProvinceName && [model.name isEqualToString:selectProvinceName]) { + weakSelf.provinceIndex = idx; + weakSelf.selectProvinceModel = model; + *stop = YES; + } + }]; + } + } + + if (self.pickerMode == BRAddressPickerModeCity || self.pickerMode == BRAddressPickerModeArea) { + self.cityModelArr = [self getCityModelArray:self.provinceIndex]; + if (self.selectIndexs.count > 0) { + NSInteger cityIndex = self.selectIndexs.count > 1 ? [self.selectIndexs[1] integerValue] : 0; + self.cityIndex = (cityIndex > 0 && cityIndex < self.cityModelArr.count) ? cityIndex : 0; + self.selectCityModel = self.cityModelArr.count > self.cityIndex ? self.cityModelArr[self.cityIndex] : nil; + } else { + self.cityIndex = 0; + self.selectCityModel = self.cityModelArr.count > 0 ? self.cityModelArr[0] : nil; + [self.cityModelArr enumerateObjectsUsingBlock:^(BRCityModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) { + if (selectCityName && [model.name isEqualToString:selectCityName]) { + weakSelf.cityIndex = idx; + weakSelf.selectCityModel = model; + *stop = YES; + } + }]; + } + } + + if (self.pickerMode == BRAddressPickerModeArea) { + self.areaModelArr = [self getAreaModelArray:self.provinceIndex cityIndex:self.cityIndex]; + if (self.selectIndexs.count > 0) { + NSInteger areaIndex = self.selectIndexs.count > 2 ? [self.selectIndexs[2] integerValue] : 0; + self.areaIndex = (areaIndex > 0 && areaIndex < self.areaModelArr.count) ? areaIndex : 0; + self.selectAreaModel = self.areaModelArr.count > self.areaIndex ? self.areaModelArr[self.areaIndex] : nil; + } else { + self.areaIndex = 0; + self.selectAreaModel = self.areaModelArr.count > 0 ? self.areaModelArr[0] : nil; + [self.areaModelArr enumerateObjectsUsingBlock:^(BRAreaModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) { + if (selectAreaName && [model.name isEqualToString:selectAreaName]) { + weakSelf.areaIndex = idx; + weakSelf.selectAreaModel = model; + *stop = YES; + } + }]; + } + } +} + +// 根据 省索引 获取 城市模型数组 +- (NSArray *)getCityModelArray:(NSInteger)provinceIndex { + BRProvinceModel *provinceModel = self.provinceModelArr[provinceIndex]; + // 返回城市模型数组 + return provinceModel.citylist; +} + +// 根据 省索引和城市索引 获取 区域模型数组 +- (NSArray *)getAreaModelArray:(NSInteger)provinceIndex cityIndex:(NSInteger)cityIndex { + BRProvinceModel *provinceModel = self.provinceModelArr[provinceIndex]; + if (provinceModel.citylist && provinceModel.citylist.count > 0) { + BRCityModel *cityModel = provinceModel.citylist[cityIndex]; + // 返回地区模型数组 + return cityModel.arealist; + } else { + return nil; + } +} + +#pragma mark - 地址选择器 +- (UIPickerView *)pickerView { + if (!_pickerView) { + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)]; + _pickerView.backgroundColor = self.pickerStyle.pickerColor; + _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + _pickerView.dataSource = self; + _pickerView.delegate = self; + } + return _pickerView; +} + +#pragma mark - UIPickerViewDataSource +// 1.设置 pickerView 的列数 +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { + switch (self.pickerMode) { + case BRAddressPickerModeProvince: + return 1; + break; + case BRAddressPickerModeCity: + return 2; + break; + case BRAddressPickerModeArea: + return 3; + break; + + default: + break; + } +} + +// 2.设置 pickerView 每列的行数 +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + if (component == 0) { + // 返回省个数 + return self.provinceModelArr.count; + } + if (component == 1) { + // 返回市个数 + return self.cityModelArr.count; + } + if (component == 2) { + // 返回区个数 + return self.areaModelArr.count; + } + return 0; +} + +#pragma mark - UIPickerViewDelegate +// 3.设置 pickerView 的显示内容 +- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view { + // 1.自定义 row 的内容视图 + UILabel *label = (UILabel *)view; + if (!label) { + label = [[UILabel alloc]init]; + label.backgroundColor = [UIColor clearColor]; + label.textAlignment = NSTextAlignmentCenter; + label.font = self.pickerStyle.pickerTextFont; + label.textColor = self.pickerStyle.pickerTextColor; + // 字体自适应属性 + label.adjustsFontSizeToFitWidth = YES; + // 自适应最小字体缩放比例 + label.minimumScaleFactor = 0.5f; + } + if (component == 0) { + BRProvinceModel *model = self.provinceModelArr[row]; + label.text = model.name; + } else if (component == 1) { + BRCityModel *model = self.cityModelArr[row]; + label.text = model.name; + } else if (component == 2) { + BRAreaModel *model = self.areaModelArr[row]; + label.text = model.name; + } + + // 2.设置选择器中间选中行的样式 + [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component]; + + return label; +} + +// 4.滚动 pickerView 执行的回调方法 +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + if (component == 0) { // 选择省 + // 保存选择的省份的索引 + self.provinceIndex = row; + switch (self.pickerMode) { + case BRAddressPickerModeProvince: + { + self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil; + self.selectCityModel = nil; + self.selectAreaModel = nil; + } + break; + case BRAddressPickerModeCity: + { + self.cityModelArr = [self getCityModelArray:self.provinceIndex]; + [self.pickerView reloadComponent:1]; + [self.pickerView selectRow:0 inComponent:1 animated:YES]; + self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil; + self.selectCityModel = self.cityModelArr.count > 0 ? self.cityModelArr[0] : nil; + self.selectAreaModel = nil; + } + break; + case BRAddressPickerModeArea: + { + self.cityModelArr = [self getCityModelArray:self.provinceIndex]; + self.areaModelArr = [self getAreaModelArray:self.provinceIndex cityIndex:0]; + [self.pickerView reloadComponent:1]; + [self.pickerView selectRow:0 inComponent:1 animated:YES]; + [self.pickerView reloadComponent:2]; + [self.pickerView selectRow:0 inComponent:2 animated:YES]; + self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil; + self.selectCityModel = self.cityModelArr.count > 0 ? self.cityModelArr[0] : nil; + self.selectAreaModel = self.areaModelArr.count > 0 ? self.areaModelArr[0] : nil; + } + break; + default: + break; + } + } + if (component == 1) { // 选择市 + // 保存选择的城市的索引 + self.cityIndex = row; + switch (self.pickerMode) { + case BRAddressPickerModeCity: + { + self.selectCityModel = self.cityModelArr.count > self.cityIndex ? self.cityModelArr[self.cityIndex] : nil; + self.selectAreaModel = nil; + } + break; + case BRAddressPickerModeArea: + { + self.areaModelArr = [self getAreaModelArray:self.provinceIndex cityIndex:self.cityIndex]; + [self.pickerView reloadComponent:2]; + [self.pickerView selectRow:0 inComponent:2 animated:YES]; + self.selectCityModel = self.cityModelArr.count > self.cityIndex ? self.cityModelArr[self.cityIndex] : nil; + self.selectAreaModel = self.areaModelArr.count > 0 ? self.areaModelArr[0] : nil; + } + break; + default: + break; + } + } + if (component == 2) { // 选择区 + // 保存选择的地区的索引 + self.areaIndex = row; + if (self.pickerMode == BRAddressPickerModeArea) { + self.selectAreaModel = self.areaModelArr.count > self.areaIndex ? self.areaModelArr[self.areaIndex] : nil; + } + } + + // 滚动选择时执行 changeBlock + if (self.changeBlock) { + self.changeBlock(self.selectProvinceModel, self.selectCityModel, self.selectAreaModel); + } + + // 设置自动选择时,滚动选择时就执行 resultBlock + if (self.isAutoSelect) { + if (self.resultBlock) { + self.resultBlock(self.selectProvinceModel, self.selectCityModel, self.selectAreaModel); + } + } +} + +// 设置行高 +- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { + return self.pickerStyle.rowHeight; +} + +#pragma mark - 重写父类方法 +- (void)reloadData { + // 1.处理数据源 + [self handlerPickerData]; + // 2.刷新选择器 + [self.pickerView reloadAllComponents]; + // 3.滚动到选择的地区 + if (self.pickerMode == BRAddressPickerModeProvince) { + [self.pickerView selectRow:self.provinceIndex inComponent:0 animated:YES]; + } else if (self.pickerMode == BRAddressPickerModeCity) { + [self.pickerView selectRow:self.provinceIndex inComponent:0 animated:YES]; + [self.pickerView selectRow:self.cityIndex inComponent:1 animated:YES]; + } else if (self.pickerMode == BRAddressPickerModeArea) { + [self.pickerView selectRow:self.provinceIndex inComponent:0 animated:YES]; + [self.pickerView selectRow:self.cityIndex inComponent:1 animated:YES]; + [self.pickerView selectRow:self.areaIndex inComponent:2 animated:YES]; + } +} + +- (void)addPickerToView:(UIView *)view { + // 1.添加地址选择器 + if (view) { + // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示) + [view setNeedsLayout]; + [view layoutIfNeeded]; + + self.frame = view.bounds; + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0; + self.pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight); + [self addSubview:self.pickerView]; + } else { + // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题) + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + self.pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight); + + [self.alertView addSubview:self.pickerView]; + } + + // ③添加中间选择行的两条分割线 + if (self.pickerStyle.clearPickerNewStyle) { + [self.pickerStyle addSeparatorLineView:self.pickerView]; + } + + // 2.绑定数据 + [self reloadData]; + + __weak typeof(self) weakSelf = self; + self.doneBlock = ^{ + // 点击确定按钮后,执行block回调 + if (weakSelf.resultBlock) { + weakSelf.resultBlock(weakSelf.selectProvinceModel, weakSelf.selectCityModel, weakSelf.selectAreaModel); + } + }; + + [super addPickerToView:view]; +} + +#pragma mark - 重写父类方法 +- (void)addSubViewToPicker:(UIView *)customView { + [self.pickerView addSubview:customView]; +} + +#pragma mark - 弹出选择器视图 +- (void)show { + [self addPickerToView:nil]; +} + +#pragma mark - 关闭选择器视图 +- (void)dismiss { + [self removePickerFromView:nil]; +} + +#pragma mark - setter方法 +- (void)setSelectValues:(NSArray *)selectValues { + self.mSelectValues = selectValues; +} + +#pragma mark - getter方法 +- (NSArray *)provinceModelArr { + if (!_provinceModelArr) { + _provinceModelArr = [NSArray array]; + } + return _provinceModelArr; +} + +- (NSArray *)cityModelArr { + if (!_cityModelArr) { + _cityModelArr = [NSArray array]; + } + return _cityModelArr; +} + +- (NSArray *)areaModelArr { + if (!_areaModelArr) { + _areaModelArr = [NSArray array]; + } + return _areaModelArr; +} + +- (BRProvinceModel *)selectProvinceModel { + if (!_selectProvinceModel) { + _selectProvinceModel = [[BRProvinceModel alloc]init]; + } + return _selectProvinceModel; +} + +- (BRCityModel *)selectCityModel { + if (!_selectCityModel) { + _selectCityModel = [[BRCityModel alloc]init]; + _selectCityModel.code = @""; + _selectCityModel.name = @""; + } + return _selectCityModel; +} + +- (BRAreaModel *)selectAreaModel { + if (!_selectAreaModel) { + _selectAreaModel = [[BRAreaModel alloc]init]; + _selectAreaModel.code = @""; + _selectAreaModel.name = @""; + } + return _selectAreaModel; +} + +- (NSArray *)dataSourceArr { + if (!_dataSourceArr) { + _dataSourceArr = [NSArray array]; + } + return _dataSourceArr; +} + +- (NSArray *)mSelectValues { + if (!_mSelectValues) { + _mSelectValues = [NSArray array]; + } + return _mSelectValues; +} + +- (NSArray *)selectIndexs { + if (!_selectIndexs) { + _selectIndexs = [NSArray array]; + } + return _selectIndexs; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/BRPickerView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/BRPickerView.h new file mode 100755 index 0000000..118f605 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/BRPickerView.h @@ -0,0 +1,17 @@ +// +// BRPickerView.h +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#ifndef BRPickerView_h +#define BRPickerView_h + +#import "BRDatePickerView.h" +#import "BRAddressPickerView.h" +#import "BRStringPickerView.h" + +#endif /* BRPickerView_h */ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRBaseView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRBaseView.h new file mode 100644 index 0000000..6c47162 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRBaseView.h @@ -0,0 +1,76 @@ +// +// BaseView.h +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import +#import "BRPickerStyle.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^BRCancelBlock)(void); +typedef void(^BRDoneClickBlock)(void); + +@interface BRBaseView : UIView + +/** 选择器标题 */ +@property (nullable, nonatomic, copy) NSString *title; + +/** 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO */ +@property (nonatomic, assign) BOOL isAutoSelect; + +/** 自定义UI样式(不传或为nil时,是默认样式) */ +@property (nullable, nonatomic, strong) BRPickerStyle *pickerStyle; + +/** 取消选择的回调 */ +@property (nullable, nonatomic, copy) BRCancelBlock cancelBlock; + +/** accessory view for above picker view. default is nil */ +@property (nullable, nonatomic, strong) UIView *pickerHeaderView; + +/** accessory view below picker view. default is nil */ +@property (nullable, nonatomic, strong) UIView *pickerFooterView; + +/// 确定按钮点击事件的回调 +/// 应用场景:如果是自定义确定按钮,需要在该按钮点击事件方法里,执行一下 doneBlock 回调。目的是触发组件内部执行 resultBlock 回调,回调选择的值 +@property (nullable, nonatomic, copy) BRDoneClickBlock doneBlock; + +/** 弹框视图(使用场景:可以在 alertView 上添加选择器的自定义背景视图) */ +@property (nullable, nonatomic, strong) UIView *alertView; + +/** 组件的父视图:可以传 自己获取的 keyWindow,或页面的 view */ +@property (nullable, nonatomic, strong) UIView *keyView; + + +/// 刷新选择器数据 +/// 应用场景:动态更新数据源、动态更新选择的值、选择器类型切换等 +- (void)reloadData; + +/// 扩展一:添加选择器到指定容器视图上 +/// 应用场景:可将中间的滚轮选择器 pickerView 视图(不包含蒙层及标题栏)添加到任何自定义视图上(会自动填满容器视图),也方便自定义更多的弹框样式 +/// 补充说明:如果是自定义确定按钮,需要回调默认选择的值:只需在自定义确定按钮的点击事件方法里执行一下 doneBlock 回调(目的是去触发组件内部执行 resultBlock 回调,进而回调默认选择的值) +/// @param view 容器视图 +- (void)addPickerToView:(nullable UIView *)view NS_REQUIRES_SUPER; + +/// 从指定容器视图上移除选择器 +/// @param view 容器视图 +- (void)removePickerFromView:(nullable UIView *)view; + +/// 扩展二:添加自定义视图到选择器(pickerView)上 +/// 应用场景:可以添加一些固定的标题、单位等到选择器中间 +/// @param customView 自定义视图 +- (void)addSubViewToPicker:(UIView *)customView; + +/// 扩展三:添加自定义视图到标题栏(titleBarView)上 +/// 应用场景:可以添加一些子控件到标题栏 +/// @param customView 自定义视图 +- (void)addSubViewToTitleBar:(UIView *)customView; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRBaseView.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRBaseView.m new file mode 100644 index 0000000..5ffa09d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRBaseView.m @@ -0,0 +1,398 @@ +// +// BaseView.m +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRBaseView.h" + +@interface BRBaseView () +// 蒙层视图 +@property (nonatomic, strong) UIView *maskView; +// 标题栏背景视图 +@property (nonatomic, strong) UIView *titleBarView; +// 左边取消按钮 +@property (nonatomic, strong) UIButton *cancelBtn; +// 右边确定按钮 +@property (nonatomic, strong) UIButton *doneBtn; +// 中间标题 +@property (nonatomic, strong) UILabel *titleLabel; + +// 取消按钮离屏幕边缘的距离 +@property (nonatomic, assign) CGFloat cancelBtnMargin; +// 确定按钮离屏幕边缘的距离 +@property (nonatomic, assign) CGFloat doneBtnMargin; + +@end + +@implementation BRBaseView + +- (void)initUI { + self.frame = self.keyView.bounds; + // 设置子视图的宽度随着父视图变化 + self.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + + if (!self.pickerStyle.hiddenMaskView) { + [self addSubview:self.maskView]; + } + + [self addSubview:self.alertView]; + + // 是否隐藏标题栏 + if (!self.pickerStyle.hiddenTitleBarView) { + [self.alertView addSubview:self.titleBarView]; + [self.alertView sendSubviewToBack:self.titleBarView]; + + if (!self.pickerStyle.hiddenTitleLabel) { + [self.titleBarView addSubview:self.titleLabel]; + } + if (!self.pickerStyle.hiddenCancelBtn) { + [self.titleBarView addSubview:self.cancelBtn]; + // 获取边距 + if (self.pickerStyle.cancelBtnFrame.origin.x < self.bounds.size.width / 2) { + self.cancelBtnMargin = self.pickerStyle.cancelBtnFrame.origin.x; + } else { + self.cancelBtnMargin = self.bounds.size.width - self.pickerStyle.cancelBtnFrame.origin.x - self.pickerStyle.cancelBtnFrame.size.width; + } + } + if (!self.pickerStyle.hiddenDoneBtn) { + [self.titleBarView addSubview:self.doneBtn]; + // 获取边距 + if (self.pickerStyle.doneBtnFrame.origin.x < self.bounds.size.width / 2) { + self.doneBtnMargin = self.pickerStyle.doneBtnFrame.origin.x; + } else { + self.doneBtnMargin = self.bounds.size.width - self.pickerStyle.doneBtnFrame.origin.x - self.pickerStyle.doneBtnFrame.size.width; + } + } + } +} + +#pragma mark - 适配横屏安全区域,更新子视图布局 +- (void)layoutSubviews { + [super layoutSubviews]; + if (_cancelBtn || _doneBtn) { + if (@available(iOS 11.0, *)) { + UIEdgeInsets safeInsets = self.safeAreaInsets; + if (_cancelBtn) { + CGRect cancelBtnFrame = self.pickerStyle.cancelBtnFrame; + if (cancelBtnFrame.origin.x < MIN(self.bounds.size.width / 2, self.bounds.size.height / 2)) { + cancelBtnFrame.origin.x += safeInsets.left; + } else { + cancelBtnFrame.origin.x = self.bounds.size.width - cancelBtnFrame.size.width - safeInsets.right - self.cancelBtnMargin; + } + self.cancelBtn.frame = cancelBtnFrame; + } + if (_doneBtn) { + CGRect doneBtnFrame = self.pickerStyle.doneBtnFrame; + if (doneBtnFrame.origin.x < MIN(self.bounds.size.width / 2, self.bounds.size.height / 2)) { + doneBtnFrame.origin.x += safeInsets.left; + } else { + doneBtnFrame.origin.x = self.bounds.size.width - doneBtnFrame.size.width - safeInsets.right - self.doneBtnMargin; + } + self.doneBtn.frame = doneBtnFrame; + } + } + } + + if (_alertView && self.pickerStyle.topCornerRadius > 0) { + // 设置顶部圆角 + [BRPickerStyle br_setView:_alertView roundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight withRadius:self.pickerStyle.topCornerRadius]; + } +} + +#pragma mark - 蒙层视图 +- (UIView *)maskView { + if (!_maskView) { + _maskView = [[UIView alloc]initWithFrame:self.keyView.bounds]; + _maskView.backgroundColor = self.pickerStyle.maskColor; + // 设置子视图的大小随着父视图变化 + _maskView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + _maskView.userInteractionEnabled = YES; + UITapGestureRecognizer *myTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(didTapMaskView:)]; + [_maskView addGestureRecognizer:myTap]; + } + return _maskView; +} + +#pragma mark - 弹框视图 +- (UIView *)alertView { + if (!_alertView) { + CGFloat accessoryViewHeight = 0; + if (self.pickerHeaderView) { + accessoryViewHeight += self.pickerHeaderView.bounds.size.height; + } + if (self.pickerFooterView) { + accessoryViewHeight += self.pickerFooterView.bounds.size.height; + } + CGFloat height = self.pickerStyle.titleBarHeight + self.pickerStyle.pickerHeight + self.pickerStyle.paddingBottom + accessoryViewHeight; + _alertView = [[UIView alloc]initWithFrame:CGRectMake(0, self.keyView.bounds.size.height - height, self.keyView.bounds.size.width, height)]; + _alertView.backgroundColor = self.pickerStyle.alertViewColor ? self.pickerStyle.alertViewColor : self.pickerStyle.pickerColor; + if (!self.pickerStyle.topCornerRadius && !self.pickerStyle.hiddenShadowLine) { + // 设置弹框视图顶部边框线 + UIView *shadowLineView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _alertView.frame.size.width, self.pickerStyle.shadowLineHeight)]; + shadowLineView.backgroundColor = self.pickerStyle.shadowLineColor; + shadowLineView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [_alertView addSubview:shadowLineView]; + } + _alertView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + } + return _alertView; +} + +#pragma mark - 标题栏视图 +- (UIView *)titleBarView { + if (!_titleBarView) { + _titleBarView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.keyView.bounds.size.width, self.pickerStyle.titleBarHeight)]; + _titleBarView.backgroundColor = self.pickerStyle.titleBarColor; + _titleBarView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + if (!self.pickerStyle.hiddenTitleLine) { + // 设置标题栏底部分割线 + UIView *titleLineView = [[UIView alloc]initWithFrame:CGRectMake(0, _titleBarView.frame.size.height - 0.5f, _titleBarView.frame.size.width, 0.5f)]; + titleLineView.backgroundColor = self.pickerStyle.titleLineColor; + titleLineView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [_titleBarView addSubview:titleLineView]; + } + } + return _titleBarView; +} + +#pragma mark - 取消按钮 +- (UIButton *)cancelBtn { + if (!_cancelBtn) { + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + _cancelBtn.frame = self.pickerStyle.cancelBtnFrame; + _cancelBtn.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin; + _cancelBtn.backgroundColor = self.pickerStyle.cancelColor;; + _cancelBtn.titleLabel.font = self.pickerStyle.cancelTextFont; + [_cancelBtn setTitleColor:self.pickerStyle.cancelTextColor forState:UIControlStateNormal]; + if (self.pickerStyle.cancelBtnImage) { + [_cancelBtn setImage:self.pickerStyle.cancelBtnImage forState:UIControlStateNormal]; + } + if (self.pickerStyle.cancelBtnTitle) { + [_cancelBtn setTitle:self.pickerStyle.cancelBtnTitle forState:UIControlStateNormal]; + } + [_cancelBtn addTarget:self action:@selector(clickCancelBtn) forControlEvents:UIControlEventTouchUpInside]; + // 设置按钮圆角或边框 + if (self.pickerStyle.cancelBorderStyle == BRBorderStyleSolid) { + _cancelBtn.layer.cornerRadius = self.pickerStyle.cancelCornerRadius > 0 ? self.pickerStyle.cancelCornerRadius : 6.0f; + _cancelBtn.layer.borderColor = self.pickerStyle.cancelTextColor.CGColor; + _cancelBtn.layer.borderWidth = self.pickerStyle.cancelBorderWidth > 0 ? self.pickerStyle.cancelBorderWidth : 1.0f; + _cancelBtn.layer.masksToBounds = YES; + } else if (self.pickerStyle.cancelBorderStyle == BRBorderStyleFill) { + _cancelBtn.layer.cornerRadius = self.pickerStyle.cancelCornerRadius > 0 ? self.pickerStyle.cancelCornerRadius : 6.0f; + _cancelBtn.layer.masksToBounds = YES; + } + } + return _cancelBtn; +} + +#pragma mark - 确定按钮 +- (UIButton *)doneBtn { + if (!_doneBtn) { + _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + _doneBtn.frame = self.pickerStyle.doneBtnFrame; + _doneBtn.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin; + _doneBtn.backgroundColor = self.pickerStyle.doneColor; + if (self.pickerStyle.doneBtnImage) { + [_doneBtn setImage:self.pickerStyle.doneBtnImage forState:UIControlStateNormal]; + } + if (self.pickerStyle.doneBtnTitle) { + _doneBtn.titleLabel.font = self.pickerStyle.doneTextFont; + [_doneBtn setTitleColor:self.pickerStyle.doneTextColor forState:UIControlStateNormal]; + [_doneBtn setTitle:self.pickerStyle.doneBtnTitle forState:UIControlStateNormal]; + } + [_doneBtn addTarget:self action:@selector(clickDoneBtn) forControlEvents:UIControlEventTouchUpInside]; + // 设置按钮圆角或边框 + if (self.pickerStyle.doneBorderStyle == BRBorderStyleSolid) { + _doneBtn.layer.cornerRadius = self.pickerStyle.doneCornerRadius > 0 ? self.pickerStyle.doneCornerRadius : 6.0f; + _doneBtn.layer.borderColor = self.pickerStyle.doneTextColor.CGColor; + _doneBtn.layer.borderWidth = self.pickerStyle.doneBorderWidth > 0 ? self.pickerStyle.doneBorderWidth : 1.0f; + _doneBtn.layer.masksToBounds = YES; + } else if (self.pickerStyle.doneBorderStyle == BRBorderStyleFill) { + _doneBtn.layer.cornerRadius = self.pickerStyle.doneCornerRadius > 0 ? self.pickerStyle.doneCornerRadius : 6.0f; + _doneBtn.layer.masksToBounds = YES; + } + } + return _doneBtn; +} + +#pragma mark - 中间标题label +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc]initWithFrame:self.pickerStyle.titleLabelFrame]; + _titleLabel.backgroundColor = self.pickerStyle.titleLabelColor; + _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.font = self.pickerStyle.titleTextFont; + _titleLabel.textColor = self.pickerStyle.titleTextColor; + _titleLabel.text = self.title; + } + return _titleLabel; +} + +#pragma mark - 点击蒙层视图事件 +- (void)didTapMaskView:(UITapGestureRecognizer *)sender { + [self removePickerFromView:nil]; + if (self.cancelBlock) { + self.cancelBlock(); + } +} + +#pragma mark - 取消按钮的点击事件 +- (void)clickCancelBtn { + [self removePickerFromView:nil]; + if (self.cancelBlock) { + self.cancelBlock(); + } +} + +#pragma mark - 确定按钮的点击事件 +- (void)clickDoneBtn { + [self removePickerFromView:nil]; + if (self.doneBlock) { + self.doneBlock(); + } +} + +#pragma mark - 添加视图方法 +- (void)addPickerToView:(UIView *)view { + if (view) { + self.frame = view.bounds; + self.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + + CGFloat accessoryViewHeight = 0; + if (self.pickerHeaderView) { + CGRect rect = self.pickerHeaderView.frame; + self.pickerHeaderView.frame = CGRectMake(0, 0, view.bounds.size.width, rect.size.height); + self.pickerHeaderView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [self addSubview:self.pickerHeaderView]; + + accessoryViewHeight += self.pickerHeaderView.bounds.size.height; + } + if (self.pickerFooterView) { + CGRect rect = self.pickerFooterView.frame; + self.pickerFooterView.frame = CGRectMake(0, view.bounds.size.height - rect.size.height, view.bounds.size.width, rect.size.height); + self.pickerFooterView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [self addSubview:self.pickerFooterView]; + + accessoryViewHeight += self.pickerFooterView.bounds.size.height; + } + + [view addSubview:self]; + } else { + [self initUI]; + + if (self.pickerHeaderView) { + CGRect rect = self.pickerHeaderView.frame; + CGFloat titleBarHeight = self.pickerStyle.hiddenTitleBarView ? 0 : self.pickerStyle.titleBarHeight; + self.pickerHeaderView.frame = CGRectMake(0, titleBarHeight, self.alertView.bounds.size.width, rect.size.height); + self.pickerHeaderView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [self.alertView addSubview:self.pickerHeaderView]; + } + if (self.pickerFooterView) { + CGRect rect = self.pickerFooterView.frame; + self.pickerFooterView.frame = CGRectMake(0, self.alertView.bounds.size.height - self.pickerStyle.paddingBottom - rect.size.height, self.alertView.bounds.size.width, rect.size.height); + self.pickerFooterView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [self.alertView addSubview:self.pickerFooterView]; + } + + [self.keyView addSubview:self]; + + // iOS16:重新设置 alertView 高度(解决懒加载设置frame不生效问题) + CGFloat accessoryViewHeight = 0; + if (self.pickerHeaderView) { + accessoryViewHeight += self.pickerHeaderView.bounds.size.height; + } + if (self.pickerFooterView) { + accessoryViewHeight += self.pickerFooterView.bounds.size.height; + } + CGFloat height = self.pickerStyle.titleBarHeight + self.pickerStyle.pickerHeight + self.pickerStyle.paddingBottom + accessoryViewHeight; + self.alertView.frame = CGRectMake(0, self.keyView.bounds.size.height - height, self.keyView.bounds.size.width, height); + + // 动画前初始位置 + CGRect rect = self.alertView.frame; + rect.origin.y = self.bounds.size.height; + self.alertView.frame = rect; + // 弹出动画 + if (!self.pickerStyle.hiddenMaskView) { + self.maskView.alpha = 0; + } + [UIView animateWithDuration:0.3f animations:^{ + if (!self.pickerStyle.hiddenMaskView) { + self.maskView.alpha = 1; + } + CGFloat alertViewHeight = self.alertView.bounds.size.height; + CGRect rect = self.alertView.frame; + rect.origin.y -= alertViewHeight; + self.alertView.frame = rect; + }]; + } +} + +#pragma mark - 移除视图方法 +- (void)removePickerFromView:(UIView *)view { + if (view) { + [self removeFromSuperview]; + } else { + // 关闭动画 + [UIView animateWithDuration:0.2f animations:^{ + CGFloat alertViewHeight = self.alertView.bounds.size.height; + CGRect rect = self.alertView.frame; + rect.origin.y += alertViewHeight; + self.alertView.frame = rect; + if (!self.pickerStyle.hiddenMaskView) { + self.maskView.alpha = 0; + } + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; + } +} + +#pragma mark - 刷新选择器数据 +- (void)reloadData { + +} + +#pragma mark - 添加自定义视图到选择器(picker)上 +- (void)addSubViewToPicker:(UIView *)customView { + +} + +#pragma mark - 添加自定义视图到标题栏(titleBar)上 +- (void)addSubViewToTitleBar:(UIView *)customView { + if (!self.pickerStyle.hiddenTitleBarView) { + [self.titleBarView addSubview:customView]; + } +} + +- (BRPickerStyle *)pickerStyle { + if (!_pickerStyle) { + _pickerStyle = [[BRPickerStyle alloc]init]; + } + return _pickerStyle; +} + +- (UIView *)keyView { + if (!_keyView) { + _keyView = BRGetKeyWindow(); + } + return _keyView; +} + +#pragma mark - setter 方法(支持动态设置标题) +- (void)setTitle:(NSString *)title { + _title = title; + if (_titleLabel) { + _titleLabel.text = title; + } +} + +- (void)dealloc { + NSLog(@"%@ dealloc", NSStringFromClass([self class])); +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerStyle.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerStyle.h new file mode 100644 index 0000000..c57bb3d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerStyle.h @@ -0,0 +1,251 @@ +// +// BRPickerStyle.h +// BRPickerViewDemo +// +// Created by renbo on 2019/10/2. +// Copyright © 2019 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import +#import +#import "BRPickerViewMacro.h" + +NS_ASSUME_NONNULL_BEGIN + +// 边框样式(左边取消按钮/右边确定按钮) +typedef NS_ENUM(NSInteger, BRBorderStyle) { + /** 无边框(默认) */ + BRBorderStyleNone = 0, + /** 有圆角和边框 */ + BRBorderStyleSolid, + /** 仅有圆角 */ + BRBorderStyleFill +}; + +@interface BRPickerStyle : NSObject + + +/////////////////////////////// 蒙层视图(maskView)/////////////////////////////// + +/** 设置背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *maskColor; + +/** 隐藏 maskView,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenMaskView; + + +////////////////////////////// 弹框视图(alertView)/////////////////////////////// + +/** 设置 alertView 弹框视图的背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *alertViewColor; + +/** 设置 alertView 弹框视图左上和右上的圆角半径 */ +@property (nonatomic, assign) NSInteger topCornerRadius; + +/** 设置 alertView 弹框视图顶部边框线颜色 */ +@property (nullable, nonatomic, strong) UIColor *shadowLineColor; + +/** 设置 alertView 弹框视图顶部边框线高度 */ +@property (nonatomic, assign) CGFloat shadowLineHeight; + +/** 隐藏 alertView 弹框视图顶部边框线,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenShadowLine; + +/** 设置 alertView 弹框视图底部内边距,默认为安全区域底部距屏幕底部的高度 */ +@property (nonatomic, assign) CGFloat paddingBottom; + + +//////////////////////////// 标题栏视图(titleBarView) //////////////////////////// + +/** 设置 titleBarView 标题栏的背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *titleBarColor; + +/** 设置 titleBarView 标题栏的高度 */ +@property (nonatomic, assign) CGFloat titleBarHeight; + +/** 设置 titleBarView 标题栏底部分割线颜色 */ +@property (nullable, nonatomic, strong) UIColor *titleLineColor; + +/** 隐藏 titleBarView 标题栏底部分割线,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenTitleLine; + +/** 隐藏 titleBarView,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenTitleBarView; + + +////////////////////////// 标题栏中间label(titleLabel)/////////////////////////// + +/** 设置 titleLabel 的背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *titleLabelColor; + +/** 设置 titleLabel 文本颜色 */ +@property (nullable, nonatomic, strong) UIColor *titleTextColor; + +/** 设置 titleLabel 字体大小 */ +@property (nullable, nonatomic, strong) UIFont *titleTextFont; + +/** 设置 titleLabel 的 frame */ +@property (nonatomic, assign) CGRect titleLabelFrame; + +/** 隐藏 titleLabel,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenTitleLabel; + + +/////////////////////////////// 取消按钮(cancelBtn)////////////////////////////// + +/** 设置 cancelBtn 的背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *cancelColor; + +/** 设置 cancelBtn 标题的颜色 */ +@property (nullable, nonatomic, strong) UIColor *cancelTextColor; + +/** 设置 cancelBtn 标题的字体 */ +@property (nullable, nonatomic, strong) UIFont *cancelTextFont; + +/** 设置 cancelBtn 的 frame */ +@property (nonatomic, assign) CGRect cancelBtnFrame; + +/** 设置 cancelBtn 的边框样式 */ +@property (nonatomic, assign) BRBorderStyle cancelBorderStyle; + +/** 设置 cancelBtn 的圆角大小 */ +@property (nonatomic, assign) CGFloat cancelCornerRadius; + +/** 设置 cancelBtn 的边框宽度 */ +@property (nonatomic, assign) CGFloat cancelBorderWidth; + +/** 设置 cancelBtn 的 image */ +@property (nullable, nonatomic, strong) UIImage *cancelBtnImage; + +/** 设置 cancelBtn 的 title */ +@property (nullable, nonatomic, copy) NSString *cancelBtnTitle; + +/** 隐藏 cancelBtn,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenCancelBtn; + + +/////////////////////////////// 确定按钮(doneBtn)//////////////////////////////// + +/** 设置 doneBtn 的背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *doneColor; + +/** 设置 doneBtn 标题的颜色 */ +@property (nullable, nonatomic, strong) UIColor *doneTextColor; + +/** 设置 doneBtn 标题的字体 */ +@property (nullable, nonatomic, strong) UIFont *doneTextFont; + +/** 设置 doneBtn 的 frame */ +@property (nonatomic, assign) CGRect doneBtnFrame; + +/** 设置 doneBtn 的边框样式 */ +@property (nonatomic, assign) BRBorderStyle doneBorderStyle; + +/** 设置 doneBtn 的圆角大小 */ +@property (nonatomic, assign) CGFloat doneCornerRadius; + +/** 设置 doneBtn 的边框宽度 */ +@property (nonatomic, assign) CGFloat doneBorderWidth; + +/** 设置 doneBtn 的 image */ +@property (nullable, nonatomic, strong) UIImage *doneBtnImage; + +/** 设置 doneBtn 的 title */ +@property (nullable, nonatomic, copy) NSString *doneBtnTitle; + +/** 隐藏 doneBtn,默认为 NO */ +@property (nonatomic, assign) BOOL hiddenDoneBtn; + + +/////////////////////////////// 选择器(pickerView)/////////////////////////////// + +/** 设置 picker 的背景颜色 */ +@property (nullable, nonatomic, strong) UIColor *pickerColor; + +/** 设置 picker 中间两条分割线的背景颜色。暂不支持日期选择器前4种类型 */ +@property (nullable, nonatomic, strong) UIColor *separatorColor; + +/** 设置 picker 中间两条分割线的高度。暂不支持日期选择器前4种类型 */ +@property (nonatomic, assign) CGFloat separatorHeight; + +/** 设置 picker 文本的颜色。暂不支持日期选择器前4种类型 */ +@property (nullable, nonatomic, strong) UIColor *pickerTextColor; + +/** 设置 picker 文本的字体。暂不支持日期选择器前4种类型 */ +@property (nullable, nonatomic, strong) UIFont *pickerTextFont; + +/** 设置 picker 中间选中行的背景颜色。暂不支持日期选择器前4种类型 */ +@property (nullable, nonatomic, strong) UIColor *selectRowColor; + +/** 设置 picker 中间选中行文本的颜色。暂不支持日期选择器前4种类型 */ +@property (nullable, nonatomic, strong) UIColor *selectRowTextColor; + +/** 设置 picker 中间选中行文本的字体。暂不支持日期选择器前4种类型 */ +@property (nullable, nonatomic, strong) UIFont *selectRowTextFont; + +/** 设置 picker 的高度,系统默认高度为 216 */ +@property (nonatomic, assign) CGFloat pickerHeight; + +/** 设置 picker 的行高。暂不支持日期选择器前4种类型 */ +@property (nonatomic, assign) CGFloat rowHeight; + +/** + * 清除iOS14之后选择器默认自带的新样式。暂不支持日期选择器前4种类型 + * 主要是:①隐藏中间选择行的背景样式,②清除默认的内边距,③新增中间选择行的两条分割线;与iOS14之前的样式保持一致),默认为 YES + */ +@property (nonatomic, assign) BOOL clearPickerNewStyle; + + +/** + * 设置语言(不设置或为nil时,将随系统的语言自动改变) + * language: zh-Hans(简体中文)、zh-Hant(繁体中文)、en(英语 ) + */ +@property(nullable, nonatomic, copy) NSString *language; + + +/////// 日期选择器单位样式(showUnitType == BRShowUnitTypeOnlyCenter 时生效。暂不支持日期选择器前4种类型 )/////// + +/** 设置日期选择器单位文本的颜色 */ +@property (nullable, nonatomic, strong) UIColor *dateUnitTextColor; + +/** 设置日期选择器单位文本的字体 */ +@property (nullable, nonatomic, strong) UIFont *dateUnitTextFont; + +/** 设置日期选择器单位 label 的水平方向偏移量 */ +@property (nonatomic, assign) CGFloat dateUnitOffsetX; + +/** 设置日期选择器单位 label 的竖直方向偏移量 */ +@property (nonatomic, assign) CGFloat dateUnitOffsetY; + + +//////////////////////////////// 常用的几种模板样式 //////////////////////////////// + +/// 弹框模板样式1 - 取消/确定按钮圆角样式 +/// @param themeColor 主题颜色 ++ (instancetype)pickerStyleWithThemeColor:(nullable UIColor *)themeColor; + +/// 弹框模板样式2 - 顶部圆角样式 + 完成按钮 +/// @param doneTextColor 完成按钮标题的颜色 ++ (instancetype)pickerStyleWithDoneTextColor:(nullable UIColor *)doneTextColor; + +/// 弹框模板样式3 - 顶部圆角样式 + 图标按钮 +/// @param doneBtnImage 完成按钮的 image ++ (instancetype)pickerStyleWithDoneBtnImage:(nullable UIImage *)doneBtnImage; + + +//////////////////////////////// 以下是组件内部使用的几个封装方法 //////////////////////////////// + +/** 设置选择器中间选中行的样式 */ +- (void)setupPickerSelectRowStyle:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; + +/** 添加选择器中间行上下两条分割线(iOS14之后系统默认去掉,需要手动添加)*/ +- (void)addSeparatorLineView:(UIView *)pickerView; + +/** 设置 view 的部分圆角 */ +// corners(枚举类型,可组合使用):UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners ++ (void)br_setView:(UIView *)view roundingCorners:(UIRectCorner)corners withRadius:(CGFloat)radius; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerStyle.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerStyle.m new file mode 100644 index 0000000..fa8600c --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerStyle.m @@ -0,0 +1,494 @@ +// +// BRPickerStyle.m +// BRPickerViewDemo +// +// Created by renbo on 2019/10/2. +// Copyright © 2019 irenb. All dones reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRPickerStyle.h" +#import "NSBundle+BRPickerView.h" + +// 标题颜色 +#define kBRDefaultTextColor BR_RGB_HEX(0x333333, 1.0f) + +@implementation BRPickerStyle + +- (instancetype)init { + if (self = [super init]) { + self.clearPickerNewStyle = YES; + } + return self; +} + +/// 设置默认样式 + +- (UIColor *)maskColor { + if (!_maskColor) { + _maskColor = [self br_colorWithLightColor:BR_RGB_HEX(0x000000, 0.3f) darkColor:BR_RGB_HEX(0x666666, 0.3f)]; + } + return _maskColor; +} + +- (UIColor *)shadowLineColor { + if (!_shadowLineColor) { + if (@available(iOS 13.0, *)) { + // 边框线颜色,有透明度 + _shadowLineColor = [UIColor separatorColor]; + } else { + _shadowLineColor = BR_RGB_HEX(0xc6c6c8, 1.0f); + } + } + return _shadowLineColor; +} + +- (CGFloat)shadowLineHeight { + if (_shadowLineHeight <= 0 || _shadowLineHeight > 5.0f) { + _shadowLineHeight = 0.5f; + } + return _shadowLineHeight; +} + +- (CGFloat)paddingBottom { + if (_paddingBottom <= 0) { + _paddingBottom = BR_BOTTOM_MARGIN; + } + return _paddingBottom; +} + +- (UIColor *)titleBarColor { + if (!_titleBarColor) { + if (@available(iOS 13.0, *)) { + // #ffffff(正常)、#1c1c1e(深色) + _titleBarColor = [UIColor secondarySystemGroupedBackgroundColor]; + } else { + _titleBarColor = [UIColor whiteColor]; + } + } + return _titleBarColor; +} + +- (CGFloat)titleBarHeight { + if (!self.hiddenTitleBarView) { + if (_titleBarHeight < 44.0f && (!self.hiddenCancelBtn || !self.hiddenDoneBtn || !self.hiddenTitleLabel)) { + _titleBarHeight = 44.0f; + } + } else { + _titleBarHeight = 0; + } + return _titleBarHeight; +} + +- (UIColor *)titleLineColor { + if (!_titleLineColor) { + _titleLineColor = [self br_colorWithLightColor:BR_RGB_HEX(0xededee, 1.0f) darkColor:BR_RGB_HEX(0x18181c, 1.0f)]; + } + return _titleLineColor; +} + +- (UIColor *)cancelColor { + if (!_cancelColor) { + _cancelColor = [UIColor clearColor]; + } + return _cancelColor; +} + +- (UIColor *)cancelTextColor { + if (!_cancelTextColor) { + if (@available(iOS 13.0, *)) { + _cancelTextColor = [UIColor labelColor]; + } else { + _cancelTextColor = kBRDefaultTextColor; + } + } + return _cancelTextColor; +} + +- (UIFont *)cancelTextFont { + if (!_cancelTextFont) { + _cancelTextFont = [UIFont systemFontOfSize:16.0f]; + } + return _cancelTextFont; +} + +- (NSString *)cancelBtnTitle { + if (!_cancelBtnTitle && !_cancelBtnImage) { + _cancelBtnTitle = [NSBundle br_localizedStringForKey:@"取消" language:self.language]; + } + return _cancelBtnTitle; +} + +- (CGRect)cancelBtnFrame { + if (CGRectEqualToRect(_cancelBtnFrame, CGRectZero) || _cancelBtnFrame.size.height == 0) { + _cancelBtnFrame = CGRectMake(5, 8, 60, 28); + } + return _cancelBtnFrame; +} + +- (UIColor *)titleLabelColor { + if (!_titleLabelColor) { + _titleLabelColor = [UIColor clearColor]; + } + return _titleLabelColor; +} + +- (UIColor *)titleTextColor { + if (!_titleTextColor) { + if (@available(iOS 13.0, *)) { + _titleTextColor = [UIColor secondaryLabelColor]; + } else { + _titleTextColor = BR_RGB_HEX(0x999999, 1.0f); + } + } + return _titleTextColor; +} + +- (UIFont *)titleTextFont { + if (!_titleTextFont) { + _titleTextFont = [UIFont systemFontOfSize:15.0f]; + } + return _titleTextFont; +} + +- (CGRect)titleLabelFrame { + if (CGRectEqualToRect(_titleLabelFrame, CGRectZero) || _titleLabelFrame.size.height == 0) { + _titleLabelFrame = CGRectMake(5 + 60 + 2, 0, BRGetKeyWindow().bounds.size.width - 2 * (5 + 60 + 2), 44); + } + return _titleLabelFrame; +} + +- (UIColor *)doneColor { + if (!_doneColor) { + _doneColor = [UIColor clearColor]; + } + return _doneColor; +} + +- (UIColor *)doneTextColor { + if (!_doneTextColor) { + if (@available(iOS 13.0, *)) { + _doneTextColor = [UIColor labelColor]; + } else { + _doneTextColor = kBRDefaultTextColor; + } + } + return _doneTextColor; +} + +- (UIFont *)doneTextFont { + if (!_doneTextFont) { + _doneTextFont = [UIFont systemFontOfSize:16.0f]; + } + return _doneTextFont; +} + +- (NSString *)doneBtnTitle { + if (!_doneBtnTitle && !_doneBtnImage) { + _doneBtnTitle = [NSBundle br_localizedStringForKey:@"确定" language:self.language]; + } + return _doneBtnTitle; +} + +- (CGRect)doneBtnFrame { + if (CGRectEqualToRect(_doneBtnFrame, CGRectZero) || _doneBtnFrame.size.height == 0) { + _doneBtnFrame = CGRectMake(BRGetKeyWindow().bounds.size.width - 60 - 5, 8, 60, 28); + } + return _doneBtnFrame; +} + +- (UIColor *)pickerColor { + if (!_pickerColor) { + if (@available(iOS 13.0, *)) { + // #ffffff(正常)、#1c1c1e(深色) + _pickerColor = [UIColor secondarySystemGroupedBackgroundColor]; + } else { + _pickerColor = [UIColor whiteColor]; + } + } + return _pickerColor; +} + +- (UIColor *)separatorColor { + if (!_separatorColor) { + if (@available(iOS 13.0, *)) { + // 分割线颜色,无透明度 + _separatorColor = [UIColor opaqueSeparatorColor]; + } else { + _separatorColor = BR_RGB_HEX(0xc6c6c8, 1.0f); + } + } + return _separatorColor; +} + +- (UIColor *)pickerTextColor { + if (!_pickerTextColor) { + if (@available(iOS 13.0, *)) { + _pickerTextColor = [UIColor labelColor]; + } else { + _pickerTextColor = kBRDefaultTextColor; + } + } + return _pickerTextColor; +} + +- (UIFont *)pickerTextFont { + if (!_pickerTextFont) { + _pickerTextFont = [UIFont systemFontOfSize:18.0f]; + } + return _pickerTextFont; +} + +- (CGFloat)pickerHeight { + if (_pickerHeight < 40) { + _pickerHeight = 216.0f; + } + return _pickerHeight; +} + +- (CGFloat)rowHeight { + if (_rowHeight < 20) { + _rowHeight = 35.0f; + } + return _rowHeight; +} + +- (NSString *)language { + if (!_language) { + // 跟随系统的首选语言自动改变 + // zh-Hans-CN(简体中文)、zh-Hant-CN(繁体中文)、en-CN(美式英语)、en-GB(英式英语) + // 其中`CN`是iOS9以后新增的地区代码,如:CN 代表中国,US 代表美国 + _language = [NSLocale preferredLanguages].firstObject; + } + return _language; +} + +- (UIColor *)dateUnitTextColor { + if (!_dateUnitTextColor) { + if (@available(iOS 13.0, *)) { + _dateUnitTextColor = [UIColor labelColor]; + } else { + _dateUnitTextColor = kBRDefaultTextColor; + } + } + return _dateUnitTextColor; +} + +- (UIFont *)dateUnitTextFont { + if (!_dateUnitTextFont) { + _dateUnitTextFont = [UIFont systemFontOfSize:18.0f]; + } + return _dateUnitTextFont; +} + +#pragma mark - 创建自定义动态颜色(适配深色模式) +- (UIColor *)br_colorWithLightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor { + if (@available(iOS 13.0, *)) { + UIColor *dyColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) { + if ([traitCollection userInterfaceStyle] == UIUserInterfaceStyleLight) { + return lightColor; + } else { + return darkColor; + } + }]; + return dyColor; + } else { + return lightColor; + } +} + +#pragma mark - 弹框模板样式1 - 取消/确定按钮圆角样式 ++ (instancetype)pickerStyleWithThemeColor:(UIColor *)themeColor { + BRPickerStyle *customStyle = [[self alloc]init]; + if (themeColor) { + customStyle.cancelTextColor = themeColor; + customStyle.cancelBorderStyle = BRBorderStyleSolid; + customStyle.doneColor = themeColor; + customStyle.doneTextColor = [UIColor whiteColor]; + customStyle.doneBorderStyle = BRBorderStyleFill; + } + return customStyle; +} + +#pragma mark - 弹框模板样式2 - 顶部圆角样式 + 完成按钮 ++ (instancetype)pickerStyleWithDoneTextColor:(UIColor *)doneTextColor { + BRPickerStyle *customStyle = [[self alloc]init]; + if (doneTextColor) { + customStyle.topCornerRadius = 16.0f; + customStyle.hiddenCancelBtn = YES; + customStyle.hiddenTitleLine = YES; + customStyle.titleLabelFrame = CGRectMake(20, 4, 100, 40); + customStyle.doneTextColor = doneTextColor; + customStyle.doneTextFont = [UIFont boldSystemFontOfSize:18.0f]; + customStyle.doneBtnFrame = CGRectMake(BRGetKeyWindow().bounds.size.width - 60, 4, 60, 40); + customStyle.doneBtnTitle = [NSBundle br_localizedStringForKey:@"完成" language:customStyle.language]; + customStyle.selectRowTextColor = doneTextColor; + customStyle.selectRowTextFont = [UIFont boldSystemFontOfSize:20.0f]; + } + return customStyle; +} + +#pragma mark - 弹框模板样式3 - 顶部圆角样式 + 图标按钮 ++ (instancetype)pickerStyleWithDoneBtnImage:(UIImage *)doneBtnImage { + BRPickerStyle *customStyle = [[self alloc]init]; + if (doneBtnImage) { + customStyle.topCornerRadius = 16.0f; + customStyle.hiddenTitleLine = YES; + customStyle.hiddenCancelBtn = YES; + customStyle.titleLabelFrame = CGRectMake(20, 4, 100, 40); + customStyle.doneBtnImage = doneBtnImage; + customStyle.doneBtnFrame = CGRectMake(BRGetKeyWindow().bounds.size.width - 44, 4, 40, 40); + } + return customStyle; +} + + +#pragma mark - 设置选择器中间选中行的样式 +- (void)setupPickerSelectRowStyle:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + // 1.设置分割线的颜色 + NSString *systemVersion = [UIDevice currentDevice].systemVersion; + if (systemVersion.doubleValue < 14.0) { + for (UIView *subView in pickerView.subviews) { + if (subView && [subView isKindOfClass:[UIView class]] && subView.frame.size.height <= 1) { + subView.backgroundColor = self.separatorColor; + // 设置分割线高度 + if (self.separatorHeight > 0) { + CGRect rect = subView.frame; + rect.size.height = self.separatorHeight; + subView.frame = rect; + } + } + } + } + + // 2.设置选择器中间选中行的背景颜色 + UIView *contentView = nil; + NSArray *subviews = pickerView.subviews; + if (subviews.count > 0) { + id firstView = subviews.firstObject; + if (firstView && [firstView isKindOfClass:[UIView class]]) { + contentView = (UIView *)firstView; + } + } + if (self.selectRowColor) { + UIView *columnView = nil; + if (contentView) { + id obj = [contentView valueForKey:@"subviewCache"]; + if (obj && [obj isKindOfClass:[NSArray class]]) { + NSArray *columnViews = (NSArray *)obj; + if (columnViews.count > 0) { + id columnObj = columnViews.firstObject; + if (columnObj && [columnObj isKindOfClass:[UIView class]]) { + columnView = (UIView *)columnObj; + } + } + } + } + if (columnView) { + id obj = [columnView valueForKey:@"middleContainerView"]; + if (obj && [obj isKindOfClass:[UIView class]]) { + UIView *selectRowView = (UIView *)obj; + // 中间选中行的背景颜色 + selectRowView.backgroundColor = self.selectRowColor; + } + } + } + + if (contentView && self.clearPickerNewStyle) { + if (systemVersion.doubleValue >= 14.0) { + // ①隐藏中间选择行的背景样式 + id lastView = subviews.lastObject; + if (lastView && [lastView isKindOfClass:[UIView class]]) { + UIView *rectBgView = (UIView *)lastView; + rectBgView.hidden = YES; + } + + // ②清除iOS14上选择器默认的内边距 + if (systemVersion.doubleValue < 15.0f) { + [self setPickerAllSubViewsStyle:contentView]; + } + } + } + + // 3.设置选择器中间选中行的字体颜色/字体大小 + if (self.selectRowTextColor || self.selectRowTextFont) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + // 当前选中的 label + UILabel *selectLabel = (UILabel *)[pickerView viewForRow:row forComponent:component]; + if (selectLabel) { + if (self.selectRowTextColor) { + selectLabel.textColor = self.selectRowTextColor; + } + if (self.selectRowTextFont) { + selectLabel.font = self.selectRowTextFont; + } + } + }); + } +} + +// 遍历子视图,重新设置 frame(清空在 iOS14 上 UIPickerView 出现的内边距) +- (void)setPickerAllSubViewsStyle:(UIView *)view { + NSArray *subViews = view.subviews; + if (subViews.count == 0 || [view isKindOfClass:[UILabel class]]) return; + for (UIView *subView in subViews) { + NSString *className = NSStringFromClass([subView class]); + if ([className isEqualToString:@"UIPickerColumnView"]) { + CGRect rect = subView.frame; + rect.origin.x = 0; + rect.size.width = view.bounds.size.width; + subView.frame = rect; + } + NSString *superClassName = NSStringFromClass([view class]); + if ([superClassName isEqualToString:@"UIPickerColumnView"]) { + CGRect rect = subView.frame; + rect.size.width = view.bounds.size.width; + subView.frame = rect; + } + if ([subView isKindOfClass:[UILabel class]]) { + CGRect rect = subView.frame; + rect.origin.x = 10; + subView.frame = rect; + } + + [self setPickerAllSubViewsStyle:subView]; + } +} + +#pragma mark - 添加选择器中间行上下两条分割线(iOS14之后系统默认去掉,需要手动添加) +- (void)addSeparatorLineView:(UIView *)pickerView { + if ([UIDevice currentDevice].systemVersion.doubleValue >= 14.0) { + UIView *topLineView = [[UIView alloc]initWithFrame:CGRectMake(0, pickerView.bounds.size.height / 2 - self.rowHeight / 2, pickerView.bounds.size.width, 0.5f)]; + topLineView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + topLineView.backgroundColor = self.separatorColor; + // 设置分割线高度 + if (self.separatorHeight > 0) { + CGRect topRect = topLineView.frame; + topRect.size.height = self.separatorHeight; + topLineView.frame = topRect; + } + [pickerView addSubview:topLineView]; + + UIView *bottomLineView = [[UIView alloc]initWithFrame:CGRectMake(0, pickerView.bounds.size.height / 2 + self.rowHeight / 2, pickerView.bounds.size.width, 0.5f)]; + bottomLineView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + bottomLineView.backgroundColor = self.separatorColor; + // 设置分割线高度 + if (self.separatorHeight > 0) { + CGRect bottomRect = bottomLineView.frame; + bottomRect.size.height = self.separatorHeight; + bottomLineView.frame = bottomRect; + } + [pickerView addSubview:bottomLineView]; + } +} + +#pragma mark - 设置 view 的部分圆角 +// corners(枚举类型,可组合使用):UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners ++ (void)br_setView:(UIView *)view roundingCorners:(UIRectCorner)corners withRadius:(CGFloat)radius { + UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)]; + CAShapeLayer *shape = [[CAShapeLayer alloc]init]; + [shape setPath:rounded.CGPath]; + view.layer.mask = shape; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/en.lproj/Localizable.strings b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/en.lproj/Localizable.strings new file mode 100644 index 0000000..ad98740 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/en.lproj/Localizable.strings @@ -0,0 +1,35 @@ +/* + Localizable.strings + BRPickerViewDemo + + Created by renbo on 2019/10/30. + Copyright © 2019 irenb. All rights reserved. +*/ + +"确定" = "OK"; +"取消" = "Cancel"; +"完成" = "Done"; + +"年" = " "; +"月" = " "; +"日" = " "; +"时" = " "; +"分" = " "; +"秒" = " "; + +"周" = " "; +"季度" = " "; + +"上午" = "AM"; +"下午" = "PM"; + +"至今" = " Now"; +"今天" = " Today"; + +"周一" = " Mon"; +"周二" = " Tue"; +"周三" = " Wed"; +"周四" = " Thu"; +"周五" = " Fri"; +"周六" = " Sat"; +"周日" = " Sun"; diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings new file mode 100644 index 0000000..002110f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings @@ -0,0 +1,35 @@ +/* + Localizable.strings + BRPickerViewDemo + + Created by renbo on 2019/10/30. + Copyright © 2019 irenb. All rights reserved. +*/ + +"确定" = "确定"; +"取消" = "取消"; +"完成" = "完成"; + +"年" = "年"; +"月" = "月"; +"日" = "日"; +"时" = "时"; +"分" = "分"; +"秒" = "秒"; + +"周" = "周"; +"季度" = "季度"; + +"上午" = "上午"; +"下午" = "下午"; + +"至今" = "至今"; +"今天" = "今天"; + +"周一" = "周一"; +"周二" = "周二"; +"周三" = "周三"; +"周四" = "周四"; +"周五" = "周五"; +"周六" = "周六"; +"周日" = "周日"; diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings new file mode 100644 index 0000000..9c3521b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings @@ -0,0 +1,35 @@ +/* + Localizable.strings + BRPickerViewDemo + + Created by renbo on 2019/10/30. + Copyright © 2019 irenb. All rights reserved. +*/ + +"确定" = "確定"; +"取消" = "取消"; +"完成" = "完成"; + +"年" = "年"; +"月" = "月"; +"日" = "日"; +"时" = "時"; +"分" = "分"; +"秒" = "秒"; + +"周" = "周"; +"季度" = "季度"; + +"上午" = "上午"; +"下午" = "下午"; + +"至今" = "至今"; +"今天" = "今天"; + +"周一" = "周壹"; +"周二" = "周二"; +"周三" = "周三"; +"周四" = "周四"; +"周五" = "周五"; +"周六" = "周六"; +"周日" = "周日"; diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerViewMacro.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerViewMacro.h new file mode 100644 index 0000000..717480e --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/BRPickerViewMacro.h @@ -0,0 +1,87 @@ +// +// BRPickerViewMacro.h +// BRPickerViewDemo +// +// Created by renbo on 2018/4/23. +// Copyright © 2018 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#ifndef BRPickerViewMacro_h +#define BRPickerViewMacro_h + +#import + +// 屏幕安全区域下边距 +#define BR_BOTTOM_MARGIN \ +({CGFloat safeBottomHeight = 0;\ +if (@available(iOS 11.0, *)) {\ +safeBottomHeight = BRGetKeyWindow().safeAreaInsets.bottom;\ +}\ +(safeBottomHeight);}) + + +// 静态库中编写 Category 时的便利宏,用于解决 Category 方法从静态库中加载需要特别设置的问题 +#ifndef BRSYNTH_DUMMY_CLASS + +#define BRSYNTH_DUMMY_CLASS(_name_) \ +@interface BRSYNTH_DUMMY_CLASS_ ## _name_ : NSObject @end \ +@implementation BRSYNTH_DUMMY_CLASS_ ## _name_ @end + +#endif + + +// 打印错误日志 +#ifdef DEBUG + #define BRErrorLog(...) NSLog(@"reason: %@", [NSString stringWithFormat:__VA_ARGS__]) +#else + #define BRErrorLog(...) +#endif + + +/** RGB颜色(16进制) */ +static inline UIColor *BR_RGB_HEX(uint32_t rgbValue, CGFloat alpha) { + return [UIColor colorWithRed:((CGFloat)((rgbValue & 0xFF0000) >> 16)) / 255.0 + green:((CGFloat)((rgbValue & 0xFF00) >> 8)) / 255.0 + blue:((CGFloat)(rgbValue & 0xFF)) / 255.0 + alpha:(alpha)]; +} + + +/** 获取 keyWindow */ +static inline UIWindow *BRGetKeyWindow(void) { + UIWindow *keyWindow = nil; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 // 编译时检查SDK版本(兼容不同版本的Xcode,防止编译报错) + if (@available(iOS 13.0, *)) { // 运行时检查系统版本(兼容不同版本的系统,防止运行报错) + NSSet *connectedScenes = [UIApplication sharedApplication].connectedScenes; + for (UIScene *scene in connectedScenes) { + if (scene.activationState == UISceneActivationStateForegroundActive && [scene isKindOfClass:[UIWindowScene class]]) { + UIWindowScene *windowScene = (UIWindowScene *)scene; + for (UIWindow *window in windowScene.windows) { + if (window.isKeyWindow) { + keyWindow = window; + break; + } + } + } + } + } +#endif + + if (!keyWindow) { + keyWindow = [UIApplication sharedApplication].windows.firstObject; + if (!keyWindow.isKeyWindow) { +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + UIWindow *window = [UIApplication sharedApplication].keyWindow; + if (CGRectEqualToRect(window.bounds, UIScreen.mainScreen.bounds)) { + keyWindow = window; + } +#endif + } + } + + return keyWindow; +} + + +#endif /* BRPickerViewMacro_h */ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.h new file mode 100644 index 0000000..a0b7d5f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.h @@ -0,0 +1,26 @@ +// +// NSBundle+BRPickerView.h +// BRPickerViewDemo +// +// Created by renbo on 2019/10/30. +// Copyright © 2019 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSBundle (BRPickerView) + +/// 获取 BRPickerView.bundle ++ (instancetype)br_pickerBundle; + +/// 获取国际化后的文本 +/// @param key 代表 Localizable.strings 文件中 key-value 中的 key。 +/// @param language 设置语言(可为空,为nil时将随系统的语言自动改变) ++ (NSString *)br_localizedStringForKey:(NSString *)key language:(NSString *)language; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.m new file mode 100644 index 0000000..898f05e --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.m @@ -0,0 +1,68 @@ +// +// NSBundle+BRPickerView.m +// BRPickerViewDemo +// +// Created by renbo on 2019/10/30. +// Copyright © 2019 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "NSBundle+BRPickerView.h" +#import "BRBaseView.h" + +BRSYNTH_DUMMY_CLASS(NSBundle_BRPickerView) + +@implementation NSBundle (BRPickerView) + +#pragma mark - 获取 BRPickerView.bundle ++ (instancetype)br_pickerBundle { + static NSBundle *pickerBundle = nil; + if (!pickerBundle) { + /* + 先拿到最外面的 bundle。 + 对 framework 链接方式来说就是 framework 的 bundle 根目录, + 对静态库链接方式来说就是 target client 的 main bundle, + 然后再去找下面名为 BRPickerView 的 bundle 对象。 + */ + NSBundle *bundle = [NSBundle bundleForClass:[BRBaseView class]]; + NSURL *url = [bundle URLForResource:@"BRPickerView" withExtension:@"bundle"]; + pickerBundle = [NSBundle bundleWithURL:url]; + } + return pickerBundle; +} + +#pragma mark - 获取国际化后的文本 ++ (NSString *)br_localizedStringForKey:(NSString *)key language:(NSString *)language { + return [self br_localizedStringForKey:key value:nil language:language]; +} + ++ (NSString *)br_localizedStringForKey:(NSString *)key value:(NSString *)value language:(NSString *)language { + static NSBundle *bundle = nil; + if (!bundle) { + // 如果没有手动设置语言,将随系统的语言自动改变 + if (!language) { + // 系统首选语言 + language = [NSLocale preferredLanguages].firstObject; + } + + if ([language hasPrefix:@"en"]) { + language = @"en"; + } else if ([language hasPrefix:@"zh"]) { + if ([language rangeOfString:@"Hans"].location != NSNotFound) { + language = @"zh-Hans"; // 简体中文 + } else { // zh-Hant、zh-HK、zh-TW + language = @"zh-Hant"; // 繁體中文 + } + } else { + language = @"en"; + } + + // 从 BRPickerView.bundle 中查找资源 + bundle = [NSBundle bundleWithPath:[[self br_pickerBundle] pathForResource:language ofType:@"lproj"]]; + } + value = [bundle localizedStringForKey:key value:value table:nil]; + + return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.h new file mode 100644 index 0000000..44e2c4d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.h @@ -0,0 +1,111 @@ +// +// BRDatePickerView+BR.h +// BRPickerViewDemo +// +// Created by renbo on 2020/6/16. +// Copyright © 2020 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRDatePickerView.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface BRDatePickerView (BR) + +/** 最小日期 */ +- (NSDate *)handlerMinDate:(nullable NSDate *)minDate; + +/** 最大日期 */ +- (NSDate *)handlerMaxDate:(nullable NSDate *)maxDate; + +/** 默认选中的日期 */ +- (NSDate *)handlerSelectDate:(nullable NSDate *)selectDate dateFormat:(NSString *)dateFormat; + +/** NSDate 转 NSString */ +- (NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat; + +/** NSString 转 NSDate */ +- (NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat; + +/** 比较两个日期大小(可以指定比较级数,即按指定格式进行比较) */ +- (NSComparisonResult)br_compareDate:(NSDate *)date targetDate:(NSDate *)targetDate dateFormat:(NSString *)dateFormat; + +/** 获取 yearArr 数组 */ +- (NSArray *)getYearArr; + +/** 获取 monthArr 数组 */ +- (NSArray *)getMonthArr:(NSInteger)year; + +/** 获取 dayArr 数组 */ +- (NSArray *)getDayArr:(NSInteger)year month:(NSInteger)month; + +/** 获取 hourArr 数组 */ +- (NSArray *)getHourArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; + +/** 获取 minuteArr 数组 */ +- (NSArray *)getMinuteArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour; + +/** 获取 secondArr 数组 */ +- (NSArray *)getSecondArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; + +/** 获取 monthWeekArr 数组 */ +- (NSArray *)getMonthWeekArr:(NSInteger)year month:(NSInteger)month; + +/** 获取 yearWeekArr 数组 */ +- (NSArray *)getYearWeekArr:(NSInteger)year; + + /** 获取 quarterArr 数组 */ +- (NSArray *)getQuarterArr:(NSInteger)year; + +/** 添加 pickerView */ +- (void)setupPickerView:(UIView *)pickerView toView:(UIView *)view; + +/** 设置日期单位 */ +- (NSArray *)setupPickerUnitLabel:(UIPickerView *)pickerView unitArr:(NSArray *)unitArr; + +- (NSString *)getYearNumber:(NSInteger)year; + +- (NSString *)getMDHMSNumber:(NSInteger)number; + +- (NSString *)getYearText:(NSArray *)yearArr row:(NSInteger)row; + +- (NSString *)getMonthText:(NSArray *)monthArr row:(NSInteger)row; + +- (NSString *)getDayText:(NSArray *)dayArr row:(NSInteger)row mSelectDate:(NSDate *)mSelectDate; + +- (NSString *)getHourText:(NSArray *)hourArr row:(NSInteger)row; + +- (NSString *)getMinuteText:(NSArray *)minuteArr row:(NSInteger)row; + +- (NSString *)getSecondText:(NSArray *)secondArr row:(NSInteger)row; + +- (NSString *)getWeekText:(NSArray *)weekArr row:(NSInteger)row; + +- (NSString *)getQuarterText:(NSArray *)quarterArr row:(NSInteger)row; + +- (NSString *)getAMText; + +- (NSString *)getPMText; + +- (NSString *)getYearUnit; + +- (NSString *)getMonthUnit; + +- (NSString *)getDayUnit; + +- (NSString *)getHourUnit; + +- (NSString *)getMinuteUnit; + +- (NSString *)getSecondUnit; + +- (NSString *)getWeekUnit; + +- (NSString *)getQuarterUnit; + +- (NSInteger)getIndexWithArray:(NSArray *)array object:(NSString *)obj; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.m new file mode 100644 index 0000000..61e777c --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.m @@ -0,0 +1,755 @@ +// +// BRDatePickerView+BR.m +// BRPickerViewDemo +// +// Created by renbo on 2020/6/16. +// Copyright © 2020 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRDatePickerView+BR.h" +#import "NSBundle+BRPickerView.h" + +BRSYNTH_DUMMY_CLASS(BRDatePickerView_BR) + +////////////////////////////////////////// +/// 本分类主要是给 BRDatePickerView 文件瘦身 +////////////////////////////////////////// + +@implementation BRDatePickerView (BR) + +#pragma mark - 最小日期 +- (NSDate *)handlerMinDate:(NSDate *)minDate { + if (!minDate) { + if (self.pickerMode == BRDatePickerModeMDHM) { + minDate = [NSDate br_setMonth:1 day:1 hour:0 minute:0]; + } else if (self.pickerMode == BRDatePickerModeMD) { + minDate = [NSDate br_setMonth:1 day:1]; + } else if (self.pickerMode == BRDatePickerModeTime || self.pickerMode == BRDatePickerModeCountDownTimer || self.pickerMode == BRDatePickerModeHM) { + minDate = [NSDate br_setHour:0 minute:0]; + } else if (self.pickerMode == BRDatePickerModeHMS) { + minDate = [NSDate br_setHour:0 minute:0 second:0]; + } else if (self.pickerMode == BRDatePickerModeMS) { + minDate = [NSDate br_setMinute:0 second:0]; + } else { + minDate = [NSDate distantPast]; // 遥远的过去的一个时间点 + } + } + return minDate; +} + +#pragma mark - 最大日期 +- (NSDate *)handlerMaxDate:(NSDate *)maxDate { + if (!maxDate) { + if (self.pickerMode == BRDatePickerModeMDHM) { + maxDate = [NSDate br_setMonth:12 day:31 hour:23 minute:59]; + } else if (self.pickerMode == BRDatePickerModeMD) { + maxDate = [NSDate br_setMonth:12 day:31]; + } else if (self.pickerMode == BRDatePickerModeTime || self.pickerMode == BRDatePickerModeCountDownTimer || self.pickerMode == BRDatePickerModeHM) { + maxDate = [NSDate br_setHour:23 minute:59]; + } else if (self.pickerMode == BRDatePickerModeHMS) { + maxDate = [NSDate br_setHour:23 minute:59 second:59]; + } else if (self.pickerMode == BRDatePickerModeMS) { + maxDate = [NSDate br_setMinute:59 second:59]; + } else { + maxDate = [NSDate distantFuture]; // 遥远的未来的一个时间点 + } + } + return maxDate; +} + +#pragma mark - 默认选中的日期 +- (NSDate *)handlerSelectDate:(NSDate *)selectDate dateFormat:(NSString *)dateFormat { + // selectDate 优先级高于 selectValue(推荐使用 selectDate 设置默认选中的日期) + if (!selectDate) { + if (self.selectValue && self.selectValue.length > 0) { + if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) { + NSString *firstString = [[self.selectValue componentsSeparatedByString:@" "] firstObject]; + NSString *lastString = [[self.selectValue componentsSeparatedByString:@" "] lastObject]; + if ([lastString isEqualToString:[self getAMText]]) { + self.selectValue = [NSString stringWithFormat:@"%@ 00", firstString]; + } + if ([lastString isEqualToString:[self getPMText]]) { + self.selectValue = [NSString stringWithFormat:@"%@ 12", firstString]; + } + } + + NSDate *date = nil; + if ([self.selectValue isEqualToString:self.lastRowContent]) { + date = self.addToNow ? [NSDate date] : nil; + } else if ([self.selectValue isEqualToString:self.firstRowContent]) { + date = nil; + } else { + date = [self br_dateFromString:self.selectValue dateFormat:dateFormat]; + if (!date) { + BRErrorLog(@"参数异常!字符串 selectValue 的正确格式是:%@", dateFormat); + NSAssert(date, @"参数异常!请检查字符串 selectValue 的格式"); + date = [NSDate date]; // 默认值参数格式错误时,重置/忽略默认值,防止在 Release 环境下崩溃! + } + if (self.pickerMode == BRDatePickerModeMDHM) { + selectDate = [NSDate br_setMonth:date.br_month day:date.br_day hour:date.br_hour minute:date.br_minute]; + } else if (self.pickerMode == BRDatePickerModeMD) { + selectDate = [NSDate br_setMonth:date.br_month day:date.br_day]; + } else if (self.pickerMode == BRDatePickerModeTime || self.pickerMode == BRDatePickerModeCountDownTimer || self.pickerMode == BRDatePickerModeHM) { + selectDate = [NSDate br_setHour:date.br_hour minute:date.br_minute]; + } else if (self.pickerMode == BRDatePickerModeHMS) { + selectDate = [NSDate br_setHour:date.br_hour minute:date.br_minute second:date.br_second]; + } else if (self.pickerMode == BRDatePickerModeMS) { + selectDate = [NSDate br_setMinute:date.br_minute second:date.br_second]; + } else { + selectDate = date; + } + } + } else { + // 不设置默认日期 + if (self.pickerMode == BRDatePickerModeTime || + self.pickerMode == BRDatePickerModeCountDownTimer || + self.pickerMode == BRDatePickerModeHM || + self.pickerMode == BRDatePickerModeHMS || + self.pickerMode == BRDatePickerModeMS) { + // 默认选中最小日期 + selectDate = self.minDate; + } else { + if (self.minuteInterval > 1 || self.secondInterval > 1) { + NSDate *date = [NSDate date]; + NSInteger minute = self.minDate.br_minute % self.minuteInterval == 0 ? self.minDate.br_minute : 0; + NSInteger second = self.minDate.br_second % self.secondInterval == 0 ? self.minDate.br_second : 0; + selectDate = [NSDate br_setYear:date.br_year month:date.br_month day:date.br_day hour:date.br_hour minute:minute second:second]; + } else { + // 默认选中今天的日期 + selectDate = [NSDate date]; + } + } + } + } + + // 判断日期是否超过边界限制 + BOOL selectLessThanMin = [self br_compareDate:selectDate targetDate:self.minDate dateFormat:dateFormat] == NSOrderedAscending; + BOOL selectMoreThanMax = [self br_compareDate:selectDate targetDate:self.maxDate dateFormat:dateFormat] == NSOrderedDescending; + if (selectLessThanMin) { + BRErrorLog(@"默认选择的日期不能小于最小日期!"); + selectDate = self.minDate; + } + if (selectMoreThanMax) { + BRErrorLog(@"默认选择的日期不能大于最大日期!"); + selectDate = self.maxDate; + } + + return selectDate; +} + +#pragma mark - NSDate 转 NSString +- (NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat { + return [NSDate br_stringFromDate:date dateFormat:dateFormat timeZone:self.timeZone language:self.pickerStyle.language]; +} + +#pragma mark - NSString 转 NSDate +- (NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat { + return [NSDate br_dateFromString:dateString dateFormat:dateFormat timeZone:self.timeZone language:self.pickerStyle.language]; +} + +#pragma mark - 比较两个日期大小(可以指定比较级数,即按指定格式进行比较) +- (NSComparisonResult)br_compareDate:(NSDate *)date targetDate:(NSDate *)targetDate dateFormat:(NSString *)dateFormat { + NSString *dateString1 = [self br_stringFromDate:date dateFormat:dateFormat]; + NSString *dateString2 = [self br_stringFromDate:targetDate dateFormat:dateFormat]; + NSDate *date1 = [self br_dateFromString:dateString1 dateFormat:dateFormat]; + NSDate *date2 = [self br_dateFromString:dateString2 dateFormat:dateFormat]; + if ([date1 compare:date2] == NSOrderedDescending) { + return 1; // 大于 + } else if ([date1 compare:date2] == NSOrderedAscending) { + return -1; // 小于 + } else { + return 0; // 等于 + } +} + +#pragma mark - 获取 yearArr 数组 +- (NSArray *)getYearArr { + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = self.minDate.br_year; i <= self.maxDate.br_year; i++) { + [tempArr addObject:[self getYearNumber:i]]; + } + if (self.isDescending) { + NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects]; + tempArr = [reversedArr mutableCopy]; + } + // 判断是否需要添加【自定义字符串】 + if (self.lastRowContent || self.firstRowContent) { + switch (self.pickerMode) { + case BRDatePickerModeYMDHMS: + case BRDatePickerModeYMDHM: + case BRDatePickerModeYMDH: + case BRDatePickerModeYMD: + case BRDatePickerModeYM: + case BRDatePickerModeY: + { + if (self.lastRowContent) { + [tempArr addObject:self.lastRowContent]; + } + if (self.firstRowContent) { + [tempArr insertObject:self.firstRowContent atIndex:0]; + } + } + break; + + default: + break; + } + } + + return [tempArr copy]; +} + +#pragma mark - 获取 monthArr 数组 +- (NSArray *)getMonthArr:(NSInteger)year { + NSInteger startMonth = 1; + NSInteger endMonth = 12; + if (year == self.minDate.br_year) { + startMonth = self.minDate.br_month; + } + if (year == self.maxDate.br_year) { + endMonth = self.maxDate.br_month; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startMonth; i <= endMonth; i++) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects]; + tempArr = [reversedArr mutableCopy]; + } + // 判断是否需要添加【自定义字符串】 + if (self.lastRowContent || self.firstRowContent) { + switch (self.pickerMode) { + case BRDatePickerModeMDHM: + case BRDatePickerModeMD: + { + if (self.lastRowContent) { + [tempArr addObject:self.lastRowContent]; + } + if (self.firstRowContent) { + [tempArr insertObject:self.firstRowContent atIndex:0]; + } + } + break; + + default: + break; + } + } + + return [tempArr copy]; +} + +#pragma mark - 获取 dayArr 数组 +- (NSArray *)getDayArr:(NSInteger)year month:(NSInteger)month { + NSInteger startDay = 1; + NSInteger endDay = [NSDate br_getDaysInYear:year month:month]; + if (year == self.minDate.br_year && month == self.minDate.br_month) { + startDay = self.minDate.br_day; + } + if (year == self.maxDate.br_year && month == self.maxDate.br_month) { + endDay = self.maxDate.br_day; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startDay; i <= endDay; i++) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + return [[tempArr reverseObjectEnumerator] allObjects]; + } + + return [tempArr copy]; +} + +#pragma mark - 获取 hourArr 数组 +- (NSArray *)getHourArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day { + if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) { + return @[[self getAMText], [self getPMText]]; + } + + NSInteger startHour = 0; + NSInteger endHour = 23; + if (year == self.minDate.br_year && month == self.minDate.br_month && day == self.minDate.br_day) { + startHour = self.minDate.br_hour; + } + if (year == self.maxDate.br_year && month == self.maxDate.br_month && day == self.maxDate.br_day) { + endHour = self.maxDate.br_hour; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startHour; i <= endHour; i++) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects]; + tempArr = [reversedArr mutableCopy]; + } + // 判断是否需要添加【自定义字符串】 + if (self.lastRowContent || self.firstRowContent) { + switch (self.pickerMode) { + case BRDatePickerModeHMS: + case BRDatePickerModeHM: + { + if (self.lastRowContent) { + [tempArr addObject:self.lastRowContent]; + } + if (self.firstRowContent) { + [tempArr insertObject:self.firstRowContent atIndex:0]; + } + } + break; + + default: + break; + } + } + + return [tempArr copy]; +} + +#pragma mark - 获取 minuteArr 数组 +- (NSArray *)getMinuteArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour { + NSInteger startMinute = 0; + NSInteger endMinute = 59; + if (year == self.minDate.br_year && month == self.minDate.br_month && day == self.minDate.br_day && hour == self.minDate.br_hour) { + startMinute = self.minDate.br_minute; + } + if (year == self.maxDate.br_year && month == self.maxDate.br_month && day == self.maxDate.br_day && hour == self.maxDate.br_hour) { + endMinute = self.maxDate.br_minute; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startMinute; i <= endMinute; i += self.minuteInterval) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects]; + tempArr = [reversedArr mutableCopy]; + } + // 判断是否需要添加【自定义字符串】 + if (self.lastRowContent || self.firstRowContent) { + switch (self.pickerMode) { + case BRDatePickerModeMS: + { + if (self.lastRowContent) { + [tempArr addObject:self.lastRowContent]; + } + if (self.firstRowContent) { + [tempArr insertObject:self.firstRowContent atIndex:0]; + } + } + break; + + default: + break; + } + } + + return [tempArr copy]; +} + +#pragma mark - 获取 secondArr 数组 +- (NSArray *)getSecondArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute { + NSInteger startSecond = 0; + NSInteger endSecond = 59; + if (year == self.minDate.br_year && month == self.minDate.br_month && day == self.minDate.br_day && hour == self.minDate.br_hour && minute == self.minDate.br_minute) { + startSecond = self.minDate.br_second; + } + if (year == self.maxDate.br_year && month == self.maxDate.br_month && day == self.maxDate.br_day && hour == self.maxDate.br_hour && minute == self.maxDate.br_minute) { + endSecond = self.maxDate.br_second; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startSecond; i <= endSecond; i += self.secondInterval) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + return [[tempArr reverseObjectEnumerator] allObjects]; + } + + return [tempArr copy]; +} + +#pragma mark - 获取 monthWeekArr 数组 +- (NSArray *)getMonthWeekArr:(NSInteger)year month:(NSInteger)month { + NSInteger startWeek = 1; + NSInteger endWeek = [NSDate br_getWeeksOfMonthInYear:year month:month]; + if (year == self.minDate.br_year && month == self.minDate.br_month) { + startWeek = self.minDate.br_monthWeek; + } + if (year == self.maxDate.br_year && month == self.maxDate.br_month) { + endWeek = self.maxDate.br_monthWeek; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startWeek; i <= endWeek; i++) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + return [[tempArr reverseObjectEnumerator] allObjects]; + } + + return [tempArr copy]; +} + +#pragma mark - 获取 yearWeekArr 数组 +- (NSArray *)getYearWeekArr:(NSInteger)year { + NSInteger startWeek = 1; + NSInteger endWeek = [NSDate br_getWeeksOfYearInYear:year]; + if (year == self.minDate.br_year) { + startWeek = self.minDate.br_yearWeek; + } + if (year == self.maxDate.br_year) { + endWeek = self.maxDate.br_yearWeek; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startWeek; i <= endWeek; i++) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + return [[tempArr reverseObjectEnumerator] allObjects]; + } + + return [tempArr copy]; +} + +#pragma mark - 获取 quarterArr 数组 +- (NSArray *)getQuarterArr:(NSInteger)year { + NSInteger startQuarter = 1; + NSInteger endQuarter = [NSDate br_getQuartersInYear:year]; + if (year == self.minDate.br_year) { + startQuarter = self.minDate.br_quarter; + } + if (year == self.maxDate.br_year) { + endQuarter = self.maxDate.br_quarter; + } + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = startQuarter; i <= endQuarter; i++) { + [tempArr addObject:[self getMDHMSNumber:i]]; + } + if (self.isDescending) { + return [[tempArr reverseObjectEnumerator] allObjects]; + } + + return [tempArr copy]; +} + +#pragma mark - 添加 pickerView +- (void)setupPickerView:(UIView *)pickerView toView:(UIView *)view { + if (view) { + // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示) + [view setNeedsLayout]; + [view layoutIfNeeded]; + + self.frame = view.bounds; + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0; + pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight); + [self addSubview:pickerView]; + } else { + // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题) + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight); + + [self.alertView addSubview:pickerView]; + } +} + +#pragma mark - 获取日期单位 +- (NSArray *)setupPickerUnitLabel:(UIPickerView *)pickerView unitArr:(NSArray *)unitArr { + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + for (NSInteger i = 0; i < pickerView.numberOfComponents; i++) { + // label宽度 + CGFloat labelWidth = pickerView.bounds.size.width / pickerView.numberOfComponents; + // 根据占位文本长度去计算宽度 + NSString *tempText = @"00"; + if (i == 0) { + switch (self.pickerMode) { + case BRDatePickerModeYMDHMS: + case BRDatePickerModeYMDHM: + case BRDatePickerModeYMDH: + case BRDatePickerModeYMD: + case BRDatePickerModeYM: + case BRDatePickerModeY: + { + tempText = @"0123"; + } + break; + + default: + break; + } + } + // 文本宽度 + CGFloat labelTextWidth = [tempText boundingRectWithSize:CGSizeMake(MAXFLOAT, self.pickerStyle.rowHeight) + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:@{NSFontAttributeName: self.pickerStyle.pickerTextFont} + context:nil].size.width; + // 单位label + UILabel *unitLabel = [[UILabel alloc]init]; + unitLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; + unitLabel.backgroundColor = [UIColor clearColor]; + if (self.pickerMode != BRDatePickerModeYMDHMS) { + unitLabel.textAlignment = NSTextAlignmentCenter; + } + unitLabel.font = self.pickerStyle.dateUnitTextFont; + unitLabel.textColor = self.pickerStyle.dateUnitTextColor; + // 字体自适应属性 + unitLabel.adjustsFontSizeToFitWidth = YES; + // 自适应最小字体缩放比例 + unitLabel.minimumScaleFactor = 0.5f; + unitLabel.text = (unitArr.count > 0 && i < unitArr.count) ? unitArr[i] : nil; + + CGFloat originX = i * labelWidth + labelWidth / 2.0 + labelTextWidth / 2.0 + self.pickerStyle.dateUnitOffsetX; + CGFloat originY = (pickerView.frame.size.height - self.pickerStyle.rowHeight) / 2 + self.pickerStyle.dateUnitOffsetY; + unitLabel.frame = CGRectMake(originX, originY, MAX(self.pickerStyle.rowHeight, labelTextWidth), self.pickerStyle.rowHeight); + + [tempArr addObject:unitLabel]; + + [pickerView addSubview:unitLabel]; + } + + return [tempArr copy]; +} + +- (NSString *)getYearNumber:(NSInteger)year { + NSString *yearString = [NSString stringWithFormat:@"%@", @(year)]; + if (self.isNumberFullName) { + yearString = [NSString stringWithFormat:@"%04d", [yearString intValue]]; + } + return yearString; +} + +- (NSString *)getMDHMSNumber:(NSInteger)number { + NSString *string = [NSString stringWithFormat:@"%@", @(number)]; + if (self.isNumberFullName) { + string = [NSString stringWithFormat:@"%02d", [string intValue]]; + } + return string; +} + +- (NSString *)getYearText:(NSArray *)yearArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, yearArr.count - 1); + } + NSString *yearString = [yearArr objectAtIndex:index]; + if ((self.lastRowContent && [yearString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [yearString isEqualToString:self.firstRowContent])) { + return yearString; + } + NSString *yearUnit = self.showUnitType == BRShowUnitTypeAll ? [self getYearUnit] : @""; + return [NSString stringWithFormat:@"%@%@", yearString, yearUnit]; +} + +- (NSString *)getMonthText:(NSArray *)monthArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, monthArr.count - 1); + } + NSString *monthString = [monthArr objectAtIndex:index]; + // 首行/末行是自定义字符串,直接返回 + if ((self.firstRowContent && [monthString isEqualToString:self.firstRowContent]) || (self.lastRowContent && [monthString isEqualToString:self.lastRowContent])) { + return monthString; + } + + // 自定义月份数据源 + if (self.monthNames && self.monthNames.count > 0) { + NSInteger index = [monthString integerValue] - 1; + monthString = (index >= 0 && index < self.monthNames.count) ? self.monthNames[index] : @""; + } else { + if (![self.pickerStyle.language hasPrefix:@"zh"] && (self.pickerMode == BRDatePickerModeYMD || self.pickerMode == BRDatePickerModeYM || self.pickerMode == BRDatePickerModeYMW)) { + // 非中文环境:月份使用系统的月份名称 + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:self.pickerStyle.language]; + // monthSymbols: @[@"January", @"February", @"March", @"April", @"May", @"June", @"July", @"August", @"September", @"October", @"November", @"December"]; + // shortMonthSymbols: @[@"Jan", @"Feb", @"Mar", @"Apr", @"May", @"Jun", @"Jul", @"Aug", @"Sep", @"Oct", @"Nov", @"Dec"]; + NSArray *monthNames = self.isShortMonthName ? dateFormatter.shortMonthSymbols : dateFormatter.monthSymbols; + NSInteger index = [monthString integerValue] - 1; + monthString = (index >= 0 && index < monthNames.count) ? monthNames[index] : @""; + } else { + // 中文环境:月份显示数字 + NSString *monthUnit = self.showUnitType == BRShowUnitTypeAll ? [self getMonthUnit] : @""; + monthString = [NSString stringWithFormat:@"%@%@", monthString, monthUnit]; + } + } + + return monthString; +} + +- (NSString *)getDayText:(NSArray *)dayArr row:(NSInteger)row mSelectDate:(NSDate *)mSelectDate { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, dayArr.count - 1); + } + NSString *dayString = [dayArr objectAtIndex:index]; + if (self.isShowToday && mSelectDate.br_year == [NSDate date].br_year && mSelectDate.br_month == [NSDate date].br_month && [dayString integerValue] == [NSDate date].br_day) { + return [NSBundle br_localizedStringForKey:@"今天" language:self.pickerStyle.language]; + } + NSString *dayUnit = self.showUnitType == BRShowUnitTypeAll ? [self getDayUnit] : @""; + dayString = [NSString stringWithFormat:@"%@%@", dayString, dayUnit]; + if (self.isShowWeek) { + NSDate *date = [NSDate br_setYear:mSelectDate.br_year month:mSelectDate.br_month day:[dayString integerValue]]; + NSString *weekdayString = [NSBundle br_localizedStringForKey:[date br_weekdayString] language:self.pickerStyle.language]; + dayString = [NSString stringWithFormat:@"%@%@", dayString, weekdayString]; + } + return dayString; +} + +- (NSString *)getHourText:(NSArray *)hourArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, hourArr.count - 1); + } + NSString *hourString = [hourArr objectAtIndex:index]; + if ((self.lastRowContent && [hourString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [hourString isEqualToString:self.firstRowContent])) { + return hourString; + } + NSString *hourUnit = self.showUnitType == BRShowUnitTypeAll ? [self getHourUnit] : @""; + return [NSString stringWithFormat:@"%@%@", hourString, hourUnit]; +} + +- (NSString *)getMinuteText:(NSArray *)minuteArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, minuteArr.count - 1); + } + NSString *minuteString = [minuteArr objectAtIndex:index]; + NSString *minuteUnit = self.showUnitType == BRShowUnitTypeAll ? [self getMinuteUnit] : @""; + return [NSString stringWithFormat:@"%@%@", minuteString, minuteUnit]; +} + +- (NSString *)getSecondText:(NSArray *)secondArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, secondArr.count - 1); + } + NSString *secondString = [secondArr objectAtIndex:index]; + NSString *secondUnit = self.showUnitType == BRShowUnitTypeAll ? [self getSecondUnit] : @""; + return [NSString stringWithFormat:@"%@%@", secondString, secondUnit]; +} + +- (NSString *)getWeekText:(NSArray *)weekArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, weekArr.count - 1); + } + NSString *weekString = [weekArr objectAtIndex:index]; + if ((self.lastRowContent && [weekString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [weekString isEqualToString:self.firstRowContent])) { + return weekString; + } + NSString *weekUnit = self.showUnitType == BRShowUnitTypeAll ? [self getWeekUnit] : @""; + return [NSString stringWithFormat:@"%@%@", weekString, weekUnit]; +} + +- (NSString *)getQuarterText:(NSArray *)quarterArr row:(NSInteger)row { + NSInteger index = 0; + if (row >= 0) { + index = MIN(row, quarterArr.count - 1); + } + NSString *quarterString = [quarterArr objectAtIndex:index]; + if ((self.lastRowContent && [quarterString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [quarterString isEqualToString:self.firstRowContent])) { + return quarterString; + } + NSString *quarterUnit = self.showUnitType == BRShowUnitTypeAll ? [self getQuarterUnit] : @""; + return [NSString stringWithFormat:@"%@%@", quarterString, quarterUnit]; +} + +- (NSString *)getAMText { + return [NSBundle br_localizedStringForKey:@"上午" language:self.pickerStyle.language]; +} + +- (NSString *)getPMText { + return [NSBundle br_localizedStringForKey:@"下午" language:self.pickerStyle.language]; +} + +- (NSString *)getYearUnit { + if (self.customUnit) { + return self.customUnit[@"year"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"年" language:self.pickerStyle.language]; +} + +- (NSString *)getMonthUnit { + if (self.customUnit) { + return self.customUnit[@"month"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"月" language:self.pickerStyle.language]; +} + +- (NSString *)getDayUnit { + if (self.customUnit) { + return self.customUnit[@"day"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"日" language:self.pickerStyle.language]; +} + +- (NSString *)getHourUnit { + if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) { + return @""; + } + if (self.customUnit) { + return self.customUnit[@"hour"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"时" language:self.pickerStyle.language]; +} + +- (NSString *)getMinuteUnit { + if (self.customUnit) { + return self.customUnit[@"minute"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"分" language:self.pickerStyle.language]; +} + +- (NSString *)getSecondUnit { + if (self.customUnit) { + return self.customUnit[@"second"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"秒" language:self.pickerStyle.language]; +} + +- (NSString *)getWeekUnit { + if (self.customUnit) { + return self.customUnit[@"week"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"周" language:self.pickerStyle.language]; +} + +- (NSString *)getQuarterUnit { + if (self.customUnit) { + return self.customUnit[@"quarter"] ? : @""; + } + if (![self.pickerStyle.language hasPrefix:@"zh"]) { + return @""; + } + return [NSBundle br_localizedStringForKey:@"季度" language:self.pickerStyle.language]; +} + +- (NSInteger)getIndexWithArray:(NSArray *)array object:(NSString *)obj { + if (!array || array.count == 0 || !obj) { + return 0; + } + if ([array containsObject:obj]) { + return [array indexOfObject:obj]; + } + return 0; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.h new file mode 100755 index 0000000..db1635d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.h @@ -0,0 +1,274 @@ +// +// BRDatePickerView.h +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRBaseView.h" +#import "NSDate+BRPickerView.h" + +NS_ASSUME_NONNULL_BEGIN + +/// 日期选择器格式 +typedef NS_ENUM(NSInteger, BRDatePickerMode) { + // ----- 以下4种是系统样式(兼容国际化日期格式) ----- + /** 【yyyy-MM-dd】UIDatePickerModeDate(美式日期:MM-dd-yyyy;英式日期:dd-MM-yyyy)*/ + BRDatePickerModeDate, + /** 【yyyy-MM-dd HH:mm】 UIDatePickerModeDateAndTime */ + BRDatePickerModeDateAndTime, + /** 【HH:mm】UIDatePickerModeTime */ + BRDatePickerModeTime, + /** 【HH:mm】UIDatePickerModeCountDownTimer */ + BRDatePickerModeCountDownTimer, + + // ----- 以下14种是自定义样式 ----- + /** 【yyyy-MM-dd HH:mm:ss】年月日时分秒 */ + BRDatePickerModeYMDHMS, + /** 【yyyy-MM-dd HH:mm】年月日时分 */ + BRDatePickerModeYMDHM, + /** 【yyyy-MM-dd HH】年月日时 */ + BRDatePickerModeYMDH, + /** 【MM-dd HH:mm】月日时分 */ + BRDatePickerModeMDHM, + /** 【yyyy-MM-dd】年月日(兼容国际化日期:dd-MM-yyyy)*/ + BRDatePickerModeYMD, + /** 【yyyy-MM】年月(兼容国际化日期:MM-yyyy)*/ + BRDatePickerModeYM, + /** 【yyyy】年 */ + BRDatePickerModeY, + /** 【MM-dd】月日 */ + BRDatePickerModeMD, + /** 【HH:mm:ss】时分秒 */ + BRDatePickerModeHMS, + /** 【HH:mm】时分 */ + BRDatePickerModeHM, + /** 【mm:ss】分秒 */ + BRDatePickerModeMS, + + /** 【yyyy-qq】年季度 */ + BRDatePickerModeYQ, + /** 【yyyy-MM-ww】年月周 */ + BRDatePickerModeYMW, + /** 【yyyy-ww】年周 */ + BRDatePickerModeYW +}; + +/// 日期单位显示的位置 +typedef NS_ENUM(NSInteger, BRShowUnitType) { + /** 日期单位显示全部行(默认)*/ + BRShowUnitTypeAll, + /** 日期单位仅显示中间行 */ + BRShowUnitTypeOnlyCenter, + /** 日期单位不显示(隐藏日期单位)*/ + BRShowUnitTypeNone +}; + +typedef void (^BRDateResultBlock)(NSDate * _Nullable selectDate, NSString * _Nullable selectValue); + +typedef void (^BRDateResultRangeBlock)(NSDate * _Nullable selectStartDate, NSDate * _Nullable selectEndDate, NSString * _Nullable selectValue); + +@interface BRDatePickerView : BRBaseView + +/** + ////////////////////////////////////////////////////////////////////////// + /// + /// 【用法一】 + /// 特点:灵活,扩展性强(推荐使用!) + /// + ////////////////////////////////////////////////////////////////////////*/ + +/** 日期选择器显示类型 */ +@property (nonatomic, assign) BRDatePickerMode pickerMode; + +/** 设置选中的日期(推荐使用 selectDate) */ +@property (nullable, nonatomic, strong) NSDate *selectDate; +@property (nullable, nonatomic, copy) NSString *selectValue; + +/** 最小日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)*/ +@property (nullable, nonatomic, strong) NSDate *minDate; +/** 最大日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)*/ +@property (nullable, nonatomic, strong) NSDate *maxDate; + +/** 选择结果的回调 */ +@property (nullable, nonatomic, copy) BRDateResultBlock resultBlock; +/** 选择结果范围的回调:for `BRDatePickerModeYQ`、`BRDatePickerModeYMW`、`BRDatePickerModeYW`, ignored otherwise. */ +@property (nullable, nonatomic, copy) BRDateResultRangeBlock resultRangeBlock; + +/** 滚动选择时触发的回调 */ +@property (nullable, nonatomic, copy) BRDateResultBlock changeBlock; +/** 滚动选择范围时触发的回调:for `BRDatePickerModeYQ`、`BRDatePickerModeYMW`、`BRDatePickerModeYW`, ignored otherwise. */ +@property (nullable, nonatomic, copy) BRDateResultRangeBlock changeRangeBlock; + +/** 日期单位显示类型 */ +@property (nonatomic, assign) BRShowUnitType showUnitType; + +/** 是否显示【星期】,默认为 NO */ +@property (nonatomic, assign, getter=isShowWeek) BOOL showWeek; + +/** 是否显示【今天】,默认为 NO */ +@property (nonatomic, assign, getter=isShowToday) BOOL showToday; + +/** 是否添加【至今】,默认为 NO */ +@property (nonatomic, assign, getter=isAddToNow) BOOL addToNow; + +/** 首行添加【自定义字符串】,配合 selectValue 可设置默认选中 */ +@property (nullable, nonatomic, copy) NSString *firstRowContent; + +/** 末行添加【自定义字符串】,配合 selectValue 可设置默认选中 */ +@property (nullable, nonatomic, copy) NSString *lastRowContent; + +/** 最后一行,添加【自定义字符串】 */ +@property (nullable, nonatomic, copy) NSString *addCustomString DEPRECATED_MSG_ATTRIBUTE("Use 'lastRowContent' instead"); + +/** 滚轮上日期数据排序是否降序,默认为 NO(升序)*/ +@property (nonatomic, assign, getter=isDescending) BOOL descending; + +/** 选择器上数字是否带有前导零,默认为 NO(如:无前导零:2020-1-1;有前导零:2020-01-01)*/ +@property (nonatomic, assign, getter=isNumberFullName) BOOL numberFullName; + +/** 设置分的时间间隔,默认为1(范围:1 ~ 30)*/ +@property (nonatomic, assign) NSInteger minuteInterval; + +/** 设置秒的时间间隔,默认为1(范围:1 ~ 30)*/ +@property (nonatomic, assign) NSInteger secondInterval; + +/** 设置倒计时的时长,默认为0(范围:0 ~ 24*60*60-1,单位为秒) for `BRDatePickerModeCountDownTimer`, ignored otherwise. */ +@property (nonatomic, assign) NSTimeInterval countDownDuration; + +/** + * 自定义月份数据源 + * 如:@[@"1月", @"2月",..., @"12月"]、 @[@"一月", @"二月",..., @"十二月"]、 @[@"Jan", @"Feb",..., @"Dec"] 等 + */ +@property (nonatomic, copy) NSArray *monthNames; + +/** + * 设置国际化日期(非中文环境下)月份是否显示简称,默认为 NO。for `BRDatePickerModeYMD` and `BRDatePickerModeYM`, ignored otherwise. + * 如:January 的简称为:Jan + */ +@property (nonatomic, assign, getter=isShortMonthName) BOOL shortMonthName; + +/** + * 自定义日期单位 + * 字典格式:@{@"year": @"年", @"month": @"月", @"day": @"日", @"hour": @"时", @"minute": @"分", @"second": @"秒"} + */ +@property (nonatomic, copy) NSDictionary *customUnit; + +/** 显示上午和下午,默认为 NO. for `BRDatePickerModeYMDH`, ignored otherwise. */ +@property (nonatomic, assign, getter=isShowAMAndPM) BOOL showAMAndPM; + +/** 设置时区,默认为当前时区 */ +@property (nullable, nonatomic, copy) NSTimeZone *timeZone; + +/** default is [NSCalendar currentCalendar]. setting nil returns to default. for `UIDatePicker` */ +@property (nonatomic, copy) NSCalendar *calendar; + +/** 指定不允许选择的日期 */ +@property (nullable, nonatomic, copy) NSArray *nonSelectableDates; + +/** 不允许选择日期的回调 */ +@property (nullable, nonatomic, copy) BRDateResultBlock nonSelectableBlock; + +/// 初始化日期选择器 +/// @param pickerMode 日期选择器显示类型 +- (instancetype)initWithPickerMode:(BRDatePickerMode)pickerMode; + +/// 弹出选择器视图 +- (void)show; + +/// 关闭选择器视图 +- (void)dismiss; + + + + +//================================================= 华丽的分割线 ================================================= + + + + +/** + ////////////////////////////////////////////////////////////////////////// + /// + /// 【用法二】:快捷使用,直接选择下面其中的一个方法进行使用 + /// 特点:快捷,方便 + /// + ////////////////////////////////////////////////////////////////////////*/ + +/** + * 1.显示日期选择器 + * + * @param mode 日期显示类型 + * @param title 选择器标题 + * @param selectValue 默认选中的日期(默认选中当前日期) + * @param resultBlock 选择结果的回调 + * + */ ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(nullable NSString *)title + selectValue:(nullable NSString *)selectValue + resultBlock:(nullable BRDateResultBlock)resultBlock; + +/** + * 2.显示日期选择器 + * + * @param mode 日期显示类型 + * @param title 选择器标题 + * @param selectValue 默认选中的日期(默认选中当前日期) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择结果的回调 + * + */ ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(nullable NSString *)title + selectValue:(nullable NSString *)selectValue + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRDateResultBlock)resultBlock; + +/** + * 3.显示日期选择器 + * + * @param mode 日期显示类型 + * @param title 选择器标题 + * @param selectValue 默认选中的日期(默认选中当前日期) + * @param minDate 最小日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建) + * @param maxDate 最大日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择结果的回调 + * + */ ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(nullable NSString *)title + selectValue:(nullable NSString *)selectValue + minDate:(nullable NSDate *)minDate + maxDate:(nullable NSDate *)maxDate + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRDateResultBlock)resultBlock; + +/** + * 3.显示日期选择器 + * + * @param mode 日期显示类型 + * @param title 选择器标题 + * @param selectValue 默认选中的日期(默认选中当前日期) + * @param minDate 最小日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建) + * @param maxDate 最大日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择结果的回调 + * @param resultRangeBlock 范围选择结果的回调 + * + */ ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(nullable NSString *)title + selectValue:(nullable NSString *)selectValue + minDate:(nullable NSDate *)minDate + maxDate:(nullable NSDate *)maxDate + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRDateResultBlock)resultBlock + resultRangeBlock:(nullable BRDateResultRangeBlock)resultRangeBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.m new file mode 100755 index 0000000..9ed9ddd --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.m @@ -0,0 +1,1965 @@ +// +// BRDatePickerView.m +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRDatePickerView.h" +#import "NSBundle+BRPickerView.h" +#import "BRDatePickerView+BR.h" + +/// 日期选择器的类型 +typedef NS_ENUM(NSInteger, BRDatePickerStyle) { + BRDatePickerStyleSystem, // 系统样式:使用 UIDatePicker + BRDatePickerStyleCustom // 自定义样式:使用 UIPickerView +}; + +@interface BRDatePickerView () +{ + UIDatePickerMode _datePickerMode; + UIView *_containerView; + BOOL _isAdjustSelectRow; // 设置minDate时,调整日期联动的选择(解决日期选择器联动不正确的问题) +} +/** 日期选择器1 */ +@property (nonatomic, strong) UIDatePicker *datePicker; +/** 日期选择器2 */ +@property (nonatomic, strong) UIPickerView *pickerView; + +/// 日期存储数组 +@property(nonatomic, copy) NSArray *yearArr; +@property(nonatomic, copy) NSArray *monthArr; +@property(nonatomic, copy) NSArray *dayArr; +@property(nonatomic, copy) NSArray *hourArr; +@property(nonatomic, copy) NSArray *minuteArr; +@property(nonatomic, copy) NSArray *secondArr; + +/// 月周、年周、季度数组 +@property(nonatomic, copy) NSArray *monthWeekArr; +@property(nonatomic, copy) NSArray *yearWeekArr; +@property(nonatomic, copy) NSArray *quarterArr; + +/// 记录 年、月、日、时、分、秒 当前选择的位置 +@property(nonatomic, assign) NSInteger yearIndex; +@property(nonatomic, assign) NSInteger monthIndex; +@property(nonatomic, assign) NSInteger dayIndex; +@property(nonatomic, assign) NSInteger hourIndex; +@property(nonatomic, assign) NSInteger minuteIndex; +@property(nonatomic, assign) NSInteger secondIndex; + +/// 月周、年周、季度 当前选择的位置 +@property(nonatomic, assign) NSInteger monthWeekIndex; +@property(nonatomic, assign) NSInteger yearWeekIndex; +@property(nonatomic, assign) NSInteger quarterIndex; + +// 记录选择的值 +@property (nonatomic, strong) NSDate *mSelectDate; +@property (nonatomic, copy) NSString *mSelectValue; + +/** 日期选择器的类型 */ +@property (nonatomic, assign) BRDatePickerStyle style; +/** 日期的格式 */ +@property (nonatomic, copy) NSString *dateFormatter; +/** 单位数组 */ +@property (nonatomic, copy) NSArray *unitArr; +/** 单位label数组 */ +@property (nonatomic, copy) NSArray *unitLabelArr; + +@end + +@implementation BRDatePickerView + +#pragma mark - 1.显示日期选择器 ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(NSString *)title + selectValue:(NSString *)selectValue + resultBlock:(BRDateResultBlock)resultBlock { + [self showDatePickerWithMode:mode title:title selectValue:selectValue minDate:nil maxDate:nil isAutoSelect:NO resultBlock:resultBlock]; +} + +#pragma mark - 2.显示日期选择器 ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(NSString *)title + selectValue:(NSString *)selectValue + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRDateResultBlock)resultBlock { + [self showDatePickerWithMode:mode title:title selectValue:selectValue minDate:nil maxDate:nil isAutoSelect:isAutoSelect resultBlock:resultBlock]; +} + +#pragma mark - 3.显示日期选择器 ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(NSString *)title + selectValue:(NSString *)selectValue + minDate:(NSDate *)minDate + maxDate:(NSDate *)maxDate + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRDateResultBlock)resultBlock { + [self showDatePickerWithMode:mode title:title selectValue:selectValue minDate:nil maxDate:nil isAutoSelect:isAutoSelect resultBlock:resultBlock resultRangeBlock:nil]; +} + +#pragma mark - 4.显示日期选择器 ++ (void)showDatePickerWithMode:(BRDatePickerMode)mode + title:(NSString *)title + selectValue:(NSString *)selectValue + minDate:(NSDate *)minDate + maxDate:(NSDate *)maxDate + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRDateResultBlock)resultBlock + resultRangeBlock:(BRDateResultRangeBlock)resultRangeBlock { + // 创建日期选择器 + BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; + datePickerView.pickerMode = mode; + datePickerView.title = title; + datePickerView.selectValue = selectValue; + datePickerView.minDate = minDate; + datePickerView.maxDate = maxDate; + datePickerView.isAutoSelect = isAutoSelect; + datePickerView.resultBlock = resultBlock; + datePickerView.resultRangeBlock = resultRangeBlock; + // 显示 + [datePickerView show]; +} + +#pragma mark - 初始化日期选择器 +- (instancetype)initWithPickerMode:(BRDatePickerMode)pickerMode { + if (self = [super init]) { + self.pickerMode = pickerMode; + } + return self; +} + +#pragma mark - 处理选择器数据 +- (void)handlerPickerData { + // 1.最小日期限制 + self.minDate = [self handlerMinDate:self.minDate]; + // 2.最大日期限制 + self.maxDate = [self handlerMaxDate:self.maxDate]; + + BOOL minMoreThanMax = [self br_compareDate:self.minDate targetDate:self.maxDate dateFormat:self.dateFormatter] == NSOrderedDescending; + NSAssert(!minMoreThanMax, @"最小日期不能大于最大日期!"); + if (minMoreThanMax) { + // 如果最小日期大于了最大日期,就忽略两个值 + self.minDate = [NSDate distantPast]; // 0000-12-30 00:00:00 +0000 + self.maxDate = [NSDate distantFuture]; // 4001-01-01 00:00:00 +0000 + } + + // 3.默认选中的日期 + self.mSelectDate = [self handlerSelectDate:self.selectDate dateFormat:self.dateFormatter]; + + // 4.设置选择器日期数据 + if (self.style == BRDatePickerStyleCustom) { + [self setupDateArray]; + } + + if (self.selectValue && ([self.selectValue isEqualToString:self.lastRowContent] || [self.selectValue isEqualToString:self.firstRowContent])) { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + } else { + if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) { + self.hourIndex = (self.mSelectDate.br_hour < 12 ? 0 : 1); + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %@", (int)self.mSelectDate.br_year, (int)self.mSelectDate.br_month, (int)self.mSelectDate.br_day, [self getHourString]]; + } else { + self.mSelectValue = [self br_stringFromDate:self.mSelectDate dateFormat:self.dateFormatter]; + } + } +} + +#pragma mark - 设置默认日期数据源 +- (void)setupDateArray { + if (self.selectValue && ([self.selectValue isEqualToString:self.lastRowContent] || [self.selectValue isEqualToString:self.firstRowContent])) { + switch (self.pickerMode) { + case BRDatePickerModeYMDHMS: + case BRDatePickerModeYMDHM: + case BRDatePickerModeYMDH: + case BRDatePickerModeYMD: + case BRDatePickerModeYM: + case BRDatePickerModeY: + { + self.yearArr = [self getYearArr]; + self.monthArr = nil; + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = nil; + self.quarterArr = nil; + } + break; + case BRDatePickerModeMDHM: + case BRDatePickerModeMD: + { + self.yearArr = [self getYearArr]; + self.monthArr = [self getMonthArr:self.mSelectDate.br_year]; + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = nil; + self.quarterArr = nil; + } + break; + case BRDatePickerModeHMS: + case BRDatePickerModeHM: + { + self.yearArr = [self getYearArr]; + self.monthArr = [self getMonthArr:self.mSelectDate.br_year]; + self.dayArr = [self getDayArr:self.mSelectDate.br_year month:self.mSelectDate.br_month]; + self.hourArr = [self getHourArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day]; + self.minuteArr = nil; + self.secondArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = nil; + self.quarterArr = nil; + } + break; + case BRDatePickerModeMS: + { + self.yearArr = [self getYearArr]; + self.monthArr = [self getMonthArr:self.mSelectDate.br_year]; + self.dayArr = [self getDayArr:self.mSelectDate.br_year month:self.mSelectDate.br_month]; + self.hourArr = [self getHourArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day]; + self.minuteArr = [self getMinuteArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day hour:self.mSelectDate.br_hour]; + self.secondArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = nil; + self.quarterArr = nil; + } + break; + case BRDatePickerModeYMW: + { + self.yearArr = [self getYearArr]; + self.monthArr = [self getMonthArr:self.mSelectDate.br_year]; + self.monthWeekArr = [self getMonthWeekArr:self.mSelectDate.br_year month:self.mSelectDate.br_month]; + self.yearWeekArr = nil; + self.quarterArr = nil; + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + } + break; + case BRDatePickerModeYW: + { + self.yearArr = [self getYearArr]; + self.monthArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = [self getYearWeekArr:self.mSelectDate.br_year]; + self.quarterArr = nil; + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + } + break; + case BRDatePickerModeYQ: + { + self.yearArr = [self getYearArr]; + self.monthArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = nil; + self.quarterArr = [self getQuarterArr:self.mSelectDate.br_year];; + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + } + break; + + default: + break; + } + } else { + self.yearArr = [self getYearArr]; + self.monthArr = [self getMonthArr:self.mSelectDate.br_year]; + self.dayArr = [self getDayArr:self.mSelectDate.br_year month:self.mSelectDate.br_month]; + self.hourArr = [self getHourArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day]; + self.minuteArr = [self getMinuteArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day hour:self.mSelectDate.br_hour]; + self.secondArr = [self getSecondArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day hour:self.mSelectDate.br_hour minute:self.mSelectDate.br_minute]; + + self.monthWeekArr = [self getMonthWeekArr:self.mSelectDate.br_year month:self.mSelectDate.br_month]; + self.yearWeekArr = [self getYearWeekArr:self.mSelectDate.br_year]; + self.quarterArr = [self getQuarterArr:self.mSelectDate.br_year]; + } +} + +- (void)setupDateFormatter:(BRDatePickerMode)mode { + switch (mode) { + case BRDatePickerModeDate: + { + self.dateFormatter = @"yyyy-MM-dd"; + self.style = BRDatePickerStyleSystem; + _datePickerMode = UIDatePickerModeDate; + } + break; + case BRDatePickerModeDateAndTime: + { + self.dateFormatter = @"yyyy-MM-dd HH:mm"; + self.style = BRDatePickerStyleSystem; + _datePickerMode = UIDatePickerModeDateAndTime; + } + break; + case BRDatePickerModeTime: + { + self.dateFormatter = @"HH:mm"; + self.style = BRDatePickerStyleSystem; + _datePickerMode = UIDatePickerModeTime; + } + break; + case BRDatePickerModeCountDownTimer: + { + self.dateFormatter = @"HH:mm"; + self.style = BRDatePickerStyleSystem; + _datePickerMode = UIDatePickerModeCountDownTimer; + } + break; + + case BRDatePickerModeYMDHMS: + { + self.dateFormatter = @"yyyy-MM-dd HH:mm:ss"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit], [self getHourUnit], [self getMinuteUnit], [self getSecondUnit]]; + } + break; + case BRDatePickerModeYMDHM: + { + self.dateFormatter = @"yyyy-MM-dd HH:mm"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit], [self getHourUnit], [self getMinuteUnit]]; + } + break; + case BRDatePickerModeYMDH: + { + self.dateFormatter = @"yyyy-MM-dd HH"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit], self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM ? @"" : [self getHourUnit]]; + } + break; + case BRDatePickerModeMDHM: + { + self.dateFormatter = @"MM-dd HH:mm"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getMonthUnit], [self getDayUnit], [self getHourUnit], [self getMinuteUnit]]; + } + break; + case BRDatePickerModeYMD: + { + self.dateFormatter = @"yyyy-MM-dd"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit]]; + } + break; + case BRDatePickerModeYM: + { + self.dateFormatter = @"yyyy-MM"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getMonthUnit]]; + } + break; + case BRDatePickerModeY: + { + self.dateFormatter = @"yyyy"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit]]; + } + break; + case BRDatePickerModeMD: + { + self.dateFormatter = @"MM-dd"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getMonthUnit], [self getDayUnit]]; + } + break; + case BRDatePickerModeHMS: + { + self.dateFormatter = @"HH:mm:ss"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getHourUnit], [self getMinuteUnit], [self getSecondUnit]]; + } + break; + case BRDatePickerModeHM: + { + self.dateFormatter = @"HH:mm"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getHourUnit], [self getMinuteUnit]]; + } + break; + case BRDatePickerModeMS: + { + self.dateFormatter = @"mm:ss"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getMinuteUnit], [self getSecondUnit]]; + } + break; + case BRDatePickerModeYMW: + { + self.dateFormatter = @"yyyy-MM-WW"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getWeekUnit]]; + } + break; + case BRDatePickerModeYW: + { + self.dateFormatter = @"yyyy-ww"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getWeekUnit]]; + } + break; + case BRDatePickerModeYQ: + { + self.dateFormatter = @"yyyy-qq"; + self.style = BRDatePickerStyleCustom; + self.unitArr = @[[self getYearUnit], [self getQuarterUnit]]; + } + break; + + default: + break; + } +} + +#pragma mark - 更新日期数据源数组 +- (void)reloadDateArrayWithUpdateMonth:(BOOL)updateMonth updateDay:(BOOL)updateDay updateHour:(BOOL)updateHour updateMinute:(BOOL)updateMinute updateSecond:(BOOL)updateSecond { + [self reloadDateArrayWithUpdateMonth:updateMonth updateDay:updateDay updateHour:updateHour updateMinute:updateMinute updateSecond:NO updateWeekOfMonth:NO updateWeekOfYear:NO updateQuarter:NO]; +} + +- (void)reloadDateArrayWithUpdateMonth:(BOOL)updateMonth updateDay:(BOOL)updateDay updateHour:(BOOL)updateHour updateMinute:(BOOL)updateMinute updateSecond:(BOOL)updateSecond + updateWeekOfMonth:(BOOL)updateWeekOfMonth updateWeekOfYear:(BOOL)updateWeekOfYear updateQuarter:(BOOL)updateQuarter { + _isAdjustSelectRow = NO; + // 1.更新 monthArr + if (self.yearArr.count == 0) { + return; + } + NSString *yearString = [self getYearString]; + if ((self.lastRowContent && [yearString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [yearString isEqualToString:self.firstRowContent])) { + self.monthArr = nil; + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + self.monthWeekArr = nil; + self.yearWeekArr = nil; + self.quarterArr = nil; + + return; + } + if (updateMonth) { + NSString *lastSelectMonth = [self getMDHMSNumber:self.mSelectDate.br_month]; + self.monthArr = [self getMonthArr:[yearString integerValue]]; + if (self.mSelectDate) { + if ([self.monthArr containsObject:lastSelectMonth]) { + NSInteger monthIndex = [self.monthArr indexOfObject:lastSelectMonth]; + if (monthIndex != self.monthIndex) { + _isAdjustSelectRow = YES; + self.monthIndex = monthIndex; + } + } else { + _isAdjustSelectRow = YES; + self.monthIndex = ([lastSelectMonth intValue] < [self.monthArr.firstObject intValue]) ? 0 : (self.monthArr.count - 1); + } + } + } + + // 1/1.更新 yearWeekArr + if (updateWeekOfYear) { + NSString *lastSelectWeekOfYear = [self getMDHMSNumber:self.mSelectDate.br_yearWeek]; + self.yearWeekArr = [self getYearWeekArr:[yearString integerValue]]; + if (self.mSelectDate) { + if ([self.yearWeekArr containsObject:lastSelectWeekOfYear]) { + NSInteger yearWeekIndex = [self.yearWeekArr indexOfObject:lastSelectWeekOfYear]; + if (yearWeekIndex != self.yearWeekIndex) { + _isAdjustSelectRow = YES; + self.monthIndex = yearWeekIndex; + } + } else { + _isAdjustSelectRow = YES; + self.yearWeekIndex = ([lastSelectWeekOfYear intValue] < [self.yearWeekArr.firstObject intValue]) ? 0 : (self.yearWeekArr.count - 1); + } + } + } + + // 1/1.更新 quarterArr + if (updateQuarter) { + NSString *lastSelectQuarter = [self getMDHMSNumber:self.mSelectDate.br_quarter]; + self.quarterArr = [self getQuarterArr:[yearString integerValue]]; + if (self.mSelectDate) { + if ([self.quarterArr containsObject:lastSelectQuarter]) { + NSInteger quarterIndex = [self.quarterArr indexOfObject:lastSelectQuarter]; + if (quarterIndex != self.quarterIndex) { + _isAdjustSelectRow = YES; + self.quarterIndex = quarterIndex; + } + } else { + _isAdjustSelectRow = YES; + self.quarterIndex = ([lastSelectQuarter intValue] < [self.quarterArr.firstObject intValue]) ? 0 : (self.quarterArr.count - 1); + } + } + } + + // 2.更新 dayArr + if (self.monthArr.count == 0) { + return; + } + NSString *monthString = [self getMonthString]; + if ((self.lastRowContent && [monthString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [monthString isEqualToString:self.firstRowContent])) { + self.dayArr = nil; + self.hourArr = nil; + self.minuteArr = nil; + self.secondArr = nil; + self.monthWeekArr = nil; + + return; + } + if (updateDay) { + NSString *lastSelectDay = [self getMDHMSNumber:self.mSelectDate.br_day]; + self.dayArr = [self getDayArr:[yearString integerValue] month:[monthString integerValue]]; + if (self.mSelectDate) { + if ([self.dayArr containsObject:lastSelectDay]) { + NSInteger dayIndex = [self.dayArr indexOfObject:lastSelectDay]; + if (dayIndex != self.dayIndex) { + _isAdjustSelectRow = YES; + self.dayIndex = dayIndex; + } + } else { + _isAdjustSelectRow = YES; + self.dayIndex = ([lastSelectDay intValue] < [self.dayArr.firstObject intValue]) ? 0 : (self.dayArr.count - 1); + } + } + } + + // 2/1.更新 monthWeekArr + if (updateWeekOfMonth) { + NSString *lastWeekOfMonth = [self getMDHMSNumber:self.mSelectDate.br_monthWeek]; + self.monthWeekArr = [self getMonthWeekArr:[yearString integerValue] month:[monthString integerValue]]; + if (self.mSelectDate) { + if ([self.monthWeekArr containsObject:lastWeekOfMonth]) { + NSInteger monthWeekIndex = [self.monthWeekArr indexOfObject:lastWeekOfMonth]; + if (monthWeekIndex != self.monthWeekIndex) { + _isAdjustSelectRow = YES; + self.monthWeekIndex = monthWeekIndex; + } + } else { + _isAdjustSelectRow = YES; + self.monthWeekIndex = ([lastWeekOfMonth intValue] < [self.monthWeekArr.firstObject intValue]) ? 0 : (self.monthWeekArr.count - 1); + } + } + } + + // 3.更新 hourArr + if (self.dayArr.count == 0) { + return; + } + NSInteger day = [[self getDayString] integerValue]; + if (updateHour) { + NSString *lastSelectHour = [self getMDHMSNumber:self.mSelectDate.br_hour]; + self.hourArr = [self getHourArr:[yearString integerValue] month:[monthString integerValue] day:day]; + if (self.mSelectDate) { + if ([self.hourArr containsObject:lastSelectHour]) { + NSInteger hourIndex = [self.hourArr indexOfObject:lastSelectHour]; + if (hourIndex != self.hourIndex) { + _isAdjustSelectRow = YES; + self.hourIndex = hourIndex; + } + } else { + _isAdjustSelectRow = YES; + self.hourIndex = ([lastSelectHour intValue] < [self.hourArr.firstObject intValue]) ? 0 : (self.hourArr.count - 1); + } + } + } + + // 4.更新 minuteArr + if (self.hourArr.count == 0) { + return; + } + NSString *hourString = [self getHourString]; + if ((self.lastRowContent && [hourString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [hourString isEqualToString:self.firstRowContent])) { + self.minuteArr = nil; + self.secondArr = nil; + + return; + } + if (updateMinute) { + NSString *lastSelectMinute = [self getMDHMSNumber:self.mSelectDate.br_minute]; + self.minuteArr = [self getMinuteArr:[yearString integerValue] month:[monthString integerValue] day:day hour:[hourString integerValue]]; + if (self.mSelectDate) { + if ([self.minuteArr containsObject:lastSelectMinute]) { + NSInteger minuteIndex = [self.minuteArr indexOfObject:lastSelectMinute]; + if (minuteIndex != self.minuteIndex) { + _isAdjustSelectRow = YES; + self.minuteIndex = minuteIndex; + } + } else { + _isAdjustSelectRow = YES; + self.minuteIndex = ([lastSelectMinute intValue] < [self.minuteArr.firstObject intValue]) ? 0 : (self.minuteArr.count - 1); + } + } + } + + // 5.更新 secondArr + if (self.minuteArr.count == 0) { + return; + } + NSString *minuteString = [self getMinuteString]; + if ((self.lastRowContent && [minuteString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [minuteString isEqualToString:self.firstRowContent])) { + self.secondArr = nil; + return; + } + if (updateSecond) { + NSString *lastSelectSecond = [self getMDHMSNumber:self.mSelectDate.br_second]; + self.secondArr = [self getSecondArr:[yearString integerValue] month:[monthString integerValue] day:day hour:[hourString integerValue] minute:[minuteString integerValue]]; + if (self.mSelectDate) { + if ([self.secondArr containsObject:lastSelectSecond]) { + NSInteger secondIndex = [self.secondArr indexOfObject:lastSelectSecond]; + if (secondIndex != self.secondIndex) { + _isAdjustSelectRow = YES; + self.secondIndex = secondIndex; + } + } else { + _isAdjustSelectRow = YES; + self.secondIndex = ([lastSelectSecond intValue] < [self.secondArr.firstObject intValue]) ? 0 : (self.secondArr.count - 1); + } + } + } +} + +#pragma mark - 滚动到指定日期的位置(更新选择的索引) +- (void)scrollToSelectDate:(NSDate *)selectDate animated:(BOOL)animated { + self.yearIndex = [self getIndexWithArray:self.yearArr object:[self getYearNumber:selectDate.br_year]]; + self.monthIndex = [self getIndexWithArray:self.monthArr object:[self getMDHMSNumber:selectDate.br_month]]; + self.dayIndex = [self getIndexWithArray:self.dayArr object:[self getMDHMSNumber:selectDate.br_day]]; + if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) { + self.hourIndex = selectDate.br_hour < 12 ? 0 : 1; + } else { + self.hourIndex = [self getIndexWithArray:self.hourArr object:[self getMDHMSNumber:selectDate.br_hour]]; + } + self.minuteIndex = [self getIndexWithArray:self.minuteArr object:[self getMDHMSNumber:selectDate.br_minute]]; + self.secondIndex = [self getIndexWithArray:self.secondArr object:[self getMDHMSNumber:selectDate.br_second]]; + + NSArray *indexArr = nil; + if (self.pickerMode == BRDatePickerModeYMDHMS) { + indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex), @(self.hourIndex), @(self.minuteIndex), @(self.secondIndex)]; + } else if (self.pickerMode == BRDatePickerModeYMDHM) { + indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex), @(self.hourIndex), @(self.minuteIndex)]; + } else if (self.pickerMode == BRDatePickerModeYMDH) { + indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex), @(self.hourIndex)]; + } else if (self.pickerMode == BRDatePickerModeMDHM) { + indexArr = @[@(self.monthIndex), @(self.dayIndex), @(self.hourIndex), @(self.minuteIndex)]; + } else if (self.pickerMode == BRDatePickerModeYMD) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex)]; + } else { + indexArr = @[@(self.dayIndex), @(self.monthIndex), @(self.yearIndex)]; + } + } else if (self.pickerMode == BRDatePickerModeYM) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + indexArr = @[@(self.yearIndex), @(self.monthIndex)]; + } else { + indexArr = @[@(self.monthIndex), @(self.yearIndex)]; + } + } else if (self.pickerMode == BRDatePickerModeY) { + indexArr = @[@(self.yearIndex)]; + } else if (self.pickerMode == BRDatePickerModeMD) { + indexArr = @[@(self.monthIndex), @(self.dayIndex)]; + } else if (self.pickerMode == BRDatePickerModeHMS) { + indexArr = @[@(self.hourIndex), @(self.minuteIndex), @(self.secondIndex)]; + } else if (self.pickerMode == BRDatePickerModeHM) { + indexArr = @[@(self.hourIndex), @(self.minuteIndex)]; + } else if (self.pickerMode == BRDatePickerModeMS) { + indexArr = @[@(self.minuteIndex), @(self.secondIndex)]; + } else if (self.pickerMode == BRDatePickerModeYMW) { + indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.monthWeekIndex)]; + } else if (self.pickerMode == BRDatePickerModeYW) { + indexArr = @[@(self.yearIndex), @(self.yearWeekIndex)]; + } else if (self.pickerMode == BRDatePickerModeYQ) { + indexArr = @[@(self.yearIndex), @(self.quarterIndex)]; + } + if (!indexArr) return; + for (NSInteger i = 0; i < indexArr.count; i++) { + [self.pickerView selectRow:[indexArr[i] integerValue] inComponent:i animated:animated]; + } +} + +#pragma mark - 滚动到【自定义字符串】的位置 +- (void)scrollToCustomString:(BOOL)animated { + switch (self.pickerMode) { + case BRDatePickerModeYMDHMS: + case BRDatePickerModeYMDHM: + case BRDatePickerModeYMDH: + case BRDatePickerModeYMD: + case BRDatePickerModeYM: + case BRDatePickerModeY: + case BRDatePickerModeYMW: + case BRDatePickerModeYW: + case BRDatePickerModeYQ: + { + NSInteger yearIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.yearArr.count > 0) ? self.yearArr.count - 1 : 0; + NSInteger component = 0; + if ((self.pickerMode == BRDatePickerModeYMD || self.pickerMode == BRDatePickerModeYMW) && ![self.pickerStyle.language hasPrefix:@"zh"]) { + component = 2; + } else if ((self.pickerMode == BRDatePickerModeYM || self.pickerMode == BRDatePickerModeYQ) && ![self.pickerStyle.language hasPrefix:@"zh"]) { + component = 1; + } + [self.pickerView selectRow:yearIndex inComponent:component animated:animated]; + } + break; + case BRDatePickerModeMDHM: + case BRDatePickerModeMD: + { + NSInteger monthIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.monthArr.count > 0) ? self.monthArr.count - 1 : 0; + [self.pickerView selectRow:monthIndex inComponent:0 animated:animated]; + } + break; + case BRDatePickerModeHMS: + case BRDatePickerModeHM: + { + NSInteger hourIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.hourArr.count > 0) ? self.hourArr.count - 1 : 0; + [self.pickerView selectRow:hourIndex inComponent:0 animated:animated]; + } + break; + case BRDatePickerModeMS: + { + NSInteger minuteIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.minuteArr.count > 0) ? self.minuteArr.count - 1 : 0; + [self.pickerView selectRow:minuteIndex inComponent:0 animated:animated]; + } + break; + + default: + break; + } +} + +#pragma mark - 日期选择器1 +- (UIDatePicker *)datePicker { + if (!_datePicker) { + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + _datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)]; + _datePicker.backgroundColor = self.pickerStyle.pickerColor; + _datePicker.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + // 滚动改变值的响应事件 + [_datePicker addTarget:self action:@selector(didSelectValueChanged:) forControlEvents:UIControlEventValueChanged]; + } + return _datePicker; +} + +#pragma mark - 日期选择器2 +- (UIPickerView *)pickerView { + if (!_pickerView) { + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)]; + _pickerView.backgroundColor = self.pickerStyle.pickerColor; + _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + _pickerView.dataSource = self; + _pickerView.delegate = self; + } + return _pickerView; +} + +#pragma mark - UIPickerViewDataSource +// 1.设置 pickerView 的列数 +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { + if (self.pickerMode == BRDatePickerModeYMDHMS) { + return 6; + } else if (self.pickerMode == BRDatePickerModeYMDHM) { + return 5; + } else if (self.pickerMode == BRDatePickerModeYMDH) { + return 4; + } else if (self.pickerMode == BRDatePickerModeMDHM) { + return 4; + } else if (self.pickerMode == BRDatePickerModeYMD) { + return 3; + } else if (self.pickerMode == BRDatePickerModeYM) { + return 2; + } else if (self.pickerMode == BRDatePickerModeY) { + return 1; + } else if (self.pickerMode == BRDatePickerModeMD) { + return 2; + } else if (self.pickerMode == BRDatePickerModeHMS) { + return 3; + } else if (self.pickerMode == BRDatePickerModeHM) { + return 2; + } else if (self.pickerMode == BRDatePickerModeMS) { + return 2; + } else if (self.pickerMode == BRDatePickerModeYMW) { + return 3; + } else if (self.pickerMode == BRDatePickerModeYW) { + return 2; + } else if (self.pickerMode == BRDatePickerModeYQ) { + return 2; + } + return 0; +} + +// 2.设置 pickerView 每列的行数 +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + NSArray *rowsArr = [NSArray array]; + if (self.pickerMode == BRDatePickerModeYMDHMS) { + rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count), @(self.minuteArr.count), @(self.secondArr.count)]; + } else if (self.pickerMode == BRDatePickerModeYMDHM) { + rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count), @(self.minuteArr.count)]; + } else if (self.pickerMode == BRDatePickerModeYMDH) { + rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count)]; + } else if (self.pickerMode == BRDatePickerModeMDHM) { + rowsArr = @[@(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count), @(self.minuteArr.count)]; + } else if (self.pickerMode == BRDatePickerModeYMD) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count)]; + } else { + rowsArr = @[@(self.dayArr.count), @(self.monthArr.count), @(self.yearArr.count)]; + } + } else if (self.pickerMode == BRDatePickerModeYM) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + rowsArr = @[@(self.yearArr.count), @(self.monthArr.count)]; + } else { + rowsArr = @[@(self.monthArr.count), @(self.yearArr.count)]; + } + } else if (self.pickerMode == BRDatePickerModeY) { + rowsArr = @[@(self.yearArr.count)]; + } else if (self.pickerMode == BRDatePickerModeMD) { + rowsArr = @[@(self.monthArr.count), @(self.dayArr.count)]; + } else if (self.pickerMode == BRDatePickerModeHMS) { + rowsArr = @[@(self.hourArr.count), @(self.minuteArr.count), @(self.secondArr.count)]; + } else if (self.pickerMode == BRDatePickerModeHM) { + rowsArr = @[@(self.hourArr.count), @(self.minuteArr.count)]; + } else if (self.pickerMode == BRDatePickerModeMS) { + rowsArr = @[@(self.minuteArr.count), @(self.secondArr.count)]; + } else if (self.pickerMode == BRDatePickerModeYMW) { + rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.monthWeekArr.count)]; + } else if (self.pickerMode == BRDatePickerModeYW) { + rowsArr = @[@(self.yearArr.count), @(self.yearWeekArr.count)]; + } else if (self.pickerMode == BRDatePickerModeYQ) { + rowsArr = @[@(self.yearArr.count), @(self.quarterArr.count)]; + } + if (component >= 0 && component < rowsArr.count) { + return [rowsArr[component] integerValue]; + } + return 0; +} + +#pragma mark - UIPickerViewDelegate +// 3. 设置 pickerView 的显示内容 +- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view { + // 1.自定义 row 的内容视图 + UILabel *label = (UILabel *)view; + if (!label) { + label = [[UILabel alloc]init]; + label.backgroundColor = [UIColor clearColor]; + label.textAlignment = NSTextAlignmentCenter; + label.font = self.pickerStyle.pickerTextFont; + label.textColor = self.pickerStyle.pickerTextColor; + // 字体自适应属性 + label.adjustsFontSizeToFitWidth = YES; + // 自适应最小字体缩放比例 + label.minimumScaleFactor = 0.5f; + } + label.text = [self pickerView:pickerView titleForRow:row forComponent:component]; + + // 2.设置选择器中间选中行的样式 + [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component]; + + return label; +} + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + NSString *titleString = @""; + if (self.pickerMode == BRDatePickerModeYMDHMS) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row]; + } else if (component == 1) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 2) { + titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate]; + } else if (component == 3) { + titleString = [self getHourText:self.hourArr row:row]; + } else if (component == 4) { + titleString = [self getMinuteText:self.minuteArr row:row]; + } else if (component == 5) { + titleString = [self getSecondText:self.secondArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYMDHM) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row]; + } else if (component == 1) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 2) { + titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate]; + } else if (component == 3) { + titleString = [self getHourText:self.hourArr row:row]; + } else if (component == 4) { + titleString = [self getMinuteText:self.minuteArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYMDH) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row];; + } else if (component == 1) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 2) { + titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate]; + } else if (component == 3) { + titleString = [self getHourText:self.hourArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeMDHM) { + if (component == 0) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 1) { + titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate]; + } else if (component == 2) { + titleString = [self getHourText:self.hourArr row:row]; + } else if (component == 3) { + titleString = [self getMinuteText:self.minuteArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYMD) { + if (component == 0) { + titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getYearText:self.yearArr row:row] : [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate]; + } else if (component == 1) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 2) { + titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate] : [self getYearText:self.yearArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYM) { + if (component == 0) { + titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getYearText:self.yearArr row:row] : [self getMonthText:self.monthArr row:row]; + } else if (component == 1) { + titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getMonthText:self.monthArr row:row] : [self getYearText:self.yearArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeY) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeMD) { + if (component == 0) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 1) { + titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate]; + } + } else if (self.pickerMode == BRDatePickerModeHMS) { + if (component == 0) { + titleString = [self getHourText:self.hourArr row:row]; + } else if (component == 1) { + titleString = [self getMinuteText:self.minuteArr row:row]; + } else if (component == 2) { + titleString = [self getSecondText:self.secondArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeHM) { + if (component == 0) { + titleString = [self getHourText:self.hourArr row:row]; + } else if (component == 1) { + titleString = [self getMinuteText:self.minuteArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeMS) { + if (component == 0) { + titleString = [self getMinuteText:self.minuteArr row:row]; + } else if (component == 1) { + titleString = [self getSecondText:self.secondArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYMW) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row]; + } else if (component == 1) { + titleString = [self getMonthText:self.monthArr row:row]; + } else if (component == 2) { + titleString = [self getWeekText:self.monthWeekArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYW) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row]; + } else if (component == 1) { + titleString = [self getWeekText:self.yearWeekArr row:row]; + } + } else if (self.pickerMode == BRDatePickerModeYQ) { + if (component == 0) { + titleString = [self getYearText:self.yearArr row:row]; + } else if (component == 1) { + titleString = [self getQuarterText:self.quarterArr row:row]; + } + } + + return titleString; +} + +// 4.滚动 pickerView 执行的回调方法 +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + NSString *lastSelectValue = self.mSelectValue; + NSDate *lastSelectDate = self.mSelectDate; + if (self.pickerMode == BRDatePickerModeYMDHMS) { + if (component == 0) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:YES updateMinute:YES updateSecond:YES]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + [self.pickerView reloadComponent:4]; + [self.pickerView reloadComponent:5]; + } else if (component == 1) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:YES updateSecond:YES]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + [self.pickerView reloadComponent:4]; + [self.pickerView reloadComponent:5]; + } else if (component == 2) { + self.dayIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:YES updateSecond:YES]; + [self.pickerView reloadComponent:3]; + [self.pickerView reloadComponent:4]; + [self.pickerView reloadComponent:5]; + } else if (component == 3) { + self.hourIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:YES]; + [self.pickerView reloadComponent:4]; + [self.pickerView reloadComponent:5]; + } else if (component == 4) { + self.minuteIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:YES]; + [self.pickerView reloadComponent:5]; + } else if (component == 5) { + self.secondIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count * self.minuteArr.count * self.secondArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int day = [[self getDayString] intValue]; + int hour = [[self getHourString] intValue]; + int minute = [[self getMinuteString] intValue]; + int second = [[self getSecondString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour minute:minute second:second]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeYMDHM) { + if (component == 0) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:YES updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + [self.pickerView reloadComponent:4]; + } else if (component == 1) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + [self.pickerView reloadComponent:4]; + } else if (component == 2) { + self.dayIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:3]; + [self.pickerView reloadComponent:4]; + } else if (component == 3) { + self.hourIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:4]; + } else if (component == 4) { + self.minuteIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count * self.minuteArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int day = [[self getDayString] intValue]; + int hour = [[self getHourString] intValue]; + int minute = [[self getMinuteString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour minute:minute]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %02d:%02d", year, month, day, hour, minute]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeYMDH) { + if (component == 0) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:YES updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + } else if (component == 1) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + } else if (component == 2) { + self.dayIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:3]; + } else if (component == 3) { + self.hourIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int day = [[self getDayString] intValue]; + int hour = 0; + if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) { + hour = (self.hourIndex == 0 ? 0 : 12); + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %@", year, month, day, [self getHourString]]; + } else { + hour = [[self getHourString] intValue]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %02d", year, month, day, hour]; + } + self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeMDHM) { + if (component == 0) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + } else if (component == 1) { + self.dayIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:2]; + [self.pickerView reloadComponent:3]; + } else if (component == 2) { + self.hourIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:3]; + } else if (component == 3) { + self.minuteIndex = row; + } + + NSString *monthString = [self getMonthString]; + if (![monthString isEqualToString:self.lastRowContent] && ![monthString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count * self.minuteArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int day = [[self getDayString] intValue]; + int hour = [[self getHourString] intValue]; + int minute = [[self getMinuteString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour minute:minute]; + self.mSelectValue = [NSString stringWithFormat:@"%02d-%02d %02d:%02d", month, day, hour, minute]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([monthString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([monthString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeYMD) { + if (component == 0) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + } else { + self.dayIndex = row; + } + } else if (component == 1) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO]; + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + [self.pickerView reloadComponent:2]; + } else { + [self.pickerView reloadComponent:0]; + } + } else if (component == 2) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + self.dayIndex = row; + } else { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:0]; + [self.pickerView reloadComponent:1]; + } + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.dayArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int day = [[self getDayString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month day:day]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d", year, month, day]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeYM) { + if (component == 0) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:1]; + } else { + self.monthIndex = row; + } + } else if (component == 1) { + if ([self.pickerStyle.language hasPrefix:@"zh"]) { + self.monthIndex = row; + } else { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:0]; + } + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d", year, month]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + } else if (self.pickerMode == BRDatePickerModeY) { + if (component == 0) { + self.yearIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count == 0) return; + int year = [[self getYearString] intValue]; + self.mSelectDate = [NSDate br_setYear:year]; + self.mSelectValue = [NSString stringWithFormat:@"%04d", year]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeMD) { + if (component == 0) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO]; + [self.pickerView reloadComponent:1]; + } else if (component == 1) { + self.dayIndex = row; + } + + NSString *monthString = [self getMonthString]; + if (![monthString isEqualToString:self.lastRowContent] && ![monthString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.dayArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int day = [[self getDayString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month day:day]; + self.mSelectValue = [NSString stringWithFormat:@"%02d-%02d", month, day]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([monthString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([monthString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeHMS) { + if (component == 0) { + self.hourIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:YES]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + } else if (component == 1) { + self.minuteIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:YES]; + [self.pickerView reloadComponent:2]; + } else if (component == 2) { + self.secondIndex = row; + } + + NSString *hourString = [self getHourString]; + if (![hourString isEqualToString:self.lastRowContent] && ![hourString isEqualToString:self.firstRowContent]) { + if (self.hourArr.count * self.minuteArr.count * self.secondArr.count == 0) return; + int hour = [[self getHourString] intValue]; + int minute = [[self getMinuteString] intValue]; + int second = [[self getSecondString] intValue]; + self.mSelectDate = [NSDate br_setHour:hour minute:minute second:second]; + self.mSelectValue = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, minute, second]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([hourString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([hourString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + + } else if (self.pickerMode == BRDatePickerModeHM) { + if (component == 0) { + self.hourIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:NO]; + [self.pickerView reloadComponent:1]; + } else if (component == 1) { + self.minuteIndex = row; + } + + NSString *hourString = [self getHourString]; + if (![hourString isEqualToString:self.lastRowContent] && ![hourString isEqualToString:self.firstRowContent]) { + if (self.hourArr.count * self.minuteArr.count == 0) return; + int hour = [[self getHourString] intValue]; + int minute = [[self getMinuteString] intValue]; + self.mSelectDate = [NSDate br_setHour:hour minute:minute]; + self.mSelectValue = [NSString stringWithFormat:@"%02d:%02d", hour, minute]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([hourString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([hourString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + } else if (self.pickerMode == BRDatePickerModeMS) { + if (component == 0) { + self.minuteIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:YES]; + [self.pickerView reloadComponent:1]; + } else if (component == 1) { + self.secondIndex = row; + } + + NSString *minuteString = [self getMinuteString]; + if (![minuteString isEqualToString:self.lastRowContent] && ![minuteString isEqualToString:self.firstRowContent]) { + if (self.minuteArr.count * self.secondArr.count == 0) return; + int minute = [[self getMinuteString] intValue]; + int second = [[self getSecondString] intValue]; + self.mSelectDate = [NSDate br_setMinute:minute second:second]; + self.mSelectValue = [NSString stringWithFormat:@"%02d:%02d", minute, second]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([minuteString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([minuteString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + } else if (self.pickerMode == BRDatePickerModeYMW) { + if (component == 0) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:YES updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:YES updateWeekOfYear:NO updateQuarter:NO]; + [self.pickerView reloadComponent:1]; + [self.pickerView reloadComponent:2]; + } else if (component == 1) { + self.monthIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:YES updateWeekOfYear:NO updateQuarter:NO]; + [self.pickerView reloadComponent:2]; + } else if (component == 2) { + self.monthWeekIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.monthWeekArr.count == 0) return; + int year = [[self getYearString] intValue]; + int month = [[self getMonthString] intValue]; + int week = [[self getMonthWeekString] intValue]; + self.mSelectDate = [NSDate br_setYear:year month:month weekOfMonth:week]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d", year, month, week]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + } else if (self.pickerMode == BRDatePickerModeYW) { + if (component == 0) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:NO updateWeekOfYear:YES updateQuarter:NO]; + [self.pickerView reloadComponent:1]; + } else if (component == 1) { + self.yearWeekIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.monthWeekArr.count == 0) return; + int year = [[self getYearString] intValue]; + int week = [[self getYearWeekString] intValue]; + self.mSelectDate = [NSDate br_setYear:year weekOfYear:week]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d", year, week]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + } else if (self.pickerMode == BRDatePickerModeYQ) { + if (component == 0) { + self.yearIndex = row; + [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:NO updateWeekOfYear:NO updateQuarter:YES]; + [self.pickerView reloadComponent:1]; + } else if (component == 1) { + self.quarterIndex = row; + } + + NSString *yearString = [self getYearString]; + if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) { + if (self.yearArr.count * self.monthArr.count * self.monthWeekArr.count == 0) return; + int year = [[self getYearString] intValue]; + int quarter = [[self getQuarterString] intValue]; + self.mSelectDate = [NSDate br_setYear:year quarter:quarter]; + self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d", year, quarter]; + } else { + self.mSelectDate = self.addToNow ? [NSDate date] : nil; + if ([yearString isEqualToString:self.lastRowContent]) { + self.mSelectValue = self.lastRowContent; + } else if ([yearString isEqualToString:self.firstRowContent]) { + self.mSelectValue = self.firstRowContent; + } + } + } + + // 纠正选择日期(解决:由【自定义字符串】滚动到 其它日期时,或设置 minDate,日期联动不正确问题) + BOOL isLastRowContent = [lastSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.firstRowContent]; + BOOL isFirstRowContent = [lastSelectValue isEqualToString:self.firstRowContent] && ![self.mSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.firstRowContent]; + if (isLastRowContent || isFirstRowContent || _isAdjustSelectRow) { + [self scrollToSelectDate:self.mSelectDate animated:NO]; + } + + // 禁止选择日期:回滚到上次选择的日期 + if (self.nonSelectableDates && self.nonSelectableDates.count > 0 && ![self.mSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.firstRowContent]) { + for (NSDate *date in self.nonSelectableDates) { + if ([self br_compareDate:date targetDate:self.mSelectDate dateFormat:self.dateFormatter] == NSOrderedSame) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + // 如果当前的日期不可选择,就回滚到上次选择的日期 + [self scrollToSelectDate:lastSelectDate animated:YES]; + }); + // 不可选择日期的回调 + if (self.nonSelectableBlock) { + self.nonSelectableBlock(self.mSelectDate, self.mSelectValue); + } + self.mSelectDate = lastSelectDate; + self.mSelectValue = lastSelectValue; + break; + } + } + } + + // 滚动选择时执行 changeBlock 回调 + if (self.changeBlock) { + self.changeBlock(self.mSelectDate, self.mSelectValue); + } + + // 滚动选择范围时执行 changeBlock 回调 + if (self.changeRangeBlock) { + self.changeRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue); + } + + // 设置自动选择时,滚动选择时就执行 resultBlock + if (self.isAutoSelect) { + // 滚动完成后,执行block回调 + if (self.resultBlock) { + self.resultBlock(self.mSelectDate, self.mSelectValue); + } + if (self.resultRangeBlock) { + self.resultRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue); + } + } +} + +// 设置行高 +- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { + return self.pickerStyle.rowHeight; +} + +#pragma mark - 日期选择器1 滚动后的响应事件 +- (void)didSelectValueChanged:(UIDatePicker *)sender { + // 读取日期:datePicker.date + self.mSelectDate = sender.date; + + if (_datePickerMode != UIDatePickerModeCountDownTimer) { + BOOL selectLessThanMin = [self br_compareDate:self.mSelectDate targetDate:self.minDate dateFormat:self.dateFormatter] == NSOrderedAscending; + BOOL selectMoreThanMax = [self br_compareDate:self.mSelectDate targetDate:self.maxDate dateFormat:self.dateFormatter] == NSOrderedDescending; + if (selectLessThanMin) { + self.mSelectDate = self.minDate; + } + if (selectMoreThanMax) { + self.mSelectDate = self.maxDate; + } + } + + [self.datePicker setDate:self.mSelectDate animated:YES]; + + self.mSelectValue = [self br_stringFromDate:self.mSelectDate dateFormat:self.dateFormatter]; + + // 滚动选择时执行 changeBlock 回调 + if (self.changeBlock) { + self.changeBlock(self.mSelectDate, self.mSelectValue); + } + + // 滚动选择范围时执行 changeBlock 回调 + if (self.changeRangeBlock) { + self.changeRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue); + } + + // 设置自动选择时,滚动选择时就执行 resultBlock + if (self.isAutoSelect) { + // 滚动完成后,执行block回调 + if (self.resultBlock) { + self.resultBlock(self.mSelectDate, self.mSelectValue); + } + if (self.resultRangeBlock) { + self.resultRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue); + } + } +} + +#pragma mark - 重写父类方法 +- (void)reloadData { + // 1.处理数据源 + [self handlerPickerData]; + if (self.style == BRDatePickerStyleSystem) { + // 2.刷新选择器(重新设置相关值) + self.datePicker.datePickerMode = _datePickerMode; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400 // 编译时检查SDK版本,iOS SDK 13.4 以后版本的处理 + if (@available(iOS 13.4, *)) { + // 适配 iOS14 以后 UIDatePicker 的显示样式 + self.datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels; + // 设置 datePicker 的 frame(在iOS14里,UIDatePicker 的 frame 赋值必须放在 datePickerMode 赋值之后, 否则 frame 不会生效) + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + self.datePicker.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight); + } else +#endif + { + // Fallback on earlier versions + } + + // 设置该 UIDatePicker 的国际化 Locale + self.datePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:self.pickerStyle.language]; + if (self.timeZone) { + self.datePicker.timeZone = self.timeZone; + } + + self.datePicker.calendar = self.calendar; + // 设置农历日期 + //self.datePicker.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierChinese]; + + if (self.minDate) { + self.datePicker.minimumDate = self.minDate; + } + if (self.maxDate) { + self.datePicker.maximumDate = self.maxDate; + } + if (_datePickerMode == UIDatePickerModeCountDownTimer && self.countDownDuration > 0) { + self.datePicker.countDownDuration = self.countDownDuration; + } + if (self.minuteInterval > 1) { + self.datePicker.minuteInterval = self.minuteInterval; + } + + // 3.滚动到选择的日期 + [self.datePicker setDate:self.mSelectDate animated:NO]; + } else if (self.style == BRDatePickerStyleCustom) { + // 2.刷新选择器 + [self.pickerView reloadAllComponents]; + // 3.滚动到选择的日期 + if (self.selectValue && ([self.selectValue isEqualToString:self.lastRowContent] || [self.selectValue isEqualToString:self.firstRowContent])) { + [self scrollToCustomString:NO]; + } else { + [self scrollToSelectDate:self.mSelectDate animated:NO]; + } + } +} + +- (void)addPickerToView:(UIView *)view { + _containerView = view; + [self setupDateFormatter:self.pickerMode]; + // 1.添加日期选择器 + if (self.style == BRDatePickerStyleSystem) { + [self setupPickerView:self.datePicker toView:view]; + } else if (self.style == BRDatePickerStyleCustom) { + [self setupPickerView:self.pickerView toView:view]; + if (self.showUnitType == BRShowUnitTypeOnlyCenter) { + // 添加日期单位到选择器 + [self addUnitLabel]; + } + } + + // ③添加中间选择行的两条分割线 + if (self.pickerStyle.clearPickerNewStyle) { + [self.pickerStyle addSeparatorLineView:self.pickerView]; + } + + // 2.绑定数据 + [self reloadData]; + + __weak typeof(self) weakSelf = self; + self.doneBlock = ^{ + // 点击确定按钮后,执行block回调 + if (weakSelf.resultBlock) { + weakSelf.resultBlock(weakSelf.mSelectDate, weakSelf.mSelectValue); + } + if (weakSelf.resultRangeBlock) { + weakSelf.resultRangeBlock(weakSelf.getSelectRangeDate.firstObject, weakSelf.getSelectRangeDate.lastObject, weakSelf.mSelectValue); + } + }; + + [super addPickerToView:view]; +} + +#pragma mark - 添加日期单位到选择器 +- (void)addUnitLabel { + if (self.unitLabelArr.count > 0) { + for (UILabel *unitLabel in self.unitLabelArr) { + [unitLabel removeFromSuperview]; + } + self.unitLabelArr = nil; + } + self.unitLabelArr = [self setupPickerUnitLabel:self.pickerView unitArr:self.unitArr]; +} + +#pragma mark - 重写父类方法 +- (void)addSubViewToPicker:(UIView *)customView { + if (self.style == BRDatePickerStyleSystem) { + [self.datePicker addSubview:customView]; + } else if (self.style == BRDatePickerStyleCustom) { + [self.pickerView addSubview:customView]; + } +} + +#pragma mark - 弹出选择器视图 +- (void)show { + [self addPickerToView:nil]; +} + +#pragma mark - 关闭选择器视图 +- (void)dismiss { + [self removePickerFromView:nil]; +} + +#pragma mark - setter 方法 +- (void)setPickerMode:(BRDatePickerMode)pickerMode { + _pickerMode = pickerMode; + // 非空,表示二次设置 + if (_datePicker || _pickerView) { + BRDatePickerStyle lastStyle = self.style; + [self setupDateFormatter:pickerMode]; + // 系统样式 切换到 自定义样式 + if (lastStyle == BRDatePickerStyleSystem && self.style == BRDatePickerStyleCustom) { + [self.datePicker removeFromSuperview]; + [self setupPickerView:self.pickerView toView:_containerView]; + } + // 自定义样式 切换到 系统样式 + if (lastStyle == BRDatePickerStyleCustom && self.style == BRDatePickerStyleSystem) { + [self.pickerView removeFromSuperview]; + [self setupPickerView:self.datePicker toView:_containerView]; + } + // 刷新选择器数据 + [self reloadData]; + if (self.style == BRDatePickerStyleCustom && self.showUnitType == BRShowUnitTypeOnlyCenter) { + // 添加日期单位到选择器 + [self addUnitLabel]; + } + } +} + +- (void)setAddToNow:(BOOL)addToNow { + _addToNow = addToNow; + if (addToNow) { + _maxDate = [NSDate date]; + _lastRowContent = [NSBundle br_localizedStringForKey:@"至今" language:self.pickerStyle.language]; + } +} + +- (void)setLastRowContent:(NSString *)lastRowContent { + if (!_addToNow) { + _lastRowContent = lastRowContent; + } +} + +// 支持动态设置选择的值 +- (void)setSelectDate:(NSDate *)selectDate { + _selectDate = selectDate; + _mSelectDate = selectDate; + if (_datePicker || _pickerView) { + // 刷新选择器数据 + [self reloadData]; + } +} + +- (void)setSelectValue:(NSString *)selectValue { + _selectValue = selectValue; + _mSelectValue = selectValue; + if (_datePicker || _pickerView) { + // 刷新选择器数据 + [self reloadData]; + } +} + +- (void)setAddCustomString:(NSString *)addCustomString { + self.lastRowContent = addCustomString; +} + +#pragma mark - getter 方法 +- (NSArray *)yearArr { + if (!_yearArr) { + _yearArr = [NSArray array]; + } + return _yearArr; +} + +- (NSArray *)monthArr { + if (!_monthArr) { + _monthArr = [NSArray array]; + } + return _monthArr; +} + +- (NSArray *)dayArr { + if (!_dayArr) { + _dayArr = [NSArray array]; + } + return _dayArr; +} + +- (NSArray *)hourArr { + if (!_hourArr) { + _hourArr = [NSArray array]; + } + return _hourArr; +} + +- (NSArray *)minuteArr { + if (!_minuteArr) { + _minuteArr = [NSArray array]; + } + return _minuteArr; +} + +- (NSArray *)secondArr { + if (!_secondArr) { + _secondArr = [NSArray array]; + } + return _secondArr; +} + +- (NSInteger)minuteInterval { + if (_minuteInterval < 1 || _minuteInterval > 30) { + _minuteInterval = 1; + } + return _minuteInterval; +} + +- (NSInteger)secondInterval { + if (_secondInterval < 1 || _secondInterval > 30) { + _secondInterval = 1; + } + return _secondInterval; +} + +- (NSArray *)unitArr { + if (!_unitArr) { + _unitArr = [NSArray array]; + } + return _unitArr; +} + +- (NSArray *)unitLabelArr { + if (!_unitLabelArr) { + _unitLabelArr = [NSArray array]; + } + return _unitLabelArr; +} + +- (NSArray *)monthNames { + if (!_monthNames) { + _monthNames = [NSArray array]; + } + return _monthNames; +} + +- (NSString *)getYearString { + NSInteger index = 0; + if (self.yearIndex >= 0 && self.yearIndex < self.yearArr.count) { + index = self.yearIndex; + } + return [self.yearArr objectAtIndex:index]; +} + +- (NSString *)getMonthString { + NSInteger index = 0; + if (self.monthIndex >= 0 && self.monthIndex < self.monthArr.count) { + index = self.monthIndex; + } + return [self.monthArr objectAtIndex:index]; +} + +- (NSString *)getDayString { + NSInteger index = 0; + if (self.dayIndex >= 0 && self.dayIndex < self.dayArr.count) { + index = self.dayIndex; + } + return [self.dayArr objectAtIndex:index]; +} + +- (NSString *)getHourString { + NSInteger index = 0; + if (self.hourIndex >= 0 && self.hourIndex < self.hourArr.count) { + index = self.hourIndex; + } + return [self.hourArr objectAtIndex:index]; +} + +- (NSString *)getMinuteString { + NSInteger index = 0; + if (self.minuteIndex >= 0 && self.minuteIndex < self.minuteArr.count) { + index = self.minuteIndex; + } + return [self.minuteArr objectAtIndex:index]; +} + +- (NSString *)getSecondString { + NSInteger index = 0; + if (self.secondIndex >= 0 && self.secondIndex < self.secondArr.count) { + index = self.secondIndex; + } + return [self.secondArr objectAtIndex:index]; +} + +- (NSString *)getMonthWeekString { + NSInteger index = 0; + if (self.monthWeekIndex >= 0 && self.monthWeekIndex < self.monthWeekArr.count) { + index = self.monthWeekIndex; + } + return [self.monthWeekArr objectAtIndex:index]; +} + +- (NSString *)getYearWeekString { + NSInteger index = 0; + if (self.yearWeekIndex >= 0 && self.yearWeekIndex < self.yearWeekArr.count) { + index = self.yearWeekIndex; + } + return [self.yearWeekArr objectAtIndex:index]; +} + +- (NSString *)getQuarterString { + NSInteger index = 0; + if (self.quarterIndex >= 0 && self.quarterIndex < self.quarterArr.count) { + index = self.quarterIndex; + } + return [self.quarterArr objectAtIndex:index]; +} + +#pragma mark - 获取选中日期范围 +- (NSArray *)getSelectRangeDate { + NSDate *startDate, *endDate = nil; + switch (self.pickerMode) { + case BRDatePickerModeYMDHMS: + case BRDatePickerModeMS: + case BRDatePickerModeHMS: + { + endDate = self.mSelectDate; + startDate = self.mSelectDate; + } + break; + case BRDatePickerModeYMDHM: + case BRDatePickerModeMDHM: + case BRDatePickerModeHM: + case BRDatePickerModeDateAndTime: + case BRDatePickerModeTime: + { + NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + startDate = tempDate; + endDate = [tempDate dateByAddingTimeInterval:59]; + } + break; + case BRDatePickerModeYMDH: + { + NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + startDate = tempDate; + endDate = [tempDate dateByAddingTimeInterval:60 * 59 + 59]; + } + break; + case BRDatePickerModeMD: + case BRDatePickerModeYMD: + case BRDatePickerModeDate: + { + NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + startDate = tempDate; + endDate = [[tempDate br_getNewDateToDays:1] dateByAddingTimeInterval:-1]; + } + break; + case BRDatePickerModeYM: + { + NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + startDate = tempDate; + endDate = [[tempDate br_getNewDateToMonths:1] dateByAddingTimeInterval:-1]; + } + break; + case BRDatePickerModeY: + { + NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + startDate = tempDate; + endDate = [[tempDate br_getNewDateToMonths:12] dateByAddingTimeInterval:-1]; + } + break; + case BRDatePickerModeYMW: + case BRDatePickerModeYW: + { + NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + endDate = [tempDate dateByAddingTimeInterval:-1]; + startDate = [tempDate br_getNewDateToDays:-7]; + } + break; + case BRDatePickerModeYQ: + { + startDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter]; + endDate = [[startDate br_getNewDateToMonths:3] dateByAddingTimeInterval:-1]; + } + break; + + default: + break; + } + + NSMutableArray *dataArr = [NSMutableArray array]; + if (startDate) + [dataArr addObject:startDate]; + if (endDate) + [dataArr addObject:endDate]; + return dataArr; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.h new file mode 100644 index 0000000..66820eb --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.h @@ -0,0 +1,126 @@ +// +// NSDate+BRPickerView.h +// BRPickerViewDemo +// +// Created by renbo on 2018/3/15. +// Copyright © 2018 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSDate (BRPickerView) +/// 获取指定date的详细信息 +@property (readonly) NSInteger br_year; // 年 +@property (readonly) NSInteger br_month; // 月 +@property (readonly) NSInteger br_day; // 日 +@property (readonly) NSInteger br_hour; // 时 +@property (readonly) NSInteger br_minute; // 分 +@property (readonly) NSInteger br_second; // 秒 +@property (readonly) NSInteger br_weekday; // 星期 +@property (readonly) NSInteger br_monthWeek; // 月周 +@property (readonly) NSInteger br_yearWeek; // 年周 +@property (readonly) NSInteger br_quarter; // 季度 + +/** 获取中文星期字符串 */ +@property (nullable, nonatomic, readonly, copy) NSString *br_weekdayString; + +/** 获取日历单例对象 */ ++ (NSCalendar *)br_calendar; + + +/// ---------------- 创建 date ---------------- +/** 通过 NSDateComponents对象 来创建 NSDate对象(可以设置时区) */ ++ (nullable NSDate *)br_setDateFromComponents:(NSDateComponents *)components timeZone:(NSTimeZone *)timeZone; + +/** yyyy */ ++ (nullable NSDate *)br_setYear:(NSInteger)year; + +/** yyyy-MM */ ++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month; + +/** yyyy-MM-dd */ ++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; + +/** yyyy-MM-dd HH */ ++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour; + +/** yyyy-MM-dd HH:mm */ ++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; + +/** yyyy-MM-dd HH:mm:ss */ ++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; + +/** MM-dd HH:mm */ ++ (nullable NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; + +/** MM-dd */ ++ (nullable NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day; + +/** HH:mm:ss */ ++ (nullable NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; + +/** HH:mm */ ++ (nullable NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute; + +/** mm:ss */ ++ (nullable NSDate *)br_setMinute:(NSInteger)minute second:(NSInteger)second; + +/** yyyy-MM-ww */ ++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month weekOfMonth:(NSInteger)weekOfMont; + +/** yyyy-ww */ ++ (nullable NSDate *)br_setYear:(NSInteger)year weekOfYear:(NSInteger)weekOfYear; + +/** yyyy-qq */ ++ (nullable NSDate *)br_setYear:(NSInteger)year quarter:(NSInteger)quarter; + + +/** 获取某个月的天数(通过年月求每月天数)*/ ++ (NSUInteger)br_getDaysInYear:(NSInteger)year month:(NSInteger)month; + +/** 获取某个月的周数(通过年月求该月周数)*/ ++ (NSUInteger)br_getWeeksOfMonthInYear:(NSInteger)year month:(NSInteger)month; + +/** 获取某一年的周数(通过年求该年周数)*/ ++ (NSUInteger)br_getWeeksOfYearInYear:(NSInteger)year; + +/** 获取某一年的季度数(通过年求该年季度数)*/ ++ (NSUInteger)br_getQuartersInYear:(NSInteger)year; + +/** 获取 日期加上/减去某天数后的新日期 */ +- (nullable NSDate *)br_getNewDateToDays:(NSTimeInterval)days; + +/** 获取 日期加上/减去某个月数后的新日期 */ +- (nullable NSDate *)br_getNewDateToMonths:(NSTimeInterval)months; + +/** NSDate 转 NSString */ ++ (nullable NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat; +/** NSDate 转 NSString */ ++ (nullable NSString *)br_stringFromDate:(NSDate *)date + dateFormat:(NSString *)dateFormat + timeZone:(nullable NSTimeZone *)timeZone + language:(nullable NSString *)language; + + +/** NSString 转 NSDate */ ++ (nullable NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat; +/** NSString 转 NSDate */ ++ (nullable NSDate *)br_dateFromString:(NSString *)dateString + dateFormat:(NSString *)dateFormat + timeZone:(nullable NSTimeZone *)timeZone + language:(nullable NSString *)language; + + +/** NSDate 转 NSString(已弃用) */ ++ (nullable NSString *)br_getDateString:(NSDate *)date format:(NSString *)format DEPRECATED_MSG_ATTRIBUTE("Use 'br_stringFromDate:dateFormat:' instead"); + +/** NSString 转 NSDate(已弃用) */ ++ (nullable NSDate *)br_getDate:(NSString *)dateString format:(NSString *)format DEPRECATED_MSG_ATTRIBUTE("Use 'br_dateFromString:dateFormat:' instead"); + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.m new file mode 100644 index 0000000..00b4da2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.m @@ -0,0 +1,400 @@ +// +// NSDate+BRPickerView.m +// BRPickerViewDemo +// +// Created by renbo on 2018/3/15. +// Copyright © 2018 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "NSDate+BRPickerView.h" +#import "BRPickerViewMacro.h" + +BRSYNTH_DUMMY_CLASS(NSDate_BRPickerView) + +static const NSCalendarUnit unitFlags = (NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekOfYear | NSCalendarUnitWeekOfMonth | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitWeekday | NSCalendarUnitWeekdayOrdinal | NSCalendarUnitQuarter); + +@implementation NSDate (BRPickerView) + +#pragma mark - 获取日历单例对象 ++ (NSCalendar *)br_calendar { + static NSCalendar *sharedCalendar = nil; + if (!sharedCalendar) { + // 创建日历对象,指定日历的算法(公历/阳历) + sharedCalendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + // NSCalendar 设置时区 + //sharedCalendar.timeZone = [NSTimeZone timeZoneWithName:@"America/Chicago"]; + } + return sharedCalendar; +} + +#pragma mark - NSDate 转 NSDateComponents ++ (NSDateComponents *)br_componentsFromDate:(NSDate *)date { + // 通过日历类 NSCalendar 进行转换 + NSCalendar *calendar = [self br_calendar]; + // NSDateComponents 可以获得日期的详细信息,即日期的组成 + return [calendar components:unitFlags fromDate:date]; +} + +#pragma mark - NSDateComponents 转 NSDate ++ (NSDate *)br_dateFromComponents:(NSDateComponents *)components { + // 通过日历类 NSCalendar 进行转换 + NSCalendar *calendar = [self br_calendar]; + return [calendar dateFromComponents:components]; +} + +#pragma mark - 获取指定日期的年份 +- (NSInteger)br_year { + return [NSDate br_componentsFromDate:self].year; +} + +#pragma mark - 获取指定日期的月份 +- (NSInteger)br_month { + return [NSDate br_componentsFromDate:self].month; +} + +#pragma mark - 获取指定日期的天 +- (NSInteger)br_day { + return [NSDate br_componentsFromDate:self].day; +} + +#pragma mark - 获取指定日期的小时 +- (NSInteger)br_hour { + return [NSDate br_componentsFromDate:self].hour; +} + +#pragma mark - 获取指定日期的分钟 +- (NSInteger)br_minute { + return [NSDate br_componentsFromDate:self].minute; +} + +#pragma mark - 获取指定日期的秒 +- (NSInteger)br_second { + return [NSDate br_componentsFromDate:self].second; +} + +#pragma mark - 获取指定日期的星期 +- (NSInteger)br_weekday { + return [NSDate br_componentsFromDate:self].weekday; +} + +#pragma mark - 获取指定日期的月周 +- (NSInteger)br_monthWeek { + return [NSDate br_componentsFromDate:self].weekOfMonth; +} + +#pragma mark - 获取指定日期的年周 +- (NSInteger)br_yearWeek { + return [NSDate br_componentsFromDate:self].weekOfYear; +} + +#pragma mark - 获取指定日期的季度 +- (NSInteger)br_quarter { +// [NSDate br_componentsFromDate:self].quarter; // 取到的季度值总是0? + NSInteger quarter = 1; + NSInteger month = self.br_month; + if (month > 3) quarter = 2; + if (month > 6) quarter = 3; + if (month > 9) quarter = 4; + + return quarter; +} + +#pragma mark - 获取指定日期的星期 +- (NSString *)br_weekdayString { + switch (self.br_weekday - 1) { + case 0: + { + return @"周日"; + } + break; + case 1: + { + return @"周一"; + } + break; + case 2: + { + return @"周二"; + } + break; + case 3: + { + return @"周三"; + } + break; + case 4: + { + return @"周四"; + } + break; + case 5: + { + return @"周五"; + } + break; + case 6: + { + return @"周六"; + } + break; + + default: + break; + } + + return @""; +} + +/// ---------------- 创建 date ---------------- +#pragma mark - 通过 NSDateComponents对象 来创建 NSDate对象(可以设置时区) ++ (nullable NSDate *)br_setDateFromComponents:(NSDateComponents *)components timeZone:(NSTimeZone *)timeZone { + // 创建日历对象,指定日历的算法(公历/阳历) + NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + if (timeZone) { + // NSCalendar 设置时区 + calendar.timeZone = timeZone; + } + return [calendar dateFromComponents:components]; +} + +#pragma mark - 创建date(通过 NSCalendar 类来创建日期) ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second { + return [self br_setYear:year month:month day:day hour:hour minute:minute second:second weekOfMonth:0 weekOfYear:0 quarter:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day + hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second + weekOfMonth:(NSInteger)weekOfMonth weekOfYear:(NSInteger)weekOfYear quarter:(NSInteger)quarter { + NSDateComponents *components = [self br_componentsFromDate:[NSDate date]]; + if (year > 0) { + // 初始化日期组件 + components = [[NSDateComponents alloc]init]; + components.year = year; + } + if (month > 0) { + components.month = month; + } + if (day > 0) { + components.day = day; + } + if (hour >= 0) { + components.hour = hour; + } + if (minute >= 0) { + components.minute = minute; + } + if (second >= 0) { + components.second = second; + } + if (weekOfMonth > 0) { + components.weekOfMonth = weekOfMonth; + } + if (weekOfYear > 0) { + components.weekOfYear = weekOfYear; + } + if (quarter > 0) { + components.quarter = quarter; + } + + return [self br_dateFromComponents:components]; +} + ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute { + return [self br_setYear:year month:month day:day hour:hour minute:minute second:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour { + return [self br_setYear:year month:month day:day hour:hour minute:0 second:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day { + return [self br_setYear:year month:month day:day hour:0 minute:0 second:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month { + return [self br_setYear:year month:month day:0 hour:0 minute:0 second:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year { + return [self br_setYear:year month:0 day:0 hour:0 minute:0 second:0]; +} + ++ (NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute { + return [self br_setYear:0 month:month day:day hour:hour minute:minute second:0]; +} + ++ (NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day { + return [self br_setYear:0 month:month day:day hour:0 minute:0 second:0]; +} + ++ (NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second { + return [self br_setYear:0 month:0 day:0 hour:hour minute:minute second:second]; +} + ++ (NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute { + return [self br_setYear:0 month:0 day:0 hour:hour minute:minute second:0]; +} + ++ (NSDate *)br_setMinute:(NSInteger)minute second:(NSInteger)second { + return [self br_setYear:0 month:0 day:0 hour:0 minute:minute second:second]; +} + ++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month weekOfMonth:(NSInteger)weekOfMonth { + return [self br_setYear:year month:month day:0 hour:0 minute:0 second:0 weekOfMonth:weekOfMonth weekOfYear:0 quarter:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year weekOfYear:(NSInteger)weekOfYear { + return [self br_setYear:year month:0 day:0 hour:0 minute:0 second:0 weekOfMonth:0 weekOfYear:weekOfYear quarter:0]; +} + ++ (NSDate *)br_setYear:(NSInteger)year quarter:(NSInteger)quarter { + return [self br_setYear:year month:0 day:0 hour:0 minute:0 second:0 weekOfMonth:0 weekOfYear:0 quarter:quarter]; +} + +#pragma mark - 获取某个月的天数(通过年月求每月天数) ++ (NSUInteger)br_getDaysInYear:(NSInteger)year month:(NSInteger)month { + BOOL isLeapYear = year % 4 == 0 ? (year % 100 == 0 ? (year % 400 == 0 ? YES : NO) : YES) : NO; + switch (month) { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + { + return 31; + } + case 4: + case 6: + case 9: + case 11: + { + return 30; + } + case 2: + { + if (isLeapYear) { + return 29; + } else { + return 28; + } + } + default: + break; + } + + return 0; +} + +#pragma mark - 获取某个月的周数(通过年月求该月周数) ++ (NSUInteger)br_getWeeksOfMonthInYear:(NSInteger)year month:(NSInteger)month { + NSUInteger lastDayOfMonth = [self br_getDaysInYear:year month:month]; + NSDate *endDate = [self br_setYear:year month:month day:lastDayOfMonth]; + return endDate.br_monthWeek; +} + +#pragma mark - 获取某一年的周数(通过年求该年周数) ++ (NSUInteger)br_getWeeksOfYearInYear:(NSInteger)year { + NSDate *endDate = [self br_setYear:year month:12 day:31]; + NSInteger weeks = endDate.br_yearWeek; + if (weeks == 1) weeks = 52; + return weeks; +} + +#pragma mark - 获取某一年的季度数(通过年求该年季度数) ++ (NSUInteger)br_getQuartersInYear:(NSInteger)year { + NSDate *endDate = [self br_setYear:year month:12 day:31]; + return endDate.br_quarter; +} + +#pragma mark - 获取 日期加上/减去某天数后的新日期 +- (NSDate *)br_getNewDateToDays:(NSTimeInterval)days { + // days 为正数时,表示几天之后的日期;负数表示几天之前的日期 + return [self dateByAddingTimeInterval:60 * 60 * 24 * days]; +} + +#pragma mark - 获取 日期加上/减去某个月数后的新日期 +- (nullable NSDate *)br_getNewDateToMonths:(NSTimeInterval)months { + // months 为正数时,表示几个月之后的日期;负数表示几个月之前的日期 + NSDateComponents *components = [[NSDateComponents alloc] init]; + [components setMonth:months]; + NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + return [calender dateByAddingComponents:components toDate:self options:0]; +} + +#pragma mark - NSDate 转 NSString ++ (NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat { + return [self br_stringFromDate:date dateFormat:dateFormat timeZone:nil language:nil]; +} +#pragma mark - NSDate 转 NSString ++ (NSString *)br_stringFromDate:(NSDate *)date + dateFormat:(NSString *)dateFormat + timeZone:(NSTimeZone *)timeZone + language:(NSString *)language { + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + // 设置日期格式 + dateFormatter.dateFormat = dateFormat; + // NSDateFormatter 设置时区 ,不设置默认为系统时区 + if (timeZone) { + dateFormatter.timeZone = timeZone; + } + if (!language) { + language = [NSLocale preferredLanguages].firstObject; + } + dateFormatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:language]; + NSString *dateString = [dateFormatter stringFromDate:date]; + + return dateString; +} + +#pragma mark - NSString 转 NSDate ++ (NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat { + return [self br_dateFromString:dateString dateFormat:dateFormat timeZone:nil language:nil]; +} +#pragma mark - NSString 转 NSDate ++ (NSDate *)br_dateFromString:(NSString *)dateString + dateFormat:(NSString *)dateFormat + timeZone:(NSTimeZone *)timeZone + language:(NSString *)language { + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + // 设置日期格式 + dateFormatter.dateFormat = dateFormat; + // 设置时区 + if (!timeZone) { + timeZone = [self currentTimeZone]; + } + if (!language) { + language = [NSLocale preferredLanguages].firstObject; + } + dateFormatter.timeZone = timeZone; + dateFormatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:language]; + // 如果当前时间不存在,就获取距离最近的整点时间 + dateFormatter.lenient = YES; + + return [dateFormatter dateFromString:dateString]; +} + +#pragma mark - 获取当前时区(不使用夏时制) ++ (NSTimeZone *)currentTimeZone { + // 当前时区 + NSTimeZone *localTimeZone = [NSTimeZone localTimeZone]; + // 当前时区相对于GMT(零时区)的偏移秒数 + NSInteger interval = [localTimeZone secondsFromGMTForDate:[NSDate date]]; + // 当前时区(不使用夏时制):由偏移量获得对应的NSTimeZone对象 + // 注意:一些夏令时时间 NSString 转 NSDate 时,默认会导致 NSDateFormatter 格式化失败,返回 null + return [NSTimeZone timeZoneForSecondsFromGMT:interval]; +} + +#pragma mark - NSDate 转 NSString(已弃用) ++ (NSString *)br_getDateString:(NSDate *)date format:(NSString *)format { + return [self br_stringFromDate:date dateFormat:format]; +} + +#pragma mark - NSString 转 NSDate(已弃用) ++ (NSDate *)br_getDate:(NSString *)dateString format:(NSString *)format { + return [self br_dateFromString:dateString dateFormat:format]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRResultModel.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRResultModel.h new file mode 100644 index 0000000..26b04f4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRResultModel.h @@ -0,0 +1,37 @@ +// +// BRResultModel.h +// BRPickerViewDemo +// +// Created by renbo on 2019/10/2. +// Copyright © 2019 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BRResultModel : NSObject + +/** key */ +@property (nullable, nonatomic, copy) NSString *key; +/** value */ +@property (nullable, nonatomic, copy) NSString *value; +/** 父级key(提示:联动时第一级数据,parentKey设置为:@"-1") */ +@property (nullable, nonatomic, copy) NSString *parentKey; +/** 父级value */ +@property (nullable, nonatomic, copy) NSString *parentValue; +/** 级别 */ +@property (nullable, nonatomic, copy) NSString *level; +/** 子级list */ +@property (nullable, nonatomic, copy) NSArray *children; +/** 记录选择的索引位置 */ +@property (nonatomic, assign) NSInteger index; + +/// 其它扩展字段 +@property (nullable, nonatomic, strong) id extras; +@property (nullable, nonatomic, copy) NSString *remark; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRResultModel.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRResultModel.m new file mode 100644 index 0000000..6a34748 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRResultModel.m @@ -0,0 +1,41 @@ +// +// BRResultModel.m +// BRPickerViewDemo +// +// Created by renbo on 2019/10/2. +// Copyright © 2019 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRResultModel.h" + +@implementation BRResultModel + +/// 判断两个对象是否相等 +/// @param object 目标对象 +- (BOOL)isEqual:(id)object { + // 1.对象的地址相同 + if (self == object) { + return YES; + } + + if (![object isKindOfClass:[BRResultModel class]]) { + return NO; + } + + BRResultModel *model = (BRResultModel *)object; + if (!model) { + return NO; + } + // 2.对象的类型相同,且对象的各个属性相等 + BOOL isSameKey = (!self.key && !model.key) || [self.key isEqualToString:model.key]; + BOOL isSameValue = (!self.value && !model.value) || [self.value isEqualToString:model.value]; + + return isSameKey && isSameValue; +} + +- (NSUInteger)hash { + return [self.key hash] ^ [self.value hash]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.h b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.h new file mode 100755 index 0000000..7dd5e0f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.h @@ -0,0 +1,191 @@ +// +// BRStringPickerView.h +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRBaseView.h" +#import "BRResultModel.h" + +NS_ASSUME_NONNULL_BEGIN + +/// 字符串选择器类型 +typedef NS_ENUM(NSInteger, BRStringPickerMode) { + /** 单列选择器 */ + BRStringPickerComponentSingle, + /** 多列选择器 */ + BRStringPickerComponentMulti, + /** 多级联动选择器 */ + BRStringPickerComponentLinkage +}; + +typedef void(^BRStringResultModelBlock)(BRResultModel * _Nullable resultModel); + +typedef void(^BRStringResultModelArrayBlock)(NSArray * _Nullable resultModelArr); + +@interface BRStringPickerView : BRBaseView + +/** + ////////////////////////////////////////////////////////////////////////// + /// + /// 【用法一】 + /// 特点:灵活,扩展性强(推荐使用!) + /// + ////////////////////////////////////////////////////////////////////////*/ + +/** 字符串选择器显示类型 */ +@property (nonatomic, assign) BRStringPickerMode pickerMode; + +/** + * 1.设置数据源 + * 单列:@[@"男", @"女", @"其他"],或直接传一维模型数组(NSArray *) + * 多列:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组 + * 联动:直接传一维模型数组(NSArray *),要注意数据源联动格式,可参考Demo + */ +@property (nullable, nonatomic, copy) NSArray *dataSourceArr; +/** + * 2.设置数据源 + * 直接传plist文件名:NSString类型(如:@"test.plist"),要带后缀名 + * 场景:可以将数据源数据(数组类型)放到plist文件中,直接传plist文件名更加简单 + */ +@property (nullable, nonatomic, copy) NSString *plistName; + +/** + * 设置默认选中的位置【单列】 + * 推荐使用 selectIndex,更加严谨,可以避免使用 selectValue 时,有名称相同的情况 + */ +@property (nonatomic, assign) NSInteger selectIndex; +@property (nullable, nonatomic, copy) NSString *selectValue; + +/** + * 设置默认选中的位置【多列】 + * 推荐使用 selectIndexs,更加严谨,可以避免使用 selectValues 时,有名称相同的情况 + */ +@property (nullable, nonatomic, copy) NSArray *selectIndexs; +@property (nullable, nonatomic, copy) NSArray *selectValues; + +/** 选择结果的回调【单列】 */ +@property (nullable, nonatomic, copy) BRStringResultModelBlock resultModelBlock; +/** 选择结果的回调【多列】 */ +@property (nullable, nonatomic, copy) BRStringResultModelArrayBlock resultModelArrayBlock; + +/** 滚动选择时触发的回调【单列】 */ +@property (nullable, nonatomic, copy) BRStringResultModelBlock changeModelBlock; +/** 滚动选择时触发的回调【多列】 */ +@property (nullable, nonatomic, copy) BRStringResultModelArrayBlock changeModelArrayBlock; + +/** + * 最大层级数(列数) for `BRStringPickerComponentLinkage`, ignored otherwise. + * 使用场景:默认可选,当数据源中有 key 等于 parentKey 情况时,必须要设置 + */ +@property (nonatomic, assign) NSInteger numberOfComponents; + +/// 初始化字符串选择器 +/// @param pickerMode 字符串选择器显示类型 +- (instancetype)initWithPickerMode:(BRStringPickerMode)pickerMode; + +/// 弹出选择器视图 +- (void)show; + +/// 关闭选择器视图 +- (void)dismiss; + + + + +//================================================= 华丽的分割线 ================================================= + + + + +/** + ////////////////////////////////////////////////////////////////////////// + /// + /// 【用法二】:快捷使用,直接选择下面其中的一个方法进行使用 + /// 特点:快捷,方便 + /// + ////////////////////////////////////////////////////////////////////////*/ + +/** + * 1.显示【单列】选择器 + * + * @param title 选择器标题 + * @param dataSourceArr 数据源,格式:@[@"男", @"女", @"其他"],或直接传一维模型数组(NSArray *) + * @param selectIndex 默认选中的位置 + * @param resultBlock 选择后的回调 + * + */ ++ (void)showPickerWithTitle:(nullable NSString *)title + dataSourceArr:(nullable NSArray *)dataSourceArr + selectIndex:(NSInteger)selectIndex + resultBlock:(nullable BRStringResultModelBlock)resultBlock; + +/** + * 2.显示【单列】选择器 + * + * @param title 选择器标题 + * @param dataSourceArr 数据源(如:@[@"男", @"女", @"其他"],或直接传模型数组) + * @param selectIndex 默认选中的位置 + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择后的回调 + * + */ ++ (void)showPickerWithTitle:(nullable NSString *)title + dataSourceArr:(nullable NSArray *)dataSourceArr + selectIndex:(NSInteger)selectIndex + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRStringResultModelBlock)resultBlock; + +/** + * 3.显示【多列】选择器 + * + * @param title 选择器标题 + * @param dataSourceArr 数据源,格式:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组 + * @param selectIndexs 默认选中的位置(传索引数组,如:@[@2, @1]) + * @param resultBlock 选择后的回调 + * + */ ++ (void)showMultiPickerWithTitle:(nullable NSString *)title + dataSourceArr:(nullable NSArray *)dataSourceArr + selectIndexs:(nullable NSArray *)selectIndexs + resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock; + +/** + * 4.显示【多列】选择器 + * + * @param title 选择器标题 + * @param dataSourceArr 数据源,格式:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组 + * @param selectIndexs 默认选中的位置(传索引数组,如:@[@2, @1]) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择后的回调 + * + */ ++ (void)showMultiPickerWithTitle:(nullable NSString *)title + dataSourceArr:(nullable NSArray *)dataSourceArr + selectIndexs:(nullable NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock; + +/** + * 5.显示【联动】选择器 + * + * @param title 选择器标题 + * @param dataSourceArr 数据源,格式:直接传一维模型数组(NSArray *) + * @param selectIndexs 默认选中的位置(传索引数组,如:@[@2, @1]) + * @param isAutoSelect 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO + * @param resultBlock 选择后的回调 + * + */ ++ (void)showLinkagePickerWithTitle:(nullable NSString *)title + dataSourceArr:(nullable NSArray *)dataSourceArr + selectIndexs:(nullable NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.m b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.m new file mode 100755 index 0000000..2cc26aa --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.m @@ -0,0 +1,571 @@ +// +// BRStringPickerView.m +// BRPickerViewDemo +// +// Created by renbo on 2017/8/11. +// Copyright © 2017 irenb. All rights reserved. +// +// 最新代码下载地址:https://github.com/91renb/BRPickerView + +#import "BRStringPickerView.h" + +@interface BRStringPickerView () +{ + BOOL _dataSourceException; // 数据源格式是否有误 +} +/** 选择器 */ +@property (nonatomic, strong) UIPickerView *pickerView; +/** 单列选择的值 */ +@property (nonatomic, copy) NSString *mSelectValue; +/** 多列选择的值 */ +@property (nonatomic, copy) NSArray * mSelectValues; + +/** 数据源 */ +@property (nullable, nonatomic, copy) NSArray *mDataSourceArr; + +@end + +@implementation BRStringPickerView + +#pragma mark - 1.显示【单列】选择器 ++ (void)showPickerWithTitle:(NSString *)title + dataSourceArr:(NSArray *)dataSourceArr + selectIndex:(NSInteger)selectIndex + resultBlock:(BRStringResultModelBlock)resultBlock { + [self showPickerWithTitle:title dataSourceArr:dataSourceArr selectIndex:selectIndex isAutoSelect:NO resultBlock:resultBlock]; +} + +#pragma mark - 2.显示【单列】选择器 ++ (void)showPickerWithTitle:(NSString *)title + dataSourceArr:(NSArray *)dataSourceArr + selectIndex:(NSInteger)selectIndex + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRStringResultModelBlock)resultBlock { + // 创建选择器 + BRStringPickerView *strPickerView = [[BRStringPickerView alloc]init]; + strPickerView.pickerMode = BRStringPickerComponentSingle; + strPickerView.title = title; + strPickerView.dataSourceArr = dataSourceArr; + strPickerView.selectIndex = selectIndex; + strPickerView.isAutoSelect = isAutoSelect; + strPickerView.resultModelBlock = resultBlock; + + // 显示 + [strPickerView show]; +} + +#pragma mark - 3.显示【多列】选择器 ++ (void)showMultiPickerWithTitle:(NSString *)title + dataSourceArr:(NSArray *)dataSourceArr + selectIndexs:(NSArray *)selectIndexs + resultBlock:(BRStringResultModelArrayBlock)resultBlock { + [self showMultiPickerWithTitle:title dataSourceArr:dataSourceArr selectIndexs:selectIndexs isAutoSelect:NO resultBlock:resultBlock]; +} + +#pragma mark - 4.显示【多列】选择器 ++ (void)showMultiPickerWithTitle:(NSString *)title + dataSourceArr:(NSArray *)dataSourceArr + selectIndexs:(NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(BRStringResultModelArrayBlock)resultBlock { + // 创建选择器 + BRStringPickerView *strPickerView = [[BRStringPickerView alloc]init]; + strPickerView.pickerMode = BRStringPickerComponentMulti; + strPickerView.title = title; + strPickerView.dataSourceArr = dataSourceArr; + strPickerView.selectIndexs = selectIndexs; + strPickerView.isAutoSelect = isAutoSelect; + strPickerView.resultModelArrayBlock = resultBlock; + + // 显示 + [strPickerView show]; +} + +#pragma mark - 5.显示【联动】选择器 ++ (void)showLinkagePickerWithTitle:(nullable NSString *)title + dataSourceArr:(nullable NSArray *)dataSourceArr + selectIndexs:(nullable NSArray *)selectIndexs + isAutoSelect:(BOOL)isAutoSelect + resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock { + // 创建选择器 + BRStringPickerView *strPickerView = [[BRStringPickerView alloc]init]; + strPickerView.pickerMode = BRStringPickerComponentLinkage; + strPickerView.title = title; + strPickerView.dataSourceArr = dataSourceArr; + strPickerView.selectIndexs = selectIndexs; + strPickerView.isAutoSelect = isAutoSelect; + strPickerView.resultModelArrayBlock = resultBlock; + + // 显示 + [strPickerView show]; +} + +#pragma mark - 初始化自定义选择器 +- (instancetype)initWithPickerMode:(BRStringPickerMode)pickerMode { + if (self = [super init]) { + self.pickerMode = pickerMode; + } + return self; +} + +#pragma mark - 处理选择器数据 +- (void)handlerPickerData { + if (self.dataSourceArr.count == 0) { + _dataSourceException = YES; + } + id item = [self.dataSourceArr firstObject]; + if (self.pickerMode == BRStringPickerComponentSingle) { + _dataSourceException = [item isKindOfClass:[NSArray class]]; + } else if (self.pickerMode == BRStringPickerComponentMulti) { + _dataSourceException = [item isKindOfClass:[NSString class]]; + } else if (self.pickerMode == BRStringPickerComponentLinkage) { + _dataSourceException = ![item isKindOfClass:[BRResultModel class]]; + } + if (_dataSourceException) { + NSAssert(!_dataSourceException, @"数据源异常!请检查选择器数据源的格式"); + return; + } + + // 处理选择器当前选择的值 + if (self.pickerMode == BRStringPickerComponentSingle) { + self.mDataSourceArr = self.dataSourceArr; + NSInteger selectIndex = 0; + if (self.selectIndex > 0 && self.selectIndex < self.mDataSourceArr.count) { + selectIndex = self.selectIndex; + } else { + if (self.mSelectValue) { + id item = [self.mDataSourceArr firstObject]; + if ([item isKindOfClass:[BRResultModel class]]) { + for (NSInteger i = 0; i < self.mDataSourceArr.count; i++) { + BRResultModel *model = self.mDataSourceArr[i]; + if ([model.value isEqualToString:self.mSelectValue]) { + selectIndex = i; + break; + } + } + } else { + if ([self.mDataSourceArr containsObject:self.mSelectValue]) { + selectIndex = [self.mDataSourceArr indexOfObject:self.mSelectValue]; + } + } + } + } + self.selectIndex = selectIndex; + + } else if (self.pickerMode == BRStringPickerComponentMulti) { + self.mDataSourceArr = self.dataSourceArr; + NSMutableArray *selectIndexs = [[NSMutableArray alloc]init]; + for (NSInteger i = 0; i < self.mDataSourceArr.count; i++) { + NSArray *itemArr = self.mDataSourceArr[i]; + NSInteger row = 0; + if (self.selectIndexs.count > 0) { + if (i < self.selectIndexs.count) { + NSInteger index = [self.selectIndexs[i] integerValue]; + row = ((index > 0 && index < itemArr.count) ? index : 0); + } + } else { + if (self.mSelectValues.count > 0 && i < self.mSelectValues.count) { + NSString *value = self.mSelectValues[i]; + id item = [itemArr firstObject]; + if ([item isKindOfClass:[BRResultModel class]]) { + for (NSInteger j = 0; j < itemArr.count; j++) { + BRResultModel *model = itemArr[j]; + if ([model.value isEqualToString:value]) { + row = j; + break; + } + } + } else { + if ([itemArr containsObject:value]) { + row = [itemArr indexOfObject:value]; + } + } + } + } + [selectIndexs addObject:@(row)]; + } + self.selectIndexs = [selectIndexs copy]; + + } else if (self.pickerMode == BRStringPickerComponentLinkage) { + + NSMutableArray *selectIndexs = [[NSMutableArray alloc]init]; + NSMutableArray *mDataSourceArr = [[NSMutableArray alloc]init]; + + BRResultModel *selectModel = nil; + BOOL hasNext = YES; + NSInteger i = 0; + + NSMutableArray *dataArr = [self.dataSourceArr mutableCopy]; + + do { + NSArray *nextArr = [self getNextDataArr:dataArr selectModel:selectModel]; + // 设置 numberOfComponents,防止 key 等于 parentKey 时进入死循环 + if (nextArr.count == 0 || i > self.numberOfComponents - 1) { + hasNext = NO; + break; + } + + NSInteger selectIndex = 0; + if (self.selectIndexs.count > i && [self.selectIndexs[i] integerValue] < nextArr.count) { + selectIndex = [self.selectIndexs[i] integerValue]; + } + selectModel = nextArr[selectIndex]; + + [selectIndexs addObject:@(selectIndex)]; + [mDataSourceArr addObject:nextArr]; + + i++; + + } while (hasNext); + + self.selectIndexs = [selectIndexs copy]; + self.mDataSourceArr = [mDataSourceArr copy]; + } +} + +- (NSArray *)getNextDataArr:(NSArray *)dataArr selectModel:(BRResultModel *)selectModel { + NSMutableArray *tempArr = [[NSMutableArray alloc]init]; + // parentKey = @"-1",表示是第一列数据 + NSString *key = selectModel ? selectModel.key : @"-1"; + for (BRResultModel *model in dataArr) { + if ([model.parentKey isEqualToString:key]) { + [tempArr addObject:model]; + } + } + return [tempArr copy]; +} + +#pragma mark - 选择器 +- (UIPickerView *)pickerView { + if (!_pickerView) { + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)]; + _pickerView.backgroundColor = self.pickerStyle.pickerColor; + _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; + _pickerView.dataSource = self; + _pickerView.delegate = self; + } + return _pickerView; +} + +#pragma mark - UIPickerViewDataSource +// 1.设置 pickerView 的列数 +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { + switch (self.pickerMode) { + case BRStringPickerComponentSingle: + return 1; + break; + case BRStringPickerComponentMulti: + case BRStringPickerComponentLinkage: + return self.mDataSourceArr.count; + break; + + default: + break; + } +} + +// 2.设置 pickerView 每列的行数 +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + switch (self.pickerMode) { + case BRStringPickerComponentSingle: + return self.mDataSourceArr.count; + break; + case BRStringPickerComponentMulti: + case BRStringPickerComponentLinkage: + { + NSArray *itemArr = self.mDataSourceArr[component]; + return itemArr.count; + } + break; + + default: + break; + } +} + +#pragma mark - UIPickerViewDelegate +// 3.设置 pickerView 的显示内容 +- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view { + // 1.自定义 row 的内容视图 + UILabel *label = (UILabel *)view; + if (!label) { + label = [[UILabel alloc]init]; + label.backgroundColor = [UIColor clearColor]; + label.textAlignment = NSTextAlignmentCenter; + label.font = self.pickerStyle.pickerTextFont; + label.textColor = self.pickerStyle.pickerTextColor; + // 字体自适应属性 + label.adjustsFontSizeToFitWidth = YES; + // 自适应最小字体缩放比例 + label.minimumScaleFactor = 0.5f; + } + if (self.pickerMode == BRStringPickerComponentSingle) { + id item = self.mDataSourceArr[row]; + if ([item isKindOfClass:[BRResultModel class]]) { + BRResultModel *model = (BRResultModel *)item; + label.text = model.value; + } else { + label.text = item; + } + } else if (self.pickerMode == BRStringPickerComponentMulti || self.pickerMode == BRStringPickerComponentLinkage) { + NSArray *itemArr = self.mDataSourceArr[component]; + id item = [itemArr objectAtIndex:row]; + if ([item isKindOfClass:[BRResultModel class]]) { + BRResultModel *model = (BRResultModel *)item; + label.text = model.value; + } else { + label.text = item; + } + } + + // 2.设置选择器中间选中行的样式 + [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component]; + + return label; +} + +// 4.滚动 pickerView 执行的回调方法 +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + switch (self.pickerMode) { + case BRStringPickerComponentSingle: + { + self.selectIndex = row; + + // 滚动选择时执行 changeModelBlock + if (self.changeModelBlock) { + self.changeModelBlock([self getResultModel]); + } + + // 设置自动选择时,滚动选择时就执行 resultModelBlock + if (self.isAutoSelect) { + if (self.resultModelBlock) { + self.resultModelBlock([self getResultModel]); + } + } + } + break; + case BRStringPickerComponentMulti: + { + if (component < self.selectIndexs.count) { + NSMutableArray *mutableArr = [self.selectIndexs mutableCopy]; + [mutableArr replaceObjectAtIndex:component withObject:@(row)]; + self.selectIndexs = [mutableArr copy]; + } + + // 滚动选择时执行 changeModelArrayBlock + if (self.changeModelArrayBlock) { + self.changeModelArrayBlock([self getResultModelArr]); + } + + // 设置自动选择时,滚动选择时就执行 resultModelArrayBlock + if (self.isAutoSelect) { + if (self.resultModelArrayBlock) { + self.resultModelArrayBlock([self getResultModelArr]); + } + } + } + break; + case BRStringPickerComponentLinkage: + { + if (component < self.selectIndexs.count) { + NSMutableArray *selectIndexs = [[NSMutableArray alloc]init]; + for (NSInteger i = 0; i < self.selectIndexs.count; i++) { + if (i < component) { + [selectIndexs addObject:self.selectIndexs[i]]; + } else if (i == component) { + [selectIndexs addObject:@(row)]; + } else { + [selectIndexs addObject:@(0)]; + } + } + self.selectIndexs = [selectIndexs copy]; + } + + // 刷新选择器数据 + [self reloadData]; + + // 滚动选择时执行 changeModelArrayBlock + if (self.changeModelArrayBlock) { + self.changeModelArrayBlock([self getResultModelArr]); + } + + // 设置自动选择时,滚动选择时就执行 resultModelArrayBlock + if (self.isAutoSelect) { + if (self.resultModelArrayBlock) { + self.resultModelArrayBlock([self getResultModelArr]); + } + } + } + break; + + default: + break; + } +} + +#pragma mark - 获取【单列】选择器选择的值 +- (BRResultModel *)getResultModel { + id item = self.selectIndex < self.mDataSourceArr.count ? self.mDataSourceArr[self.selectIndex] : nil; + if ([item isKindOfClass:[BRResultModel class]]) { + BRResultModel *model = (BRResultModel *)item; + model.index = self.selectIndex; + return model; + } else { + BRResultModel *model = [[BRResultModel alloc]init]; + model.index = self.selectIndex; + model.value = item; + return model; + } +} + +#pragma mark - 获取【多列】选择器选择的值 +- (NSArray *)getResultModelArr { + NSMutableArray *resultModelArr = [[NSMutableArray alloc]init]; + for (NSInteger i = 0; i < self.mDataSourceArr.count; i++) { + NSInteger index = [self.selectIndexs[i] integerValue]; + NSArray *dataArr = self.mDataSourceArr[i]; + + id item = index < dataArr.count ? dataArr[index] : nil; + if ([item isKindOfClass:[BRResultModel class]]) { + BRResultModel *model = (BRResultModel *)item; + model.index = index; + [resultModelArr addObject:model]; + } else { + BRResultModel *model = [[BRResultModel alloc]init]; + model.index = index; + model.value = item; + [resultModelArr addObject:model]; + } + } + return [resultModelArr copy]; +} + +// 设置行高 +- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { + return self.pickerStyle.rowHeight; +} + +#pragma mark - 重写父类方法 +- (void)reloadData { + // 1.处理数据源 + [self handlerPickerData]; + // 2.刷新选择器 + [self.pickerView reloadAllComponents]; + // 3.滚动到选择的值 + if (self.pickerMode == BRStringPickerComponentSingle) { + [self.pickerView selectRow:self.selectIndex inComponent:0 animated:NO]; + } else if (self.pickerMode == BRStringPickerComponentMulti || self.pickerMode == BRStringPickerComponentLinkage) { + for (NSInteger i = 0; i < self.selectIndexs.count; i++) { + NSNumber *index = [self.selectIndexs objectAtIndex:i]; + [self.pickerView selectRow:[index integerValue] inComponent:i animated:NO]; + } + } +} + +- (void)addPickerToView:(UIView *)view { + // 1.添加选择器 + if (view) { + // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示) + [view setNeedsLayout]; + [view layoutIfNeeded]; + + self.frame = view.bounds; + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0; + self.pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight); + [self addSubview:self.pickerView]; + } else { + // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题) + CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0; + self.pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight); + + [self.alertView addSubview:self.pickerView]; + } + + // ③添加中间选择行的两条分割线 + if (self.pickerStyle.clearPickerNewStyle) { + [self.pickerStyle addSeparatorLineView:self.pickerView]; + } + + // 2.绑定数据 + [self reloadData]; + + __weak typeof(self) weakSelf = self; + self.doneBlock = ^{ + // 点击确定按钮后,执行block回调 + if (weakSelf.pickerMode == BRStringPickerComponentSingle) { + if (weakSelf.resultModelBlock) { + weakSelf.resultModelBlock([weakSelf getResultModel]); + } + } else if (weakSelf.pickerMode == BRStringPickerComponentMulti || weakSelf.pickerMode == BRStringPickerComponentLinkage) { + if (weakSelf.resultModelArrayBlock) { + weakSelf.resultModelArrayBlock([weakSelf getResultModelArr]); + } + } + }; + + [super addPickerToView:view]; +} + +#pragma mark - 重写父类方法 +- (void)addSubViewToPicker:(UIView *)customView { + [self.pickerView addSubview:customView]; +} + +#pragma mark - 弹出选择器视图 +- (void)show { + [self addPickerToView:nil]; +} + +#pragma mark - 关闭选择器视图 +- (void)dismiss { + [self removePickerFromView:nil]; +} + +#pragma mark - setter 方法 +- (void)setPlistName:(NSString *)plistName { + NSString *path = [[NSBundle mainBundle] pathForResource:plistName ofType:nil]; + if (path && path.length > 0) { + self.dataSourceArr = [[NSArray alloc] initWithContentsOfFile:path]; + } +} + +- (void)setSelectValue:(NSString *)selectValue { + self.mSelectValue = selectValue; +} + +- (void)setSelectValues:(NSArray *)selectValues { + self.mSelectValues = selectValues; +} + +#pragma mark - getter 方法 +- (NSArray *)mDataSourceArr { + if (!_mDataSourceArr) { + _mDataSourceArr = [NSArray array]; + } + return _mDataSourceArr; +} + +- (NSArray *)selectIndexs { + if (!_selectIndexs) { + _selectIndexs = [NSArray array]; + } + return _selectIndexs; +} + +- (NSArray *)mSelectValues { + if (!_mSelectValues) { + _mSelectValues = [NSArray array]; + } + return _mSelectValues; +} + +- (NSInteger)numberOfComponents { + if (_numberOfComponents <= 0) { + _numberOfComponents = 3; + } + return _numberOfComponents; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertConfig.h new file mode 100644 index 0000000..9d01930 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertConfig.h @@ -0,0 +1,45 @@ +// +// EasyAlertConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import +#import "EasyAlertTypes.h" +#import "EasyShowUtils.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyAlertConfig : NSObject + +@property (nonatomic,strong)UIColor *tintColor ; //alertview的背景颜色 +@property (nonatomic,strong)UIColor *titleColor ; //title的字体颜色 +@property (nonatomic,strong)UIColor *subtitleColor ;//subtitle的字体颜色 +@property (nonatomic,assign)NSTextAlignment subtitleTextAligment ;//subtitle对其方式 +@property (nonatomic,assign)BOOL twoItemHorizontal ;//当alertview为两个的时候,是否横着摆放 +@property (nonatomic,assign)AlertAnimationType animationType;//alertView:展示和消失的动画类型。(只对自定义的alertview起作用) +//背景的样式。(只对自定义的alertview起作用) +@property (nonatomic,assign)AlertBgEffectType effectType UI_APPEARANCE_SELECTOR; + +@property (nonatomic,assign)BOOL bgViewEvent ; //点击alertview之外的空白区域,是否销毁alertview。默认为:NO +@property (nonatomic,assign)NSUInteger alertViewMaxNum ; //允许出现alertView的最大数量 +@property (nonatomic,assign)BOOL isSupportRotating; //是否支持横屏 + ++ (instancetype)shared ; + +- (EasyAlertConfig *(^)(UIColor *))setTintColor; +- (EasyAlertConfig *(^)(UIColor *))setTitleColor ; +- (EasyAlertConfig *(^)(UIColor *))setSubtitleColor ; +- (EasyAlertConfig *(^)(NSTextAlignment))setSubtitleTextAligment ; +- (EasyAlertConfig *(^)(BOOL))settwoItemHorizontal ; +- (EasyAlertConfig *(^)(AlertAnimationType))setAnimationType ; +- (EasyAlertConfig *(^)(AlertBgEffectType))setEffectType ; +- (EasyAlertConfig *(^)(BOOL))setBgViewEvent ; +- (EasyAlertConfig *(^)(NSUInteger))setAlertViewMaxNum ; + +@end +NS_ASSUME_NONNULL_END + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertConfig.m new file mode 100644 index 0000000..0d50990 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertConfig.m @@ -0,0 +1,99 @@ +// +// EasyAlertConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyAlertConfig.h" +#import "EasyAlertGlobalConfig.h" +@implementation EasyAlertConfig + + ++ (instancetype)shared +{ + return [[self alloc]init]; +} +- (instancetype)init +{ + if (self = [super init]) { + + _alertViewMaxNum = 0 ; + + EasyAlertGlobalConfig *globalC = [EasyAlertGlobalConfig shared]; + _twoItemHorizontal = globalC.twoItemHorizontal ; + _bgViewEvent = globalC.bgViewEvent ; + _animationType = globalC.animationType ; + _effectType = globalC.effectType ; + _isSupportRotating = globalC.isSupportRotating ; + _subtitleTextAligment = NSTextAlignmentCenter ; + } + return self ; +} + +- (EasyAlertConfig * _Nonnull (^)(UIColor *))setTintColor +{ + return ^EasyAlertConfig *(UIColor *tintColor){ + self.tintColor = tintColor ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(UIColor *))setTitleColor +{ + return ^EasyAlertConfig *(UIColor *titleColor){ + self.titleColor = titleColor ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(UIColor *))setSubtitleColor +{ + return ^EasyAlertConfig *(UIColor *subtitleColor){ + self.subtitleColor = subtitleColor ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(NSTextAlignment))setSubtitleTextAligment +{ + return ^EasyAlertConfig *(NSTextAlignment alignment){ + self.subtitleTextAligment = alignment ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(BOOL))settwoItemHorizontal +{ + return ^EasyAlertConfig *(BOOL horizontal){ + self.twoItemHorizontal = horizontal ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(AlertAnimationType))setAnimationType +{ + return ^EasyAlertConfig *(AlertAnimationType type){ + self.animationType = type ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(AlertBgEffectType))setEffectType +{ + return ^EasyAlertConfig *(AlertBgEffectType type){ + self.effectType = type ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(BOOL))setBgViewEvent +{ + return ^EasyAlertConfig *(BOOL event){ + self.bgViewEvent = event ; + return self; + }; +} +- (EasyAlertConfig * _Nonnull (^)(NSUInteger))setAlertViewMaxNum +{ + return ^EasyAlertConfig *(NSUInteger maxnum){ + self.alertViewMaxNum = maxnum ; + return self; + }; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertGlobalConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertGlobalConfig.h new file mode 100644 index 0000000..9414aea --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertGlobalConfig.h @@ -0,0 +1,50 @@ +// +// EasyAlertGlobalConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import "EasyShowUtils.h" +#import "EasyAlertTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyAlertGlobalConfig : NSObject + +//alertview的背景颜色 +@property (nonatomic,strong)UIColor *tintColor UI_APPEARANCE_SELECTOR; + +//title的字体颜色 +@property (nonatomic,strong)UIColor *titleColor UI_APPEARANCE_SELECTOR; + +//subtitle的字体颜色 +@property (nonatomic,strong)UIColor *subtitleColor UI_APPEARANCE_SELECTOR; + +//当alertview为两个的时候,是否横着摆放 +@property (nonatomic,assign)BOOL twoItemHorizontal UI_APPEARANCE_SELECTOR; + +//alertView:展示和消失的动画类型。(只对自定义的alertview起作用) +@property (nonatomic,assign)AlertAnimationType animationType UI_APPEARANCE_SELECTOR; + +//背景的样式。(只对自定义的alertview起作用) +@property (nonatomic,assign)AlertBgEffectType effectType UI_APPEARANCE_SELECTOR; + + + //点击alertview之外的空白区域,是否销毁alertview。默认为:NO +@property (nonatomic,assign)BOOL bgViewEvent UI_APPEARANCE_SELECTOR ; + +//允许出现alertView的最大数量 +@property (nonatomic,assign)NSUInteger alertViewMaxNum UI_APPEARANCE_SELECTOR; + +//是否支持横屏 +@property (nonatomic,assign)BOOL isSupportRotating UI_APPEARANCE_SELECTOR; + +easyShowView_singleton_interface + +@end + +NS_ASSUME_NONNULL_END + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertGlobalConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertGlobalConfig.m new file mode 100644 index 0000000..30b1216 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertGlobalConfig.m @@ -0,0 +1,30 @@ +// +// EasyAlertGlobalConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyAlertGlobalConfig.h" + +@implementation EasyAlertGlobalConfig + +easyShowView_singleton_implementation(EasyAlertGlobalConfig) + +- (instancetype)init +{ + if (self = [super init]) { + + _tintColor = [UIColor groupTableViewBackgroundColor]; + _titleColor = [UIColor darkTextColor]; + _subtitleColor = [UIColor lightGrayColor]; + _twoItemHorizontal = NO ; + _animationType = AlertAnimationTypeBounce ; + _effectType = AlertBgEffectTypeWoolGlass ; + _bgViewEvent = YES ; + _alertViewMaxNum = 2 ; + } + return self ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertItem.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertItem.h new file mode 100644 index 0000000..8bfccc0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertItem.h @@ -0,0 +1,22 @@ +// +// EasyAlertItem.h +// EasyShowViewDemo +// +// Created by nf on 2018/3/14. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import "EasyAlertTypes.h" + +@interface EasyAlertItem : NSObject + +@property (nonatomic,strong)NSString *title ; //按钮的标题 +@property (nonatomic,assign)AlertItemType itemTpye ; //按钮的类型 +@property (nonatomic,strong)AlertCallback callback ;//点击按钮的回调 + + ++ (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type ; ++ (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type callback:(AlertCallback)callback ; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertItem.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertItem.m new file mode 100644 index 0000000..4096550 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertItem.m @@ -0,0 +1,25 @@ +// +// EasyAlertItem.m +// EasyShowViewDemo +// +// Created by nf on 2018/3/14. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyAlertItem.h" + +@implementation EasyAlertItem + ++ (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type +{ + return [self itemWithTitle:title type:type callback:nil]; +} ++ (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type callback:(AlertCallback)callback +{ + EasyAlertItem *item = [[EasyAlertItem alloc]init]; + item.title = title ; + item.itemTpye = type ; + item.callback = callback ; + return item ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertPart.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertPart.h new file mode 100644 index 0000000..adb09d0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertPart.h @@ -0,0 +1,29 @@ +// +// EasyAlertPart.h +// EasyShowViewDemo +// +// Created by nf on 2018/3/14. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import "EasyAlertTypes.h" + +@interface EasyAlertPart : NSObject + +@property (nonatomic,strong)NSString *title ; //标题 +@property (nonatomic,strong)NSString *subtitle ; //副标题 +@property (nonatomic,assign)AlertViewType alertType ; //alert类型 分4种 + ++ (instancetype)shared ; + +- (EasyAlertPart *(^)(NSString *))setTitle ; +- (EasyAlertPart *(^)(NSString *))setSubtitle ; +- (EasyAlertPart *(^)(AlertViewType))setAlertType ; + ++ (instancetype)alertPartWithTitle:(NSString *)title ; ++ (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle ; ++ (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle alertype:(AlertViewType)alerttype ; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertPart.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertPart.m new file mode 100644 index 0000000..349124f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertPart.m @@ -0,0 +1,60 @@ +// +// EasyAlertPart.m +// EasyShowViewDemo +// +// Created by nf on 2018/3/14. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyAlertPart.h" + +@implementation EasyAlertPart + ++ (instancetype)shared +{ + return [self new]; +} + +- (EasyAlertPart *(^)(NSString *))setTitle +{ + return ^EasyAlertPart* (NSString *title) { + self.title = title; + return self; + }; +} +- (EasyAlertPart *(^)(NSString *))setSubtitle +{ + return ^EasyAlertPart* (NSString *subtitle){ + self.subtitle = subtitle ; + return self ; + }; +} +- (EasyAlertPart *(^)(AlertViewType))setAlertType +{ + return ^EasyAlertPart* (AlertViewType type){ + self.alertType = type ; + return self ; + }; +} + + ++ (instancetype)alertPartWithTitle:(NSString *)title +{ + return [self alertPartWithTitle:title subtitle:nil]; +} ++ (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle +{ + return [self alertPartWithTitle:title subtitle:subtitle alertype:AlertViewTypeAlert]; +} ++ (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle alertype:(AlertViewType)alerttype +{ + EasyAlertPart *part = [self shared]; + part.title = title ; + part.subtitle = subtitle ; + part.alertType = alerttype ; + return part ; +} +@end + + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertTypes.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertTypes.h new file mode 100644 index 0000000..c70ad30 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertTypes.h @@ -0,0 +1,65 @@ +// +// EasyAlertTypes.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import + +/** + * 添加一个item的样式,只有color和blod可选 + */ +typedef NS_ENUM(NSInteger, AlertItemType) { + AlertItemTypeBlack = 1, // 黑色字体 + AlertItemTypeBlodBlack , // 黑色加粗字体 + AlertItemTypeBlue, // 蓝色字体 + AlertItemTypeBlodBlue, // 蓝色加粗字体 + AlertItemTypeRed , // 红色字体 + AlertItemTypeBlodRed , // 红色加粗字体 + AlertItemTypeCustom , //自定义的一种自己,需要配置,如果不配置将会是第一种(黑色字体) + + AlertItemTypeSystemDefault , + AlertItemTypeSystemCancel , + AlertItemTypeSystemDestructive , +}; + +/** + * alertView的动画形式 + */ +typedef NS_ENUM(NSInteger , AlertAnimationType) { + AlertAnimationTypeUndefine ,//未定义 + AlertAnimationTypeNone ,//无动画 + AlertAnimationTypeFade,//alpha改变 + AlertAnimationTypeBounce ,//抖动 + AlertAnimationTypeZoom, //放大缩小 + AlertAnimationTypePush ,//向上push +}; + + +typedef NS_ENUM(NSInteger , AlertViewType) { + AlertViewTypeAlert , //默认类型 + AlertViewTypeActionSheet , + AlertViewTypeSystemAlert , + AlertViewTypeSystemActionSheet , +}; + +typedef NS_ENUM(NSInteger , AlertBgEffectType) { + AlertBgEffectTypeUndefine , //默认类型 + AlertBgEffectTypeAlphaCover , + AlertBgEffectTypeWoolGlass, +}; + + +@class EasyAlertView ; + +/** + * 点击item回调,注意:如果全局和item都有回调,会优先显示全局的回调 + */ +typedef void (^AlertCallback)(EasyAlertView *showview , long index); + + +@interface EasyAlertTypes : NSObject + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertTypes.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertTypes.m new file mode 100644 index 0000000..b6b1bee --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertTypes.m @@ -0,0 +1,13 @@ +// +// EasyAlertTypes.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyAlertTypes.h" + +@implementation EasyAlertTypes + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertView.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertView.h new file mode 100644 index 0000000..94b14d0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertView.h @@ -0,0 +1,78 @@ +// +// EasyAlertView.h +// EasyShowViewDemo +// +// Created by nf on 2017/12/14. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import +#import "EasyAlertTypes.h" +#import "EasyAlertConfig.h" +#import "EasyAlertItem.h" +#import "EasyAlertPart.h" + +@interface EasyAlertView : UIView + + + +/** + * 快速创建AlertView的方法 + * + * part alertView的组成部分 标题,副标题,显示类型 + * config 配置信息(如果为空,就是使用EasyAlertGlobalConfig中的属性值) + * buttonArray 所以需要显示的按钮 + * callback 点击按钮回调 + */ ++ (EasyAlertView *)alertViewWithPart:(EasyAlertPart *(^)(void))part + config:(EasyAlertConfig *(^)(void))config + buttonArray:(NSArray *(^)(void))buttonArray + callback:(AlertCallback)callback ; + + + +/** + * 第一步:创建一个自定义的Alert/ActionSheet + */ ++ (instancetype)alertViewWithTitle:(NSString *)title + subtitle:(NSString *)subtitle + AlertViewType:(AlertViewType)alertType + config:(EasyAlertConfig *(^)(void))config ; + ++ (instancetype)alertViewWithPart:(EasyAlertPart *(^)(void))part + config:(EasyAlertConfig *(^)(void))config + callback:(AlertCallback)callback ; + +/** + * 第二步:往创建的alert上面添加事件 + */ +- (void)addAlertItemWithTitle:(NSString *)title + type:(AlertItemType)type + callback:(AlertCallback)callback; +- (void)addAlertItem:(EasyAlertItem *(^)(void))item ; +- (void)addAlertItemWithTitleArray:(NSArray *)titleArray + callback:(AlertCallback)callbck ; + +/** + * 第三步:展示alert + */ +- (void)showAlertView ; + + +// 移除alertview +- (void)removeAlertView ; + + + +@end + + + + + + + + + + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertView.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertView.m new file mode 100644 index 0000000..747268d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyAlertView.m @@ -0,0 +1,671 @@ +// +// EasyAlertView.m +// EasyShowViewDemo +// +// Created by nf on 2017/12/14. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import "EasyAlertView.h" +#import "UIView+EasyShowExt.h" +#import "EasyAlertConfig.h" + +#import "EasyShowLabel.h" +#import "EasyAlertGlobalConfig.h" +#import "EasyAlertItem.h" + + +@interface EasyAlertView() + +@property (nonatomic,strong)EasyAlertConfig *config ; +@property (nonatomic,strong)EasyAlertPart *part ; +@property (nonatomic,strong)AlertCallback callback ; + +@property (nonatomic,strong)UILabel *titleLabel ; +@property (nonatomic,strong)UILabel *subtitleLabel ; +@property (nonatomic,strong)UIView *alertBgView ; +@property (nonatomic,strong)NSMutableArray *itemArray ; +@property (nonatomic,strong)NSMutableArray *buttonArray ; + +@property (nonatomic,strong)UIWindow *alertWindow ; +//@property (nonatomic,strong)UIWindow *oldKeyWindow ; + + +@end + +@implementation EasyAlertView + +- (void)dealloc +{ + //[[NSNotificationCenter defaultCenter] removeObserver:self]; +} + + ++ (EasyAlertView *)alertViewWithPart:(EasyAlertPart *(^)(void))part + config:(EasyAlertConfig *(^)(void))config + buttonArray:(NSArray *(^)(void))buttonArray + callback:(AlertCallback)callback +{ + EasyAlertView *alertView = [self alertViewWithPart:part config:config callback:callback]; + NSArray *tempArr = buttonArray ? buttonArray() : @[] ; + [alertView addAlertItemWithTitleArray:tempArr callback:callback]; + [alertView showAlertView]; + return alertView ; +} + + +//第一步:创建一个自定义的Alert/ActionSheet ++ (instancetype)alertViewWithTitle:(NSString *)title + subtitle:(NSString *)subtitle + AlertViewType:(AlertViewType)alertType + config:(EasyAlertConfig *(^)(void))config +{ + EasyAlertPart *(^tempPart)(void) = ^EasyAlertPart *{ + return [EasyAlertPart alertPartWithTitle:title subtitle:subtitle alertype:alertType] ; + }; + return [self alertViewWithPart:tempPart config:config callback:nil] ; + +} + ++ (instancetype)alertViewWithPart:(EasyAlertPart *(^)(void))part + config:(EasyAlertConfig *(^)(void))config + callback:(AlertCallback)callback +{ + EasyAlertPart *tempPart = [self changePartWithPart:part]; + EasyAlertConfig *tempConfig = [self changeConfigWithConfig:config] ; + + EasyAlertView *showView = [[EasyAlertView alloc]initWithPart:tempPart config:tempConfig]; + showView.callback = callback ; + showView.itemArray = [NSMutableArray arrayWithCapacity:3]; + return showView ; +} + +//第二步:往创建的alert上面添加事件 +- (void)addAlertItemWithTitle:(NSString *)title + type:(AlertItemType)type + callback:(AlertCallback)callback +{ + EasyAlertItem *tempItem = [EasyAlertItem itemWithTitle:title type:type callback:callback]; + [self.itemArray addObject:tempItem]; +} +- (void)addAlertItem:(EasyAlertItem *(^)(void))item +{ + EasyAlertItem *tempItem = item ? item() : [EasyAlertItem init]; + [self.itemArray addObject:tempItem]; +} +- (void)addAlertItemWithTitleArray:(NSArray *)titleArray + callback:(AlertCallback)callbck +{ + for (int i = 0 ; i < titleArray.count; i++) { + EasyAlertItem *tempItem = [EasyAlertItem itemWithTitle:titleArray[i] type:AlertItemTypeBlack callback:callbck]; + [self.itemArray addObject:tempItem]; + } +} + +//第三步:展示alert +- (void)showAlertView +{ + + if (self.part.alertType == AlertViewTypeSystemAlert ||self.part.alertType==AlertViewTypeSystemActionSheet ) { + UIAlertControllerStyle stype = self.part.alertType == AlertViewTypeSystemAlert ; + UIAlertController *alertC = [UIAlertController alertControllerWithTitle:self.part.title + message:self.part.subtitle + preferredStyle:stype]; + [self.itemArray enumerateObjectsUsingBlock:^(EasyAlertItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + UIAlertActionStyle actionStyle = UIAlertActionStyleDefault ; + if (obj.itemTpye == AlertItemTypeSystemCancel) { + actionStyle = UIAlertActionStyleCancel ; + }else if (obj.itemTpye == AlertItemTypeSystemDestructive){ + actionStyle = UIAlertActionStyleDestructive ; + } + + UIAlertAction *action = [UIAlertAction actionWithTitle:obj.title + style:actionStyle + handler:^(UIAlertAction * _Nonnull action) { + typeof(self)weakself = self; + if (self.callback) { + self.callback(weakself, idx); + }else{ + if (obj.callback) { + obj.callback(weakself,idx); + } + } + + }]; + [alertC addAction:action]; + }]; + + UIViewController *presentVC = [EasyShowUtils easyShowViewTopViewController]; + [presentVC presentViewController:alertC animated:YES completion:nil]; + + return ; + } + +// self.oldKeyWindow = [UIApplication sharedApplication].keyWindow ; + + [self removeOtherAlertView]; + [self.alertWindow addSubview:self]; +// [self.alertWindow makeKeyAndVisible]; + + [self addSubview:self.alertBgView]; + + [self.alertBgView addSubview:self.titleLabel]; + [self.alertBgView addSubview:self.subtitleLabel]; + self.titleLabel.text = self.part.title ; + self.subtitleLabel.text = self.part.subtitle ; + + for (int i = 0; i < self.itemArray.count; i++) { + UIButton *button = [self alertButtonWithIndex:i]; + [self.alertBgView addSubview:button]; + } + + [self layoutAlertSubViews]; + + [self showStartAnimationWithType:self.config.animationType completion:nil]; + +} + + +// 移除alertview +- (void)removeAlertView +{ + [self alertWindowTap]; +} +- (instancetype)initWithPart:(EasyAlertPart *)part config:(EasyAlertConfig *)config +{ + if (self = [super init]) { + _part = part ; + _config = config ; + self.frame = [UIApplication sharedApplication].keyWindow.bounds ; + } + return self ; +} + + + +- (void)statusBarOrientationChange:(NSNotification *)notification { + + // self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + [self layoutAlertSubViews]; +} +- (void)layoutAlertSubViews +{ + CGFloat bgViewMaxWidth = self.part.alertType==AlertViewTypeAlert ? SCREEN_WIDTH_S*0.75 : SCREEN_WIDTH_S ; + CGFloat buttonHeight = 50 ; + + CGSize titleLabelSize = [self.titleLabel sizeThatFits:CGSizeMake(bgViewMaxWidth, MAXFLOAT)]; + if (ISEMPTY_S(self.titleLabel.text)) { + titleLabelSize.height = 10 ; + } + self.titleLabel.frame = CGRectMake(0, 0, bgViewMaxWidth, titleLabelSize.height); + + CGSize messageLabelSize = [self.subtitleLabel sizeThatFits:CGSizeMake(bgViewMaxWidth, MAXFLOAT)]; + if (ISEMPTY_S(self.subtitleLabel.text)) { + messageLabelSize.height = 10 ; + } + self.subtitleLabel.frame = CGRectMake(0, self.titleLabel.easyS_bottom, bgViewMaxWidth, messageLabelSize.height) ; + + CGFloat totalHeight = self.subtitleLabel.easyS_bottom + 0.5 ; + CGFloat btnCount = self.buttonArray.count ; + + if (self.part.alertType==AlertViewTypeAlert && btnCount==2 && self.config.twoItemHorizontal) { + + for (int i = 0; i < btnCount ; i++) { + UIButton *tempButton = self.buttonArray[i]; + + CGFloat tempButtonX = i ? (bgViewMaxWidth/2+0.5) : 0 ; + CGFloat tempButtonY = self.subtitleLabel.easyS_bottom +0.5 ; + [tempButton setFrame:CGRectMake(tempButtonX, tempButtonY, bgViewMaxWidth/2, buttonHeight)]; + totalHeight = tempButton.easyS_bottom ; + } + } + else{ + for (int i = 0; i < btnCount ; i++) { + UIButton *tempButton = self.buttonArray[i]; + + CGFloat lineHeight = ((i==btnCount-1)&&self.part.alertType==AlertViewTypeActionSheet) ? 10 : 0.5 ; + CGFloat tempButtonY = self.subtitleLabel.easyS_bottom + lineHeight + i*(buttonHeight+ 0.5) ; + [tempButton setFrame:CGRectMake(0, tempButtonY, bgViewMaxWidth, buttonHeight)]; + totalHeight = tempButton.easyS_bottom ; + } + } + + CGFloat actionShowAddSafeHeiht = self.part.alertType==AlertViewTypeActionSheet ? kEasyShowSafeBottomMargin_S : 0 ; + self.alertBgView.bounds = CGRectMake(0, 0, bgViewMaxWidth, totalHeight+actionShowAddSafeHeiht); + + switch (self.part.alertType) { + case AlertViewTypeAlert: + { + self.alertBgView.center = self.center ; + + UIColor *boderColor = [self.alertBgView.backgroundColor colorWithAlphaComponent:0.2]; + [self.alertBgView setRoundedCorners:UIRectCornerAllCorners + borderWidth:0.5 + borderColor:boderColor + cornerSize:CGSizeMake(15,15)];//需要添加阴影 + }break; + case AlertViewTypeActionSheet: + { + self.alertBgView.center = CGPointMake(SCREEN_WIDTH_S/2, SCREEN_HEIGHT_S-(totalHeight/2)); + }break ; + default: + break; + } + +} + +- (void)bgViewTap:(UIPanGestureRecognizer *)recognizer +{ + +} +- (void)bgViewPan:(UIPanGestureRecognizer *)recognizer +{ + CGPoint location = [recognizer locationInView:self]; + + UIButton *tempButton = nil; + for (int i = 0; i < self.buttonArray.count; i++) { + UIButton *itemBtn = self.buttonArray[i]; + CGRect btnFrame = [itemBtn convertRect:itemBtn.bounds toView:self]; + if (CGRectContainsPoint(btnFrame, location)) { + itemBtn.highlighted = YES; + tempButton = itemBtn; + } else { + itemBtn.highlighted = NO; + } + } + + if (tempButton && recognizer.state == UIGestureRecognizerStateEnded) { + [self buttonClick:tempButton]; + } + +} + +- (void)buttonClick:(UIButton *)button +{ + EasyAlertItem *item = self.itemArray[button.tag]; + if (self.callback || item.callback) { + typeof(self)weakself = self; + dispatch_queue_after_S(EasyShowAnimationTime/2.0f, ^{ + if (self.callback) { + self.callback(weakself, button.tag); + }else{ + if (item.callback) { + item.callback(weakself,button.tag); + } + } + }); + } + [self alertWindowTap]; +} +- (UIButton *)alertButtonWithIndex:(long)index +{ + EasyAlertItem *item = self.itemArray[index]; + + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.tag = index; + button.adjustsImageWhenHighlighted = NO; + [button setTitle:item.title forState:UIControlStateNormal]; + [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; + + UIImage *bgImage = [EasyShowUtils imageWithColor:[UIColor whiteColor]]; + UIImage *bgHighImage = [EasyShowUtils imageWithColor:[[UIColor whiteColor]colorWithAlphaComponent:0.7] ]; + [button setBackgroundImage:bgImage forState:UIControlStateNormal]; + [button setBackgroundImage:bgHighImage forState:UIControlStateHighlighted]; + + UIFont *textFont = [UIFont systemFontOfSize:17] ; + UIColor *textColor = [UIColor blackColor] ; + switch (item.itemTpye) { + case AlertItemTypeRed: { + textColor = [UIColor redColor]; + }break ; + case AlertItemTypeBlodRed:{ + textColor = [UIColor redColor]; + textFont = [UIFont boldSystemFontOfSize:17] ; + }break ; + case AlertItemTypeBlue:{ + textColor = [UIColor blueColor]; + }break ; + case AlertItemTypeBlodBlue:{ + textColor = [UIColor blueColor]; + textFont = [UIFont boldSystemFontOfSize:17] ; + }break ; + case AlertItemTypeBlack:{ + + }break ; + case AlertItemTypeBlodBlack:{ + textFont = [UIFont boldSystemFontOfSize:17] ; + }break ; + case AlertItemTypeCustom:{ + textColor = UIColorHex(#21BEBD); + textFont = [UIFont boldSystemFontOfSize:13] ; + + }break ; + default: + break ; + } + [button setTitleColor:textColor forState:UIControlStateNormal]; + [button setTitleColor:[textColor colorWithAlphaComponent:0.2] forState:UIControlStateHighlighted]; + [button.titleLabel setFont:textFont] ; + + [self.buttonArray addObject:button]; + + return button ; +} + +- (void)alertWindowTap +{ + + void (^completion)(void) = ^{ +// [self.oldKeyWindow makeKeyWindow]; + [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + [self removeFromSuperview]; + + [self.alertWindow.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + self.alertWindow.hidden = YES ; + [self.alertWindow removeFromSuperview]; + self.alertWindow = nil; + }; + + [self showEndAnimationWithType:self.config.animationType + completion:completion]; +} + +#pragma mark - animation + +- (void)showEndAnimationWithType:(AlertAnimationType)type completion:(void(^)(void))completion +{ + if (self.part.alertType == AlertViewTypeActionSheet) { + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alertBgView.easyS_top = SCREEN_HEIGHT_S ; + } completion:^(BOOL finished) { + if (completion) { + completion() ; + } + }]; + return ; + } + + switch (type) { + case AlertAnimationTypeFade: + { + [UIView animateWithDuration:EasyShowAnimationTime + delay:0 + options:UIViewAnimationOptionCurveEaseIn + animations:^{ + self.alpha = .0f; + self.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + if (completion) { + completion() ; + } + }]; + }break; + case AlertAnimationTypeZoom: + { + [UIView animateWithDuration:EasyShowAnimationTime + delay:0 options:UIViewAnimationOptionCurveEaseIn + animations:^{ + self.alertBgView.alpha = 0 ; + self.alertBgView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + if (completion) { + completion() ; + } + }]; + }break ; + case AlertAnimationTypeBounce: + { + CABasicAnimation *bacAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + bacAnimation.duration = EasyShowAnimationTime ; + bacAnimation.beginTime = .0; + bacAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.4f :0.3f :0.5f :-0.5f]; + bacAnimation.fromValue = [NSNumber numberWithFloat:1.0f]; + bacAnimation.toValue = [NSNumber numberWithFloat:0.0f]; + + CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; + animationGroup.animations = @[bacAnimation]; + animationGroup.duration = bacAnimation.duration; + animationGroup.removedOnCompletion = NO; + animationGroup.fillMode = kCAFillModeForwards; + + animationGroup.delegate = self ; + [animationGroup setValue:completion forKey:@"handler"]; + + [self.alertBgView.layer addAnimation:animationGroup forKey:nil]; + }break ; + case AlertAnimationTypePush: + { + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alertBgView.easyS_top = SCREEN_HEIGHT_S ; + } completion:^(BOOL finished) { + if (completion) { + completion() ; + } + }]; + }break ; + default: + { + if (completion) { + completion(); + } + } + break; + } +} + +- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag +{ + void(^completion)(void) = [anim valueForKey:@"handler"]; + if (completion) { + completion(); + } +} +- (void)showStartAnimationWithType:(AlertAnimationType)type completion:(void(^)(void))completion +{ + if (self.part.alertType == AlertViewTypeActionSheet) { + self.alertBgView.easyS_top = SCREEN_HEIGHT_S ; + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alertBgView.easyS_top = (SCREEN_HEIGHT_S-self.alertBgView.easyS_height)-5 ; + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.05 animations:^{ + self.alertBgView.easyS_top = (SCREEN_HEIGHT_S-self.alertBgView.easyS_height) ; + } completion:^(BOOL finished) { + }]; + }]; + return ; + } + + switch (type) { + case AlertAnimationTypeFade: + { + self.alertBgView.alpha = 0 ; + [UIView beginAnimations:nil context:NULL]; + [UIView setAnimationDuration:EasyShowAnimationTime]; + self.alertBgView.alpha = 1.0f; + [UIView commitAnimations]; + }break; + case AlertAnimationTypeZoom: + { + self.alertBgView.alpha = 0 ; + self.alertBgView.transform = CGAffineTransformConcat(CGAffineTransformIdentity, CGAffineTransformMakeScale(3, 3)); + [UIView beginAnimations:nil context:NULL]; + [UIView setAnimationDuration:EasyShowAnimationTime]; + self.alertBgView.alpha = 1.0f; + self.alertBgView.transform = CGAffineTransformIdentity; + [UIView commitAnimations]; + }break ; + case AlertAnimationTypeBounce: + { + CAKeyframeAnimation *popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; + popAnimation.duration = EasyShowAnimationTime; + popAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.01f, 0.01f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.05f, 1.05f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.95f, 0.95f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DIdentity]]; + popAnimation.keyTimes = @[@0.2f, @0.5f, @0.75f, @1.0f]; + popAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; + [self.alertBgView.layer addAnimation:popAnimation forKey:nil]; + }break ; + case AlertAnimationTypePush: + { + self.alertBgView.easyS_top = SCREEN_HEIGHT_S ; + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alertBgView.easyS_top = (SCREEN_HEIGHT_S-self.alertBgView.easyS_height)/2-5 ; + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.05 animations:^{ + self.alertBgView.easyS_top = (SCREEN_HEIGHT_S-self.alertBgView.easyS_height)/2 ; + } completion:^(BOOL finished) { + }]; + }]; + }break ; + default: + break; + } +} + +- (void)removeOtherAlertView +{ + NSMutableArray *tempAlertViewArray = [NSMutableArray arrayWithCapacity:2]; + for (UIWindow *subWindow in [UIApplication sharedApplication].windows) { + for (UIView *subView in subWindow.subviews) { + if ([subView isKindOfClass:[self class]]) { + [tempAlertViewArray addObject:subView]; + } + } + } + if (tempAlertViewArray.count > self.config.alertViewMaxNum-1) { + for (int i = 0 ; i < tempAlertViewArray.count-self.config.alertViewMaxNum+1; i++) { + UIView *tempView = tempAlertViewArray[i]; + if ([tempView isKindOfClass:[self class]]) { + EasyAlertView *tempAlertView = (EasyAlertView *)tempView ; + [tempAlertView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + [tempAlertView removeFromSuperview]; + + [tempAlertView.alertWindow.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + tempAlertView.alertWindow.hidden = YES ; + [tempAlertView.alertWindow removeFromSuperview]; + tempAlertView.alertWindow = nil; + } + } + } +} + +#pragma mark - getter +- (UIView *)alertBgView +{ + if (nil == _alertBgView) { + _alertBgView = [[UIView alloc]init]; + _alertBgView.backgroundColor = self.config.tintColor==[UIColor clearColor] ? [UIColor groupTableViewBackgroundColor] : self.config.tintColor ; + _alertBgView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight ; + UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(bgViewPan:)] ; + [_alertBgView addGestureRecognizer:panGesture]; + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bgViewTap:)] ; + [_alertBgView addGestureRecognizer:tapGesture]; + + // _alertBgView.clipsToBounds = YES ; + // _alertBgView.layer.cornerRadius = 10 ; + } + return _alertBgView ; +} +- (UIWindow *)alertWindow { + if (nil == _alertWindow) { + _alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + _alertBgView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight ; + + if (self.config.effectType == AlertBgEffectTypeAlphaCover) { + _alertWindow.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3]; + } + else{ + UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; + effectView.alpha = 0.8; + effectView.frame = _alertWindow.bounds ; + [_alertWindow addSubview:effectView]; + } + + + _alertWindow.hidden = NO ; + if (self.config.bgViewEvent) { + UITapGestureRecognizer *tapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(alertWindowTap)]; + [_alertWindow addGestureRecognizer:tapGes]; + } + } + + return _alertWindow; +} + +- (UILabel *)titleLabel +{ + if (nil == _titleLabel) { + _titleLabel = [[EasyShowLabel alloc] initWithContentInset:UIEdgeInsetsMake(35, 30, 15, 30)]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.backgroundColor = self.config.tintColor == [UIColor clearColor] ? [UIColor whiteColor] : self.config.tintColor ; + _titleLabel.font = [UIFont boldSystemFontOfSize:20]; + _titleLabel.textColor = self.config.titleColor ; + _titleLabel.numberOfLines = 0; + } + return _titleLabel ; +} +- (UILabel *)subtitleLabel +{ + if (nil == _subtitleLabel) { + _subtitleLabel = [[EasyShowLabel alloc] initWithContentInset:UIEdgeInsetsMake(15, 30, 20, 30)]; + _subtitleLabel.textAlignment = self.config.subtitleTextAligment ; + _subtitleLabel.backgroundColor = self.config.tintColor==[UIColor clearColor] ? [UIColor whiteColor] : self.config.tintColor; + _subtitleLabel.font = [UIFont systemFontOfSize:17]; + _subtitleLabel.textColor = self.config.subtitleColor ; + _subtitleLabel.numberOfLines = 0; + } + return _subtitleLabel ; +} +- (NSMutableArray *)buttonArray +{ + if (nil == _buttonArray) { + _buttonArray = [NSMutableArray arrayWithCapacity:3]; + } + return _buttonArray ; +} + + +#pragma mark - 工具方法 ++ (EasyAlertPart *)changePartWithPart:(EasyAlertPart *(^)(void))part +{ + EasyAlertPart *tempPart = part ? part() : nil ; + if (nil == tempPart) { + tempPart = [EasyAlertPart alertPartWithTitle:nil subtitle:nil alertype:AlertViewTypeAlert] ; + } + + if (ISEMPTY_S(tempPart.title) && ISEMPTY_S(tempPart.subtitle)) { + NSAssert(NO, @"you should set title or message") ; + } + return tempPart ; +} ++ (EasyAlertConfig *)changeConfigWithConfig:(EasyAlertConfig *(^)(void))config +{ + EasyAlertConfig *tempConfig = config ? config() : nil ; + if (nil == tempConfig) { + tempConfig = [EasyAlertConfig shared]; + } + + EasyAlertGlobalConfig *globalConfig = [EasyAlertGlobalConfig shared]; + if (!tempConfig.tintColor) { + tempConfig.tintColor = globalConfig.tintColor ; + } + if (!tempConfig.titleColor) { + tempConfig.titleColor = globalConfig.titleColor ; + } + if (!tempConfig.subtitleColor) { + tempConfig.subtitleColor = globalConfig.subtitleColor ; + } + if (tempConfig.animationType == AlertAnimationTypeUndefine) { + tempConfig.animationType = globalConfig.animationType ; + } + if (tempConfig.alertViewMaxNum <= 0) { + tempConfig.alertViewMaxNum = globalConfig.alertViewMaxNum ; + } + return tempConfig ; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyConfig.h new file mode 100644 index 0000000..185cb46 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyConfig.h @@ -0,0 +1,53 @@ +// +// EasyEmptyConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyEmptyConfig : NSObject + + +@property (nonatomic,strong)UIColor *bgColor ; //背景颜色 + +@property (nonatomic,strong)UIFont *tittleFont ; //标题字体大小 +@property (nonatomic,strong)UIColor *titleColor ;//标题字体颜色 + +@property (nonatomic,strong)UIFont *subtitleFont ; //副标题字体大小 +@property (nonatomic,strong)UIColor *subTitleColor ;//副标题字体颜色 + +@property (nonatomic,strong)UIFont *buttonFont ; //按钮字体大小 +@property (nonatomic,strong)UIColor *buttonColor ; //按钮字体亚瑟 +@property (nonatomic,strong)UIColor *buttonBgColor ;//按钮背景颜色 + +@property (nonatomic,assign)UIEdgeInsets easyViewEdgeInsets ;//整个emptyview往内缩的距离(如果为负数,则会超出边界) +@property (nonatomic,assign)UIEdgeInsets buttonEdgeInsets ; //按钮往内缩的边距(按钮四边边缘距离文字的距离) +@property (nonatomic,assign)BOOL scrollVerticalEnable ;//是否可以上下滚动 + ++ (instancetype)shared ; +- (EasyEmptyConfig *(^)(UIColor *))setBgColor ; +- (EasyEmptyConfig *(^)(UIFont *))setTitleFont ; +- (EasyEmptyConfig *(^)(UIColor *))setTitleColor ; +- (EasyEmptyConfig *(^)(UIFont *))setSubtitleFont ; +- (EasyEmptyConfig *(^)(UIColor *))setSubtitleColor ; +- (EasyEmptyConfig *(^)(UIFont *))setButtonFont ; +- (EasyEmptyConfig *(^)(UIColor *))setButtonColor ; +- (EasyEmptyConfig *(^)(UIColor *))setButtonBgColor ; +- (EasyEmptyConfig *(^)(UIEdgeInsets))setEasyViewEdgeInsets ; +- (EasyEmptyConfig *(^)(UIEdgeInsets))setButtonEdgeInsets ; +- (EasyEmptyConfig *(^)(BOOL))setScrollVerticalEnable ; + + ++ (instancetype)configWithBgColor:(UIColor *)bgColor ; ++ (instancetype)configWithBgColor:(UIColor *)bgColor titleFount:(UIFont *)titleFount ; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyConfig.m new file mode 100644 index 0000000..645d4a6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyConfig.m @@ -0,0 +1,118 @@ +// +// EasyEmptyConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyEmptyConfig.h" +#import "EasyEmptyGlobalConfig.h" + +@implementation EasyEmptyConfig + ++ (instancetype)shared +{ + return [[EasyEmptyConfig alloc]init]; +} +- (instancetype)init{ + if ([super init]) { + EasyEmptyGlobalConfig *globalC = [EasyEmptyGlobalConfig shared] ; + _scrollVerticalEnable = globalC.scrollVerticalEnable ; + _easyViewEdgeInsets = UIEdgeInsetsZero ; + } + return self ; +} + + +- (EasyEmptyConfig *(^)(UIColor *))setBgColor +{ + return ^EasyEmptyConfig *(UIColor *bgColor){ + self.bgColor = bgColor ; + return self ; + }; +} +- (EasyEmptyConfig *(^)(UIFont *))setTitleFont +{ + return ^EasyEmptyConfig *(UIFont *titleFont){ + self.tittleFont = titleFont ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIColor *))setTitleColor +{ + return ^EasyEmptyConfig *(UIColor *titleColor){ + self.titleColor = titleColor ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIFont *))setSubtitleFont +{ + return ^EasyEmptyConfig *(UIFont *subtitleFont){ + self.subtitleFont = subtitleFont ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIColor *))setSubtitleColor +{ + return ^EasyEmptyConfig *(UIColor *titleColor){ + self.subTitleColor = titleColor ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIFont *))setButtonFont +{ + return ^EasyEmptyConfig *(UIFont *buttonFont){ + self.buttonFont = buttonFont ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIColor *))setButtonColor +{ + return ^EasyEmptyConfig *(UIColor *buttonColor){ + self.buttonColor = buttonColor ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIColor *))setButtonBgColor +{ + return ^EasyEmptyConfig *(UIColor *buttonbgColor){ + self.buttonBgColor = buttonbgColor ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIEdgeInsets))setEasyViewEdgeInsets +{ + return ^EasyEmptyConfig *(UIEdgeInsets edge){ + self.easyViewEdgeInsets = edge ; + return self ; + } ; +} +- (EasyEmptyConfig *(^)(UIEdgeInsets))setButtonEdgeInsets +{ + return ^EasyEmptyConfig *(UIEdgeInsets edge){ + self.buttonEdgeInsets = edge ; + return self ; + } ; +} + +- (EasyEmptyConfig *(^)(BOOL))setScrollVerticalEnable +{ + return ^EasyEmptyConfig *(BOOL enabel){ + self.scrollVerticalEnable = enabel ; + return self ; + } ; +} + ++ (instancetype)configWithBgColor:(UIColor *)bgColor +{ + return [self configWithBgColor:bgColor titleFount:[EasyEmptyGlobalConfig shared].tittleFont]; +} ++ (instancetype)configWithBgColor:(UIColor *)bgColor titleFount:(UIFont *)titleFount +{ + EasyEmptyConfig *config = [self shared] ; + config.bgColor = bgColor ; + config.tittleFont = titleFount ; + return config ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.h new file mode 100644 index 0000000..9dd3cfe --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.h @@ -0,0 +1,40 @@ +// +// EasyEmptyGlobalConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import +#import "EasyShowUtils.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyEmptyGlobalConfig : NSObject + +@property (nonatomic,strong)UIColor *bgColor UI_APPEARANCE_SELECTOR ; //背景颜色 + +@property (nonatomic,strong)UIFont *tittleFont UI_APPEARANCE_SELECTOR ; //标题字体大小 +@property (nonatomic,strong)UIColor *titleColor UI_APPEARANCE_SELECTOR ;//标题字体颜色 + +@property (nonatomic,strong)UIFont *subtitleFont UI_APPEARANCE_SELECTOR ; //副标题字体大小 +@property (nonatomic,strong)UIColor *subTitleColor UI_APPEARANCE_SELECTOR ;//副标题字体颜色 + +@property (nonatomic,strong)UIFont *buttonFont UI_APPEARANCE_SELECTOR ; //按钮字体大小 +@property (nonatomic,strong)UIColor *buttonColor UI_APPEARANCE_SELECTOR ; //按钮字体亚瑟 +@property (nonatomic,strong)UIColor *buttonBgColor UI_APPEARANCE_SELECTOR ;//按钮背景颜色 + +@property (nonatomic,assign)UIEdgeInsets buttonEdgeInsets UI_APPEARANCE_SELECTOR ; //按钮往内缩的边距(按钮四边边缘距离文字的距离) + +@property (nonatomic,assign)BOOL scrollVerticalEnable ;//是否可以上下滚动 + + +easyShowView_singleton_interface + + +@end + +NS_ASSUME_NONNULL_END + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.m new file mode 100644 index 0000000..904fed9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.m @@ -0,0 +1,32 @@ +// +// EasyEmptyGlobalConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/5. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyEmptyGlobalConfig.h" + +@implementation EasyEmptyGlobalConfig + +easyShowView_singleton_implementation(EasyEmptyGlobalConfig) + +- (instancetype)init +{ + if (self = [super init]) { + + _bgColor = [UIColor blackColor]; + _tittleFont = [UIFont systemFontOfSize:17]; + _titleColor = [UIColor blackColor]; + _subtitleFont = [UIFont systemFontOfSize:15]; + _subTitleColor = [UIColor lightGrayColor]; + _buttonFont = [UIFont systemFontOfSize:13]; + _buttonColor = [UIColor blueColor]; + _buttonBgColor = [UIColor whiteColor]; + _buttonEdgeInsets = UIEdgeInsetsMake(15, 20, 15, 20); + _scrollVerticalEnable = YES ; + } + return self ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyPart.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyPart.h new file mode 100644 index 0000000..684147b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyPart.h @@ -0,0 +1,31 @@ +// +// EasyEmptyPart.h +// EasyShowViewDemo +// +// Created by nf on 2018/3/14. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import + +@interface EasyEmptyPart : NSObject + +@property (nonatomic,strong)NSString *title ; //标题 +@property (nonatomic,strong)NSString *subtitle ; //副标题 +@property (nonatomic,strong)NSString *imageName ; //图片名称 +@property (nonatomic,strong)NSArray *buttonArray ;//下面需要的按钮 + ++ (instancetype)shared ; +- (EasyEmptyPart *(^)(NSString *))setTitle ; +- (EasyEmptyPart *(^)(NSString *))setSubtitle ; +- (EasyEmptyPart *(^)(NSString *))setImageName ; +- (EasyEmptyPart *(^)(NSArray *))setButtonArray ; + + ++ (instancetype)itemWithTitle:(NSString *)title ; ++ (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle ; ++ (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName ; ++ (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName buttonArray:(NSArray *)buttonArray ; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyPart.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyPart.m new file mode 100644 index 0000000..9f060b6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyPart.m @@ -0,0 +1,75 @@ +// +// EasyEmptyPart.m +// EasyShowViewDemo +// +// Created by nf on 2018/3/14. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyEmptyPart.h" + +@implementation EasyEmptyPart + ++ (instancetype)shared +{ + return [[self alloc]init] ; +} + +- (EasyEmptyPart *(^)(NSString *))setTitle +{ + return ^EasyEmptyPart* (NSString *title) { + self.title = title; + return self; + }; +} +- (EasyEmptyPart *(^)(NSString *))setSubtitle +{ + return ^EasyEmptyPart* (NSString *subtitle){ + self.subtitle = subtitle ; + return self ; + }; +} +- (EasyEmptyPart *(^)(NSString *))setImageName +{ + return ^EasyEmptyPart *(NSString *imageName){ + self.imageName = imageName ; + return self ; + }; +} +- (EasyEmptyPart *(^)(NSArray *))setButtonArray +{ + return ^EasyEmptyPart *(NSArray *buttonArray){ + self.buttonArray = [buttonArray copy]; + return self ; + }; +} + + ++ (instancetype)itemWithTitle:(NSString *)title +{ + return [self itemWithTitle:title subtitle:nil]; +} ++ (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle +{ + return [self itemWithTitle:title subtitle:subtitle imageName:nil]; +} ++ (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName +{ + return [self itemWithTitle:title subtitle:subtitle imageName:imageName buttonArray:nil]; +} ++ (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName buttonArray:(NSArray *)buttonArray +{ + EasyEmptyPart *item = [[EasyEmptyPart alloc]init]; + item.title = title ; + item.subtitle = subtitle ; + item.imageName = imageName ; + item.buttonArray = [buttonArray copy]; + return item ; +} + + + + + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyTypes.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyTypes.h new file mode 100644 index 0000000..3e7fea4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyTypes.h @@ -0,0 +1,33 @@ +// +// EasyEmptyTypes.h +// EasyShowViewDemo +// +// Created by nf on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import + +typedef NS_ENUM(NSInteger , callbackType) { + callbackTypeBgView = 0, + callbackTypeButton_1 = 1, + callbackTypeButton_2 = 2, +}; + +//typedef NS_ENUM(NSUInteger , emptyViewType) { +// emptyViewTypeLoading , +// emptyViewTypeNoData , +// emptyViewTypeNetError , +//// emptyViewTypeCustom , +//}; + +@class EasyEmptyView ; + +typedef void (^emptyViewCallback)(EasyEmptyView *view , UIButton *button , callbackType callbackType); + + + +@interface EasyEmptyTypes : NSObject + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyTypes.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyTypes.m new file mode 100644 index 0000000..a004f82 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyTypes.m @@ -0,0 +1,13 @@ +// +// EasyEmptyTypes.m +// EasyShowViewDemo +// +// Created by nf on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyEmptyTypes.h" + +@implementation EasyEmptyTypes + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyView.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyView.h new file mode 100644 index 0000000..9ac805d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyView.h @@ -0,0 +1,34 @@ +// +// EasyEmptyView.h +// EasyShowViewDemo +// +// Created by nf on 2018/1/16. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import + +#import "EasyEmptyPart.h" +#import "EasyEmptyConfig.h" +#import "EasyEmptyTypes.h" + +@interface EasyEmptyView : UIScrollView + ++ (EasyEmptyView *)showEmptyInView:(UIView *)superview + part:(EasyEmptyPart *(^)(void))part ; + ++ (EasyEmptyView *)showEmptyInView:(UIView *)superview + part:(EasyEmptyPart *(^)(void))part + config:(EasyEmptyConfig *(^)(void))config ; + ++ (EasyEmptyView *)showEmptyInView:(UIView *)superview + part:(EasyEmptyPart *(^)(void))part + config:(EasyEmptyConfig *(^)(void))config + callback:(emptyViewCallback)callback ; + + ++ (void)hiddenEmptyInView:(UIView *)superView ; ++ (void)hiddenEmptyView:(EasyEmptyView *)emptyView ; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyView.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyView.m new file mode 100644 index 0000000..7c12a92 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyEmptyView.m @@ -0,0 +1,365 @@ +// +// EasyEmptyView.m +// EasyShowViewDemo +// +// Created by nf on 2018/1/16. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyEmptyView.h" + +#import "EasyEmptyGlobalConfig.h" +#import "EasyShowUtils.h" +#import "EasyShowLabel.h" +#import "UIView+EasyShowExt.h" + +@interface EasyEmptyView() + +@property (nonatomic,strong)EasyEmptyPart *emptyItem ; +@property (nonatomic,strong)EasyEmptyConfig *emptyConfig ; +@property (nonatomic,strong)emptyViewCallback callback ; + +@property (nonatomic,strong)UIView *bgContentView ; +@property (nonatomic,strong)UILabel *defaultTitleLabel ; +@property (nonatomic,strong)UILabel *defaultSubTitleLabel ; +@property (nonatomic,strong)UIImageView *defaultImageView ; + +@end + +@implementation EasyEmptyView + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; +} +- (instancetype)initWithConfig:(EasyEmptyConfig *)config +{ + if (self = [super init]) { + + _emptyConfig = config ; + + self.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight ; + self.backgroundColor = config.bgColor ; + self.alwaysBounceVertical = config.scrollVerticalEnable ; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChangeNoti:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil]; + } + return self ; +} +- (void)statusBarChangeNoti:(NSNotification *)notifycation +{ + [self layoutemptyViewSubviews]; +} + +- (void)layoutemptyViewSubviews +{ + CGFloat contentWidth = [self bgViewWidth];//bgcontentview的高度 + __block CGFloat contentHeight = 0 ;//计算bgcontentview的高度 + if (!ISEMPTY_S(self.emptyItem.imageName)) { + UIImage *defaultImage = [UIImage imageNamed:self.emptyItem.imageName]; + CGSize imageSize = defaultImage.size ; + if (imageSize.width > contentWidth*2/3.0f) { + imageSize.height = (imageSize.height*(contentWidth*2/3.0f))/imageSize.width ; + imageSize.width= contentWidth*2/3.0f ; + } + self.defaultImageView.frame = CGRectMake((contentWidth-imageSize.width)/2.0f, contentHeight, imageSize.width, imageSize.height) ; + contentHeight += imageSize.height+10 ; + } + + if (!ISEMPTY_S(self.emptyItem.title)) { + CGSize titleSize = [self.defaultTitleLabel sizeThatFits:CGSizeMake(contentWidth, MAXFLOAT)]; + self.defaultTitleLabel.frame = CGRectMake(0, contentHeight, contentWidth, titleSize.height); + + contentHeight += self.defaultTitleLabel.easyS_height ; + } + + if (!ISEMPTY_S(self.emptyItem.subtitle)) { + CGSize titleSize = [self.defaultSubTitleLabel sizeThatFits:CGSizeMake(contentWidth, MAXFLOAT)]; + self.defaultSubTitleLabel.frame = CGRectMake(0, contentHeight, contentWidth, titleSize.height); + + contentHeight += self.defaultSubTitleLabel.easyS_height ; + } + + __weak typeof(NSArray *) weakButtonArray = self.emptyItem.buttonArray ; + [self.bgContentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if ([obj isKindOfClass:[UIButton class]]) { + CGRect buttonFrame = obj.frame ; + buttonFrame.origin.y = contentHeight+10 ; + + CGFloat buttonX = (contentWidth-obj.easyS_width)/2; + if (weakButtonArray.count == 2) { + buttonX = (contentWidth/2-obj.easyS_width)/2 + ((obj.tag==2)?(contentWidth/2):0) ; + } + buttonFrame.origin.x =buttonX ; + [obj setFrame:buttonFrame]; + + if (weakButtonArray.count==1 || (weakButtonArray.count==2&&obj.tag==2)) { + contentHeight += buttonFrame.size.height+10 ; + } + } + }] ; + + self.bgContentView.frame = CGRectMake((self.easyS_width-contentWidth)/2, (self.easyS_height-contentHeight)/2, contentWidth, contentHeight) ; + +} +- (void)showView +{ + if (self.callback) { + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(buttonClick:)]; + [self addGestureRecognizer:tapGesture]; + } + [self addSubview:self.bgContentView]; + + if (!ISEMPTY_S(self.emptyItem.imageName)) { + self.defaultImageView.image = [UIImage imageNamed:self.emptyItem.imageName] ; + } + + if (!ISEMPTY_S(self.emptyItem.title)) { + self.defaultTitleLabel.text = self.emptyItem.title ; + } + + if (!ISEMPTY_S(self.emptyItem.subtitle)) { + self.defaultSubTitleLabel.text = self.emptyItem.subtitle ; + } + + for (int i = 0 ; i < self.emptyItem.buttonArray.count; i++) { + UIButton *button = [self defaultButtonWithIndex:i contentWidth:[self bgViewWidth]] ; + [self.bgContentView addSubview:button]; + } + + [self layoutemptyViewSubviews]; + + self.alpha = 0.2 ; + [UIView animateWithDuration:0.3 animations:^{ + self.alpha = 1 ; + }] ; + +} + +- (UIButton *)defaultButtonWithIndex:(long)index contentWidth:(CGFloat)contentWidth +{ + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; + [button setTitleColor:self.emptyConfig.buttonColor forState:UIControlStateNormal]; + [button setTitleColor:[self.emptyConfig.buttonColor colorWithAlphaComponent:0.5f] forState:UIControlStateHighlighted]; + UIImage *bgNormalImg = [EasyShowUtils imageWithColor:self.emptyConfig.buttonBgColor] ; + [button setBackgroundImage:bgNormalImg forState:UIControlStateNormal]; + UIImage *bgHightImg = [EasyShowUtils imageWithColor:[self.emptyConfig.buttonBgColor colorWithAlphaComponent:0.5f]] ; + [button setBackgroundImage:bgHightImg forState:UIControlStateHighlighted]; + button.titleLabel.numberOfLines = 0 ; + [button setTitleEdgeInsets:self.emptyConfig.buttonEdgeInsets]; + button.titleLabel.font = self.emptyConfig.buttonFont ; + [button setTag:index+1]; + + NSString *titleString = self.emptyItem.buttonArray[index]; + CGFloat buttonMaxWidth = contentWidth/self.emptyItem.buttonArray.count - self.emptyConfig.buttonEdgeInsets.left - self.emptyConfig.buttonEdgeInsets.right ; + NSMutableAttributedString *astr = [[NSMutableAttributedString alloc] initWithString:titleString attributes:nil]; + [astr setAttributes:@{NSFontAttributeName:button.titleLabel.font} range:NSMakeRange(0, titleString.length)]; + CGSize buttonSize = [astr boundingRectWithSize:CGSizeMake(buttonMaxWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size; + buttonSize = CGSizeMake(buttonSize.width+self.emptyConfig.buttonEdgeInsets.left + self.emptyConfig.buttonEdgeInsets.right, buttonSize.height+self.emptyConfig.buttonEdgeInsets.top+self.emptyConfig.buttonEdgeInsets.bottom) ; + [button setFrame:CGRectMake(0, 0, buttonSize.width, buttonSize.height)]; + [button setRoundedCorners:4]; + + [button setTitle:titleString forState:UIControlStateNormal]; + + return button ; +} +- (void)buttonClick:(UIButton *)button +{ + [EasyEmptyView hiddenEmptyView:self]; + + if (self.callback) { + if ([button isKindOfClass:[UIButton class]]) { + self.callback(self, button, button.tag) ; + return ; + } + self.callback(self, nil, callbackTypeBgView); + } +} + + +#pragma mark - getter + + +- (CGFloat)bgViewWidth +{ + CGFloat contentWidth = self.easyS_width*0.7 ;//计算bgcontentview的宽度 + if (contentWidth < 200) { //如果superview的宽度小于200 就应该是全部宽度 + contentWidth = self.easyS_width ; + } + return contentWidth ; +} + +- (UIView *)bgContentView +{ + if (nil == _bgContentView) { + _bgContentView = [[UIView alloc]init]; + _bgContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight ; + _bgContentView.backgroundColor = kColorRandom_S ; + } + return _bgContentView ; +} + +- (UIImageView *)defaultImageView +{ + if (nil == _defaultImageView) { + _defaultImageView = [[UIImageView alloc]init]; + _defaultImageView.backgroundColor = kColorRandom_S ; + [self.bgContentView addSubview:_defaultImageView]; + } + return _defaultImageView ; +} +- (UILabel *)defaultSubTitleLabel +{ + if (nil == _defaultSubTitleLabel) { + _defaultSubTitleLabel = [[EasyShowLabel alloc] initWithContentInset:UIEdgeInsetsMake(10, 20, 10, 20)]; + _defaultSubTitleLabel.textColor = self.emptyConfig.subTitleColor ; + _defaultSubTitleLabel.font = self.emptyConfig.subtitleFont ; + _defaultSubTitleLabel.numberOfLines = 0 ; + _defaultSubTitleLabel.textAlignment = NSTextAlignmentCenter ; + _defaultSubTitleLabel.backgroundColor = kColorRandom_S ; + [self.bgContentView addSubview:_defaultSubTitleLabel]; + } + return _defaultSubTitleLabel ; +} +- (UILabel *)defaultTitleLabel +{ + if (nil == _defaultTitleLabel) { + _defaultTitleLabel = [[EasyShowLabel alloc] initWithContentInset:UIEdgeInsetsMake(10, 30, 10, 30)];; + _defaultTitleLabel.textColor = self.emptyConfig.titleColor ; + _defaultTitleLabel.font = self.emptyConfig.tittleFont ; + _defaultTitleLabel.numberOfLines = 0 ; + _defaultTitleLabel.backgroundColor = kColorRandom_S ; + _defaultTitleLabel.textAlignment = NSTextAlignmentCenter ; + [self.bgContentView addSubview:_defaultTitleLabel]; + } + return _defaultTitleLabel ; +} + +#pragma mark - 类方法 + ++ (EasyEmptyView *)showEmptyInView:(UIView *)superview + part:(EasyEmptyPart *(^)(void))part +{ + return [self showEmptyInView:superview part:part config:nil]; +} + ++ (EasyEmptyView *)showEmptyInView:(UIView *)superview + part:(EasyEmptyPart *(^)(void))part + config:(EasyEmptyConfig *(^)(void))config +{ + return [self showEmptyInView:superview part:part config:config callback:nil]; +} + ++ (EasyEmptyView *)showEmptyInView:(UIView *)superview + part:(EasyEmptyPart *(^)(void))part + config:(EasyEmptyConfig *(^)(void))config + callback:(emptyViewCallback)callback +{ + + EasyEmptyConfig *emptyConfig = [self changeConfigWithConfig:config] ; + EasyEmptyPart *emptyItem = part() ; + + NSAssert(emptyItem.buttonArray.count<3, @"you can't set more than two button") ; + + EasyEmptyView *emptyView = [[EasyEmptyView alloc]initWithConfig:emptyConfig]; + emptyView.emptyItem =emptyItem ; + emptyView.callback = callback ; + + UIEdgeInsets edge = emptyConfig.easyViewEdgeInsets ; + CGFloat viewW = superview.easyS_width-edge.left-edge.right ; + CGFloat viewH = superview.easyS_height-edge.top-edge.bottom ; + [emptyView setFrame:CGRectMake(edge.left, edge.top, viewW,viewH )] ; + + [superview addSubview:emptyView] ; + + [emptyView showView]; + + return emptyView ; +} + + ++ (void)hiddenEmptyView:(EasyEmptyView *)emptyView +{ + [UIView animateWithDuration:.3 animations:^{ + emptyView.alpha = 0.2 ; + } completion:^(BOOL finished) { + [emptyView removeFromSuperview]; + }] ; +} ++ (void)hiddenEmptyInView:(UIView *)superView +{ + + NSAssert([NSThread isMainThread], @"needs to be accessed on the main thread."); + if (![NSThread isMainThread]) { + dispatch_async(dispatch_get_main_queue(), ^(void) { + }); + } + + NSEnumerator *subviewsEnum = [superView.subviews reverseObjectEnumerator]; + for (UIView *subview in subviewsEnum) { + if ([subview isKindOfClass:self]) { + EasyEmptyView *emptyView = (EasyEmptyView *)subview ; + [self hiddenEmptyView:emptyView]; + } + } +} + ++ (EasyEmptyConfig *)changeConfigWithConfig:(EasyEmptyConfig *(^)(void))config +{ + EasyEmptyConfig *tempConfig = config ? config() : nil ; + if (!tempConfig) { + tempConfig = [EasyEmptyConfig shared] ; + } + + EasyEmptyGlobalConfig *globalConfig = [EasyEmptyGlobalConfig shared]; + + if (!tempConfig.bgColor) { + tempConfig.bgColor = globalConfig.bgColor ; + } + if (!tempConfig.tittleFont) { + tempConfig.tittleFont =globalConfig.tittleFont; + } + if (!tempConfig.titleColor) { + tempConfig.titleColor = globalConfig.titleColor ; + } + if (!tempConfig.subtitleFont) { + tempConfig.subtitleFont = globalConfig.subtitleFont; + } + if (!tempConfig.subTitleColor) { + tempConfig.subTitleColor = globalConfig.subTitleColor ; + } + if (!tempConfig.buttonFont) { + tempConfig.buttonFont = globalConfig.buttonFont ; + } + if (!tempConfig.buttonColor) { + tempConfig.buttonColor = globalConfig.buttonColor; + } + if (!tempConfig.buttonBgColor) { + tempConfig.buttonBgColor = globalConfig.buttonBgColor; + } + + if (tempConfig.buttonEdgeInsets.top==0 && tempConfig.buttonEdgeInsets.left==0 + && tempConfig.buttonEdgeInsets.bottom==0 && tempConfig.buttonEdgeInsets.right==0 ) { + tempConfig.buttonEdgeInsets = globalConfig.buttonEdgeInsets ; + } + return tempConfig ; +} + +//+ (void)showEmptyViewLoadingWithImageName:(NSString *)imageName +// callback:(emptyViewCallback)callback +//{ +//} +// +//+ (void)showEmptyViewLoadingWithTitle:(NSString *)title +// callback:(emptyViewCallback)callback +//{ +//} +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingConfig.h new file mode 100644 index 0000000..cd9a721 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingConfig.h @@ -0,0 +1,96 @@ +// +// EasyLoadingConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/4. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import +#import "EasyLoadingTypes.h" +#import "EasyShowUtils.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyLoadingConfig : NSObject + + +/** 显示Loading所需要的父视图 **/ +@property (nonatomic,strong)UIView *superView ; + +/** 加载框所显示的类型 **/ +@property LoadingShowType LoadingType ; + +/** 显示/隐藏 加载框的动画 **/ +@property LoadingAnimationType animationType ; + +/** 在显示加载框的时候,superview能否接收事件。默认为NO **/ +@property BOOL superReceiveEvent ; + +/** + * 是否将加载框显示到window上面。默认为NO(此属性只有在不传superview的时候有效) + * 当为NO: 加载框会遮盖住最上面一个controller的大小。如果superReceiveEvent为NO,那么superview不接受事件,返回按钮会有效。 + * 当为YES:加载框会在盖住整个window的大小。如果superReceiveEvent为NO,那么在不隐藏加载框的时候返回事件都会被遮住。 + * + */ +@property BOOL showOnWindow ; + + +/** 圆角大小 **/ +@property (nonatomic,assign)CGFloat cycleCornerWidth ; + +/** 加载框主体颜色 **/ +@property (nonatomic,strong)UIColor * tintColor ; + +/** 文字字体大小 **/ +@property (nonatomic,strong)UIFont * textFont ; + +/** 背景颜色 **/ +@property (nonatomic,strong)UIColor * bgColor ; + +/** 图片动画类型 所需要的图片数组 **/ +@property (nonatomic,strong)NSArray * playImagesArray ; + + + +#pragma mark - 创建对象的简便方法 + ++ (instancetype)shared ; + + +#pragma mark - 链式编程设置属性(和上面直接设置属性一样) + +- (EasyLoadingConfig *(^)(UIView *))setSuperView ; +- (EasyLoadingConfig *(^)(BOOL))setSuperReceiveEvent ; +- (EasyLoadingConfig *(^)(LoadingShowType))setLoadingType ; +- (EasyLoadingConfig *(^)(LoadingAnimationType animationType))setAnimationType ; +- (EasyLoadingConfig *(^)(BOOL))setShowOnWindow ; +- (EasyLoadingConfig *(^)(CGFloat))setCycleCornerWidth ; +- (EasyLoadingConfig *(^)(UIColor *))setTintColor ; +- (EasyLoadingConfig *(^)(UIFont *))setTextFont ; +- (EasyLoadingConfig *(^)(UIColor *))setBgColor ; +- (EasyLoadingConfig *(^)(NSArray *))setPlayImagesArray ; + + +#pragma mark - 类方法设置属性(和上面直接设置属性一样) + ++ (instancetype)configInView:(UIView *)superView ; + ++ (instancetype)configInView:(UIView *)superView + showType:(LoadingShowType)showType; + ++ (instancetype)configInView:(UIView *)superView + showType:(LoadingShowType)showType + animationType:(LoadingAnimationType)animationType; + ++ (instancetype)configInView:(UIView *)superView + showType:(LoadingShowType)showType + animationType:(LoadingAnimationType)animationType + superReceive:(BOOL)receive ; + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingConfig.m new file mode 100644 index 0000000..282d5ca --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingConfig.m @@ -0,0 +1,132 @@ +// +// EasyLoadingConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/4. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyLoadingConfig.h" +#import "EasyShowUtils.h" +#import "EasyLoadingGlobalConfig.h" + +@implementation EasyLoadingConfig + ++ (instancetype)shared +{ + return [[self alloc]init]; +} +- (instancetype)init +{ + if (self = [super init]) { + EasyLoadingGlobalConfig *golbalC = [EasyLoadingGlobalConfig shared]; + _LoadingType = golbalC.LoadingType ; + _animationType = golbalC.animationType ; + _superReceiveEvent = golbalC.superReceiveEvent ; + _showOnWindow = golbalC.showOnWindow ; + } + return self ; +} + +- (EasyLoadingConfig *(^)(UIView *))setSuperView { + return ^EasyLoadingConfig *(UIView *spuerView){ + self.superView = spuerView ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(BOOL))setSuperReceiveEvent{ + return ^EasyLoadingConfig *(BOOL receive){ + self.superReceiveEvent = receive ; + return self ; + } ; +} +- (EasyLoadingConfig *(^)(LoadingShowType))setLoadingType { + return ^EasyLoadingConfig *(LoadingShowType showtype){ + self.LoadingType = showtype ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(LoadingAnimationType))setAnimationType { + return ^EasyLoadingConfig *(LoadingAnimationType animationtype){ + self.animationType = animationtype ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(BOOL))setShowOnWindow { + return ^EasyLoadingConfig *(BOOL showOnWindow){ + self.showOnWindow = showOnWindow ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(CGFloat))setCycleCornerWidth{ + return ^EasyLoadingConfig *(CGFloat cornerWidth){ + self.cycleCornerWidth = cornerWidth ; + return self ; + }; +} + +- (EasyLoadingConfig *(^)(UIColor *))setTintColor{ + return ^EasyLoadingConfig *(UIColor *titleColor){ + self.tintColor = titleColor ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(UIFont *))setTextFont { + return ^EasyLoadingConfig *(UIFont *textFont){ + self.textFont = textFont ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(UIColor *))setBgColor { + return ^EasyLoadingConfig *(UIColor *bgcolor){ + self.bgColor = bgcolor ; + return self ; + }; +} +- (EasyLoadingConfig *(^)(NSArray *))setPlayImagesArray +{ + return ^EasyLoadingConfig *(NSArray *playImagesArray){ + self.playImagesArray = playImagesArray ; + return self ; + }; +} + + + ++ (instancetype)configInView:(UIView *)superView +{ + return [EasyLoadingConfig configInView:superView + showType:LoadingShowTypeUnDefine]; +} + ++ (instancetype)configInView:(UIView *)superView + showType:(LoadingShowType)showType +{ + return [self configInView:superView + showType:showType + animationType:LoadingAnimationTypeUndefine]; +} + ++ (instancetype)configInView:(UIView *)superView + showType:(LoadingShowType)showType + animationType:(LoadingAnimationType)animationType +{ + return [self configInView:superView + showType:showType + animationType:animationType + superReceive:[EasyLoadingGlobalConfig shared].superReceiveEvent]; +} + ++ (instancetype)configInView:(UIView *)superView + showType:(LoadingShowType)showType + animationType:(LoadingAnimationType)animationType + superReceive:(BOOL)receive +{ + EasyLoadingConfig *config = [[EasyLoadingConfig alloc]init]; + config.superView = superView ; + config.superReceiveEvent = receive ; + config.LoadingType = showType ; + config.animationType = animationType ; + return config ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.h new file mode 100644 index 0000000..87d0081 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.h @@ -0,0 +1,61 @@ +// +// EasyLoadingGlobalConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/4. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import +#import "EasyLoadingTypes.h" +#import "EasyShowUtils.h" + +NS_ASSUME_NONNULL_BEGIN + + +@interface EasyLoadingGlobalConfig : NSObject + +easyShowView_singleton_interface + + +/** 加载框所显示的类型 **/ +@property LoadingShowType LoadingType UI_APPEARANCE_SELECTOR ; + +/** 显示/隐藏 加载框的动画 **/ +@property LoadingAnimationType animationType UI_APPEARANCE_SELECTOR ; + +/** 在显示加载框的时候,superview能否接收事件。默认为NO **/ +@property BOOL superReceiveEvent UI_APPEARANCE_SELECTOR ; + +/** + * 是否将加载框显示到window上面。默认为NO(此属性只有在不传superview的时候有效) + * 当为NO: 加载框会遮盖住最上面一个controller的大小。如果superReceiveEvent为NO,那么superview不接受事件,返回按钮会有效。 + * 当为YES:加载框会在盖住整个window的大小。如果superReceiveEvent为NO,那么在不隐藏加载框的时候返回事件都会被遮住。 + * + */ +@property BOOL showOnWindow UI_APPEARANCE_SELECTOR ; + + +/** 圆角大小 **/ +@property (nonatomic,assign)CGFloat cycleCornerWidth UI_APPEARANCE_SELECTOR ; + +/** 加载框主体颜色 **/ +@property (nonatomic,strong)UIColor * tintColor UI_APPEARANCE_SELECTOR ; + +/** 文字字体大小 **/ +@property (nonatomic,strong)UIFont * textFont UI_APPEARANCE_SELECTOR ; + +/** 背景颜色 **/ +@property (nonatomic,strong)UIColor * bgColor UI_APPEARANCE_SELECTOR ; + +/** 图片动画类型 所需要的图片数组 **/ +@property (nonatomic,strong)NSArray * playImagesArray UI_APPEARANCE_SELECTOR ; + + + + +@end + +NS_ASSUME_NONNULL_END + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.m new file mode 100644 index 0000000..3a065c8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.m @@ -0,0 +1,31 @@ +// +// EasyLoadingGlobalConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/4. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyLoadingGlobalConfig.h" + +@implementation EasyLoadingGlobalConfig + +easyShowView_singleton_implementation(EasyLoadingGlobalConfig) + +- (instancetype)init +{ + if (self = [super init]) { + + _LoadingType = LoadingShowTypeTurnAround ; + _animationType = LoadingAnimationTypeBounce ; + _textFont = [UIFont systemFontOfSize:15]; + _tintColor = [UIColor blackColor]; + _bgColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.05]; + _superReceiveEvent = YES ; + _showOnWindow = NO ; + _cycleCornerWidth = 5 ; + + } + return self ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingTypes.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingTypes.h new file mode 100644 index 0000000..85fbc2a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingTypes.h @@ -0,0 +1,52 @@ +// +// EasyLoadingTypes.h +// EasyShowViewDemo +// +// Created by nf on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import + +/** + * 加载框的样式 + */ +typedef NS_ENUM(NSInteger , LoadingShowType) { + + LoadingShowTypeUnDefine = 0 , /** 未定义 */ + LoadingShowTypeTurnAround = 1 , //默认转圈样式 + LoadingShowTypeTurnAroundLeft = 2 , //默认在左边转圈样式 + + LoadingShowTypeIndicator = 3 , //菊花样式 + LoadingShowTypeIndicatorLeft = 4 , //菊花在左边的样式 + + LoadingShowTypePlayImages = 5 , //以一个图片数组轮流播放(需添加一组图片) + LoadingShowTypePlayImagesLeft = 6 , //以一个图片数组轮流播放需添加一组图片) + + LoadingShowTypeImageUpturn = 7 ,//自定义图片翻转样式 + LoadingShowTypeImageUpturnLeft= 8 ,//自动以图片左边翻转样式 + + LoadingShowTypeImageAround = 9 ,//自定义图片边缘转圈样式 + LoadingShowTypeImageAroundLeft= 10 ,//自动以图片左边边缘转圈样式 +}; + +/** + * 动画类型 + */ +typedef NS_ENUM(NSInteger , LoadingAnimationType) { + LoadingAnimationTypeUndefine = 0 , /** 未定义 */ + LoadingAnimationTypeNone ,//无动画 + LoadingAnimationTypeFade,//alpha改变 + LoadingAnimationTypeBounce ,//抖动 +} ; + + +UIKIT_EXTERN const CGFloat EasyShowLoadingMaxWidth ; //显示文字的最大宽度(高度已限制死) +UIKIT_EXTERN const CGFloat EasyShowLoadingImageEdge ; //加载框图片的边距 +UIKIT_EXTERN const CGFloat EasyShowLoadingImageWH ; //加载框图片的大小 +UIKIT_EXTERN const CGFloat EasyShowLoadingImageMaxWH ; //加载框图片的最大宽度 + +@interface EasyLoadingTypes : NSObject + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingTypes.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingTypes.m new file mode 100644 index 0000000..0df8568 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingTypes.m @@ -0,0 +1,19 @@ +// +// EasyLoadingTypes.m +// EasyShowViewDemo +// +// Created by nf on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyLoadingTypes.h" + + +const CGFloat EasyShowLoadingMaxWidth = 200 ; //显示文字的最大宽度(高度已限制死) +const CGFloat EasyShowLoadingImageEdge = 10 ; //加载框图片的边距 +const CGFloat EasyShowLoadingImageWH = 30 ; //加载框图片的大小 +const CGFloat EasyShowLoadingImageMaxWH = 60 ; //加载框图片的最大宽度 + +@implementation EasyLoadingTypes + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingView.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingView.h new file mode 100644 index 0000000..fba6ad3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingView.h @@ -0,0 +1,41 @@ +// +// EasyLoadingView.h +// EasyShowViewDemo +// +// Created by nf on 2017/12/14. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import + +#import "EasyLoadingConfig.h" + +@interface EasyLoadingView : UIView + +/** + * 显示一个加载框(config:显示属性设置) + */ ++ (EasyLoadingView *)showLoading ; ++ (EasyLoadingView *)showLoadingText:(NSString *)text ; ++ (EasyLoadingView *)showLoadingText:(NSString *)text + config:(EasyLoadingConfig *(^)(void))config ; + +/** + * 显示一个带图片的加载框 (config:显示属性设置) + */ ++ (EasyLoadingView *)showLoadingText:(NSString *)text + imageName:(NSString *)imageName ; ++ (EasyLoadingView *)showLoadingText:(NSString *)text + imageName:(NSString *)imageName + config:(EasyLoadingConfig *(^)(void))config ; + +/** + * 移除一个加载框 + * superview:加载框所在的父视图。(如果show没指定父视图。那么隐藏也不用) + */ ++ (void)hidenLoading ; ++ (void)hidenLoingInView:(UIView *)superView ; ++ (void)hidenLoading:(EasyLoadingView *)LoadingView ; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingView.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingView.m new file mode 100644 index 0000000..368f857 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyLoadingView.m @@ -0,0 +1,630 @@ +// +// EasyLoadingView.m +// EasyShowViewDemo +// +// Created by nf on 2017/12/14. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import "EasyLoadingView.h" +#import "UIView+EasyShowExt.h" +#import "EasyShowLabel.h" + +#import "EasyLoadingGlobalConfig.h" + +@interface EasyLoadingView() + +@property (nonatomic,strong)NSString *showText ;//展示的文字 +@property (nonatomic,strong)NSString *showImageName ;//展示的图片 +@property (nonatomic,strong)EasyLoadingConfig *showConfig ;//展示的配置信息 + + +@property (nonatomic,strong)UIView *LoadingBgView ;//上面放着 textlabel 和 imageview +@property (nonatomic,strong)UILabel *textLabel ; +@property (nonatomic,strong)UIImageView *imageView ; + +@property (nonatomic,strong)UIActivityIndicatorView *imageViewIndeicator ; + +@end + +@implementation EasyLoadingView + +- (void)dealloc +{ + +} + +- (instancetype)initWithFrame:(CGRect)frame showText:(NSString *)showText iamgeName:(NSString *)imageName config:(EasyLoadingConfig *)config +{ + if (self = [super initWithFrame:frame]) { + self.showText = showText ; + self.showImageName = imageName ; + self.showConfig = config ; + [self bluidUI]; + } + return self ; +} + + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + self.backgroundColor = [UIColor clearColor]; // [UIColor greenColor] ;// + } + return self ; +} + +- (void)bluidUI +{ + //展示视图的frame + CGSize imageSize = CGSizeZero ; + switch (self.showConfig.LoadingType) { + case LoadingShowTypeTurnAround: + case LoadingShowTypeTurnAroundLeft: + case LoadingShowTypeIndicator: + case LoadingShowTypeIndicatorLeft: + imageSize = CGSizeMake(EasyShowLoadingImageWH, EasyShowLoadingImageWH); + break; + case LoadingShowTypePlayImages: + case LoadingShowTypePlayImagesLeft: + { + NSAssert(self.showConfig.playImagesArray, @"you should set a image array!") ; + UIImage *image = self.showConfig.playImagesArray.firstObject ; + CGSize tempSize = image.size ; + if (tempSize.height > EasyShowLoadingImageMaxWH) { + tempSize.height = EasyShowLoadingImageMaxWH ; + } + if (tempSize.width > EasyShowLoadingImageMaxWH) { + tempSize.width = EasyShowLoadingImageMaxWH ; + } + imageSize = tempSize ; + }break ; + case LoadingShowTypeImageUpturn: + case LoadingShowTypeImageUpturnLeft: + case LoadingShowTypeImageAround: + case LoadingShowTypeImageAroundLeft: + { + UIImage *image = [[UIImage imageNamed:self.showImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + CGSize tempSize = image.size ; + if (tempSize.height > EasyShowLoadingImageMaxWH) { + tempSize.height = EasyShowLoadingImageMaxWH ; + } + if (tempSize.width > EasyShowLoadingImageMaxWH) { + tempSize.width = EasyShowLoadingImageMaxWH ; + } + imageSize = tempSize ; + }break ; + default: + break; + } + + + if (!ISEMPTY_S(self.showText)) { + self.textLabel.text = self.showText ; + } + + CGFloat textMaxWidth = EasyShowLoadingMaxWidth ; + if (self.showConfig.LoadingType%2 == 0) {//当为左右形式的时候减去图片的宽度 + textMaxWidth -= EasyShowLoadingImageWH+EasyShowLoadingImageEdge*2 ; + } + + CGSize textSize = [self.textLabel sizeThatFits:CGSizeMake(textMaxWidth, MAXFLOAT)]; + if (ISEMPTY_S(self.showText)) { + textSize = CGSizeZero ; + } + + //显示区域的宽高 + CGSize displayAreaSize = CGSizeZero ; + if (self.showConfig.LoadingType%2 == 0) { + //左右形式 + displayAreaSize.width = imageSize.width + EasyShowLoadingImageEdge*2 + textSize.width ; + displayAreaSize.height = MAX(imageSize.height+ EasyShowLoadingImageEdge*2, textSize.height) ; + } + else{ + //上下形式 + displayAreaSize.width = MAX(imageSize.width+2*EasyShowLoadingImageEdge, textSize.width); + displayAreaSize.height = imageSize.height+2*EasyShowLoadingImageEdge + textSize.height ; + } + + + if (self.showConfig.superReceiveEvent) { + //父视图能够接受事件 。 显示区域的大小=self的大小=displayAreaSize + + [self setFrame:CGRectMake((self.showConfig.superView.easyS_width-displayAreaSize.width)/2, (self.showConfig.superView.easyS_height-displayAreaSize.height)/2, displayAreaSize.width, displayAreaSize.height)]; + } + else{ + //父视图不能接收-->self的大小应该为superview的大小。来遮盖 + + [self setFrame: CGRectMake(0, 0, self.showConfig.superView.easyS_width, self.showConfig.superView.easyS_height)] ; + + self.LoadingBgView.center = self.center ; + + } + + self.LoadingBgView.frame = CGRectMake(0,0, displayAreaSize.width,displayAreaSize.height) ; + if (!self.showConfig.superReceiveEvent ) { + self.LoadingBgView.center = self.center ; + } + + + self.imageView.frame = CGRectMake(EasyShowLoadingImageEdge, EasyShowLoadingImageEdge, imageSize.width, imageSize.height) ; + if (self.showConfig.LoadingType%2 != 0) {//上下形式 + self.imageView.easyS_centerX = self.LoadingBgView.easyS_width/2 ; + }else{ + self.imageView.easyS_centerY = self.LoadingBgView.easyS_height/2; + } + + CGFloat textLabelX = 0 ; + CGFloat textLabelY = 0 ; + if (self.showConfig.LoadingType%2 == 0 ) {//左右形式 + textLabelX = self.imageView.easyS_right ; + textLabelY = (self.LoadingBgView.easyS_height-textSize.height)/2 ; + } + else{ + textLabelX = 0 ; + textLabelY = self.imageView.easyS_bottom + EasyShowLoadingImageEdge ; + } + self.textLabel.frame = CGRectMake(textLabelX, textLabelY, textSize.width, textSize.height ); + + if ((self.showConfig.LoadingType%2 !=0) && !ISEMPTY_S(self.showText)) { + self.imageView.easyS_y += 8 ; + } + +// [superView addSubview:self]; + if (self.showConfig.cycleCornerWidth > 0) { + [_LoadingBgView setRoundedCorners:self.showConfig.cycleCornerWidth]; + } + + switch (self.showConfig.LoadingType) { + case LoadingShowTypeTurnAround: + case LoadingShowTypeTurnAroundLeft: + [self drawAnimationImageViewLoading]; + break; + case LoadingShowTypeIndicator: + case LoadingShowTypeIndicatorLeft: + [self.imageView addSubview:self.imageViewIndeicator]; + break ; + case LoadingShowTypePlayImages: + case LoadingShowTypePlayImagesLeft: + { + UIImage *tempImage = self.showConfig.playImagesArray.firstObject ; + if (tempImage) { + self.imageView.image = tempImage ; + } + } + break ; + case LoadingShowTypeImageUpturn: + case LoadingShowTypeImageUpturnLeft: + + case LoadingShowTypeImageAround: + case LoadingShowTypeImageAroundLeft: + { + UIImage *image = [[UIImage imageNamed:self.showImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + if (image) { + self.imageView.image = image ; + } + else{ + NSAssert(NO, @"iamgeName is illgal "); + } + } break ; + default: + break; + } + + + void (^completion)(void) = ^{ + switch (self.showConfig.LoadingType) { + case LoadingShowTypeTurnAround: + case LoadingShowTypeTurnAroundLeft: + [self drawAnimiationImageView:NO]; + break; + case LoadingShowTypeIndicator: + case LoadingShowTypeIndicatorLeft: + [self.imageViewIndeicator startAnimating]; + break ; + case LoadingShowTypePlayImages: + case LoadingShowTypePlayImagesLeft: + { + NSMutableArray *tempArray= [NSMutableArray arrayWithCapacity:20]; + for (int i = 0 ; i < self.showConfig.playImagesArray.count; i++) { + UIImage *img = self.showConfig.playImagesArray[i] ; + if ([img isKindOfClass:[UIImage class]]) { + [tempArray addObject:img]; + } + } + self.imageView.animationImages = tempArray ; + self.imageView.animationDuration = EasyShowAnimationTime ; + // self.imageView.animationRepeatCount = NSIntegerMax ; + [self.imageView startAnimating]; + + }break ; + case LoadingShowTypeImageUpturn: + case LoadingShowTypeImageUpturnLeft: + [self drawAnimiationImageView:YES]; + break ; + case LoadingShowTypeImageAround: + case LoadingShowTypeImageAroundLeft: + [self drawGradientaLayerAmination]; + break ; + default: + break; + } + }; + + + switch (self.showConfig.animationType) { + case LoadingAnimationTypeNone: + completion() ; + break; + case LoadingAnimationTypeBounce: + [self showBounceAnimationStart:YES completion:completion]; + break ; + case LoadingAnimationTypeFade: + [self showFadeAnimationStart:YES completion:completion ] ; + break ; + default: + break; + } + +} + +- (void)drawGradientaLayerAmination +{ + + CAShapeLayer *shapeLayer = [CAShapeLayer layer]; + shapeLayer.fillColor = [UIColor clearColor].CGColor; + shapeLayer.strokeColor = [UIColor clearColor].CGColor; + shapeLayer.lineCap = kCALineCapRound; + shapeLayer.lineJoin = kCALineJoinRound; + + CGFloat layerRadius = self.imageView.easyS_width/2*1.0f ; + shapeLayer.frame = CGRectMake(.0f, .0f, layerRadius*2.f+3, layerRadius*2.f+3) ; + + CGFloat cp = layerRadius+3/2.f; + UIBezierPath *p = [UIBezierPath bezierPathWithArcCenter:CGPointMake(cp, cp) radius:layerRadius startAngle:.0f endAngle:.75f*M_PI clockwise:YES]; + shapeLayer.path = p.CGPath; + + shapeLayer.strokeColor = self.showConfig.tintColor.CGColor; + shapeLayer.lineWidth=2.0f; + + + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.startPoint = CGPointMake(.0f, .5f); + gradientLayer.endPoint = CGPointMake(1.f, .5f); + gradientLayer.frame = shapeLayer.frame ; + + NSMutableArray *tempArray = [NSMutableArray arrayWithCapacity:6]; + for(int i=10;i>=0;i-=2) { + [tempArray addObject:(__bridge id)[self.showConfig.tintColor colorWithAlphaComponent:i*.1f].CGColor]; + } + gradientLayer.colors = tempArray; + gradientLayer.mask = shapeLayer; + [self.imageView.layer addSublayer:gradientLayer]; + + + CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; + animation.fromValue = @0; + animation.toValue = @(2.f*M_PI); + animation.duration = 1; + animation.repeatCount = MAXFLOAT; + animation.removedOnCompletion = NO; + animation.fillMode = kCAFillModeForwards; + + [gradientLayer addAnimation:animation forKey:@"GradientLayerAnimation"]; +} +- (void)removeSelfFromSuperView +{ + NSAssert([NSThread isMainThread], @"needs to be accessed on the main thread."); + + if (![NSThread isMainThread]) { + dispatch_async(dispatch_get_main_queue(), ^(void) { + }); + } + + + void (^completion)(void) = ^{ + [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + [self removeFromSuperview]; + }; + switch (self.showConfig.animationType) { + case LoadingAnimationTypeNone: + completion() ; + break; + case LoadingAnimationTypeBounce: + [self showBounceAnimationStart:NO completion:completion]; + break ; + case LoadingAnimationTypeFade: + [self showFadeAnimationStart:NO completion:completion ] ; + break ; + default: + break; + } +} + + +#pragma mark - animation +// 转圈动画 +- (void)drawAnimiationImageView:(BOOL)isImageView +{ + NSString *keyPath = isImageView ? @"transform.rotation.y" : @"transform.rotation.z" ; + CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:keyPath]; + animation.fromValue=@(0); + animation.toValue=@(M_PI*2); + animation.duration=isImageView ? 1.3 : .8; + animation.repeatCount=HUGE; + animation.fillMode=kCAFillModeForwards; + animation.removedOnCompletion=NO; + animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + [self.imageView.layer addAnimation:animation forKey:@"animation"]; +} + + +- (void)showFadeAnimationStart:(BOOL)isStart completion:(void(^)(void))completion +{ + self.alpha = isStart ? 0.1f : 1.0f; + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alpha = isStart ? 1.0 : 0.1f ; + } completion:^(BOOL finished) { + if (completion) { + completion() ; + } + }]; +} +- (void)showBounceAnimationStart:(BOOL)isStart completion:(void(^)(void))completion +{ + if (isStart) { + CAKeyframeAnimation *popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; + popAnimation.duration = EasyShowAnimationTime ; + popAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.01f, 0.01f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.05f, 1.05f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.95f, 0.95f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DIdentity]]; + popAnimation.keyTimes = @[@0.2f, @0.5f, @0.75f, @1.0f]; + popAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; + + popAnimation.delegate = self ; + [popAnimation setValue:completion forKey:@"handler"]; + [self.LoadingBgView.layer addAnimation:popAnimation forKey:nil]; + return ; + } + CABasicAnimation *bacAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + bacAnimation.duration = EasyShowAnimationTime ; + bacAnimation.beginTime = .0; + bacAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.4f :0.3f :0.5f :-0.5f]; + bacAnimation.fromValue = [NSNumber numberWithFloat:1.0f]; + bacAnimation.toValue = [NSNumber numberWithFloat:0.0f]; + + CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; + animationGroup.animations = @[bacAnimation]; + animationGroup.duration = bacAnimation.duration; + animationGroup.removedOnCompletion = NO; + animationGroup.fillMode = kCAFillModeForwards; + + // animationGroup.delegate = self ; + // [animationGroup setValue:completion forKey:@"handler"]; + [self.LoadingBgView.layer addAnimation:animationGroup forKey:nil]; + + [self performSelector:@selector(ddd) withObject:nil afterDelay:bacAnimation.duration]; +} +- (void)ddd +{ + [self removeFromSuperview]; +} +- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag +{ + void(^completion)(void) = [anim valueForKey:@"handler"]; + if (completion) { + completion(); + } +} +//加载Loading的动画 +- (void)drawAnimationImageViewLoading +{ + CGPoint centerPoint= CGPointMake(self.imageView.easyS_width/2.0f, self.imageView.easyS_height/2.0f) ; + UIBezierPath *beizPath=[UIBezierPath bezierPathWithArcCenter:centerPoint radius:centerPoint.x startAngle:-M_PI_2 endAngle:M_PI_2 clockwise:YES]; + CAShapeLayer *centerLayer=[CAShapeLayer layer]; + centerLayer.path=beizPath.CGPath; + centerLayer.fillColor=[UIColor clearColor].CGColor;//填充色 + centerLayer.strokeColor=self.showConfig.tintColor.CGColor;//边框颜色 + centerLayer.lineWidth=2.0f; + centerLayer.lineCap=kCALineCapRound;//线框类型 + + [self.imageView.layer addSublayer:centerLayer]; + +} + + +#pragma mark - getter + +- (UIView *)LoadingBgView +{ + if (nil == _LoadingBgView) { + _LoadingBgView = [[UIView alloc]init] ; + _LoadingBgView.backgroundColor = self.showConfig.bgColor ; + [self addSubview:_LoadingBgView]; + } + return _LoadingBgView ; +} +- (UIImageView *)imageView +{ + if (nil == _imageView) { + _imageView = [[UIImageView alloc]init]; + _imageView.backgroundColor = [UIColor clearColor]; + _imageView.tintColor = self.showConfig.tintColor ; + [self.LoadingBgView addSubview:_imageView]; + } + return _imageView ; +} +- (UILabel *)textLabel +{ + if (nil == _textLabel) { + CGFloat margX = self.showConfig.LoadingType%2 ? 20 : 8 ; + _textLabel = [[EasyShowLabel alloc]initWithContentInset:UIEdgeInsetsMake(10, margX, 10, margX)]; + _textLabel.textColor = self.showConfig.tintColor; + _textLabel.font = self.showConfig.textFont ; + _textLabel.backgroundColor = [UIColor clearColor]; + _textLabel.textAlignment = NSTextAlignmentCenter ; + _textLabel.numberOfLines = 0 ; + [self.LoadingBgView addSubview:_textLabel]; + } + return _textLabel ; +} + +- (UIActivityIndicatorView *)imageViewIndeicator +{ + if (nil == _imageViewIndeicator) { + UIActivityIndicatorViewStyle style = self.showConfig.LoadingType%2 ?UIActivityIndicatorViewStyleWhiteLarge : UIActivityIndicatorViewStyleWhite ; + _imageViewIndeicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:style]; + _imageViewIndeicator.tintColor = self.showConfig.tintColor ; + _imageViewIndeicator.color = self.showConfig.tintColor ; + _imageViewIndeicator.backgroundColor = [UIColor clearColor]; + _imageViewIndeicator.frame = self.imageView.bounds ; + } + return _imageViewIndeicator ; +} + + +#pragma mark - 类方法 ++ (EasyLoadingView *)showLoading +{ + return [self showLoadingText:@""]; +} ++ (EasyLoadingView *)showLoadingText:(NSString *)text +{ + return [self showLoadingText:text imageName:nil]; +} ++ (EasyLoadingView *)showLoadingText:(NSString *)text imageName:(NSString *)imageName +{ + EasyLoadingConfig *(^configTemp)(void) = ^EasyLoadingConfig *{ + return [EasyLoadingConfig shared] ; + }; + return [self showLoadingText:text imageName:imageName config:configTemp]; + +} ++ (EasyLoadingView *)showLoadingText:(NSString *)text + config:(EasyLoadingConfig *(^)(void))config +{ + return [self showLoadingText:text imageName:nil config:config]; +} + ++ (EasyLoadingView *)showLoadingText:(NSString *)text imageName:(NSString *)imageName config:(EasyLoadingConfig *(^)(void))config +{ + NSAssert(config, @"there shoud have a superview!") ; + + if (nil == config) { + EasyLoadingConfig *(^configTemp)(void) = ^EasyLoadingConfig *{ + return [EasyLoadingConfig shared]; + }; + config = configTemp ; + } + + NSAssert([NSThread isMainThread], @"needs to be accessed on the main thread."); + if (![NSThread isMainThread]) { + dispatch_async(dispatch_get_main_queue(), ^(void) { + }); + } + + EasyLoadingConfig *tempConfig = [self changeConfigWithConfig:config] ; + if (!tempConfig.superView) { + if (tempConfig.showOnWindow) { + tempConfig.superView = [UIApplication sharedApplication].keyWindow ; + }else{ + tempConfig.superView = [EasyShowUtils easyShowViewTopViewController].view ; + } + } + + //显示之前---->隐藏还在显示的视图 + [self hidenLoingInView:tempConfig.superView]; + + //创建显示的view + EasyLoadingView *LoadingView = [[EasyLoadingView alloc]initWithFrame:CGRectZero + showText:text + iamgeName:imageName + config:tempConfig]; + //Loadingview加到父视图上面 + [tempConfig.superView addSubview:LoadingView]; + return LoadingView ; +} + + ++ (void)hidenLoading +{ + UIView *showView = nil ; + if ([EasyLoadingGlobalConfig shared].showOnWindow == YES) { + showView = [UIApplication sharedApplication].keyWindow ; + }else{ + showView = [EasyShowUtils easyShowViewTopViewController].view ; + } + [self hidenLoingInView:showView]; +} ++ (void)hidenLoingInView:(UIView *)superView +{ + NSEnumerator *subviewsEnum = [superView.subviews reverseObjectEnumerator]; + for (UIView *subview in subviewsEnum) { + if ([subview isKindOfClass:self]) { + EasyLoadingView *showView = (EasyLoadingView *)subview ; + [self hidenLoading:showView]; + } + } +} ++ (void)hidenLoading:(EasyLoadingView *)LoadingView +{ + [LoadingView removeSelfFromSuperView]; +} + +#pragma mark - 工具方法 +//+ (UIView *)showLoadingEmptyView +//{ +// UIView *showView = [UIApplication sharedApplication].keyWindow ; +// if ([EasyLoadingGlobalConfig isUseLoeingGlobalConfig]) { +// if (![EasyLoadingGlobalConfig sharedEasyLoadingGlobalConfig].showOnWindow) { +// showView = [EasyShowUtils easyShowViewTopViewController].view ; +// } +// } +// else{ +//// if (![EasyShowOptions sharedEasyShowOptions].LoadingShowOnWindow) { +//// showView = [EasyShowUtils easyShowViewTopViewController].view ; +//// } +// } +// return showView ; +//} + ++ (EasyLoadingConfig *)changeConfigWithConfig:(EasyLoadingConfig *(^)(void))config +{ + EasyLoadingConfig *tempConfig = config ? config() : nil ; + if (!tempConfig) { + tempConfig = [EasyLoadingConfig shared] ; + } + + EasyLoadingGlobalConfig *globalConfig = [EasyLoadingGlobalConfig shared]; + + if (tempConfig.LoadingType == LoadingShowTypeUnDefine) { + tempConfig.LoadingType = globalConfig.LoadingType ; + } + if (tempConfig.animationType == LoadingAnimationTypeUndefine) { + tempConfig.animationType = globalConfig.animationType ; + } + if (!tempConfig.cycleCornerWidth) { + tempConfig.cycleCornerWidth =globalConfig.cycleCornerWidth; + } + if (!tempConfig.tintColor) { + tempConfig.tintColor = globalConfig.tintColor ; + } + if (!tempConfig.textFont) { + tempConfig.textFont = globalConfig.textFont; + } + if (!tempConfig.bgColor) { + tempConfig.bgColor = globalConfig.bgColor ; + } + if (!tempConfig.playImagesArray) { + tempConfig.playImagesArray = globalConfig.playImagesArray ; + } + return tempConfig ; +} + + + +@end + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowLabel.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowLabel.h new file mode 100644 index 0000000..ff3ab35 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowLabel.h @@ -0,0 +1,15 @@ +// +// EasyShowLabel.h +// EasyShowViewDemo +// +// Created by nf on 2017/12/20. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import + +@interface EasyShowLabel : UILabel + +- (instancetype)initWithContentInset:(UIEdgeInsets)contentInset ; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowLabel.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowLabel.m new file mode 100644 index 0000000..2f399ee --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowLabel.m @@ -0,0 +1,51 @@ +// +// EasyShowLabel.m +// EasyShowViewDemo +// +// Created by nf on 2017/12/20. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import "EasyShowLabel.h" + +@interface EasyShowLabel() + +@property (nonatomic) UIEdgeInsets contentInset; + +@end + +@implementation EasyShowLabel + + +- (instancetype)initWithContentInset:(UIEdgeInsets)contentInset +{ + if (self = [super init]) { + _contentInset = contentInset ; + } + return self ; +} +- (void)setContentInset:(UIEdgeInsets)contentInset { + _contentInset = contentInset; + NSString *tempString = self.text; + self.text = @""; + self.text = tempString; +} +- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines +{ + UIEdgeInsets insets = self.contentInset; + CGRect rect = [super textRectForBounds:UIEdgeInsetsInsetRect(bounds, insets) + limitedToNumberOfLines:numberOfLines]; + + rect.origin.x -= insets.left; + rect.origin.y -= insets.top; + rect.size.width += (insets.left + insets.right); + rect.size.height += (insets.top + insets.bottom); + + return rect; +} +-(void)drawTextInRect:(CGRect)rect +{ + [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.contentInset)]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowUtils.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowUtils.h new file mode 100644 index 0000000..24a5ddd --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowUtils.h @@ -0,0 +1,125 @@ +// +// EasyShowUtils.h +// EasyShowViewDemo +// +// Created by nf on 2017/11/24. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import +#import + +// 是否为空 +#define ISEMPTY_S(_v) (_v == nil || _v.length == 0) + + +//屏幕宽度 +#define SCREEN_WIDTH_S [[UIScreen mainScreen] bounds].size.width +//屏幕高度 +#define SCREEN_HEIGHT_S [[UIScreen mainScreen] bounds].size.height +//屏幕的高度 +#define SCREEN_MAX_LENGTH_S (MAX(SCREEN_WIDTH_S, SCREEN_HEIGHT_S)) + +//屏幕是否是横屏状态 +#define ISHORIZONTALSCREEM_S UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) +//retain屏 +#define ISRETAIN_S ([[UIScreen mainScreen] scale] >= 2.0) +//屏幕尺寸判断 +#define ISIPHONE_S (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) +//#define ISIPHONE_4 (ISIPHONE && SCREEN_MAX_LENGTH == 480.0f) // 4/4s 3.5寸 320*480 +//#define ISIPHONE_5 (ISIPHONE && SCREEN_MAX_LENGTH == 568.0f) // 5/5s/se 4寸 320*568 +//#define ISIPHONE_6 (ISIPHONE && SCREEN_MAX_LENGTH == 667.0f) // 6/6s/7/8 4.7寸 375*667 +//#define ISIPHONE_6P (ISIPHONE && SCREEN_MAX_LENGTH == 736.0f) // 6p/6ps/7p/8p 5.5寸 414*736 +#define ISIPHONE_X_S (ISIPHONE_S && SCREEN_MAX_LENGTH_S == 812.0f) // iPhonex 5.8寸 375*812 + +//iOS版本判断 +//#define SYSTEM_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) +//#define IS_IOS7_OR_LATER (SYSTEM_VERSION >= 7.0) +//#define IS_IOS8_OR_LATER (SYSTEM_VERSION >= 8.0) +//#define IS_IOS9_OR_LATER (SYSTEM_VERSION >= 9.0) +//#define IS_IOS10_OR_LATER (SYSTEM_VERSION >= 10.0) +//#define IS_IOS11_OR_LATER (SYSTEM_VERSION >= 11.0) + + +//statusbar默认高度 orginal +#define STATUSBAR_HEIGHT_S (ISIPHONE_X_S ? (50) : 20 ) + +//导航栏原始高度 +#define kNavNormalHeight_S 44.0f + +//大标题增加出来的高度 +#define kNavBigTitleHeight_S 55.0f + +#define kEasyShowSafeBottomMargin_S (ISIPHONE_X_S ? 34.0f : 0.0f ) + +/*随机颜色*/ //[UIColor clearColor];// +#define kColorRandom_S [UIColor clearColor];//kColor_S(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) +#define kColor_S(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] + +//状态栏高度 +#define NAVIGATION_HEIGHT_S (STATUSBAR_HEIGHT_S + kNavNormalHeight_S) +//#define STATUSBAR_HEIGHT (ISHORIZONTALSCREEM ? (ISIPHONE_X ? 0 : STATUSBAR_HEIGHT) : STATUSBAR_HEIGHT ) + + +#define kEasyShowKeyWindow ([UIApplication sharedApplication].keyWindow) + +//推迟执行 +CG_INLINE void dispatch_queue_after_S(CGFloat time ,dispatch_block_t block) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), block); +} + +// .h +#define easyShowView_singleton_interface + (instancetype)shared ; +// .m +#define easyShowView_singleton_implementation(class) \ +static class *_showInstance; \ ++ (id)allocWithZone:(struct _NSZone *)zone { \ + static dispatch_once_t onceToken; \ + dispatch_once(&onceToken, ^{ \ + _showInstance = [super allocWithZone:zone]; \ + }); \ + return _showInstance; \ +} \ ++ (instancetype)shared { \ + if (nil == _showInstance) { \ + static dispatch_once_t onceToken; \ + dispatch_once(&onceToken, ^{ \ + _showInstance = [[class alloc] init]; \ + }); \ + } \ + return _showInstance; \ +} \ +- (id)copyWithZone:(NSZone *)zone{ \ + return _showInstance; \ +} \ +- (id)mutableCopyWithZone:(NSZone *)zone{ \ + return _showInstance; \ +} \ + + +UIKIT_EXTERN const CGFloat EasyShowAnimationTime ;//动画时间 + + + +@interface EasyShowUtils : NSObject + ++ (CGSize)textWidthWithStirng:(NSString *)string font:(UIFont *)font maxWidth:(CGFloat)maxWidth ; + ++ (UIViewController *)easyShowViewTopViewController ; + ++ (UIImage *)imageWithColor:(UIColor *)color ; + +@end + + + + + + + + + + + + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowUtils.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowUtils.m new file mode 100644 index 0000000..111b25c --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowUtils.m @@ -0,0 +1,90 @@ +// +// EasyShowUtils.m +// EasyShowViewDemo +// +// Created by nf on 2017/11/24. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import "EasyShowUtils.h" + +const CGFloat EasyShowAnimationTime = 0.3f ; //动画时间 + +@implementation EasyShowUtils + ++ (CGSize)textWidthWithStirng:(NSString *)string font:(UIFont *)font maxWidth:(CGFloat)maxWidth +{ + CGSize size = [string boundingRectWithSize:CGSizeMake(maxWidth, SCREEN_HEIGHT_S) + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + attributes:@{NSFontAttributeName:font} + context:nil].size; + + if (size.width < 60) { + size.width = 60 ; + } + return size ; +} + ++ (UIViewController *)easyShowViewTopViewController { + UIViewController *resultVC = [self tempEasyShowViewTopVC:[[UIApplication sharedApplication].keyWindow rootViewController]]; + while (resultVC.presentedViewController) { + resultVC = [self tempEasyShowViewTopVC:resultVC.presentedViewController]; + } + return resultVC; +} ++ (UIViewController *)tempEasyShowViewTopVC:(UIViewController *)vc { + if ([vc isKindOfClass:[UINavigationController class]]) { + return [self tempEasyShowViewTopVC:[(UINavigationController *)vc topViewController]]; + } else if ([vc isKindOfClass:[UITabBarController class]]) { + return [self tempEasyShowViewTopVC:[(UITabBarController *)vc selectedViewController]]; + } else { + return vc; + } + return nil; +} ++ (UIImage *)imageWithColor:(UIColor *)color +{ + CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); + UIGraphicsBeginImageContext(rect.size); + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSetFillColorWithColor(context, [color CGColor]); + CGContextFillRect(context, rect); + + UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return theImage; +} +//+ (UIImageView *)imageViewSetCorner:(UIImageView *)imgView radius:(CGFloat)radius sizetoFit:(CGSize)sizetoFit +//{ +// CGRect rect = CGRectMake(0, 0, sizetoFit.easyS_width, sizetoFit.easyS_height) ; +// +// UIGraphicsBeginImageContextWithOptions(rect.size, false, [UIScreen mainScreen].scale) ; +// CGContextAddPath(UIGraphicsGetCurrentContext(), +// UIBezierPath(roundedRect: rect, byRoundingCorners: UIRectCorner.AllCorners, +// cornerRadii: CGSize(width: radius, height: radius)).CGPath) +// CGContextClip(UIGraphicsGetCurrentContext()) +// +// imgView.drawInRect(rect) ; +// CGContextDrawPath(UIGraphicsGetCurrentContext(), .FillStroke) +// let output = UIGraphicsGetImageFromCurrentImageContext(); +// UIGraphicsEndImageContext(); +//} +//func kt_drawRectWithRoundedCorner(radius radius: CGFloat, _ sizetoFit: CGSize) -> UIImage { +// let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: sizetoFit) +// +// UIGraphicsBeginImageContextWithOptions(rect.size, false, UIScreen.mainScreen().scale) +// CGContextAddPath(UIGraphicsGetCurrentContext(), +// UIBezierPath(roundedRect: rect, byRoundingCorners: UIRectCorner.AllCorners, +// cornerRadii: CGSize(width: radius, height: radius)).CGPath) +// CGContextClip(UIGraphicsGetCurrentContext()) +// +// self.drawInRect(rect) +// CGContextDrawPath(UIGraphicsGetCurrentContext(), .FillStroke) +// let output = UIGraphicsGetImageFromCurrentImageContext(); +// UIGraphicsEndImageContext(); +// +// return output +//} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowView.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowView.h new file mode 100644 index 0000000..9472781 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyShowView.h @@ -0,0 +1,20 @@ +// +// EasyShowView.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2017/11/30. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#ifndef EasyShowView_h +#define EasyShowView_h + +#import "EasyTextView.h" +#import "EasyLoadingView.h" +#import "EasyAlertView.h" +#import "EasyEmptyView.h" + + + + +#endif /* EasyShowView_h */ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextBgView.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextBgView.h new file mode 100644 index 0000000..1d578a5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextBgView.h @@ -0,0 +1,26 @@ +// +// EasyTextBgView.h +// EFHealth +// +// Created by nf on 16/7/20. +// Copyright © 2016年 ef. All rights reserved. +// + +#import + +#import "EasyTextConfig.h" + +@interface EasyTextBgView : UIView + +- (instancetype)initWithFrame:(CGRect)frame + status:(ShowTextStatus)status + text:(NSString *)text + imageName:(NSString *)imageName + config:(EasyTextConfig *)config ; + +- (void)showWindowYToPoint:(CGFloat)toPoint ; + +- (void)showStartAnimationWithDuration:(CGFloat)duration ; +- (void)showEndAnimationWithDuration:(CGFloat)duration ; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextBgView.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextBgView.m new file mode 100644 index 0000000..7440cc0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextBgView.m @@ -0,0 +1,310 @@ +// +// EasyTextBgView.m +// EFHealth +// +// Created by nf on 16/7/20. +// Copyright © 2016年 ef. All rights reserved. +// + +#import "EasyTextBgView.h" + +#import "UIView+EasyShowExt.h" +#import "EasyShowUtils.h" + + +@interface EasyTextBgView() + +@property ShowTextStatus showTextStatus ; + +@property (nonatomic,strong)UILabel *textLabel ; +@property (nonatomic,strong)UIImageView *imageView ; + +@property (nonatomic,strong)EasyTextConfig *config ; + +@property (nonatomic,strong)UIWindow *showTextWindow ; + +@end + +@implementation EasyTextBgView + +- (void)dealloc +{ + _showTextWindow = nil ; +} + + +- (void)showWindowYToPoint:(CGFloat)toPoint +{ + self.showTextWindow.easyS_y = toPoint ; +} +- (instancetype)initWithFrame:(CGRect)frame status:(ShowTextStatus)status text:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *)config +{ + if ([super initWithFrame:frame]) { + + _config = config ; + self.backgroundColor = self.config.bgColor ; //[UIColor redColor]; // + + _showTextStatus = status ; + + if ((!(self.isShowedStatusBar||self.isShowedNavigation))) { + + [self setRoundedCorners:10]; + + if (_showTextStatus != ShowTextStatusPureText && (!ISEMPTY_S(text))) {//只要不是纯文字,其他的都需要显示图片 + self.imageView.easyS_top = EasyDrawImageEdge ; + } + } + + + if (imageName) { + UIImage *image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + if (image) { + self.imageView.image = image ; + } + else{ + NSAssert(NO, @"iamgeName is illgal "); + } + } + + + + if (!ISEMPTY_S(text)) { + CGSize textSize = [EasyShowUtils textWidthWithStirng:text + font:self.config.titleFont + maxWidth:TextShowMaxWidth]; + + self.textLabel.text = text ; + + + if (self.isShowedStatusBar||self.isShowedNavigation) { + + CGFloat addX = self.isShowedStatusBar ? 7 : 10 ; + CGFloat addH = self.isShowedStatusBar ?: 5; + self.textLabel.frame = CGRectMake(self.imageView.easyS_right + addX , self.imageView.easyS_top - addH, self.easyS_width - self.imageView.easyS_right - 5, self.imageView.easyS_height +addH*2 ) ; + // self.textLabel.backgroundColor = [UIColor yellowColor]; + self.textLabel.textAlignment = NSTextAlignmentLeft ; + } + else{ + + self.textLabel.frame = CGRectMake(20,self.easyS_height-textSize.height-15 ,textSize.width, textSize.height) ; + self.textLabel.textAlignment = NSTextAlignmentCenter ; + } + } + + [self drawAnimationImageView]; + } + return self ; +} + +- (UIWindow *)showTextWindow +{ + if (nil == _showTextWindow) { + CGFloat showHeight = self.isShowedStatusBar ? STATUSBAR_HEIGHT_S : NAVIGATION_HEIGHT_S ; + _showTextWindow = [[UIWindow alloc]initWithFrame:CGRectMake(0, -showHeight , SCREEN_WIDTH_S, showHeight )]; + _showTextWindow.backgroundColor = self.config.bgColor ; // [UIColor yellowColor]; // + _showTextWindow.windowLevel = UIWindowLevelAlert; + UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureTap)]; + [_showTextWindow addGestureRecognizer:gesture]; + _showTextWindow.hidden = NO ; + _showTextWindow.alpha = 1; + } + return _showTextWindow ; +} +- (void)gestureTap +{ +} +//加载Loading的动画 +- (void)drawAnimationImageViewLoading +{ + CGPoint centerPoint= CGPointMake(self.imageView.easyS_width/2.0f, self.imageView.easyS_height/2.0f) ; + UIBezierPath *beizPath=[UIBezierPath bezierPathWithArcCenter:centerPoint radius:centerPoint.x startAngle:-M_PI_2 endAngle:M_PI_2 clockwise:YES]; + CAShapeLayer *centerLayer=[CAShapeLayer layer]; + centerLayer.path=beizPath.CGPath; + centerLayer.fillColor=[UIColor clearColor].CGColor;//填充色 + centerLayer.strokeColor=self.config.titleColor.CGColor;//边框颜色 + centerLayer.lineWidth=2.0f; + centerLayer.lineCap=kCALineCapRound;//线框类型 + + [self.imageView.layer addSublayer:centerLayer]; + + [self drawAnimiationImageView:NO]; +} + +// 转圈动画 +- (void)drawAnimiationImageView:(BOOL)isImageView +{ + NSString *keyPath = isImageView ? @"transform.rotation.y" : @"transform.rotation.z" ; + CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:keyPath]; + animation.fromValue=@(0); + animation.toValue=@(M_PI*2); + animation.duration=isImageView ? 1.3 : .8; + animation.repeatCount=HUGE; + animation.fillMode=kCAFillModeForwards; + animation.removedOnCompletion=NO; + animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + [self.imageView.layer addAnimation:animation forKey:@"animation"]; +} + +- (void)drawAnimationImageView +{ + CGFloat imageWH = self.imageView.easyS_width ; + + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, imageWH, imageWH) + cornerRadius:imageWH/2]; + UIColor *drawColor = nil ; + switch (_showTextStatus) { + case ShowTextStatusPureText: + return ; + case ShowTextStatusSuccess: + { + CGFloat addHeight = self.config.statusType == TextStatusTypeStatusBar ? 1 : 3 ; + [path moveToPoint:CGPointMake((imageWH-imageWH)/2+imageWH/4, addHeight + imageWH/2)]; + [path addLineToPoint:CGPointMake(imageWH/2, imageWH*3/4)]; + [path addLineToPoint:CGPointMake(imageWH/2 + imageWH*1/3, imageWH*1/3)]; + + drawColor = [UIColor greenColor] ; + } break; + case ShowTextStatusError: + { + [path moveToPoint:CGPointMake(imageWH/2-imageWH/4, imageWH/4)]; + [path addLineToPoint:CGPointMake(imageWH/2+imageWH/4, imageWH*3/4)]; + + [path moveToPoint:CGPointMake(imageWH/2+imageWH/4, imageWH/4)]; + [path addLineToPoint:CGPointMake(imageWH/2-imageWH/4, imageWH*3/4)]; + + drawColor = [UIColor redColor] ; + }break ; + case ShowTextStatusInfo: + { + CGFloat addHeight = self.config.statusType == TextStatusTypeStatusBar ? 5 : 3 ; + [path moveToPoint:CGPointMake(imageWH/2, imageWH/4 )]; + [path addLineToPoint:CGPointMake(imageWH/2,imageWH/4 + addHeight)]; + + [path moveToPoint:CGPointMake(imageWH/2,imageWH/4 + 6)]; + [path addLineToPoint:CGPointMake(imageWH/2, imageWH*3/4 )]; + + drawColor = [UIColor lightGrayColor] ; + }break ; + default: + break; + } + + CAShapeLayer *lineLayer = [ CAShapeLayer layer]; + lineLayer.frame = CGRectZero; + lineLayer.fillColor = [ UIColor clearColor ].CGColor ; + lineLayer.path = path. CGPath ; + lineLayer.strokeColor = self.config.titleColor.CGColor ; + lineLayer.lineWidth = self.isShowedStatusBar ? 1 : 2; + lineLayer.cornerRadius = 50; + + CABasicAnimation *ani = [ CABasicAnimation animationWithKeyPath: @"strokeEnd"]; + ani.fromValue = @0 ; + ani.toValue = @1 ; + ani.duration = 0.4; + [lineLayer addAnimation :ani forKey :@"strokeEnd"]; + + [self.imageView.layer addSublayer :lineLayer]; +} + +- (void)showEndAnimationWithDuration:(CGFloat)duration +{ + CABasicAnimation *bacAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + bacAnimation.duration = duration ; + bacAnimation.beginTime = .0; + bacAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.4f :0.3f :0.5f :-0.5f]; + bacAnimation.fromValue = [NSNumber numberWithFloat:1.0f]; + bacAnimation.toValue = [NSNumber numberWithFloat:0.0f]; + + CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; + animationGroup.animations = @[bacAnimation]; + animationGroup.duration = bacAnimation.duration; + animationGroup.removedOnCompletion = NO; + animationGroup.fillMode = kCAFillModeForwards; + + [self.layer addAnimation:animationGroup forKey:nil]; +} + +- (void)showStartAnimationWithDuration:(CGFloat)duration +{ + CAKeyframeAnimation *popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; + popAnimation.duration = duration; + popAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.01f, 0.01f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.05f, 1.05f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.95f, 0.95f, 1.0f)], + [NSValue valueWithCATransform3D:CATransform3DIdentity]]; + popAnimation.keyTimes = @[@0.2f, @0.5f, @0.75f, @1.0f]; + popAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; + [self.layer addAnimation:popAnimation forKey:nil]; +} + +#pragma mark - getter + + +//是否显示在statusbar上 +- (BOOL)isShowedStatusBar +{ + return self.config.statusType==TextStatusTypeStatusBar ; +} +//是否正在显示在navigation上 +- (BOOL)isShowedNavigation +{ + return self.config.statusType==TextStatusTypeNavigation ; +} + +- (UIImageView *)imageView +{ + if (nil == _imageView) { + CGFloat imageWH = EasyDrawImageWH ; + CGFloat imageX = (self.easyS_width-EasyDrawImageWH)/2 ; + CGFloat imageY = EasyDrawImageEdge/2 ; + if (self.isShowedStatusBar) { + imageWH = 15 ; + imageX = 10 ; + imageY = self.easyS_height - imageWH - 2.5 ; + }else if ( self.isShowedNavigation){ + imageX = 10 ; + imageY = (self.easyS_height - imageWH)/2 + (ISIPHONE_X_S ? 20 : 3 ); + } + + _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(imageX,imageY , imageWH, imageWH)]; + _imageView.tintColor = self.config.titleColor ; + // _imageView.backgroundColor = [UIColor yellowColor]; + if ((self.isShowedStatusBar||self.isShowedNavigation)) { + [self.showTextWindow addSubview:_imageView]; + } + else{ + [self addSubview:_imageView]; + } + } + return _imageView ; +} +- (UILabel *)textLabel +{ + if (nil == _textLabel) { + _textLabel = [[UILabel alloc]init]; + _textLabel.textColor = self.config.titleColor; + _textLabel.font = self.config.titleFont ; + _textLabel.backgroundColor = [UIColor clearColor]; + _textLabel.textAlignment = NSTextAlignmentCenter ; + _textLabel.numberOfLines = 0 ; + if ((self.isShowedStatusBar||self.isShowedNavigation)) { + [self.showTextWindow addSubview:_textLabel]; + } + else{ + [self addSubview:_textLabel]; + } + } + return _textLabel ; +} + +/* + // Only override drawRect: if you perform custom drawing. + // An empty implementation adversely affects performance during animation. + - (void)drawRect:(CGRect)rect { + // Drawing code + } + */ + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextConfig.h new file mode 100644 index 0000000..6ef1d9f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextConfig.h @@ -0,0 +1,102 @@ +// +// EasyTextConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/3. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import "EasyTextTypes.h" +#import "EasyShowUtils.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyTextConfig : NSObject + +// 显示吐丝所需要的父视图(为空将显示在window上) +@property (nonatomic,strong)UIView *superView ; + +//显示期间,父视图是否接受事件 +@property (nonatomic,assign)BOOL superReceiveEvent ; + +// 展示/隐藏 动画类型 +@property (nonatomic,assign)TextAnimationType animationType ; + +// 显示吐丝的位置(上、中、下、statusbar上、导航条上) +@property (nonatomic,assign)TextStatusType statusType ; + +//显示文字大小 +@property (nonatomic,strong)UIFont *titleFont ; + +// 显示文字颜色 +@property (nonatomic,strong)UIColor *titleColor ; + +//显示背景颜色 +@property (nonatomic,strong)UIColor *bgColor ; + +// 阴影颜色(为clearcolor的时候不显示阴影) +@property (nonatomic,strong)UIColor *shadowColor ; + +//显示文字的时间 +@property (nonatomic,copy) float(^textShowTimeBlock)(NSString *text) ; + + +#pragma mark - 创建对象的简便方法 + ++ (instancetype)shared ; + + +#pragma mark - 链式编程设置属性(和上面直接设置属性一样) + +- (EasyTextConfig *(^)(UIView *))setSuperView ; +- (EasyTextConfig *(^)(BOOL))setSuperReceiveEvent ; +- (EasyTextConfig *(^)(TextAnimationType))setAnimationType ; +- (EasyTextConfig *(^)(TextStatusType))setStatusType ; + +- (EasyTextConfig *(^)(UIFont *))setTitleFont ; +- (EasyTextConfig *(^)(UIColor *))setTitleColor ; +- (EasyTextConfig *(^)(UIColor *))setBgColor ; +- (EasyTextConfig *(^)(UIColor *))setShadowColor ; + + +#pragma mark - 类方法设置属性(和上面直接设置属性一样) + +/** + * superview 显示所需要的父视图 + */ ++ (instancetype)configWithSuperView:(UIView *)superView ; + +/** + * superview 显示所需要的父视图 + * receive 在显示的期间,superview是否能接接收事件 + * animationType 文字展示的动画形式 + */ ++ (instancetype)configWithSuperView:(UIView *)superView + animationType:(TextAnimationType)animationType ; + +/** + * superview 显示所需要的父视图 + * receive 在显示的期间,superview是否能接接收事件 + * animationType 文字展示的动画形式 + * statusType 文字显示所在的位置 + */ ++ (instancetype)configWithSuperView:(UIView *)superView + animationType:(TextAnimationType)animationType + statusType:(TextStatusType)statusType ; + +/** + * superview 显示所需要的父视图 + * receive 在显示的期间,superview是否能接接收事件 + * animationType 文字展示的动画形式 + * statusType 文字显示所在的位置 + */ ++ (instancetype)configWithSuperView:(UIView *)superView + animationType:(TextAnimationType)animationType + statusType:(TextStatusType)statusType + superReceiveEvent:(BOOL)receive ; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextConfig.m new file mode 100644 index 0000000..d095012 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextConfig.m @@ -0,0 +1,118 @@ +// +// EasyTextConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/3. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyTextConfig.h" +#import "EasyShowUtils.h" +#import "EasyTextGlobalConfig.h" + +@implementation EasyTextConfig + ++ (instancetype)shared +{ + return [[self alloc]init]; +} +- (instancetype)init +{ + if (self = [super init]) { + + EasyTextGlobalConfig *globalC = [EasyTextGlobalConfig shared]; + _superReceiveEvent = globalC.superReceiveEvent ; + _animationType = globalC.animationType ; + _statusType = globalC.statusType ; + } + return self ; +} + +- (EasyTextConfig *(^)(UIView *))setSuperView{ + return ^EasyTextConfig *(UIView *superView){ + self.superView = superView ; + return self ; + } ; +} +- (EasyTextConfig *(^)(TextStatusType))setStatusType{ + return ^EasyTextConfig *(TextStatusType statusType){ + self.statusType = statusType ; + return self ; + } ; +} +- (EasyTextConfig *(^)(TextAnimationType))setAnimationType{ + return ^EasyTextConfig *(TextAnimationType animationType){ + self.animationType = animationType ; + return self ; + }; +} +- (EasyTextConfig *(^)(BOOL))setSuperReceiveEvent{ + return ^EasyTextConfig *(BOOL receive){ + self.superReceiveEvent = receive ; + return self ; + }; +} +- (EasyTextConfig *(^)(UIFont *))setTitleFont { + return ^EasyTextConfig *(UIFont *titleFont){ + self.titleFont = titleFont ; + return self ; + }; +} +- (EasyTextConfig *(^)(UIColor *))setTitleColor{ + return ^EasyTextConfig *(UIColor *titleColor){ + self.titleColor = titleColor ; + return self ; + }; +} +- (EasyTextConfig *(^)(UIColor *))setBgColor{ + return ^EasyTextConfig *(UIColor *bgcolor){ + self.bgColor = bgcolor ; + return self ; + }; +} +- (EasyTextConfig *(^)(UIColor *))setShadowColor{ + return ^EasyTextConfig *(UIColor *shadowColor){ + self.shadowColor = shadowColor ; + return self ; + }; +} + + + ++ (instancetype)configWithSuperView:(UIView *)superView +{ + return [self configWithSuperView:superView + animationType:TextAnimationTypeUndefine]; +} + ++ (instancetype)configWithSuperView:(UIView *)superView + animationType:(TextAnimationType)animationType +{ + return [self configWithSuperView:superView + animationType:animationType + statusType:TextStatusTypeUndefine]; +} + ++ (instancetype)configWithSuperView:(UIView *)superView + animationType:(TextAnimationType)animationType + statusType:(TextStatusType)statusType +{ + return [self configWithSuperView:superView + animationType:animationType + statusType:statusType + superReceiveEvent:[EasyTextGlobalConfig shared].superReceiveEvent]; +} + ++ (instancetype)configWithSuperView:(UIView *)superView + animationType:(TextAnimationType)animationType + statusType:(TextStatusType)statusType + superReceiveEvent:(BOOL)receive +{ + EasyTextConfig *config = [self shared]; + config.superView = superView ; + config.superReceiveEvent = receive ; + config.animationType = animationType ; + config.statusType = statusType ; + return config ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextGlobalConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextGlobalConfig.h new file mode 100644 index 0000000..af6bddb --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextGlobalConfig.h @@ -0,0 +1,59 @@ +// +// EasyTextGlobalConfig.h +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/3. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import "EasyTextTypes.h" +#import "EasyShowUtils.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface EasyTextGlobalConfig : NSObject + +// 显示吐丝所需要的父视图(为空将显示在window上) +//@property (nonatomic,strong)UIView *superView UI_APPEARANCE_SELECTOR ; + +//显示期间,父视图是否接受事件 +@property (nonatomic,assign)BOOL superReceiveEvent UI_APPEARANCE_SELECTOR ; + +// 展示/隐藏 动画类型 +@property (nonatomic,assign)TextAnimationType animationType UI_APPEARANCE_SELECTOR ; + +// 显示吐丝的位置(上、中、下、statusbar上、导航条上) +@property (nonatomic,assign)TextStatusType statusType UI_APPEARANCE_SELECTOR ; + +//显示背景颜色 +@property (nonatomic,strong)UIColor *bgColor UI_APPEARANCE_SELECTOR ; + +//显示文字大小 +@property (nonatomic,strong)UIFont *titleFont UI_APPEARANCE_SELECTOR ; + +// 显示文字颜色 +@property (nonatomic,strong)UIColor *titleColor UI_APPEARANCE_SELECTOR ; + +// 阴影颜色(为clearcolor的时候不显示阴影) +@property (nonatomic,strong)UIColor *shadowColor UI_APPEARANCE_SELECTOR; + +//显示文字的时间 +@property (nonatomic,copy) float(^textShowTimeBlock)(NSString *text) UI_APPEARANCE_SELECTOR ; + +// 吐丝是否系那是到window上,默认为YES 。(如果设置为NO:将显示到最顶层controller上) ---> window和controller的区别。当push到下一个控制器的时候,会不会还在系那是 +@property (nonatomic,assign)BOOL showOnWindow UI_APPEARANCE_SELECTOR ; + +easyShowView_singleton_interface + + +/** + * 是否已经使用了globalConfig,库内部使用 + */ ++ (BOOL)isUseTextGlobalConfig ; + +@end + +NS_ASSUME_NONNULL_END + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextGlobalConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextGlobalConfig.m new file mode 100644 index 0000000..a2b43c3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextGlobalConfig.m @@ -0,0 +1,38 @@ +// +// EasyTextGlobalConfig.m +// EasyShowViewDemo +// +// Created by Mr_Chen on 2018/3/3. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyTextGlobalConfig.h" + +@implementation EasyTextGlobalConfig + +easyShowView_singleton_implementation(EasyTextGlobalConfig) + +- (instancetype)init +{ + if (self = [super init]) { + + _showOnWindow = YES ; + _superReceiveEvent = YES ; + + _animationType = TextAnimationTypeBounce ; + _statusType = TextStatusTypeMidden ; + + _titleFont = [UIFont systemFontOfSize:15]; + _titleColor = [[UIColor whiteColor]colorWithAlphaComponent:1.7]; + _bgColor = [UIColor blackColor]; + _shadowColor = [UIColor blueColor]; + + } + return self ; +} + ++ (BOOL)isUseTextGlobalConfig +{ + return _showInstance!=nil ? YES : NO ; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextTypes.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextTypes.h new file mode 100644 index 0000000..c770779 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextTypes.h @@ -0,0 +1,59 @@ +// +// EasyTextTypes.h +// EasyShowViewDemo +// +// Created by nf on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import +#import + + +typedef NS_ENUM(NSInteger, ShowTextStatus) { + + ShowTextStatusPureText ,/** 纯文字 */ + ShowTextStatusSuccess, /** 成功 */ + ShowTextStatusError, /** 失败 */ + ShowTextStatusInfo, /** 提示 */ + ShowTextStatusImage, /** 自定义图片 */ +}; + +/** + * 设置文字的位置 + */ +typedef NS_ENUM(NSInteger , TextStatusType) { + TextStatusTypeUndefine = 0 , /** 未定义 */ + TextStatusTypeTop = 1 , + TextStatusTypeMidden , + TextStatusTypeBottom, + TextStatusTypeStatusBar ,//在statusbar上显示 + TextStatusTypeNavigation ,//在navigation上显示 +}; + +/** + * 文字展示时的动画类型 + */ +typedef NS_ENUM(NSInteger , TextAnimationType) { + TextAnimationTypeUndefine = 0 , /** 未定义 */ + TextAnimationTypeNone ,//无动画 + TextAnimationTypeFade,//alpha改变 + TextAnimationTypeBounce ,//抖动 +}; + + +UIKIT_EXTERN const CGFloat TextShowMaxTime ;//最大的显示时长。显示的时长为字符串长度成比例。但是不会超过设置的此时间长度(默认为6秒) +UIKIT_EXTERN const CGFloat TextShowMaxWidth ;//文字显示的最大宽度 + + +UIKIT_EXTERN const CGFloat EasyDrawImageWH ; +UIKIT_EXTERN const CGFloat EasyDrawImageEdge ; +UIKIT_EXTERN const CGFloat EasyTextShowEdge ; +UIKIT_EXTERN const CGFloat EasyShowViewMinWidth ; + +UIKIT_EXTERN NSString *const EasyShowViewDidlDismissNotification; + + +@interface EasyTextTypes : NSObject + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextTypes.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextTypes.m new file mode 100644 index 0000000..c4e8a0b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextTypes.m @@ -0,0 +1,27 @@ +// +// EasyTextTypes.m +// EasyShowViewDemo +// +// Created by nf on 2018/3/13. +// Copyright © 2018年 chenliangloveyou. All rights reserved. +// + +#import "EasyTextTypes.h" + + +const CGFloat TextShowMaxTime = 8.0f;//最大的显示时长。显示的时长为字符串长度成比例。但是不会超过设置的此时间长度(默认为6秒) +const CGFloat TextShowMaxWidth = 300;//文字显示的最大宽度 + + +const CGFloat EasyDrawImageWH = 30 ; //显示图片的宽高 +const CGFloat EasyDrawImageEdge = 15 ; //显示图片的边距 +const CGFloat EasyTextShowEdge = 40 ; //显示纯文字时,当设置top和bottom的时候,距离屏幕上下的距离 +const CGFloat EasyShowViewMinWidth = 50 ;//视图最小的宽度 + + +NSString *const EasyShowViewDidlDismissNotification = @"EasyShowViewDidlDismissNotification" ; //当EasyShowView消失的时候会发送此通知。 + + +@implementation EasyTextTypes + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextView.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextView.h new file mode 100644 index 0000000..eaa018d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextView.h @@ -0,0 +1,46 @@ +// +// EasyTextView.h +// EasyShowViewDemo +// +// Created by nf on 2017/12/14. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import + +#import "EasyTextConfig.h" + +@interface EasyTextView : UIView + +/** + * 显示一个纯文字消息 (config:显示属性设置,可省略) + */ ++ (void)showText:(NSString *)text ; ++ (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; + +/** + * 显示一个成功消息(config:显示属性设置) + */ ++ (void)showSuccessText:(NSString *)text ; ++ (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; + +/** + * 显示一个错误消息(config:显示属性设置) + */ ++ (void)showErrorText:(NSString *)text ; ++ (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; + +/** + * 显示一个提示消息(config:显示属性设置) + */ ++ (void)showInfoText:(NSString *)text ; ++ (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; + +/** + * 显示一个自定义图片消息(config:显示属性设置) + */ ++ (void)showImageText:(NSString *)text imageName:(NSString *)imageName ; ++ (void)showImageText:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *(^)(void))config ; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextView.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextView.m new file mode 100644 index 0000000..0df9d8e --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/EasyTextView.m @@ -0,0 +1,504 @@ +// +// EasyTextView.m +// EasyShowViewDemo +// +// Created by nf on 2017/12/14. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import "EasyTextView.h" +#import "UIView+EasyShowExt.h" + +#import "EasyTextBgView.h" + +#import "EasyTextGlobalConfig.h" + +@interface EasyTextView() + +@property (nonatomic,strong)NSString *showText ;//展示的文字 +@property (nonatomic,strong)NSString *showImageName ;//展示的图片 +@property (nonatomic,assign)ShowTextStatus showTextStatus ;//展示的类型 +@property (nonatomic,strong)EasyTextConfig *showTextConfig ;//配置信息 + +@property (nonatomic,assign)BOOL isShowOnStatusBar ; +@property (nonatomic,assign)BOOL isShowOnNavigation ; + +@property (nonatomic,strong)EasyTextBgView *showBgView ;//用于放图片和文字的背景 + + +- (void)showViewWithSuperView:(UIView *)superView ; +- (void)removeSelfFromSuperView ; + +@property (nonatomic,strong)NSTimer *removeTimer ; +@property CGFloat timerShowTime ;//定时器走动的时间 + +@end + +@implementation EasyTextView + +- (void)dealloc +{ + +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + self.backgroundColor = [UIColor clearColor]; + } + return self ; +} + + +- (void)showViewWithSuperView:(UIView *)superView +{ + //展示视图的frame + CGRect showFrame = [self showRectWithSpuerView:superView] ; + + if (self.showTextConfig.superReceiveEvent) {//父视图能接受事件 + //self的大小为显示区域的大小 + [self setFrame:CGRectMake((superView.easyS_width-showFrame.size.width)/2, showFrame.origin.y, showFrame.size.width, showFrame.size.height)]; + //显示视图的bgview的frame的位置为{0,0} + showFrame.origin.y = 0 ; + } + else{ + //父视图不能接收-->self的大小应该为superview的大小。来遮盖 + [self setFrame: CGRectMake(0, 0, superView.easyS_width, superView.easyS_height)] ; + } + + + self.showBgView = [[EasyTextBgView alloc]initWithFrame:showFrame + status:self.showTextStatus + text:self.showText + imageName:self.showImageName config:self.showTextConfig]; + [self addSubview:self.showBgView]; + + + [self showSelfToSuperView:superView]; + + if (self.showTextConfig.shadowColor && self.showTextConfig.shadowColor!=[UIColor clearColor]) { + CGFloat afterStart = self.showTextConfig.animationType==TextAnimationTypeBounce ? EasyShowAnimationTime : EasyShowAnimationTime/2 ; + if (afterStart > 0.1) { + afterStart -=0.1 ; + } + dispatch_queue_after_S(afterStart, ^{ + [self showBackgrouldsubLayer]; + }); + } +} +- (void)showBackgrouldsubLayer +{ + CALayer *addSubLayer=[CALayer layer]; + addSubLayer.frame= self.showBgView.frame; + addSubLayer.cornerRadius=8; + addSubLayer.backgroundColor=self.showTextConfig.bgColor.CGColor; + addSubLayer.masksToBounds=NO; + addSubLayer.name = @"backgrouldsubLayer"; + addSubLayer.shadowColor = self.showTextConfig.shadowColor.CGColor; + addSubLayer.shadowOffset = CGSizeMake(0.5,1); + addSubLayer.shadowOpacity = 0.6; + addSubLayer.shadowRadius = 3; + [self.layer insertSublayer:addSubLayer below:self.showBgView.layer]; +} +- (void)hiddenBackgrouldsubLayer +{ + for (CALayer *subLayer in self.layer.sublayers) { + if ([subLayer.name isEqualToString:@"backgrouldsubLayer"]) { + [subLayer removeFromSuperlayer]; + break ; + } + } +} + +- (void)showSelfToSuperView:(UIView *)superView +{ + switch (self.showTextConfig.animationType) { + case TextAnimationTypeNone: + { + if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { + self.easyS_y = 0 ; + [self.showBgView showWindowYToPoint:0]; + + [superView addSubview:self]; + + } + else{ +// self.alpha = 0.1 ; +// [UIView animateWithDuration:EasyShowAnimationTime animations:^{ +// self.alpha = 1.0 ; +// } completion:^(BOOL finished) { + [superView addSubview:self]; +// }]; + } + }break; + case TextAnimationTypeFade: + { + if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { + self.easyS_y = 0 ; + [self.showBgView showWindowYToPoint:0]; + + [superView addSubview:self]; + } + else{ + self.alpha = 0.1 ; + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alpha = 1.0 ; + } completion:^(BOOL finished) { + }]; + [superView addSubview:self]; + } + }break ; + case TextAnimationTypeBounce: + { + if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { + self.easyS_y = - self.easyS_height ; + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.easyS_y = 0 ; + [self.showBgView showWindowYToPoint:0]; + }] ; + } + else{ + [self.showBgView showStartAnimationWithDuration:EasyShowAnimationTime]; + } + + [superView addSubview:self]; + }break ; + default: + break; + } + +} +- (void)removeSelfFromSuperView +{ + + //移除阴影 + if (self.showTextConfig.shadowColor && self.showTextConfig.shadowColor!=[UIColor clearColor]) { + dispatch_queue_after_S(0.1, ^{ + [self hiddenBackgrouldsubLayer]; + }); + } + + switch (self.showTextConfig.animationType) { + case TextAnimationTypeNone: + { + [self removeFromSuperview]; + }break ; + case TextAnimationTypeFade: + { + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.alpha = 0.1 ; + }completion:^(BOOL finished) { + [self removeFromSuperview]; + }] ; + }break ; + case TextAnimationTypeBounce: + { + + if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { + + [UIView animateWithDuration:EasyShowAnimationTime animations:^{ + self.easyS_y = -self.easyS_height ; + [self.showBgView showWindowYToPoint:-self.easyS_height ]; + }completion:^(BOOL finished) { + [self removeFromSuperview]; + }] ; + } + else{ + [self.showBgView showEndAnimationWithDuration:EasyShowAnimationTime]; + dispatch_queue_after_S(EasyShowAnimationTime, ^{ + [self removeFromSuperview]; + }); + } + } + break ; + default: + break ; + } + + +} + ++ (void)EasyTextViewWithText:(NSString *)text + imageName:(NSString *)imageName + status:(ShowTextStatus)status + config:(EasyTextConfig *(^)(void))config +{ + if (status==ShowTextStatusPureText && ISEMPTY_S(text)) {// + NSAssert(NO, @"you should set a text for showView !"); + return ; + } + + NSAssert([NSThread isMainThread], @"needs to be accessed on the main thread."); + + if (![NSThread isMainThread]) { + dispatch_async(dispatch_get_main_queue(), ^(void) { + }); + } + + EasyTextConfig *tempConfig = [self changeConfigWithConfig:config] ; + + //显示之前隐藏还在显示的视图 + NSEnumerator *subviewsEnum = [tempConfig.superView.subviews reverseObjectEnumerator]; + for (UIView *subview in subviewsEnum) { + if ([subview isKindOfClass:self]) { + EasyTextView *showView = (EasyTextView *)subview ; + [showView removeSelfFromSuperView]; + } + } + + EasyTextView *showView = [[EasyTextView alloc] initWithFrame:CGRectZero]; + showView.showText = text ; + showView.showImageName = imageName ; + + showView.showTextStatus = status ; + + showView.showTextConfig = tempConfig ; + + showView.timerShowTime = 0 ; + [showView showViewWithSuperView:tempConfig.superView]; + + [showView.removeTimer fire]; +} + + +- (CGRect)showRectWithSpuerView:(UIView *)superView +{ + //显示图片的高度。 + CGFloat imageH = self.showTextStatus==ShowTextStatusPureText ?:(EasyDrawImageWH + EasyDrawImageEdge) ; + + //显示区域的宽高 + CGFloat backGroundH = 0 ; + CGFloat backGroundW = SCREEN_WIDTH_S ; + switch (self.showTextConfig.statusType) { + case TextStatusTypeStatusBar://如果是在statusbar上,则高固定,不需要计算 + backGroundH = STATUSBAR_HEIGHT_S ; + break; + case TextStatusTypeNavigation: + backGroundH = NAVIGATION_HEIGHT_S ; + break ; + default:{ + CGSize textSize = CGSizeZero ; + if (!ISEMPTY_S(self.showText)) { + textSize = [EasyShowUtils textWidthWithStirng:self.showText + font:self.showTextConfig.titleFont + maxWidth:TextShowMaxWidth]; + } + backGroundH = (textSize.height?(textSize.height+30):0) + imageH ; + backGroundW = textSize.width?(textSize.width+40):0 ; + + if (backGroundW < EasyShowViewMinWidth) { + backGroundW = EasyShowViewMinWidth ; + } + } break; + } + + //显示区域的y值 + CGFloat showFrameY = (superView.easyS_height-backGroundH)/2 ;//默认显示在中间 + // if (self.showTextStatus != ShowStatusLoading) { + switch (self.showTextConfig.statusType ) { + case TextStatusTypeNavigation: + case TextStatusTypeStatusBar: + showFrameY = 0 ; + break ; + case TextStatusTypeTop: + showFrameY = NAVIGATION_HEIGHT_S + EasyTextShowEdge ; + break; + case TextStatusTypeBottom: + showFrameY = SCREEN_HEIGHT_S - backGroundH - EasyTextShowEdge ; + break ; + default: break; + } + // } + + //显示区域的frame + CGRect showFrame = CGRectMake(0, showFrameY, backGroundW, backGroundH); + + if (!self.showTextConfig.superReceiveEvent) { + showFrame.origin = CGPointMake((superView.easyS_width-backGroundW)/2, showFrameY) ; + } + + return showFrame ; +} + + + +- (void)timerAction +{ + if (_timerShowTime >= self.showTextConfig.textShowTimeBlock(self.showText) ) { + //移除定时器 + _timerShowTime = 0 ; + if (_removeTimer) { + [_removeTimer invalidate]; + _removeTimer = nil ; + } + //移除自己 + [self removeSelfFromSuperView]; + } + _timerShowTime++ ; +} +- (NSTimer *)removeTimer +{ + if (nil == _removeTimer) { + _removeTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerAction) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:_removeTimer forMode:NSRunLoopCommonModes]; + } + return _removeTimer ; +} + + +#pragma mark - getter +//是否显示在statusbar上 +- (BOOL)isShowOnStatusBar +{ + return self.showTextConfig.statusType==TextStatusTypeStatusBar ; +} +//是否正在显示在navigation上 +- (BOOL)isShowOnNavigation +{ + return self.showTextConfig.statusType==TextStatusTypeNavigation ; +} + +#pragma - 工具 + ++ (EasyTextConfig *)changeConfigWithConfig:(EasyTextConfig *(^)(void))config +{ + + EasyTextConfig *tempConfig = config ? config() : nil ; + if (!tempConfig) { + tempConfig = [EasyTextConfig shared] ; + } + EasyTextGlobalConfig *globalConfig = [EasyTextGlobalConfig shared]; + + if (!tempConfig.superView) { + if (globalConfig.showOnWindow) { + tempConfig.superView = kEasyShowKeyWindow ; + } + else{ + tempConfig.superView = [EasyShowUtils easyShowViewTopViewController].view; + } + } + + if (tempConfig.animationType == TextAnimationTypeUndefine) { + tempConfig.animationType = globalConfig.animationType ; + } + if (tempConfig.statusType == TextStatusTypeUndefine) { + tempConfig.statusType = globalConfig.statusType ; + } + if (!tempConfig.titleFont) { + tempConfig.titleFont = globalConfig.titleFont ; + } + if (!tempConfig.titleColor) { + tempConfig.titleColor = globalConfig.titleColor ; + } + if (!tempConfig.bgColor) { + tempConfig.bgColor = globalConfig.bgColor ; + } + if (!tempConfig.shadowColor) { + tempConfig.shadowColor = globalConfig.shadowColor ; + } + + if (!tempConfig.textShowTimeBlock) { + + if (globalConfig.textShowTimeBlock) { + tempConfig.textShowTimeBlock = globalConfig.textShowTimeBlock ; + }else{ + float(^textShowTime)(NSString *text) = ^float(NSString *text){ + CGFloat time = 1 + text.length*0.15 ; + if (time > TextShowMaxTime) { + time = TextShowMaxTime ; + } + if (time < 2) { + time = 2 ; + } + return time ; + }; + tempConfig.textShowTimeBlock = textShowTime ; + } + } + return tempConfig ; +} + + +#pragma mark - 类方法 + ++ (void)showText:(NSString *)text +{ + EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ + return [EasyTextConfig shared] ; + }; + [self showText:text config:configTemp]; +} ++ (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config +{ + [self EasyTextViewWithText:text + imageName:nil + status:ShowTextStatusPureText + config:config]; +} + + ++ (void)showSuccessText:(NSString *)text +{ + EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ + return [EasyTextConfig shared] ; + }; + [self showSuccessText:text config:configTemp]; +} ++ (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config +{ + [self EasyTextViewWithText:text + imageName:nil + status:ShowTextStatusSuccess + config:config]; +} + + ++ (void)showErrorText:(NSString *)text +{ + EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ + return [EasyTextConfig shared] ; + }; + [self showErrorText:text config:configTemp]; +} ++ (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config +{ + [self EasyTextViewWithText:text + imageName:nil + status:ShowTextStatusError + config:config]; +} + + ++ (void)showInfoText:(NSString *)text +{ + EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ + return [EasyTextConfig shared] ; + }; + [self showInfoText:text config:configTemp]; +} ++ (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config +{ + [self EasyTextViewWithText:text + imageName:nil + status:ShowTextStatusInfo + config:config]; +} + + ++ (void)showImageText:(NSString *)text imageName:(NSString *)imageName +{ + EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ + return [EasyTextConfig shared] ; + }; + [self showImageText:text imageName:imageName config:configTemp] ; +} ++ (void)showImageText:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *(^)(void))config +{ + [self EasyTextViewWithText:text + imageName:imageName + status:ShowTextStatusImage + config:config]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/UIView+EasyShowExt.h b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/UIView+EasyShowExt.h new file mode 100644 index 0000000..167943d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/UIView+EasyShowExt.h @@ -0,0 +1,45 @@ +// +// UIView+EasyShowExt.h +// EasyShowViewDemo +// +// Created by nf on 2017/11/24. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import + + + +/** + * 已iPhone5为标准,宽高都等比例缩放 + * + * 4/4s 3.5寸 320*480 + * 5/5s/se 4寸 320*568 + * 6/6s/7/8 4.7寸 375*667 + * 6p/6ps/7p/8p 5.5寸 414*736 + * iPhonex 5.8寸 375*812 + */ + +@interface UIView (EasyShowExt) + +@property(nonatomic) CGFloat easyS_x; +@property(nonatomic) CGFloat easyS_y; +@property(nonatomic) CGFloat easyS_width; +@property(nonatomic) CGFloat easyS_height; + +@property(nonatomic) CGFloat easyS_centerX; +@property(nonatomic) CGFloat easyS_centerY; + +@property(nonatomic) CGFloat easyS_left; +@property(nonatomic) CGFloat easyS_top; +@property(nonatomic) CGFloat easyS_right; +@property(nonatomic) CGFloat easyS_bottom; + + +- (void)setRoundedCorners:(CGFloat)corners ; + +- (void)setRoundedCorners:(UIRectCorner)corners + borderWidth:(CGFloat)borderWidth + borderColor:(UIColor *)borderColor + cornerSize:(CGSize)size ; +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/UIView+EasyShowExt.m b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/UIView+EasyShowExt.m new file mode 100644 index 0000000..851d28b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/EasyShowView/UIView+EasyShowExt.m @@ -0,0 +1,173 @@ +// +// UIView+EasyShowExt.m +// EasyShowViewDemo +// +// Created by nf on 2017/11/24. +// Copyright © 2017年 chenliangloveyou. All rights reserved. +// + +#import "UIView+EasyShowExt.h" + +#import "EasyShowUtils.h" + +@implementation UIView (EasyShowExt) + +- (CGFloat)easyS_x { + return self.frame.origin.x; +} +- (void)setEasyS_x:(CGFloat)easyS_x { + CGRect frame = self.frame; + frame.origin.x = easyS_x; + self.frame = frame; +} +- (CGFloat)easyS_y { + return self.frame.origin.y; +} +- (void)setEasyS_y:(CGFloat)easyS_y { + CGRect frame = self.frame; + frame.origin.y = easyS_y; + self.frame = frame; +} +- (CGFloat)easyS_width { + return self.frame.size.width; +} + +- (void)setEasyS_width:(CGFloat)easyS_width { + CGRect frame = self.frame; + frame.size.width = easyS_width; + self.frame = frame; +} + +- (CGFloat)easyS_height { + return self.frame.size.height; +} + +- (void)setEasyS_height:(CGFloat)easyS_height { + CGRect frame = self.frame; + frame.size.height = easyS_height; + self.frame = frame; +} + + +- (CGFloat)easyS_centerX { + return self.center.x; +} + +- (void)setEasyS_centerX:(CGFloat)easyS_centerX{ + self.center = CGPointMake(easyS_centerX, self.center.y); +} + +- (CGFloat)easyS_centerY { + return self.center.y; +} + +- (void)setEasyS_centerY:(CGFloat)easyS_centerY { + self.center = CGPointMake(self.center.x, easyS_centerY); +} + + + +- (CGFloat)easyS_left { + return self.frame.origin.x; +} + +- (void)setEasyS_left:(CGFloat)easyS_left { + CGRect frame = self.frame; + frame.origin.x = easyS_left; + self.frame = frame; +} + +- (CGFloat)easyS_top { + return self.frame.origin.y; +} + +- (void)setEasyS_top:(CGFloat)easyS_top { + CGRect frame = self.frame; + frame.origin.y = easyS_top; + self.frame = frame; +} + +- (CGFloat)easyS_right { + return self.frame.origin.x + self.frame.size.width; +} + +- (void)setEasyS_right:(CGFloat)easyS_right { + CGRect frame = self.frame; + frame.origin.x = easyS_right - frame.size.width; + self.frame = frame; +} + +- (CGFloat)easyS_bottom { + return self.frame.origin.y + self.frame.size.height; +} + +- (void)setEasyS_bottom:(CGFloat)easyS_bottom { + CGRect frame = self.frame; + frame.origin.y = easyS_bottom - frame.size.height; + self.frame = frame; +} + + +- (void)setRoundedCorners:(CGFloat)corners +{ + + UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(corners, 0)]; + CAShapeLayer* shapeLayer = [CAShapeLayer layer]; + shapeLayer.frame = self.bounds; + shapeLayer.path = maskPath.CGPath; + + self.layer.mask = shapeLayer ; +} + +- (void)setRoundedCorners:(UIRectCorner)corners + borderWidth:(CGFloat)borderWidth + borderColor:(UIColor *)borderColor + cornerSize:(CGSize)size +{ + UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds + byRoundingCorners:corners + cornerRadii:size]; + + CAShapeLayer* maskLayer = [CAShapeLayer layer]; + maskLayer.fillColor = [UIColor blueColor].CGColor; + maskLayer.frame = self.bounds; + maskLayer.path = maskPath.CGPath; + + self.layer.mask = maskLayer; + + if (borderWidth > 0) { + CAShapeLayer *borderLayer = [CAShapeLayer layer]; + + // 用贝赛尔曲线画线,path 其实是在线的中间,这样会被 layer.mask(遮罩层)遮住一半,故在 halfWidth 处新建 path,刚好产生一个内描边 + CGFloat halfWidth = borderWidth / 2.0f; + CGRect f = CGRectMake(halfWidth, halfWidth, CGRectGetWidth(self.bounds) - borderWidth, CGRectGetHeight(self.bounds) - borderWidth); + + borderLayer.path = [UIBezierPath bezierPathWithRoundedRect:f byRoundingCorners:corners cornerRadii:size].CGPath; + borderLayer.fillColor = [UIColor clearColor].CGColor; + borderLayer.strokeColor = borderColor.CGColor; + borderLayer.lineWidth = borderWidth; + borderLayer.frame = CGRectMake(0, 0, CGRectGetWidth(f), CGRectGetHeight(f)); + [self.layer addSublayer:borderLayer]; + } +} +@end + + + + + + + + + + + + + + + + + + + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollView.h b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollView.h new file mode 100644 index 0000000..f19e0f3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollView.h @@ -0,0 +1,143 @@ +// +// GKCycleScrollView.h +// GKCycleScrollViewDemo +// +// Created by QuintGao on 2019/9/15. +// Copyright © 2019 QuintGao. All rights reserved. +// + +#import +#import "GKCycleScrollViewCell.h" + +// 滚动方向 +typedef NS_ENUM(NSUInteger, GKCycleScrollViewScrollDirection) { + GKCycleScrollViewScrollDirectionHorizontal = 0, // 横向 + GKCycleScrollViewScrollDirectionVertical = 1 // 纵向 +}; + +@class GKCycleScrollView; + +/// 数据源代理 +@protocol GKCycleScrollViewDataSource + +/// 返回cell个数 +/// @param cycleScrollView cycleScrollView description +- (NSInteger)numberOfCellsInCycleScrollView:(GKCycleScrollView *)cycleScrollView; + +/// 返回继承自GKCycleScrollViewCell的类 +/// @param cycleScrollView cycleScrollView description +/// @param index 索引 +- (__kindof GKCycleScrollViewCell *)cycleScrollView:(GKCycleScrollView *)cycleScrollView cellForViewAtIndex:(NSInteger)index; + +@end + +@protocol GKCycleScrollViewDelegate + +@optional +/// 返回自定义cell尺寸 +/// @param cycleScrollView cycleScrollView description +- (CGSize)sizeForCellInCycleScrollView:(GKCycleScrollView *)cycleScrollView; + +// cell滑动时调用 +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didScrollCellToIndex:(NSInteger)index; + +// cell点击时调用 +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didSelectCellAtIndex:(NSInteger)index; + +/// scrollView滚动中的回调 +/// @param cycleScrollView cycleScrollView对象 +/// @param fromIndex 正在滚动中,相对位置处于左边或上边的index,根据direction区分 +/// @param toIndex 正在滚动中,相对位置处于右边或下边的index,根据direction区分 +/// @param ratio 从左到右或从上到下计算的百分比,根据direction区分 +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView scrollingFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex ratio:(CGFloat)ratio; +#pragma mark - UIScrollViewDelegate 相关 +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView willBeginDragging:(UIScrollView *)scrollView; +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didScroll:(UIScrollView *)scrollView; +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didEndDecelerating:(UIScrollView *)scrollView; +- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didEndScrollingAnimation:(UIScrollView *)scrollView; + +@end + +@interface GKCycleScrollView : UIView + +// 数据源 +@property (nonatomic, weak) id dataSource; +// 代理 +@property (nonatomic, weak) id delegate; + +// 滚动方向,默认为横向 +@property (nonatomic, assign) GKCycleScrollViewScrollDirection direction; + +// 滚动视图 +@property (nonatomic, strong, readonly) UIScrollView *scrollView; + +// 默认为nil,需外部创建并传入 +@property (nonatomic, weak) UIPageControl *pageControl; + +// 当前展示的cell +@property (nonatomic, strong, readonly) GKCycleScrollViewCell *currentCell; + +// 当前显示的页码 +@property (nonatomic, assign, readonly) NSInteger currentSelectIndex; + +// 默认选中的页码(默认:0) +@property (nonatomic, assign) NSInteger defaultSelectIndex; + +// 是否自动滚动,默认YES +@property (nonatomic, assign) BOOL isAutoScroll; + +// 是否无限循环,默认YES +@property (nonatomic, assign) BOOL isInfiniteLoop; + +// 是否改变透明度,默认YES +@property (nonatomic, assign) BOOL isChangeAlpha; + +// 非当前页cell的最小透明度,默认1.0f +@property (nonatomic, assign) CGFloat minimumCellAlpha; + +// 左右间距,默认0 +@property (nonatomic, assign) CGFloat leftRightMargin; + +// 上下间距,默认0 +@property (nonatomic, assign) CGFloat topBottomMargin; + +// 自动滚动时间间隔,默认3s +@property (nonatomic, assign) CGFloat autoScrollTime; + +/** + 刷新数据,必须调用此方法 + */ +- (void)reloadData; + +/** + 获取可重复使用的cell + + @return cell + */ +- (GKCycleScrollViewCell *)dequeueReusableCell; + +/** + 滑动到指定cell + + @param index 指定cell的索引 + @param animated 是否动画 + */ +- (void)scrollToCellAtIndex:(NSInteger)index animated:(BOOL)animated; + +/** + 调整当前显示的cell的位置,防止出现滚动时卡住一半 + */ +- (void)adjustCurrentCell; + +/** + 开启定时器 + */ +- (void)startTimer; + +/** + 关闭定时器 + */ +- (void)stopTimer; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollView.m b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollView.m new file mode 100644 index 0000000..b840991 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollView.m @@ -0,0 +1,866 @@ +// +// GKCycleScrollView.m +// GKCycleScrollViewDemo +// +// Created by QuintGao on 2019/9/15. +// Copyright © 2019 QuintGao. All rights reserved. +// + +#import "GKCycleScrollView.h" + +@interface GKCycleScrollView () + +@property (nonatomic, strong) UIScrollView *scrollView; + +@property (nonatomic, strong) GKCycleScrollViewCell *currentCell; + +@property (nonatomic, assign) NSInteger currentSelectIndex; + +// 实际的个数 +@property (nonatomic, assign) NSInteger realCount; + +// 显示的个数 +@property (nonatomic, assign) NSInteger showCount; + +// 定时器 +@property (nonatomic, weak) NSTimer *timer; +@property (nonatomic, assign) NSInteger timerIndex; + +// 当前显示的cell大小 +@property (nonatomic, assign) CGSize cellSize; + +@property (nonatomic, strong) NSMutableArray *visibleCells; +@property (nonatomic, strong) NSMutableArray *reusableCells; +@property (nonatomic, assign) NSRange visibleRange; + +// 处理xib加载时导致的尺寸不准确问题 +@property (nonatomic, assign) CGSize originSize; + +@end + +@implementation GKCycleScrollView + +#pragma mark - Life Cycle +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self initialization]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + if (self = [super initWithCoder:aDecoder]) { + [self initialization]; + } + return self; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + if (CGSizeEqualToSize(self.originSize, CGSizeZero)) return; + + // 解决xib加载时导致的布局错误问题 + if (!CGSizeEqualToSize(self.bounds.size, self.originSize)) { + [self updateScrollViewAndCellSize]; + } +} + +// 解决当父视图释放时,当前视图因为NSTimer强引用而导致的不能释放 +- (void)willMoveToSuperview:(UIView *)newSuperview { + if (!newSuperview) { + [self stopTimer]; + } +} + +- (void)dealloc { + [self stopTimer]; + self.scrollView.delegate = nil; +} + +// 重新此方法是为了解决当cell超出UIScrollView时不能点击的问题 +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { + if ([self pointInside:point withEvent:event]) { + // 判断点击的点是否在cell上 + for (UIView *cell in self.scrollView.subviews) { + // 将cell的frame转换到当前视图上 + CGRect convertFrame = CGRectZero; + convertFrame.size = cell.frame.size; + + if (self.direction == GKCycleScrollViewScrollDirectionHorizontal) { + convertFrame.origin.x = cell.frame.origin.x + self.scrollView.frame.origin.x - self.scrollView.contentOffset.x; + convertFrame.origin.y = self.scrollView.frame.origin.y + cell.frame.origin.y; + }else { + convertFrame.origin.x = self.scrollView.frame.origin.x + cell.frame.origin.x; + convertFrame.origin.y = cell.frame.origin.y + self.scrollView.frame.origin.y - self.scrollView.contentOffset.y; + } + + // 判断点击的点是否在cell上 + if (CGRectContainsPoint(convertFrame, point)) { + // 修复cell上添加其他点击事件无效的bug + UIView *view = [super hitTest:point withEvent:event]; + if (view == self || view == cell || view == self.scrollView) return cell; + return view; + } + } + // 判断点击的点是否在UIScrollView上 + CGPoint newPoint = CGPointZero; + newPoint.x = point.x - self.scrollView.frame.origin.x + self.scrollView.contentOffset.x; + newPoint.y = point.y - self.scrollView.frame.origin.y + self.scrollView.contentOffset.y; + if ([self.scrollView pointInside:newPoint withEvent:event]) { + return [self.scrollView hitTest:newPoint withEvent:event]; + } + // 系统处理 + return [super hitTest:point withEvent:event]; + } + return nil; +} + +#pragma mark - Public Methods +- (void)reloadData { + // 移除所有cell + [self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + // 停止定时器 + [self stopTimer]; + + // 加载数据 + if (self.dataSource && [self.dataSource respondsToSelector:@selector(numberOfCellsInCycleScrollView:)]) { + // 实际个数 + self.realCount = [self.dataSource numberOfCellsInCycleScrollView:self]; + + // 展示个数 + if (self.isInfiniteLoop) { + self.showCount = self.realCount == 1 ? 1 : self.realCount * 3; + }else { + self.showCount = self.realCount; + } + + // 如果总页数为0,return + if (self.showCount == 0) return; + + if (self.pageControl && [self.pageControl respondsToSelector:@selector(setNumberOfPages:)]) { + [self.pageControl setNumberOfPages:self.realCount]; + } + } + + // 清除原始数据 + [self.visibleCells removeAllObjects]; + [self.reusableCells removeAllObjects]; + self.visibleRange = NSMakeRange(0, 0); + + //cell数量为1或defaultSelectIndex超过了当前数量 + if (self.defaultSelectIndex >= self.realCount) { + self.defaultSelectIndex = 0; + } + if (self.realCount == 1) { + self.timerIndex = 0; + } + + for (NSInteger i = 0; i < self.showCount; i++){ + [self.visibleCells addObject:[NSNull null]]; + } + + __weak __typeof(self) weakSelf = self; + [self refreshSizeCompletion:^{ + [weakSelf initialScrollViewAndCellSize]; + }]; +} + +- (void)refreshSizeCompletion:(void(^)(void))completion { + if (self.bounds.size.width == 0 || self.bounds.size.height == 0) { + [self layoutIfNeeded]; + // 此处做延时处理是为了解决使用Masonry布局时导致的view的大小不能及时更新的bug + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (self.bounds.size.width == 0 || self.bounds.size.height == 0) { + [self refreshSizeCompletion:completion]; + }else { + !completion ? : completion(); + } + }); + }else { + !completion ? : completion(); + } +} + +- (GKCycleScrollViewCell *)dequeueReusableCell{ + GKCycleScrollViewCell *cell = self.reusableCells.lastObject; + if (cell) { + [self.reusableCells removeLastObject]; + } + return cell; +} + +- (void)scrollToCellAtIndex:(NSInteger)index animated:(BOOL)animated { + if (index < self.realCount) { + [self stopTimer]; + + if (self.isInfiniteLoop) { + self.timerIndex = self.realCount + index; + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startTimer) object:nil]; + [self performSelector:@selector(startTimer) withObject:nil afterDelay:0.5]; + } else { + self.timerIndex = index; + } + + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: + [self.scrollView setContentOffset:CGPointMake(self.cellSize.width * self.timerIndex, 0) animated:animated]; + break; + case GKCycleScrollViewScrollDirectionVertical: + [self.scrollView setContentOffset:CGPointMake(0, self.cellSize.height * self.timerIndex) animated:animated]; + break; + default: + break; + } + [self setupCellsWithContentOffset:self.scrollView.contentOffset]; + [self updateVisibleCellAppearance]; + } +} + +- (void)adjustCurrentCell { + if (self.isAutoScroll && self.realCount > 0) { + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + self.scrollView.contentOffset = CGPointMake(self.cellSize.width * self.timerIndex, 0); + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + self.scrollView.contentOffset = CGPointMake(0, self.cellSize.height * self.timerIndex); + } + break; + default: + break; + } + } +} + +- (void)startTimer { + if (self.realCount > 1 && self.isAutoScroll) { + [self stopTimer]; + + NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:self.autoScrollTime target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES]; + [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; + self.timer = timer; + } +} + +- (void)stopTimer { + if (self.timer) { + [self.timer invalidate]; + self.timer = nil; + } +} + +#pragma mark Private Methods +- (void)initialization { + // 初始化默认数据 + self.clipsToBounds = YES; + self.isChangeAlpha = YES; + self.isAutoScroll = YES; + self.isInfiniteLoop = YES; + self.minimumCellAlpha = 1.0f; + self.autoScrollTime = 3.0f; + + // 添加scrollView + [self addSubview:self.scrollView]; +} + +- (void)initialScrollViewAndCellSize { + self.originSize = self.bounds.size; + [self updateScrollViewAndCellSize]; + + // 默认选中 + if (self.defaultSelectIndex >= 0 && self.defaultSelectIndex < self.realCount) { + [self handleCellScrollWithIndex:self.defaultSelectIndex]; + } +} + +- (void)updateScrollViewAndCellSize { + if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) return; + + // 设置cell尺寸 + self.cellSize = CGSizeMake(self.bounds.size.width - 2 * self.leftRightMargin, self.bounds.size.height - 2 * self.topBottomMargin); + if (self.delegate && [self.delegate respondsToSelector:@selector(sizeForCellInCycleScrollView:)]) { + self.cellSize = [self.delegate sizeForCellInCycleScrollView:self]; + } + + // 设置scrollView大小 + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + self.scrollView.frame = CGRectMake(0, 0, self.cellSize.width, self.cellSize.height); + self.scrollView.contentSize = CGSizeMake(self.cellSize.width * self.showCount,0); + self.scrollView.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); + + if (self.realCount > 1) { + CGPoint offset = CGPointZero; + + if (self.isInfiniteLoop) { // 开启无限轮播 + // 滚动到第二组 + offset = CGPointMake(self.cellSize.width * (self.realCount + self.defaultSelectIndex), 0); + self.timerIndex = self.realCount + self.defaultSelectIndex; + }else { + offset = CGPointMake(self.cellSize.width * self.defaultSelectIndex, 0); + self.timerIndex = self.defaultSelectIndex; + } + + [self.scrollView setContentOffset:offset animated:NO]; + + // 自动轮播 + if (self.isAutoScroll) { + [self startTimer]; + } + } + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + self.scrollView.frame = CGRectMake(0, 0, self.cellSize.width, self.cellSize.height); + self.scrollView.contentSize = CGSizeMake(0, self.cellSize.height * self.showCount); + self.scrollView.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); + + if (self.realCount > 1) { + CGPoint offset = CGPointZero; + if (self.isInfiniteLoop) { // 开启无限轮播 + // 滚动到第二组 + offset = CGPointMake(0, self.cellSize.height * (self.realCount + self.defaultSelectIndex)); + self.timerIndex = self.realCount + self.defaultSelectIndex; + }else { + offset = CGPointMake(0, self.cellSize.height * self.defaultSelectIndex); + self.timerIndex = self.defaultSelectIndex; + } + + [self.scrollView setContentOffset:offset animated:NO]; + + // 自动轮播 + if (self.isAutoScroll) { + [self startTimer]; + } + } + } + break; + default: + break; + } + + // 根据当前scrollView的offset设置显示的cell + [self setupCellsWithContentOffset:self.scrollView.contentOffset]; + + // 更新可见cell的显示 + [self updateVisibleCellAppearance]; +} + +- (void)setupCellsWithContentOffset:(CGPoint)offset { + if (self.showCount == 0) return; + if (self.cellSize.width <= 0 || self.cellSize.height <= 0) return; + //计算_visibleRange + CGFloat originX = self.scrollView.frame.origin.x == 0 ? 0.01 : self.scrollView.frame.origin.x; + CGFloat originY = self.scrollView.frame.origin.y == 0 ? 0.01 : self.scrollView.frame.origin.y; + + CGPoint startPoint = CGPointMake(offset.x - originX, offset.y - originY); + CGPoint endPoint = CGPointMake(offset.x + self.scrollView.frame.size.width + originX, offset.y + self.scrollView.frame.size.height + originY); + + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + NSInteger startIndex = 0; + for (NSInteger i = 0; i < self.visibleCells.count; i++) { + if (self.cellSize.width * (i + 1) > startPoint.x) { + startIndex = i; + break; + } + } + + NSInteger endIndex = startIndex; + for (NSInteger i = startIndex; i < self.visibleCells.count; i++) { + //如果都不超过则取最后一个 + if ((self.cellSize.width * (i + 1) < endPoint.x && self.cellSize.width * (i + 2) >= endPoint.x) || i + 2 == self.visibleCells.count) { + endIndex = i + 1; + break; + } + } + + // 可见页分别向前向后扩展一个,提高效率 + startIndex = MAX(startIndex, 0); + endIndex = MIN(endIndex, self.visibleCells.count - 1); + self.visibleRange = NSMakeRange(startIndex, endIndex - startIndex + 1); + + for (NSInteger i = startIndex; i <= endIndex; i++) { + [self addCellAtIndex:i]; + } + + for (NSInteger i = 0; i < startIndex; i ++) { + [self removeCellAtIndex:i]; + } + + for (NSInteger i = endIndex + 1; i < self.visibleCells.count; i ++) { + [self removeCellAtIndex:i]; + } + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + NSInteger startIndex = 0; + for (NSInteger i = 0; i < self.visibleCells.count; i++) { + if (self.cellSize.height * (i +1) > startPoint.y) { + startIndex = i; + break; + } + } + + NSInteger endIndex = startIndex; + for (NSInteger i = startIndex; i < self.visibleCells.count; i++) { + //如果都不超过则取最后一个 + if ((self.cellSize.height * (i + 1) < endPoint.y && self.cellSize.height * (i + 2) >= endPoint.y) || i+ 2 == self.visibleCells.count) { + endIndex = i + 1;//i+2 是以个数,所以其index需要减去1 + break; + } + } + + //可见页分别向前向后扩展一个,提高效率 + startIndex = MAX(startIndex - 1, 0); + endIndex = MIN(endIndex + 1, self.visibleCells.count - 1); + self.visibleRange = NSMakeRange(startIndex, endIndex - startIndex + 1); + + for (NSInteger i = startIndex; i <= endIndex; i++) { + [self addCellAtIndex:i]; + } + + for (NSInteger i = 0; i < startIndex; i ++) { + [self removeCellAtIndex:i]; + } + + for (NSInteger i = endIndex + 1; i < self.visibleCells.count; i ++) { + [self removeCellAtIndex:i]; + } + break; + } + default: + break; + } +} + +- (void)updateVisibleCellAppearance { + if (self.showCount == 0) return; + if (self.cellSize.width <= 0 || self.cellSize.height <= 0) return; + + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal:{ + CGFloat offsetX = self.scrollView.contentOffset.x; + for (NSInteger i = self.visibleRange.location; i < NSMaxRange(self.visibleRange); i++) { + GKCycleScrollViewCell *cell = self.visibleCells[i]; + if ((NSObject *)cell == [NSNull null]) continue; + CGFloat originX = cell.frame.origin.x; + CGFloat delta = fabs(originX - offsetX); + + CGRect originCellFrame = (CGRect){{self.cellSize.width * i, 0}, self.cellSize}; + + CGFloat leftRightInset = 0; + CGFloat topBottomInset = 0; + CGFloat alpha = 0; + + if (delta < self.cellSize.width) { + alpha = (delta / self.cellSize.width) * self.minimumCellAlpha; + + CGFloat adjustLeftRightMargin = self.leftRightMargin == 0 ? 0 : self.leftRightMargin + 1; + CGFloat adjustTopBottomMargin = self.topBottomMargin == 0 ? 0 : self.topBottomMargin; + + leftRightInset = adjustLeftRightMargin * delta / self.cellSize.width; + topBottomInset = adjustTopBottomMargin * delta / self.cellSize.width; + + NSInteger index = self.realCount == 0 ? 0 : i % self.realCount; + if (index == self.currentSelectIndex) { + [self.scrollView bringSubviewToFront:cell]; + } + } else { + alpha = self.minimumCellAlpha; + + leftRightInset = self.leftRightMargin; + topBottomInset = self.topBottomMargin; + + [self.scrollView sendSubviewToBack:cell]; + } + + if (self.leftRightMargin == 0 && self.topBottomMargin == 0) { + cell.frame = originCellFrame; + }else { + CGFloat scaleX = (self.cellSize.width - leftRightInset * 2) / self.cellSize.width; + CGFloat scaleY = (self.cellSize.height - topBottomInset * 2) / self.cellSize.height; + UIEdgeInsets insets = UIEdgeInsetsMake(topBottomInset, leftRightInset - 0.1, topBottomInset, leftRightInset); + + cell.layer.transform = CATransform3DMakeScale(scaleX, scaleY, 1.0); + cell.frame = UIEdgeInsetsInsetRect(originCellFrame, insets); + } + + // 获取当前cell + if (cell.tag == self.currentSelectIndex) { + self.currentCell = cell; + } + + // 透明度渐变 + if (self.isChangeAlpha) { + cell.coverView.alpha = alpha; + } + } + } + break; + case GKCycleScrollViewScrollDirectionVertical:{ + CGFloat offsetY = self.scrollView.contentOffset.y; + for (NSInteger i = self.visibleRange.location; i < NSMaxRange(self.visibleRange); i++) { + GKCycleScrollViewCell *cell = self.visibleCells[i]; + if ((NSObject *)cell == [NSNull null]) continue; + CGFloat originY = cell.frame.origin.y; + CGFloat delta = fabs(originY - offsetY); + + CGRect originCellFrame = (CGRect){{0, self.cellSize.height * i}, self.cellSize}; + + CGFloat leftRightInset = 0; + CGFloat topBottomInset = 0; + CGFloat alpha = 0; + + if (delta < self.cellSize.height) { + alpha = (delta / self.cellSize.height) * self.minimumCellAlpha; + + CGFloat adjustLeftRightMargin = self.leftRightMargin == 0 ? 0 : self.leftRightMargin; + CGFloat adjustTopBottomMargin = self.topBottomMargin == 0 ? 0 : self.topBottomMargin + 1; + + leftRightInset = adjustLeftRightMargin * delta / self.cellSize.height; + topBottomInset = adjustTopBottomMargin * delta / self.cellSize.height; + + NSInteger index = self.realCount == 0 ? 0 : i % self.realCount; + if (index == self.currentSelectIndex) { + [self.scrollView bringSubviewToFront:cell]; + } + } else { + alpha = self.minimumCellAlpha; + + leftRightInset = self.leftRightMargin; + topBottomInset = self.topBottomMargin; + + [self.scrollView sendSubviewToBack:cell]; + } + + if (self.leftRightMargin == 0 && self.topBottomMargin == 0) { + cell.frame = originCellFrame; + }else { + CGFloat scaleX = (self.cellSize.width - leftRightInset * 2) / self.cellSize.width; + CGFloat scaleY = (self.cellSize.height - topBottomInset * 2) / self.cellSize.height; + UIEdgeInsets insets = UIEdgeInsetsMake(topBottomInset - 0.1, leftRightInset, topBottomInset, leftRightInset); + + cell.layer.transform = CATransform3DMakeScale(scaleX, scaleY, 1.0f); + cell.frame = UIEdgeInsetsInsetRect(originCellFrame, insets); + } + + // 透明度渐变 + if (self.isChangeAlpha) { + cell.coverView.alpha = alpha; + } + } + } + break; + default: + break; + } +} + +- (void)addCellAtIndex:(NSInteger)index { + NSParameterAssert(index >= 0 && index < self.visibleCells.count); + + GKCycleScrollViewCell *cell = self.visibleCells[index]; + if ((NSObject *)cell == [NSNull null]) { + cell = [self.dataSource cycleScrollView:self cellForViewAtIndex:index % self.realCount]; + if (cell) { + [self.visibleCells replaceObjectAtIndex:index withObject:cell]; + + cell.tag = index % self.realCount; + [cell setupCellFrame:CGRectMake(0, 0, self.cellSize.width, self.cellSize.height)]; + if (!self.isChangeAlpha) cell.coverView.hidden = YES; + + __weak __typeof(self) weakSelf = self; + cell.didCellClick = ^(NSInteger index) { + [weakSelf handleCellSelectWithIndex:index]; + }; + + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: + cell.frame = CGRectMake(self.cellSize.width * index, 0, self.cellSize.width, self.cellSize.height); + break; + case GKCycleScrollViewScrollDirectionVertical: + cell.frame = CGRectMake(0, self.cellSize.height * index, self.cellSize.width, self.cellSize.height); + break; + default: + break; + } + + if (!cell.superview) { + [self.scrollView addSubview:cell]; + } + } + } +} + +- (void)removeCellAtIndex:(NSInteger)index{ + GKCycleScrollViewCell *cell = self.visibleCells[index]; + if ((NSObject *)cell == [NSNull null]) return; + + [self.reusableCells addObject:cell]; + + if (cell.superview) { + [cell removeFromSuperview]; + } + + [self.visibleCells replaceObjectAtIndex:index withObject:[NSNull null]]; +} + +- (void)handleCellSelectWithIndex:(NSInteger)index { + if ([self.delegate respondsToSelector:@selector(cycleScrollView:didSelectCellAtIndex:)]) { + [self.delegate cycleScrollView:self didSelectCellAtIndex:index]; + } +} + +- (void)handleCellScrollWithIndex:(NSInteger)index { + self.currentSelectIndex = index; + + if (self.pageControl && [self.pageControl respondsToSelector:@selector(setCurrentPage:)]) { + self.pageControl.currentPage = index; + } + + // 获取当前cell + for (NSInteger i = self.visibleRange.location; i < NSMaxRange(self.visibleRange); i++) { + GKCycleScrollViewCell *cell = self.visibleCells[i]; + if ((NSObject *)cell == [NSNull null]) continue; + if (cell.tag == index) { + self.currentCell = cell; + } + } + + if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScrollCellToIndex:)]) { + [self.delegate cycleScrollView:self didScrollCellToIndex:index]; + } +} + +- (void)timerUpdate { + self.timerIndex++; + + // bug fixed:解决反向滑动停止后,可能出现的自动滚动错乱问题 + if (self.timerIndex > self.realCount * 2) { + self.timerIndex = self.realCount * 2; + } + + if (!self.isInfiniteLoop) { + if (self.timerIndex >= self.realCount) { + self.timerIndex = 0; + } + } + + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + [self.scrollView setContentOffset:CGPointMake(self.cellSize.width * self.timerIndex, 0) animated:YES]; + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + [self.scrollView setContentOffset:CGPointMake(0, self.cellSize.height * self.timerIndex) animated:YES]; + } + break; + default: + break; + } +} + +#pragma mark UIScrollView Delegate +- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ + if (self.realCount == 0) return; + if (self.cellSize.width <= 0 || self.cellSize.height <= 0) return; + + NSInteger index = 0; + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + index = (NSInteger)round(self.scrollView.contentOffset.x / self.cellSize.width) % self.realCount; + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + index = (NSInteger)round(self.scrollView.contentOffset.y / self.cellSize.height) % self.realCount; + } + break; + default: + break; + } + + if (self.isInfiniteLoop) { + if (self.realCount > 1) { + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + CGFloat horIndex = scrollView.contentOffset.x / self.cellSize.width; + if (horIndex >= 2 * self.realCount) { + scrollView.contentOffset = CGPointMake(self.cellSize.width * self.realCount, 0); + self.timerIndex = self.realCount; + } + + if (horIndex <= (self.realCount - 1)) { + scrollView.contentOffset = CGPointMake(self.cellSize.width * (2 * self.realCount - 1), 0); + self.timerIndex = 2 * self.realCount - 1; + } + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + NSInteger verIndex = scrollView.contentOffset.y / self.cellSize.height; + + if (verIndex >= 2 * self.realCount) { + scrollView.contentOffset = CGPointMake(0, self.cellSize.height * self.realCount); + self.timerIndex = self.realCount; + } + + if (verIndex <= (self.realCount - 1)) { + scrollView.contentOffset = CGPointMake(0, self.cellSize.height * (2 * self.realCount - 1)); + self.timerIndex = 2 * self.realCount - 1; + } + } + break; + default: + break; + } + }else { + index = 0; + } + } + + [self setupCellsWithContentOffset:scrollView.contentOffset]; + [self updateVisibleCellAppearance]; + + if (index >= 0 && self.currentSelectIndex != index) { + [self handleCellScrollWithIndex:index]; + } + + [self handleScrollViewDidScroll:scrollView]; +} + +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { + [self stopTimer]; + if ([self.delegate respondsToSelector:@selector(cycleScrollView:willBeginDragging:)]) { + [self.delegate cycleScrollView:self willBeginDragging:scrollView]; + } +} + +// 结束拖拽时调用,decelerate是否有减速 +- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { + if (!decelerate) { + [self startTimer]; + } + if ([self.delegate respondsToSelector:@selector(cycleScrollView:didEndDragging:willDecelerate:)]) { + [self.delegate cycleScrollView:self didEndDragging:scrollView willDecelerate:decelerate]; + } +} + +// 结束减速是调用 +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { + [self startTimer]; + if ([self.delegate respondsToSelector:@selector(cycleScrollView:didEndDecelerating:)]) { + [self.delegate cycleScrollView:self didEndDecelerating:scrollView]; + } +} + +- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { + if (self.realCount > 1 && self.isAutoScroll) { + switch (self.direction) { + case GKCycleScrollViewScrollDirectionHorizontal: { + NSInteger index = round(targetContentOffset->x / self.cellSize.width); + self.timerIndex = index; + } + break; + case GKCycleScrollViewScrollDirectionVertical: { + NSInteger index = round(targetContentOffset->y / self.cellSize.height); + self.timerIndex = index; + } + break; + default: + break; + } + } +} + +- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { + [self updateVisibleCellAppearance]; + + if ([self.delegate respondsToSelector:@selector(cycleScrollView:didEndScrollingAnimation:)]) { + [self.delegate cycleScrollView:self didEndScrollingAnimation:scrollView]; + } +} + +- (void)handleScrollViewDidScroll:(UIScrollView *)scrollView { + if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScroll:)]) { + [self.delegate cycleScrollView:self didScroll:scrollView]; + } + + if ([self.delegate respondsToSelector:@selector(cycleScrollView:scrollingFromIndex:toIndex:ratio:)]) { + BOOL isFirstRevirse = NO; // 是否在第一个位置反向滑动 + CGFloat ratio = 0; // 滑动百分比 + if (self.direction == GKCycleScrollViewScrollDirectionHorizontal) { + CGFloat offsetX = scrollView.contentOffset.x; + CGFloat maxW = self.realCount * scrollView.bounds.size.width; + + CGFloat changeOffsetX = self.isInfiniteLoop ? (offsetX - maxW) : offsetX; + if (changeOffsetX < 0) { + changeOffsetX = -changeOffsetX; + isFirstRevirse = YES; + } + ratio = (changeOffsetX / scrollView.bounds.size.width); + }else if (self.direction == GKCycleScrollViewScrollDirectionVertical) { + CGFloat offsetY = scrollView.contentOffset.y; + CGFloat maxW = self.realCount * scrollView.bounds.size.height; + + CGFloat changeOffsetY = self.isInfiniteLoop ? (offsetY - maxW) : offsetY; + if (changeOffsetY < 0) { + changeOffsetY = -changeOffsetY; + isFirstRevirse = YES; + } + ratio = (changeOffsetY / scrollView.bounds.size.height); + } + if (ratio > self.realCount || ratio < 0) return; // 越界,不作处理 + ratio = MAX(0, MIN(self.realCount, ratio)); + NSInteger baseIndex = floor(ratio); + if (baseIndex + 1 > self.realCount) { + // 右边越界了 + baseIndex = 0; + } + CGFloat remainderRatio = ratio - baseIndex; + if (remainderRatio <= 0 || remainderRatio >= 1) return; + NSInteger toIndex = 0; + if (isFirstRevirse) { + baseIndex = self.realCount - 1; + toIndex = 0; + remainderRatio = 1 - remainderRatio; + }else if (baseIndex == self.realCount - 1) { + toIndex = 0; + }else { + toIndex = baseIndex + 1; + } + [self.delegate cycleScrollView:self scrollingFromIndex:baseIndex toIndex:toIndex ratio:remainderRatio]; + } +} + +#pragma mark - 懒加载 +- (UIScrollView *)scrollView { + if (!_scrollView) { + _scrollView = [[UIScrollView alloc] initWithFrame:self.bounds]; + _scrollView.scrollsToTop = NO; + _scrollView.delegate = self; + _scrollView.pagingEnabled = YES; + _scrollView.clipsToBounds = NO; + _scrollView.showsHorizontalScrollIndicator = NO; + _scrollView.showsVerticalScrollIndicator = NO; + } + return _scrollView; +} + +- (NSMutableArray *)visibleCells { + if (!_visibleCells) { + _visibleCells = [NSMutableArray new]; + } + return _visibleCells; +} + +- (NSMutableArray *)reusableCells { + if (!_reusableCells) { + _reusableCells = [NSMutableArray new]; + } + return _reusableCells; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollViewCell.h b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollViewCell.h new file mode 100644 index 0000000..5e9949b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollViewCell.h @@ -0,0 +1,28 @@ +// +// GKCycleScrollViewCell.h +// GKCycleScrollViewDemo +// +// Created by QuintGao on 2019/9/15. +// Copyright © 2019 QuintGao. All rights reserved. +// + +#import + +@class GKCycleScrollViewCell; + +typedef void(^cellClickBlock)(NSInteger index); + +@interface GKCycleScrollViewCell : UIView + +/// 图片视图 +@property (nonatomic, strong) UIImageView *imageView; + +/// 遮罩视图,用于处理透明度渐变 +@property (nonatomic, strong) UIView *coverView; + +/// cell点击回调 +@property (nonatomic, copy) cellClickBlock didCellClick; + +- (void)setupCellFrame:(CGRect)frame; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollViewCell.m b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollViewCell.m new file mode 100644 index 0000000..177242a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKCycleScrollViewCell.m @@ -0,0 +1,54 @@ +// +// GKCycleScrollViewCell.m +// GKCycleScrollViewDemo +// +// Created by QuintGao on 2019/9/15. +// Copyright © 2019 QuintGao. All rights reserved. +// + +#import "GKCycleScrollViewCell.h" + +@implementation GKCycleScrollViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + self.clipsToBounds = YES; + + [self addSubview:self.imageView]; + [self addSubview:self.coverView]; + + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; + [self addGestureRecognizer:tapGesture]; + } + return self; +} + +- (void)handleTapGesture:(UITapGestureRecognizer *)tap { + !self.didCellClick ? : self.didCellClick(self.tag); +} + +- (void)setupCellFrame:(CGRect)frame { + if (CGRectEqualToRect(self.imageView.frame, frame)) return; + + self.imageView.frame = frame; + self.coverView.frame = frame; +} + +#pragma mark - 懒加载 +- (UIImageView *)imageView { + if (!_imageView) { + _imageView = [UIImageView new]; + } + return _imageView; +} + +- (UIView *)coverView { + if (!_coverView) { + _coverView = [UIView new]; + _coverView.backgroundColor = [UIColor blackColor]; + _coverView.userInteractionEnabled = NO; + } + return _coverView; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKPageControl.h b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKPageControl.h new file mode 100644 index 0000000..11959f0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKPageControl.h @@ -0,0 +1,38 @@ +// +// GKPageControl.h +// GKCycleScrollViewDemo +// +// Created by QuintGao on 2019/9/21. +// Copyright © 2019 QuintGao. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSInteger, GKPageControlStyle) { + GKPageControlStyleSystem, // 系统,默认类型 + GKPageControlStyleCycle, // 圆形 + GKPageControlStyleRectangle, // 长方形 + GKPageControlStyleSquare, // 正方形 + GKPageControlStyleSizeDot // 大小点 +}; + +@interface GKPageControl : UIPageControl + +/// pageControl类型 +@property (nonatomic, assign) GKPageControlStyle style; + +/// 以下属性在style为GKPageControlStyleSizeDot时有效 +/// 默认8 长方形默认16 +@property (nonatomic, assign) CGFloat dotWidth; + +/// 默认8 长方形默认2 +@property (nonatomic, assign) CGFloat dotHeight; + +/// 默认8 +@property (nonatomic, assign) CGFloat dotMargin; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKPageControl.m b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKPageControl.m new file mode 100644 index 0000000..8f984c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/GKCycleScrollView/GKPageControl.m @@ -0,0 +1,270 @@ +// +// GKPageControl.m +// GKCycleScrollViewDemo +// +// Created by QuintGao on 2019/9/21. +// Copyright © 2019 QuintGao. All rights reserved. +// + +#import "GKPageControl.h" + +@interface GKPageDotView : UIView + +@property (nonatomic, assign) NSInteger numberOfPages; +@property (nonatomic, assign) NSInteger currentPage; +@property (nonatomic, strong) UIColor *pageIndicatorColor; +@property (nonatomic, strong) UIColor *currentPageIndicatorColor; + +@property (nonatomic, assign) CGFloat dotWidth; +@property (nonatomic, assign) CGFloat dotHeight; +@property (nonatomic, assign) CGFloat dotMargin; + +@end + +@implementation GKPageDotView + +- (void)setCurrentPage:(NSInteger)currentPage { + if (_currentPage == currentPage) return; + + _currentPage = MIN(currentPage, self.numberOfPages - 1); + + for (NSInteger i = 0; i < self.numberOfPages; i++) { + UIView *dotView = self.subviews[i]; + if (currentPage == i) { + dotView.backgroundColor = self.currentPageIndicatorColor; + }else { + dotView.backgroundColor = self.pageIndicatorColor; + } + } + [self layoutSubviews]; +} + +- (void)setNumberOfPages:(NSInteger)numberOfPages { + if (_numberOfPages == numberOfPages) return; + _numberOfPages = MAX(0, numberOfPages); + [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + for (NSInteger i = 0; i < numberOfPages; i++) { + UIView *dotView = [UIView new]; + if (self.currentPage == i) { + dotView.backgroundColor = self.currentPageIndicatorColor; + }else { + dotView.backgroundColor = self.pageIndicatorColor; + } + dotView.layer.cornerRadius = self.dotHeight * 0.5f; + dotView.layer.masksToBounds = YES; + [self addSubview:dotView]; + } + [self layoutSubviews]; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat selectW = 2 * self.dotWidth + self.dotMargin; + + CGFloat viewX = (self.frame.size.width - self.dotWidth * (self.numberOfPages + 1) - self.dotMargin * self.numberOfPages) / 2; + CGFloat viewY = (self.frame.size.height - self.dotHeight) / 2; + + for (NSInteger i = 0; i < self.numberOfPages; i++) { + UIView *dotView = self.subviews[i]; + + if (self.currentPage == i) { + dotView.frame = CGRectMake(viewX, viewY, selectW, self.dotHeight); + viewX += selectW + self.dotMargin; + }else { + dotView.frame = CGRectMake(viewX, viewY, self.dotWidth, self.dotHeight); + viewX += self.dotWidth + self.dotMargin; + } + } +} + +@end + +@interface GKPageControl() + +@property (nonatomic, strong) GKPageDotView *pageDotView; + +@end + +@implementation GKPageControl + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + self.pageIndicatorTintColor = [UIColor grayColor]; + self.currentPageIndicatorTintColor = [UIColor whiteColor]; + + self.dotWidth = 8; + self.dotHeight = 8; + self.dotMargin = 8; + } + return self; +} + +- (void)setStyle:(GKPageControlStyle)style { + _style = style; + + if (style == GKPageControlStyleRectangle) { + self.dotWidth = 20; + self.dotHeight = 4; + }else if (style == GKPageControlStyleSizeDot) { + self.pageDotView.dotWidth = self.dotWidth; + self.pageDotView.dotHeight = self.dotHeight;; + self.pageDotView.dotMargin = self.dotMargin; + [self.pageDotView layoutSubviews]; + } +} + +- (void)setDotWidth:(CGFloat)dotWidth { + _dotWidth = dotWidth; + + if (self.style == GKPageControlStyleSizeDot) { + self.pageDotView.dotWidth = dotWidth; + [self.pageDotView layoutSubviews]; + } +} + +- (void)setDotHeight:(CGFloat)dotHeight { + _dotHeight = dotHeight; + + if (self.style == GKPageControlStyleSizeDot) { + self.pageDotView.dotHeight = dotHeight; + [self.pageDotView layoutSubviews]; + } +} + +- (void)setDotMargin:(CGFloat)dotMargin { + _dotMargin = dotMargin; + + if (self.style == GKPageControlStyleSizeDot) { + self.pageDotView.dotMargin = dotMargin; + [self.pageDotView layoutSubviews]; + } +} + +- (void)setNumberOfPages:(NSInteger)numberOfPages { + [super setNumberOfPages:numberOfPages]; + + if (self.style == GKPageControlStyleSystem) return; + + [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + if (self.style == GKPageControlStyleSizeDot) { + [self addSubview:self.pageDotView]; + self.pageDotView.numberOfPages = numberOfPages; + return; + } + + for (NSInteger i = 0; i < numberOfPages; i++) { + UIView *dotView = [UIView new]; + dotView.tag = [dotView hash] + i; + + if (self.hidesForSinglePage && numberOfPages == 1) { + dotView.hidden = YES; + } + + [self addSubview:dotView]; + } +} + +- (void)setCurrentPage:(NSInteger)currentPage { + [super setCurrentPage:currentPage]; + + if (self.style == GKPageControlStyleSystem) return; + + if (self.style == GKPageControlStyleSizeDot) { + self.pageDotView.currentPage = currentPage; + return; + } + + [super setCurrentPage:currentPage]; + + [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + obj.backgroundColor = currentPage == idx ? self.currentPageIndicatorTintColor : self.pageIndicatorTintColor; + }]; +} + +- (void)setPageIndicatorTintColor:(UIColor *)pageIndicatorTintColor { + [super setPageIndicatorTintColor:pageIndicatorTintColor]; + + if (self.style == GKPageControlStyleSizeDot) { + self.pageDotView.pageIndicatorColor = pageIndicatorTintColor; + } +} + +- (void)setCurrentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor { + [super setCurrentPageIndicatorTintColor:currentPageIndicatorTintColor]; + + if (self.style == GKPageControlStyleSizeDot) { + self.pageDotView.currentPageIndicatorColor = currentPageIndicatorTintColor; + } +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + if (self.style == GKPageControlStyleSystem) return; + + [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (obj.tag == [obj hash] + idx) { + + switch (self.style) { + case GKPageControlStyleCycle: { + CGFloat objW = self.dotWidth; + CGFloat objH = self.dotHeight; + + CGFloat originX = (self.frame.size.width - objW * self.numberOfPages - self.dotMargin * (self.numberOfPages - 1)) / 2; + CGFloat objX = originX + (self.dotMargin + objW) * idx; + CGFloat objy = (self.frame.size.height - objH) / 2; + + obj.frame = CGRectMake(objX, objy, objW, objH); + obj.layer.cornerRadius = objW / 2; + obj.layer.masksToBounds = YES; + } + break; + case GKPageControlStyleRectangle: { + CGFloat objW = self.dotWidth; + CGFloat objH = self.dotHeight; + + CGFloat originX = (self.frame.size.width - objW * self.numberOfPages - self.dotMargin * (self.numberOfPages - 1)) / 2; + CGFloat objX = originX + (self.dotMargin + objW) * idx; + CGFloat objy = (self.frame.size.height - objH) / 2; + + obj.frame = CGRectMake(objX, objy, objW, objH); + } + break; + case GKPageControlStyleSquare: { + CGFloat objW = self.dotWidth; + CGFloat objH = self.dotHeight; + + CGFloat originX = (self.frame.size.width - objW * self.numberOfPages - self.dotMargin * (self.numberOfPages - 1)) / 2; + CGFloat objX = originX + (self.dotMargin + objW) * idx; + CGFloat objy = (self.frame.size.height - objH) / 2; + + obj.frame = CGRectMake(objX, objy, objW, objH); + } + break; + case GKPageControlStyleSizeDot: + obj.frame = self.bounds; + break; + default: + break; + } + }else { + [obj removeFromSuperview]; + } + }]; +} + +#pragma mark - 懒加载 +- (GKPageDotView *)pageDotView { + if (!_pageDotView) { + _pageDotView = [[GKPageDotView alloc] initWithFrame:self.bounds]; + _pageDotView.pageIndicatorColor = self.pageIndicatorTintColor; + _pageDotView.currentPageIndicatorColor = self.currentPageIndicatorTintColor; + _pageDotView.tag = [_pageDotView hash]; + } + return _pageDotView; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboard.h b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboard.h new file mode 100644 index 0000000..f2c9a48 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboard.h @@ -0,0 +1,31 @@ +// +// LVKeyboard.h +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import + +@class LVKeyboard; +@protocol LVKeyboardDelegate + +@optional +/** + * 点击了文字或字符数字按钮 + */ +- (void)keyboard:(LVKeyboard *)keyboard didClickTextButton:(UIButton *)textBtn string:(NSMutableString *)string; +/** + * 点击了删除按钮 + */ +- (void)keyboard:(LVKeyboard *)keyboard didClickDeleteButton:(UIButton *)deleteBtn string:(NSMutableString *)string; + +@end + + +@interface LVKeyboard : UIView + +@property (nonatomic, assign) id delegate; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboard.m b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboard.m new file mode 100644 index 0000000..b1680d1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboard.m @@ -0,0 +1,130 @@ +// +// LVKeyboard.m +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import "LVKeyboard.h" +#import "LVSymbolKeyboard.h" +#import "LVLetterKeyboard.h" +#import "LVNumberKeyboard.h" +#import "LVKeyboardTool.h" +#define LVScreen_Size [UIScreen mainScreen].bounds.size + +@interface LVKeyboard () + +@property (nonatomic, strong) LVLetterKeyboard *letterKeyboard; +@property (nonatomic, strong) LVSymbolKeyboard *symbolKeyboard; +@property (nonatomic, strong) LVNumberKeyboard *numberKeyboard; + +@property (nonatomic, strong) NSMutableString *string; + +@end + +@implementation LVKeyboard + +- (LVLetterKeyboard *)letterKeyboard { + if (!_letterKeyboard) { + _letterKeyboard = [[LVLetterKeyboard alloc] initWithFrame:self.bounds]; + _letterKeyboard.delegate = self; + _letterKeyboard.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + } + return _letterKeyboard; +} + +- (LVSymbolKeyboard *)symbolKeyboard { + if (!_symbolKeyboard) { + _symbolKeyboard = [[LVSymbolKeyboard alloc] initWithFrame:self.bounds]; + _symbolKeyboard.delegate = self; + } + return _symbolKeyboard; +} + +- (LVNumberKeyboard *)numberKeyboard { + if (!_numberKeyboard) { + _numberKeyboard = [[LVNumberKeyboard alloc] initWithFrame:self.bounds]; + _numberKeyboard.delegate = self; + } + return _numberKeyboard; +} + + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.frame = CGRectMake(0, LVScreen_Size.height - 216, LVScreen_Size.width, 216); + self.string = [NSMutableString string]; + self.backgroundColor = [UIColor lightGrayColor]; + [self addSubview:self.letterKeyboard]; + } + return self; +} + +- (void)letterKeyboard:(LVLetterKeyboard *)letter didClickButton:(UIButton *)button { + if ([button.currentTitle isEqualToString:@"符"]) { + [letter removeFromSuperview]; + [self addSubview:self.symbolKeyboard]; + } else if ([button.currentTitle isEqualToString:@"123"]) { + [self.letterKeyboard removeFromSuperview]; + [self addSubview:self.numberKeyboard]; + } else if ([button.currentTitle isEqualToString:@"确定"]) { + [self.nextResponder resignFirstResponder]; + } else { + [self appendString:button]; + } +} + +- (void)symbolKeyboard:(LVSymbolKeyboard *)symbol didClickButton:(UIButton *)button { + if ([button.currentTitle isEqualToString:@"ABC"]) { + [symbol removeFromSuperview]; + [self addSubview:self.letterKeyboard]; + } else if ([button.currentTitle isEqualToString:@"123"]) { + [symbol removeFromSuperview]; + [self addSubview:self.numberKeyboard]; + } else if ([button.currentTitle isEqualToString:@"确定"]) { + [self.nextResponder resignFirstResponder]; + } else { + [self appendString:button]; + } +} + +- (void)numberKeyboard:(LVNumberKeyboard *)number didClickButton:(UIButton *)button { + if ([button.currentTitle isEqualToString:@"符"]) { + [number removeFromSuperview]; + [self addSubview:self.symbolKeyboard]; + } else if ([button.currentTitle isEqualToString:@"ABC"]) { + [number removeFromSuperview]; + [self addSubview:self.letterKeyboard]; + } else if ([button.currentTitle isEqualToString:@"确定"]) { + [self.nextResponder resignFirstResponder]; + } else { + [self appendString:button]; + } +} + +// 删除方法 +- (void)customKeyboardDidClickDeleteButton:(UIButton *)deleteBtn { + + if (self.string.length > 0) { + [self.string deleteCharactersInRange:NSMakeRange(self.string.length - 1, 1)]; + if ([self.delegate respondsToSelector:@selector(keyboard:didClickDeleteButton:string:)]) { + [self.delegate keyboard:self didClickDeleteButton:deleteBtn string:self.string]; + } + } + +} + +- (void)appendString:(UIButton *)button { + + [self.string appendString:button.currentTitle]; + + if ([self.delegate respondsToSelector:@selector(keyboard:didClickTextButton:string:)]) { + [self.delegate keyboard:self didClickTextButton:button string:self.string]; + } +} + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboardTool.h b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboardTool.h new file mode 100644 index 0000000..1a47cc6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboardTool.h @@ -0,0 +1,34 @@ +// +// LVKeyboardTool.h +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// +#import +#import + +@class LVLetterKeyboard, LVNumberKeyboard, LVSymbolKeyboard; +@protocol LVCustomKeyboardDelegate + +@optional + +- (void)letterKeyboard:(LVLetterKeyboard *)letter didClickButton:(UIButton *)button; +- (void)numberKeyboard:(LVNumberKeyboard *)number didClickButton:(UIButton *)button; +- (void)symbolKeyboard:(LVSymbolKeyboard *)symbol didClickButton:(UIButton *)button; + +- (void)customKeyboardDidClickDeleteButton:(UIButton *)deleteBtn; + +@end + + + +@interface LVKeyboardTool : NSObject + +#pragma mark - 添加基础按钮 ++ (UIButton *)setupBasicButtonsWithTitle:(NSString *)title image:(UIImage *)image highImage:(UIImage *)highImage; + +#pragma mark - 添加功能按钮 ++ (UIButton *)setupFunctionButtonWithTitle:(NSString *)title image:(UIImage *)image highImage:(UIImage *)highImage; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboardTool.m b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboardTool.m new file mode 100644 index 0000000..2831521 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVKeyboardTool.m @@ -0,0 +1,40 @@ +// +// LVKeyboardTool.m +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import "LVKeyboardTool.h" + +@implementation LVKeyboardTool + +#pragma mark - 添加基础按钮 ++ (UIButton *)setupBasicButtonsWithTitle:(NSString *)title image:(UIImage *)image highImage:(UIImage *)highImage { + + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.titleLabel.font = [UIFont boldSystemFontOfSize:20]; + [button setTitle:title forState:UIControlStateNormal]; + [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + [button setBackgroundImage:image forState:UIControlStateNormal]; + [button setBackgroundImage:highImage forState:UIControlStateHighlighted]; + + return button; +} + +#pragma mark - 添加功能按钮 ++ (UIButton *)setupFunctionButtonWithTitle:(NSString *)title image:(UIImage *)image highImage:(UIImage *)highImage { + + UIButton *otherBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + otherBtn.titleLabel.font = [UIFont boldSystemFontOfSize:20]; + [otherBtn setTitle:title forState:UIControlStateNormal]; + [otherBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + [otherBtn setBackgroundImage:image forState:UIControlStateNormal]; + [otherBtn setBackgroundImage:highImage forState:UIControlStateHighlighted]; + + return otherBtn; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVLetterKeyboard.h b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVLetterKeyboard.h new file mode 100644 index 0000000..7140f61 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVLetterKeyboard.h @@ -0,0 +1,16 @@ +// +// LVLetterKeyboard.h +// 字母键盘 +// +// Created by PBOC CS on 15/4/9. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import +#import "LVKeyboardTool.h" + +@interface LVLetterKeyboard : UIView + +@property (nonatomic, assign) id delegate; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVLetterKeyboard.m b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVLetterKeyboard.m new file mode 100644 index 0000000..5b4308a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVLetterKeyboard.m @@ -0,0 +1,216 @@ +// +// LVLetterKeyboard.m +// 字母键盘 +// +// Created by PBOC CS on 15/4/9. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import "LVLetterKeyboard.h" +#import "UIView+LVExtension.h" + +@interface LVLetterKeyboard () + +@property (nonatomic, strong) NSArray *lettersArr; + + +@property (nonatomic, strong) NSArray *uppersArr; + +/** 小写字母按钮 */ +@property (nonatomic, strong) NSMutableArray *charBtnsArrM; + +/** 其他按钮 */ +@property (nonatomic, strong) NSMutableArray *tempArrM; + +/** 其他按钮 切换大小写 */ +@property (nonatomic, strong) UIButton *shiftBtn; +/** 其他按钮 删除按钮 */ +@property (nonatomic, strong) UIButton *deleteBtn; +/** 其他按钮 切换至数字键盘 */ +@property (nonatomic, strong) UIButton *switchNumBtn; +/** 其他按钮 切换至符号按钮 */ +@property (nonatomic, strong) UIButton *switchSymbolBtn; +/** 其他按钮 登录 */ +@property (nonatomic, strong) UIButton *loginBtn; + +@property (nonatomic, assign) BOOL isUpper; + +@end + + +@implementation LVLetterKeyboard + +- (NSArray *)lettersArr { + if (!_lettersArr) { + _lettersArr = @[@"q",@"w",@"e",@"r",@"t",@"y",@"u",@"i",@"o",@"p",@"a",@"s",@"d",@"f",@"g",@"h",@"j",@"k",@"l",@"z",@"x",@"c",@"v",@"b",@"n",@"m"]; + } + return _lettersArr; +} + +- (NSArray *)uppersArr { + if (!_uppersArr) { + _uppersArr = @[@"Q",@"W",@"E",@"R",@"T",@"Y",@"U",@"I",@"O",@"P",@"A",@"S",@"D",@"F",@"G",@"H",@"J",@"K",@"L",@"Z",@"X",@"C",@"V",@"B",@"N",@"M"]; + } + return _uppersArr; +} + +- (NSMutableArray *)charBtnsArrM { + if (!_charBtnsArrM) { + _charBtnsArrM = [NSMutableArray array]; + } + return _charBtnsArrM; +} + +- (NSMutableArray *)tempArrM { + if (!_tempArrM) { + _tempArrM = [NSMutableArray array]; + } + return _tempArrM; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.isUpper = YES; + [self setupControls]; + + } + return self; +} + +- (void)setupControls { + + // 添加26个字母按钮 + UIImage *image = [UIImage imageNamed:@"c_charKeyboardButton"]; + image = [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5]; + UIImage *highImage = [UIImage imageNamed:@"c_chaKeyboardButtonSel"]; + highImage = [highImage stretchableImageWithLeftCapWidth:highImage.size.width * 0.5 topCapHeight:highImage.size.height * 0.5]; + + NSUInteger count = self.lettersArr.count; + for (NSUInteger i = 0 ; i < count; i++) { + + UIButton *charBtn = [LVKeyboardTool setupBasicButtonsWithTitle:nil image:image highImage:highImage]; + [charBtn addTarget:self action:@selector(charbuttonClick:) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:charBtn]; + [self.charBtnsArrM addObject:charBtn]; + } + + // 添加其他按钮 切换大小写、删除回退、确定(登录)、 数字、符号 + self.shiftBtn = [LVKeyboardTool setupFunctionButtonWithTitle:nil image:[UIImage imageNamed:@"c_chaKeyboardShiftButton"] highImage:[UIImage imageNamed:@"c_chaKeyboardShiftButtonSel"]]; + self.deleteBtn = [LVKeyboardTool setupFunctionButtonWithTitle:nil image:[UIImage imageNamed:@"c_character_keyboardDeleteButton"] highImage:[UIImage imageNamed:@"c_character_keyboardDeleteButtonSel"]]; + self.loginBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"确定" image:[UIImage imageNamed:@"login_c_character_keyboardLoginButton"] highImage:highImage]; + self.switchNumBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"123" image:[UIImage imageNamed:@"c_character_keyboardSwitchButton"] highImage:[UIImage imageNamed:@"c_character_keyboardSwitchButtonSel"]]; + self.switchSymbolBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"符" image:[UIImage imageNamed:@"c_character_keyboardSwitchButton"] highImage:[UIImage imageNamed:@"c_character_keyboardSwitchButtonSel"]]; + + [self.shiftBtn addTarget:self action:@selector(changeCharacteBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.deleteBtn addTarget:self action:@selector(deleteBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.loginBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.switchNumBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.switchSymbolBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + [self addSubview:self.shiftBtn]; + [self addSubview:self.deleteBtn]; + [self addSubview:self.loginBtn]; + [self addSubview:self.switchNumBtn]; + [self addSubview:self.switchSymbolBtn]; + + [self changeCharacteBtnClick:nil]; + +} + +- (void)charbuttonClick:(UIButton *)charButton { + if ([self.delegate respondsToSelector:@selector(letterKeyboard:didClickButton:)]) { + [self.delegate letterKeyboard:self didClickButton:charButton]; + } +} + +- (void)changeCharacteBtnClick:(UIButton *)shiftBtn { + + [self.tempArrM removeAllObjects]; + NSUInteger count = self.charBtnsArrM.count; + + if (self.isUpper) { + self.tempArrM = [NSMutableArray arrayWithArray:self.lettersArr]; + self.isUpper = NO; + } else { + + self.tempArrM = [NSMutableArray arrayWithArray:self.uppersArr]; + self.isUpper = YES; + } + for (int i = 0; i < count; i++) { + UIButton *charBtn = (UIButton *)self.charBtnsArrM[i]; + NSString *upperTitle = self.tempArrM[i]; + [charBtn setTitle:upperTitle forState:UIControlStateNormal]; + [charBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + } +} + +- (void)deleteBtnClick:(UIButton *)deleteBtn { + if ([self.delegate respondsToSelector:@selector(customKeyboardDidClickDeleteButton:)]) { + [self.delegate customKeyboardDidClickDeleteButton:deleteBtn]; + } + +} + +- (void)functionBtnClick:(UIButton *)switchBtn { + if ([self.delegate respondsToSelector:@selector(letterKeyboard:didClickButton:)]) { + [self.delegate letterKeyboard:self didClickButton:switchBtn]; + } +} + +- (void)layoutSubviews { + + [super layoutSubviews]; + CGFloat topMargin = 15; + CGFloat bottomMargin = SafetyAreaHeight; + CGFloat leftMargin = 3; + CGFloat colMargin = 3; + CGFloat rowMargin = 3; + + // 布局字母按钮 + CGFloat buttonW = (self.width - 2 * leftMargin - 9 * colMargin) / 10; + CGFloat buttonH = (self.height - topMargin - bottomMargin - 3 * rowMargin) / 4; + + NSUInteger count = self.charBtnsArrM.count; + for (NSUInteger i = 0; i < count; i++) { + + UIButton *button = (UIButton *)self.charBtnsArrM[i]; + button.width = buttonW; + button.height = buttonH; + + if (i < 10) { // 第一行 + button.x = (colMargin + buttonW) * i + leftMargin; + button.y = topMargin; + } else if (i < 19) { // 第二行 + button.x = (colMargin + buttonW) * (i - 10) + leftMargin + buttonW / 2 + colMargin; + button.y = topMargin + rowMargin + buttonH; + } else if (i < count) { + button.y = topMargin + 2 * rowMargin + 2 * buttonH; + button.x = (colMargin + buttonW) * (i - 19) + leftMargin + buttonW / 2 + colMargin + buttonW + colMargin; + } + } + + // 布局其他功能按钮 切换大小写、删除回退、确定(登录)、 数字、符号 + CGFloat shiftBtnW = buttonW / 2 + colMargin + buttonW; + CGFloat shiftBtnY = topMargin + 2 * rowMargin + 2 * buttonH; + self.shiftBtn.frame = CGRectMake(leftMargin, shiftBtnY, shiftBtnW, buttonH); + + CGFloat deleteBtnW = buttonW / 2 + buttonW; + self.deleteBtn.frame = CGRectMake(self.width - leftMargin - deleteBtnW, shiftBtnY, deleteBtnW, buttonH); + + CGFloat loginBtnW = 2 * buttonW + colMargin; + CGFloat loginBtnY = self.height - bottomMargin - buttonH; + CGFloat loginBtnX = self.width - leftMargin - loginBtnW; + + self.loginBtn.frame = CGRectMake(loginBtnX, loginBtnY, loginBtnW, buttonH); + + CGFloat switchBtnW = (loginBtnX - 2 * colMargin - leftMargin) / 2; + + self.switchNumBtn.frame = CGRectMake(leftMargin, loginBtnY, switchBtnW, buttonH); + self.switchSymbolBtn.frame = CGRectMake(CGRectGetMaxX(self.switchNumBtn.frame) + colMargin, loginBtnY, switchBtnW, buttonH); +} + + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVNumberKeyboard.h b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVNumberKeyboard.h new file mode 100644 index 0000000..edc6b1b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVNumberKeyboard.h @@ -0,0 +1,15 @@ +// +// LVNumberKeyboard.h +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import +#import "LVKeyboardTool.h" +@interface LVNumberKeyboard : UIView + +@property (nonatomic, assign) id delegate; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVNumberKeyboard.m b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVNumberKeyboard.m new file mode 100644 index 0000000..245280a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVNumberKeyboard.m @@ -0,0 +1,167 @@ +// +// LVNumberKeyboard.m +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import "LVNumberKeyboard.h" +#import "UIView+LVExtension.h" + + +@interface LVNumberKeyboard () + +/** 删除按钮 */ +@property (nonatomic, strong) UIButton *deleteBtn; + +/** 符号按钮 */ +@property (nonatomic, strong) UIButton *switchSymbolBtn; + +/** ABC 文字按钮 */ +@property (nonatomic, strong) UIButton *switchLetterBtn; + + +@end + +@implementation LVNumberKeyboard + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + + UIImage *image = [UIImage imageNamed:@"c_numKeyboardButton"]; + UIImage *highImage = [UIImage imageNamed:@"c_numKeyboardButtonSel"]; + + [self setupNumberButtonsWithImage:image highImage:highImage]; + [self setupBottomButtonsWithImage:highImage highImage:image]; + } + return self; +} + +#pragma mark - 数字按钮 +- (void)setupNumberButtonsWithImage:(UIImage *)image highImage:(UIImage *)highImage { + + NSMutableArray *arrM = [NSMutableArray array]; + [arrM removeAllObjects]; + for (int i = 0 ; i < 10; i++) { +// int j = arc4random_uniform(10); + NSNumber *number = [[NSNumber alloc] initWithInt:i]; + if ([arrM containsObject:number]) { + i--; + continue; + } + [arrM addObject:number]; + } + + for (int i = 0; i < 10; i++) { + + NSNumber *number = arrM[i]; + NSString *title = number.stringValue; + + UIButton *numBtn = [LVKeyboardTool setupBasicButtonsWithTitle:title image:image highImage:highImage]; + [numBtn addTarget:self action:@selector(numBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + [self addSubview:numBtn]; + } +} + +- (void)numBtnClick:(UIButton *)numBtn { + if ([self.delegate respondsToSelector:@selector(numberKeyboard:didClickButton:)]) { + [self.delegate numberKeyboard:self didClickButton:numBtn]; + } +} + + +#pragma mark - 删除按钮可以点击 符号、ABC按钮不能点击 +- (void)setupBottomButtonsWithImage:(UIImage *)image highImage:(UIImage *)highImage { + + self.switchSymbolBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"符" image:image highImage:highImage]; + self.switchLetterBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"ABC" image:image highImage:highImage]; + self.deleteBtn = [LVKeyboardTool setupFunctionButtonWithTitle:nil image:[UIImage imageNamed:@"c_number_keyboardDeleteButton"] highImage:[UIImage imageNamed:@"c_number_keyboardDeleteButtonSel"]]; + + // 切换至字符键盘切换至ABC键盘 + [self.switchSymbolBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.switchLetterBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.deleteBtn addTarget:self action:@selector(deleteBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + [self addSubview:self.switchSymbolBtn]; + [self addSubview:self.switchLetterBtn]; + [self addSubview:self.deleteBtn]; + +} + +#pragma mark - 切换键盘 +- (void)functionBtnClick:(UIButton *)switchBtn { + if ([self.delegate respondsToSelector:@selector(numberKeyboard:didClickButton:)]) { + [self.delegate numberKeyboard:self didClickButton:switchBtn]; + } +} + +#pragma mark - 点击删除按钮 +- (void)deleteBtnClick:(UIButton *)deleteBtn { + if ([self.delegate respondsToSelector:@selector(customKeyboardDidClickDeleteButton:)]) { + [self.delegate customKeyboardDidClickDeleteButton:deleteBtn]; + } +} + +- (void)layoutSubviews { + + [super layoutSubviews]; + + CGFloat topMargin = 15; + CGFloat bottomMargin = SafetyAreaHeight; + CGFloat leftMargin = 3; + CGFloat colMargin = 3; + CGFloat rowMargin = 3; + + CGFloat topBtnW = (self.width - 2 * leftMargin - 2 * colMargin) / 3; + CGFloat topBtnH = (self.height - topMargin - bottomMargin - 3 * rowMargin) / 4; + + NSUInteger count = self.subviews.count; + + // 布局数字按钮 + for (NSUInteger i = 0; i < count; i++) { + if (i == 0 ) { // 0 + UIButton *buttonZero = self.subviews[i]; + buttonZero.height = topBtnH; + buttonZero.width = topBtnW; + buttonZero.centerX = self.centerX; + buttonZero.centerY = self.height - bottomMargin - buttonZero.height * 0.5; + + // 符号、文字及删除按钮的位置 + self.deleteBtn.x = CGRectGetMaxX(buttonZero.frame) + colMargin; + self.deleteBtn.y = buttonZero.y; + self.deleteBtn.width = buttonZero.width; + self.deleteBtn.height = buttonZero.height; + + self.switchSymbolBtn.x = leftMargin; + self.switchSymbolBtn.y = buttonZero.y; + self.switchSymbolBtn.width = buttonZero.width / 2 - colMargin / 2; + self.switchSymbolBtn.height = buttonZero.height; + + self.switchLetterBtn.x = CGRectGetMaxX(self.switchSymbolBtn.frame) + colMargin; + self.switchLetterBtn.y = buttonZero.y; + self.switchLetterBtn.width = self.switchSymbolBtn.width; + self.switchLetterBtn.height = self.switchSymbolBtn.height; + + } + if (i > 0 && i < 10) { // 0 ~ 9 + + UIButton *topButton = self.subviews[i]; + CGFloat row = (i - 1) / 3; + CGFloat col = (i - 1) % 3; + + topButton.x = leftMargin + col * (topBtnW + colMargin); + topButton.y = topMargin + row * (topBtnH + rowMargin); + topButton.width = topBtnW; + topButton.height = topBtnH; + } + + } + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVSymbolKeyboard.h b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVSymbolKeyboard.h new file mode 100644 index 0000000..3817789 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVSymbolKeyboard.h @@ -0,0 +1,16 @@ +// +// LVSymbolKeyboard.h +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import +#import "LVKeyboardTool.h" + +@interface LVSymbolKeyboard : UIView + +@property (nonatomic, assign) id delegate; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVSymbolKeyboard.m b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVSymbolKeyboard.m new file mode 100644 index 0000000..59220e7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/LVSymbolKeyboard.m @@ -0,0 +1,139 @@ +// +// LVSymbolKeyboard.m +// 字母键盘 +// +// Created by PBOC CS on 15/4/11. +// Copyright (c) 2015年 liuchunlao. All rights reserved. +// + +#import "LVSymbolKeyboard.h" +#import "UIView+LVExtension.h" + +@interface LVSymbolKeyboard () + +@property (nonatomic, copy) NSString *title; +@property (nonatomic, strong) NSMutableArray *symbolBtnArrM; + +/** 其他按钮 删除按钮 */ +@property (nonatomic, strong) UIButton *deleteBtn; +/** 其他按钮 切换至数字键盘 */ +@property (nonatomic, strong) UIButton *switchNumBtn; +/** 其他按钮 切换至符号按钮 */ +@property (nonatomic, strong) UIButton *switchLetterBtn; +/** 其他按钮 登录 */ +@property (nonatomic, strong) UIButton *loginBtn; + +@end +@implementation LVSymbolKeyboard + +- (NSMutableArray *)symbolBtnArrM { + if (!_symbolBtnArrM) { + _symbolBtnArrM = [NSMutableArray array]; + } + return _symbolBtnArrM; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.title = @"~`!@#$%^&*()_-+={}[]|\\:;\"'<,>.?/"; + [self setupControls]; + } + return self; +} + +// 添加子控件 +- (void)setupControls { + + UIImage *image = [UIImage imageNamed:@"c_symbolKeyboardButton"]; + UIImage *highImage = [UIImage imageNamed:@"c_symbolKeyboardButtonSel"]; + + NSUInteger length = self.title.length; + // 字母按钮 + for (NSUInteger i = 0; i < length; i++) { + unichar c = [self.title characterAtIndex:i]; + NSString *text = [NSString stringWithFormat:@"%c", c]; + UIButton *symbolBtn = [LVKeyboardTool setupBasicButtonsWithTitle:text image:image highImage:highImage]; + [self addSubview:symbolBtn]; + + [symbolBtn addTarget:self action:@selector(symbolBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + [self.symbolBtnArrM addObject:symbolBtn]; + } + + // 其他按钮 123、ABC、回退、login + self.deleteBtn = [LVKeyboardTool setupFunctionButtonWithTitle:nil image:[UIImage imageNamed:@"c_symbol_keyboardDeleteButton"] highImage:[UIImage imageNamed:@"c_symbol_keyboardDeleteButtonSel"]]; + self.loginBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"确定" image:[UIImage imageNamed:@"login_c_symbol_keyboardLoginButton"] highImage:highImage]; + self.switchNumBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"123" image:[UIImage imageNamed:@"c_symbol_keyboardSwitchButton"] highImage:[UIImage imageNamed:@"c_symbol_keyboardSwitchButtonSel"]]; + self.switchLetterBtn = [LVKeyboardTool setupFunctionButtonWithTitle:@"ABC" image:[UIImage imageNamed:@"c_character_keyboardSwitchButton"] highImage:[UIImage imageNamed:@"c_character_keyboardSwitchButtonSel"]]; + + [self.deleteBtn addTarget:self action:@selector(deleteBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.loginBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.switchNumBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + [self.switchLetterBtn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + [self addSubview:self.deleteBtn]; + [self addSubview:self.loginBtn]; + [self addSubview:self.switchNumBtn]; + [self addSubview:self.switchLetterBtn]; + +} + +// 符号按钮 +- (void)symbolBtnClick:(UIButton *)symbolBtn { + if ([self.delegate respondsToSelector:@selector(symbolKeyboard:didClickButton:)]) { + [self.delegate symbolKeyboard:self didClickButton:symbolBtn]; + } +} + +- (void)deleteBtnClick:(UIButton *)deleteBtn { + if ([self.delegate respondsToSelector:@selector(customKeyboardDidClickDeleteButton:)]) { + [self.delegate customKeyboardDidClickDeleteButton:deleteBtn]; + } +} + +- (void)functionBtnClick:(UIButton *)switchBtn { + if ([self.delegate respondsToSelector:@selector(symbolKeyboard:didClickButton:)]) { + [self.delegate symbolKeyboard:self didClickButton:switchBtn]; + } +} + + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat topMargin = 15; + CGFloat bottomMargin = SafetyAreaHeight; + CGFloat leftMargin = 3; + CGFloat colMargin = 3; + CGFloat rowMargin = 3; + + CGFloat buttonH = (self.height - (topMargin + bottomMargin + 3 * rowMargin)) / 4; + CGFloat buttonW = (self.width - 9 * colMargin - leftMargin * 2) / 10; + + + NSUInteger count = self.symbolBtnArrM.count; + for (NSUInteger i = 0; i < count; i++) { + + UIButton *symbolBtn = (UIButton *)self.symbolBtnArrM[i]; + NSUInteger row = i / 10; + NSUInteger col = i % 10; + + symbolBtn.x = leftMargin + (buttonW + colMargin) * col; + symbolBtn.y = topMargin + (buttonH + rowMargin) * row; + symbolBtn.width = buttonW; + symbolBtn.height = buttonH; + } + + CGFloat otherBtnW = 2 * buttonW + colMargin; + CGFloat otherBtnY = self.height - bottomMargin - buttonH; + self.loginBtn.frame = CGRectMake(self.width - leftMargin - otherBtnW, otherBtnY, otherBtnW, buttonH); + self.deleteBtn.frame = CGRectMake(self.width - leftMargin - colMargin - 2 * otherBtnW, otherBtnY, otherBtnW, buttonH); + self.switchLetterBtn.frame = CGRectMake(self.width - leftMargin - 2 * colMargin - 3 * otherBtnW, otherBtnY, otherBtnW, buttonH); + self.switchNumBtn.frame = CGRectMake(self.width - leftMargin - 3 * colMargin - 4 * otherBtnW, otherBtnY, otherBtnW, buttonH); +} + + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/UIView+LVExtension.h b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/UIView+LVExtension.h new file mode 100755 index 0000000..4acf4b2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/UIView+LVExtension.h @@ -0,0 +1,20 @@ +// +// UIView+LVExtension.h +// 黑马微博2期 +// +// Created by apple on 14-10-7. +// Copyright (c) 2014年 heima. All rights reserved. +// + +#import + +@interface UIView (LVExtension) +@property (nonatomic, assign) CGFloat x; +@property (nonatomic, assign) CGFloat y; +@property (nonatomic, assign) CGFloat width; +@property (nonatomic, assign) CGFloat height; +@property (nonatomic, assign) CGFloat centerX; +@property (nonatomic, assign) CGFloat centerY; +@property (nonatomic, assign) CGSize size; +@property (nonatomic, assign) CGPoint origin; +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/UIView+LVExtension.m b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/UIView+LVExtension.m new file mode 100755 index 0000000..19c8b8f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LVKeyboard/UIView+LVExtension.m @@ -0,0 +1,108 @@ +// +// UIView+LVExtension.m +// 黑马微博2期 +// +// Created by apple on 14-10-7. +// Copyright (c) 2014年 heima. All rights reserved. +// + +#import "UIView+LVExtension.h" + +@implementation UIView (LVExtension) + +- (void)setX:(CGFloat)x +{ + CGRect frame = self.frame; + frame.origin.x = x; + self.frame = frame; +} + +- (void)setY:(CGFloat)y +{ + CGRect frame = self.frame; + frame.origin.y = y; + self.frame = frame; +} + +- (CGFloat)x +{ + return self.frame.origin.x; +} + +- (CGFloat)y +{ + return self.frame.origin.y; +} + +- (void)setCenterX:(CGFloat)centerX +{ + CGPoint center = self.center; + center.x = centerX; + self.center = center; +} + +- (CGFloat)centerX +{ + return self.center.x; +} + +- (void)setCenterY:(CGFloat)centerY +{ + CGPoint center = self.center; + center.y = centerY; + self.center = center; +} + +- (CGFloat)centerY +{ + return self.center.y; +} + +- (void)setWidth:(CGFloat)width +{ + CGRect frame = self.frame; + frame.size.width = width; + self.frame = frame; +} + +- (void)setHeight:(CGFloat)height +{ + CGRect frame = self.frame; + frame.size.height = height; + self.frame = frame; +} + +- (CGFloat)height +{ + return self.frame.size.height; +} + +- (CGFloat)width +{ + return self.frame.size.width; +} + +- (void)setSize:(CGSize)size +{ + CGRect frame = self.frame; + frame.size = size; + self.frame = frame; +} + +- (CGSize)size +{ + return self.frame.size; +} + +- (void)setOrigin:(CGPoint)origin +{ + CGRect frame = self.frame; + frame.origin = origin; + self.frame = frame; +} + +- (CGPoint)origin +{ + return self.frame.origin; +} +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXScrollContentView.h b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXScrollContentView.h new file mode 100644 index 0000000..c433ec5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXScrollContentView.h @@ -0,0 +1,60 @@ +// +// LXScrollContentView.h +// LXScrollContentView +// +// Created by 刘行 on 2017/3/23. +// Copyright © 2017年 刘行. All rights reserved. +// + +#import + +@class LXScrollContentView; + +@protocol LXScrollContentViewDataSource + +- (UIEdgeInsets)scrollContentView:(LXScrollContentView *)scrollContentView childVcContentInsetAtIndex:(NSInteger)index; + +@required + +- (NSInteger)numberOfchildVcsInScrollContentView:(LXScrollContentView *)scrollContentView; + +- (UIViewController *)scrollContentView:(LXScrollContentView *)scrollContentView childVcAtIndex:(NSInteger)index; + +- (UIViewController *)parentVcInScrollContentView:(LXScrollContentView *)scrollContentView; + +@end + +@protocol LXScrollContentViewDelegate + +@optional + +- (void)contentViewDidScroll:(LXScrollContentView *)contentView + fromIndex:(NSInteger)fromIndex + toIndex:(NSInteger)toIndex + progress:(float)progress; + +- (void)contentViewDidEndDecelerating:(LXScrollContentView *)contentView + startIndex:(NSInteger)startIndex + endIndex:(NSInteger)endIndex; + +- (void)childVcViewWillAppearAtIndex:(NSUInteger)index; + +- (void)childVcViewDidDisappearAtIndex:(NSUInteger)index; + +@end + +@interface LXScrollContentView : UIView + +- (void)reloadData; + +@property (nonatomic, weak) id dataSource; + +@property (nonatomic, weak) id delegate; + +@property (nonatomic, assign) NSUInteger currentIndex; + +@property (nonatomic, assign) BOOL preloadNearVcs;//提前加载当前vc + +@property (nonatomic, weak, readonly) UICollectionView *collectionView; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXScrollContentView.m b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXScrollContentView.m new file mode 100644 index 0000000..20f758a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXScrollContentView.m @@ -0,0 +1,288 @@ +// +// LXScrollContentView.m +// LXScrollContentView +// +// Created by 刘行 on 2017/3/23. +// Copyright © 2017年 刘行. All rights reserved. +// + +#import "LXScrollContentView.h" + +static NSString *kContentCellID = @"kContentCellID"; + +@interface LXScrollContentView() +{ + CGFloat _startOffsetX; +} + +@property (nonatomic, strong) NSMutableDictionary *childVcDicts; + +@property (nonatomic, assign) NSInteger childVcsCount; + +@property (nonatomic, assign) BOOL isForbidScrollDelegate; + +@property (nonatomic, weak) UIViewController *parentVC; + +@property (nonatomic, weak, readwrite) UICollectionView *collectionView; + +@end + +@implementation LXScrollContentView + +- (void)awakeFromNib { + [super awakeFromNib]; + [self setup]; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self setup]; + } + return self; +} + +- (void)setup { + self.backgroundColor = [UIColor whiteColor]; +} + +- (void)layoutSubviews{ + [super layoutSubviews]; + self.collectionView.frame = self.bounds; + UICollectionViewFlowLayout *flowLayout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout; + flowLayout.itemSize = self.bounds.size; +} + +#pragma mark - lazy init + +- (NSMutableDictionary *)childVcDicts { + if (!_childVcDicts) { + _childVcDicts = [[NSMutableDictionary alloc] init]; + } + return _childVcDicts; +} + +- (UICollectionView *)collectionView { + if (!_collectionView) { + UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; + flowLayout.minimumLineSpacing = 0; + flowLayout.minimumInteritemSpacing = 0; + flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout]; + collectionView.scrollsToTop = NO; + collectionView.backgroundColor = [UIColor clearColor]; + collectionView.showsHorizontalScrollIndicator = NO; + collectionView.pagingEnabled = YES; + collectionView.bounces = NO; + collectionView.delegate = self; + collectionView.dataSource = self; + [collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:kContentCellID]; + + if (@available(iOS 11.0, *)) { + collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + + [self addSubview:collectionView]; + _collectionView = collectionView; + } + return _collectionView; +} + + +#pragma mark - UICollectionViewDataSource + +- (NSInteger)collectionView:(UICollectionView *)collectionView + numberOfItemsInSection:(NSInteger)section { + return self.childVcsCount; +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + cellForItemAtIndexPath:(NSIndexPath *)indexPath { + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kContentCellID forIndexPath:indexPath]; + cell.backgroundColor = [UIColor clearColor]; + cell.contentView.backgroundColor = [UIColor clearColor]; + return cell; +} + + +#pragma mark - UICollectionViewDelegate + +- (void)collectionView:(UICollectionView *)collectionView + willDisplayCell:(UICollectionViewCell *)cell + forItemAtIndexPath:(NSIndexPath *)indexPath { + [cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + UIViewController *childVc = [self fetchChildVcAtIndex:indexPath.row]; + if (childVc) { + if (!childVc.parentViewController) { + [self.parentVC addChildViewController:childVc]; + } + [cell.contentView addSubview:childVc.view]; + } + + if (self.delegate && [self.delegate respondsToSelector:@selector(childVcViewWillAppearAtIndex:)]) { + [self.delegate childVcViewWillAppearAtIndex:indexPath.row]; + } + + if (!self.preloadNearVcs) return; + [self preloadNearVcsAtIndex:indexPath.row]; +} + +- (void)collectionView:(UICollectionView *)collectionView + didEndDisplayingCell:(UICollectionViewCell *)cell + forItemAtIndexPath:(NSIndexPath *)indexPath { + if (self.delegate && [self.delegate respondsToSelector:@selector(childVcViewDidDisappearAtIndex:)]) { + [self.delegate childVcViewDidDisappearAtIndex:indexPath.row]; + } + UIViewController *childVc = [self fetchChildVcAtIndex:indexPath.row]; + if (childVc == nil) return; + + if (childVc.parentViewController == self.parentVC) { + [childVc removeFromParentViewController]; + } + if (childVc.view.superview) { + [childVc.view removeFromSuperview]; + } +} + +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { + if (scrollView != self.collectionView) return; + + self.isForbidScrollDelegate = NO; + _startOffsetX = scrollView.contentOffset.x; +} + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + if (scrollView != self.collectionView) return; + if (self.isForbidScrollDelegate) return; + + CGFloat endOffsetX = scrollView.contentOffset.x; + NSInteger fromIndex = floor(_startOffsetX / scrollView.frame.size.width); + CGFloat progress; + NSInteger toIndex; + if (_startOffsetX < endOffsetX) {//左滑 + progress = (endOffsetX - _startOffsetX) / scrollView.frame.size.width; + toIndex = fromIndex + 1; + if (toIndex > self.childVcsCount - 1) { + toIndex = self.childVcsCount - 1; + } + } else if (_startOffsetX == endOffsetX){ + progress = 0; + toIndex = fromIndex; + } else { + progress = (_startOffsetX - endOffsetX) / scrollView.frame.size.width; + toIndex = fromIndex - 1; + if (toIndex < 0) { + toIndex = 0; + } + } + if (self.delegate && [self.delegate respondsToSelector:@selector(contentViewDidScroll:fromIndex:toIndex:progress:)]) { + [self.delegate contentViewDidScroll:self fromIndex:fromIndex toIndex:toIndex progress:progress]; + } +} + +- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { + if (!decelerate) { + [self scrollViewDidEndScroll:scrollView]; + } +} + +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { + [self scrollViewDidEndScroll:scrollView]; +} + +- (void)scrollViewDidEndScroll:(UIScrollView *)scrollView { + if (scrollView != self.collectionView) return; + + CGFloat endOffsetX = scrollView.contentOffset.x; + NSInteger startIndex = floor(_startOffsetX / scrollView.frame.size.width); + NSInteger endIndex = floor(endOffsetX / scrollView.frame.size.width); + _currentIndex = endIndex; + if (self.delegate && [self.delegate respondsToSelector:@selector(contentViewDidEndDecelerating:startIndex:endIndex:)]) { + [self.delegate contentViewDidEndDecelerating:self startIndex:startIndex endIndex:endIndex]; + } +} + +#pragma mark - public methods + +- (void)reloadData { + if (self.dataSource && [self.dataSource respondsToSelector:@selector(numberOfchildVcsInScrollContentView:)]) { + self.childVcsCount = [self.dataSource numberOfchildVcsInScrollContentView:self]; + } + + if (self.dataSource && [self.dataSource respondsToSelector:@selector(parentVcInScrollContentView:)]) { + self.parentVC = [self.dataSource parentVcInScrollContentView:self]; + } + + NSArray *childVcs = self.childVcDicts.allValues; + for (UIViewController *childVc in childVcs) { + if (childVc.parentViewController == self.parentVC) { + [childVc removeFromParentViewController]; + } + if (childVc.view.superview) { + [childVc.view removeFromSuperview]; + } + } + [self.childVcDicts removeAllObjects]; + + [self.collectionView reloadData]; +} + + +- (void)setCurrentIndex:(NSUInteger)currentIndex { + if (currentIndex < 0 + || currentIndex > self.childVcsCount - 1 + || self.childVcsCount <= 0) { + return; + } + _currentIndex = currentIndex; + self.isForbidScrollDelegate = YES; + dispatch_async(dispatch_get_main_queue(), ^{ + NSIndexPath *currentIndexPath = [NSIndexPath indexPathForRow:currentIndex inSection:0]; + [self.collectionView scrollToItemAtIndexPath:currentIndexPath + atScrollPosition:UICollectionViewScrollPositionNone + animated:NO]; + }); +} + +- (void)setDataSource:(id)dataSource { + _dataSource = dataSource; + [self reloadData]; +} + +#pragma mark - private methods + +- (UIViewController *)fetchChildVcAtIndex:(NSUInteger)index { + UIViewController *childVc = self.childVcDicts[@(index)]; + if (childVc) return childVc; + + if (self.dataSource && [self.dataSource respondsToSelector:@selector(scrollContentView:childVcAtIndex:)]) { + childVc = [self.dataSource scrollContentView:self childVcAtIndex:index]; + if (childVc) { + childVc.view.frame = [self childVcFrameAtIndex:index]; + self.childVcDicts[@(index)] = childVc; + return childVc; + } + } + return nil; +} + +- (CGRect)childVcFrameAtIndex:(NSUInteger)index { + CGRect frame = self.bounds; + if (self.dataSource && [self.dataSource respondsToSelector:@selector(scrollContentView:childVcContentInsetAtIndex:)]) { + UIEdgeInsets inset = [self.dataSource scrollContentView:self childVcContentInsetAtIndex:index]; + CGFloat weight = MAX(0, self.bounds.size.width - inset.left - inset.right); + CGFloat height = MAX(0, self.bounds.size.height - inset.top - inset.bottom); + frame = CGRectMake(inset.left, inset.top, weight, height); + } + return frame; +} + +- (void)preloadNearVcsAtIndex:(NSUInteger)index { + if (index < self.childVcsCount - 1) { + [self fetchChildVcAtIndex:index + 1]; + } + if (index > 1) { + [self fetchChildVcAtIndex:index - 1]; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.h b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.h new file mode 100644 index 0000000..60bd402 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.h @@ -0,0 +1,103 @@ +// +// LXSegmentTitleView.h +// LXScrollContentView +// +// Created by 刘行 on 2017/3/31. +// Copyright © 2017年 刘行. All rights reserved. +// + +#import + +@class LXSegmentTitleView; + +@protocol LXSegmentTitleViewDelegate + +@optional + +- (void)segmentTitleView:(LXSegmentTitleView *)segmentView + selectedIndex:(NSInteger)selectedIndex + lastSelectedIndex:(NSInteger)lastSelectedIndex; + +@end + +@protocol LXSegmentTitleViewDataSource + +@optional + +- (NSArray *)segmentTitlesOfSegmentTitleView:(LXSegmentTitleView *)segmentView; + +@end + +@interface LXSegmentTitleView : UIView + +- (void)reloadData; + +@property (nonatomic, weak) id delegate; + +@property (nonatomic, weak) id dataSource; + +/** + 文字未选中颜色,默认black + */ +@property (nonatomic, strong) UIColor *titleNormalColor; + +/** + 文字选中和下方滚动条颜色,默认red + */ +@property (nonatomic, strong) UIColor *titleSelectedColor; + +/** +按钮未选中颜色,默认black + */ +@property (nonatomic, strong) UIColor *btnNormalColor; + +/** + 按钮选中和下方滚动条颜色,默认red + */ +@property (nonatomic, strong) UIColor *btnSelectedColor; + +/** + 第几个标题处于选中状态,默认第0个 + */ +@property (nonatomic, assign) NSInteger selectedIndex; + + +/** + 标题font,默认[UIFont systemFontOfSize:14.f] + */ +@property (nonatomic, strong) UIFont *titleFont; + + +/** + 下方指示条颜色,默认red + */ +@property (nonatomic, strong) UIColor *indicatorColor; + +/** + 下方滚动指示条高度,默认2.f + */ +@property (nonatomic, assign) CGFloat indicatorHeight; + + +/** + 下方指示条延伸宽度,默认5.f + */ +@property (nonatomic, assign) CGFloat indicatorExtraW; + + +/** + 下方指示条距离底部距离,默认为0 + */ +@property (nonatomic, assign) CGFloat indicatorBottomMargin; + +/** + 每个item之间最小间隔,默认25.f + */ +@property (nonatomic, assign) CGFloat itemMinMargin; + +/** + 选项卡标题数组 + */ +@property (nonatomic, copy) NSArray *segmentTitles; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.m b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.m new file mode 100644 index 0000000..f29e1e1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.m @@ -0,0 +1,262 @@ +// +// LXSegmentTitleView.m +// LXScrollContentView +// +// Created by 刘行 on 2017/3/31. +// Copyright © 2017年 刘行. All rights reserved. +// + +#import "LXSegmentTitleView.h" + +@interface LXSegmentTitleView() + +@property (nonatomic, weak) UIScrollView *scrollView; + +@property (nonatomic, strong) NSMutableArray *itemButtons; + +@property (nonatomic, weak) UIView *indicatorView; + +@end + +@implementation LXSegmentTitleView + +- (void)awakeFromNib { + [super awakeFromNib]; + [self setupData]; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self setupData]; + } + return self; +} + +- (void)setupData { + self.titleNormalColor = [UIColor blackColor]; + self.titleSelectedColor = [UIColor redColor]; + self.selectedIndex = 0; + self.titleFont = [UIFont systemFontOfSize:14.f]; + self.indicatorColor = [UIColor redColor]; + self.indicatorHeight = 2.f; + self.indicatorExtraW = 5.f; + self.indicatorBottomMargin = 0; + self.itemMinMargin = 25.f; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + self.scrollView.frame = self.bounds; + if (self.itemButtons.count == 0) { + return; + } + CGFloat totalBtnW = 0; + for (UIButton *btn in self.itemButtons) { + [btn sizeToFit]; + totalBtnW += btn.frame.size.width; + } + + CGFloat itemMarginW = (self.scrollView.frame.size.width - totalBtnW) / (self.itemButtons.count + 1); +// if (itemMarginW < self.itemMinMargin) { +// itemMarginW = self.itemMinMargin; +// } + itemMarginW = self.itemMinMargin; + CGFloat lastX = itemMarginW; + for (UIButton *btn in self.itemButtons) { + [btn sizeToFit]; + btn.frame = CGRectMake(lastX, 5, btn.frame.size.width + 20, self.scrollView.frame.size.height - 10); + lastX += btn.frame.size.width + itemMarginW; + } + self.scrollView.contentSize = CGSizeMake(lastX, self.scrollView.frame.size.height); + [self setSelectedIndicatorFrame:NO]; +} + +- (void)setSelectedIndicatorFrame:(BOOL)animated { + UIButton *selectedBtn = self.itemButtons[self.selectedIndex]; + [UIView animateWithDuration:(animated? 0.02 : 0) delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ + self.indicatorView.frame = CGRectMake(selectedBtn.frame.origin.x - self.indicatorExtraW,self.scrollView.bottom - self.indicatorHeight, self.indicatorExtraW, self.indicatorHeight); + self.indicatorView.centerX = selectedBtn.centerX; + } completion:^(BOOL finished) { + [self scrollRectToVisibleCenterAnimated:animated]; + }]; +} + +- (void)scrollRectToVisibleCenterAnimated:(BOOL)animated { + UIButton *selectedBtn = self.itemButtons[self.selectedIndex]; + CGRect centeredRect = CGRectMake(selectedBtn.center.x - self.scrollView.frame.size.width / 2, 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height); + [self.scrollView scrollRectToVisible:centeredRect animated:animated]; +} + +#pragma mark - public + +- (void)reloadData { + + if (self.dataSource && [self.dataSource respondsToSelector:@selector(segmentTitlesOfSegmentTitleView:)]) { + NSArray *segmentTitles = [self.dataSource segmentTitlesOfSegmentTitleView:self]; + self.segmentTitles = segmentTitles; + } +} + +#pragma mark - getter + +- (UIScrollView *)scrollView { + if (!_scrollView) { + UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; + scrollView.scrollsToTop = NO; + scrollView.showsHorizontalScrollIndicator = NO; + scrollView.showsVerticalScrollIndicator = NO; + [self addSubview:scrollView]; + _scrollView = scrollView; + } + return _scrollView; +} + +- (UIView *)indicatorView { + if (!_indicatorView) { + UIView *indicatorView = [[UIView alloc] initWithFrame:CGRectZero]; + [self.scrollView addSubview:indicatorView]; + _indicatorView = indicatorView; + } + return _indicatorView; +} + +- (NSMutableArray *)itemButtons { + if (!_itemButtons) { + _itemButtons = [[NSMutableArray alloc] init]; + } + return _itemButtons; +} + + +#pragma mark - setter + +- (void)setSegmentTitles:(NSArray *)segmentTitles +{ + _segmentTitles = [segmentTitles copy]; + [self.itemButtons makeObjectsPerformSelector:@selector(removeFromSuperview)]; + self.itemButtons = nil; + for (NSString *title in segmentTitles) { + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; + if (self.selectedIndex == self.itemButtons.count) { + btn.selected = YES; + } + btn.tag = 888 + self.itemButtons.count; + [btn setTitle:title forState:UIControlStateNormal]; + [btn setTitleColor:self.titleNormalColor forState:UIControlStateNormal]; + [btn setTitleColor:self.titleSelectedColor forState:UIControlStateSelected]; + [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; + [btn setBackgroundImage:[UIImage imageWithColor:self.btnNormalColor] forState:UIControlStateNormal]; + [btn setBackgroundImage:[UIImage imageWithColor:self.btnSelectedColor] forState:UIControlStateSelected]; + btn.layer.cornerRadius = 12.0f; + btn.layer.masksToBounds = true; + btn.titleLabel.font = self.titleFont; + [self.scrollView addSubview:btn]; + [self.itemButtons addObject:btn]; + } + [self setNeedsLayout]; + [self layoutIfNeeded]; +} + + +- (void)setSelectedIndex:(NSInteger)selectedIndex { + if (_selectedIndex == selectedIndex + || selectedIndex < 0 + || selectedIndex > self.itemButtons.count - 1 + || self.itemButtons.count <= 0) { + return; + } + UIButton *btn = [self.scrollView viewWithTag:_selectedIndex + 888]; + btn.selected = NO; + _selectedIndex = selectedIndex; + UIButton *selectedBtn = [self.scrollView viewWithTag:_selectedIndex + 888]; + selectedBtn.selected = YES; + [self setSelectedIndicatorFrame:YES]; +} + +- (void)setTitleNormalColor:(UIColor *)titleNormalColor { + _titleNormalColor = titleNormalColor; + for (UIButton *btn in self.itemButtons) { + [btn setTitleColor:titleNormalColor forState:UIControlStateNormal]; + } +} + +- (void)setTitleSelectedColor:(UIColor *)titleSelectedColor { + _titleSelectedColor = titleSelectedColor; + for (UIButton *btn in self.itemButtons) { + [btn setTitleColor:titleSelectedColor forState:UIControlStateSelected]; + + } +} + +- (void)setBtnNormalColor:(UIColor *)btnNormalColor { + + _btnNormalColor = btnNormalColor; + for (UIButton *btn in self.itemButtons) { + [btn setBackgroundImage:[UIImage imageWithColor:btnNormalColor] forState:UIControlStateNormal]; + } +} + + +- (void)setBtnSelectedColor:(UIColor *)btnSelectedColor { + + _btnSelectedColor = btnSelectedColor; + for (UIButton *btn in self.itemButtons) { + [btn setBackgroundImage:[UIImage imageWithColor:self.btnSelectedColor] forState:UIControlStateSelected]; + } +} + + + +- (void)setTitleFont:(UIFont *)titleFont { + _titleFont = titleFont; + for (UIButton *btn in self.itemButtons) { + btn.titleLabel.font = titleFont; + } + [self setNeedsLayout]; + [self layoutIfNeeded]; +} + +- (void)setIndicatorColor:(UIColor *)indicatorColor { + _indicatorColor = indicatorColor; + self.indicatorView.backgroundColor = indicatorColor; +} + +- (void)setIndicatorHeight:(CGFloat)indicatorHeight { + _indicatorHeight = indicatorHeight; + [self setNeedsLayout]; + [self layoutIfNeeded]; +} + +- (void)setIndicatorExtraW:(CGFloat)indicatorExtraW { + _indicatorExtraW = indicatorExtraW; + [self setNeedsLayout]; + [self layoutIfNeeded]; +} + +- (void)setItemMinMargin:(CGFloat)itemMinMargin { + _itemMinMargin = itemMinMargin; + [self setNeedsLayout]; + [self layoutIfNeeded]; +} + +- (void)setIndicatorBottomMargin:(CGFloat)indicatorBottomMargin { + _indicatorBottomMargin = indicatorBottomMargin; + [self setNeedsLayout]; + [self layoutIfNeeded]; +} + + +#pragma mark - EventResponse + +- (void)btnClick:(UIButton *)btn { + NSInteger btnIndex = btn.tag - 888; + if (btnIndex == self.selectedIndex) { + return; + } + if (self.delegate && [self.delegate respondsToSelector:@selector(segmentTitleView:selectedIndex:lastSelectedIndex:)]) { + [self.delegate segmentTitleView:self selectedIndex:btnIndex lastSelectedIndex:self.selectedIndex]; + } + self.selectedIndex = btnIndex; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyBaseView.h b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyBaseView.h new file mode 100644 index 0000000..e2b273d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyBaseView.h @@ -0,0 +1,146 @@ +// +// LYEmptyBaseView.h +// LYEmptyViewDemo +// +// Created by liyang on 2017/5/5. +// Copyright © 2017年 liyang. All rights reserved. +// + +#import +#import "UIView+LYExtension.h" + +//事件回调 +typedef void (^LYActionTapBlock)(void); + +@interface LYEmptyBaseView : UIView + +/////////属性传递(可修改) +/* image 的优先级大于 imageStr,只有一个有效*/ +@property (nonatomic, strong)UIImage *image; +@property (nonatomic, copy) NSString *imageStr; +@property (nonatomic, copy) NSString *titleStr; +@property (nonatomic, copy) NSString *detailStr; +@property (nonatomic, copy) NSString *btnTitleStr; + +/////////属性传递 (只读) +@property (nonatomic,strong,readonly) UIView *contentView; +@property (nonatomic, weak, readonly) id actionBtnTarget; +@property (nonatomic,assign,readonly) SEL actionBtnAction; +@property (nonatomic, copy, readonly) LYActionTapBlock btnClickBlock; +@property (nonatomic,strong,readonly) UIView *customView; + +/** + emptyView点击事件 + */ +@property (nonatomic, copy) LYActionTapBlock tapEmptyViewBlock; + + +///初始化配置 +- (void)prepare; + +///重置Subviews +- (void)setupSubviews; + + +/** + 构造方法 - 创建emptyView + + @param image 占位图片 + @param titleStr 标题 + @param detailStr 详细描述 + @param btnTitleStr 按钮的名称 + @param target 响应的对象 + @param action 按钮点击事件 + @return 返回一个emptyView + */ ++ (instancetype)emptyActionViewWithImage:(UIImage *)image + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + target:(id)target + action:(SEL)action; + +/** + 构造方法 - 创建emptyView + + @param image 占位图片 + @param titleStr 占位描述 + @param detailStr 详细描述 + @param btnTitleStr 按钮的名称 + @param btnClickBlock 按钮点击事件回调 + @return 返回一个emptyView + */ ++ (instancetype)emptyActionViewWithImage:(UIImage *)image + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + btnClickBlock:(LYActionTapBlock)btnClickBlock; + +/** + 构造方法 - 创建emptyView + + @param imageStr 占位图片名称 + @param titleStr 标题 + @param detailStr 详细描述 + @param btnTitleStr 按钮的名称 + @param target 响应的对象 + @param action 按钮点击事件 + @return 返回一个emptyView + */ ++ (instancetype)emptyActionViewWithImageStr:(NSString *)imageStr + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + target:(id)target + action:(SEL)action; + +/** + 构造方法 - 创建emptyView + + @param imageStr 占位图片名称 + @param titleStr 占位描述 + @param detailStr 详细描述 + @param btnTitleStr 按钮的名称 + @param btnClickBlock 按钮点击事件回调 + @return 返回一个emptyView + */ ++ (instancetype)emptyActionViewWithImageStr:(NSString *)imageStr + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + btnClickBlock:(LYActionTapBlock)btnClickBlock; + +/** + 构造方法 - 创建emptyView + + @param image 占位图片 + @param titleStr 占位描述 + @param detailStr 详细描述 + @return 返回一个没有点击事件的emptyView + */ ++ (instancetype)emptyViewWithImage:(UIImage *)image + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr; + +/** + 构造方法 - 创建emptyView + + @param imageStr 占位图片名称 + @param titleStr 占位描述 + @param detailStr 详细描述 + @return 返回一个没有点击事件的emptyView + */ ++ (instancetype)emptyViewWithImageStr:(NSString *)imageStr + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr; + +/** + 构造方法 - 创建一个自定义的emptyView + + @param customView 自定义view + @return 返回一个自定义内容的emptyView + */ ++ (instancetype)emptyViewWithCustomView:(UIView *)customView; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyBaseView.m b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyBaseView.m new file mode 100644 index 0000000..a5898aa --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyBaseView.m @@ -0,0 +1,212 @@ +// +// LYEmptyBaseView.h +// LYEmptyViewDemo +// +// Created by liyang on 2017/5/5. +// Copyright © 2017年 liyang. All rights reserved. +// + +#import "LYEmptyBaseView.h" + +@interface LYEmptyBaseView () + +@end + +@implementation LYEmptyBaseView + +#pragma mark - ------------------ Life Cycle ------------------ +- (instancetype)init +{ + self = [super init]; + if (self) { + [self initialize]; + [self prepare]; + } + return self; +} + +- (void)initialize{ +} + +- (void)prepare{ + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + + UIView *view = self.superview; + //不是UIView,不做操作 + if (view && [view isKindOfClass:[UIView class]]){ + self.ly_width = view.ly_width; + self.ly_height = view.ly_height; + } + + [self setupSubviews]; +} + +- (void)setupSubviews{ +} + +- (void)willMoveToSuperview:(UIView *)newSuperview +{ + [super willMoveToSuperview:newSuperview]; + + //不是UIView,不做操作 + if (newSuperview && ![newSuperview isKindOfClass:[UIView class]]) return; + + if (newSuperview) { + self.ly_width = newSuperview.ly_width; + self.ly_height = newSuperview.ly_height; + } +} + +#pragma mark - ------------------ 实例化 ------------------ ++ (instancetype)emptyActionViewWithImage:(UIImage *)image + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + target:(id)target + action:(SEL)action{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithImage:image imageStr:nil titleStr:titleStr detailStr:detailStr btnTitleStr:btnTitleStr target:target action:action btnClickBlock:nil]; + + return emptyView; +} + ++ (instancetype)emptyActionViewWithImage:(UIImage *)image + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + btnClickBlock:(LYActionTapBlock)btnClickBlock{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithImage:image imageStr:nil titleStr:titleStr detailStr:detailStr btnTitleStr:btnTitleStr target:nil action:nil btnClickBlock:btnClickBlock]; + + return emptyView; +} + ++ (instancetype)emptyActionViewWithImageStr:(NSString *)imageStr + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + target:(id)target + action:(SEL)action{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithImage:nil imageStr:imageStr titleStr:titleStr detailStr:detailStr btnTitleStr:btnTitleStr target:target action:action btnClickBlock:nil]; + + return emptyView; +} + ++ (instancetype)emptyActionViewWithImageStr:(NSString *)imageStr + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr + btnTitleStr:(NSString *)btnTitleStr + btnClickBlock:(LYActionTapBlock)btnClickBlock{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithImage:nil imageStr:imageStr titleStr:titleStr detailStr:detailStr btnTitleStr:btnTitleStr target:nil action:nil btnClickBlock:btnClickBlock]; + + return emptyView; +} + ++ (instancetype)emptyViewWithImage:(UIImage *)image + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithImage:image imageStr:nil titleStr:titleStr detailStr:detailStr btnTitleStr:nil target:nil action:nil btnClickBlock:nil]; + + return emptyView; +} + ++ (instancetype)emptyViewWithImageStr:(NSString *)imageStr + titleStr:(NSString *)titleStr + detailStr:(NSString *)detailStr{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithImage:nil imageStr:imageStr titleStr:titleStr detailStr:detailStr btnTitleStr:nil target:nil action:nil btnClickBlock:nil]; + + return emptyView; +} + ++ (instancetype)emptyViewWithCustomView:(UIView *)customView{ + + LYEmptyBaseView *emptyView = [[self alloc] init]; + [emptyView creatEmptyViewWithCustomView:customView]; + + return emptyView; +} + +- (void)creatEmptyViewWithImage:(UIImage *)image imageStr:(NSString *)imageStr titleStr:(NSString *)titleStr detailStr:(NSString *)detailStr btnTitleStr:(NSString *)btnTitleStr target:(id)target action:(SEL)action btnClickBlock:(LYActionTapBlock)btnClickBlock{ + + _image = image; + _imageStr = imageStr; + _titleStr = titleStr; + _detailStr = detailStr; + _btnTitleStr = btnTitleStr; + _actionBtnTarget = target; + _actionBtnAction = action; + _btnClickBlock = btnClickBlock; + + //内容物背景视图 + if (!_contentView) { + _contentView = [[UIView alloc] initWithFrame:CGRectZero]; + [self addSubview:_contentView]; + } + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEmptyView:)]; + [self addGestureRecognizer:tap]; +} + +- (void)creatEmptyViewWithCustomView:(UIView *)customView{ + + //内容物背景视图 + if (!_contentView) { + _contentView = [[UIView alloc] initWithFrame:CGRectZero]; + [self addSubview:_contentView]; + } + + if (!_customView) { + [_contentView addSubview:customView]; + } + _customView = customView; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEmptyView:)]; + [self addGestureRecognizer:tap]; +} + +#pragma mark - ------------------ Event Method ------------------ +- (void)tapEmptyView:(UITapGestureRecognizer *)tap{ + if (_tapEmptyViewBlock) { + _tapEmptyViewBlock(); + } +} + +#pragma mark - ------------------ Setter ------------------ + +- (void)setImage:(UIImage *)image{ + _image = image; + [self setNeedsLayout]; +} +- (void)setImageStr:(NSString *)imageStr{ + _imageStr = imageStr; + [self setNeedsLayout]; +} +- (void)setTitleStr:(NSString *)titleStr{ + _titleStr = titleStr; + [self setNeedsLayout]; +} +- (void)setDetailStr:(NSString *)detailStr{ + _detailStr = detailStr; + [self setNeedsLayout]; +} +- (void)setBtnTitleStr:(NSString *)btnTitleStr{ + _btnTitleStr = btnTitleStr; + [self setNeedsLayout]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyView.h b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyView.h new file mode 100755 index 0000000..a6c2a92 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyView.h @@ -0,0 +1,142 @@ +// +// LYEmptyView.h +// LYEmptyViewDemo +// +// Created by liyang on 2017/5/10. +// Copyright © 2017年 liyang. All rights reserved. +// + +#import "LYEmptyBaseView.h" + +@interface LYEmptyView : LYEmptyBaseView + +/** + 是否自动显隐EmptyView, default=YES + */ +@property (nonatomic, assign) BOOL autoShowEmptyView; + +/** + 占位图是否完全覆盖父视图, default=NO + 当设置为YES后,占位图的backgroundColor默认为浅白色,可自行设置 + */ +@property (nonatomic, assign) BOOL emptyViewIsCompleteCoverSuperView; + +/** + 内容物上每个子控件之间的间距 default is 20.f , 这是统一设置的,每个子控件可单独设置 + */ +@property (nonatomic, assign) CGFloat subViewMargin; + +/** + 内容物-垂直方向偏移 (此属性与contentViewY 互斥,只有一个会有效) + */ +@property (nonatomic, assign) CGFloat contentViewOffset; + +/** + 内容物-Y坐标 (此属性与contentViewOffset 互斥,只有一个会有效) + */ +@property (nonatomic, assign) CGFloat contentViewY; + +/** + 是否忽略scrollView的contentInset + */ +@property (nonatomic, assign) BOOL ignoreContentInset; + + +//-------------------------- image --------------------------// +/** + 图片可设置固定大小 (default=图片实际大小) + */ +@property (nonatomic, assign) CGSize imageSize; + + +//-------------------------- titleLab 相关 --------------------------// +/** + 标题字体, 大小default is 16.f + */ +@property (nonatomic, strong) UIFont *titleLabFont; + +/** + 标题文字颜色 + */ +@property (nonatomic, strong) UIColor *titleLabTextColor; + +/** + 标题与图片之间的间距 default is @subViewMargin + */ +@property (nonatomic, assign) CGFloat titleLabMargin; + + +//-------------------------- detailLab 相关 --------------------------// +/** + 详细描述字体,大小default is 14.f + */ +@property (nonatomic, strong) UIFont *detailLabFont; + +/** + 详细描述最大行数, default is 2 + */ +@property (nonatomic, assign) NSInteger detailLabMaxLines; + +/** + 详细描述文字颜色 + */ +@property (nonatomic, strong) UIColor *detailLabTextColor; + +/** + 详细描述文字行间距 + */ +@property (nonatomic, assign) NSInteger detailLabLineSpacing; + +/** + 详细描述 与 (标题或图片) 之间的间距 default is @subViewMargin + */ +@property (nonatomic, assign) CGFloat detailLabMargin; + + +//-------------------------- Button 相关 --------------------------// +/** + 按钮字体, 大小default is 14.f + */ +@property (nonatomic, strong) UIFont *actionBtnFont; +/** + 按钮的高度, default is 40.f + */ +@property (nonatomic, assign) CGFloat actionBtnHeight; +/** + 按钮的宽度, default is 0.f, (此属性和actionBtnHorizontalMargin只有一个有效,都>0时,此属性优先级大) + */ +@property (nonatomic, assign) CGFloat actionBtnWidth; +/** + 按钮的水平方向内边距, default is 30.f, (此属性和actionBtnWidth只有一个有效,都>0时,此属性优先级小) + */ +@property (nonatomic, assign) CGFloat actionBtnHorizontalMargin; +/** + 按钮的圆角大小, default is 0 + */ +@property (nonatomic, assign) CGFloat actionBtnCornerRadius; +/** + 按钮边框border的宽度, default is 0 + */ +@property (nonatomic, assign) CGFloat actionBtnBorderWidth; +/** + 按钮边框颜色 + */ +@property (nonatomic, strong) UIColor *actionBtnBorderColor; +/** + 按钮文字颜色 + */ +@property (nonatomic, strong) UIColor *actionBtnTitleColor; +/** + 按钮背景颜色 + */ +@property (nonatomic, strong) UIColor *actionBtnBackGroundColor; +/** + 按钮背景渐变颜色集合,2个 + */ +@property (nonatomic, strong) NSArray *actionBtnBackGroundGradientColors; +/** + 按钮 与 (详细描述或标题或图片) 之间的间距 default is @subViewMargin + */ +@property (nonatomic, assign) CGFloat actionBtnMargin; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyView.m b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyView.m new file mode 100755 index 0000000..92913f2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyView.m @@ -0,0 +1,656 @@ +// +// LYEmptyView.m +// LYEmptyViewDemo +// +// Created by liyang on 2017/5/10. +// Copyright © 2017年 liyang. All rights reserved. +// + +#import "LYEmptyView.h" + +//每个子控件之间的间距 +#define kSubViewMargin 20.f + +//描述字体 +#define kTitleLabFont [UIFont systemFontOfSize:16.f] + +//详细描述字体 +#define kDetailLabFont [UIFont systemFontOfSize:14.f] + +//按钮字体大小 +#define kActionBtnFont [UIFont systemFontOfSize:14.f] + +//按钮高度 +#define kActionBtnHeight 40.f +//按钮宽度 +#define kActionBtnWidth 120.f +//水平方向内边距 +#define kActionBtnHorizontalMargin 30.f + +//背景色 +#define kBackgroundColor [UIColor colorWithRed:250.f/255.f green:250.f/255.f blue:250.f/255.f alpha:1.f] +//黑色 +#define kBlackColor [UIColor colorWithRed:0.3f green:0.3f blue:0.3f alpha:1.f] +//灰色 +#define kGrayColor [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1.f] + +@interface LYEmptyView () + +@property (nonatomic, strong) UIImageView *promptImageView; +@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UILabel *detailLabel; +@property (nonatomic, strong) UIButton *actionButton; +@property (nonatomic, strong) UIView *customV; + +@end + +@implementation LYEmptyView +{ + CGFloat contentMaxWidth; //最大宽度 + CGFloat contentWidth; //内容物宽度 + CGFloat contentHeight; //内容物高度 + CGFloat subViweMargin; //内容物上每个子控件之间的间距 +} + +- (void)initialize{ + self.actionBtnHeight = 40.f; + self.actionBtnWidth = 120.f; + self.actionBtnHorizontalMargin = 30.f; + self.detailLabMaxLines = 2; +} + +- (void)prepare{ + [super prepare]; + + self.autoShowEmptyView = YES; //默认自动显隐 + self.contentViewY = 1000; //默认值,用来判断是否设置过content的Y值 +} + +- (void)setupSubviews{ + [super setupSubviews]; + + contentMaxWidth = self.emptyViewIsCompleteCoverSuperView ? self.ly_width : self.ly_width - 30.f; + contentWidth = 0;//内容物宽度 + contentHeight = 0;//内容物高度 + subViweMargin = self.subViewMargin ? self.subViewMargin : kSubViewMargin; + + //占位图片 + UIImage *image; + if (self.imageStr.length) { + image = [UIImage imageNamed:self.imageStr]; + } + if(self.image){ + [self setupPromptImageView:self.image]; + }else if (image) { + [self setupPromptImageView:image]; + } else{ + if (_promptImageView) { + [self.promptImageView removeFromSuperview]; + self.promptImageView = nil; + } + } + + //标题 + if (self.titleStr.length) { + [self setupTitleLabel:self.titleStr]; + }else{ + if (_titleLabel) { + [self.titleLabel removeFromSuperview]; + self.titleLabel = nil; + } + } + + //详细描述 + if (self.detailStr.length) { + [self setupDetailLabel:self.detailStr]; + }else{ + if (_detailLabel) { + [self.detailLabel removeFromSuperview]; + self.detailLabel = nil; + } + } + + //按钮 + if (self.btnTitleStr.length) { + if (self.actionBtnTarget && self.actionBtnAction) { + [self setupActionBtn:self.btnTitleStr target:self.actionBtnTarget action:self.actionBtnAction btnClickBlock:nil]; + }else if (self.btnClickBlock) { + [self setupActionBtn:self.btnTitleStr target:nil action:nil btnClickBlock:self.btnClickBlock]; + }else{ + if (_actionButton) { + [self.actionButton removeFromSuperview]; + self.actionButton = nil; + } + } + }else{ + if (_actionButton) { + [self.actionButton removeFromSuperview]; + self.actionButton = nil; + } + } + + //自定义view + if (self.customView) { + contentWidth = self.customView.ly_width; + contentHeight = self.customView.ly_maxY; + } + + ///设置frame + [self setSubViewFrame]; +} + +- (void)setSubViewFrame{ + + //emptyView初始宽高 + CGFloat originEmptyWidth = self.ly_width; + CGFloat originEmptyHeight = self.ly_height; + + CGFloat emptyViewCenterX = originEmptyWidth * 0.5f; + CGFloat emptyViewCenterY = originEmptyHeight * 0.4f; + + //不是完全覆盖父视图时,重新设置self的frame(大小为content的大小) + if (!self.emptyViewIsCompleteCoverSuperView) { + self.ly_size = CGSizeMake(contentWidth, contentHeight); + } + self.center = CGPointMake(emptyViewCenterX, emptyViewCenterY); + + //设置contentView + self.contentView.ly_size = CGSizeMake(contentWidth, contentHeight); + if (self.emptyViewIsCompleteCoverSuperView) { + self.contentView.center = CGPointMake(emptyViewCenterX, emptyViewCenterY); + } else { + self.contentView.center = CGPointMake(contentWidth*0.5, contentHeight*0.5); + } + + //子控件的centerX设置 + CGFloat centerX = self.contentView.ly_width * 0.5f; + if (self.customView) { + self.customView.ly_centerX = centerX; + + }else{ + _promptImageView.ly_centerX = centerX; + _titleLabel.ly_centerX = centerX; + _detailLabel.ly_centerX = centerX; + _actionButton.ly_centerX = centerX; + } + + if (self.contentViewOffset) { //有无设置偏移 + self.ly_centerY += self.contentViewOffset; + + } else if (self.contentViewY < 1000) { //有无设置Y坐标值 + self.ly_y = self.contentViewY; + + } + + //是否忽略scrollView的contentInset + if (self.ignoreContentInset && [self.superview isKindOfClass:[UIScrollView class]]) { + UIScrollView *scrollView = (UIScrollView *)self.superview; + self.ly_centerY -= scrollView.contentInset.top; + self.ly_centerX -= scrollView.contentInset.left; + self.ly_centerY += scrollView.contentInset.bottom; + self.ly_centerX += scrollView.contentInset.right; + } +} + +#pragma mark - ------------------ Setup View ------------------ +- (void)setupPromptImageView:(UIImage *)img{ + + self.promptImageView.image = img; + + CGFloat imgViewWidth = img.size.width; + CGFloat imgViewHeight = img.size.height; + + if (self.imageSize.width && self.imageSize.height) {//设置了宽高大小 + if (imgViewWidth > imgViewHeight) {//以宽为基准,按比例缩放高度 + imgViewHeight = (imgViewHeight / imgViewWidth) * self.imageSize.width; + imgViewWidth = self.imageSize.width; + + }else{//以高为基准,按比例缩放宽度 + imgViewWidth = (imgViewWidth / imgViewHeight) * self.imageSize.height; + imgViewHeight = self.imageSize.height; + } + } + self.promptImageView.frame = CGRectMake(0, 0, imgViewWidth, imgViewHeight); + + contentWidth = self.promptImageView.ly_size.width; + contentHeight = self.promptImageView.ly_maxY; +} + +- (void)setupTitleLabel:(NSString *)titleStr{ + + UIFont *font = self.titleLabFont.pointSize ? self.titleLabFont : kTitleLabFont; + CGFloat fontSize = font.pointSize; + UIColor *textColor = self.titleLabTextColor ? self.titleLabTextColor : kBlackColor; + CGFloat titleMargin = self.titleLabMargin > 0 ? self.titleLabMargin : (contentHeight == 0 ?: subViweMargin); + CGSize size = [self returnTextWidth:titleStr size:CGSizeMake(contentMaxWidth, fontSize + 5) font:font]; + + CGFloat width = size.width; + CGFloat height = size.height; + + self.titleLabel.frame = CGRectMake(0, contentHeight + titleMargin, width, height); + self.titleLabel.font = font; + self.titleLabel.text = titleStr; + self.titleLabel.textColor = textColor; + + contentWidth = width > contentWidth ? width : contentWidth; + contentHeight = self.titleLabel.ly_maxY; +} + +- (void)setupDetailLabel:(NSString *)detailStr{ + + UIColor *textColor = self.detailLabTextColor ? self.detailLabTextColor : kGrayColor; + UIFont *font = self.detailLabFont.pointSize ? self.detailLabFont : kDetailLabFont; + CGFloat fontSize = font.pointSize; + CGFloat maxLines = self.detailLabMaxLines > 0 ? self.detailLabMaxLines : 1; + CGFloat detailMargin = self.detailLabMargin > 0 ? self.detailLabMargin : (contentHeight == 0 ?: subViweMargin); + self.detailLabel.font = font; + self.detailLabel.textColor = textColor; + self.detailLabel.text = detailStr; + + CGFloat width = 0; + CGFloat height = 0; + + //设置行高 + if(self.detailLabLineSpacing){ + + CGFloat maxHeight = maxLines * (fontSize + 5) + (maxLines-1) * self.detailLabLineSpacing; + + NSDictionary *dic = [self sizeWithAttributedString:self.detailLabel.text font:font lineSpacing:self.detailLabLineSpacing maxSize:CGSizeMake(contentMaxWidth, maxHeight)]; + + NSMutableAttributedString *attStr = dic[@"attributed"]; + NSValue *sizeValue = dic[@"size"]; + CGSize size = sizeValue.CGSizeValue; + width = size.width; + height = size.height; + self.detailLabel.attributedText = attStr; + + } + else{ + + CGFloat maxHeight = maxLines * (fontSize + 5); + CGSize size = [self returnTextWidth:detailStr size:CGSizeMake(contentMaxWidth, maxHeight) font:font];//计算得出label大小 + width = size.width; + height = size.height; + } + + self.detailLabel.frame = CGRectMake(0, contentHeight + detailMargin, width, height); + + contentWidth = width > contentWidth ? width : contentWidth; + contentHeight = self.detailLabel.ly_maxY; + +} + +- (void)setupActionBtn:(NSString *)btnTitle target:(id)target action:(SEL)action btnClickBlock:(LYActionTapBlock)btnClickBlock{ + + UIFont *font = self.actionBtnFont.pointSize ? self.actionBtnFont : kActionBtnFont; + CGFloat fontSize = font.pointSize; + UIColor *titleColor = self.actionBtnTitleColor ?: kBlackColor; + UIColor *backGColor = self.actionBtnBackGroundColor ?: [UIColor whiteColor]; + UIColor *borderColor = self.actionBtnBorderColor ?: [UIColor colorWithRed:0.8f green:0.8f blue:0.8f alpha:1.f]; + CGFloat borderWidth = self.actionBtnBorderWidth ?: 0; + CGFloat cornerRadius = self.actionBtnCornerRadius ?: 0; + CGFloat width = self.actionBtnWidth; + CGFloat horiMargin = self.actionBtnHorizontalMargin; + CGFloat height = self.actionBtnHeight; + CGSize textSize = [self returnTextWidth:btnTitle size:CGSizeMake(contentMaxWidth, fontSize) font:font];//计算得出title文字内容大小 + if (height < textSize.height) { + height = textSize.height + 4.f; + } + + //按钮的宽 + CGFloat btnWidth = textSize.width; + if (width) { + btnWidth = width; + } else if (horiMargin) { + btnWidth = textSize.width + horiMargin * 2.f; + } + + //按钮的高 + CGFloat btnHeight = height; + btnWidth = btnWidth > contentMaxWidth ? contentMaxWidth : btnWidth; + CGFloat btnMargin = self.actionBtnMargin > 0 ? self.actionBtnMargin : (contentHeight == 0 ?: subViweMargin); + + self.actionButton.frame = CGRectMake(0, contentHeight + btnMargin, btnWidth, btnHeight); + [self.actionButton setTitle:btnTitle forState:UIControlStateNormal]; + self.actionButton.titleLabel.font = font; + self.actionButton.backgroundColor = backGColor; + if (self.actionBtnBackGroundGradientColors) [self addGradientWithView:self.actionButton gradientColors:self.actionBtnBackGroundGradientColors]; + [self.actionButton setTitleColor:titleColor forState:UIControlStateNormal]; + self.actionButton.layer.borderColor = borderColor.CGColor; + self.actionButton.layer.borderWidth = borderWidth; + self.actionButton.layer.cornerRadius = cornerRadius; + + //添加事件 + if (target && action) { + [self.actionButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + [self.actionButton addTarget:self action:@selector(actionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + }else if (btnClickBlock) { + [self.actionButton addTarget:self action:@selector(actionBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + } + + contentWidth = btnWidth > contentWidth ? btnWidth : contentWidth; + contentHeight = self.actionButton.ly_maxY; +} + +#pragma mark - ------------------ Event Method ------------------ +- (void)actionBtnClick:(UIButton *)sender{ + if (self.btnClickBlock) { + self.btnClickBlock(); + } +} + +#pragma mark - ------------------ setter ------------------ + +- (void)setEmptyViewIsCompleteCoverSuperView:(BOOL)emptyViewIsCompleteCoverSuperView{ + _emptyViewIsCompleteCoverSuperView = emptyViewIsCompleteCoverSuperView; + if (emptyViewIsCompleteCoverSuperView) { + if (!self.backgroundColor || [self.backgroundColor isEqual:[UIColor clearColor]]) { + self.backgroundColor = kBackgroundColor; + } + [self setNeedsLayout]; + }else{ + self.backgroundColor = [UIColor clearColor]; + } +} + +#pragma mark 内容物背景视图 相关 +- (void)setSubViewMargin:(CGFloat)subViewMargin{ + if (_subViewMargin != subViewMargin) { + _subViewMargin = subViewMargin; + + [self reSetupSubviews]; + } +} +- (void)setTitleLabMargin:(CGFloat)titleLabMargin{ + if (_titleLabMargin != titleLabMargin) { + _titleLabMargin = titleLabMargin; + + [self reSetupSubviews]; + } +} +- (void)setDetailLabMargin:(CGFloat)detailLabMargin{ + if (_detailLabMargin != detailLabMargin) { + _detailLabMargin = detailLabMargin; + + [self reSetupSubviews]; + } +} +- (void)setActionBtnMargin:(CGFloat)actionBtnMargin{ + if (_actionBtnMargin != actionBtnMargin) { + _actionBtnMargin = actionBtnMargin; + + [self reSetupSubviews]; + } +} +- (void)reSetupSubviews{ + if (_promptImageView || _titleLabel || _detailLabel || _actionButton || self.customView) {//此判断的意思只是确定self是否已加载完毕 + [self setupSubviews]; + } +} +- (void)setContentViewOffset:(CGFloat)contentViewOffset{ + if (_contentViewOffset != contentViewOffset) { + _contentViewOffset = contentViewOffset; + + if (_promptImageView || _titleLabel || _detailLabel || _actionButton || self.customView) { + self.ly_centerY += self.contentViewOffset; + } + } +} +- (void)setContentViewY:(CGFloat)contentViewY{ + if (_contentViewY != contentViewY) { + _contentViewY = contentViewY; + + if (_promptImageView || _titleLabel || _detailLabel || _actionButton || self.customView) { + self.ly_y = self.contentViewY; + } + } +} + +#pragma mark 提示图Image 相关 +- (void)setImageSize:(CGSize)imageSize{ + if (_imageSize.width != imageSize.width || _imageSize.height != imageSize.height) { + _imageSize = imageSize; + + if (_promptImageView) { + [self setupSubviews]; + } + } +} + +#pragma mark 描述Label 相关 +- (void)setTitleLabFont:(UIFont *)titleLabFont{ + if (_titleLabFont != titleLabFont) { + _titleLabFont = titleLabFont; + + if (_titleLabel) { + [self setupSubviews]; + } + } + +} +- (void)setTitleLabTextColor:(UIColor *)titleLabTextColor{ + if (_titleLabTextColor != titleLabTextColor) { + _titleLabTextColor = titleLabTextColor; + + if (_titleLabel) { + _titleLabel.textColor = titleLabTextColor; + } + } +} + +#pragma mark 详细描述Label 相关 +- (void)setDetailLabFont:(UIFont *)detailLabFont{ + if (_detailLabFont != detailLabFont) { + _detailLabFont = detailLabFont; + + if (_detailLabel) { + [self setupSubviews]; + } + } +} +- (void)setDetailLabMaxLines:(NSInteger)detailLabMaxLines{ + if (_detailLabMaxLines != detailLabMaxLines) { + _detailLabMaxLines = detailLabMaxLines; + + if (_detailLabel) { + [self setupSubviews]; + } + } +} +- (void)setDetailLabTextColor:(UIColor *)detailLabTextColor{ + if (_detailLabTextColor != detailLabTextColor) { + _detailLabTextColor = detailLabTextColor; + + if (_detailLabel) { + _detailLabel.textColor = detailLabTextColor; + } + } +} + +- (void)setDetailLabLineSpacing:(NSInteger)detailLabLineSpacing{ + if (_detailLabLineSpacing != detailLabLineSpacing) { + _detailLabLineSpacing = detailLabLineSpacing; + + if (_detailLabel) { + [self setupSubviews]; + } + } +} + +#pragma mark Button 相关 +//////////大小位置相关-需要重新布局 +- (void)setActionBtnFont:(UIFont *)actionBtnFont{ + if (_actionBtnFont != actionBtnFont) { + _actionBtnFont = actionBtnFont; + + if (_actionButton) { + [self setupSubviews]; + } + } +} +- (void)setActionBtnHeight:(CGFloat)actionBtnHeight{ + if (_actionBtnHeight != actionBtnHeight) { + _actionBtnHeight = actionBtnHeight; + + if (_actionButton) { + [self setupSubviews]; + } + } +} +- (void)setActionBtnWidth:(CGFloat)actionBtnWidth{ + if (_actionBtnWidth != actionBtnWidth) { + _actionBtnWidth = actionBtnWidth; + + if (_actionButton) { + [self setupSubviews]; + } + } +} +- (void)setActionBtnHorizontalMargin:(CGFloat)actionBtnHorizontalMargin{ + if (_actionBtnHorizontalMargin != actionBtnHorizontalMargin) { + _actionBtnHorizontalMargin = actionBtnHorizontalMargin; + + if (_actionButton) { + [self setupSubviews]; + } + } +} +//////////其他相关-直接赋值 +- (void)setActionBtnCornerRadius:(CGFloat)actionBtnCornerRadius{ + if (_actionBtnCornerRadius != actionBtnCornerRadius) { + _actionBtnCornerRadius = actionBtnCornerRadius; + + if (_actionButton) { + _actionButton.layer.cornerRadius = actionBtnCornerRadius; + } + } +} +- (void)setActionBtnBorderWidth:(CGFloat)actionBtnBorderWidth{ + if (actionBtnBorderWidth != _actionBtnBorderWidth) { + _actionBtnBorderWidth = actionBtnBorderWidth; + + if (_actionButton) { + _actionButton.layer.borderWidth = actionBtnBorderWidth; + } + } +} +- (void)setActionBtnBorderColor:(UIColor *)actionBtnBorderColor{ + if (_actionBtnBorderColor != actionBtnBorderColor) { + _actionBtnBorderColor = actionBtnBorderColor; + + if (_actionButton) { + _actionButton.layer.borderColor = actionBtnBorderColor.CGColor; + } + } +} +- (void)setActionBtnTitleColor:(UIColor *)actionBtnTitleColor{ + if (_actionBtnTitleColor != actionBtnTitleColor) { + _actionBtnTitleColor = actionBtnTitleColor; + + if (_actionButton) { + [_actionButton setTitleColor:actionBtnTitleColor forState:UIControlStateNormal]; + } + } +} +- (void)setActionBtnBackGroundColor:(UIColor *)actionBtnBackGroundColor{ + if (actionBtnBackGroundColor != _actionBtnBackGroundColor) { + _actionBtnBackGroundColor = actionBtnBackGroundColor; + + if (_actionButton) { + [_actionButton setBackgroundColor:actionBtnBackGroundColor]; + } + } +} +- (void)setActionBtnBackGroundGradientColors:(NSArray *)actionBtnBackGroundGradientColors +{ + if (actionBtnBackGroundGradientColors.count >= 2) { + _actionBtnBackGroundGradientColors = [actionBtnBackGroundGradientColors subarrayWithRange:NSMakeRange(0, 2)]; + if (_actionButton) { + [self addGradientWithView:_actionButton gradientColors:_actionBtnBackGroundGradientColors]; + } + } +} + +#pragma mark - ------------------ getter ------------------ +- (UIImageView *)promptImageView{ + if (!_promptImageView) { + _promptImageView = [[UIImageView alloc] init]; + _promptImageView.contentMode = UIViewContentModeScaleAspectFit; + [self.contentView addSubview:_promptImageView]; + } + return _promptImageView; +} +- (UILabel *)titleLabel{ + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:_titleLabel]; + } + return _titleLabel; +} +- (UILabel *)detailLabel{ + if (!_detailLabel) { + _detailLabel = [[UILabel alloc] init]; + _detailLabel.textAlignment = NSTextAlignmentCenter; + _detailLabel.numberOfLines = 0; + [self.contentView addSubview:_detailLabel]; + } + return _detailLabel; +} +- (UIButton *)actionButton{ + if (!_actionButton) { + _actionButton = [[UIButton alloc] init]; + _actionButton.layer.masksToBounds = YES; + [self.contentView addSubview:_actionButton]; + } + return _actionButton; +} + +#pragma mark - ------------------ Help Method ------------------ +- (CGSize)returnTextWidth:(NSString *)text size:(CGSize)size font:(UIFont *)font{ + CGSize textSize = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : font} context:nil].size; + return textSize; +} + +- (NSDictionary *)sizeWithAttributedString:(NSString *)string font:(UIFont *)font lineSpacing:(CGFloat)lineSpacing maxSize:(CGSize)maxSize{ + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; + paragraphStyle.lineSpacing = lineSpacing; // 设置行间距 + paragraphStyle.alignment = NSTextAlignmentCenter; + + NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSParagraphStyleAttributeName: paragraphStyle, NSFontAttributeName:font}]; + + CGSize size = [attributedStr boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size; + + NSDictionary *dic = @{ + @"attributed":attributedStr, + @"size": [NSValue valueWithCGSize:size] + }; + return dic; +} + +- (void)addGradientWithView:(UIView *)view gradientColors:(NSArray *)gradientColors +{ + [view setBackgroundColor:[UIColor clearColor]]; + + NSArray *colors = @[(__bridge id)[gradientColors.firstObject CGColor], + (__bridge id)[gradientColors.lastObject CGColor]]; + CAGradientLayer *layer = [CAGradientLayer layer]; + layer.colors = colors; + layer.locations = @[@0.3, @0.5, @1.0]; + layer.startPoint = CGPointMake(0, 0); + layer.endPoint = CGPointMake(1.0, 0); + layer.frame = view.bounds; + layer.masksToBounds = YES; + layer.cornerRadius = view.frame.size.height * 0.5; + + CALayer *firstLayer = self.layer.sublayers.firstObject; + if ([firstLayer isKindOfClass:[CAGradientLayer class]]) { + [view.layer replaceSublayer:firstLayer with:layer]; + } else { + [view.layer insertSublayer:layer atIndex:0]; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyViewHeader.h b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyViewHeader.h new file mode 100644 index 0000000..e99b96f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/LYEmptyViewHeader.h @@ -0,0 +1,15 @@ +// +// LYEmptyViewHeader.h +// LYEmptyViewDemo +// +// Created by 李阳 on 2017/5/11. +// Copyright © 2017年 liyang. All rights reserved. +// + +#ifndef LYEmptyViewHeader_h +#define LYEmptyViewHeader_h + +#import "LYEmptyView.h" +#import "UIView+Empty.h" + +#endif /* LYEmptyViewHeader_h */ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+Empty.h b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+Empty.h new file mode 100644 index 0000000..2ac8e07 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+Empty.h @@ -0,0 +1,54 @@ +// +// UIView+Empty.h +// LYEmptyViewDemo +// +// Created by liyang on 2018/5/10. +// Copyright © 2018年 liyang. All rights reserved. +// + +#import + +@class LYEmptyView; + +@interface UIView (Empty) + +/** + 空页面占位图控件 + */ +@property (nonatomic, strong) LYEmptyView *ly_emptyView; + +/////////////////////// +/////////////////////// +//使用下面的四个方法请将EmptyView的autoShowEmptyView值置为NO,关闭自动显隐,以保证不受自动显隐的影响 +/////////////////////// +/////////////////////// + +/** + 一般用于开始请求网络时调用,ly_startLoading调用时会暂时隐藏emptyView + 当调用ly_endLoading方法时,ly_endLoading方法内部会根据当前的tableView/collectionView的 + DataSource来自动判断是否显示emptyView + */ +- (void)ly_startLoading; + +/** + 在想要刷新emptyView状态时调用 + 注意:ly_endLoading 的调用时机,有刷新UI的地方一定要等到刷新UI的方法之后调用, + 因为只有刷新了UI,view的DataSource才会更新,故调用此方法才能正确判断是否有内容。 + */ +- (void)ly_endLoading; + + +//调用下面两个手动显隐的方法,不受DataSource的影响,单独设置显示与隐藏(前提是关闭autoShowEmptyView) + +/** + 手动调用显示emptyView + */ +- (void)ly_showEmptyView; + +/** + 手动调用隐藏emptyView + */ +- (void)ly_hideEmptyView; + +@end + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+Empty.m b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+Empty.m new file mode 100644 index 0000000..5cc2332 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+Empty.m @@ -0,0 +1,224 @@ +// +// UIView+Empty.m +// LYEmptyViewDemo +// +// Created by liyang on 2018/5/10. +// Copyright © 2018年 liyang. All rights reserved. +// + +#import "UIView+Empty.h" +#import +#import "LYEmptyView.h" + +#pragma mark - ------------------ UIView ------------------ + +@implementation UIView (Empty) + ++ (void)exchangeInstanceMethod1:(SEL)method1 method2:(SEL)method2 +{ + method_exchangeImplementations(class_getInstanceMethod(self, method1), class_getInstanceMethod(self, method2)); +} + +#pragma mark - Setter/Getter + +static char kEmptyViewKey; +- (void)setLy_emptyView:(LYEmptyView *)ly_emptyView{ + if (ly_emptyView != self.ly_emptyView) { + + objc_setAssociatedObject(self, &kEmptyViewKey, ly_emptyView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + for (UIView *view in self.subviews) { + if ([view isKindOfClass:[LYEmptyView class]]) { + [view removeFromSuperview]; + } + } + [self addSubview:self.ly_emptyView]; + + if ([self isKindOfClass:[UITableView class]] || [self isKindOfClass:[UICollectionView class]]) { + [self getDataAndSet]; // 添加时根据DataSource去决定显隐 + } else { + self.ly_emptyView.hidden = YES;// 添加时默认隐藏 + } + } +} +- (LYEmptyView *)ly_emptyView{ + return objc_getAssociatedObject(self, &kEmptyViewKey); +} + +#pragma mark - Private Method (UITableView、UICollectionView有效) +- (NSInteger)totalDataCount +{ + NSInteger totalCount = 0; + if ([self isKindOfClass:[UITableView class]]) { + UITableView *tableView = (UITableView *)self; + + for (NSInteger section = 0; section < tableView.numberOfSections; section++) { + totalCount += [tableView numberOfRowsInSection:section]; + } + } else if ([self isKindOfClass:[UICollectionView class]]) { + UICollectionView *collectionView = (UICollectionView *)self; + + for (NSInteger section = 0; section < collectionView.numberOfSections; section++) { + totalCount += [collectionView numberOfItemsInSection:section]; + } + } + return totalCount; +} +- (void)getDataAndSet{ + //没有设置emptyView的,直接返回 + if (!self.ly_emptyView) { + return; + } + + if ([self totalDataCount] == 0) { + [self show]; + }else{ + [self hide]; + } +} +- (void)show{ + //当不自动显隐时,内部自动调用show方法时也不要去显示,要显示的话只有手动去调用 ly_showEmptyView + if (!self.ly_emptyView.autoShowEmptyView) { + return; + } + + [self ly_showEmptyView]; +} +- (void)hide{ + //当不自动显隐时,内部自动调用hide方法时也不要去隐藏,要隐藏的话只有手动去调用 ly_hideEmptyView + if (!self.ly_emptyView.autoShowEmptyView) { + return; + } + + [self ly_hideEmptyView]; +} + +#pragma mark - Public Method +- (void)ly_showEmptyView{ + + NSAssert(![self isKindOfClass:[LYEmptyView class]], @"LYEmptyView及其子类不能调用ly_showEmptyView方法"); + + self.ly_emptyView.hidden = NO; + + //让 emptyBGView 始终保持在最上层 + [self bringSubviewToFront:self.ly_emptyView]; +} +- (void)ly_hideEmptyView{ + NSAssert(![self isKindOfClass:[LYEmptyView class]], @"LYEmptyView及其子类不能调用ly_hideEmptyView方法"); + self.ly_emptyView.hidden = YES; +} +- (void)ly_startLoading{ + NSAssert(![self isKindOfClass:[LYEmptyView class]], @"LYEmptyView及其子类不能调用ly_startLoading方法"); + self.ly_emptyView.hidden = YES; +} +- (void)ly_endLoading{ + NSAssert(![self isKindOfClass:[LYEmptyView class]], @"LYEmptyView及其子类不能调用ly_endLoading方法"); + self.ly_emptyView.hidden = [self totalDataCount]; +} + +@end + +#pragma mark - ------------------ UITableView ------------------ + +@implementation UITableView (Empty) ++ (void)load{ + + [self exchangeInstanceMethod1:@selector(reloadData) method2:@selector(ly_reloadData)]; + + ///section + [self exchangeInstanceMethod1:@selector(insertSections:withRowAnimation:) method2:@selector(ly_insertSections:withRowAnimation:)]; + [self exchangeInstanceMethod1:@selector(deleteSections:withRowAnimation:) method2:@selector(ly_deleteSections:withRowAnimation:)]; + [self exchangeInstanceMethod1:@selector(reloadSections:withRowAnimation:) method2:@selector(ly_reloadSections:withRowAnimation:)]; + + ///row + [self exchangeInstanceMethod1:@selector(insertRowsAtIndexPaths:withRowAnimation:) method2:@selector(ly_insertRowsAtIndexPaths:withRowAnimation:)]; + [self exchangeInstanceMethod1:@selector(deleteRowsAtIndexPaths:withRowAnimation:) method2:@selector(ly_deleteRowsAtIndexPaths:withRowAnimation:)]; + [self exchangeInstanceMethod1:@selector(reloadRowsAtIndexPaths:withRowAnimation:) method2:@selector(ly_reloadRowsAtIndexPaths:withRowAnimation:)]; +} +- (void)ly_reloadData{ + [self ly_reloadData]; + [self getDataAndSet]; +} +///section +- (void)ly_insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation{ + [self ly_insertSections:sections withRowAnimation:animation]; + [self getDataAndSet]; +} +- (void)ly_deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation{ + [self ly_deleteSections:sections withRowAnimation:animation]; + [self getDataAndSet]; +} +- (void)ly_reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation{ + [self ly_reloadSections:sections withRowAnimation:animation]; + [self getDataAndSet]; +} + +///row +- (void)ly_insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation{ + [self ly_insertRowsAtIndexPaths:indexPaths withRowAnimation:animation]; + [self getDataAndSet]; +} +- (void)ly_deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation{ + [self ly_deleteRowsAtIndexPaths:indexPaths withRowAnimation:animation]; + [self getDataAndSet]; +} +- (void)ly_reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation{ + [self ly_reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation]; + [self getDataAndSet]; +} + + +@end + +#pragma mark - ------------------ UICollectionView ------------------ + +@implementation UICollectionView (Empty) + ++ (void)load{ + + [self exchangeInstanceMethod1:@selector(reloadData) method2:@selector(ly_reloadData)]; + + ///section + [self exchangeInstanceMethod1:@selector(insertSections:) method2:@selector(ly_insertSections:)]; + [self exchangeInstanceMethod1:@selector(deleteSections:) method2:@selector(ly_deleteSections:)]; + [self exchangeInstanceMethod1:@selector(reloadSections:) method2:@selector(ly_reloadSections:)]; + + ///item + [self exchangeInstanceMethod1:@selector(insertItemsAtIndexPaths:) method2:@selector(ly_insertItemsAtIndexPaths:)]; + [self exchangeInstanceMethod1:@selector(deleteItemsAtIndexPaths:) method2:@selector(ly_deleteItemsAtIndexPaths:)]; + [self exchangeInstanceMethod1:@selector(reloadItemsAtIndexPaths:) method2:@selector(ly_reloadItemsAtIndexPaths:)]; + +} +- (void)ly_reloadData{ + [self ly_reloadData]; + [self getDataAndSet]; +} +///section +- (void)ly_insertSections:(NSIndexSet *)sections{ + [self ly_insertSections:sections]; + [self getDataAndSet]; +} +- (void)ly_deleteSections:(NSIndexSet *)sections{ + [self ly_deleteSections:sections]; + [self getDataAndSet]; +} +- (void)ly_reloadSections:(NSIndexSet *)sections{ + [self ly_reloadSections:sections]; + [self getDataAndSet]; +} + +///item +- (void)ly_insertItemsAtIndexPaths:(NSArray *)indexPaths{ + [self ly_insertItemsAtIndexPaths:indexPaths]; + [self getDataAndSet]; +} +- (void)ly_deleteItemsAtIndexPaths:(NSArray *)indexPaths{ + [self ly_deleteItemsAtIndexPaths:indexPaths]; + [self getDataAndSet]; +} +- (void)ly_reloadItemsAtIndexPaths:(NSArray *)indexPaths{ + [self ly_reloadItemsAtIndexPaths:indexPaths]; + [self getDataAndSet]; +} +@end + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+LYExtension.h b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+LYExtension.h new file mode 100644 index 0000000..44fabf0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+LYExtension.h @@ -0,0 +1,26 @@ +// +// UIView+LYExtension.h +// LYEmptyViewDemo +// +// Created by 李阳 on 2017/5/12. +// Copyright © 2017年 liyang. All rights reserved. +// + +#import + +@interface UIView (LYExtension) + +@property (nonatomic, assign) CGFloat ly_x; +@property (nonatomic, assign) CGFloat ly_y; +@property (nonatomic, assign) CGFloat ly_width; +@property (nonatomic, assign) CGFloat ly_height; +@property (nonatomic, assign) CGFloat ly_centerX; +@property (nonatomic, assign) CGFloat ly_centerY; +@property (nonatomic, assign) CGSize ly_size; +@property (nonatomic, assign) CGPoint ly_origin; +@property (nonatomic, assign, readonly) CGFloat ly_maxX; +@property (nonatomic, assign, readonly) CGFloat ly_maxY; + + +@end + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+LYExtension.m b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+LYExtension.m new file mode 100644 index 0000000..a1ab06e --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/LYEmptyView/UIView+LYExtension.m @@ -0,0 +1,108 @@ +// +// UIView+LYExtension.m +// LYEmptyViewDemo +// +// Created by 李阳 on 2017/5/12. +// Copyright © 2017年 liyang. All rights reserved. +// + +#import "UIView+LYExtension.h" + +@implementation UIView (LYExtension) + +- (void)setLy_x:(CGFloat)ly_x{ + + CGRect frame = self.frame; + frame.origin.x = ly_x; + self.frame = frame; +} +- (CGFloat)ly_x +{ + return self.frame.origin.x; +} + +- (void)setLy_y:(CGFloat)ly_y{ + + CGRect frame = self.frame; + frame.origin.y = ly_y; + self.frame = frame; +} +- (CGFloat)ly_y +{ + return self.frame.origin.y; +} + +- (void)setLy_centerX:(CGFloat)ly_centerX{ + CGPoint center = self.center; + center.x = ly_centerX; + self.center = center; +} +- (CGFloat)ly_centerX +{ + return self.center.x; +} + +- (void)setLy_centerY:(CGFloat)ly_centerY +{ + CGPoint center = self.center; + center.y = ly_centerY; + self.center = center; +} +- (CGFloat)ly_centerY +{ + return self.center.y; +} + +- (void)setLy_width:(CGFloat)ly_width +{ + CGRect frame = self.frame; + frame.size.width = ly_width; + self.frame = frame; +} +- (CGFloat)ly_width +{ + return self.frame.size.width; +} + +- (void)setLy_height:(CGFloat)ly_height +{ + CGRect frame = self.frame; + frame.size.height = ly_height; + self.frame = frame; +} +- (CGFloat)ly_height +{ + return self.frame.size.height; +} + +- (void)setLy_size:(CGSize)ly_size +{ + CGRect frame = self.frame; + frame.size = ly_size; + self.frame = frame; +} +- (CGSize)ly_size +{ + return self.frame.size; +} + +- (void)setLy_origin:(CGPoint)ly_origin +{ + CGRect frame = self.frame; + frame.origin = ly_origin; + self.frame = frame; +} + +- (CGPoint)ly_origin +{ + return self.frame.origin; +} +- (CGFloat)ly_maxX{ + return self.frame.origin.x + self.frame.size.width; +} +- (CGFloat)ly_maxY{ + return self.frame.origin.y + self.frame.size.height; +} + +@end + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/MQTextField.h b/XinjiangProject/XinjiangProject/ThirdParty/MQTextField.h new file mode 100644 index 0000000..43dc6db --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/MQTextField.h @@ -0,0 +1,16 @@ +// +// MQTextField.h +// EscortProject +// +// Created by Apple on 2024/5/7. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MQTextField : UITextField + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/MQTextField.m b/XinjiangProject/XinjiangProject/ThirdParty/MQTextField.m new file mode 100644 index 0000000..ca4c2d4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/MQTextField.m @@ -0,0 +1,28 @@ +// +// MQTextField.m +// EscortProject +// +// Created by Apple on 2024/5/7. +// + +#import "MQTextField.h" + +@implementation MQTextField + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (BOOL)canPerformAction:(SEL)action withSender:(id)sender { + UIMenuController *menuController = [UIMenuController sharedMenuController]; + if (menuController) { + //直接隐藏菜单 + [UIMenuController sharedMenuController].menuVisible = NO; + } + return NO; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSAppInfo.h b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSAppInfo.h new file mode 100755 index 0000000..d9b097a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSAppInfo.h @@ -0,0 +1,70 @@ +// +// PSAppInfo.h +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import + +@interface PSAppInfo : NSObject + +/** + * AppId + */ +@property (nonatomic, copy) NSString *appId; + +/** + * bundleId + */ +@property(nonatomic,copy)NSString *bundleId; + +/** + * 当前版本号 + */ +@property (nonatomic, copy) NSString *currentVersion; + +/** + * 更新版本号 + */ +@property (nonatomic, copy) NSString *releaseVersion; + +/** + * 更新日志 + */ +@property (nonatomic, copy) NSString *releaseLog; + +/** + * 更新时间(yyyy-MM-dd HH:mm) + */ +@property (nonatomic, copy) NSString *releaseDate; + +/** + * AppStore地址 + */ +@property (nonatomic, copy) NSString *appStoreUrl; + +/** + * APP简介 + */ +@property (nonatomic, copy) NSString *appAbstract; + +/** + * 开发商 + */ +@property (nonatomic, copy) NSString *sellerName; + +/** + * 文件大小(MB) + */ +@property (nonatomic, copy) NSString *fileSize; + +/** + * 展示图 + */ +@property (nonatomic, copy) NSArray *screenshotUrls; + +- (instancetype)initWithDict:(NSDictionary *)dict; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSAppInfo.m b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSAppInfo.m new file mode 100755 index 0000000..56a2dda --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSAppInfo.m @@ -0,0 +1,56 @@ +// +// PSAppInfo.m +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import "PSAppInfo.h" + +@implementation PSAppInfo + +- (instancetype)initWithDict:(NSDictionary *)dict { + + self = [super init]; + if (self) { + + self.appId = dict[@"trackId"]; + self.bundleId = dict[@"bundleId"]; + self.currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"]; + self.releaseVersion = dict[@"version"]; + self.releaseLog = dict[@"releaseNotes"]; + self.releaseDate = dict[@"currentVersionReleaseDate"]; + self.appStoreUrl = dict[@"trackViewUrl"]; + self.appAbstract = dict[@"description"]; + self.sellerName = dict[@"sellerName"]; + self.fileSize = dict[@"fileSizeBytes"]; + self.screenshotUrls = dict[@"screenshotUrls"]; + + self.releaseDate = [self formatReleaseDate]; + self.fileSize = [self formatFileSizeByMB]; + } + return self; +} + +- (NSString *)formatReleaseDate { + + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ"; + NSDate *date = [dateFormatter dateFromString:self.releaseDate]; + NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"]; + [dateFormatter setTimeZone:timeZone]; + dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm"; + NSString *releaseDate= [dateFormatter stringFromDate:date]; + + return releaseDate; +} + +- (NSString *)formatFileSizeByMB { + + CGFloat fileSizeByMB = ([self.fileSize integerValue] /(1000 *1000)); + NSString *fileSize = [NSString stringWithFormat:@"%.0fMB",fileSizeByMB]; + return fileSize; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersion.h b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersion.h new file mode 100755 index 0000000..66136bf --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersion.h @@ -0,0 +1,45 @@ +// +// PSCheckVersion.h +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import +#import "PSAppInfo.h" + +typedef void(^completeBlock) (PSAppInfo *info, NSError *error); + +@interface PSCheckVersion : NSObject + ++ (PSCheckVersion *)shardInstance; + +/** + 在App内打开(此方式存在延迟,请求苹果服务器完成才能显示弹框) + */ +@property (nonatomic, assign) BOOL openAppStoreInApp; + +/** + 如检测到不是最新版本,可设置销售地区,默认为cn,一般情况不用设置 + */ +@property (nonatomic, copy) NSString *salesArea; + +/** + 检测版本更新,自带UI + */ ++ (void)checkVersion; + +/** + 检测版本更新,自带UI(强制更新) + */ ++ (void)checkVersionCompulsoryUpdate; + +/** + 检测版本更新,需要自定义UI + + @param completeBlock 完成回调 + */ ++ (void)checkVersionCompleteBlock:(completeBlock)completeBlock; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersion.m b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersion.m new file mode 100755 index 0000000..cea11f9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersion.m @@ -0,0 +1,196 @@ +// +// PSCheckVersion.m +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import "PSCheckVersion.h" +#import +#import "PSCheckVersionRequest.h" +#import "PSCheckVersionView.h" +#if __has_include() +#import +#else +#import "Masonry.h" +#endif + +#define kNoVersionUpdateError [[NSError alloc] initWithDomain:@"PSCheckVersionDomain" code:50000 userInfo:@{NSLocalizedDescriptionKey:@"当前app为最新版本"}] + +@interface PSCheckVersion() + +@property (nonatomic, strong) PSAppInfo *appInfo; +@property (nonatomic, strong) UIView *coverView; +@property (nonatomic, strong) PSCheckVersionView *checkVersionView; + +@property (nonatomic, assign) BOOL isCompulsoryUpdate; + +@end + +@implementation PSCheckVersion + ++ (void)checkVersion { + + [[PSCheckVersion shardInstance] + checkVersionAutoAlertCompulsoryUpdate:NO]; +} + ++ (void)checkVersionCompulsoryUpdate { + + [[PSCheckVersion shardInstance] + checkVersionAutoAlertCompulsoryUpdate:YES]; +} + ++ (void)checkVersionCompleteBlock:(completeBlock)completeBlock { + + [[PSCheckVersion shardInstance] checkVersionCompleteBlock:completeBlock]; +} + +- (void)show { + + if (_coverView) { return; } + + __weak typeof(self)weakSelf = self; + + if (self.isCompulsoryUpdate) { + self.checkVersionView = [[PSCheckVersionView alloc] + initWithAppInfo:self.appInfo + confirm:^{ + [weakSelf jumpAppStoreUpdate]; + }]; + }else { + self.checkVersionView = [[PSCheckVersionView alloc] + initWithAppInfo:self.appInfo + confirm:^{ + [weakSelf jumpAppStoreUpdate]; + [weakSelf hide]; + } cancel:^{ + [weakSelf hide]; + }]; + } + [self.coverView addSubview:self.checkVersionView]; + [self.checkVersionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.equalTo(self.coverView).multipliedBy(0.69); + make.height.equalTo(self.coverView).multipliedBy(0.57); + make.center.equalTo(self.coverView); + }]; + [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:self.coverView]; +} + +- (void)hide { + + [self.coverView removeFromSuperview]; + self.appInfo = nil; + self.checkVersionView = nil; + self.coverView = nil; +} + +- (void)checkVersionAutoAlertCompulsoryUpdate:(BOOL)update { + + self.isCompulsoryUpdate = update; + [self checkVersionCompleteBlock:^(PSAppInfo *info, NSError *error) { + + if (error) { return; } + [self show]; + }]; +} + +- (void)checkVersionCompleteBlock:(completeBlock)completeBlock { + + [PSCheckVersionRequest checkVersionSuccess:^(NSDictionary *result) { + + NSInteger resultCount = [result[@"resultCount"] integerValue]; + if(resultCount == 1) { + NSArray *resultList = result[@"results"]; + NSDictionary *resultDict = resultList.firstObject; + PSAppInfo *appInfo = [[PSAppInfo alloc] initWithDict:resultDict]; + self.appInfo = appInfo; + if([self checkVersionUpdate]) { + if (completeBlock) { + completeBlock(appInfo, nil); + } + }else { + if (completeBlock) { + completeBlock(nil, kNoVersionUpdateError); + } + } + [self debugLog]; + }else { + if (completeBlock) { + completeBlock(nil, kNoVersionUpdateError); + } + } + } failure:^(NSError *error) { + + #ifdef DEBUG + #endif + if (completeBlock) { + completeBlock(nil, error); + } + }]; +} + +- (void)debugLog { +#ifdef DEBUG +#endif +} + +- (BOOL)checkVersionUpdate { + + if([self.appInfo.currentVersion compare:self.appInfo.releaseVersion options:NSNumericSearch] + == NSOrderedAscending) { + return YES; + } + return NO; +} + +- (void)jumpAppStoreUpdate { + + if (self.openAppStoreInApp) { + SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init]; + storeViewController.delegate = self; + NSDictionary *parametersDic = @{SKStoreProductParameterITunesItemIdentifier: + self.appInfo.appId}; + [storeViewController loadProductWithParameters:parametersDic completionBlock:^(BOOL result, NSError * _Nullable error) { + if (result) { + [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:storeViewController animated:YES completion:^{ + + }]; + } + }]; + }else { + [[UIApplication sharedApplication] openURL: + [NSURL URLWithString:self.appInfo.appStoreUrl]]; + } +} + +- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController { + + [[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:^{ + + }]; +} + +- (UIView *)coverView { + + if (!_coverView) { + _coverView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; + _coverView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5f]; + } + return _coverView; +} + ++ (PSCheckVersion *)shardInstance { + + static PSCheckVersion *instance = nil; + static dispatch_once_t oneToken; + dispatch_once(&oneToken,^{ + instance = [[PSCheckVersion alloc] init]; + instance.openAppStoreInApp = NO; + instance.salesArea = @"cn"; + }); + return instance; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionRequest.h b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionRequest.h new file mode 100755 index 0000000..09be4d6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionRequest.h @@ -0,0 +1,19 @@ +// +// PSCheckVersionRequest.h +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import + +typedef void(^requestSucess) (NSDictionary *result); +typedef void(^requestFailure) (NSError *error); + +@interface PSCheckVersionRequest : NSObject + ++ (void)checkVersionSuccess:(requestSucess)success + failure:(requestFailure)failure; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionRequest.m b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionRequest.m new file mode 100755 index 0000000..b9ee9c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionRequest.m @@ -0,0 +1,54 @@ +// +// PSCheckVersionRequest.m +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import "PSCheckVersionRequest.h" +#import "PSCheckVersion.h" + +#define kCheckVersioError(_userInfo) [[NSError alloc] initWithDomain:@"PSCheckVersionErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey:_userInfo}] + +@implementation PSCheckVersionRequest + ++ (void)checkVersionSuccess:(requestSucess)success + failure:(requestFailure)failure { + + NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; + NSString *bundleId = infoDict[@"CFBundleIdentifier"]; + NSString *salesArea = [PSCheckVersion shardInstance].salesArea; + NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/lookup?country=%@&bundleId=%@",salesArea,bundleId]]; + + dispatch_async(dispatch_get_global_queue + (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + + NSURLRequest *request = [NSURLRequest requestWithURL:url]; + NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { + + dispatch_async(dispatch_get_main_queue(), ^{ + if (error || !data) { + if(failure) { + failure(error ?:kCheckVersioError(@"苹果服务器返回数据为nil,请检查你的网络(可能原因:iTunes被墙)")); + } + return; + } + NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil]; + if (responseDict[@"errorMessage"]) { + if(failure) { + failure(kCheckVersioError(responseDict[@"errorMessage"])); + } + }else { + if(success) { + success(responseDict); + } + } + }); + + }]; + [dataTask resume]; + }); +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionView.h b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionView.h new file mode 100755 index 0000000..275d1c2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionView.h @@ -0,0 +1,36 @@ +// +// PSCheckVersionView.h +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import +@class PSAppInfo; + +@interface PSCheckVersionView : UIView + +/** + 初始化更新view + + @param info app信息 + @param confirm 确定 + @param cancel 取消 + @return PSCheckVersionView + */ +- (instancetype)initWithAppInfo:(PSAppInfo *)info + confirm:(void(^)(void))confirm + cancel:(void(^)(void))cancel; + +/** + 初始化更新view(强制更新) + + @param info app信息 + @param confirm 确定 + @return 取消 + */ +- (instancetype)initWithAppInfo:(PSAppInfo *)info + confirm:(void(^)(void))confirm; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionView.m b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionView.m new file mode 100755 index 0000000..db9b614 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/PSCheckVersion/PSCheckVersionView.m @@ -0,0 +1,320 @@ +// +// PSCheckVersionView.m +// tyfocg +// +// Created by paintingStyle on 2018/4/19. +// Copyright © 2018年 com.worldTravelNetscape.tyfocg. All rights reserved. +// + +#import "PSCheckVersionView.h" +#import "PSAppInfo.h" +#if __has_include() +#import +#else +#import "Masonry.h" +#endif + +#define kExplainLabelLayoutMaxWidth CGRectGetWidth(self.scrollView.frame)-1 -(15*2) +#define kRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1] + +@interface PSCheckVersionView() + +@property (nonatomic, strong) UIScrollView *scrollView; +@property (nonatomic, strong) UIView *contentView; + +@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UILabel *latestVersionLabel; + +@property (nonatomic, strong) UILabel *packetSizeLabel; +@property (nonatomic, strong) UILabel *currentVersionLabel; +@property (nonatomic, strong) UILabel *updateTimeLabel; + +@property (nonatomic, strong) UILabel *updateExplainLabel; +@property (nonatomic, strong) UILabel *explainLabel; + +@property (nonatomic, strong) UIView *bottomLineView; +@property (nonatomic, strong) UIView *centerLineView; +@property (nonatomic, strong) UIButton *confirmButton; +@property (nonatomic, strong) UIButton *cancelButton; + +@property (nonatomic, strong) PSAppInfo *appInfo; +@property (nonatomic, assign) BOOL isCompulsoryUpdate; +@property (nonatomic, copy) void (^confirmBlock)(void); +@property (nonatomic, copy) void (^cancelBlock)(void); + +@end + +@implementation PSCheckVersionView + +- (instancetype)initWithAppInfo:(PSAppInfo *)info + confirm:(void(^)(void))confirm + cancel:(void(^)(void))cancel { + + if (self = [super init]) { + + self.appInfo = info; + self.confirmBlock = confirm; + self.cancelBlock = cancel; + self.isCompulsoryUpdate = (cancel == nil); + [self configUI]; + } + return self; +} + +- (instancetype)initWithAppInfo:(PSAppInfo *)info + confirm:(void(^)(void))confirm { + + return [self initWithAppInfo:info confirm:confirm cancel:nil]; +} + +- (void)configUI { + + self.backgroundColor = [UIColor whiteColor]; + self.layer.cornerRadius = 5.0f; + self.layer.masksToBounds = YES; + + self.scrollView = [[UIScrollView alloc] init]; + self.scrollView.showsHorizontalScrollIndicator = NO; + [self addSubview:self.scrollView]; + + self.contentView = [[UIView alloc] init]; + [self.scrollView addSubview:self.contentView]; + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.textColor = kRGBColor(23, 24, 28); + self.titleLabel.font = [UIFont systemFontOfSize:16.0f];; + self.titleLabel.textAlignment = NSTextAlignmentLeft; + self.titleLabel.text = @"最新版本"; + [self.contentView addSubview:self.titleLabel]; + + self.latestVersionLabel = [[UILabel alloc] init]; + self.latestVersionLabel.textColor = [UIColor whiteColor]; + self.latestVersionLabel.backgroundColor = kRGBColor(228, 30, 30); + self.latestVersionLabel.font = [UIFont systemFontOfSize:12.0f]; + self.latestVersionLabel.text = self.appInfo.releaseVersion; + self.latestVersionLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.latestVersionLabel]; + + self.packetSizeLabel = [[UILabel alloc] init]; + self.packetSizeLabel.textColor = kRGBColor(119, 119, 119); + self.packetSizeLabel.font = [UIFont systemFontOfSize:12.0f]; +// self.packetSizeLabel.text = [NSString stringWithFormat:@"包大小: %@",self.appInfo.fileSize]; + self.packetSizeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.packetSizeLabel]; + + self.currentVersionLabel = [[UILabel alloc] init]; + self.currentVersionLabel.textColor = kRGBColor(119, 119, 119); + self.currentVersionLabel.font = [UIFont systemFontOfSize:12.0f]; + self.currentVersionLabel.text = [NSString stringWithFormat: + @"当前版本: %@",self.appInfo.currentVersion]; + self.currentVersionLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.currentVersionLabel]; + + self.updateTimeLabel = [[UILabel alloc] init]; + self.updateTimeLabel.textColor = KClearColor; + self.updateTimeLabel.font = [UIFont systemFontOfSize:12.0f]; + self.updateTimeLabel.textAlignment = NSTextAlignmentLeft; +// self.updateTimeLabel.text = [NSString stringWithFormat: +// @"更新时间: %@",self.appInfo.releaseDate]; + [self.contentView addSubview:self.updateTimeLabel]; + + self.updateExplainLabel = [[UILabel alloc] init]; + self.updateExplainLabel.textColor = kRGBColor(119, 119, 119); + self.updateExplainLabel.font = [UIFont systemFontOfSize:12.0f]; + self.updateExplainLabel.textAlignment = NSTextAlignmentLeft; + self.updateExplainLabel.text = @"更新日志"; + [self.contentView addSubview:self.updateExplainLabel]; + + self.explainLabel = [[UILabel alloc] init]; + self.explainLabel.textColor = kRGBColor(119, 119, 119); + self.explainLabel.font = [UIFont systemFontOfSize:12.0f]; + self.explainLabel.numberOfLines = 0; + self.explainLabel.textAlignment = NSTextAlignmentLeft; + self.explainLabel.preferredMaxLayoutWidth = kExplainLabelLayoutMaxWidth; + self.explainLabel.text = self.appInfo.releaseLog; + [self.contentView addSubview:self.explainLabel]; + + self.bottomLineView = [[UIView alloc] init]; + self.bottomLineView.backgroundColor = kRGBColor(223, 223, 223); + [self addSubview:self.bottomLineView]; + + self.confirmButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.confirmButton.titleLabel.font = [UIFont systemFontOfSize:16.0f]; + [self.confirmButton setTitleColor:kRGBColor(69, 149, 236) + forState:UIControlStateNormal]; + [self.confirmButton setTitle:@"立即更新" forState:UIControlStateNormal]; + [self addSubview:self.confirmButton]; + [self.confirmButton addTarget:self action:@selector(confirmButtonDidClicked) forControlEvents:UIControlEventTouchUpInside]; + + if (!self.isCompulsoryUpdate) { + self.centerLineView = [[UIView alloc] init]; + self.centerLineView.backgroundColor = kRGBColor(223, 223, 223); + [self addSubview:self.centerLineView]; + self.cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.cancelButton.titleLabel.font = [UIFont systemFontOfSize:16.0f]; + [self.cancelButton setTitle:@"取消" forState:UIControlStateNormal]; + [self.cancelButton setTitleColor:kRGBColor(23, 24, 28) forState:UIControlStateNormal]; + [self addSubview:self.cancelButton]; + [self.cancelButton addTarget:self action:@selector(cancelButtonDidClicked) forControlEvents:UIControlEventTouchUpInside]; + } +} + +- (void)confirmButtonDidClicked { + + if (self.confirmBlock) { + self.confirmBlock(); + } +} + +- (void)cancelButtonDidClicked { + + if (self.cancelBlock) { + self.cancelBlock(); + } +} + +- (CGFloat)calculationContentViewHeight { + + CGFloat explainLabelHeight = 0; + if (self.explainLabel.text.length > 0) { + CGRect frame = [self.explainLabel.text boundingRectWithSize:CGSizeMake(kExplainLabelLayoutMaxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{ NSFontAttributeName:self.explainLabel.font } context:nil]; + explainLabelHeight = frame.size.height + 1; + } + + CGFloat h = + 22 + 15 + + 22 + + (12 *3) + (2 *8) + + 20 + + 15 + + 16 + + explainLabelHeight + + 16; + + return ceil(h); +} + +- (void)layoutSubviews { + + [super layoutSubviews]; + + // 布局完成获取frame,计算滚动视图内容高度 + [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(@([self calculationContentViewHeight])); + }]; +} + ++ (BOOL)requiresConstraintBasedLayout { + + return YES; +} + +- (void)updateConstraints { + + [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.left.right.mas_equalTo(self); + make.bottom.mas_equalTo(self.bottomLineView.mas_top); + }]; + + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + + make.edges.mas_equalTo(self.scrollView); + make.width.mas_equalTo(self.scrollView).offset(-1); // 禁止左右滚动 + make.height.mas_equalTo([UIScreen mainScreen].bounds.size.height); // 设置初始值 + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.contentView).offset(22); + make.centerX.mas_equalTo(self.contentView).offset(-22); + make.height.mas_equalTo(@15); + }]; + + [self.latestVersionLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.titleLabel.mas_right).offset(22); + make.centerY.mas_equalTo(self.titleLabel); + make.width.mas_greaterThanOrEqualTo(@44); + make.height.mas_equalTo(self.titleLabel); + }]; + + [self.packetSizeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.latestVersionLabel.mas_bottom).offset(22); + make.left.mas_equalTo(self.contentView).offset(15); + make.right.mas_equalTo(self.contentView).offset(-15); + make.height.mas_equalTo(@12); + }]; + + [self.currentVersionLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.packetSizeLabel.mas_bottom).offset(8); + make.left.right.mas_equalTo(self.packetSizeLabel); + make.height.mas_equalTo(@12); + }]; + + [self.updateTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.currentVersionLabel.mas_bottom).offset(8); + make.left.right.mas_equalTo(self.currentVersionLabel); + make.height.mas_equalTo(@12); + }]; + + [self.updateExplainLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.updateTimeLabel.mas_bottom).offset(20); + make.left.right.mas_equalTo(self.updateTimeLabel); + make.height.mas_equalTo(@15); + }]; + + [self.explainLabel mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.updateExplainLabel.mas_bottom).offset(16); + make.left.right.mas_equalTo(self.updateExplainLabel); + make.bottom.mas_equalTo(self.contentView).offset(-16); + }]; + + [self.bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) { + + make.bottom.mas_equalTo(self).offset(-45); + make.left.right.mas_equalTo(self); + make.height.mas_equalTo(@1); + }]; + + if (!self.isCompulsoryUpdate) { + + [self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(self.centerLineView.mas_right); + make.height.mas_equalTo(self.cancelButton); + make.right.bottom.mas_equalTo(self); + }]; + + [self.centerLineView mas_makeConstraints:^(MASConstraintMaker *make) { + + make.top.mas_equalTo(self.bottomLineView.mas_bottom).offset(6); + make.bottom.mas_equalTo(self).offset(-6); + make.centerX.mas_equalTo(self); + make.width.mas_equalTo(@1); + }]; + + [self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) { + + make.right.mas_equalTo(self.centerLineView.mas_left); + make.top.mas_equalTo(self.bottomLineView); + make.left.bottom.mas_equalTo(self); + }]; + }else { + [self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.right.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.bottomLineView); + make.bottom.mas_equalTo(self); + }]; + } + + [super updateConstraints]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/RSAObjC.h b/XinjiangProject/XinjiangProject/ThirdParty/RSAObjC.h new file mode 100644 index 0000000..d422a66 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/RSAObjC.h @@ -0,0 +1,46 @@ +// +// RSAObjC.h +// +// Created by PacteraLF on 16/10/17. +// Copyright © 2016年 PacteraLF. All rights reserved. +// RSA 加密封装类 + +#import + +@interface RSAObjC : NSObject + +/** + * -------RSA 字符串公钥加密------- + @param plaintext 明文,待加密的字符串 + @param pubKey 公钥字符串 + @return 密文,加密后的字符串 + */ ++ (NSString *)encrypt:(NSString *)plaintext PublicKey:(NSString *)pubKey; + +/** + * -------RSA 公钥文件加密------- + @param plaintext 明文,待加密的字符串 + @param path 公钥文件路径,p12或pem格式 + @return 密文,加密后的字符串 + */ ++ (NSString *)encrypt:(NSString *)plaintext KeyFilePath:(NSString *)path; + +/** + * -------RSA 私钥字符串解密------- + @param ciphertext 密文,需要解密的字符串 + @param privKey 私钥字符串 + @return 明文,解密后的字符串 + */ ++ (NSString *)decrypt:(NSString *)ciphertext PrivateKey:(NSString *)privKey; + +/** + * -------RSA 私钥文件解密------- + @param ciphertext 密文,需要解密的字符串 + @param path 私钥文件路径,p12或pem格式(pem私钥需为pcks8格式) + @param pwd 私钥文件的密码 + @return 明文,解密后的字符串 + */ ++ (NSString *)decrypt:(NSString *)ciphertext KeyFilePath:(NSString *)path FilePwd:(NSString *)pwd; + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/RSAObjC.m b/XinjiangProject/XinjiangProject/ThirdParty/RSAObjC.m new file mode 100644 index 0000000..f4d0f03 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/RSAObjC.m @@ -0,0 +1,527 @@ +// +// RSAObjC.m +// +// Created by PacteraLF on 16/10/17. +// Copyright © 2016年 PacteraLF. All rights reserved. +// RSA 加密封装类 + +#import "RSAObjC.h" +#import + +@implementation RSAObjC + +static NSString *base64_encode_data(NSData *data){ + data = [data base64EncodedDataWithOptions:0]; + NSString *ret = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + return ret; +} + +static NSData *base64_decode(NSString *str){ + NSData *data = [[NSData alloc] initWithBase64EncodedString:str options:NSDataBase64DecodingIgnoreUnknownCharacters]; + return data; +} + +/** + * -------RSA 字符串公钥加密------- + @param plaintext 明文,待加密的字符串 + @param pubKey 公钥字符串 + @return 密文,加密后的字符串 + */ ++ (NSString *)encrypt:(NSString *)plaintext PublicKey:(NSString *)pubKey{ + if (plaintext.length == 0 || pubKey.length == 0) { + return nil; + } + NSData *data = [self encryptData:[plaintext dataUsingEncoding:NSUTF8StringEncoding] publicKey:pubKey]; + NSString *ret = base64_encode_data(data); + return ret; +} + +/** + * -------RSA 公钥文件加密------- + @param plaintext 明文,待加密的字符串 + @param path 公钥文件路径,p12或pem格式 + @return 密文,加密后的字符串 + */ ++ (NSString *)encrypt:(NSString *)plaintext KeyFilePath:(NSString *)path{ + if (plaintext.length == 0 || path.length == 0) { + return nil; + } + NSString *result = nil; + if ([path hasSuffix:@".pem"]) { + NSString *pubKey = [self readPubKeyFromPem:path]; + NSData *data = [self encryptData:[plaintext dataUsingEncoding:NSUTF8StringEncoding] publicKey:pubKey]; + result = base64_encode_data(data); + }else{ + SecKeyRef pubKeyRef = [self getPublicKeyRefWithContentsOfFile:path]; + result = [self encryptString:plaintext publicKeyRef:pubKeyRef]; + if (pubKeyRef) CFRelease(pubKeyRef); + } + return result; +} + +/** + * -------RSA 字符串私钥解密------- + @param ciphertext 密文,需要解密的字符串 + @param privKey 私钥字符串 + @return 明文,解密后的字符串 + */ ++ (NSString *)decrypt:(NSString *)ciphertext PrivateKey:(NSString *)privKey{ + if (ciphertext.length == 0 || privKey.length == 0) { + return nil; + } + + NSData *data = [[NSData alloc] initWithBase64EncodedString:ciphertext options:NSDataBase64DecodingIgnoreUnknownCharacters]; + data = [self decryptData:data privateKey:privKey]; + NSString *ret = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + + return ret; +} + +/** + * -------RSA 私钥文件解密------- + @param ciphertext 密文,需要解密的字符串 + @param path 私钥文件路径,p12或pem格式(pem私钥需为pcks8格式) + @param pwd 私钥文件的密码 + @return 明文,解密后的字符串 + */ ++ (NSString *)decrypt:(NSString *)ciphertext KeyFilePath:(NSString *)path FilePwd:(NSString *)pwd{ + if (ciphertext.length == 0 || path.length == 0) { + return nil; + } + if (!pwd) pwd = @""; + + NSString *result = nil; + if ([path hasSuffix:@".pem"]) { + NSString *privKey = [self readPrivKeyFromPem:path]; + NSData *data = [[NSData alloc] initWithBase64EncodedString:ciphertext options:NSDataBase64DecodingIgnoreUnknownCharacters]; + data = [self decryptData:data privateKey:privKey]; + result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + }else{ + result = [self decryptString:ciphertext privateKeyRef:[self getPrivateKeyRefWithContentsOfFile:path password:pwd]]; + } + return result; +} + ++ (NSString *)readPubKeyFromPem:(NSString *)filePath{ + NSString *pemStr = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; + if (pemStr.length == 0) { + return nil; + } + NSString *header = @"-----BEGIN PUBLIC KEY-----"; + NSString *footer = @"-----END PUBLIC KEY-----"; + pemStr = [pemStr stringByReplacingOccurrencesOfString:header withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:footer withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@"\r" withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@"\t" withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@" " withString:@""]; + return pemStr; +} + ++ (NSString *)readPrivKeyFromPem:(NSString *)filePath{ + NSString *pemStr = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; + if (pemStr.length == 0) { + return nil; + } + NSString *header = @"-----BEGIN RSA PRIVATE KEY-----"; + NSString *footer = @"-----END RSA PRIVATE KEY-----"; + NSString *header_pkcs8 = @"-----BEGIN PRIVATE KEY-----"; + NSString *footer_pkcs8 = @"-----END PRIVATE KEY-----"; + pemStr = [pemStr stringByReplacingOccurrencesOfString:header withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:footer withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:header_pkcs8 withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:footer_pkcs8 withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@"\r" withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@"\t" withString:@""]; + pemStr = [pemStr stringByReplacingOccurrencesOfString:@" " withString:@""]; + return pemStr; +} + ++ (SecKeyRef)getPublicKeyRefWithContentsOfFile:(NSString *)filePath{ + NSData *certData = [NSData dataWithContentsOfFile:filePath]; + if (!certData) { + return NULL; + } + SecCertificateRef cert = SecCertificateCreateWithData(NULL, (CFDataRef)certData); + SecKeyRef key = NULL; + SecTrustRef trust = NULL; + SecPolicyRef policy = NULL; + if (cert != NULL) { + policy = SecPolicyCreateBasicX509(); + if (policy) { + if (SecTrustCreateWithCertificates((CFTypeRef)cert, policy, &trust) == noErr) { + SecTrustResultType result; + if (SecTrustEvaluate(trust, &result) == noErr) { + key = SecTrustCopyPublicKey(trust); + } + } + } + } + if (policy) CFRelease(policy); + if (trust) CFRelease(trust); + if (cert) CFRelease(cert); + return key; +} + ++ (NSString *)encryptString:(NSString *)str publicKeyRef:(SecKeyRef)publicKeyRef{ + if(!publicKeyRef){ + return nil; + } + if(![str dataUsingEncoding:NSUTF8StringEncoding]){ + return nil; + } + NSData *data = [self encryptData:[str dataUsingEncoding:NSUTF8StringEncoding] withKeyRef:publicKeyRef]; + NSString *ret = base64_encode_data(data); + return ret; +} + ++ (SecKeyRef)getPrivateKeyRefWithContentsOfFile:(NSString *)filePath password:(NSString*)password{ + NSData *p12Data = [NSData dataWithContentsOfFile:filePath]; + if (!p12Data) { + return NULL; + } + + SecKeyRef privateKeyRef = NULL; + CFArrayRef rawItems = NULL; + NSDictionary *options = @{(id)kSecImportExportPassphrase:password}; + + OSStatus securityError = SecPKCS12Import((__bridge CFDataRef)p12Data, (__bridge CFDictionaryRef)options, &rawItems); + if (securityError != errSecSuccess) { + if (rawItems) CFRelease(rawItems); + return NULL; + } + + NSArray *items = (NSArray*)CFBridgingRelease(rawItems); + if (items.count > 0) { + NSDictionary *firstItem = items[0]; + SecIdentityRef identity = (SecIdentityRef)CFBridgingRetain(firstItem[(id)kSecImportItemIdentity]); + securityError = SecIdentityCopyPrivateKey(identity, &privateKeyRef); + if (identity) CFRelease(identity); + if (securityError != errSecSuccess) privateKeyRef = NULL; + } + + return privateKeyRef; +} + ++ (NSString *)decryptString:(NSString *)str privateKeyRef:(SecKeyRef)privKeyRef{ + NSData *data = [[NSData alloc] initWithBase64EncodedString:str options:NSDataBase64DecodingIgnoreUnknownCharacters]; + if (!privKeyRef) { + return nil; + } + data = [self decryptData:data withKeyRef:privKeyRef]; + NSString *ret = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + return ret; +} + ++ (NSData *)encryptData:(NSData *)data publicKey:(NSString *)pubKey{ + if(!data || !pubKey){ + return nil; + } + SecKeyRef keyRef = [self addPublicKey:pubKey]; + NSData *enData = [self encryptData:data withKeyRef:keyRef]; + if (keyRef) CFRelease(keyRef); + + return enData; +} + ++ (SecKeyRef)addPublicKey:(NSString *)key{ + NSRange spos = [key rangeOfString:@"-----BEGIN PUBLIC KEY-----"]; + NSRange epos = [key rangeOfString:@"-----END PUBLIC KEY-----"]; + if(spos.location != NSNotFound && epos.location != NSNotFound){ + NSUInteger s = spos.location + spos.length; + NSUInteger e = epos.location; + NSRange range = NSMakeRange(s, e-s); + key = [key substringWithRange:range]; + } + key = [key stringByReplacingOccurrencesOfString:@"\r" withString:@""]; + key = [key stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + key = [key stringByReplacingOccurrencesOfString:@"\t" withString:@""]; + key = [key stringByReplacingOccurrencesOfString:@" " withString:@""]; + + // This will be base64 encoded, decode it. + NSData *data = base64_decode(key); + data = [self stripPublicKeyHeader:data]; + if(!data){ + return nil; + } + + //a tag to read/write keychain storage + NSString *tag = @"RSAUtil_PubKey"; + NSData *d_tag = [NSData dataWithBytes:[tag UTF8String] length:[tag length]]; + + // Delete any old lingering key with the same tag + NSMutableDictionary *publicKey = [[NSMutableDictionary alloc] init]; + [publicKey setObject:(__bridge id) kSecClassKey forKey:(__bridge id)kSecClass]; + [publicKey setObject:(__bridge id) kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType]; + [publicKey setObject:d_tag forKey:(__bridge id)kSecAttrApplicationTag]; + SecItemDelete((__bridge CFDictionaryRef)publicKey); + + // Add persistent version of the key to system keychain + [publicKey setObject:data forKey:(__bridge id)kSecValueData]; + [publicKey setObject:(__bridge id) kSecAttrKeyClassPublic forKey:(__bridge id) + kSecAttrKeyClass]; + [publicKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id) + kSecReturnPersistentRef]; + + CFTypeRef persistKey = nil; + OSStatus status = SecItemAdd((__bridge CFDictionaryRef)publicKey, &persistKey); + if (persistKey != nil){ + CFRelease(persistKey); + } + if ((status != noErr) && (status != errSecDuplicateItem)) { + return nil; + } + + [publicKey removeObjectForKey:(__bridge id)kSecValueData]; + [publicKey removeObjectForKey:(__bridge id)kSecReturnPersistentRef]; + [publicKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id)kSecReturnRef]; + [publicKey setObject:(__bridge id) kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType]; + + // Now fetch the SecKeyRef version of the key + SecKeyRef keyRef = nil; + status = SecItemCopyMatching((__bridge CFDictionaryRef)publicKey, (CFTypeRef *)&keyRef); + if(status != noErr){ + return nil; + } + return keyRef; +} + ++ (NSData *)stripPublicKeyHeader:(NSData *)d_key{ + // Skip ASN.1 public key header + if (d_key == nil) return(nil); + + unsigned long len = [d_key length]; + if (!len) return(nil); + + unsigned char *c_key = (unsigned char *)[d_key bytes]; + unsigned int idx = 0; + + if (c_key[idx++] != 0x30) return(nil); + + if (c_key[idx] > 0x80) idx += c_key[idx] - 0x80 + 1; + else idx++; + + // PKCS #1 rsaEncryption szOID_RSA_RSA + static unsigned char seqiod[] = + { 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, + 0x01, 0x05, 0x00 }; + if (memcmp(&c_key[idx], seqiod, 15)) return(nil); + + idx += 15; + + if (c_key[idx++] != 0x03) return(nil); + + if (c_key[idx] > 0x80) idx += c_key[idx] - 0x80 + 1; + else idx++; + + if (c_key[idx++] != '\0') return(nil); + + return ([NSData dataWithBytes:&c_key[idx] length:len - idx]); +} + ++ (NSData *)encryptData:(NSData *)data withKeyRef:(SecKeyRef)keyRef{ + if(!keyRef){ + return nil; + } + const uint8_t *srcbuf = (const uint8_t *)[data bytes]; + size_t srclen = (size_t)data.length; + + size_t block_size = SecKeyGetBlockSize(keyRef) * sizeof(uint8_t); + void *outbuf = malloc(block_size); + size_t src_block_size = block_size - 11; + + NSMutableData *ret = [[NSMutableData alloc] init]; + for(int idx=0; idx src_block_size){ + data_len = src_block_size; + } + + size_t outlen = block_size; + OSStatus status = noErr; + status = SecKeyEncrypt(keyRef, + kSecPaddingPKCS1, + srcbuf + idx, + data_len, + outbuf, + &outlen + ); + if (status != 0) { + NSLog(@"SecKeyEncrypt fail. Error Code: %d", (int)status); + ret = nil; + break; + }else{ + [ret appendBytes:outbuf length:outlen]; + } + } + + free(outbuf); + return ret; +} + ++ (NSData *)decryptData:(NSData *)data privateKey:(NSString *)privKey{ + if(!data || !privKey){ + return nil; + } + SecKeyRef keyRef = [self addPrivateKey:privKey]; + NSData *deData = [self decryptData:data withKeyRef:keyRef]; + if (keyRef) CFRelease(keyRef); + + return deData; +} + ++ (SecKeyRef)addPrivateKey:(NSString *)key{ + NSRange spos = [key rangeOfString:@"-----BEGIN RSA PRIVATE KEY-----"]; + NSRange epos = [key rangeOfString:@"-----END RSA PRIVATE KEY-----"]; + if(spos.location != NSNotFound && epos.location != NSNotFound){ + NSUInteger s = spos.location + spos.length; + NSUInteger e = epos.location; + NSRange range = NSMakeRange(s, e-s); + key = [key substringWithRange:range]; + } + key = [key stringByReplacingOccurrencesOfString:@"\r" withString:@""]; + key = [key stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + key = [key stringByReplacingOccurrencesOfString:@"\t" withString:@""]; + key = [key stringByReplacingOccurrencesOfString:@" " withString:@""]; + + // This will be base64 encoded, decode it. + NSData *data = base64_decode(key); + data = [self stripPrivateKeyHeader:data]; + if(!data){ + return NULL; + } + + //a tag to read/write keychain storage + NSString *tag = @"RSAUtil_PrivKey"; + NSData *d_tag = [NSData dataWithBytes:[tag UTF8String] length:[tag length]]; + + // Delete any old lingering key with the same tag + NSMutableDictionary *privateKey = [[NSMutableDictionary alloc] init]; + [privateKey setObject:(__bridge id) kSecClassKey forKey:(__bridge id)kSecClass]; + [privateKey setObject:(__bridge id) kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType]; + [privateKey setObject:d_tag forKey:(__bridge id)kSecAttrApplicationTag]; + SecItemDelete((__bridge CFDictionaryRef)privateKey); + + // Add persistent version of the key to system keychain + [privateKey setObject:data forKey:(__bridge id)kSecValueData]; + [privateKey setObject:(__bridge id) kSecAttrKeyClassPrivate forKey:(__bridge id) + kSecAttrKeyClass]; + [privateKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id) + kSecReturnPersistentRef]; + + CFTypeRef persistKey = NULL; + OSStatus status = SecItemAdd((__bridge CFDictionaryRef)privateKey, &persistKey); + if (persistKey) CFRelease(persistKey); + + if ((status != noErr) && (status != errSecDuplicateItem)) { + return NULL; + } + + [privateKey removeObjectForKey:(__bridge id)kSecValueData]; + [privateKey removeObjectForKey:(__bridge id)kSecReturnPersistentRef]; + [privateKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id)kSecReturnRef]; + [privateKey setObject:(__bridge id) kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType]; + + // Now fetch the SecKeyRef version of the key + SecKeyRef keyRef = nil; + status = SecItemCopyMatching((__bridge CFDictionaryRef)privateKey, (CFTypeRef *)&keyRef); + if(status != noErr){ + return NULL; + } + return keyRef; +} + ++ (NSData *)stripPrivateKeyHeader:(NSData *)d_key{ + // Skip ASN.1 private key header + if (d_key == nil) return(nil); + + unsigned long len = [d_key length]; + if (!len) return(nil); + + unsigned char *c_key = (unsigned char *)[d_key bytes]; + unsigned int idx = 22; //magic byte at offset 22 + + if (0x04 != c_key[idx++]) return nil; + + //calculate length of the key + unsigned int c_len = c_key[idx++]; + int det = c_len & 0x80; + if (!det) { + c_len = c_len & 0x7f; + } else { + int byteCount = c_len & 0x7f; + if (byteCount + idx > len) { + //rsa length field longer than buffer + return nil; + } + unsigned int accum = 0; + unsigned char *ptr = &c_key[idx]; + idx += byteCount; + while (byteCount) { + accum = (accum << 8) + *ptr; + ptr++; + byteCount--; + } + c_len = accum; + } + + return [d_key subdataWithRange:NSMakeRange(idx, c_len)]; +} + ++ (NSData *)decryptData:(NSData *)data withKeyRef:(SecKeyRef)keyRef{ + if(!keyRef){ + return nil; + } + const uint8_t *srcbuf = (const uint8_t *)[data bytes]; + size_t srclen = (size_t)data.length; + + size_t block_size = SecKeyGetBlockSize(keyRef) * sizeof(uint8_t); + UInt8 *outbuf = malloc(block_size); + size_t src_block_size = block_size; + + NSMutableData *ret = [[NSMutableData alloc] init]; + for(int idx=0; idx src_block_size){ + data_len = src_block_size; + } + + size_t outlen = block_size; + OSStatus status = noErr; + status = SecKeyDecrypt(keyRef, + kSecPaddingNone, + srcbuf + idx, + data_len, + outbuf, + &outlen + ); + if (status != 0) { + NSLog(@"SecKeyEncrypt fail. Error Code: %d", (int)status); + ret = nil; + break; + }else{ + //the actual decrypted data is in the middle, locate it! + int idxFirstZero = -1; + int idxNextZero = (int)outlen; + for ( int i = 0; i < outlen; i++ ) { + if ( outbuf[i] == 0 ) { + if ( idxFirstZero < 0 ) { + idxFirstZero = i; + } else { + idxNextZero = i; + break; + } + } + } + + [ret appendBytes:&outbuf[idxFirstZero+1] length:idxNextZero-idxFirstZero-1]; + } + } + + free(outbuf); + return ret; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-076.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-076.png new file mode 100755 index 0000000..5fc65c5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-076.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-120.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-120.png new file mode 100755 index 0000000..d15d8f5 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-120.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-152.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-152.png new file mode 100755 index 0000000..1cc539d Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-152.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-167.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-167.png new file mode 100755 index 0000000..17f3912 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-167.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-180.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-180.png new file mode 100755 index 0000000..4ef0e53 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/AppIcon-180.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H.png new file mode 100755 index 0000000..855fe7c Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H@2x.png new file mode 100755 index 0000000..0d212b6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H@3x.png new file mode 100755 index 0000000..1cea49a Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-H@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N.png new file mode 100755 index 0000000..cc85f4d Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N@2x.png new file mode 100755 index 0000000..915771c Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N@3x.png new file mode 100755 index 0000000..199b2f6 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Button-N@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email.png new file mode 100755 index 0000000..7588c1b Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email@2x.png new file mode 100755 index 0000000..8b9005e Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email@3x.png new file mode 100755 index 0000000..f35fe79 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Email@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export.png new file mode 100755 index 0000000..1f646b3 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export@2x.png new file mode 100755 index 0000000..febfd21 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export@3x.png new file mode 100755 index 0000000..ade21f1 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Export@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N.png new file mode 100755 index 0000000..398e780 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N@2x.png new file mode 100755 index 0000000..7460298 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N@3x.png new file mode 100755 index 0000000..502a830 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-N@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y.png new file mode 100755 index 0000000..fbdc11a Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y@2x.png new file mode 100755 index 0000000..413e0f4 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y@3x.png new file mode 100755 index 0000000..5253515 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Mark-Y@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print.png new file mode 100755 index 0000000..0b3eeed Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print@2x.png new file mode 100755 index 0000000..4f5781c Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print@3x.png new file mode 100755 index 0000000..29c11ca Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Print@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs.png new file mode 100755 index 0000000..929ceb2 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs@2x.png new file mode 100755 index 0000000..a512341 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs@3x.png new file mode 100755 index 0000000..5459e7e Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Graphics/Reader-Thumbs@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/CGPDFDocument.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/CGPDFDocument.h new file mode 100755 index 0000000..8c6ad80 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/CGPDFDocument.h @@ -0,0 +1,39 @@ +// +// CGPDFDocument.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import +#import + +// +// Custom CGPDFDocument[...] functions +// + +CGPDFDocumentRef CGPDFDocumentCreateUsingUrl(CFURLRef theURL, NSString *password); + +CGPDFDocumentRef CGPDFDocumentCreateUsingData(CGDataProviderRef dataProvider, NSString *password); + +BOOL CGPDFDocumentUrlNeedsPassword(CFURLRef theURL, NSString *password); + +BOOL CGPDFDocumentDataNeedsPassword(CGDataProviderRef dataProvider, NSString *password); diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/CGPDFDocument.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/CGPDFDocument.m new file mode 100755 index 0000000..20c6b63 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/CGPDFDocument.m @@ -0,0 +1,242 @@ +// +// CGPDFDocument.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "CGPDFDocument.h" + +// +// CGPDFDocumentRef CGPDFDocumentCreateUsingUrl(CFURLRef, NSString *) function +// + +CGPDFDocumentRef CGPDFDocumentCreateUsingUrl(CFURLRef theURL, NSString *password) +{ + CGPDFDocumentRef thePDFDocRef = NULL; // CGPDFDocument + + if (theURL != NULL) // Check for non-NULL CFURLRef + { + thePDFDocRef = CGPDFDocumentCreateWithURL(theURL); + + if (thePDFDocRef != NULL) // Check for non-NULL CGPDFDocumentRef + { + if (CGPDFDocumentIsEncrypted(thePDFDocRef) == TRUE) // Encrypted + { + // Try a blank password first, per Apple's Quartz PDF example + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, "") == FALSE) + { + // Nope, now let's try the provided password to unlock the PDF + + if ((password != nil) && (password.length > 0)) // Not blank? + { + char text[128]; // char array buffer for the string conversion + + [password getCString:text maxLength:126 encoding:NSUTF8StringEncoding]; + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, text) == FALSE) // Log failure + { + #ifdef DEBUG + NSLog(@"CGPDFDocumentCreateUsingUrl: Unable to unlock [%@] with [%@]", theURL, password); + #endif + } + } + } + + if (CGPDFDocumentIsUnlocked(thePDFDocRef) == FALSE) // Cleanup unlock failure + { + CGPDFDocumentRelease(thePDFDocRef), thePDFDocRef = NULL; + } + } + } + } + else // Log an error diagnostic + { + #ifdef DEBUG + NSLog(@"CGPDFDocumentCreateUsingUrl: theURL == NULL"); + #endif + } + + return thePDFDocRef; +} + +// +// CGPDFDocumentRef CGPDFDocumentCreateUsingData(CGDataProviderRef, NSString *) function +// + +CGPDFDocumentRef CGPDFDocumentCreateUsingData(CGDataProviderRef dataProvider, NSString *password) +{ + CGPDFDocumentRef thePDFDocRef = NULL; // CGPDFDocument + + if (dataProvider != NULL) // Check for non-NULL CGDataProviderRef + { + thePDFDocRef = CGPDFDocumentCreateWithProvider(dataProvider); + + if (thePDFDocRef != NULL) // Check for non-NULL CGPDFDocumentRef + { + if (CGPDFDocumentIsEncrypted(thePDFDocRef) == TRUE) // Encrypted + { + // Try a blank password first, per Apple's Quartz PDF example + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, "") == FALSE) + { + // Nope, now let's try the provided password to unlock the PDF + + if ((password != nil) && (password.length > 0)) // Not blank? + { + char text[128]; // char array buffer for the string conversion + + [password getCString:text maxLength:126 encoding:NSUTF8StringEncoding]; + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, text) == FALSE) // Log failure + { + #ifdef DEBUG + NSLog(@"CGPDFDocumentCreateUsingData: Unable to unlock data with '%@'", password); + #endif + } + } + } + + if (CGPDFDocumentIsUnlocked(thePDFDocRef) == FALSE) // Cleanup unlock failure + { + CGPDFDocumentRelease(thePDFDocRef), thePDFDocRef = NULL; + } + } + } + } + else // Log an error diagnostic + { + #ifdef DEBUG + NSLog(@"CGPDFDocumentCreateUsingData: theURL == NULL"); + #endif + } + + return thePDFDocRef; +} + +// +// BOOL CGPDFDocumentUrlNeedsPassword(CFURLRef, NSString *) function +// + +BOOL CGPDFDocumentUrlNeedsPassword(CFURLRef theURL, NSString *password) +{ + BOOL needPassword = NO; // Default flag + + if (theURL != NULL) // Check for non-NULL CFURLRef + { + CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateWithURL(theURL); + + if (thePDFDocRef != NULL) // Check for non-NULL CGPDFDocumentRef + { + if (CGPDFDocumentIsEncrypted(thePDFDocRef) == TRUE) // Encrypted + { + // Try a blank password first, per Apple's Quartz PDF example + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, "") == FALSE) + { + // Nope, now let's try the provided password to unlock the PDF + + if ((password != nil) && (password.length > 0)) // Not blank? + { + char text[128]; // char array buffer for the string conversion + + [password getCString:text maxLength:126 encoding:NSUTF8StringEncoding]; + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, text) == FALSE) + { + needPassword = YES; + } + } + else + { + needPassword = YES; + } + } + } + + CGPDFDocumentRelease(thePDFDocRef); // Cleanup CGPDFDocumentRef + } + } + else // Log an error diagnostic + { + #ifdef DEBUG + NSLog(@"CGPDFDocumentUrlNeedsPassword: theURL == NULL"); + #endif + } + + return needPassword; +} + +// +// BOOL CGPDFDocumentUrlNeedsPassword(CGDataProviderRef, NSString *) function +// + +BOOL CGPDFDocumentDataNeedsPassword(CGDataProviderRef dataProvider, NSString *password) +{ + BOOL needPassword = NO; // Default flag + + if (dataProvider != NULL) // Check for non-NULL CGDataProviderRef + { + CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateWithProvider(dataProvider); + + if (thePDFDocRef != NULL) // Check for non-NULL CGPDFDocumentRef + { + if (CGPDFDocumentIsEncrypted(thePDFDocRef) == TRUE) // Encrypted + { + // Try a blank password first, per Apple's Quartz PDF example + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, "") == FALSE) + { + // Nope, now let's try the provided password to unlock the PDF + + if ((password != nil) && (password.length > 0)) // Not blank? + { + char text[128]; // char array buffer for the string conversion + + [password getCString:text maxLength:126 encoding:NSUTF8StringEncoding]; + + if (CGPDFDocumentUnlockWithPassword(thePDFDocRef, text) == FALSE) + { + needPassword = YES; + } + } + else + { + needPassword = YES; + } + } + } + + CGPDFDocumentRelease(thePDFDocRef); // Cleanup CGPDFDocumentRef + } + } + else // Log an error diagnostic + { + #ifdef DEBUG + NSLog(@"CGPDFDocumentUrlNeedsPassword: theURL == NULL"); + #endif + } + + return needPassword; +} + +// EOF diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderConstants.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderConstants.h new file mode 100755 index 0000000..917b579 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderConstants.h @@ -0,0 +1,39 @@ +// +// ReaderConstants.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#if !__has_feature(objc_arc) + #error ARC (-fobjc-arc) is required to build this code. +#endif + +#import + +#define READER_FLAT_UI TRUE +#define READER_SHOW_SHADOWS TRUE +#define READER_ENABLE_THUMBS TRUE +#define READER_DISABLE_RETINA FALSE +#define READER_ENABLE_PREVIEW TRUE +#define READER_DISABLE_IDLE FALSE +#define READER_STANDALONE FALSE +#define READER_BOOKMARKS TRUE diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderConstants.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderConstants.m new file mode 100755 index 0000000..ae538d9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderConstants.m @@ -0,0 +1,28 @@ +// +// ReaderConstants.m +// Reader v2.8.7 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2016 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" + +static NSString *const kReaderCopyrightNotice = @"Reader v2.x.y • Copyright © 2011-2016 Julius Oklamcak. All rights reserved."; diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentPage.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentPage.h new file mode 100755 index 0000000..92f5408 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentPage.h @@ -0,0 +1,50 @@ +// +// ReaderContentPage.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface ReaderContentPage : UIView + +- (instancetype)initWithURL:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase; + +- (id)processSingleTap:(UITapGestureRecognizer *)recognizer; + +@end + +#pragma mark - + +// +// ReaderDocumentLink class interface +// + +@interface ReaderDocumentLink : NSObject + +@property (nonatomic, assign, readonly) CGRect rect; + +@property (nonatomic, assign, readonly) CGPDFDictionaryRef dictionary; + ++ (instancetype)newWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentPage.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentPage.m new file mode 100755 index 0000000..e6902c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentPage.m @@ -0,0 +1,593 @@ +// +// ReaderContentPage.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ReaderContentPage.h" +#import "ReaderContentTile.h" +#import "CGPDFDocument.h" + +@implementation ReaderContentPage +{ + NSMutableArray *_links; + + CGPDFDocumentRef _PDFDocRef; + + CGPDFPageRef _PDFPageRef; + + NSInteger _pageAngle; + + CGFloat _pageWidth; + CGFloat _pageHeight; + + CGFloat _pageOffsetX; + CGFloat _pageOffsetY; +} + +#pragma mark - ReaderContentPage class methods + ++ (Class)layerClass +{ + return [ReaderContentTile class]; +} + +#pragma mark - ReaderContentPage PDF link methods + +- (void)highlightPageLinks +{ + if (_links.count > 0) // Add highlight views over all links + { + UIColor *hilite = [UIColor colorWithRed:0.0f green:0.0f blue:1.0f alpha:0.15f]; + + for (ReaderDocumentLink *link in _links) // Enumerate the links array + { + UIView *highlight = [[UIView alloc] initWithFrame:link.rect]; + + highlight.autoresizesSubviews = NO; + highlight.userInteractionEnabled = NO; + highlight.contentMode = UIViewContentModeRedraw; + highlight.autoresizingMask = UIViewAutoresizingNone; + highlight.backgroundColor = hilite; // Color + + [self addSubview:highlight]; + } + } +} + +- (ReaderDocumentLink *)linkFromAnnotation:(CGPDFDictionaryRef)annotationDictionary +{ + ReaderDocumentLink *documentLink = nil; // Document link object + + CGPDFArrayRef annotationRectArray = NULL; // Annotation co-ordinates array + + if (CGPDFDictionaryGetArray(annotationDictionary, "Rect", &annotationRectArray)) + { + CGPDFReal ll_x = 0.0f; CGPDFReal ll_y = 0.0f; // PDFRect lower-left X and Y + CGPDFReal ur_x = 0.0f; CGPDFReal ur_y = 0.0f; // PDFRect upper-right X and Y + + CGPDFArrayGetNumber(annotationRectArray, 0, &ll_x); // Lower-left X co-ordinate + CGPDFArrayGetNumber(annotationRectArray, 1, &ll_y); // Lower-left Y co-ordinate + + CGPDFArrayGetNumber(annotationRectArray, 2, &ur_x); // Upper-right X co-ordinate + CGPDFArrayGetNumber(annotationRectArray, 3, &ur_y); // Upper-right Y co-ordinate + + if (ll_x > ur_x) { CGPDFReal t = ll_x; ll_x = ur_x; ur_x = t; } // Normalize Xs + if (ll_y > ur_y) { CGPDFReal t = ll_y; ll_y = ur_y; ur_y = t; } // Normalize Ys + + ll_x -= _pageOffsetX; ll_y -= _pageOffsetY; // Offset lower-left co-ordinate + ur_x -= _pageOffsetX; ur_y -= _pageOffsetY; // Offset upper-right co-ordinate + + switch (_pageAngle) // Page rotation angle (in degrees) + { + case 90: // 90 degree page rotation + { + CGPDFReal swap; + swap = ll_y; ll_y = ll_x; ll_x = swap; + swap = ur_y; ur_y = ur_x; ur_x = swap; + break; + } + + case 270: // 270 degree page rotation + { + CGPDFReal swap; + swap = ll_y; ll_y = ll_x; ll_x = swap; + swap = ur_y; ur_y = ur_x; ur_x = swap; + ll_x = ((0.0f - ll_x) + _pageWidth); + ur_x = ((0.0f - ur_x) + _pageWidth); + break; + } + + case 0: // 0 degree page rotation + { + ll_y = ((0.0f - ll_y) + _pageHeight); + ur_y = ((0.0f - ur_y) + _pageHeight); + break; + } + } + + NSInteger vr_x = ll_x; NSInteger vr_w = (ur_x - ll_x); // Integer X and width + NSInteger vr_y = ll_y; NSInteger vr_h = (ur_y - ll_y); // Integer Y and height + + CGRect viewRect = CGRectMake(vr_x, vr_y, vr_w, vr_h); // View CGRect from PDFRect + + documentLink = [ReaderDocumentLink newWithRect:viewRect dictionary:annotationDictionary]; + } + + return documentLink; +} + +- (void)buildAnnotationLinksList +{ + _links = [NSMutableArray new]; // Links list array + + CGPDFArrayRef pageAnnotations = NULL; // Page annotations array + + CGPDFDictionaryRef pageDictionary = CGPDFPageGetDictionary(_PDFPageRef); + + if (CGPDFDictionaryGetArray(pageDictionary, "Annots", &pageAnnotations) == true) + { + NSInteger count = CGPDFArrayGetCount(pageAnnotations); // Number of annotations + + for (NSInteger index = 0; index < count; index++) // Iterate through all annotations + { + CGPDFDictionaryRef annotationDictionary = NULL; // PDF annotation dictionary + + if (CGPDFArrayGetDictionary(pageAnnotations, index, &annotationDictionary) == true) + { + const char *annotationSubtype = NULL; // PDF annotation subtype string + + if (CGPDFDictionaryGetName(annotationDictionary, "Subtype", &annotationSubtype) == true) + { + if (strcmp(annotationSubtype, "Link") == 0) // Found annotation subtype of 'Link' + { + ReaderDocumentLink *documentLink = [self linkFromAnnotation:annotationDictionary]; + + if (documentLink != nil) [_links insertObject:documentLink atIndex:0]; // Add link + } + } + } + } + + //[self highlightPageLinks]; // Link support debugging + } +} + +- (CGPDFArrayRef)destinationWithName:(const char *)destinationName inDestsTree:(CGPDFDictionaryRef)node +{ + CGPDFArrayRef destinationArray = NULL; + + CGPDFArrayRef limitsArray = NULL; // Limits array + + if (CGPDFDictionaryGetArray(node, "Limits", &limitsArray) == true) + { + CGPDFStringRef lowerLimit = NULL; CGPDFStringRef upperLimit = NULL; + + if (CGPDFArrayGetString(limitsArray, 0, &lowerLimit) == true) // Lower limit + { + if (CGPDFArrayGetString(limitsArray, 1, &upperLimit) == true) // Upper limit + { + const char *ll = (const char *)CGPDFStringGetBytePtr(lowerLimit); // Lower string + const char *ul = (const char *)CGPDFStringGetBytePtr(upperLimit); // Upper string + + if ((strcmp(destinationName, ll) < 0) || (strcmp(destinationName, ul) > 0)) + { + return NULL; // Destination name is outside this node's limits + } + } + } + } + + CGPDFArrayRef namesArray = NULL; // Names array + + if (CGPDFDictionaryGetArray(node, "Names", &namesArray) == true) + { + NSInteger namesCount = CGPDFArrayGetCount(namesArray); + + for (NSInteger index = 0; index < namesCount; index += 2) + { + CGPDFStringRef destName; // Destination name string + + if (CGPDFArrayGetString(namesArray, index, &destName) == true) + { + const char *dn = (const char *)CGPDFStringGetBytePtr(destName); + + if (strcmp(dn, destinationName) == 0) // Found the destination name + { + if (CGPDFArrayGetArray(namesArray, (index + 1), &destinationArray) == false) + { + CGPDFDictionaryRef destinationDictionary = NULL; // Destination dictionary + + if (CGPDFArrayGetDictionary(namesArray, (index + 1), &destinationDictionary) == true) + { + CGPDFDictionaryGetArray(destinationDictionary, "D", &destinationArray); + } + } + + return destinationArray; // Return the destination array + } + } + } + } + + CGPDFArrayRef kidsArray = NULL; // Kids array + + if (CGPDFDictionaryGetArray(node, "Kids", &kidsArray) == true) + { + NSInteger kidsCount = CGPDFArrayGetCount(kidsArray); + + for (NSInteger index = 0; index < kidsCount; index++) + { + CGPDFDictionaryRef kidNode = NULL; // Kid node dictionary + + if (CGPDFArrayGetDictionary(kidsArray, index, &kidNode) == true) // Recurse into node + { + destinationArray = [self destinationWithName:destinationName inDestsTree:kidNode]; + + if (destinationArray != NULL) return destinationArray; // Return destination array + } + } + } + + return NULL; +} + +- (id)annotationLinkTarget:(CGPDFDictionaryRef)annotationDictionary +{ + id linkTarget = nil; // Link target object + + CGPDFStringRef destName = NULL; const char *destString = NULL; + + CGPDFDictionaryRef actionDictionary = NULL; CGPDFArrayRef destArray = NULL; + + if (CGPDFDictionaryGetDictionary(annotationDictionary, "A", &actionDictionary) == true) + { + const char *actionType = NULL; // Annotation action type string + + if (CGPDFDictionaryGetName(actionDictionary, "S", &actionType) == true) + { + if (strcmp(actionType, "GoTo") == 0) // GoTo action type + { + if (CGPDFDictionaryGetArray(actionDictionary, "D", &destArray) == false) + { + CGPDFDictionaryGetString(actionDictionary, "D", &destName); + } + } + else // Handle other link action type possibility + { + if (strcmp(actionType, "URI") == 0) // URI action type + { + CGPDFStringRef uriString = NULL; // Action's URI string + + if (CGPDFDictionaryGetString(actionDictionary, "URI", &uriString) == true) + { + const char *uri = (const char *)CGPDFStringGetBytePtr(uriString); // Destination URI string + + NSString *target = [NSString stringWithCString:uri encoding:NSUTF8StringEncoding]; // NSString - UTF8 + + linkTarget = [NSURL URLWithString:[target stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + + if (linkTarget == nil) NSLog(@"%s Bad URI '%@'", __FUNCTION__, target); + } + } + } + } + } + else // Handle other link target possibilities + { + if (CGPDFDictionaryGetArray(annotationDictionary, "Dest", &destArray) == false) + { + if (CGPDFDictionaryGetString(annotationDictionary, "Dest", &destName) == false) + { + CGPDFDictionaryGetName(annotationDictionary, "Dest", &destString); + } + } + } + + if (destName != NULL) // Handle a destination name + { + CGPDFDictionaryRef catalogDictionary = CGPDFDocumentGetCatalog(_PDFDocRef); + + CGPDFDictionaryRef namesDictionary = NULL; // Destination names in the document + + if (CGPDFDictionaryGetDictionary(catalogDictionary, "Names", &namesDictionary) == true) + { + CGPDFDictionaryRef destsDictionary = NULL; // Document destinations dictionary + + if (CGPDFDictionaryGetDictionary(namesDictionary, "Dests", &destsDictionary) == true) + { + const char *destinationName = (const char *)CGPDFStringGetBytePtr(destName); // Name + + destArray = [self destinationWithName:destinationName inDestsTree:destsDictionary]; + } + } + } + + if (destString != NULL) // Handle a destination string + { + CGPDFDictionaryRef catalogDictionary = CGPDFDocumentGetCatalog(_PDFDocRef); + + CGPDFDictionaryRef destsDictionary = NULL; // Document destinations dictionary + + if (CGPDFDictionaryGetDictionary(catalogDictionary, "Dests", &destsDictionary) == true) + { + CGPDFDictionaryRef targetDictionary = NULL; // Destination target dictionary + + if (CGPDFDictionaryGetDictionary(destsDictionary, destString, &targetDictionary) == true) + { + CGPDFDictionaryGetArray(targetDictionary, "D", &destArray); + } + } + } + + if (destArray != NULL) // Handle a destination array + { + NSInteger targetPageNumber = 0; // The target page number + + CGPDFDictionaryRef pageDictionaryFromDestArray = NULL; // Target reference + + if (CGPDFArrayGetDictionary(destArray, 0, &pageDictionaryFromDestArray) == true) + { + NSInteger pageCount = CGPDFDocumentGetNumberOfPages(_PDFDocRef); // Pages + + for (NSInteger pageNumber = 1; pageNumber <= pageCount; pageNumber++) + { + CGPDFPageRef pageRef = CGPDFDocumentGetPage(_PDFDocRef, pageNumber); + + CGPDFDictionaryRef pageDictionaryFromPage = CGPDFPageGetDictionary(pageRef); + + if (pageDictionaryFromPage == pageDictionaryFromDestArray) // Found it + { + targetPageNumber = pageNumber; break; + } + } + } + else // Try page number from array possibility + { + CGPDFInteger pageNumber = 0; // Page number in array + + if (CGPDFArrayGetInteger(destArray, 0, &pageNumber) == true) + { + targetPageNumber = (pageNumber + 1); // 1-based + } + } + + if (targetPageNumber > 0) // We have a target page number + { + linkTarget = [NSNumber numberWithInteger:targetPageNumber]; + } + } + + return linkTarget; +} + +- (id)processSingleTap:(UITapGestureRecognizer *)recognizer +{ + id result = nil; // Tap result object + + if (recognizer.state == UIGestureRecognizerStateRecognized) + { + if (_links.count > 0) // Process the single tap + { + CGPoint point = [recognizer locationInView:self]; + + for (ReaderDocumentLink *link in _links) // Enumerate links + { + if (CGRectContainsPoint(link.rect, point) == true) // Found it + { + result = [self annotationLinkTarget:link.dictionary]; break; + } + } + } + } + + return result; +} + +#pragma mark - ReaderContentPage instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = NO; + self.userInteractionEnabled = NO; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingNone; + self.backgroundColor = [UIColor clearColor]; + } + + return self; +} + +- (instancetype)initWithURL:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase +{ + CGRect viewRect = CGRectZero; // View rect + + if (fileURL != nil) // Check for non-nil file URL + { + _PDFDocRef = CGPDFDocumentCreateUsingUrl((__bridge CFURLRef)fileURL, phrase); + + if (_PDFDocRef != NULL) // Check for non-NULL CGPDFDocumentRef + { + if (page < 1) page = 1; // Check the lower page bounds + + NSInteger pages = CGPDFDocumentGetNumberOfPages(_PDFDocRef); + + if (page > pages) page = pages; // Check the upper page bounds + + _PDFPageRef = CGPDFDocumentGetPage(_PDFDocRef, page); // Get page + + if (_PDFPageRef != NULL) // Check for non-NULL CGPDFPageRef + { + CGPDFPageRetain(_PDFPageRef); // Retain the PDF page + + CGRect cropBoxRect = CGPDFPageGetBoxRect(_PDFPageRef, kCGPDFCropBox); + CGRect mediaBoxRect = CGPDFPageGetBoxRect(_PDFPageRef, kCGPDFMediaBox); + CGRect effectiveRect = CGRectIntersection(cropBoxRect, mediaBoxRect); + + _pageAngle = CGPDFPageGetRotationAngle(_PDFPageRef); // Angle + + switch (_pageAngle) // Page rotation angle (in degrees) + { + default: // Default case + case 0: case 180: // 0 and 180 degrees + { + _pageWidth = effectiveRect.size.width; + _pageHeight = effectiveRect.size.height; + _pageOffsetX = effectiveRect.origin.x; + _pageOffsetY = effectiveRect.origin.y; + break; + } + + case 90: case 270: // 90 and 270 degrees + { + _pageWidth = effectiveRect.size.height; + _pageHeight = effectiveRect.size.width; + _pageOffsetX = effectiveRect.origin.y; + _pageOffsetY = effectiveRect.origin.x; + break; + } + } + + NSInteger page_w = _pageWidth; // Integer width + NSInteger page_h = _pageHeight; // Integer height + + if (page_w % 2) page_w--; if (page_h % 2) page_h--; // Even + + viewRect.size = CGSizeMake(page_w, page_h); // View size + } + else // Error out with a diagnostic + { + CGPDFDocumentRelease(_PDFDocRef), _PDFDocRef = NULL; + + NSAssert(NO, @"CGPDFPageRef == NULL"); + } + } + else // Error out with a diagnostic + { + NSAssert(NO, @"CGPDFDocumentRef == NULL"); + } + } + else // Error out with a diagnostic + { + NSAssert(NO, @"fileURL == nil"); + } + + ReaderContentPage *view = [self initWithFrame:viewRect]; + + if (view != nil) [self buildAnnotationLinksList]; + + return view; +} + +- (void)removeFromSuperview +{ + self.layer.delegate = nil; + + //self.layer.contents = nil; + + [super removeFromSuperview]; +} + +- (void)dealloc +{ + CGPDFPageRelease(_PDFPageRef), _PDFPageRef = NULL; + + CGPDFDocumentRelease(_PDFDocRef), _PDFDocRef = NULL; +} + +#if (READER_DISABLE_RETINA == TRUE) // Option + +- (void)didMoveToWindow +{ + self.contentScaleFactor = 1.0f; // Override scale factor +} + +#endif // end of READER_DISABLE_RETINA Option + +#pragma mark - CATiledLayer delegate methods + +- (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context +{ + ReaderContentPage *readerContentPage = self; // Retain self + + CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White + + CGContextFillRect(context, CGContextGetClipBoundingBox(context)); // Fill + + //NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(CGContextGetClipBoundingBox(context))); + + CGContextTranslateCTM(context, 0.0f, self.bounds.size.height); CGContextScaleCTM(context, 1.0f, -1.0f); + + CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(_PDFPageRef, kCGPDFCropBox, self.bounds, 0, true)); + + //CGContextSetRenderingIntent(context, kCGRenderingIntentDefault); CGContextSetInterpolationQuality(context, kCGInterpolationDefault); + + CGContextDrawPDFPage(context, _PDFPageRef); // Render the PDF page into the context + + if (readerContentPage != nil) readerContentPage = nil; // Release self +} + +@end + +#pragma mark - + +// +// ReaderDocumentLink class implementation +// + +@implementation ReaderDocumentLink +{ + CGPDFDictionaryRef _dictionary; + + CGRect _rect; +} + +#pragma mark - Properties + +@synthesize rect = _rect; +@synthesize dictionary = _dictionary; + +#pragma mark - ReaderDocumentLink class methods + ++ (instancetype)newWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary +{ + return [[ReaderDocumentLink alloc] initWithRect:linkRect dictionary:linkDictionary]; +} + +#pragma mark - ReaderDocumentLink instance methods + +- (instancetype)initWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary +{ + if ((self = [super init])) + { + _dictionary = linkDictionary; + + _rect = linkRect; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentTile.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentTile.h new file mode 100755 index 0000000..6c8ba80 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentTile.h @@ -0,0 +1,31 @@ +// +// ReaderContentTile.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import +#import + +@interface ReaderContentTile : CATiledLayer + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentTile.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentTile.m new file mode 100755 index 0000000..b801323 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentTile.m @@ -0,0 +1,71 @@ +// +// ReaderContentTile.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderContentTile.h" + +@implementation ReaderContentTile + +#pragma mark - Constants + +#define LEVELS_OF_DETAIL 16 + +#pragma mark - ReaderContentTile class methods + ++ (CFTimeInterval)fadeDuration +{ + return 0.001; // iOS bug (flickering tiles) workaround +} + +#pragma mark - ReaderContentTile instance methods + +- (instancetype)init +{ + if ((self = [super init])) // Initialize superclass + { + self.levelsOfDetail = LEVELS_OF_DETAIL; // Zoom levels + + self.levelsOfDetailBias = (LEVELS_OF_DETAIL - 1); // Bias + + UIScreen *mainScreen = [UIScreen mainScreen]; // Main screen + + CGFloat screenScale = [mainScreen scale]; // Main screen scale + + CGRect screenBounds = [mainScreen bounds]; // Main screen bounds + + CGFloat w_pixels = (screenBounds.size.width * screenScale); + + CGFloat h_pixels = (screenBounds.size.height * screenScale); + + CGFloat max = ((w_pixels < h_pixels) ? h_pixels : w_pixels); + + CGFloat sizeOfTiles = ((max < 512.0f) ? 512.0f : 1024.0f); + + self.tileSize = CGSizeMake(sizeOfTiles, sizeOfTiles); + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentView.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentView.h new file mode 100755 index 0000000..1738309 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentView.h @@ -0,0 +1,66 @@ +// +// ReaderContentView.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderThumbView.h" + +@class ReaderContentView; +@class ReaderContentPage; +@class ReaderContentThumb; + +@protocol ReaderContentViewDelegate + +@required // Delegate protocols + +- (void)contentView:(ReaderContentView *)contentView touchesBegan:(NSSet *)touches; + +@end + +@interface ReaderContentView : UIScrollView + +@property (nonatomic, weak, readwrite) id message; + +- (instancetype)initWithFrame:(CGRect)frame fileURL:(NSURL *)fileURL page:(NSUInteger)page password:(NSString *)phrase; + +- (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase guid:(NSString *)guid; + +- (id)processSingleTap:(UITapGestureRecognizer *)recognizer; + +- (void)zoomIncrement:(UITapGestureRecognizer *)recognizer; +- (void)zoomDecrement:(UITapGestureRecognizer *)recognizer; +- (void)zoomResetAnimated:(BOOL)animated; + +@end + +#pragma mark - + +// +// ReaderContentThumb class interface +// + +@interface ReaderContentThumb : ReaderThumbView + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentView.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentView.m new file mode 100755 index 0000000..d34cb00 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderContentView.m @@ -0,0 +1,402 @@ +// +// ReaderContentView.m +// Reader v2.8.7 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2016 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ReaderContentView.h" +#import "ReaderContentPage.h" +#import "ReaderThumbCache.h" + +#import + +@interface ReaderContentView () + +@end + +@implementation ReaderContentView +{ + UIView *theContainerView; + + UIUserInterfaceIdiom userInterfaceIdiom; + + ReaderContentPage *theContentPage; + + ReaderContentThumb *theThumbView; + + CGFloat realMaximumZoom; + CGFloat tempMaximumZoom; + + BOOL zoomBounced; +} + +#pragma mark - Constants + +#define ZOOM_FACTOR 2.0f +#define ZOOM_MAXIMUM 16.0f + +#define PAGE_THUMB_SMALL 144 +#define PAGE_THUMB_LARGE 240 + +static void *ReaderContentViewContext = &ReaderContentViewContext; + +static CGFloat g_BugFixWidthInset = 0.0f; + +#pragma mark - Properties + +@synthesize message; + +#pragma mark - ReaderContentView functions + +static inline CGFloat zoomScaleThatFits(CGSize target, CGSize source) +{ + CGFloat w_scale = (target.width / (source.width + g_BugFixWidthInset)); + + CGFloat h_scale = (target.height / source.height); + + return ((w_scale < h_scale) ? w_scale : h_scale); +} + +#pragma mark - ReaderContentView class methods + ++ (void)initialize +{ + if (self == [ReaderContentView self]) // Do once - iOS 8.0 UIScrollView bug workaround + { + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Not iPads + { + NSString *iosVersion = [UIDevice currentDevice].systemVersion; // iOS version as a string + + if ([@"8.0" compare:iosVersion options:NSNumericSearch] != NSOrderedDescending) // 8.0 and up + { +// if ([@"8.2" compare:iosVersion options:NSNumericSearch] == NSOrderedDescending) // Below 8.2 +// { + g_BugFixWidthInset = 2.0f * [[UIScreen mainScreen] scale]; // Reduce width of content view +// } + } + } + } +} + +#pragma mark - ReaderContentView instance methods + +- (void)updateMinimumMaximumZoom +{ + CGFloat zoomScale = zoomScaleThatFits(self.bounds.size, theContentPage.bounds.size); + + self.minimumZoomScale = zoomScale; self.maximumZoomScale = (zoomScale * ZOOM_MAXIMUM); + + realMaximumZoom = self.maximumZoomScale; tempMaximumZoom = (realMaximumZoom * ZOOM_FACTOR); +} + +- (void)centerScrollViewContent +{ + CGFloat iw = 0.0f; CGFloat ih = 0.0f; // Content width and height insets + + CGSize boundsSize = self.bounds.size; CGSize contentSize = self.contentSize; // Sizes + + if (contentSize.width < boundsSize.width) iw = ((boundsSize.width - contentSize.width) * 0.5f); + + if (contentSize.height < boundsSize.height) ih = ((boundsSize.height - contentSize.height) * 0.5f); + + UIEdgeInsets insets = UIEdgeInsetsMake(ih, iw, ih, iw); // Create (possibly updated) content insets + + if (UIEdgeInsetsEqualToEdgeInsets(self.contentInset, insets) == false) self.contentInset = insets; +} + +- (instancetype)initWithFrame:(CGRect)frame fileURL:(NSURL *)fileURL page:(NSUInteger)page password:(NSString *)phrase +{ + if ((self = [super initWithFrame:frame])) + { + self.scrollsToTop = NO; + self.delaysContentTouches = NO; + self.showsVerticalScrollIndicator = NO; + self.showsHorizontalScrollIndicator = NO; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + self.backgroundColor = [UIColor clearColor]; + self.autoresizesSubviews = NO; + self.clipsToBounds = NO; + self.delegate = self; + + userInterfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom; // User interface idiom + + theContentPage = [[ReaderContentPage alloc] initWithURL:fileURL page:page password:phrase]; + + if (theContentPage != nil) // Must have a valid and initialized content page + { + theContainerView = [[UIView alloc] initWithFrame:theContentPage.bounds]; + + theContainerView.autoresizesSubviews = NO; + theContainerView.userInteractionEnabled = NO; + theContainerView.contentMode = UIViewContentModeRedraw; + theContainerView.autoresizingMask = UIViewAutoresizingNone; + theContainerView.backgroundColor = [UIColor whiteColor]; + +#if (READER_SHOW_SHADOWS == TRUE) // Option + + theContainerView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f); + theContainerView.layer.shadowRadius = 4.0f; theContainerView.layer.shadowOpacity = 1.0f; + theContainerView.layer.shadowPath = [UIBezierPath bezierPathWithRect:theContainerView.bounds].CGPath; + +#endif // end of READER_SHOW_SHADOWS Option + + self.contentSize = theContentPage.bounds.size; [self centerScrollViewContent]; + +#if (READER_ENABLE_PREVIEW == TRUE) // Option + + theThumbView = [[ReaderContentThumb alloc] initWithFrame:theContentPage.bounds]; // Page thumb view + + [theContainerView addSubview:theThumbView]; // Add the page thumb view to the container view + +#endif // end of READER_ENABLE_PREVIEW Option + + [theContainerView addSubview:theContentPage]; // Add the content page to the container view + + [self addSubview:theContainerView]; // Add the container view to the scroll view + + [self updateMinimumMaximumZoom]; // Update the minimum and maximum zoom scales + + self.zoomScale = self.minimumZoomScale; // Set the zoom scale to fit page content + + [self addObserver:self forKeyPath:@"frame" options:0 context:ReaderContentViewContext]; + } + + self.tag = page; // Tag the view with the page number + } + + return self; +} + +- (void)dealloc +{ + [self removeObserver:self forKeyPath:@"frame" context:ReaderContentViewContext]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if (context == ReaderContentViewContext) // Our context + { + if ((object == self) && [keyPath isEqualToString:@"frame"]) + { + [self centerScrollViewContent]; // Center content + + CGFloat oldMinimumZoomScale = self.minimumZoomScale; + + [self updateMinimumMaximumZoom]; // Update zoom scale limits + + if (self.zoomScale == oldMinimumZoomScale) // Old minimum + { + self.zoomScale = self.minimumZoomScale; + } + else // Check against minimum zoom scale + { + if (self.zoomScale < self.minimumZoomScale) + { + self.zoomScale = self.minimumZoomScale; + } + else // Check against maximum zoom scale + { + if (self.zoomScale > self.maximumZoomScale) + { + self.zoomScale = self.maximumZoomScale; + } + } + } + } + } +} + +- (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase guid:(NSString *)guid +{ +#if (READER_ENABLE_PREVIEW == TRUE) // Option + + CGSize size = ((userInterfaceIdiom == UIUserInterfaceIdiomPad) ? CGSizeMake(PAGE_THUMB_LARGE, PAGE_THUMB_LARGE) : CGSizeMake(PAGE_THUMB_SMALL, PAGE_THUMB_SMALL)); + + ReaderThumbRequest *request = [ReaderThumbRequest newForView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size]; + + UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the page thumb + + if ([image isKindOfClass:[UIImage class]]) [theThumbView showImage:image]; // Show image from cache + +#endif // end of READER_ENABLE_PREVIEW Option +} + +- (id)processSingleTap:(UITapGestureRecognizer *)recognizer +{ + return [theContentPage processSingleTap:recognizer]; +} + +- (CGRect)zoomRectForScale:(CGFloat)scale withCenter:(CGPoint)center +{ + CGRect zoomRect; // Centered zoom rect + + zoomRect.size.width = (self.bounds.size.width / scale); + zoomRect.size.height = (self.bounds.size.height / scale); + + zoomRect.origin.x = (center.x - (zoomRect.size.width * 0.5f)); + zoomRect.origin.y = (center.y - (zoomRect.size.height * 0.5f)); + + return zoomRect; +} + +- (void)zoomIncrement:(UITapGestureRecognizer *)recognizer +{ + CGFloat zoomScale = self.zoomScale; // Current zoom + + CGPoint point = [recognizer locationInView:theContentPage]; + + if (zoomScale < self.maximumZoomScale) // Zoom in + { + zoomScale *= ZOOM_FACTOR; // Zoom in by zoom factor amount + + if (zoomScale > self.maximumZoomScale) zoomScale = self.maximumZoomScale; + + CGRect zoomRect = [self zoomRectForScale:zoomScale withCenter:point]; + + [self zoomToRect:zoomRect animated:YES]; + } + else // Handle fully zoomed in + { + if (zoomBounced == NO) // Zoom bounce + { + self.maximumZoomScale = tempMaximumZoom; + + [self setZoomScale:tempMaximumZoom animated:YES]; + } + else // Zoom all the way out + { + zoomScale = self.minimumZoomScale; + + [self setZoomScale:zoomScale animated:YES]; + } + } +} + +- (void)zoomDecrement:(UITapGestureRecognizer *)recognizer +{ + CGFloat zoomScale = self.zoomScale; // Current zoom + + CGPoint point = [recognizer locationInView:theContentPage]; + + if (zoomScale > self.minimumZoomScale) // Zoom out + { + zoomScale /= ZOOM_FACTOR; // Zoom out by zoom factor amount + + if (zoomScale < self.minimumZoomScale) zoomScale = self.minimumZoomScale; + + CGRect zoomRect = [self zoomRectForScale:zoomScale withCenter:point]; + + [self zoomToRect:zoomRect animated:YES]; + } + else // Handle fully zoomed out + { + zoomScale = self.maximumZoomScale; // Full zoom in + + CGRect zoomRect = [self zoomRectForScale:zoomScale withCenter:point]; + + [self zoomToRect:zoomRect animated:YES]; + } +} + +- (void)zoomResetAnimated:(BOOL)animated +{ + if (self.zoomScale > self.minimumZoomScale) // Reset zoom + { + if (animated) [self setZoomScale:self.minimumZoomScale animated:YES]; else self.zoomScale = self.minimumZoomScale; zoomBounced = NO; + } +} + +#pragma mark - UIScrollViewDelegate methods + +- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView +{ + return theContainerView; +} + +- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale +{ + if (self.zoomScale > realMaximumZoom) // Bounce back to real maximum zoom scale + { + [self setZoomScale:realMaximumZoom animated:YES]; self.maximumZoomScale = realMaximumZoom; zoomBounced = YES; + } + else // Normal scroll view did end zooming + { + if (self.zoomScale < realMaximumZoom) zoomBounced = NO; + } +} + +- (void)scrollViewDidZoom:(UIScrollView *)scrollView +{ + [self centerScrollViewContent]; // Center content +} + +#pragma mark - UIResponder instance methods + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesBegan:touches withEvent:event]; // Message superclass + + [message contentView:self touchesBegan:touches]; // Message delegate +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesCancelled:touches withEvent:event]; // Message superclass +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesEnded:touches withEvent:event]; // Message superclass +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesMoved:touches withEvent:event]; // Message superclass +} + +@end + +#pragma mark - + +// +// ReaderContentThumb class implementation +// + +@implementation ReaderContentThumb + +#pragma mark - ReaderContentThumb instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) // Superclass init + { + imageView.contentMode = UIViewContentModeScaleAspectFill; + + imageView.clipsToBounds = YES; // Needed for aspect fill + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocument.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocument.h new file mode 100755 index 0000000..bb9230f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocument.h @@ -0,0 +1,57 @@ +// +// ReaderDocument.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface ReaderDocument : NSObject + +@property (nonatomic, strong, readonly) NSString *guid; +@property (nonatomic, strong, readonly) NSDate *fileDate; +@property (nonatomic, strong, readwrite) NSDate *lastOpen; +@property (nonatomic, strong, readonly) NSNumber *fileSize; +@property (nonatomic, strong, readonly) NSNumber *pageCount; +@property (nonatomic, strong, readwrite) NSNumber *pageNumber; +@property (nonatomic, strong, readonly) NSMutableIndexSet *bookmarks; +@property (nonatomic, strong, readonly) NSString *password; +@property (nonatomic, strong, readonly) NSString *fileName; +@property (nonatomic, strong, readonly) NSURL *fileURL; + +@property (nonatomic, readonly) BOOL canEmail; +@property (nonatomic, readonly) BOOL canExport; +@property (nonatomic, readonly) BOOL canPrint; + ++ (NSString *)documentsPath; + ++ (ReaderDocument *)withDocumentFilePath:(NSString *)filePath password:(NSString *)phrase; + ++ (ReaderDocument *)unarchiveFromFileName:(NSString *)filePath password:(NSString *)phrase; + +- (instancetype)initWithFilePath:(NSString *)filePath password:(NSString *)phrase; + +- (BOOL)archiveDocumentProperties; + +- (void)updateDocumentProperties; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocument.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocument.m new file mode 100755 index 0000000..5c52a41 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocument.m @@ -0,0 +1,354 @@ +// +// ReaderDocument.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderDocument.h" +#import "CGPDFDocument.h" +#import + +@interface ReaderDocument () + +@property (nonatomic, strong, readwrite) NSString *password; +@property (nonatomic, strong, readwrite) NSString *filePath; + +@end + +@implementation ReaderDocument +{ + NSString *_guid; + + NSDate *_fileDate; + + NSDate *_lastOpen; + + NSNumber *_fileSize; + + NSNumber *_pageCount; + + NSNumber *_pageNumber; + + NSMutableIndexSet *_bookmarks; + + NSString *_password; + + NSString *_fileName; + + NSString *_filePath; + + NSURL *_fileURL; +} + +#pragma mark - Properties + +@synthesize guid = _guid; +@synthesize fileDate = _fileDate; +@synthesize lastOpen = _lastOpen; +@synthesize fileSize = _fileSize; +@synthesize pageCount = _pageCount; +@synthesize pageNumber = _pageNumber; +@synthesize bookmarks = _bookmarks; +@synthesize password = _password; +@synthesize filePath = _filePath; +@dynamic fileName, fileURL; +@dynamic canEmail, canExport, canPrint; + +#pragma mark - ReaderDocument class methods + ++ (NSString *)GUID +{ + CFUUIDRef theUUID = CFUUIDCreate(NULL); + + CFStringRef theString = CFUUIDCreateString(NULL, theUUID); + + NSString *unique = [NSString stringWithString:(__bridge id)theString]; + + CFRelease(theString); CFRelease(theUUID); // Cleanup CF objects + + return unique; +} + ++ (NSString *)documentsPath +{ + NSFileManager *fileManager = [NSFileManager defaultManager]; // Singleton + + NSURL *pathURL = [fileManager URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL]; + + return [pathURL path]; // Path to the application's "~/Documents" directory +} + ++ (NSString *)applicationSupportPath +{ + NSFileManager *fileManager = [NSFileManager defaultManager]; // Singleton + + NSURL *pathURL = [fileManager URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL]; + + return [pathURL path]; // Path to the application's "~/Library/Application Support" directory +} + ++ (NSString *)archiveFilePath:(NSString *)fileName +{ + NSFileManager *fileManager = [NSFileManager defaultManager]; // Singleton + + NSString *applicationSupportPath = [ReaderDocument applicationSupportPath]; // See above + + NSString *archivePath = [applicationSupportPath stringByAppendingPathComponent:@"Reader Metadata"]; + + [fileManager createDirectoryAtPath:archivePath withIntermediateDirectories:NO attributes:nil error:NULL]; + + NSString *archiveName = [[fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"plist"]; + + return [archivePath stringByAppendingPathComponent:archiveName]; // "{archivePath}/'fileName'.plist" +} + ++ (ReaderDocument *)unarchiveFromFileName:(NSString *)filePath password:(NSString *)phrase +{ + ReaderDocument *document = nil; // ReaderDocument object + + NSString *fileName = [filePath lastPathComponent]; // File name only + + NSString *archiveFilePath = [ReaderDocument archiveFilePath:fileName]; + + @try // Unarchive an archived ReaderDocument object from its property list + { + document = [NSKeyedUnarchiver unarchiveObjectWithFile:archiveFilePath]; + + if (document != nil) // Set the document's file path and password properties + { + document.filePath = [filePath copy]; document.password = [phrase copy]; + } + } + @catch (NSException *exception) // Exception handling (just in case O_o) + { + #ifdef DEBUG + NSLog(@"%s Caught %@: %@", __FUNCTION__, [exception name], [exception reason]); + #endif + } + + return document; +} + ++ (ReaderDocument *)withDocumentFilePath:(NSString *)filePath password:(NSString *)phrase +{ + ReaderDocument *document = nil; // ReaderDocument object + + document = [ReaderDocument unarchiveFromFileName:filePath password:phrase]; + + if (document == nil) // Unarchive failed so create a new ReaderDocument object + { + document = [[ReaderDocument alloc] initWithFilePath:filePath password:phrase]; + } + + return document; +} + ++ (BOOL)isPDF:(NSString *)filePath +{ + BOOL state = NO; + + if (filePath != nil) // Must have a file path + { + const char *path = [filePath fileSystemRepresentation]; + + int fd = open(path, O_RDONLY); // Open the file + + if (fd > 0) // We have a valid file descriptor + { + const char sig[1024]; // File signature buffer + + ssize_t len = read(fd, (void *)&sig, sizeof(sig)); + + state = (strnstr(sig, "%PDF", len) != NULL); + + close(fd); // Close the file + } + } + + return state; +} + +#pragma mark - ReaderDocument instance methods + +- (instancetype)initWithFilePath:(NSString *)filePath password:(NSString *)phrase +{ + if ((self = [super init])) // Initialize superclass first + { + if ([ReaderDocument isPDF:filePath] == YES) // Valid PDF + { + _guid = [ReaderDocument GUID]; // Create document's GUID + + _password = [phrase copy]; // Keep copy of document password + + _filePath = [filePath copy]; // Keep copy of document file path + + _pageNumber = [NSNumber numberWithInteger:1]; // Start on page one + + _bookmarks = [NSMutableIndexSet new]; // Bookmarked pages index set + + CFURLRef docURLRef = (__bridge CFURLRef)[self fileURL]; // CFURLRef from NSURL + + CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateUsingUrl(docURLRef, _password); + + if (thePDFDocRef != NULL) // Get the total number of pages in the document + { + NSInteger pageCount = CGPDFDocumentGetNumberOfPages(thePDFDocRef); + + _pageCount = [NSNumber numberWithInteger:pageCount]; + + CGPDFDocumentRelease(thePDFDocRef); // Cleanup + } + else // Cupertino, we have a problem with the document + { + NSAssert(NO, @"CGPDFDocumentRef == NULL"); + } + + _lastOpen = [NSDate dateWithTimeIntervalSinceReferenceDate:0.0]; + + NSFileManager *fileManager = [NSFileManager defaultManager]; // Singleton + + NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:_filePath error:NULL]; + + _fileDate = [fileAttributes objectForKey:NSFileModificationDate]; // File date + + _fileSize = [fileAttributes objectForKey:NSFileSize]; // File size (bytes) + + [self archiveDocumentProperties]; // Archive ReaderDocument object + } + else // Not a valid PDF file + { + self = nil; + } + } + + return self; +} + +- (NSString *)fileName +{ + if (_fileName == nil) _fileName = [_filePath lastPathComponent]; + + return _fileName; +} + +- (NSURL *)fileURL +{ + if (_fileURL == nil) _fileURL = [[NSURL alloc] initFileURLWithPath:_filePath isDirectory:NO]; + + return _fileURL; +} + +- (BOOL)canEmail +{ + return YES; +} + +- (BOOL)canExport +{ + return YES; +} + +- (BOOL)canPrint +{ + return YES; +} + +- (BOOL)archiveDocumentProperties +{ + NSString *archiveFilePath = [ReaderDocument archiveFilePath:[self fileName]]; + + return [NSKeyedArchiver archiveRootObject:self toFile:archiveFilePath]; +} + +- (void)updateDocumentProperties +{ + CFURLRef docURLRef = (__bridge CFURLRef)[self fileURL]; // CFURLRef from NSURL + + CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateUsingUrl(docURLRef, _password); + + if (thePDFDocRef != NULL) // Get the total number of pages in the document + { + NSInteger pageCount = CGPDFDocumentGetNumberOfPages(thePDFDocRef); + + _pageCount = [NSNumber numberWithInteger:pageCount]; + + CGPDFDocumentRelease(thePDFDocRef); // Cleanup + } + + NSFileManager *fileManager = [NSFileManager defaultManager]; // Singleton + + NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:_filePath error:NULL]; + + _fileDate = [fileAttributes objectForKey:NSFileModificationDate]; // File date + + _fileSize = [fileAttributes objectForKey:NSFileSize]; // File size (bytes) +} + +#pragma mark - NSCoding protocol methods + +- (void)encodeWithCoder:(NSCoder *)encoder +{ + [encoder encodeObject:_guid forKey:@"FileGUID"]; + + [encoder encodeObject:_fileDate forKey:@"FileDate"]; + + [encoder encodeObject:_pageCount forKey:@"PageCount"]; + + [encoder encodeObject:_pageNumber forKey:@"PageNumber"]; + + [encoder encodeObject:_bookmarks forKey:@"Bookmarks"]; + + [encoder encodeObject:_fileSize forKey:@"FileSize"]; + + [encoder encodeObject:_lastOpen forKey:@"LastOpen"]; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder +{ + if ((self = [super init])) // Superclass init + { + _guid = [decoder decodeObjectForKey:@"FileGUID"]; + + _fileDate = [decoder decodeObjectForKey:@"FileDate"]; + + _pageCount = [decoder decodeObjectForKey:@"PageCount"]; + + _pageNumber = [decoder decodeObjectForKey:@"PageNumber"]; + + _bookmarks = [decoder decodeObjectForKey:@"Bookmarks"]; + + _fileSize = [decoder decodeObjectForKey:@"FileSize"]; + + _lastOpen = [decoder decodeObjectForKey:@"LastOpen"]; + + if (_guid == nil) _guid = [ReaderDocument GUID]; + + if (_bookmarks != nil) + _bookmarks = [_bookmarks mutableCopy]; + else + _bookmarks = [NSMutableIndexSet new]; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocumentOutline.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocumentOutline.h new file mode 100755 index 0000000..7fecc39 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocumentOutline.h @@ -0,0 +1,45 @@ +// +// ReaderDocumentOutline.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2012-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface ReaderDocumentOutline : NSObject + ++ (NSArray *)outlineFromFileURL:(NSURL *)fileURL password:(NSString *)phrase; + ++ (void)logDocumentOutlineArray:(NSArray *)array; + +@end + +@interface DocumentOutlineEntry : NSObject + ++ (instancetype)newWithTitle:(NSString *)title target:(id)target level:(NSInteger)level; + +@property (nonatomic, assign, readonly) NSInteger level; +@property (nonatomic, strong, readwrite) NSMutableArray *children; +@property (nonatomic, strong, readonly) NSString *title; +@property (nonatomic, strong, readonly) id target; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocumentOutline.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocumentOutline.m new file mode 100755 index 0000000..2c94ff1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderDocumentOutline.m @@ -0,0 +1,467 @@ +// +// ReaderDocumentOutline.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2012-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderDocumentOutline.h" +#import "CGPDFDocument.h" + +@implementation ReaderDocumentOutline + +#pragma mark - Build option flags + +#define HIERARCHICAL_OUTLINE TRUE + +#pragma mark - ReaderDocumentOutline functions + +void logDictionaryEntry(const char *key, CGPDFObjectRef object, void *info) +{ + //CGPDFDictionaryApplyFunction(dictionary, logDictionaryEntry, NULL); + + NSString *kind = nil; // CGPDFObject type + + CGPDFObjectType type = CGPDFObjectGetType(object); + + switch (type) // CGPDFObjectTypes + { + case kCGPDFObjectTypeNull: + kind = @"CGPDFObjectTypeNull"; + NSLog(@"%s %@", key, kind); + break; + + case kCGPDFObjectTypeBoolean: + kind = @"CGPDFObjectTypeBoolean"; + NSLog(@"%s %@", key, kind); + break; + + case kCGPDFObjectTypeInteger: + kind = @"CGPDFObjectTypeInteger"; + NSLog(@"%s %@", key, kind); + break; + + case kCGPDFObjectTypeReal: + kind = @"CGPDFObjectTypeReal"; + NSLog(@"%s %@", key, kind); + break; + + case kCGPDFObjectTypeName: + { + kind = @"CGPDFObjectTypeName"; const char *pdfName = NULL; + + if (CGPDFObjectGetValue(object, kCGPDFObjectTypeName, &pdfName)) + { + if (pdfName != NULL) NSLog(@"%s %@ %s", key, kind, pdfName); + } + break; + } + + case kCGPDFObjectTypeString: + { + kind = @"CGPDFObjectTypeString"; CGPDFStringRef pdfString = NULL; + + if (CGPDFObjectGetValue(object, kCGPDFObjectTypeString, &pdfString)) + { + const unsigned char *string = CGPDFStringGetBytePtr(pdfString); + + if (string != NULL) NSLog(@"%s %@ %s", key, kind, string); + } + break; + } + + case kCGPDFObjectTypeArray: + kind = @"CGPDFObjectTypeArray"; + NSLog(@"%s %@", key, kind); + break; + + case kCGPDFObjectTypeDictionary: + kind = @"CGPDFObjectTypeDictionary"; + NSLog(@"%s %@", key, kind); + break; + + case kCGPDFObjectTypeStream: + kind = @"CGPDFObjectTypeStream"; + NSLog(@"%s %@", key, kind); + break; + } +} + +#pragma mark - ReaderDocumentOutline class methods + ++ (void)logDocumentOutlineArray:(NSArray *)array +{ + for (DocumentOutlineEntry *item in array) // Enumerate array entries + { + NSInteger indent = (item.level * 2); // Indent amount for NSLog output + + NSLog(@"%@%@", [@"" stringByPaddingToLength:indent withString:@" " startingAtIndex:0], item); + + [self logDocumentOutlineArray:item.children]; // Log any child entries + } +} + ++ (CGPDFArrayRef)destinationWithName:(const char *)destinationName inDestsTree:(CGPDFDictionaryRef)node +{ + CGPDFArrayRef destinationArray = NULL; + + CGPDFArrayRef limitsArray = NULL; // Limits array + + if (CGPDFDictionaryGetArray(node, "Limits", &limitsArray) == true) + { + CGPDFStringRef lowerLimit = NULL; CGPDFStringRef upperLimit = NULL; + + if (CGPDFArrayGetString(limitsArray, 0, &lowerLimit) == true) // Lower limit + { + if (CGPDFArrayGetString(limitsArray, 1, &upperLimit) == true) // Upper limit + { + const char *ll = (const char *)CGPDFStringGetBytePtr(lowerLimit); // Lower string + const char *ul = (const char *)CGPDFStringGetBytePtr(upperLimit); // Upper string + + if ((strcmp(destinationName, ll) < 0) || (strcmp(destinationName, ul) > 0)) + { + return NULL; // Destination name is outside this node's limits + } + } + } + } + + CGPDFArrayRef namesArray = NULL; // Names array + + if (CGPDFDictionaryGetArray(node, "Names", &namesArray) == true) + { + NSInteger namesCount = CGPDFArrayGetCount(namesArray); + + for (NSInteger index = 0; index < namesCount; index += 2) + { + CGPDFStringRef destName; // Destination name string + + if (CGPDFArrayGetString(namesArray, index, &destName) == true) + { + const char *dn = (const char *)CGPDFStringGetBytePtr(destName); + + if (strcmp(dn, destinationName) == 0) // Found the destination name + { + if (CGPDFArrayGetArray(namesArray, (index + 1), &destinationArray) == false) + { + CGPDFDictionaryRef destinationDictionary = NULL; // Destination dictionary + + if (CGPDFArrayGetDictionary(namesArray, (index + 1), &destinationDictionary) == true) + { + CGPDFDictionaryGetArray(destinationDictionary, "D", &destinationArray); + } + } + + return destinationArray; // Return the destination array + } + } + } + } + + CGPDFArrayRef kidsArray = NULL; // Kids array + + if (CGPDFDictionaryGetArray(node, "Kids", &kidsArray) == true) + { + NSInteger kidsCount = CGPDFArrayGetCount(kidsArray); + + for (NSInteger index = 0; index < kidsCount; index++) + { + CGPDFDictionaryRef kidNode = NULL; // Kid node dictionary + + if (CGPDFArrayGetDictionary(kidsArray, index, &kidNode) == true) // Recurse into node + { + destinationArray = [self destinationWithName:destinationName inDestsTree:kidNode]; + + if (destinationArray != NULL) return destinationArray; // Return destination array + } + } + } + + return NULL; +} + ++ (id)outlineEntryTarget:(CGPDFDictionaryRef)outlineDictionary document:(CGPDFDocumentRef)document +{ + id entryTarget = nil; // Entry target object + + CGPDFStringRef destName = NULL; const char *destString = NULL; + + CGPDFDictionaryRef actionDictionary = NULL; CGPDFArrayRef destArray = NULL; + + if (CGPDFDictionaryGetDictionary(outlineDictionary, "A", &actionDictionary) == true) + { + const char *actionType = NULL; // Outline entry action type string + + if (CGPDFDictionaryGetName(actionDictionary, "S", &actionType) == true) + { + if (strcmp(actionType, "GoTo") == 0) // GoTo action type + { + if (CGPDFDictionaryGetArray(actionDictionary, "D", &destArray) == false) + { + CGPDFDictionaryGetString(actionDictionary, "D", &destName); + } + } + else // Handle other entry action type possibility + { + if (strcmp(actionType, "URI") == 0) // URI action type + { + CGPDFStringRef uriString = NULL; // Action's URI string + + if (CGPDFDictionaryGetString(actionDictionary, "URI", &uriString) == true) + { + const char *uri = (const char *)CGPDFStringGetBytePtr(uriString); // Destination URI string + + entryTarget = [NSURL URLWithString:[NSString stringWithCString:uri encoding:NSASCIIStringEncoding]]; + } + } + } + } + } + else // Handle other entry target possibilities + { + if (CGPDFDictionaryGetArray(outlineDictionary, "Dest", &destArray) == false) + { + if (CGPDFDictionaryGetString(outlineDictionary, "Dest", &destName) == false) + { + CGPDFDictionaryGetName(outlineDictionary, "Dest", &destString); + } + } + } + + if (destName != NULL) // Handle a destination name + { + CGPDFDictionaryRef catalogDictionary = CGPDFDocumentGetCatalog(document); + + CGPDFDictionaryRef namesDictionary = NULL; // Destination names in the document + + if (CGPDFDictionaryGetDictionary(catalogDictionary, "Names", &namesDictionary) == true) + { + CGPDFDictionaryRef destsDictionary = NULL; // Document destinations dictionary + + if (CGPDFDictionaryGetDictionary(namesDictionary, "Dests", &destsDictionary) == true) + { + const char *destinationName = (const char *)CGPDFStringGetBytePtr(destName); // Name + + destArray = [self destinationWithName:destinationName inDestsTree:destsDictionary]; + } + } + } + + if (destString != NULL) // Handle a destination string + { + CGPDFDictionaryRef catalogDictionary = CGPDFDocumentGetCatalog(document); + + CGPDFDictionaryRef destsDictionary = NULL; // Document destinations dictionary + + if (CGPDFDictionaryGetDictionary(catalogDictionary, "Dests", &destsDictionary) == true) + { + CGPDFDictionaryRef targetDictionary = NULL; // Destination target dictionary + + if (CGPDFDictionaryGetDictionary(destsDictionary, destString, &targetDictionary) == true) + { + CGPDFDictionaryGetArray(targetDictionary, "D", &destArray); + } + } + } + + if (destArray != NULL) // Handle a destination array + { + NSInteger targetPageNumber = 0; // The target page number + + CGPDFDictionaryRef pageDictionaryFromDestArray = NULL; // Target reference + + if (CGPDFArrayGetDictionary(destArray, 0, &pageDictionaryFromDestArray) == true) + { + NSInteger pageCount = CGPDFDocumentGetNumberOfPages(document); // Pages + + for (NSInteger pageNumber = 1; pageNumber <= pageCount; pageNumber++) + { + CGPDFPageRef pageRef = CGPDFDocumentGetPage(document, pageNumber); + + CGPDFDictionaryRef pageDictionaryFromPage = CGPDFPageGetDictionary(pageRef); + + if (pageDictionaryFromPage == pageDictionaryFromDestArray) // Found it + { + targetPageNumber = pageNumber; break; + } + } + } + else // Try page number from array possibility + { + CGPDFInteger pageNumber = 0; // Page number in array + + if (CGPDFArrayGetInteger(destArray, 0, &pageNumber) == true) + { + targetPageNumber = (pageNumber + 1); // 1-based + } + } + + if (targetPageNumber > 0) // We have a target page number + { + entryTarget = [NSNumber numberWithInteger:targetPageNumber]; + } + } + + return entryTarget; +} + ++ (void)outlineItems:(CGPDFDictionaryRef)outlineDictionary document:(CGPDFDocumentRef)document array:(NSMutableArray *)array level:(NSInteger)level +{ + do // Loop through current level outline entries + { + DocumentOutlineEntry *outlineEntry = nil; // An entry + + CGPDFStringRef string = NULL; // Outline entry title string + + if (CGPDFDictionaryGetString(outlineDictionary, "Title", &string) == true) + { + CFStringRef title = NULL; // Actual outline title (CFObject) string + + if ((title = CGPDFStringCopyTextString(string)) != NULL) // Copy of CFObject string + { + NSString *titleString = (__bridge NSString *)title; // CFString to NSString toll-free bridge cast + + id entryTarget = [self outlineEntryTarget:outlineDictionary document:document]; // Get target object + + NSString *trimmed = [titleString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + + outlineEntry = [DocumentOutlineEntry newWithTitle:trimmed target:entryTarget level:level]; // New entry + + [array addObject:outlineEntry]; CFRelease(title); // Add new entry and cleanup + } + } + + if (outlineEntry != nil) // Must have a current outline entry + { + CGPDFDictionaryRef childItem = NULL; // First child outline item + + if (CGPDFDictionaryGetDictionary(outlineDictionary, "First", &childItem) == true) + { +#if (HIERARCHICAL_OUTLINE == TRUE) // Option + NSMutableArray *childArray = [NSMutableArray array]; outlineEntry.children = childArray; + + [self outlineItems:childItem document:document array:childArray level:(level + 1)]; +#else // Flat + [self outlineItems:childItem document:document array:array level:(level + 1)]; + +#endif // end of HIERARCHICAL_OUTLINE Option + } + } + + } while (CGPDFDictionaryGetDictionary(outlineDictionary, "Next", &outlineDictionary) == true); +} + ++ (NSArray *)outlineFromFileURL:(NSURL *)fileURL password:(NSString *)phrase +{ + NSMutableArray *outlineArray = nil; // Mutable outline array + + if ((fileURL != nil) && [fileURL isFileURL]) // Check for valid file URL + { + CGPDFDocumentRef document = CGPDFDocumentCreateUsingUrl((__bridge CFURLRef)fileURL, phrase); + + if (document != NULL) // Check for non-NULL CGPDFDocumentRef + { + CGPDFDictionaryRef outlines = NULL; // Document's outlines + + CGPDFDictionaryRef catalog = CGPDFDocumentGetCatalog(document); + + if (CGPDFDictionaryGetDictionary(catalog, "Outlines", &outlines) == true) + { + CGPDFDictionaryRef firstItem = NULL; // First outline item entry + + if (CGPDFDictionaryGetDictionary(outlines, "First", &firstItem) == true) + { + outlineArray = [NSMutableArray array]; // Top level outline entries array + + [self outlineItems:firstItem document:document array:outlineArray level:0]; + } + } + + CGPDFDocumentRelease(document); // Cleanup + } + } + + //[self logDocumentOutlineArray:outlineArray]; // Log it + + return [outlineArray copy]; // NSArray +} + +@end + +#pragma mark - + +// +// DocumentOutlineEntry class implementation +// + +@interface DocumentOutlineEntry () + +@property (nonatomic, assign, readwrite) NSInteger level; +@property (nonatomic, strong, readwrite) NSString *title; +@property (nonatomic, strong, readwrite) id target; + +@end + +@implementation DocumentOutlineEntry +{ + NSInteger _level; + + NSMutableArray *_children; + + NSString *_title; + + id _target; +} + +#pragma mark - Properties + +@synthesize level = _level; +@synthesize children = _children; +@synthesize target = _target; +@synthesize title = _title; + +#pragma mark - DocumentOutlineEntry class methods + ++ (instancetype)newWithTitle:(NSString *)title target:(id)target level:(NSInteger)level +{ + return [[DocumentOutlineEntry alloc] initWithTitle:title target:target level:level]; +} + +#pragma mark - DocumentOutlineEntry instance methods + +- (instancetype)initWithTitle:(NSString *)title target:(id)target level:(NSInteger)level +{ + if ((self = [super init])) + { + self.title = title; self.target = target; self.level = level; + } + + return self; +} + +- (NSString *)description +{ + NSString *format = @"%@ Title = '%@', Target = '%@', Level = (%i)"; + + return [[NSString alloc] initWithFormat:format, [super description], _title, _target, _level]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainPagebar.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainPagebar.h new file mode 100755 index 0000000..0c8a135 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainPagebar.h @@ -0,0 +1,88 @@ +// +// ReaderMainPagebar.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderThumbView.h" + +@class ReaderMainPagebar; +@class ReaderTrackControl; +@class ReaderPagebarThumb; +@class ReaderDocument; + +@protocol ReaderMainPagebarDelegate + +@required // Delegate protocols + +- (void)pagebar:(ReaderMainPagebar *)pagebar gotoPage:(NSInteger)page; + +@end + +@interface ReaderMainPagebar : UIView + +@property (nonatomic, weak, readwrite) id delegate; + +- (instancetype)initWithFrame:(CGRect)frame document:(ReaderDocument *)object; + +- (void)updatePagebar; + +- (void)hidePagebar; +- (void)showPagebar; + +@end + +#pragma mark - + +// +// ReaderTrackControl class interface +// + +@interface ReaderTrackControl : UIControl + +@property (nonatomic, assign, readonly) CGFloat value; + +@end + +#pragma mark - + +// +// ReaderPagebarThumb class interface +// + +@interface ReaderPagebarThumb : ReaderThumbView + +- (instancetype)initWithFrame:(CGRect)frame small:(BOOL)small; + +@end + +#pragma mark - + +// +// ReaderPagebarShadow class interface +// + +@interface ReaderPagebarShadow : UIView + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainPagebar.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainPagebar.m new file mode 100755 index 0000000..5a59345 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainPagebar.m @@ -0,0 +1,642 @@ +// +// ReaderMainPagebar.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ReaderMainPagebar.h" +#import "ReaderThumbCache.h" +#import "ReaderDocument.h" + +#import + +@implementation ReaderMainPagebar +{ + ReaderDocument *document; + + ReaderTrackControl *trackControl; + + NSMutableDictionary *miniThumbViews; + + ReaderPagebarThumb *pageThumbView; + + UILabel *pageNumberLabel; + + UIView *pageNumberView; + + NSTimer *enableTimer; + NSTimer *trackTimer; +} + +#pragma mark - Constants + +#define THUMB_SMALL_GAP 2 +#define THUMB_SMALL_WIDTH 22 +#define THUMB_SMALL_HEIGHT 28 + +#define THUMB_LARGE_WIDTH 32 +#define THUMB_LARGE_HEIGHT 42 + +#define PAGE_NUMBER_WIDTH 96.0f +#define PAGE_NUMBER_HEIGHT 30.0f + +#define PAGE_NUMBER_SPACE_SMALL 16.0f +#define PAGE_NUMBER_SPACE_LARGE 32.0f + +#define SHADOW_HEIGHT 4.0f + +#pragma mark - Properties + +@synthesize delegate; + +#pragma mark - ReaderMainPagebar class methods + ++ (Class)layerClass +{ +#if (READER_FLAT_UI == FALSE) // Option + return [CAGradientLayer class]; +#else + return [CALayer class]; +#endif // end of READER_FLAT_UI Option +} + +#pragma mark - ReaderMainPagebar instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + return [self initWithFrame:frame document:nil]; +} + +- (void)updatePageThumbView:(NSInteger)page +{ + NSInteger pages = [document.pageCount integerValue]; + + if (pages > 1) // Only update frame if more than one page + { + CGFloat controlWidth = trackControl.bounds.size.width; + + CGFloat useableWidth = (controlWidth - THUMB_LARGE_WIDTH); + + CGFloat stride = (useableWidth / (pages - 1)); // Page stride + + NSInteger X = (stride * (page - 1)); CGFloat pageThumbX = X; + + CGRect pageThumbRect = pageThumbView.frame; // Current frame + + if (pageThumbX != pageThumbRect.origin.x) // Only if different + { + pageThumbRect.origin.x = pageThumbX; // The new X position + + pageThumbView.frame = pageThumbRect; // Update the frame + } + } + + if (page != pageThumbView.tag) // Only if page number changed + { + pageThumbView.tag = page; [pageThumbView reuse]; // Reuse the thumb view + + CGSize size = CGSizeMake(THUMB_LARGE_WIDTH, THUMB_LARGE_HEIGHT); // Maximum thumb size + + NSURL *fileURL = document.fileURL; NSString *guid = document.guid; NSString *phrase = document.password; + + ReaderThumbRequest *request = [ReaderThumbRequest newForView:pageThumbView fileURL:fileURL password:phrase guid:guid page:page size:size]; + + UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the thumb + + UIImage *thumb = ([image isKindOfClass:[UIImage class]] ? image : nil); [pageThumbView showImage:thumb]; + } +} + +- (void)updatePageNumberText:(NSInteger)page +{ + if (page != pageNumberLabel.tag) // Only if page number changed + { + NSInteger pages = [document.pageCount integerValue]; // Total pages + + NSString *format = NSLocalizedString(@"%i of %i", @"format"); // Format + + NSString *number = [[NSString alloc] initWithFormat:format, (int)page, (int)pages]; + + pageNumberLabel.text = number; // Update the page number label text + + pageNumberLabel.tag = page; // Update the last page number tag + } +} + +- (instancetype)initWithFrame:(CGRect)frame document:(ReaderDocument *)object +{ + assert(object != nil); // Must have a valid ReaderDocument + + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = YES; + self.userInteractionEnabled = YES; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; + + if ([self.layer isKindOfClass:[CAGradientLayer class]]) + { + self.backgroundColor = [UIColor clearColor]; + + CAGradientLayer *layer = (CAGradientLayer *)self.layer; + UIColor *liteColor = [UIColor colorWithWhite:0.82f alpha:0.8f]; + UIColor *darkColor = [UIColor colorWithWhite:0.32f alpha:0.8f]; + layer.colors = [NSArray arrayWithObjects:(id)liteColor.CGColor, (id)darkColor.CGColor, nil]; + + CGRect shadowRect = self.bounds; shadowRect.size.height = SHADOW_HEIGHT; shadowRect.origin.y -= shadowRect.size.height; + + ReaderPagebarShadow *shadowView = [[ReaderPagebarShadow alloc] initWithFrame:shadowRect]; + + [self addSubview:shadowView]; // Add shadow to toolbar + } + else // Follow The Fuglyosity of Flat Fad + { + self.backgroundColor = [UIColor colorWithWhite:0.94f alpha:0.94f]; + + CGRect lineRect = self.bounds; lineRect.size.height = 1.0f; lineRect.origin.y -= lineRect.size.height; + + UIView *lineView = [[UIView alloc] initWithFrame:lineRect]; + lineView.autoresizesSubviews = NO; + lineView.userInteractionEnabled = NO; + lineView.contentMode = UIViewContentModeRedraw; + lineView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + lineView.backgroundColor = [UIColor colorWithWhite:0.64f alpha:0.94f]; + [self addSubview:lineView]; + } + + CGFloat space = (([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? PAGE_NUMBER_SPACE_LARGE : PAGE_NUMBER_SPACE_SMALL); + CGFloat numberY = (0.0f - (PAGE_NUMBER_HEIGHT + space)); CGFloat numberX = ((self.bounds.size.width - PAGE_NUMBER_WIDTH) * 0.5f); + CGRect numberRect = CGRectMake(numberX, numberY, PAGE_NUMBER_WIDTH, PAGE_NUMBER_HEIGHT); + + pageNumberView = [[UIView alloc] initWithFrame:numberRect]; // Page numbers view + + pageNumberView.autoresizesSubviews = NO; + pageNumberView.userInteractionEnabled = NO; + pageNumberView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + pageNumberView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.4f]; + + pageNumberView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f); + pageNumberView.layer.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.6f].CGColor; + pageNumberView.layer.shadowPath = [UIBezierPath bezierPathWithRect:pageNumberView.bounds].CGPath; + pageNumberView.layer.shadowRadius = 2.0f; pageNumberView.layer.shadowOpacity = 1.0f; + + CGRect textRect = CGRectInset(pageNumberView.bounds, 4.0f, 2.0f); // Inset the text a bit + + pageNumberLabel = [[UILabel alloc] initWithFrame:textRect]; // Page numbers label + + pageNumberLabel.autoresizesSubviews = NO; + pageNumberLabel.autoresizingMask = UIViewAutoresizingNone; + pageNumberLabel.textAlignment = NSTextAlignmentCenter; + pageNumberLabel.backgroundColor = [UIColor clearColor]; + pageNumberLabel.textColor = [UIColor whiteColor]; + pageNumberLabel.font = [UIFont systemFontOfSize:16.0f]; + pageNumberLabel.shadowOffset = CGSizeMake(0.0f, 1.0f); + pageNumberLabel.shadowColor = [UIColor blackColor]; + pageNumberLabel.adjustsFontSizeToFitWidth = YES; + pageNumberLabel.minimumScaleFactor = 0.75f; + + [pageNumberView addSubview:pageNumberLabel]; // Add label view + + [self addSubview:pageNumberView]; // Add page numbers display view + + trackControl = [[ReaderTrackControl alloc] initWithFrame:self.bounds]; // Track control view + + [trackControl addTarget:self action:@selector(trackViewTouchDown:) forControlEvents:UIControlEventTouchDown]; + [trackControl addTarget:self action:@selector(trackViewValueChanged:) forControlEvents:UIControlEventValueChanged]; + [trackControl addTarget:self action:@selector(trackViewTouchUp:) forControlEvents:UIControlEventTouchUpOutside]; + [trackControl addTarget:self action:@selector(trackViewTouchUp:) forControlEvents:UIControlEventTouchUpInside]; + + [self addSubview:trackControl]; // Add the track control and thumbs view + + document = object; // Retain the document object for our use + + [self updatePageNumberText:[document.pageNumber integerValue]]; + + miniThumbViews = [NSMutableDictionary new]; // Small thumbs + } + + return self; +} + +- (void)removeFromSuperview +{ + [trackTimer invalidate]; [enableTimer invalidate]; + + [super removeFromSuperview]; +} + +- (void)layoutSubviews +{ + CGRect controlRect = CGRectInset(self.bounds, 4.0f, 0.0f); + + CGFloat thumbWidth = (THUMB_SMALL_WIDTH + THUMB_SMALL_GAP); + + NSInteger thumbs = (controlRect.size.width / thumbWidth); + + NSInteger pages = [document.pageCount integerValue]; // Pages + + if (thumbs > pages) thumbs = pages; // No more than total pages + + CGFloat controlWidth = ((thumbs * thumbWidth) - THUMB_SMALL_GAP); + + controlRect.size.width = controlWidth; // Update control width + + CGFloat widthDelta = (self.bounds.size.width - controlWidth); + + NSInteger X = (widthDelta * 0.5f); controlRect.origin.x = X; + + trackControl.frame = controlRect; // Update track control frame + + if (pageThumbView == nil) // Create the page thumb view when needed + { + CGFloat heightDelta = (controlRect.size.height - THUMB_LARGE_HEIGHT); + + NSInteger thumbY = (heightDelta * 0.5f); NSInteger thumbX = 0; // Thumb X, Y + + CGRect thumbRect = CGRectMake(thumbX, thumbY, THUMB_LARGE_WIDTH, THUMB_LARGE_HEIGHT); + + pageThumbView = [[ReaderPagebarThumb alloc] initWithFrame:thumbRect]; // Create the thumb view + + pageThumbView.layer.zPosition = 1.0f; // Z position so that it sits on top of the small thumbs + + [trackControl addSubview:pageThumbView]; // Add as the first subview of the track control + } + + [self updatePageThumbView:[document.pageNumber integerValue]]; // Update page thumb view + + NSInteger strideThumbs = (thumbs - 1); if (strideThumbs < 1) strideThumbs = 1; + + CGFloat stride = ((CGFloat)pages / (CGFloat)strideThumbs); // Page stride + + CGFloat heightDelta = (controlRect.size.height - THUMB_SMALL_HEIGHT); + + NSInteger thumbY = (heightDelta * 0.5f); NSInteger thumbX = 0; // Initial X, Y + + CGRect thumbRect = CGRectMake(thumbX, thumbY, THUMB_SMALL_WIDTH, THUMB_SMALL_HEIGHT); + + NSMutableDictionary *thumbsToHide = [miniThumbViews mutableCopy]; + + for (NSInteger thumb = 0; thumb < thumbs; thumb++) // Iterate through needed thumbs + { + NSInteger page = ((stride * thumb) + 1); if (page > pages) page = pages; // Page + + NSNumber *key = [NSNumber numberWithInteger:page]; // Page number key for thumb view + + ReaderPagebarThumb *smallThumbView = [miniThumbViews objectForKey:key]; // Thumb view + + if (smallThumbView == nil) // We need to create a new small thumb view for the page number + { + CGSize size = CGSizeMake(THUMB_SMALL_WIDTH, THUMB_SMALL_HEIGHT); // Maximum thumb size + + NSURL *fileURL = document.fileURL; NSString *guid = document.guid; NSString *phrase = document.password; + + smallThumbView = [[ReaderPagebarThumb alloc] initWithFrame:thumbRect small:YES]; // Create a small thumb view + + ReaderThumbRequest *thumbRequest = [ReaderThumbRequest newForView:smallThumbView fileURL:fileURL password:phrase guid:guid page:page size:size]; + + UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:thumbRequest priority:NO]; // Request the thumb + + if ([image isKindOfClass:[UIImage class]]) [smallThumbView showImage:image]; // Use thumb image from cache + + [trackControl addSubview:smallThumbView]; [miniThumbViews setObject:smallThumbView forKey:key]; + } + else // Resue existing small thumb view for the page number + { + smallThumbView.hidden = NO; [thumbsToHide removeObjectForKey:key]; + + if (CGRectEqualToRect(smallThumbView.frame, thumbRect) == false) + { + smallThumbView.frame = thumbRect; // Update thumb frame + } + } + + thumbRect.origin.x += thumbWidth; // Next thumb X position + } + + [thumbsToHide enumerateKeysAndObjectsUsingBlock: // Hide unused thumbs + ^(id key, id object, BOOL *stop) + { + ReaderPagebarThumb *thumb = object; thumb.hidden = YES; + } + ]; +} + +- (void)updatePagebarViews +{ + NSInteger page = [document.pageNumber integerValue]; // # + + [self updatePageNumberText:page]; // Update page number text + + [self updatePageThumbView:page]; // Update page thumb view +} + +- (void)updatePagebar +{ + if (self.hidden == NO) // Only if visible + { + [self updatePagebarViews]; // Update views + } +} + +- (void)hidePagebar +{ + if (self.hidden == NO) // Only if visible + { + [UIView animateWithDuration:0.25 delay:0.0 + options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction + animations:^(void) + { + self.alpha = 0.0f; + } + completion:^(BOOL finished) + { + self.hidden = YES; + } + ]; + } +} + +- (void)showPagebar +{ + if (self.hidden == YES) // Only if hidden + { + [self updatePagebarViews]; // Update views first + + [UIView animateWithDuration:0.25 delay:0.0 + options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction + animations:^(void) + { + self.hidden = NO; + self.alpha = 1.0f; + } + completion:NULL + ]; + } +} + +#pragma mark - ReaderTrackControl action methods + +- (void)trackTimerFired:(NSTimer *)timer +{ + [trackTimer invalidate]; trackTimer = nil; // Cleanup timer + + if (trackControl.tag != [document.pageNumber integerValue]) // Only if different + { + [delegate pagebar:self gotoPage:trackControl.tag]; // Go to document page + } +} + +- (void)enableTimerFired:(NSTimer *)timer +{ + [enableTimer invalidate]; enableTimer = nil; // Cleanup timer + + trackControl.userInteractionEnabled = YES; // Enable track control interaction +} + +- (void)restartTrackTimer +{ + if (trackTimer != nil) { [trackTimer invalidate]; trackTimer = nil; } // Invalidate and release previous timer + + trackTimer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(trackTimerFired:) userInfo:nil repeats:NO]; +} + +- (void)startEnableTimer +{ + if (enableTimer != nil) { [enableTimer invalidate]; enableTimer = nil; } // Invalidate and release previous timer + + enableTimer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(enableTimerFired:) userInfo:nil repeats:NO]; +} + +- (NSInteger)trackViewPageNumber:(ReaderTrackControl *)trackView +{ + CGFloat controlWidth = trackView.bounds.size.width; // View width + + CGFloat stride = (controlWidth / [document.pageCount integerValue]); + + NSInteger page = (trackView.value / stride); // Integer page number + + return (page + 1); // + 1 +} + +- (void)trackViewTouchDown:(ReaderTrackControl *)trackView +{ + NSInteger page = [self trackViewPageNumber:trackView]; // Page + + if (page != [document.pageNumber integerValue]) // Only if different + { + [self updatePageNumberText:page]; // Update page number text + + [self updatePageThumbView:page]; // Update page thumb view + + [self restartTrackTimer]; // Start the track timer + } + + trackView.tag = page; // Start page tracking +} + +- (void)trackViewValueChanged:(ReaderTrackControl *)trackView +{ + NSInteger page = [self trackViewPageNumber:trackView]; // Page + + if (page != trackView.tag) // Only if the page number has changed + { + [self updatePageNumberText:page]; // Update page number text + + [self updatePageThumbView:page]; // Update page thumb view + + trackView.tag = page; // Update the page tracking tag + + [self restartTrackTimer]; // Restart the track timer + } +} + +- (void)trackViewTouchUp:(ReaderTrackControl *)trackView +{ + [trackTimer invalidate]; trackTimer = nil; // Cleanup + + if (trackView.tag != [document.pageNumber integerValue]) // Only if different + { + trackView.userInteractionEnabled = NO; // Disable track control interaction + + [delegate pagebar:self gotoPage:trackView.tag]; // Go to document page + + [self startEnableTimer]; // Start track control enable timer + } + + trackView.tag = 0; // Reset page tracking +} + +@end + +#pragma mark - + +// +// ReaderTrackControl class implementation +// + +@implementation ReaderTrackControl +{ + CGFloat _value; +} + +#pragma mark - Properties + +@synthesize value = _value; + +#pragma mark - ReaderTrackControl instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = NO; + self.userInteractionEnabled = YES; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingNone; + self.backgroundColor = [UIColor clearColor]; + self.exclusiveTouch = YES; + } + + return self; +} + +- (CGFloat)limitValue:(CGFloat)valueX +{ + CGFloat minX = self.bounds.origin.x; // 0.0f; + CGFloat maxX = (self.bounds.size.width - 1.0f); + + if (valueX < minX) valueX = minX; // Minimum X + if (valueX > maxX) valueX = maxX; // Maximum X + + return valueX; +} + +#pragma mark - UIControl subclass methods + +- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event +{ + CGPoint point = [touch locationInView:self]; // Touch point + + _value = [self limitValue:point.x]; // Limit control value + + return YES; +} + +- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event +{ + if (self.touchInside == YES) // Only if inside the control + { + CGPoint point = [touch locationInView:touch.view]; // Touch point + + CGFloat x = [self limitValue:point.x]; // Potential new control value + + if (x != _value) // Only if the new value has changed since the last time + { + _value = x; [self sendActionsForControlEvents:UIControlEventValueChanged]; + } + } + + return YES; +} + +- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event +{ + CGPoint point = [touch locationInView:self]; // Touch point + + _value = [self limitValue:point.x]; // Limit control value +} + +@end + +#pragma mark - + +// +// ReaderPagebarThumb class implementation +// + +@implementation ReaderPagebarThumb + +#pragma mark - ReaderPagebarThumb instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + return [self initWithFrame:frame small:NO]; +} + +- (instancetype)initWithFrame:(CGRect)frame small:(BOOL)small +{ + if ((self = [super initWithFrame:frame])) // Superclass init + { + CGFloat value = (small ? 0.6f : 0.7f); // Size based alpha value + + UIColor *background = [UIColor colorWithWhite:0.8f alpha:value]; + + self.backgroundColor = background; imageView.backgroundColor = background; + + imageView.layer.borderColor = [UIColor colorWithWhite:0.4f alpha:0.6f].CGColor; + + imageView.layer.borderWidth = 1.0f; // Give the thumb image view a border + } + + return self; +} + +@end + +#pragma mark - + +// +// ReaderPagebarShadow class implementation +// + +@implementation ReaderPagebarShadow + +#pragma mark - ReaderPagebarShadow class methods + ++ (Class)layerClass +{ + return [CAGradientLayer class]; +} + +#pragma mark - ReaderPagebarShadow instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = NO; + self.userInteractionEnabled = NO; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingFlexibleWidth; + self.backgroundColor = [UIColor clearColor]; + + CAGradientLayer *layer = (CAGradientLayer *)self.layer; + UIColor *blackColor = [UIColor colorWithWhite:0.42f alpha:1.0f]; + UIColor *clearColor = [UIColor colorWithWhite:0.42f alpha:0.0f]; + layer.colors = [NSArray arrayWithObjects:(id)clearColor.CGColor, (id)blackColor.CGColor, nil]; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainToolbar.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainToolbar.h new file mode 100755 index 0000000..caf5438 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainToolbar.h @@ -0,0 +1,57 @@ +// +// ReaderMainToolbar.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "UIXToolbarView.h" + +@class ReaderMainToolbar; +@class ReaderDocument; + +@protocol ReaderMainToolbarDelegate + +@required // Delegate protocols + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar doneButton:(UIButton *)button; +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar thumbsButton:(UIButton *)button; +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar exportButton:(UIButton *)button; +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar printButton:(UIButton *)button; +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar emailButton:(UIButton *)button; +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar markButton:(UIButton *)button; + +@end + +@interface ReaderMainToolbar : UIXToolbarView + +@property (nonatomic, weak, readwrite) id delegate; + +- (instancetype)initWithFrame:(CGRect)frame document:(ReaderDocument *)document; + +- (void)setBookmarkState:(BOOL)state; + +- (void)hideToolbar; +- (void)showToolbar; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainToolbar.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainToolbar.m new file mode 100755 index 0000000..3484ccc --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderMainToolbar.m @@ -0,0 +1,367 @@ +// +// ReaderMainToolbar.m +// Reader v2.9.0 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ReaderMainToolbar.h" +#import "ReaderDocument.h" + +#import + +@implementation ReaderMainToolbar +{ + UIButton *markButton; + + UIImage *markImageN; + UIImage *markImageY; +} + +#pragma mark - Constants + +#define BUTTON_X 8.0f +//#define BUTTON_Y 8.0f +#define BUTTON_Y ((IPHONE_X == YES ) ? 44.0 : 20.0) + +#define BUTTON_SPACE 8.0f +#define BUTTON_HEIGHT 30.0f + +#define BUTTON_FONT_SIZE 15.0f +#define TEXT_BUTTON_PADDING 24.0f + +#define ICON_BUTTON_WIDTH 40.0f + +#define TITLE_FONT_SIZE 19.0f +#define TITLE_HEIGHT 28.0f + +#pragma mark - Properties + +@synthesize delegate; + +#pragma mark - ReaderMainToolbar instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + return [self initWithFrame:frame document:nil]; +} + +- (instancetype)initWithFrame:(CGRect)frame document:(ReaderDocument *)document +{ + assert(document != nil); // Must have a valid ReaderDocument + + if ((self = [super initWithFrame:frame])) + { + CGFloat viewWidth = self.bounds.size.width; // Toolbar view width + +#if (READER_FLAT_UI == TRUE) // Option + UIImage *buttonH = nil; UIImage *buttonN = nil; +#else + UIImage *buttonH = [[UIImage imageNamed:@"Reader-Button-H"] stretchableImageWithLeftCapWidth:5 topCapHeight:0]; + UIImage *buttonN = [[UIImage imageNamed:@"Reader-Button-N"] stretchableImageWithLeftCapWidth:5 topCapHeight:0]; +#endif // end of READER_FLAT_UI Option + + BOOL largeDevice = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); + + const CGFloat buttonSpacing = BUTTON_SPACE; const CGFloat iconButtonWidth = ICON_BUTTON_WIDTH; + + CGFloat titleX = BUTTON_X; CGFloat titleWidth = (viewWidth - (titleX + titleX)); + + CGFloat leftButtonX = BUTTON_X; // Left-side button start X position + +#if (READER_STANDALONE == FALSE) // Option + + UIFont *doneButtonFont = [UIFont systemFontOfSize:BUTTON_FONT_SIZE]; + NSString *doneButtonText = NSLocalizedString(@"Done", @"button text"); +// doneButtonText = T(@"PDF done"); + CGSize doneButtonSize = [doneButtonText sizeWithAttributes:@{NSFontAttributeName : doneButtonFont}]; + CGFloat doneButtonWidth = (ceil(doneButtonSize.width) + TEXT_BUTTON_PADDING); + + UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom]; + doneButton.frame = CGRectMake(leftButtonX, BUTTON_Y, doneButtonWidth, BUTTON_HEIGHT); + [doneButton setTitleColor:[UIColor colorWithWhite:0.0f alpha:1.0f] forState:UIControlStateNormal]; + [doneButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forState:UIControlStateHighlighted]; + [doneButton setTitle:@"取消" forState:UIControlStateNormal]; doneButton.titleLabel.font = doneButtonFont; + [doneButton addTarget:self action:@selector(doneButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + [doneButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; + [doneButton setBackgroundImage:buttonN forState:UIControlStateNormal]; + doneButton.autoresizingMask = UIViewAutoresizingNone; + //doneButton.backgroundColor = [UIColor grayColor]; + doneButton.exclusiveTouch = YES; + + [self addSubview:doneButton]; leftButtonX += (doneButtonWidth + buttonSpacing); + + titleX += (doneButtonWidth + buttonSpacing); titleWidth -= (doneButtonWidth + buttonSpacing); + +#endif // end of READER_STANDALONE Option + +#if (READER_ENABLE_THUMBS == TRUE) // Option + + UIButton *thumbsButton = [UIButton buttonWithType:UIButtonTypeCustom]; + thumbsButton.frame = CGRectMake(leftButtonX, BUTTON_Y, iconButtonWidth, BUTTON_HEIGHT); +// [thumbsButton setImage:[UIImage imageNamed:@"Reader-Thumbs"] forState:UIControlStateNormal]; +// [thumbsButton addTarget:self action:@selector(thumbsButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; +// [thumbsButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; +// [thumbsButton setBackgroundImage:buttonN forState:UIControlStateNormal]; +// thumbsButton.autoresizingMask = UIViewAutoresizingNone; + //thumbsButton.backgroundColor = [UIColor grayColor]; + thumbsButton.exclusiveTouch = YES; + + [self addSubview:thumbsButton]; //leftButtonX += (iconButtonWidth + buttonSpacing); + + titleX += (iconButtonWidth + buttonSpacing); titleWidth -= (iconButtonWidth + buttonSpacing); + +#endif // end of READER_ENABLE_THUMBS Option + + CGFloat rightButtonX = viewWidth; // Right-side buttons start X position + +#if (READER_BOOKMARKS == TRUE) // Option + + rightButtonX -= (iconButtonWidth + buttonSpacing); // Position + + UIButton *flagButton = [UIButton buttonWithType:UIButtonTypeCustom]; + flagButton.frame = CGRectMake(rightButtonX, BUTTON_Y, iconButtonWidth, BUTTON_HEIGHT); + //[flagButton setImage:[UIImage imageNamed:@"Reader-Mark-N"] forState:UIControlStateNormal]; + [flagButton addTarget:self action:@selector(markButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + [flagButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; + [flagButton setBackgroundImage:buttonN forState:UIControlStateNormal]; + flagButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; + //flagButton.backgroundColor = [UIColor grayColor]; + flagButton.exclusiveTouch = YES; + + [self addSubview:flagButton]; titleWidth -= (iconButtonWidth + buttonSpacing); + + markButton = flagButton; markButton.enabled = NO; markButton.tag = NSIntegerMin; + + markImageN = [UIImage imageNamed:@"Reader-Mark-N"]; // N image + markImageY = [UIImage imageNamed:@"Reader-Mark-Y"]; // Y image + +#endif // end of READER_BOOKMARKS Option + + if (document.canEmail == YES) // Document email enabled + { + if ([MFMailComposeViewController canSendMail] == YES) // Can email + { + unsigned long long fileSize = [document.fileSize unsignedLongLongValue]; + + if (fileSize < 15728640ull) // Check attachment size limit (15MB) + { + rightButtonX -= (iconButtonWidth + buttonSpacing); // Next position + + UIButton *emailButton = [UIButton buttonWithType:UIButtonTypeCustom]; + emailButton.frame = CGRectMake(rightButtonX, BUTTON_Y, iconButtonWidth, BUTTON_HEIGHT); + [emailButton setImage:[UIImage imageNamed:@"Reader-Email"] forState:UIControlStateNormal]; + [emailButton addTarget:self action:@selector(emailButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + [emailButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; + [emailButton setBackgroundImage:buttonN forState:UIControlStateNormal]; + emailButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; + //emailButton.backgroundColor = [UIColor grayColor]; + emailButton.exclusiveTouch = YES; + + [self addSubview:emailButton]; titleWidth -= (iconButtonWidth + buttonSpacing); + } + } + } + + if ((document.canPrint == YES) && (document.password == nil)) // Document print enabled + { + Class printInteractionController = NSClassFromString(@"UIPrintInteractionController"); + + if ((printInteractionController != nil) && [printInteractionController isPrintingAvailable]) + { + rightButtonX -= (iconButtonWidth + buttonSpacing); // Next position + + UIButton *printButton = [UIButton buttonWithType:UIButtonTypeCustom]; + printButton.frame = CGRectMake(rightButtonX, BUTTON_Y, iconButtonWidth, BUTTON_HEIGHT); +//// [printButton setImage:[UIImage imageNamed:@"Reader-Print"] forState:UIControlStateNormal]; +// [printButton setTitleColor:[UIColor colorWithWhite:0.0f alpha:1.0f] forState:UIControlStateNormal]; +// [printButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forState:UIControlStateHighlighted]; +// [printButton setTitle:@"保存" forState:UIControlStateNormal]; +// [printButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; +// [printButton addTarget:self action:@selector(exportButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; +// [printButton setBackgroundImage:buttonN forState:UIControlStateNormal]; +// printButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; +// printButton.titleLabel.font = doneButtonFont; +// printButton.exclusiveTouch = YES; + + [self addSubview:printButton]; titleWidth -= (iconButtonWidth + buttonSpacing); + } + } + + if (document.canExport == YES) // Document export enabled + { + rightButtonX -= (iconButtonWidth + buttonSpacing); // Next position + + UIButton *exportButton = [UIButton buttonWithType:UIButtonTypeCustom]; + exportButton.frame = CGRectMake(rightButtonX, BUTTON_Y, iconButtonWidth, BUTTON_HEIGHT); +// [exportButton setImage:[UIImage imageNamed:@"Reader-Export"] forState:UIControlStateNormal]; +// [exportButton addTarget:self action:@selector(printButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + [exportButton addTarget:self action:@selector(exportButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + +// [exportButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; +// [exportButton setBackgroundImage:buttonN forState:UIControlStateNormal]; + [exportButton setTitleColor:[UIColor colorWithWhite:0.0f alpha:1.0f] forState:UIControlStateNormal]; + [exportButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forState:UIControlStateHighlighted]; + [exportButton setTitle:@"保存" forState:UIControlStateNormal]; + exportButton.titleLabel.font = doneButtonFont; + exportButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; + //exportButton.backgroundColor = [UIColor grayColor]; + exportButton.exclusiveTouch = YES; + + [self addSubview:exportButton]; titleWidth -= (iconButtonWidth + buttonSpacing); + } + + if (largeDevice == YES) // Show document filename in toolbar + { + CGRect titleRect = CGRectMake(titleX, BUTTON_Y, titleWidth, TITLE_HEIGHT); + + UILabel *titleLabel = [[UILabel alloc] initWithFrame:titleRect]; + + titleLabel.textAlignment = NSTextAlignmentCenter; + titleLabel.font = [UIFont systemFontOfSize:TITLE_FONT_SIZE]; + titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; + titleLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; + titleLabel.textColor = [UIColor colorWithWhite:0.0f alpha:1.0f]; + titleLabel.backgroundColor = [UIColor clearColor]; + titleLabel.adjustsFontSizeToFitWidth = YES; + titleLabel.minimumScaleFactor = 0.75f; + titleLabel.text = [document.fileName stringByDeletingPathExtension]; +#if (READER_FLAT_UI == FALSE) // Option + titleLabel.shadowColor = [UIColor colorWithWhite:0.75f alpha:1.0f]; + titleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f); +#endif // end of READER_FLAT_UI Option + + [self addSubview:titleLabel]; + } + } + + return self; +} + +- (void)setBookmarkState:(BOOL)state +{ +#if (READER_BOOKMARKS == TRUE) // Option + + if (state != markButton.tag) // Only if different state + { + if (self.hidden == NO) // Only if toolbar is visible + { + UIImage *image = (state ? markImageY : markImageN); + + [markButton setImage:image forState:UIControlStateNormal]; + } + + markButton.tag = state; // Update bookmarked state tag + } + + if (markButton.enabled == NO) markButton.enabled = YES; + +#endif // end of READER_BOOKMARKS Option +} + +- (void)updateBookmarkImage +{ +#if (READER_BOOKMARKS == TRUE) // Option + + if (markButton.tag != NSIntegerMin) // Valid tag + { + BOOL state = markButton.tag; // Bookmarked state + + UIImage *image = (state ? markImageY : markImageN); + + [markButton setImage:image forState:UIControlStateNormal]; + } + + if (markButton.enabled == NO) markButton.enabled = YES; + +#endif // end of READER_BOOKMARKS Option +} + +- (void)hideToolbar +{ + if (self.hidden == NO) + { + [UIView animateWithDuration:0.25 delay:0.0 + options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction + animations:^(void) + { + self.alpha = 0.0f; + } + completion:^(BOOL finished) + { + self.hidden = YES; + } + ]; + } +} + +- (void)showToolbar +{ + if (self.hidden == YES) + { + [self updateBookmarkImage]; // First + + [UIView animateWithDuration:0.25 delay:0.0 + options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction + animations:^(void) + { + self.hidden = NO; + self.alpha = 1.0f; + } + completion:NULL + ]; + } +} + +#pragma mark - UIButton action methods + +- (void)doneButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self doneButton:button]; +} + +- (void)thumbsButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self thumbsButton:button]; +} + +- (void)exportButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self exportButton:button]; +} + +- (void)printButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self printButton:button]; +} + +- (void)emailButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self emailButton:button]; +} + +- (void)markButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self markButton:button]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbCache.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbCache.h new file mode 100755 index 0000000..948022d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbCache.h @@ -0,0 +1,54 @@ +// +// ReaderThumbCache.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderThumbRequest.h" + +@interface ReaderThumbCache : NSObject + ++ (ReaderThumbCache *)sharedInstance; + ++ (void)touchThumbCacheWithGUID:(NSString *)guid; + ++ (void)createThumbCacheWithGUID:(NSString *)guid; + ++ (void)removeThumbCacheWithGUID:(NSString *)guid; + ++ (void)purgeThumbCachesOlderThan:(NSTimeInterval)age; + ++ (NSString *)thumbCachePathForGUID:(NSString *)guid; + +- (id)thumbRequest:(ReaderThumbRequest *)request priority:(BOOL)priority; + +- (void)setObject:(UIImage *)image forKey:(NSString *)key; + +- (void)removeObjectForKey:(NSString *)key; + +- (void)removeNullForKey:(NSString *)key; + +- (void)removeAllObjects; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbCache.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbCache.m new file mode 100755 index 0000000..273d6e4 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbCache.m @@ -0,0 +1,228 @@ +// +// ReaderThumbCache.m +// Reader v2.9.0 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbCache.h" +#import "ReaderThumbQueue.h" +#import "ReaderThumbFetch.h" +#import "ReaderThumbView.h" + +@implementation ReaderThumbCache +{ + NSCache *thumbCache; +} + +#pragma mark - Constants + +#define CACHE_SIZE 2097152 + +#pragma mark - ReaderThumbCache class methods + ++ (ReaderThumbCache *)sharedInstance +{ + static dispatch_once_t predicate = 0; + + static ReaderThumbCache *object = nil; // Object + + dispatch_once(&predicate, ^{ object = [self new]; }); + + return object; // ReaderThumbCache singleton +} + ++ (NSString *)appCachesPath +{ + static dispatch_once_t predicate = 0; + + static NSString *theCachesPath = nil; // Application caches path string + + dispatch_once(&predicate, // Save a copy of the application caches path the first time it is needed + ^{ + NSArray *cachesPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + + theCachesPath = [[cachesPaths objectAtIndex:0] copy]; // Keep a copy for later abusage + }); + + return theCachesPath; +} + ++ (NSString *)thumbCachePathForGUID:(NSString *)guid +{ + NSString *cachesPath = [ReaderThumbCache appCachesPath]; // Caches path + + return [cachesPath stringByAppendingPathComponent:guid]; // Append GUID +} + ++ (void)createThumbCacheWithGUID:(NSString *)guid +{ + NSFileManager *fileManager = [NSFileManager new]; // File manager instance + + NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:guid]; // Thumb cache path + + [fileManager createDirectoryAtPath:cachePath withIntermediateDirectories:NO attributes:nil error:NULL]; +} + ++ (void)removeThumbCacheWithGUID:(NSString *)guid +{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), + ^{ + NSFileManager *fileManager = [NSFileManager new]; // File manager instance + + NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:guid]; // Thumb cache path + + [fileManager removeItemAtPath:cachePath error:NULL]; // Remove thumb cache directory + }); +} + ++ (void)touchThumbCacheWithGUID:(NSString *)guid +{ + NSFileManager *fileManager = [NSFileManager new]; // File manager instance + + NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:guid]; // Thumb cache path + + NSDictionary *attributes = [NSDictionary dictionaryWithObject:[NSDate date] forKey:NSFileModificationDate]; + + [fileManager setAttributes:attributes ofItemAtPath:cachePath error:NULL]; // New modification date +} + ++ (void)purgeThumbCachesOlderThan:(NSTimeInterval)age +{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), + ^{ + NSDate *now = [NSDate date]; // Right about now time + + NSString *cachesPath = [ReaderThumbCache appCachesPath]; // Caches path + + NSFileManager *fileManager = [NSFileManager new]; // File manager instance + + NSArray *cachesList = [fileManager contentsOfDirectoryAtPath:cachesPath error:NULL]; + + if (cachesList != nil) // Process caches directory contents + { + for (NSString *cacheName in cachesList) // Enumerate directory contents + { + if (cacheName.length == 36) // This is a very hacky cache ident kludge + { + NSString *cachePath = [cachesPath stringByAppendingPathComponent:cacheName]; + + NSDictionary *attributes = [fileManager attributesOfItemAtPath:cachePath error:NULL]; + + NSDate *cacheDate = [attributes objectForKey:NSFileModificationDate]; // Cache date + + NSTimeInterval seconds = [now timeIntervalSinceDate:cacheDate]; // Cache age + + if (seconds > age) // Older than so remove the thumb cache + { + [fileManager removeItemAtPath:cachePath error:NULL]; + + #ifdef DEBUG + NSLog(@"%s purged %@", __FUNCTION__, cacheName); + #endif + } + } + } + } + }); +} + +#pragma mark - ReaderThumbCache instance methods + +- (instancetype)init +{ + if ((self = [super init])) // Initialize + { + thumbCache = [NSCache new]; // Cache + + [thumbCache setName:@"ReaderThumbCache"]; + + [thumbCache setTotalCostLimit:CACHE_SIZE]; + } + + return self; +} + +- (id)thumbRequest:(ReaderThumbRequest *)request priority:(BOOL)priority +{ + @synchronized(thumbCache) // Mutex lock + { + id object = [thumbCache objectForKey:request.cacheKey]; + + if (object == nil) // Thumb object does not yet exist in the cache + { + object = [NSNull null]; // Return an NSNull thumb placeholder object + + [thumbCache setObject:object forKey:request.cacheKey cost:2]; // Cache the placeholder object + + ReaderThumbFetch *thumbFetch = [[ReaderThumbFetch alloc] initWithRequest:request]; // Create a thumb fetch operation + + [thumbFetch setQueuePriority:(priority ? NSOperationQueuePriorityNormal : NSOperationQueuePriorityLow)]; // Queue priority + + request.thumbView.operation = thumbFetch; //[thumbFetch setThreadPriority:(priority ? 0.55 : 0.35)]; // Thread priority + + [[ReaderThumbQueue sharedInstance] addLoadOperation:thumbFetch]; // Queue the operation + } + + return object; // NSNull or UIImage + } +} + +- (void)setObject:(UIImage *)image forKey:(NSString *)key +{ + @synchronized(thumbCache) // Mutex lock + { + NSUInteger bytes = (image.size.width * image.size.height * 4.0f); + + [thumbCache setObject:image forKey:key cost:bytes]; // Cache image + } +} + +- (void)removeObjectForKey:(NSString *)key +{ + @synchronized(thumbCache) // Mutex lock + { + [thumbCache removeObjectForKey:key]; + } +} + +- (void)removeNullForKey:(NSString *)key +{ + @synchronized(thumbCache) // Mutex lock + { + id object = [thumbCache objectForKey:key]; + + if ([object isMemberOfClass:[NSNull class]]) + { + [thumbCache removeObjectForKey:key]; + } + } +} + +- (void)removeAllObjects +{ + @synchronized(thumbCache) // Mutex lock + { + [thumbCache removeAllObjects]; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbFetch.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbFetch.h new file mode 100755 index 0000000..39f0770 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbFetch.h @@ -0,0 +1,36 @@ +// +// ReaderThumbFetch.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderThumbQueue.h" + +@class ReaderThumbRequest; + +@interface ReaderThumbFetch : ReaderThumbOperation + +- (instancetype)initWithRequest:(ReaderThumbRequest *)options; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbFetch.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbFetch.m new file mode 100755 index 0000000..1710be5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbFetch.m @@ -0,0 +1,128 @@ +// +// ReaderThumbFetch.m +// Reader v2.9.0 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbFetch.h" +#import "ReaderThumbRender.h" +#import "ReaderThumbCache.h" +#import "ReaderThumbView.h" + +#import + +@implementation ReaderThumbFetch +{ + ReaderThumbRequest *request; +} + +#pragma mark - ReaderThumbFetch instance methods + +- (instancetype)initWithRequest:(ReaderThumbRequest *)options +{ + if ((self = [super initWithGUID:options.guid])) + { + request = options; + } + + return self; +} + +- (void)cancel +{ + [super cancel]; // Cancel the operation + + request.thumbView.operation = nil; // Break retain loop + + request.thumbView = nil; // Release target thumb view on cancel + + [[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey]; +} + +- (NSURL *)thumbFileURL +{ + NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:request.guid]; // Thumb cache path + + NSString *fileName = [[NSString alloc] initWithFormat:@"%@.png", request.thumbName]; // Thumb file name + + return [NSURL fileURLWithPath:[cachePath stringByAppendingPathComponent:fileName]]; // File URL +} + +- (void)main +{ + CGImageRef imageRef = NULL; NSURL *thumbURL = [self thumbFileURL]; + + CGImageSourceRef loadRef = CGImageSourceCreateWithURL((__bridge CFURLRef)thumbURL, NULL); + + if (loadRef != NULL) // Load the existing thumb image + { + imageRef = CGImageSourceCreateImageAtIndex(loadRef, 0, NULL); // Load it + + CFRelease(loadRef); // Release CGImageSource reference + } + else // Existing thumb image not found - so create and queue up a thumb render operation on the work queue + { + ReaderThumbRender *thumbRender = [[ReaderThumbRender alloc] initWithRequest:request]; // Create a thumb render operation + + [thumbRender setQueuePriority:self.queuePriority]; //[thumbRender setThreadPriority:(self.threadPriority - 0.1)]; // Priority + + if (self.isCancelled == NO) // We're not cancelled - so update things and add the render operation to the work queue + { + request.thumbView.operation = thumbRender; // Update the thumb view operation property to the new operation + + [[ReaderThumbQueue sharedInstance] addWorkOperation:thumbRender]; return; // Queue the operation + } + } + + if (imageRef != NULL) // Create a UIImage from a CGImage and show it + { + UIImage *image = [UIImage imageWithCGImage:imageRef scale:request.scale orientation:UIImageOrientationUp]; + + CGImageRelease(imageRef); // Release the CGImage reference from the above thumb load code + + UIGraphicsBeginImageContextWithOptions(image.size, YES, request.scale); // Graphics context + + [image drawAtPoint:CGPointZero]; // Decode and draw the image on this background thread + + UIImage *decoded = UIGraphicsGetImageFromCurrentImageContext(); // Newly decoded image + + UIGraphicsEndImageContext(); // Cleanup after the bitmap-based graphics drawing context + + [[ReaderThumbCache sharedInstance] setObject:decoded forKey:request.cacheKey]; // Cache it + + if (self.isCancelled == NO) // Show the image in the target thumb view on the main thread + { + ReaderThumbView *thumbView = request.thumbView; // Target thumb view for image show + + NSUInteger targetTag = request.targetTag; // Target reference tag for image show + + dispatch_async(dispatch_get_main_queue(), // Queue image show on main thread + ^{ + if (thumbView.targetTag == targetTag) [thumbView showImage:decoded]; + }); + } + } + + request.thumbView.operation = nil; // Break retain loop +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbQueue.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbQueue.h new file mode 100755 index 0000000..9532813 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbQueue.h @@ -0,0 +1,54 @@ +// +// ReaderThumbQueue.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface ReaderThumbQueue : NSObject + ++ (ReaderThumbQueue *)sharedInstance; + +- (void)addLoadOperation:(NSOperation *)operation; + +- (void)addWorkOperation:(NSOperation *)operation; + +- (void)cancelOperationsWithGUID:(NSString *)guid; + +- (void)cancelAllOperations; + +@end + +#pragma mark - + +// +// ReaderThumbOperation class interface +// + +@interface ReaderThumbOperation : NSOperation + +@property (nonatomic, strong, readonly) NSString *guid; + +- (instancetype)initWithGUID:(NSString *)guid; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbQueue.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbQueue.m new file mode 100755 index 0000000..dc256ab --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbQueue.m @@ -0,0 +1,141 @@ +// +// ReaderThumbQueue.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbQueue.h" + +@implementation ReaderThumbQueue +{ + NSOperationQueue *loadQueue; + + NSOperationQueue *workQueue; +} + +#pragma mark - ReaderThumbQueue class methods + ++ (ReaderThumbQueue *)sharedInstance +{ + static dispatch_once_t predicate = 0; + + static ReaderThumbQueue *object = nil; // Object + + dispatch_once(&predicate, ^{ object = [self new]; }); + + return object; // ReaderThumbQueue singleton +} + +#pragma mark - ReaderThumbQueue instance methods + +- (instancetype)init +{ + if ((self = [super init])) // Initialize + { + loadQueue = [NSOperationQueue new]; + + [loadQueue setName:@"ReaderThumbLoadQueue"]; + + [loadQueue setMaxConcurrentOperationCount:1]; + + workQueue = [NSOperationQueue new]; + + [workQueue setName:@"ReaderThumbWorkQueue"]; + + [workQueue setMaxConcurrentOperationCount:1]; + } + + return self; +} + +- (void)addLoadOperation:(NSOperation *)operation +{ + if ([operation isKindOfClass:[ReaderThumbOperation class]]) + { + [loadQueue addOperation:operation]; // Add to load queue + } +} + +- (void)addWorkOperation:(NSOperation *)operation +{ + if ([operation isKindOfClass:[ReaderThumbOperation class]]) + { + [workQueue addOperation:operation]; // Add to work queue + } +} + +- (void)cancelOperationsWithGUID:(NSString *)guid +{ + [loadQueue setSuspended:YES]; [workQueue setSuspended:YES]; + + for (ReaderThumbOperation *operation in loadQueue.operations) + { + if ([operation isKindOfClass:[ReaderThumbOperation class]]) + { + if ([operation.guid isEqualToString:guid]) [operation cancel]; + } + } + + for (ReaderThumbOperation *operation in workQueue.operations) + { + if ([operation isKindOfClass:[ReaderThumbOperation class]]) + { + if ([operation.guid isEqualToString:guid]) [operation cancel]; + } + } + + [workQueue setSuspended:NO]; [loadQueue setSuspended:NO]; +} + +- (void)cancelAllOperations +{ + [loadQueue cancelAllOperations]; [workQueue cancelAllOperations]; +} + +@end + +#pragma mark - + +// +// ReaderThumbOperation class implementation +// + +@implementation ReaderThumbOperation +{ + NSString *_guid; +} + +@synthesize guid = _guid; + +#pragma mark - ReaderThumbOperation instance methods + +- (instancetype)initWithGUID:(NSString *)guid +{ + if ((self = [super init])) + { + _guid = guid; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRender.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRender.h new file mode 100755 index 0000000..953b93c --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRender.h @@ -0,0 +1,36 @@ +// +// ReaderThumbRender.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderThumbQueue.h" + +@class ReaderThumbRequest; + +@interface ReaderThumbRender : ReaderThumbOperation + +- (instancetype)initWithRequest:(ReaderThumbRequest *)options; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRender.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRender.m new file mode 100755 index 0000000..fa01461 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRender.m @@ -0,0 +1,204 @@ +// +// ReaderThumbRender.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbRender.h" +#import "ReaderThumbCache.h" +#import "ReaderThumbView.h" +#import "CGPDFDocument.h" + +#import + +@implementation ReaderThumbRender +{ + ReaderThumbRequest *request; +} + +#pragma mark - ReaderThumbRender instance methods + +- (instancetype)initWithRequest:(ReaderThumbRequest *)options +{ + if ((self = [super initWithGUID:options.guid])) + { + request = options; + } + + return self; +} + +- (void)cancel +{ + [super cancel]; // Cancel the operation + + request.thumbView.operation = nil; // Break retain loop + + request.thumbView = nil; // Release target thumb view on cancel + + [[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey]; +} + +- (NSURL *)thumbFileURL +{ + NSFileManager *fileManager = [NSFileManager new]; // File manager instance + + NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:request.guid]; // Thumb cache path + + [fileManager createDirectoryAtPath:cachePath withIntermediateDirectories:NO attributes:nil error:NULL]; + + NSString *fileName = [[NSString alloc] initWithFormat:@"%@.png", request.thumbName]; // Thumb file name + + return [NSURL fileURLWithPath:[cachePath stringByAppendingPathComponent:fileName]]; // File URL +} + +- (void)main +{ + NSInteger page = request.thumbPage; NSString *password = request.password; + + CGImageRef imageRef = NULL; CFURLRef fileURL = (__bridge CFURLRef)request.fileURL; + + CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateUsingUrl(fileURL, password); + + if (thePDFDocRef != NULL) // Check for non-NULL CGPDFDocumentRef + { + CGPDFPageRef thePDFPageRef = CGPDFDocumentGetPage(thePDFDocRef, page); + + if (thePDFPageRef != NULL) // Check for non-NULL CGPDFPageRef + { + CGFloat thumb_w = request.thumbSize.width; // Maximum thumb width + CGFloat thumb_h = request.thumbSize.height; // Maximum thumb height + + CGRect cropBoxRect = CGPDFPageGetBoxRect(thePDFPageRef, kCGPDFCropBox); + CGRect mediaBoxRect = CGPDFPageGetBoxRect(thePDFPageRef, kCGPDFMediaBox); + CGRect effectiveRect = CGRectIntersection(cropBoxRect, mediaBoxRect); + + NSInteger pageRotate = CGPDFPageGetRotationAngle(thePDFPageRef); // Angle + + CGFloat page_w = 0.0f; CGFloat page_h = 0.0f; // Rotated page size + + switch (pageRotate) // Page rotation (in degrees) + { + default: // Default case + case 0: case 180: // 0 and 180 degrees + { + page_w = effectiveRect.size.width; + page_h = effectiveRect.size.height; + break; + } + + case 90: case 270: // 90 and 270 degrees + { + page_h = effectiveRect.size.width; + page_w = effectiveRect.size.height; + break; + } + } + + CGFloat scale_w = (thumb_w / page_w); // Width scale + CGFloat scale_h = (thumb_h / page_h); // Height scale + + CGFloat scale = 0.0f; // Page to target thumb size scale + + if (page_h > page_w) + scale = ((thumb_h > thumb_w) ? scale_w : scale_h); // Portrait + else + scale = ((thumb_h < thumb_w) ? scale_h : scale_w); // Landscape + + NSInteger target_w = (page_w * scale); // Integer target thumb width + NSInteger target_h = (page_h * scale); // Integer target thumb height + + if (target_w % 2) target_w--; if (target_h % 2) target_h--; // Even + + target_w *= request.scale; target_h *= request.scale; // Screen scale + + CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); // RGB color space + + CGBitmapInfo bmi = (kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst); + + CGContextRef context = CGBitmapContextCreate(NULL, target_w, target_h, 8, 0, rgb, bmi); + + if (context != NULL) // Must have a valid custom CGBitmap context to draw into + { + CGRect thumbRect = CGRectMake(0.0f, 0.0f, target_w, target_h); // Target thumb rect + + CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); CGContextFillRect(context, thumbRect); // White fill + + CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(thePDFPageRef, kCGPDFCropBox, thumbRect, 0, true)); // Fit rect + + //CGContextSetRenderingIntent(context, kCGRenderingIntentDefault); CGContextSetInterpolationQuality(context, kCGInterpolationDefault); + + CGContextDrawPDFPage(context, thePDFPageRef); // Render the PDF page into the custom CGBitmap context + + imageRef = CGBitmapContextCreateImage(context); // Create CGImage from custom CGBitmap context + + CGContextRelease(context); // Release custom CGBitmap context reference + } + + CGColorSpaceRelease(rgb); // Release device RGB color space reference + } + + CGPDFDocumentRelease(thePDFDocRef); // Release CGPDFDocumentRef reference + } + + if (imageRef != NULL) // Create UIImage from CGImage and show it, then save thumb as PNG + { + UIImage *image = [UIImage imageWithCGImage:imageRef scale:request.scale orientation:UIImageOrientationUp]; + + [[ReaderThumbCache sharedInstance] setObject:image forKey:request.cacheKey]; // Update cache + + if (self.isCancelled == NO) // Show the image in the target thumb view on the main thread + { + ReaderThumbView *thumbView = request.thumbView; // Target thumb view for image show + + NSUInteger targetTag = request.targetTag; // Target reference tag for image show + + dispatch_async(dispatch_get_main_queue(), // Queue image show on main thread + ^{ + if (thumbView.targetTag == targetTag) [thumbView showImage:image]; + }); + } + + CFURLRef thumbURL = (__bridge CFURLRef)[self thumbFileURL]; // Thumb cache path with PNG file name URL + + CGImageDestinationRef thumbRef = CGImageDestinationCreateWithURL(thumbURL, (CFStringRef)@"public.png", 1, NULL); + + if (thumbRef != NULL) // Write the thumb image file out to the thumb cache directory + { + CGImageDestinationAddImage(thumbRef, imageRef, NULL); // Add the image + + CGImageDestinationFinalize(thumbRef); // Finalize the image file + + CFRelease(thumbRef); // Release CGImageDestination reference + } + + CGImageRelease(imageRef); // Release CGImage reference + } + else // No image - so remove the placeholder object from the cache + { + [[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey]; + } + + request.thumbView.operation = nil; // Break retain loop +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRequest.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRequest.h new file mode 100755 index 0000000..f4846d0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRequest.h @@ -0,0 +1,45 @@ +// +// ReaderThumbRequest.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@class ReaderThumbView; + +@interface ReaderThumbRequest : NSObject + +@property (nonatomic, strong, readonly) NSURL *fileURL; +@property (nonatomic, strong, readonly) NSString *guid; +@property (nonatomic, strong, readonly) NSString *password; +@property (nonatomic, strong, readonly) NSString *cacheKey; +@property (nonatomic, strong, readonly) NSString *thumbName; +@property (nonatomic, strong, readwrite) ReaderThumbView *thumbView; +@property (nonatomic, assign, readonly) NSUInteger targetTag; +@property (nonatomic, assign, readonly) NSInteger thumbPage; +@property (nonatomic, assign, readonly) CGSize thumbSize; +@property (nonatomic, assign, readonly) CGFloat scale; + ++ (instancetype)newForView:(ReaderThumbView *)view fileURL:(NSURL *)url password:(NSString *)phrase guid:(NSString *)guid page:(NSInteger)page size:(CGSize)size; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRequest.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRequest.m new file mode 100755 index 0000000..93ed9ad --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbRequest.m @@ -0,0 +1,96 @@ +// +// ReaderThumbRequest.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbRequest.h" +#import "ReaderThumbView.h" + +@implementation ReaderThumbRequest +{ + NSURL *_fileURL; + + NSString *_guid; + + NSString *_password; + + NSString *_cacheKey; + + NSString *_thumbName; + + ReaderThumbView *_thumbView; + + NSUInteger _targetTag; + + NSInteger _thumbPage; + + CGSize _thumbSize; + + CGFloat _scale; +} + +#pragma mark - Properties + +@synthesize guid = _guid; +@synthesize fileURL = _fileURL; +@synthesize password = _password; +@synthesize thumbView = _thumbView; +@synthesize thumbPage = _thumbPage; +@synthesize thumbSize = _thumbSize; +@synthesize thumbName = _thumbName; +@synthesize targetTag = _targetTag; +@synthesize cacheKey = _cacheKey; +@synthesize scale = _scale; + +#pragma mark - ReaderThumbRequest class methods + ++ (instancetype)newForView:(ReaderThumbView *)view fileURL:(NSURL *)url password:(NSString *)phrase guid:(NSString *)guid page:(NSInteger)page size:(CGSize)size +{ + return [[ReaderThumbRequest alloc] initForView:view fileURL:url password:phrase guid:guid page:page size:size]; +} + +#pragma mark - ReaderThumbRequest instance methods + +- (instancetype)initForView:(ReaderThumbView *)view fileURL:(NSURL *)url password:(NSString *)phrase guid:(NSString *)guid page:(NSInteger)page size:(CGSize)size +{ + if ((self = [super init])) // Initialize object + { + NSInteger w = size.width; NSInteger h = size.height; + + _thumbView = view; _thumbPage = page; _thumbSize = size; + + _fileURL = [url copy]; _password = [phrase copy]; _guid = [guid copy]; + + _thumbName = [[NSString alloc] initWithFormat:@"%07i-%04ix%04i", (int)page, (int)w, (int)h]; + + _cacheKey = [[NSString alloc] initWithFormat:@"%@+%@", _thumbName, _guid]; + + _targetTag = [_cacheKey hash]; _thumbView.targetTag = _targetTag; + + _scale = [[UIScreen mainScreen] scale]; // Thumb screen scale + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbView.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbView.h new file mode 100755 index 0000000..4235681 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbView.h @@ -0,0 +1,45 @@ +// +// ReaderThumbView.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface ReaderThumbView : UIView +{ +@protected // Instance variables + + UIImageView *imageView; +} + +@property (atomic, strong, readwrite) NSOperation *operation; + +@property (nonatomic, assign, readwrite) NSUInteger targetTag; + +- (void)showImage:(UIImage *)image; + +- (void)showTouched:(BOOL)touched; + +- (void)reuse; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbView.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbView.m new file mode 100755 index 0000000..10c5c91 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbView.m @@ -0,0 +1,93 @@ +// +// ReaderThumbView.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbView.h" + +@implementation ReaderThumbView +{ + NSOperation *_operation; + + NSUInteger _targetTag; +} + +#pragma mark - Properties + +@synthesize operation = _operation; +@synthesize targetTag = _targetTag; + +#pragma mark - ReaderThumbView instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = NO; + self.userInteractionEnabled = NO; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingNone; + self.backgroundColor = [UIColor clearColor]; + + imageView = [[UIImageView alloc] initWithFrame:self.bounds]; + + imageView.autoresizesSubviews = NO; + imageView.userInteractionEnabled = NO; + imageView.autoresizingMask = UIViewAutoresizingNone; + imageView.contentMode = UIViewContentModeScaleAspectFit; + + [self addSubview:imageView]; + } + + return self; +} + +- (void)showImage:(UIImage *)image +{ + imageView.image = image; // Show image +} + +- (void)showTouched:(BOOL)touched +{ + // Implemented by ReaderThumbView subclass +} + +- (void)removeFromSuperview +{ + _targetTag = 0; // Clear target tag + + [self.operation cancel]; // Cancel operation + + [super removeFromSuperview]; // Remove view +} + +- (void)reuse +{ + _targetTag = 0; // Clear target tag + + [self.operation cancel]; // Cancel operation + + imageView.image = nil; // Release image +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbsView.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbsView.h new file mode 100755 index 0000000..6268770 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbsView.h @@ -0,0 +1,68 @@ +// +// ReaderThumbsView.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderThumbView.h" + +@class ReaderThumbsView; + +@protocol ReaderThumbsViewDelegate + +@required // Delegate protocols + +- (NSUInteger)numberOfThumbsInThumbsView:(ReaderThumbsView *)thumbsView; + +- (id)thumbsView:(ReaderThumbsView *)thumbsView thumbCellWithFrame:(CGRect)frame; + +- (void)thumbsView:(ReaderThumbsView *)thumbsView updateThumbCell:(id)thumbCell forIndex:(NSInteger)index; + +- (void)thumbsView:(ReaderThumbsView *)thumbsView didSelectThumbWithIndex:(NSInteger)index; + +@optional // Delegate protocols + +- (void)thumbsView:(ReaderThumbsView *)thumbsView refreshThumbCell:(id)thumbCell forIndex:(NSInteger)index; + +- (void)thumbsView:(ReaderThumbsView *)thumbsView didPressThumbWithIndex:(NSInteger)index; + +@end + +@interface ReaderThumbsView : UIScrollView + +@property (nonatomic, weak, readwrite) id delegate; + +- (void)setThumbSize:(CGSize)thumbSize; + +- (void)reloadThumbsCenterOnIndex:(NSInteger)index; + +- (void)reloadThumbsContentOffset:(CGPoint)newContentOffset; + +- (void)refreshThumbWithIndex:(NSInteger)index; + +- (void)refreshVisibleThumbs; + +- (CGPoint)insetContentOffset; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbsView.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbsView.m new file mode 100755 index 0000000..f2a59d5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderThumbsView.m @@ -0,0 +1,545 @@ +// +// ReaderThumbsView.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderThumbsView.h" + +@interface ReaderThumbsView () + +@end + +@implementation ReaderThumbsView +{ + CGPoint lastContentOffset; + + ReaderThumbView *touchedCell; + + NSMutableArray *thumbCellsQueue; + + NSMutableArray *thumbCellsVisible; + + NSInteger _thumbsX, _thumbsY, _thumbX; + + CGSize _thumbSize, _lastViewSize; + + NSUInteger _thumbCount; + + BOOL canUpdate; +} + +#pragma mark - Properties + +@synthesize delegate; + +#pragma mark - ReaderThumbsView instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.scrollsToTop = NO; + self.autoresizesSubviews = NO; + self.delaysContentTouches = NO; + self.alwaysBounceVertical = YES; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.backgroundColor = [UIColor clearColor]; + + [super setDelegate:self]; // Set the superclass UIScrollView delegate + + thumbCellsQueue = [NSMutableArray new]; thumbCellsVisible = [NSMutableArray new]; // Cell management arrays + + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; + //tapGesture.numberOfTouchesRequired = 1; tapGesture.numberOfTapsRequired = 1; tapGesture.delegate = self; + [self addGestureRecognizer:tapGesture]; + + UILongPressGestureRecognizer *pressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePressGesture:)]; + pressGesture.minimumPressDuration = 0.8; //pressGesture.numberOfTouchesRequired = 1; pressGesture.delegate = self; + [self addGestureRecognizer:pressGesture]; + + lastContentOffset = CGPointMake(CGFLOAT_MIN, CGFLOAT_MIN); + } + + return self; +} + +- (void)requeueThumbCell:(ReaderThumbView *)tvCell +{ + [thumbCellsQueue addObject:tvCell]; + + [thumbCellsVisible removeObject:tvCell]; + + tvCell.tag = NSIntegerMin; tvCell.hidden = YES; + + [tvCell reuse]; // Reuse the cell +} + +- (void)requeueAllThumbCells +{ + if (thumbCellsVisible.count > 0) + { + NSArray *visible = [thumbCellsVisible copy]; + + for (ReaderThumbView *tvCell in visible) + { + [self requeueThumbCell:tvCell]; + } + } +} + +- (ReaderThumbView *)dequeueThumbCellWithFrame:(CGRect)frame +{ + ReaderThumbView *theCell = nil; + + if (thumbCellsQueue.count > 0) // Reuse existing cell + { + theCell = [thumbCellsQueue objectAtIndex:0]; + + [thumbCellsQueue removeObjectAtIndex:0]; // Dequeue it + + theCell.frame = frame; // Position the reused cell + } + else // Allocate a brand new thumb cell subclass for our use + { + theCell = [delegate thumbsView:self thumbCellWithFrame:frame]; + + //assert([theCell isKindOfClass:[ReaderThumbView class]]); + + theCell.tag = NSIntegerMin; theCell.hidden = YES; + + [self insertSubview:theCell atIndex:0]; // Add + } + + [thumbCellsVisible addObject:theCell]; + + return theCell; +} + +- (NSMutableIndexSet *)visibleIndexSetForContentOffset +{ + CGFloat minY = self.contentOffset.y; // Content offset + CGFloat maxY = (minY + self.bounds.size.height - 1.0f); + + NSInteger startRow = (minY / _thumbSize.height); // Start row + NSInteger finalRow = (maxY / _thumbSize.height); // Final row + + NSInteger startIndex = (startRow * _thumbsX); // Start index + NSInteger finalIndex = (finalRow * _thumbsX); // Final index + + finalIndex += (_thumbsX - 1); // Last index value in last row + + NSInteger maximumIndex = (_thumbCount - 1); // Maximum index value + + if (finalIndex > maximumIndex) finalIndex = maximumIndex; // Limit it + + NSRange indexRange = NSMakeRange(startIndex, (finalIndex - startIndex + 1)); + + return [NSMutableIndexSet indexSetWithIndexesInRange:indexRange]; +} + +- (ReaderThumbView *)thumbCellContainingPoint:(CGPoint)point +{ + ReaderThumbView *theCell = nil; + + for (ReaderThumbView *tvCell in thumbCellsVisible) + { + if (CGRectContainsPoint(tvCell.frame, point) == true) + { + theCell = tvCell; break; // Found it + } + } + + return theCell; +} + +- (CGRect)thumbCellFrameForIndex:(NSInteger)index +{ + CGRect thumbRect; thumbRect.size = _thumbSize; + + NSInteger thumbY = ((index / _thumbsX) * _thumbSize.height); // X, Y + + NSInteger thumbX = (((index % _thumbsX) * _thumbSize.width) + _thumbX); + + thumbRect.origin.x = thumbX; thumbRect.origin.y = thumbY; + + return thumbRect; +} + +- (void)updateContentSize:(NSUInteger)thumbCount +{ + canUpdate = NO; // Disable updates + + if (thumbCount > 0) // Have some thumbs + { + CGFloat bw = self.bounds.size.width; + + _thumbsX = (bw / _thumbSize.width); + + if (_thumbsX < 1) _thumbsX = 1; + + _thumbsY = (thumbCount / _thumbsX); + + if ((_thumbsX * _thumbsY) < thumbCount) _thumbsY++; + + CGFloat tw = (_thumbsX * _thumbSize.width); + CGFloat th = (_thumbsY * _thumbSize.height); + + if (tw < bw) + _thumbX = ((bw - tw) * 0.5f); + else + _thumbX = 0; // Reset + + if (tw < bw) tw = bw; // Limit + + [self setContentSize:CGSizeMake(tw, th)]; + } + else // Zero (0) thumbs + { + [self setContentSize:CGSizeZero]; + } + + canUpdate = YES; // Enable updates +} + +- (void)layoutSubviews +{ + if (CGSizeEqualToSize(_lastViewSize, CGSizeZero) == true) + { + _lastViewSize = self.bounds.size; // Initial view size + } + else + if (CGSizeEqualToSize(_lastViewSize, self.bounds.size) == false) + { + _lastViewSize = self.bounds.size; // Track the view size + + [self updateContentSize:_thumbCount]; // Update the content size + + NSMutableArray *requeueCells = [NSMutableArray array]; // Requeue cell list + + NSMutableIndexSet *visibleIndexSet = [self visibleIndexSetForContentOffset]; + + for (ReaderThumbView *tvCell in thumbCellsVisible) // Enumerate visible cells + { + NSInteger index = tvCell.tag; // Get the cell's index value + + if ([visibleIndexSet containsIndex:index] == YES) // Visible cell + { + tvCell.frame = [self thumbCellFrameForIndex:index]; // Frame + + [visibleIndexSet removeIndex:index]; // Remove from set + } + else // Add it to the list of cells to requeue + { + [requeueCells addObject:tvCell]; + } + } + + for (ReaderThumbView *tvCell in requeueCells) // Enumerate requeue cells + { + [self requeueThumbCell:tvCell]; // Requeue the thumb cell + } + + [visibleIndexSet enumerateIndexesUsingBlock: // Enumerate visible indexes + ^(NSUInteger index, BOOL *stop) + { + CGRect thumbRect = [self thumbCellFrameForIndex:index]; // Frame + + ReaderThumbView *tvCell = [self dequeueThumbCellWithFrame:thumbRect]; + + [delegate thumbsView:self updateThumbCell:tvCell forIndex:index]; + + tvCell.tag = index; tvCell.hidden = NO; // Tag and show it + } + ]; + } +} + +- (void)setThumbSize:(CGSize)thumbSize +{ + if (CGSizeEqualToSize(_thumbSize, CGSizeZero) == true) + { + if (CGSizeEqualToSize(thumbSize, CGSizeZero) == false) + { + _thumbSize = thumbSize; // Set the maximum thumb size + } + } +} + +- (void)reloadThumbsCenterOnIndex:(NSInteger)index +{ + assert(delegate != nil); // Check delegate + + assert(CGSizeEqualToSize(_thumbSize, CGSizeZero) == false); + + if (self.decelerating == YES) // Stop scroll view movement + { + [self setContentOffset:self.contentOffset animated:NO]; + } + + CGPoint newContentOffset = CGPointZero; // At top + + lastContentOffset = CGPointMake(CGFLOAT_MIN, CGFLOAT_MIN); + + [self requeueAllThumbCells]; // Start off fresh + + _thumbCount = 0; // Reset the thumb count to zero + + NSUInteger thumbCount = [delegate numberOfThumbsInThumbsView:self]; + + [self updateContentSize:thumbCount]; _thumbCount = thumbCount; + + if (thumbCount > 0) // Have some thumbs + { + NSInteger boundsHeight = self.bounds.size.height; + + NSInteger maxY = (self.contentSize.height - boundsHeight); + + NSInteger minY = 0; maxY--; if (maxY < minY) maxY = minY; // Limits + + if (index < 0) index = 0; else if (index > thumbCount) index = (thumbCount - 1); + + NSInteger thumbY = ((index / _thumbsX) * _thumbSize.height); // Thumb Y + + NSInteger offsetY = (thumbY - (boundsHeight / 2) + (_thumbSize.height / 2)); + + if (offsetY < minY) offsetY = minY; else if (offsetY > maxY) offsetY = maxY; + + newContentOffset.y = offsetY; // Calculated content offset Y position + } + + newContentOffset.y -= self.contentInset.top; // Content inset adjust + + if (CGPointEqualToPoint(self.contentOffset, newContentOffset) == false) + [self setContentOffset:newContentOffset animated:NO]; + else + [self scrollViewDidScroll:self]; + + [self flashScrollIndicators]; +} + +- (void)reloadThumbsContentOffset:(CGPoint)newContentOffset +{ + assert(delegate != nil); // Check delegate + + assert(CGSizeEqualToSize(_thumbSize, CGSizeZero) == false); + + if (self.decelerating == YES) // Stop scroll view movement + { + [self setContentOffset:self.contentOffset animated:NO]; + } + + lastContentOffset = CGPointMake(CGFLOAT_MIN, CGFLOAT_MIN); + + [self requeueAllThumbCells]; // Start off fresh + + _thumbCount = 0; // Reset the thumb count to zero + + NSUInteger thumbCount = [delegate numberOfThumbsInThumbsView:self]; + + [self updateContentSize:thumbCount]; _thumbCount = thumbCount; + + if (thumbCount > 0) // Have some thumbs + { + NSInteger boundsHeight = self.bounds.size.height; + + NSInteger maxY = (self.contentSize.height - boundsHeight); + + NSInteger minY = 0; maxY--; if (maxY < minY) maxY = minY; // Limits + + NSInteger offsetY = newContentOffset.y; // Requested content offset Y + + if (offsetY < minY) offsetY = minY; else if (offsetY > maxY) offsetY = maxY; + + newContentOffset.y = offsetY; newContentOffset.x = 0.0f; // Validated + } + else // Zero (0) thumbs + { + newContentOffset = CGPointZero; + } + + newContentOffset.y -= self.contentInset.top; // Content inset adjust + + if (CGPointEqualToPoint(self.contentOffset, newContentOffset) == false) + [self setContentOffset:newContentOffset animated:NO]; + else + [self scrollViewDidScroll:self]; + + [self flashScrollIndicators]; +} + +- (void)refreshThumbWithIndex:(NSInteger)index +{ + for (ReaderThumbView *tvCell in thumbCellsVisible) // Enumerate visible cells + { + if (tvCell.tag == index) // Found a visible thumb cell with the index value + { + if ([delegate respondsToSelector:@selector(thumbsView:refreshThumbCell:forIndex:)]) + { + [delegate thumbsView:self refreshThumbCell:tvCell forIndex:index]; // Refresh + } + + break; + } + } +} + +- (void)refreshVisibleThumbs +{ + for (ReaderThumbView *tvCell in thumbCellsVisible) // Enumerate visible cells + { + if ([delegate respondsToSelector:@selector(thumbsView:refreshThumbCell:forIndex:)]) + { + [delegate thumbsView:self refreshThumbCell:tvCell forIndex:tvCell.tag]; // Refresh + } + } +} + +- (CGPoint)insetContentOffset +{ + CGPoint insetContentOffset = self.contentOffset; // Offset + + insetContentOffset.y += self.contentInset.top; // Inset adjust + + return insetContentOffset; // Adjusted content offset +} + +#pragma mark - UIGestureRecognizer action methods + +- (void)handleTapGesture:(UITapGestureRecognizer *)recognizer +{ + if (recognizer.state == UIGestureRecognizerStateRecognized) // Handle the tap + { + CGPoint point = [recognizer locationInView:recognizer.view]; // Tap location + + ReaderThumbView *tvCell = [self thumbCellContainingPoint:point]; // Look for cell + + if (tvCell != nil) [delegate thumbsView:self didSelectThumbWithIndex:tvCell.tag]; + } +} + +- (void)handlePressGesture:(UILongPressGestureRecognizer *)recognizer +{ + if (recognizer.state == UIGestureRecognizerStateBegan) // Handle the press + { + if ([delegate respondsToSelector:@selector(thumbsView:didPressThumbWithIndex:)]) + { + CGPoint point = [recognizer locationInView:recognizer.view]; // Press location + + ReaderThumbView *tvCell = [self thumbCellContainingPoint:point]; // Look for cell + + if (tvCell != nil) [delegate thumbsView:self didPressThumbWithIndex:tvCell.tag]; + } + } +} + +#pragma mark - UIScrollViewDelegate methods + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView +{ + if ((canUpdate == YES) && (_thumbCount > 0)) // Check flag and thumb count + { + if (CGPointEqualToPoint(scrollView.contentOffset, lastContentOffset) == false) + { + lastContentOffset = scrollView.contentOffset; // Work around a 'feature' + + CGRect visibleBounds = self.bounds; // Visible bounds in the scroll view + + NSMutableArray *requeueCells = [NSMutableArray array]; // Requeue cell list + + NSMutableIndexSet *visibleCellSet = [NSMutableIndexSet indexSet]; // Visible set + + for (ReaderThumbView *tvCell in thumbCellsVisible) // Enumerate visible cells + { + if (CGRectIntersectsRect(tvCell.frame, visibleBounds) == true) + [visibleCellSet addIndex:tvCell.tag]; + else + [requeueCells addObject:tvCell]; + } + + for (ReaderThumbView *tvCell in requeueCells) // Enumerate requeue cells + { + [self requeueThumbCell:tvCell]; // Requeue the thumb cell + } + + NSMutableIndexSet *visibleIndexSet = [self visibleIndexSetForContentOffset]; + + [visibleIndexSet enumerateIndexesUsingBlock: // Enumerate visible indexes + ^(NSUInteger index, BOOL *stop) + { + if ([visibleCellSet containsIndex:index] == NO) // Index not visible + { + CGRect thumbRect = [self thumbCellFrameForIndex:index]; // Frame + + ReaderThumbView *tvCell = [self dequeueThumbCellWithFrame:thumbRect]; + + [delegate thumbsView:self updateThumbCell:tvCell forIndex:index]; + + tvCell.tag = index; tvCell.hidden = NO; // Tag and show it + } + } + ]; + } + } +} + +#pragma mark - UIResponder instance methods + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesBegan:touches withEvent:event]; // Message superclass + + if (touchedCell != nil) { [touchedCell showTouched:NO]; touchedCell = nil; } + + if (touches.count == 1) // Show selection on single touch + { + UITouch *touch = [touches anyObject]; // Get touch from set + + CGPoint point = [touch locationInView:touch.view]; // Touch location + + ReaderThumbView *tvCell = [self thumbCellContainingPoint:point]; // Look for cell + + if (tvCell != nil) { touchedCell = tvCell; [touchedCell showTouched:YES]; } + } +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesCancelled:touches withEvent:event]; // Message superclass + + if (touchedCell != nil) { [touchedCell showTouched:NO]; touchedCell = nil; } +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesEnded:touches withEvent:event]; // Message superclass + + if (touchedCell != nil) { [touchedCell showTouched:NO]; touchedCell = nil; } +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesMoved:touches withEvent:event]; // Message superclass +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderViewController.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderViewController.h new file mode 100755 index 0000000..7b11322 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderViewController.h @@ -0,0 +1,46 @@ +// +// ReaderViewController.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ReaderDocument.h" + +@class ReaderViewController; + +@protocol ReaderViewControllerDelegate + +@optional // Delegate protocols + +- (void)dismissReaderViewController:(ReaderViewController *)viewController; + +@end + +@interface ReaderViewController : UIViewController + +@property (nonatomic, weak, readwrite) id delegate; + +- (instancetype)initWithReaderDocument:(ReaderDocument *)object; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderViewController.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderViewController.m new file mode 100755 index 0000000..bcfb653 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ReaderViewController.m @@ -0,0 +1,921 @@ +// +// ReaderViewController.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ReaderViewController.h" +#import "ThumbsViewController.h" +#import "ReaderMainToolbar.h" +#import "ReaderMainPagebar.h" +#import "ReaderContentView.h" +#import "ReaderThumbCache.h" +#import "ReaderThumbQueue.h" + +#import + +@interface ReaderViewController () +@end + +@implementation ReaderViewController +{ + ReaderDocument *document; + + UIScrollView *theScrollView; + + ReaderMainToolbar *mainToolbar; + + ReaderMainPagebar *mainPagebar; + + NSMutableDictionary *contentViews; + + UIUserInterfaceIdiom userInterfaceIdiom; + + NSInteger currentPage, minimumPage, maximumPage; + + UIDocumentInteractionController *documentInteraction; + + UIPrintInteractionController *printInteraction; + + CGFloat scrollViewOutset; + + CGSize lastAppearSize; + + NSDate *lastHideTime; + + BOOL ignoreDidScroll; +} + +#pragma mark - Constants + +//#define STATUS_HEIGHT 20.0f +//#define TOOLBAR_HEIGHT 44.0f + +#define TOOLBAR_HEIGHT ((IPHONE_X == YES) ? 88.0 : 64.0) + + +#define STATUS_HEIGHT ((IPHONE_X == YES) ? 44.0 : 20.0) + +#define PAGEBAR_HEIGHT 48.0f + +#define SCROLLVIEW_OUTSET_SMALL 4.0f +#define SCROLLVIEW_OUTSET_LARGE 8.0f + +#define TAP_AREA_SIZE 48.0f + +#pragma mark - Properties + +@synthesize delegate; + +#pragma mark - ReaderViewController methods + +- (void)updateContentSize:(UIScrollView *)scrollView +{ + CGFloat contentHeight = scrollView.bounds.size.height; // Height + + CGFloat contentWidth = (scrollView.bounds.size.width * maximumPage); + + scrollView.contentSize = CGSizeMake(contentWidth, contentHeight); +} + +- (void)updateContentViews:(UIScrollView *)scrollView +{ + [self updateContentSize:scrollView]; // Update content size first + + [contentViews enumerateKeysAndObjectsUsingBlock: // Enumerate content views + ^(NSNumber *key, ReaderContentView *contentView, BOOL *stop) + { + NSInteger page = [key integerValue]; // Page number value + + CGRect viewRect = CGRectZero; viewRect.size = scrollView.bounds.size; + + viewRect.origin.x = (viewRect.size.width * (page - 1)); // Update X + + contentView.frame = CGRectInset(viewRect, scrollViewOutset, 0.0f); + +// DDLogInfo(@"contentView.frame = %@", NSStringFromCGRect(contentView.frame)); + } + ]; + + NSInteger page = currentPage; // Update scroll view offset to current page + + CGPoint contentOffset = CGPointMake((scrollView.bounds.size.width * (page - 1)), 0.0f); + + if (CGPointEqualToPoint(scrollView.contentOffset, contentOffset) == false) // Update + { + scrollView.contentOffset = contentOffset; // Update content offset + } + + [mainToolbar setBookmarkState:[document.bookmarks containsIndex:page]]; + + [mainPagebar updatePagebar]; // Update page bar +} + +- (void)addContentView:(UIScrollView *)scrollView page:(NSInteger)page +{ + CGRect viewRect = CGRectZero; viewRect.size = scrollView.bounds.size; + + viewRect.origin.x = (viewRect.size.width * (page - 1)); viewRect = CGRectInset(viewRect, scrollViewOutset, 0.0f); + + NSURL *fileURL = document.fileURL; NSString *phrase = document.password; NSString *guid = document.guid; // Document properties + + ReaderContentView *contentView = [[ReaderContentView alloc] initWithFrame:viewRect fileURL:fileURL page:page password:phrase]; // ReaderContentView + + contentView.message = self; [contentViews setObject:contentView forKey:[NSNumber numberWithInteger:page]]; [scrollView addSubview:contentView]; + + [contentView showPageThumb:fileURL page:page password:phrase guid:guid]; // Request page preview thumb +} + +- (void)layoutContentViews:(UIScrollView *)scrollView +{ + CGFloat viewWidth = scrollView.bounds.size.width; // View width + + CGFloat contentOffsetX = scrollView.contentOffset.x; // Content offset X + + NSInteger pageB = ((contentOffsetX + viewWidth - 1.0f) / viewWidth); // Pages + + NSInteger pageA = (contentOffsetX / viewWidth); pageB += 2; // Add extra pages + + if (pageA < minimumPage) pageA = minimumPage; if (pageB > maximumPage) pageB = maximumPage; + + NSRange pageRange = NSMakeRange(pageA, (pageB - pageA + 1)); // Make page range (A to B) + + NSMutableIndexSet *pageSet = [NSMutableIndexSet indexSetWithIndexesInRange:pageRange]; + + for (NSNumber *key in [contentViews allKeys]) // Enumerate content views + { + NSInteger page = [key integerValue]; // Page number value + + if ([pageSet containsIndex:page] == NO) // Remove content view + { + ReaderContentView *contentView = [contentViews objectForKey:key]; + + [contentView removeFromSuperview]; [contentViews removeObjectForKey:key]; + } + else // Visible content view - so remove it from page set + { + [pageSet removeIndex:page]; + } + } + + NSInteger pages = pageSet.count; + + if (pages > 0) // We have pages to add + { + NSEnumerationOptions options = 0; // Default + + if (pages == 2) // Handle case of only two content views + { + if ((maximumPage > 2) && ([pageSet lastIndex] == maximumPage)) options = NSEnumerationReverse; + } + else if (pages == 3) // Handle three content views - show the middle one first + { + NSMutableIndexSet *workSet = [pageSet mutableCopy]; options = NSEnumerationReverse; + + [workSet removeIndex:[pageSet firstIndex]]; [workSet removeIndex:[pageSet lastIndex]]; + + NSInteger page = [workSet firstIndex]; [pageSet removeIndex:page]; + + [self addContentView:scrollView page:page]; + } + + [pageSet enumerateIndexesWithOptions:options usingBlock: // Enumerate page set + ^(NSUInteger page, BOOL *stop) + { + [self addContentView:scrollView page:page]; + } + ]; + } +} + +- (void)handleScrollViewDidEnd:(UIScrollView *)scrollView +{ + CGFloat viewWidth = scrollView.bounds.size.width; // Scroll view width + + CGFloat contentOffsetX = scrollView.contentOffset.x; // Content offset X + + NSInteger page = (contentOffsetX / viewWidth); page++; // Page number + + if (page != currentPage) // Only if on different page + { + currentPage = page; document.pageNumber = [NSNumber numberWithInteger:page]; + + [contentViews enumerateKeysAndObjectsUsingBlock: // Enumerate content views + ^(NSNumber *key, ReaderContentView *contentView, BOOL *stop) + { + if ([key integerValue] != page) [contentView zoomResetAnimated:NO]; + } + ]; + + [mainToolbar setBookmarkState:[document.bookmarks containsIndex:page]]; + + [mainPagebar updatePagebar]; // Update page bar + } +} + +- (void)showDocumentPage:(NSInteger)page +{ + if (page != currentPage) // Only if on different page + { + if ((page < minimumPage) || (page > maximumPage)) return; + + currentPage = page; document.pageNumber = [NSNumber numberWithInteger:page]; + + CGPoint contentOffset = CGPointMake((theScrollView.bounds.size.width * (page - 1)), 0.0f); + + if (CGPointEqualToPoint(theScrollView.contentOffset, contentOffset) == true) + [self layoutContentViews:theScrollView]; + else + [theScrollView setContentOffset:contentOffset]; + + [contentViews enumerateKeysAndObjectsUsingBlock: // Enumerate content views + ^(NSNumber *key, ReaderContentView *contentView, BOOL *stop) + { + if ([key integerValue] != page) [contentView zoomResetAnimated:NO]; + } + ]; + + [mainToolbar setBookmarkState:[document.bookmarks containsIndex:page]]; + + [mainPagebar updatePagebar]; // Update page bar + } +} + +- (void)showDocument +{ + [self updateContentSize:theScrollView]; // Update content size first + + [self showDocumentPage:[document.pageNumber integerValue]]; // Show page + + document.lastOpen = [NSDate date]; // Update document last opened date +} + +- (void)closeDocument +{ + if (printInteraction != nil) [printInteraction dismissAnimated:NO]; + + [document archiveDocumentProperties]; // Save any ReaderDocument changes + + [[ReaderThumbQueue sharedInstance] cancelOperationsWithGUID:document.guid]; + + [[ReaderThumbCache sharedInstance] removeAllObjects]; // Empty the thumb cache + + if ([delegate respondsToSelector:@selector(dismissReaderViewController:)] == YES) + { + [delegate dismissReaderViewController:self]; // Dismiss the ReaderViewController + } + else // We have a "Delegate must respond to -dismissReaderViewController:" error + { + NSAssert(NO, @"Delegate must respond to -dismissReaderViewController:"); + } +} + +#pragma mark - UIViewController methods + +- (instancetype)initWithReaderDocument:(ReaderDocument *)object +{ + if ((self = [super initWithNibName:nil bundle:nil])) // Initialize superclass + { + if ((object != nil) && ([object isKindOfClass:[ReaderDocument class]])) // Valid object + { + userInterfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom; // User interface idiom + + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; // Default notification center + + [notificationCenter addObserver:self selector:@selector(applicationWillResign:) name:UIApplicationWillTerminateNotification object:nil]; + + [notificationCenter addObserver:self selector:@selector(applicationWillResign:) name:UIApplicationWillResignActiveNotification object:nil]; + + scrollViewOutset = ((userInterfaceIdiom == UIUserInterfaceIdiomPad) ? SCROLLVIEW_OUTSET_LARGE : SCROLLVIEW_OUTSET_SMALL); + + [object updateDocumentProperties]; document = object; // Retain the supplied ReaderDocument object for our use + + [ReaderThumbCache touchThumbCacheWithGUID:object.guid]; // Touch the document thumb cache directory + } + else // Invalid ReaderDocument object + { + self = nil; + } + } + + return self; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + assert(document != nil); // Must have a valid ReaderDocument + + self.view.backgroundColor = [UIColor grayColor]; // Neutral gray + + UIView *fakeStatusBar = nil; CGRect viewRect = self.view.bounds; // View bounds + + if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) // iOS 7+ + { + if ([self prefersStatusBarHidden] == NO) // Visible status bar + { + CGRect statusBarRect = viewRect; statusBarRect.size.height = STATUS_HEIGHT; + fakeStatusBar = [[UIView alloc] initWithFrame:statusBarRect]; // UIView + fakeStatusBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; + fakeStatusBar.backgroundColor = [UIColor blackColor]; + fakeStatusBar.contentMode = UIViewContentModeRedraw; + fakeStatusBar.userInteractionEnabled = NO; + + viewRect.origin.y += STATUS_HEIGHT; viewRect.size.height -= STATUS_HEIGHT; + } + } + + CGRect scrollViewRect = CGRectInset(viewRect, -scrollViewOutset, 0.0f); + theScrollView = [[UIScrollView alloc] initWithFrame:scrollViewRect]; // All + theScrollView.autoresizesSubviews = NO; theScrollView.contentMode = UIViewContentModeRedraw; + theScrollView.showsHorizontalScrollIndicator = NO; theScrollView.showsVerticalScrollIndicator = NO; + theScrollView.scrollsToTop = NO; theScrollView.delaysContentTouches = NO; theScrollView.pagingEnabled = YES; + theScrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + theScrollView.backgroundColor = [UIColor clearColor]; theScrollView.delegate = self; + [self.view addSubview:theScrollView]; + + CGRect toolbarRect = viewRect; toolbarRect.size.height = TOOLBAR_HEIGHT; + mainToolbar = [[ReaderMainToolbar alloc] initWithFrame:toolbarRect document:document]; // ReaderMainToolbar + mainToolbar.delegate = self; // ReaderMainToolbarDelegate + [self.view addSubview:mainToolbar]; + + CGRect pagebarRect = self.view.bounds; pagebarRect.size.height = PAGEBAR_HEIGHT; + pagebarRect.origin.y = (self.view.bounds.size.height - pagebarRect.size.height); + mainPagebar = [[ReaderMainPagebar alloc] initWithFrame:pagebarRect document:document]; // ReaderMainPagebar + mainPagebar.delegate = self; // ReaderMainPagebarDelegate + [self.view addSubview:mainPagebar]; + + if (fakeStatusBar != nil) [self.view addSubview:fakeStatusBar]; // Add status bar background view + + UITapGestureRecognizer *singleTapOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; + singleTapOne.numberOfTouchesRequired = 1; singleTapOne.numberOfTapsRequired = 1; singleTapOne.delegate = self; + [self.view addGestureRecognizer:singleTapOne]; + + UITapGestureRecognizer *doubleTapOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; + doubleTapOne.numberOfTouchesRequired = 1; doubleTapOne.numberOfTapsRequired = 2; doubleTapOne.delegate = self; + [self.view addGestureRecognizer:doubleTapOne]; + + UITapGestureRecognizer *doubleTapTwo = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; + doubleTapTwo.numberOfTouchesRequired = 2; doubleTapTwo.numberOfTapsRequired = 2; doubleTapTwo.delegate = self; + [self.view addGestureRecognizer:doubleTapTwo]; + + [singleTapOne requireGestureRecognizerToFail:doubleTapOne]; // Single tap requires double tap to fail + + contentViews = [NSMutableDictionary new]; lastHideTime = [NSDate date]; + + minimumPage = 1; maximumPage = [document.pageCount integerValue]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + if (CGSizeEqualToSize(lastAppearSize, CGSizeZero) == false) + { + if (CGSizeEqualToSize(lastAppearSize, self.view.bounds.size) == false) + { + [self updateContentViews:theScrollView]; // Update content views + } + + lastAppearSize = CGSizeZero; // Reset view size tracking + } + + if (self.beingPresented) { + return; + } + // 隐藏导航栏 + [self.navigationController setNavigationBarHidden:YES animated:YES]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + if (CGSizeEqualToSize(theScrollView.contentSize, CGSizeZero) == true) + { + [self performSelector:@selector(showDocument) withObject:nil afterDelay:0.0]; + } + +#if (READER_DISABLE_IDLE == TRUE) // Option + + [UIApplication sharedApplication].idleTimerDisabled = YES; + +#endif // end of READER_DISABLE_IDLE Option +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + + lastAppearSize = self.view.bounds.size; // Track view size + +#if (READER_DISABLE_IDLE == TRUE) // Option + + [UIApplication sharedApplication].idleTimerDisabled = NO; + +#endif // end of READER_DISABLE_IDLE Option + + if (self.beingPresented) { + return; + } + // 显示导航栏 + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; +} + +- (void)viewDidUnload +{ +#ifdef DEBUG + NSLog(@"%s", __FUNCTION__); +#endif + + mainToolbar = nil; mainPagebar = nil; + + theScrollView = nil; contentViews = nil; lastHideTime = nil; + + documentInteraction = nil; printInteraction = nil; + + lastAppearSize = CGSizeZero; currentPage = 0; + + [super viewDidUnload]; +} + +- (BOOL)prefersStatusBarHidden +{ + return YES; +} + +- (UIStatusBarStyle)preferredStatusBarStyle +{ + return UIStatusBarStyleLightContent; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + return YES; +} + +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + if (userInterfaceIdiom == UIUserInterfaceIdiomPad) if (printInteraction != nil) [printInteraction dismissAnimated:NO]; + + ignoreDidScroll = YES; +} + +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration +{ + if (CGSizeEqualToSize(theScrollView.contentSize, CGSizeZero) == false) + { + [self updateContentViews:theScrollView]; lastAppearSize = CGSizeZero; + } +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation +{ + ignoreDidScroll = NO; +} + +- (void)didReceiveMemoryWarning +{ +#ifdef DEBUG + NSLog(@"%s", __FUNCTION__); +#endif + + [super didReceiveMemoryWarning]; +} + +#pragma mark - UIScrollViewDelegate methods + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView +{ + if (ignoreDidScroll == NO) [self layoutContentViews:scrollView]; +} + +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView +{ + [self handleScrollViewDidEnd:scrollView]; +} + +- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView +{ + [self handleScrollViewDidEnd:scrollView]; +} + +#pragma mark - UIGestureRecognizerDelegate methods + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer shouldReceiveTouch:(UITouch *)touch +{ + if ([touch.view isKindOfClass:[UIScrollView class]]) return YES; + + return NO; +} + +#pragma mark - UIGestureRecognizer action methods + +- (void)decrementPageNumber +{ + if ((maximumPage > minimumPage) && (currentPage != minimumPage)) + { + CGPoint contentOffset = theScrollView.contentOffset; // Offset + + contentOffset.x -= theScrollView.bounds.size.width; // View X-- + + [theScrollView setContentOffset:contentOffset animated:YES]; + } +} + +- (void)incrementPageNumber +{ + if ((maximumPage > minimumPage) && (currentPage != maximumPage)) + { + CGPoint contentOffset = theScrollView.contentOffset; // Offset + + contentOffset.x += theScrollView.bounds.size.width; // View X++ + + [theScrollView setContentOffset:contentOffset animated:YES]; + } +} + +- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer +{ + if (recognizer.state == UIGestureRecognizerStateRecognized) + { + CGRect viewRect = recognizer.view.bounds; // View bounds + + CGPoint point = [recognizer locationInView:recognizer.view]; // Point + + CGRect areaRect = CGRectInset(viewRect, TAP_AREA_SIZE, 0.0f); // Area rect + + if (CGRectContainsPoint(areaRect, point) == true) // Single tap is inside area + { + NSNumber *key = [NSNumber numberWithInteger:currentPage]; // Page number key + + ReaderContentView *targetView = [contentViews objectForKey:key]; // View + + id target = [targetView processSingleTap:recognizer]; // Target object + + if (target != nil) // Handle the returned target object + { + if ([target isKindOfClass:[NSURL class]]) // Open a URL + { + NSURL *url = (NSURL *)target; // Cast to a NSURL object + + if (url.scheme == nil) // Handle a missing URL scheme + { + NSString *www = url.absoluteString; // Get URL string + + if ([www hasPrefix:@"www"] == YES) // Check for 'www' prefix + { + NSString *http = [[NSString alloc] initWithFormat:@"http://%@", www]; + + url = [NSURL URLWithString:http]; // Proper http-based URL + } + } + + if ([[UIApplication sharedApplication] openURL:url] == NO) + { + #ifdef DEBUG + NSLog(@"%s '%@'", __FUNCTION__, url); // Bad or unknown URL + #endif + } + } + else // Not a URL, so check for another possible object type + { + if ([target isKindOfClass:[NSNumber class]]) // Goto page + { + NSInteger number = [target integerValue]; // Number + + [self showDocumentPage:number]; // Show the page + } + } + } + else // Nothing active tapped in the target content view + { + if ([lastHideTime timeIntervalSinceNow] < -0.75) // Delay since hide + { + if ((mainToolbar.alpha < 1.0f) || (mainPagebar.alpha < 1.0f)) // Hidden + { + [mainToolbar showToolbar]; [mainPagebar showPagebar]; // Show + } + } + } + + return; + } + + CGRect nextPageRect = viewRect; + nextPageRect.size.width = TAP_AREA_SIZE; + nextPageRect.origin.x = (viewRect.size.width - TAP_AREA_SIZE); + + if (CGRectContainsPoint(nextPageRect, point) == true) // page++ + { + [self incrementPageNumber]; return; + } + + CGRect prevPageRect = viewRect; + prevPageRect.size.width = TAP_AREA_SIZE; + + if (CGRectContainsPoint(prevPageRect, point) == true) // page-- + { + [self decrementPageNumber]; return; + } + } +} + +- (void)handleDoubleTap:(UITapGestureRecognizer *)recognizer +{ + if (recognizer.state == UIGestureRecognizerStateRecognized) + { + CGRect viewRect = recognizer.view.bounds; // View bounds + + CGPoint point = [recognizer locationInView:recognizer.view]; // Point + + CGRect zoomArea = CGRectInset(viewRect, TAP_AREA_SIZE, TAP_AREA_SIZE); // Area + + if (CGRectContainsPoint(zoomArea, point) == true) // Double tap is inside zoom area + { + NSNumber *key = [NSNumber numberWithInteger:currentPage]; // Page number key + + ReaderContentView *targetView = [contentViews objectForKey:key]; // View + + switch (recognizer.numberOfTouchesRequired) // Touches count + { + case 1: // One finger double tap: zoom++ + { + [targetView zoomIncrement:recognizer]; break; + } + + case 2: // Two finger double tap: zoom-- + { + [targetView zoomDecrement:recognizer]; break; + } + } + + return; + } + + CGRect nextPageRect = viewRect; + nextPageRect.size.width = TAP_AREA_SIZE; + nextPageRect.origin.x = (viewRect.size.width - TAP_AREA_SIZE); + + if (CGRectContainsPoint(nextPageRect, point) == true) // page++ + { + [self incrementPageNumber]; return; + } + + CGRect prevPageRect = viewRect; + prevPageRect.size.width = TAP_AREA_SIZE; + + if (CGRectContainsPoint(prevPageRect, point) == true) // page-- + { + [self decrementPageNumber]; return; + } + } +} + +#pragma mark - ReaderContentViewDelegate methods + +- (void)contentView:(ReaderContentView *)contentView touchesBegan:(NSSet *)touches +{ + if ((mainToolbar.alpha > 0.0f) || (mainPagebar.alpha > 0.0f)) + { + if (touches.count == 1) // Single touches only + { + UITouch *touch = [touches anyObject]; // Touch info + + CGPoint point = [touch locationInView:self.view]; // Touch location + + CGRect areaRect = CGRectInset(self.view.bounds, TAP_AREA_SIZE, TAP_AREA_SIZE); + + if (CGRectContainsPoint(areaRect, point) == false) return; + } + + [mainToolbar hideToolbar]; [mainPagebar hidePagebar]; // Hide + + lastHideTime = [NSDate date]; // Set last hide time + } +} + +#pragma mark - ReaderMainToolbarDelegate methods + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar doneButton:(UIButton *)button +{ +#if (READER_STANDALONE == FALSE) // Option + + [self closeDocument]; // Close ReaderViewController + +#endif // end of READER_STANDALONE Option +} + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar thumbsButton:(UIButton *)button +{ +#if (READER_ENABLE_THUMBS == TRUE) // Option + + if (printInteraction != nil) [printInteraction dismissAnimated:NO]; + + ThumbsViewController *thumbsViewController = [[ThumbsViewController alloc] initWithReaderDocument:document]; + + thumbsViewController.title = self.title; thumbsViewController.delegate = self; // ThumbsViewControllerDelegate + + thumbsViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; + thumbsViewController.modalPresentationStyle = UIModalPresentationFullScreen; + + [self presentViewController:thumbsViewController animated:NO completion:NULL]; + +#endif // end of READER_ENABLE_THUMBS Option +} + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar exportButton:(UIButton *)button +{ + if (printInteraction != nil) [printInteraction dismissAnimated:YES]; + + NSURL *fileURL = document.fileURL; // Document file URL + + documentInteraction = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; + + documentInteraction.delegate = self; // UIDocumentInteractionControllerDelegate + + [documentInteraction presentOpenInMenuFromRect:button.bounds inView:button animated:YES]; +} + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar printButton:(UIButton *)button +{ + if ([UIPrintInteractionController isPrintingAvailable] == YES) + { + NSURL *fileURL = document.fileURL; // Document file URL + + if ([UIPrintInteractionController canPrintURL:fileURL] == YES) + { + printInteraction = [UIPrintInteractionController sharedPrintController]; + + UIPrintInfo *printInfo = [UIPrintInfo printInfo]; + printInfo.duplex = UIPrintInfoDuplexLongEdge; + printInfo.outputType = UIPrintInfoOutputGeneral; + printInfo.jobName = document.fileName; + + printInteraction.printInfo = printInfo; + printInteraction.printingItem = fileURL; + printInteraction.showsPageRange = YES; + + if (userInterfaceIdiom == UIUserInterfaceIdiomPad) // Large device printing + { + [printInteraction presentFromRect:button.bounds inView:button animated:YES completionHandler: + ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) + { + #ifdef DEBUG + if ((completed == NO) && (error != nil)) NSLog(@"%s %@", __FUNCTION__, error); + #endif + } + ]; + } + else // Handle printing on small device + { + [printInteraction presentAnimated:YES completionHandler: + ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) + { + #ifdef DEBUG + if ((completed == NO) && (error != nil)) NSLog(@"%s %@", __FUNCTION__, error); + #endif + } + ]; + } + } + } +} + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar emailButton:(UIButton *)button +{ + if ([MFMailComposeViewController canSendMail] == NO) return; + + if (printInteraction != nil) [printInteraction dismissAnimated:YES]; + + unsigned long long fileSize = [document.fileSize unsignedLongLongValue]; + + if (fileSize < 15728640ull) // Check attachment size limit (15MB) + { + NSURL *fileURL = document.fileURL; NSString *fileName = document.fileName; + + NSData *attachment = [NSData dataWithContentsOfURL:fileURL options:(NSDataReadingMapped|NSDataReadingUncached) error:nil]; + + if (attachment != nil) // Ensure that we have valid document file attachment data available + { + MFMailComposeViewController *mailComposer = [MFMailComposeViewController new]; + + [mailComposer addAttachmentData:attachment mimeType:@"application/pdf" fileName:fileName]; + + [mailComposer setSubject:fileName]; // Use the document file name for the subject + + mailComposer.modalTransitionStyle = UIModalTransitionStyleCoverVertical; + mailComposer.modalPresentationStyle = UIModalPresentationFormSheet; + + mailComposer.mailComposeDelegate = self; // MFMailComposeViewControllerDelegate + + [self presentViewController:mailComposer animated:YES completion:NULL]; + } + } +} + +- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar markButton:(UIButton *)button +{ +#if (READER_BOOKMARKS == TRUE) // Option + + if (printInteraction != nil) [printInteraction dismissAnimated:YES]; + + if ([document.bookmarks containsIndex:currentPage]) // Remove bookmark + { + [document.bookmarks removeIndex:currentPage]; [mainToolbar setBookmarkState:NO]; + } + else // Add the bookmarked page number to the bookmark index set + { + [document.bookmarks addIndex:currentPage]; [mainToolbar setBookmarkState:YES]; + } + +#endif // end of READER_BOOKMARKS Option +} + +#pragma mark - MFMailComposeViewControllerDelegate methods + +- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error +{ +#ifdef DEBUG + if ((result == MFMailComposeResultFailed) && (error != NULL)) NSLog(@"%@", error); +#endif + + [self dismissViewControllerAnimated:YES completion:NULL]; +} + +#pragma mark - UIDocumentInteractionControllerDelegate methods + +- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller +{ + documentInteraction = nil; +} + +#pragma mark - ThumbsViewControllerDelegate methods + +- (void)thumbsViewController:(ThumbsViewController *)viewController gotoPage:(NSInteger)page +{ +#if (READER_ENABLE_THUMBS == TRUE) // Option + + [self showDocumentPage:page]; + +#endif // end of READER_ENABLE_THUMBS Option +} + +- (void)dismissThumbsViewController:(ThumbsViewController *)viewController +{ +#if (READER_ENABLE_THUMBS == TRUE) // Option + + [self dismissViewControllerAnimated:NO completion:NULL]; + +#endif // end of READER_ENABLE_THUMBS Option +} + +#pragma mark - ReaderMainPagebarDelegate methods + +- (void)pagebar:(ReaderMainPagebar *)pagebar gotoPage:(NSInteger)page +{ + [self showDocumentPage:page]; +} + +#pragma mark - UIApplication notification methods + +- (void)applicationWillResign:(NSNotification *)notification +{ + [document archiveDocumentProperties]; // Save any ReaderDocument changes + + if (userInterfaceIdiom == UIUserInterfaceIdiomPad) if (printInteraction != nil) [printInteraction dismissAnimated:NO]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsMainToolbar.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsMainToolbar.h new file mode 100755 index 0000000..8b3a528 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsMainToolbar.h @@ -0,0 +1,47 @@ +// +// ThumbsMainToolbar.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "UIXToolbarView.h" + +@class ThumbsMainToolbar; + +@protocol ThumbsMainToolbarDelegate + +@required // Delegate protocols + +- (void)tappedInToolbar:(ThumbsMainToolbar *)toolbar doneButton:(UIButton *)button; +- (void)tappedInToolbar:(ThumbsMainToolbar *)toolbar showControl:(UISegmentedControl *)control; + +@end + +@interface ThumbsMainToolbar : UIXToolbarView + +@property (nonatomic, weak, readwrite) id delegate; + +- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsMainToolbar.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsMainToolbar.m new file mode 100755 index 0000000..ee21ce2 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsMainToolbar.m @@ -0,0 +1,170 @@ +// +// ThumbsMainToolbar.m +// Reader v2.9.0 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ThumbsMainToolbar.h" + +@implementation ThumbsMainToolbar + +#pragma mark - Constants + +#define BUTTON_X 8.0f +//#define BUTTON_Y 8.0f +#define BUTTON_Y ((IPHONE_X == YES) ? 44.0 : 20.0) + +#define BUTTON_SPACE 8.0f +#define BUTTON_HEIGHT 30.0f + +#define BUTTON_FONT_SIZE 15.0f +#define TEXT_BUTTON_PADDING 24.0f + +#define SHOW_CONTROL_WIDTH 78.0f +#define ICON_BUTTON_WIDTH 40.0f + +#define TITLE_FONT_SIZE 19.0f +#define TITLE_HEIGHT 28.0f + +#pragma mark - Properties + +@synthesize delegate; + +#pragma mark - ThumbsMainToolbar instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + return [self initWithFrame:frame title:nil]; +} + +- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title +{ + if ((self = [super initWithFrame:frame])) + { + CGFloat viewWidth = self.bounds.size.width; // Toolbar view width + +#if (READER_FLAT_UI == TRUE) // Option + UIImage *buttonH = nil; UIImage *buttonN = nil; +#else + UIImage *buttonH = [[UIImage imageNamed:@"Reader-Button-H"] stretchableImageWithLeftCapWidth:5 topCapHeight:0]; + UIImage *buttonN = [[UIImage imageNamed:@"Reader-Button-N"] stretchableImageWithLeftCapWidth:5 topCapHeight:0]; +#endif // end of READER_FLAT_UI Option + + BOOL largeDevice = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); + + const CGFloat buttonSpacing = BUTTON_SPACE; //const CGFloat iconButtonWidth = ICON_BUTTON_WIDTH; + + CGFloat titleX = BUTTON_X; CGFloat titleWidth = (viewWidth - (titleX + titleX)); + + CGFloat leftButtonX = BUTTON_X; // Left-side button start X position + + UIFont *doneButtonFont = [UIFont systemFontOfSize:BUTTON_FONT_SIZE]; + NSString *doneButtonText = NSLocalizedString(@"Done", @"button text"); + CGSize doneButtonSize = [doneButtonText sizeWithAttributes:@{NSFontAttributeName : doneButtonFont}]; + CGFloat doneButtonWidth = (ceil(doneButtonSize.width) + TEXT_BUTTON_PADDING); + + UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom]; + doneButton.frame = CGRectMake(leftButtonX, BUTTON_Y, doneButtonWidth, BUTTON_HEIGHT); + [doneButton setTitleColor:[UIColor colorWithWhite:0.0f alpha:1.0f] forState:UIControlStateNormal]; + [doneButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forState:UIControlStateHighlighted]; + [doneButton setTitle:doneButtonText forState:UIControlStateNormal]; doneButton.titleLabel.font = doneButtonFont; + [doneButton addTarget:self action:@selector(doneButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + [doneButton setBackgroundImage:buttonH forState:UIControlStateHighlighted]; + [doneButton setBackgroundImage:buttonN forState:UIControlStateNormal]; + doneButton.autoresizingMask = UIViewAutoresizingNone; + //doneButton.backgroundColor = [UIColor grayColor]; + doneButton.exclusiveTouch = YES; + + [self addSubview:doneButton]; //leftButtonX += (doneButtonWidth + buttonSpacing); + + titleX += (doneButtonWidth + buttonSpacing); titleWidth -= (doneButtonWidth + buttonSpacing); + +#if (READER_BOOKMARKS == TRUE) // Option + + CGFloat showControlX = (viewWidth - (SHOW_CONTROL_WIDTH + buttonSpacing)); + + UIImage *thumbsImage = [UIImage imageNamed:@"Reader-Thumbs"]; + UIImage *bookmarkImage = [UIImage imageNamed:@"Reader-Mark-Y"]; + NSArray *buttonItems = [NSArray arrayWithObjects:thumbsImage, bookmarkImage, nil]; + + BOOL useTint = [self respondsToSelector:@selector(tintColor)]; // iOS 7 and up + + UISegmentedControl *showControl = [[UISegmentedControl alloc] initWithItems:buttonItems]; + showControl.frame = CGRectMake(showControlX, BUTTON_Y, SHOW_CONTROL_WIDTH, BUTTON_HEIGHT); + showControl.tintColor = (useTint ? [UIColor blackColor] : [UIColor colorWithWhite:0.8f alpha:1.0f]); + showControl.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; + //showControl.segmentedControlStyle = UISegmentedControlStyleBar; + showControl.selectedSegmentIndex = 0; // Default segment index + //showControl.backgroundColor = [UIColor grayColor]; + showControl.exclusiveTouch = YES; + + [showControl addTarget:self action:@selector(showControlTapped:) forControlEvents:UIControlEventValueChanged]; + + [self addSubview:showControl]; + + titleWidth -= (SHOW_CONTROL_WIDTH + buttonSpacing); + +#endif // end of READER_BOOKMARKS Option + + if (largeDevice == YES) // Show document filename in toolbar + { + CGRect titleRect = CGRectMake(titleX, BUTTON_Y, titleWidth, TITLE_HEIGHT); + + UILabel *titleLabel = [[UILabel alloc] initWithFrame:titleRect]; + + titleLabel.textAlignment = NSTextAlignmentCenter; + titleLabel.font = [UIFont systemFontOfSize:TITLE_FONT_SIZE]; + titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; + titleLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; + titleLabel.textColor = [UIColor colorWithWhite:0.0f alpha:1.0f]; + titleLabel.backgroundColor = [UIColor clearColor]; + titleLabel.adjustsFontSizeToFitWidth = YES; + titleLabel.minimumScaleFactor = 0.75f; + titleLabel.text = title; +#if (READER_FLAT_UI == FALSE) // Option + titleLabel.shadowColor = [UIColor colorWithWhite:0.65f alpha:1.0f]; + titleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f); +#endif // end of READER_FLAT_UI Option + + [self addSubview:titleLabel]; + } + } + + return self; +} + +#pragma mark - UISegmentedControl action methods + +- (void)showControlTapped:(UISegmentedControl *)control +{ + [delegate tappedInToolbar:self showControl:control]; +} + +#pragma mark - UIButton action methods + +- (void)doneButtonTapped:(UIButton *)button +{ + [delegate tappedInToolbar:self doneButton:button]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsViewController.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsViewController.h new file mode 100755 index 0000000..db36a87 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsViewController.h @@ -0,0 +1,66 @@ +// +// ThumbsViewController.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +#import "ThumbsMainToolbar.h" +#import "ReaderThumbsView.h" + +@class ReaderDocument; +@class ThumbsViewController; + +@protocol ThumbsViewControllerDelegate + +@required // Delegate protocols + +- (void)thumbsViewController:(ThumbsViewController *)viewController gotoPage:(NSInteger)page; + +- (void)dismissThumbsViewController:(ThumbsViewController *)viewController; + +@end + +@interface ThumbsViewController : UIViewController + +@property (nonatomic, weak, readwrite) id delegate; + +- (instancetype)initWithReaderDocument:(ReaderDocument *)object; + +@end + +#pragma mark - + +// +// ThumbsPageThumb class interface +// + +@interface ThumbsPageThumb : ReaderThumbView + +- (CGSize)maximumContentSize; + +- (void)showText:(NSString *)text; + +- (void)showBookmark:(BOOL)show; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsViewController.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsViewController.m new file mode 100755 index 0000000..27bef8b --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/ThumbsViewController.m @@ -0,0 +1,515 @@ +// +// ThumbsViewController.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "ThumbsViewController.h" +#import "ReaderThumbRequest.h" +#import "ReaderThumbCache.h" +#import "ReaderDocument.h" + +#import + +@interface ThumbsViewController () + +@end + +@implementation ThumbsViewController +{ + ReaderDocument *document; + + ThumbsMainToolbar *mainToolbar; + + ReaderThumbsView *theThumbsView; + + NSMutableArray *bookmarked; + + CGPoint thumbsOffset; + CGPoint markedOffset; + + BOOL updateBookmarked; + BOOL showBookmarked; +} + +#pragma mark - Constants + +//#define STATUS_HEIGHT 20.0f +//#define TOOLBAR_HEIGHT 44.0f +#define STATUS_HEIGHT ((IPHONE_X == YES ) ? 44.0 : 20.0) +#define TOOLBAR_HEIGHT ((IPHONE_X == YES ) ? 88.0 : 64.0) + +#define PAGE_THUMB_SMALL 160 +#define PAGE_THUMB_LARGE 256 + +#pragma mark - Properties + +@synthesize delegate; + +#pragma mark - UIViewController methods + +- (instancetype)initWithReaderDocument:(ReaderDocument *)object +{ + if ((self = [super initWithNibName:nil bundle:nil])) // Initialize superclass + { + if ((object != nil) && ([object isKindOfClass:[ReaderDocument class]])) // Valid object + { + updateBookmarked = YES; bookmarked = [NSMutableArray new]; // Bookmarked pages + + document = object; // Retain the ReaderDocument object for our use + } + else // Invalid ReaderDocument object + { + self = nil; + } + } + + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + assert(delegate != nil); assert(document != nil); + + self.view.backgroundColor = [UIColor grayColor]; // Neutral gray + + CGRect scrollViewRect = self.view.bounds; UIView *fakeStatusBar = nil; + + if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) // iOS 7+ + { + if ([self prefersStatusBarHidden] == NO) // Visible status bar + { + CGRect statusBarRect = self.view.bounds; // Status bar frame + statusBarRect.size.height = STATUS_HEIGHT; // Default status height + fakeStatusBar = [[UIView alloc] initWithFrame:statusBarRect]; // UIView + fakeStatusBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; + fakeStatusBar.backgroundColor = [UIColor blackColor]; + fakeStatusBar.contentMode = UIViewContentModeRedraw; + fakeStatusBar.userInteractionEnabled = NO; + + scrollViewRect.origin.y += STATUS_HEIGHT; scrollViewRect.size.height -= STATUS_HEIGHT; + } + } + + NSString *toolbarTitle = [document.fileName stringByDeletingPathExtension]; + + CGRect toolbarRect = scrollViewRect; // Toolbar frame + toolbarRect.size.height = TOOLBAR_HEIGHT; // Default toolbar height + mainToolbar = [[ThumbsMainToolbar alloc] initWithFrame:toolbarRect title:toolbarTitle]; // ThumbsMainToolbar + mainToolbar.delegate = self; // ThumbsMainToolbarDelegate + [self.view addSubview:mainToolbar]; + + if (fakeStatusBar != nil) [self.view addSubview:fakeStatusBar]; // Add status bar background view + + UIEdgeInsets scrollViewInsets = UIEdgeInsetsZero; // Scroll view toolbar insets + + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) // iPad + { + scrollViewRect.origin.y += TOOLBAR_HEIGHT; scrollViewRect.size.height -= TOOLBAR_HEIGHT; + } + else // Set UIScrollView insets for non-UIUserInterfaceIdiomPad case + { + scrollViewInsets.top = TOOLBAR_HEIGHT; + } + + theThumbsView = [[ReaderThumbsView alloc] initWithFrame:scrollViewRect]; // ReaderThumbsView + theThumbsView.contentInset = scrollViewInsets; theThumbsView.scrollIndicatorInsets = scrollViewInsets; + theThumbsView.delegate = self; // ReaderThumbsViewDelegate + [self.view insertSubview:theThumbsView belowSubview:mainToolbar]; + + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) + { + CGRect viewRect = self.view.bounds; CGSize viewSize = viewRect.size; // View size + + CGFloat min = ((viewSize.width < viewSize.height) ? viewSize.width : viewSize.height); + + CGFloat thumbSize = ((min > 320.0f) ? floorf(min / 3.0f) : PAGE_THUMB_SMALL); + + [theThumbsView setThumbSize:CGSizeMake(thumbSize, thumbSize)]; + } + else // Set thumb size for large (iPad) devices + { + [theThumbsView setThumbSize:CGSizeMake(PAGE_THUMB_LARGE, PAGE_THUMB_LARGE)]; + } +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + [theThumbsView reloadThumbsCenterOnIndex:([document.pageNumber integerValue] - 1)]; // Page +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; +} + +- (void)viewDidUnload +{ +#ifdef DEBUG + NSLog(@"%s", __FUNCTION__); +#endif + + mainToolbar = nil; theThumbsView = nil; + + [super viewDidUnload]; +} + +- (BOOL)prefersStatusBarHidden +{ + return YES; +} + +- (UIStatusBarStyle)preferredStatusBarStyle +{ + return UIStatusBarStyleLightContent; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + return YES; +} + +/* +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ +} + +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration +{ +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation +{ + //if (fromInterfaceOrientation == self.interfaceOrientation) return; +} +*/ + +- (void)didReceiveMemoryWarning +{ +#ifdef DEBUG + NSLog(@"%s", __FUNCTION__); +#endif + + [super didReceiveMemoryWarning]; +} + +#pragma mark - ThumbsMainToolbarDelegate methods + +- (void)tappedInToolbar:(ThumbsMainToolbar *)toolbar showControl:(UISegmentedControl *)control +{ + switch (control.selectedSegmentIndex) + { + case 0: // Show all page thumbs + { + showBookmarked = NO; // Show all thumbs + + markedOffset = [theThumbsView insetContentOffset]; + + [theThumbsView reloadThumbsContentOffset:thumbsOffset]; + + break; // We're done + } + + case 1: // Show bookmarked thumbs + { + showBookmarked = YES; // Only bookmarked + + thumbsOffset = [theThumbsView insetContentOffset]; + + if (updateBookmarked == YES) // Update bookmarked list + { + [bookmarked removeAllObjects]; // Empty the list first + + [document.bookmarks enumerateIndexesUsingBlock: // Enumerate + ^(NSUInteger page, BOOL *stop) + { + [bookmarked addObject:[NSNumber numberWithInteger:page]]; + } + ]; + + markedOffset = CGPointZero; updateBookmarked = NO; // Reset + } + + [theThumbsView reloadThumbsContentOffset:markedOffset]; + + break; // We're done + } + } +} + +- (void)tappedInToolbar:(ThumbsMainToolbar *)toolbar doneButton:(UIButton *)button +{ + [delegate dismissThumbsViewController:self]; // Dismiss thumbs display +} + +#pragma mark - UIThumbsViewDelegate methods + +- (NSUInteger)numberOfThumbsInThumbsView:(ReaderThumbsView *)thumbsView +{ + return (showBookmarked ? bookmarked.count : [document.pageCount integerValue]); +} + +- (id)thumbsView:(ReaderThumbsView *)thumbsView thumbCellWithFrame:(CGRect)frame +{ + return [[ThumbsPageThumb alloc] initWithFrame:frame]; +} + +- (void)thumbsView:(ReaderThumbsView *)thumbsView updateThumbCell:(ThumbsPageThumb *)thumbCell forIndex:(NSInteger)index +{ + CGSize size = [thumbCell maximumContentSize]; // Get the cell's maximum content size + + NSInteger page = (showBookmarked ? [[bookmarked objectAtIndex:index] integerValue] : (index + 1)); + + [thumbCell showText:[[NSString alloc] initWithFormat:@"%i", (int)page]]; // Page number place holder + + [thumbCell showBookmark:[document.bookmarks containsIndex:page]]; // Show bookmarked status + + NSURL *fileURL = document.fileURL; NSString *guid = document.guid; NSString *phrase = document.password; // Document info + + ReaderThumbRequest *thumbRequest = [ReaderThumbRequest newForView:thumbCell fileURL:fileURL password:phrase guid:guid page:page size:size]; + + UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:thumbRequest priority:YES]; // Request the thumbnail + + if ([image isKindOfClass:[UIImage class]]) [thumbCell showImage:image]; // Show image from cache +} + +- (void)thumbsView:(ReaderThumbsView *)thumbsView refreshThumbCell:(ThumbsPageThumb *)thumbCell forIndex:(NSInteger)index +{ + NSInteger page = (showBookmarked ? [[bookmarked objectAtIndex:index] integerValue] : (index + 1)); + + [thumbCell showBookmark:[document.bookmarks containsIndex:page]]; // Show bookmarked status +} + +- (void)thumbsView:(ReaderThumbsView *)thumbsView didSelectThumbWithIndex:(NSInteger)index +{ + NSInteger page = (showBookmarked ? [[bookmarked objectAtIndex:index] integerValue] : (index + 1)); + + [delegate thumbsViewController:self gotoPage:page]; // Show the selected page + + [delegate dismissThumbsViewController:self]; // Dismiss thumbs display +} + +- (void)thumbsView:(ReaderThumbsView *)thumbsView didPressThumbWithIndex:(NSInteger)index +{ + NSInteger page = (showBookmarked ? [[bookmarked objectAtIndex:index] integerValue] : (index + 1)); + + if ([document.bookmarks containsIndex:page]) [document.bookmarks removeIndex:page]; else [document.bookmarks addIndex:page]; + + updateBookmarked = YES; [thumbsView refreshThumbWithIndex:index]; // Refresh page thumb +} + +@end + +#pragma mark - + +// +// ThumbsPageThumb class implementation +// + +@implementation ThumbsPageThumb +{ + UIView *backView; + + UIView *tintView; + + UILabel *textLabel; + + UIImageView *bookMark; + + CGSize maximumSize; + + CGRect defaultRect; +} + +#pragma mark - Constants + +#define CONTENT_INSET 8.0f + +#pragma mark - ThumbsPageThumb instance methods + +- (CGRect)markRectInImageView +{ + CGRect iconRect = bookMark.frame; iconRect.origin.y = (-2.0f); + + iconRect.origin.x = (imageView.bounds.size.width - bookMark.image.size.width - 8.0f); + + return iconRect; // Frame position rect inside of image view +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + imageView.contentMode = UIViewContentModeCenter; + + defaultRect = CGRectInset(self.bounds, CONTENT_INSET, CONTENT_INSET); + + maximumSize = defaultRect.size; // Maximum thumb content size + + CGFloat newWidth = ((defaultRect.size.width / 4.0f) * 3.0f); + + CGFloat offsetX = ((defaultRect.size.width - newWidth) * 0.5f); + + defaultRect.size.width = newWidth; defaultRect.origin.x += offsetX; + + imageView.frame = defaultRect; // Update the image view frame + + CGFloat fontSize = (([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? 19.0f : 16.0f); + + textLabel = [[UILabel alloc] initWithFrame:defaultRect]; + + textLabel.autoresizesSubviews = NO; + textLabel.userInteractionEnabled = NO; + textLabel.contentMode = UIViewContentModeRedraw; + textLabel.autoresizingMask = UIViewAutoresizingNone; + textLabel.textAlignment = NSTextAlignmentCenter; + textLabel.font = [UIFont systemFontOfSize:fontSize]; + textLabel.textColor = [UIColor colorWithWhite:0.24f alpha:1.0f]; + textLabel.backgroundColor = [UIColor whiteColor]; + + [self insertSubview:textLabel belowSubview:imageView]; + + backView = [[UIView alloc] initWithFrame:defaultRect]; + + backView.autoresizesSubviews = NO; + backView.userInteractionEnabled = NO; + backView.contentMode = UIViewContentModeRedraw; + backView.autoresizingMask = UIViewAutoresizingNone; + backView.backgroundColor = [UIColor whiteColor]; + +#if (READER_SHOW_SHADOWS == TRUE) // Option + + backView.layer.shadowOffset = CGSizeMake(0.0f, 1.0f); + backView.layer.shadowRadius = 3.0f; backView.layer.shadowOpacity = 1.0f; + backView.layer.shadowPath = [UIBezierPath bezierPathWithRect:backView.bounds].CGPath; + +#endif // end of READER_SHOW_SHADOWS Option + + [self insertSubview:backView belowSubview:textLabel]; + + tintView = [[UIView alloc] initWithFrame:imageView.bounds]; + + tintView.hidden = YES; + tintView.autoresizesSubviews = NO; + tintView.userInteractionEnabled = NO; + tintView.contentMode = UIViewContentModeRedraw; + tintView.autoresizingMask = UIViewAutoresizingNone; + tintView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.25f]; + + [imageView addSubview:tintView]; + + UIImage *image = [UIImage imageNamed:@"Reader-Mark-Y"]; + + bookMark = [[UIImageView alloc] initWithImage:image]; + + bookMark.hidden = YES; + bookMark.autoresizesSubviews = NO; + bookMark.userInteractionEnabled = NO; + bookMark.contentMode = UIViewContentModeCenter; + bookMark.autoresizingMask = UIViewAutoresizingNone; + bookMark.frame = [self markRectInImageView]; + + [imageView addSubview:bookMark]; + } + + return self; +} + +- (CGSize)maximumContentSize +{ + return maximumSize; +} + +- (void)showImage:(UIImage *)image +{ + NSInteger x = (self.bounds.size.width * 0.5f); + NSInteger y = (self.bounds.size.height * 0.5f); + + CGPoint location = CGPointMake(x, y); // Center point + + CGRect viewRect = CGRectZero; viewRect.size = image.size; + + textLabel.bounds = viewRect; textLabel.center = location; // Position + + imageView.bounds = viewRect; imageView.center = location; imageView.image = image; + + bookMark.frame = [self markRectInImageView]; // Position bookmark image + + tintView.frame = imageView.bounds; backView.bounds = viewRect; backView.center = location; + +#if (READER_SHOW_SHADOWS == TRUE) // Option + + backView.layer.shadowPath = [UIBezierPath bezierPathWithRect:backView.bounds].CGPath; + +#endif // end of READER_SHOW_SHADOWS Option +} + +- (void)reuse +{ + [super reuse]; // Reuse thumb view + + textLabel.text = nil; textLabel.frame = defaultRect; + + imageView.image = nil; imageView.frame = defaultRect; + + bookMark.hidden = YES; bookMark.frame = [self markRectInImageView]; + + tintView.hidden = YES; tintView.frame = imageView.bounds; backView.frame = defaultRect; + +#if (READER_SHOW_SHADOWS == TRUE) // Option + + backView.layer.shadowPath = [UIBezierPath bezierPathWithRect:backView.bounds].CGPath; + +#endif // end of READER_SHOW_SHADOWS Option +} + +- (void)showBookmark:(BOOL)show +{ + bookMark.hidden = (show ? NO : YES); +} + +- (void)showTouched:(BOOL)touched +{ + tintView.hidden = (touched ? NO : YES); +} + +- (void)showText:(NSString *)text +{ + textLabel.text = text; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/UIXToolbarView.h b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/UIXToolbarView.h new file mode 100755 index 0000000..5ca89bf --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/UIXToolbarView.h @@ -0,0 +1,40 @@ +// +// UIXToolbarView.h +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface UIXToolbarView : UIView + +@end + +#pragma mark - + +// +// UIXToolbarShadow class interface +// + +@interface UIXToolbarShadow : UIView + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/UIXToolbarView.m b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/UIXToolbarView.m new file mode 100755 index 0000000..44829db --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/Reader/Sources/UIXToolbarView.m @@ -0,0 +1,131 @@ +// +// UIXToolbarView.m +// Reader v2.8.6 +// +// Created by Julius Oklamcak on 2011-09-01. +// Copyright © 2011-2015 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderConstants.h" +#import "UIXToolbarView.h" + +#import + +@implementation UIXToolbarView + +#pragma mark - Constants + +#define SHADOW_HEIGHT 4.0f + +#pragma mark - UIXToolbarView class methods + ++ (Class)layerClass +{ +#if (READER_FLAT_UI == FALSE) // Option + return [CAGradientLayer class]; +#else + return [CALayer class]; +#endif // end of READER_FLAT_UI Option +} + +#pragma mark - UIXToolbarView instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = YES; + self.userInteractionEnabled = YES; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingFlexibleWidth; + + if ([self.layer isKindOfClass:[CAGradientLayer class]]) + { + self.backgroundColor = [UIColor clearColor]; + + CAGradientLayer *layer = (CAGradientLayer *)self.layer; + UIColor *liteColor = [UIColor colorWithWhite:0.92f alpha:0.8f]; + UIColor *darkColor = [UIColor colorWithWhite:0.32f alpha:0.8f]; + layer.colors = [NSArray arrayWithObjects:(id)liteColor.CGColor, (id)darkColor.CGColor, nil]; + + CGRect shadowRect = self.bounds; shadowRect.origin.y += shadowRect.size.height; shadowRect.size.height = SHADOW_HEIGHT; + + UIXToolbarShadow *shadowView = [[UIXToolbarShadow alloc] initWithFrame:shadowRect]; + + [self addSubview:shadowView]; // Add shadow to toolbar + } + else // Follow The Fuglyosity of Flat Fad + { + self.backgroundColor = [UIColor colorWithWhite:0.94f alpha:0.94f]; + + CGRect lineRect = self.bounds; lineRect.origin.y += lineRect.size.height; lineRect.size.height = 1.0f; + + UIView *lineView = [[UIView alloc] initWithFrame:lineRect]; + lineView.autoresizesSubviews = NO; + lineView.userInteractionEnabled = NO; + lineView.contentMode = UIViewContentModeRedraw; + lineView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + lineView.backgroundColor = [UIColor colorWithWhite:0.64f alpha:0.94f]; + [self addSubview:lineView]; + } + } + + return self; +} + +@end + +#pragma mark - + +// +// UIXToolbarShadow class implementation +// + +@implementation UIXToolbarShadow + +#pragma mark - UIXToolbarShadow class methods + ++ (Class)layerClass +{ + return [CAGradientLayer class]; +} + +#pragma mark - UIXToolbarShadow instance methods + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) + { + self.autoresizesSubviews = NO; + self.userInteractionEnabled = NO; + self.contentMode = UIViewContentModeRedraw; + self.autoresizingMask = UIViewAutoresizingFlexibleWidth; + self.backgroundColor = [UIColor clearColor]; + + CAGradientLayer *layer = (CAGradientLayer *)self.layer; + UIColor *blackColor = [UIColor colorWithWhite:0.24f alpha:1.0f]; + UIColor *clearColor = [UIColor colorWithWhite:0.24f alpha:0.0f]; + layer.colors = [NSArray arrayWithObjects:(id)blackColor.CGColor, (id)clearColor.CGColor, nil]; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/RingView/QHCircleProgressView.h b/XinjiangProject/XinjiangProject/ThirdParty/RingView/QHCircleProgressView.h new file mode 100644 index 0000000..d57ce67 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/RingView/QHCircleProgressView.h @@ -0,0 +1,48 @@ +// +// QHCircleProgressView.h +// QinghaiProject +// +// Created by Apple on 2024/7/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QHCircleProgressView : UIView +/* + 起点角度 + */ +@property(nonatomic,assign) CGFloat startAngle; +/* + 终点 角度 + */ + @property(nonatomic,assign) CGFloat endInnerAngle; +/* + 线宽 + */ +@property(nonatomic,assign) CGFloat lineWith; +/* + 百分比数字 + */ +@property (nonatomic,assign) CGFloat percentage; +/* + 基准圆环颜色 + */ +@property(nonatomic,strong) UIColor *unfillColor; +/* + 显示圆环颜色 + */ +@property(nonatomic,strong) UIColor *fillColor; +/* + 内外环距离 + */ +@property(nonatomic,assign) CGFloat Distance; +/* + 内部百分比数字 + */ +@property (nonatomic,assign) CGFloat InternalPercent; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/ThirdParty/RingView/QHCircleProgressView.m b/XinjiangProject/XinjiangProject/ThirdParty/RingView/QHCircleProgressView.m new file mode 100644 index 0000000..36c5035 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/RingView/QHCircleProgressView.m @@ -0,0 +1,153 @@ +// +// QHCircleProgressView.m +// QinghaiProject +// +// Created by Apple on 2024/7/18. +// + +#import "QHCircleProgressView.h" +#define DEGREES_TO_RADIANS(degrees) ((M_PI * degrees)/ 180) + + +@interface QHCircleProgressView () +@property(nonatomic, assign) CGPoint CGPoinCerter; +@property(nonatomic, assign) CGFloat endAngle; +@property(nonatomic, assign) CGFloat InternalEndAngle; +@property(nonatomic, assign) BOOL clockwise; + +@end + +@implementation QHCircleProgressView + +{ + CGFloat _radius; +} + +-(instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + self.lineWith = 10.0; + self.fillColor = [UIColor greenColor]; + self.unfillColor = [UIColor lightGrayColor]; + self.clockwise = YES; + self.backgroundColor = [UIColor yellowColor]; + self.percentage = 0; + self.startAngle = 180; + self.endAngle = 360; + self.Distance = 5; + } + return self; +} + +#pragma mark setMethod +/** + * 画图函数 + * + * @param rect rect description + */ +-(void)drawRect:(CGRect)rect{ + [self initData]; + [self drawMiddlecircle]; + [self drawOutCCircle]; + //显示内部圆 + [self drawinteriorCircleOutCCircle]; + [self drawInteriorMiddlecircle]; +} + +-(void)initData +{ + + //中心标签设置 + CGFloat center =MIN(self.bounds.size.height/2, self.bounds.size.width/2); + self.CGPoinCerter = CGPointMake(center, center); + //半径计算 + _radius = MIN(self.bounds.size.height/2-self.lineWith/2, self.bounds.size.width/2-self.lineWith/2); + //起点与终点坐标 + self.endInnerAngle = DEGREES_TO_RADIANS(self.endInnerAngle); + self.startAngle = DEGREES_TO_RADIANS(self.startAngle); + self.endAngle = self.percentage*(self.endInnerAngle - self.startAngle) + self.startAngle; + self.InternalEndAngle = self. InternalPercent *(self.endInnerAngle - self.startAngle) + self.startAngle; +} + +#pragma mark - 利用layer的 strokeEnd、strokeStart和lineWidth 属性添加CA动画 +- (void)addAnimationOneOnLayer:(CAShapeLayer *)layer duration:(CFTimeInterval)duration +{ + CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; + animation.fromValue = @(0); + animation.toValue = @(1); + animation.duration = duration; + [layer addAnimation:animation forKey:nil]; +} + + +/** + * 显示圆环 + */ +-(void )drawOutCCircle{ + UIBezierPath *bPath = [UIBezierPath bezierPathWithArcCenter:self.CGPoinCerter radius:_radius startAngle:self.startAngle endAngle:self.endAngle clockwise:self.clockwise]; + + CAShapeLayer *layer = [CAShapeLayer layer]; + layer.lineWidth = self.lineWith; + layer.lineCap = kCALineCapRound; + layer.lineJoin = kCALineJoinRound; + layer.strokeColor = self.fillColor.CGColor; + layer.fillColor = nil; + layer.path = bPath.CGPath; + [self.layer addSublayer:layer]; + + [self addAnimationOneOnLayer:layer duration:1.0]; +} +/** + * 辅助圆环 + */ +-(void)drawMiddlecircle{ + UIBezierPath *cPath = [UIBezierPath bezierPathWithArcCenter:self.CGPoinCerter radius:_radius startAngle:self.startAngle endAngle:self.endInnerAngle clockwise:self.clockwise]; + cPath.lineWidth=self.lineWith; + cPath.lineCapStyle = kCGLineCapRound; + cPath.lineJoinStyle = kCGLineJoinRound; + UIColor *color = self.unfillColor; + [color setStroke]; + [cPath stroke]; +} + +/** + * 显示内部环//百分比环 + */ +-(void )drawinteriorCircleOutCCircle{ + UIBezierPath *bPath = [UIBezierPath bezierPathWithArcCenter:self.CGPoinCerter radius:_radius -_lineWith - self.Distance startAngle:self.startAngle endAngle:self.InternalEndAngle clockwise:self.clockwise]; + + CAShapeLayer *layer = [CAShapeLayer layer]; + layer.lineWidth = self.lineWith; + layer.lineCap = kCALineCapRound; + layer.lineJoin = kCALineJoinRound; + layer.strokeColor = self.fillColor.CGColor; + layer.fillColor = nil; + layer.path = bPath.CGPath; + [self.layer addSublayer:layer]; + + [self addAnimationOneOnLayer:layer duration:1.0]; +} +/** + * 内部辅助圆环// 满环 + */ +-(void)drawInteriorMiddlecircle{ + UIBezierPath *cPath = [UIBezierPath bezierPathWithArcCenter:self.CGPoinCerter radius:_radius - _lineWith - self.Distance startAngle:self.startAngle endAngle:self.endInnerAngle clockwise:self.clockwise]; + cPath.lineWidth=self.lineWith; + cPath.lineCapStyle = kCGLineCapRound; + cPath.lineJoinStyle = kCGLineJoinRound; + UIColor *color = self.unfillColor; + [color setStroke]; + [cPath stroke]; +} + +/** +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDBrowserImageView.h b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDBrowserImageView.h new file mode 100755 index 0000000..e5d88e5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDBrowserImageView.h @@ -0,0 +1,27 @@ +// +// SDBrowserImageView.h +// SDPhotoBrowser +// +// Created by aier on 15-2-6. +// Copyright (c) 2015年 GSD. All rights reserved. +// + +#import +#import "SDWaitingView.h" + + +@interface SDBrowserImageView : UIImageView + +@property (nonatomic, assign) CGFloat progress; +@property (nonatomic, assign, readonly) BOOL isScaled; +@property (nonatomic, assign) BOOL hasLoadedImage; + +- (void)eliminateScale; // 清除缩放 + +- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder; + +- (void)doubleTapToZommWithScale:(CGFloat)scale; + +- (void)clear; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDBrowserImageView.m b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDBrowserImageView.m new file mode 100755 index 0000000..ec566d6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDBrowserImageView.m @@ -0,0 +1,237 @@ +// +// SDBrowserImageView.m +// SDPhotoBrowser +// +// Created by aier on 15-2-6. +// Copyright (c) 2015年 GSD. All rights reserved. +// + +#import "SDBrowserImageView.h" +#import "UIImageView+WebCache.h" +#import "SDPhotoBrowserConfig.h" + +@implementation SDBrowserImageView +{ + __weak SDWaitingView *_waitingView; + BOOL _didCheckSize; + UIScrollView *_scroll; + UIImageView *_scrollImageView; + UIScrollView *_zoomingScroolView; + UIImageView *_zoomingImageView; + CGFloat _totalScale; +} + + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.userInteractionEnabled = YES; + self.contentMode = UIViewContentModeScaleAspectFit; + _totalScale = 1.0; + + // 捏合手势缩放图片 + UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(zoomImage:)]; + pinch.delegate = self; + [self addGestureRecognizer:pinch]; + + + + } + return self; +} + +- (BOOL)isScaled +{ + return 1.0 != _totalScale; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + _waitingView.center = CGPointMake(self.frame.size.width * 0.5, self.frame.size.height * 0.5); + + CGSize imageSize = self.image.size; + + if (self.bounds.size.width * (imageSize.height / imageSize.width) > self.bounds.size.height) { + if (!_scroll) { + UIScrollView *scroll = [[UIScrollView alloc] init]; + scroll.backgroundColor = [UIColor whiteColor]; + UIImageView *imageView = [[UIImageView alloc] init]; + imageView.image = self.image; + _scrollImageView = imageView; + [scroll addSubview:imageView]; + scroll.backgroundColor = SDPhotoBrowserBackgrounColor; + _scroll = scroll; + [self addSubview:scroll]; + if (_waitingView) { + [self bringSubviewToFront:_waitingView]; + } + } + _scroll.frame = self.bounds; + + CGFloat imageViewH = self.bounds.size.width * (imageSize.height / imageSize.width); + + _scrollImageView.bounds = CGRectMake(0, 0, _scroll.frame.size.width, imageViewH); + _scrollImageView.center = CGPointMake(_scroll.frame.size.width * 0.5, _scrollImageView.frame.size.height * 0.5); + _scroll.contentSize = CGSizeMake(0, _scrollImageView.bounds.size.height); + + } else { + if (_scroll) [_scroll removeFromSuperview]; // 防止旋转时适配的scrollView的影响 + } + +} + + + +- (void)setProgress:(CGFloat)progress +{ + _progress = progress; + _waitingView.progress = progress; + +} + +- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder +{ + SDWaitingView *waiting = [[SDWaitingView alloc] init]; + waiting.bounds = CGRectMake(0, 0, 100, 100); + waiting.mode = SDWaitingViewProgressMode; + _waitingView = waiting; + [self addSubview:waiting]; + + + __weak SDBrowserImageView *imageViewWeak = self; + + + [self sd_setImageWithURL:url placeholderImage:placeholder options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { + imageViewWeak.progress = (CGFloat)receivedSize / expectedSize; + + } completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + [imageViewWeak removeWaitingView]; + + + if (error) { + UILabel *label = [[UILabel alloc] init]; + label.bounds = CGRectMake(0, 0, 160, 30); + label.center = CGPointMake(imageViewWeak.bounds.size.width * 0.5, imageViewWeak.bounds.size.height * 0.5); + label.text = @"图片加载失败"; + label.font = [UIFont systemFontOfSize:16]; + label.textColor = [UIColor whiteColor]; + label.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8]; + label.layer.cornerRadius = 5; + label.clipsToBounds = YES; + label.textAlignment = NSTextAlignmentCenter; + [imageViewWeak addSubview:label]; + } else { + _scrollImageView.image = image; + [_scrollImageView setNeedsDisplay]; + } + + }]; +} + +- (void)zoomImage:(UIPinchGestureRecognizer *)recognizer +{ + [self prepareForImageViewScaling]; + CGFloat scale = recognizer.scale; + CGFloat temp = _totalScale + (scale - 1); + [self setTotalScale:temp]; + recognizer.scale = 1.0; +} + +- (void)setTotalScale:(CGFloat)totalScale +{ + if ((_totalScale < 0.5 && totalScale < _totalScale) || (_totalScale > 2.0 && totalScale > _totalScale)) return; // 最大缩放 2倍,最小0.5倍 + + [self zoomWithScale:totalScale]; +} + +- (void)zoomWithScale:(CGFloat)scale +{ + _totalScale = scale; + + _zoomingImageView.transform = CGAffineTransformMakeScale(scale, scale); + + if (scale > 1) { + CGFloat contentW = _zoomingImageView.frame.size.width; + CGFloat contentH = MAX(_zoomingImageView.frame.size.height, self.frame.size.height); + + _zoomingImageView.center = CGPointMake(contentW * 0.5, contentH * 0.5); + _zoomingScroolView.contentSize = CGSizeMake(contentW, contentH); + + + CGPoint offset = _zoomingScroolView.contentOffset; + offset.x = (contentW - _zoomingScroolView.frame.size.width) * 0.5; +// offset.y = (contentH - _zoomingImageView.frame.size.height) * 0.5; + _zoomingScroolView.contentOffset = offset; + + } else { + _zoomingScroolView.contentSize = _zoomingScroolView.frame.size; + _zoomingScroolView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0); + _zoomingImageView.center = _zoomingScroolView.center; + } +} + +- (void)doubleTapToZommWithScale:(CGFloat)scale +{ + [self prepareForImageViewScaling]; + [UIView animateWithDuration:0.5 animations:^{ + [self zoomWithScale:scale]; + } completion:^(BOOL finished) { + if (scale == 1) { + [self clear]; + } + }]; +} + +- (void)prepareForImageViewScaling +{ + if (!_zoomingScroolView) { + _zoomingScroolView = [[UIScrollView alloc] initWithFrame:self.bounds]; + _zoomingScroolView.backgroundColor = SDPhotoBrowserBackgrounColor; + _zoomingScroolView.contentSize = self.bounds.size; + UIImageView *zoomingImageView = [[UIImageView alloc] initWithImage:self.image]; + CGSize imageSize = zoomingImageView.image.size; + CGFloat imageViewH = self.bounds.size.height; + if (imageSize.width > 0) { + imageViewH = self.bounds.size.width * (imageSize.height / imageSize.width); + } + zoomingImageView.bounds = CGRectMake(0, 0, self.bounds.size.width, imageViewH); + zoomingImageView.center = _zoomingScroolView.center; + zoomingImageView.contentMode = UIViewContentModeScaleAspectFit; + _zoomingImageView = zoomingImageView; + [_zoomingScroolView addSubview:zoomingImageView]; + [self addSubview:_zoomingScroolView]; + } +} + +- (void)scaleImage:(CGFloat)scale +{ + [self prepareForImageViewScaling]; + [self setTotalScale:scale]; +} + +// 清除缩放 +- (void)eliminateScale +{ + [self clear]; + _totalScale = 1.0; +} + +- (void)clear +{ + [_zoomingScroolView removeFromSuperview]; + _zoomingScroolView = nil; + _zoomingImageView = nil; + +} + +- (void)removeWaitingView +{ + [_waitingView removeFromSuperview]; +} + + + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.h b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.h new file mode 100755 index 0000000..f00d647 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.h @@ -0,0 +1,37 @@ +// +// SDPhotoBrowser.h +// photobrowser +// +// Created by aier on 15-2-3. +// Copyright (c) 2015年 aier. All rights reserved. +// + +#import + + +@class SDButton, SDPhotoBrowser; + +@protocol SDPhotoBrowserDelegate + +@required + +- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index; + +@optional + +- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index; + +@end + + +@interface SDPhotoBrowser : UIView + +@property (nonatomic, strong) UIView *sourceImagesContainerView; +@property (nonatomic, assign) NSInteger currentImageIndex; +@property (nonatomic, assign) NSInteger imageCount; + +@property (nonatomic, weak) id delegate; + +- (void)show; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.m b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.m new file mode 100755 index 0000000..3731dea --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.m @@ -0,0 +1,377 @@ +// +// SDPhotoBrowser.m +// photobrowser +// +// Created by aier on 15-2-3. +// Copyright (c) 2015年 aier. All rights reserved. +// + +#import "SDPhotoBrowser.h" +#import "UIImageView+WebCache.h" +#import "SDBrowserImageView.h" + + +// ============在这里方便配置样式相关设置=========== + +// || +// || +// || +// \\// +// \/ + +#import "SDPhotoBrowserConfig.h" + +// ============================================= + +@implementation SDPhotoBrowser +{ + UIScrollView *_scrollView; + BOOL _hasShowedFistView; + UILabel *_indexLabel; + UIButton *_saveButton; + UIActivityIndicatorView *_indicatorView; + BOOL _willDisappear; +} + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = SDPhotoBrowserBackgrounColor; + } + return self; +} + + +- (void)didMoveToSuperview +{ + [self setupScrollView]; + + [self setupToolbars]; +} + +- (void)dealloc +{ + [[UIApplication sharedApplication].keyWindow removeObserver:self forKeyPath:@"frame"]; +} + +- (void)setupToolbars +{ + // 1. 序标 + UILabel *indexLabel = [[UILabel alloc] init]; + indexLabel.bounds = CGRectMake(0, kStatusBarHeight+10, 80, 30); + indexLabel.textAlignment = NSTextAlignmentCenter; + indexLabel.textColor = [UIColor whiteColor]; + indexLabel.font = [UIFont boldSystemFontOfSize:20]; + indexLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; + indexLabel.layer.cornerRadius = indexLabel.bounds.size.height * 0.5; + indexLabel.clipsToBounds = YES; + if (self.imageCount > 1) { + indexLabel.text = [NSString stringWithFormat:@"1/%ld", (long)self.imageCount]; + } + _indexLabel = indexLabel; + [self addSubview:indexLabel]; + + // 2.保存按钮 + UIButton *saveButton = [[UIButton alloc] init]; + [saveButton setTitle:@"保存" forState:UIControlStateNormal]; + [saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + saveButton.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.90f]; + saveButton.layer.cornerRadius = 5; + saveButton.clipsToBounds = YES; + [saveButton addTarget:self action:@selector(saveImage) forControlEvents:UIControlEventTouchUpInside]; + _saveButton = saveButton; + [self addSubview:saveButton]; + + UIButton * delectBtn = [[UIButton alloc] initWithFrame:CGRectMake(WIDTH-80, kStatusBarHeight+8, 70, 70)]; + [delectBtn setTitle:@"X" forState:UIControlStateNormal]; + [delectBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [delectBtn addTarget:self action:@selector(delectImage) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:delectBtn]; + +} + +- (void)delectImage +{ + [self removeFromSuperview]; +} + +- (void)saveImage +{ + int index = _scrollView.contentOffset.x / _scrollView.bounds.size.width; + UIImageView *currentImageView = _scrollView.subviews[index]; + + UIImageWriteToSavedPhotosAlbum(currentImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL); + + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] init]; + indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + indicator.center = self.center; + _indicatorView = indicator; + [[UIApplication sharedApplication].keyWindow addSubview:indicator]; + [indicator startAnimating]; +} + +- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; +{ + [_indicatorView removeFromSuperview]; + + UILabel *label = [[UILabel alloc] init]; + label.textColor = [UIColor whiteColor]; + label.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.90f]; + label.layer.cornerRadius = 5; + label.clipsToBounds = YES; + label.bounds = CGRectMake(0, 0, 150, 30); + label.center = self.center; + label.textAlignment = NSTextAlignmentCenter; + label.font = [UIFont boldSystemFontOfSize:17]; + [[UIApplication sharedApplication].keyWindow addSubview:label]; + [[UIApplication sharedApplication].keyWindow bringSubviewToFront:label]; + if (error) { + label.text = SDPhotoBrowserSaveImageFailText; + } else { + label.text = SDPhotoBrowserSaveImageSuccessText; + } + [label performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.0]; +} + +- (void)setupScrollView +{ + _scrollView = [[UIScrollView alloc] init]; + _scrollView.delegate = self; + _scrollView.showsHorizontalScrollIndicator = NO; + _scrollView.showsVerticalScrollIndicator = NO; + _scrollView.pagingEnabled = YES; + [self addSubview:_scrollView]; + + for (int i = 0; i < self.imageCount; i++) { + SDBrowserImageView *imageView = [[SDBrowserImageView alloc] init]; + imageView.tag = i; + + // 单击图片 + UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(photoClick:)]; + + // 双击放大图片 + UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewDoubleTaped:)]; + doubleTap.numberOfTapsRequired = 2; + + [singleTap requireGestureRecognizerToFail:doubleTap]; + + [imageView addGestureRecognizer:singleTap]; + [imageView addGestureRecognizer:doubleTap]; + [_scrollView addSubview:imageView]; + } + + + [self setupImageOfImageViewForIndex:self.currentImageIndex]; + +} + +// 加载图片 +- (void)setupImageOfImageViewForIndex:(NSInteger)index +{ + SDBrowserImageView *imageView = _scrollView.subviews[index]; + self.currentImageIndex = index; + if (imageView.hasLoadedImage) return; + if ([self highQualityImageURLForIndex:index]) { + [imageView setImageWithURL:[self highQualityImageURLForIndex:index] placeholderImage:[self placeholderImageForIndex:index]]; + } else { + imageView.image = [self placeholderImageForIndex:index]; + } + imageView.hasLoadedImage = YES; +} + +- (void)photoClick:(UITapGestureRecognizer *)recognizer +{ + _scrollView.hidden = YES; + _willDisappear = YES; + + SDBrowserImageView *currentImageView = (SDBrowserImageView *)recognizer.view; + NSInteger currentIndex = currentImageView.tag; + + UIView *sourceView = nil; + if ([self.sourceImagesContainerView isKindOfClass:UICollectionView.class]) { + UICollectionView *view = (UICollectionView *)self.sourceImagesContainerView; + NSIndexPath *path = [NSIndexPath indexPathForItem:currentIndex inSection:0]; + sourceView = [view cellForItemAtIndexPath:path]; + }else { + if (self.sourceImagesContainerView.subviews.count >= currentIndex ) + sourceView = self.sourceImagesContainerView.subviews[currentIndex]; + } + + + CGRect targetTemp = [self.sourceImagesContainerView convertRect:sourceView.frame toView:self]; + + UIImageView *tempView = [[UIImageView alloc] init]; + tempView.contentMode = sourceView.contentMode; + tempView.clipsToBounds = YES; + tempView.image = currentImageView.image; + CGFloat h = (self.bounds.size.width / currentImageView.image.size.width) * currentImageView.image.size.height; + + if (!currentImageView.image) { // 防止 因imageview的image加载失败 导致 崩溃 + h = self.bounds.size.height; + } + + tempView.bounds = CGRectMake(0, 0, self.bounds.size.width, h); + tempView.center = self.center; + + [self addSubview:tempView]; + + _saveButton.hidden = YES; + + [UIView animateWithDuration:SDPhotoBrowserHideImageAnimationDuration animations:^{ + tempView.frame = targetTemp; + self.backgroundColor = [UIColor clearColor]; + _indexLabel.alpha = 0.1; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} + +- (void)imageViewDoubleTaped:(UITapGestureRecognizer *)recognizer +{ + SDBrowserImageView *imageView = (SDBrowserImageView *)recognizer.view; + CGFloat scale; + if (imageView.isScaled) { + scale = 1.0; + } else { + scale = 2.0; + } + + SDBrowserImageView *view = (SDBrowserImageView *)recognizer.view; + + [view doubleTapToZommWithScale:scale]; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + + CGRect rect = self.bounds; + rect.size.width += SDPhotoBrowserImageViewMargin * 2; + + _scrollView.bounds = rect; + _scrollView.center = self.center; + + CGFloat y = 0; + CGFloat w = _scrollView.frame.size.width - SDPhotoBrowserImageViewMargin * 2; + CGFloat h = _scrollView.frame.size.height; + + + + [_scrollView.subviews enumerateObjectsUsingBlock:^(SDBrowserImageView *obj, NSUInteger idx, BOOL *stop) { + CGFloat x = SDPhotoBrowserImageViewMargin + idx * (SDPhotoBrowserImageViewMargin * 2 + w); + obj.frame = CGRectMake(x, y, w, h); + }]; + + _scrollView.contentSize = CGSizeMake(_scrollView.subviews.count * _scrollView.frame.size.width, 0); + _scrollView.contentOffset = CGPointMake(self.currentImageIndex * _scrollView.frame.size.width, 0); + + + if (!_hasShowedFistView) { + [self showFirstImage]; + } + + _indexLabel.center = CGPointMake(self.bounds.size.width * 0.5, 35); + _saveButton.frame = CGRectMake(30, self.bounds.size.height - 70, 50, 25); +} + +- (void)show +{ + UIWindow *window = [UIApplication sharedApplication].keyWindow; + self.frame = window.bounds; + [window addObserver:self forKeyPath:@"frame" options:0 context:nil]; + [window addSubview:self]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(UIView *)object change:(NSDictionary *)change context:(void *)context +{ + if ([keyPath isEqualToString:@"frame"]) { + self.frame = object.bounds; + SDBrowserImageView *currentImageView = _scrollView.subviews[_currentImageIndex]; + if ([currentImageView isKindOfClass:[SDBrowserImageView class]]) { + [currentImageView clear]; + } + } +} + +- (void)showFirstImage +{ + UIView *sourceView = nil; + + if ([self.sourceImagesContainerView isKindOfClass:UICollectionView.class]) { + UICollectionView *view = (UICollectionView *)self.sourceImagesContainerView; + NSIndexPath *path = [NSIndexPath indexPathForItem:self.currentImageIndex inSection:0]; + sourceView = [view cellForItemAtIndexPath:path]; + }else { + sourceView = self.sourceImagesContainerView.subviews[self.currentImageIndex]; + } + CGRect rect = [self.sourceImagesContainerView convertRect:sourceView.frame toView:self]; + + UIImageView *tempView = [[UIImageView alloc] init]; + tempView.image = [self placeholderImageForIndex:self.currentImageIndex]; + + [self addSubview:tempView]; + + CGRect targetTemp = [_scrollView.subviews[self.currentImageIndex] bounds]; + + tempView.frame = rect; + tempView.contentMode = [_scrollView.subviews[self.currentImageIndex] contentMode]; + _scrollView.hidden = YES; + + + [UIView animateWithDuration:SDPhotoBrowserShowImageAnimationDuration animations:^{ + tempView.center = self.center; + tempView.bounds = (CGRect){CGPointZero, targetTemp.size}; + } completion:^(BOOL finished) { + _hasShowedFistView = YES; + [tempView removeFromSuperview]; + _scrollView.hidden = NO; + }]; +} + +- (UIImage *)placeholderImageForIndex:(NSInteger)index +{ + if ([self.delegate respondsToSelector:@selector(photoBrowser:placeholderImageForIndex:)]) { + return [self.delegate photoBrowser:self placeholderImageForIndex:index]; + } + return nil; +} + +- (NSURL *)highQualityImageURLForIndex:(NSInteger)index +{ + if ([self.delegate respondsToSelector:@selector(photoBrowser:highQualityImageURLForIndex:)]) { + return [self.delegate photoBrowser:self highQualityImageURLForIndex:index]; + } + return nil; +} + +#pragma mark - scrollview代理方法 + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView +{ + int index = (scrollView.contentOffset.x + _scrollView.bounds.size.width * 0.5) / _scrollView.bounds.size.width; + + // 有过缩放的图片在拖动一定距离后清除缩放 + CGFloat margin = 150; + CGFloat x = scrollView.contentOffset.x; + if ((x - index * self.bounds.size.width) > margin || (x - index * self.bounds.size.width) < - margin) { + SDBrowserImageView *imageView = _scrollView.subviews[index]; + if (imageView.isScaled) { + [UIView animateWithDuration:0.5 animations:^{ + imageView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + [imageView eliminateScale]; + }]; + } + } + + + if (!_willDisappear) { + _indexLabel.text = [NSString stringWithFormat:@"%d/%ld", index + 1, (long)self.imageCount]; + } + [self setupImageOfImageViewForIndex:index]; +} + + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowserConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowserConfig.h new file mode 100755 index 0000000..443b558 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDPhotoBrowserConfig.h @@ -0,0 +1,42 @@ +// +// SDPhotoBrowserConfig.h +// SDPhotoBrowser +// +// Created by aier on 15-2-9. +// Copyright (c) 2015年 GSD. All rights reserved. +// + + +typedef enum { + SDWaitingViewModeLoopDiagram, // 环形 + SDWaitingViewModePieDiagram // 饼型 +} SDWaitingViewMode; + +// 图片保存成功提示文字 +#define SDPhotoBrowserSaveImageSuccessText @" ^_^ 保存成功 "; + +// 图片保存失败提示文字 +#define SDPhotoBrowserSaveImageFailText @" >_< 保存失败 "; + +// browser背景颜色 +#define SDPhotoBrowserBackgrounColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.95] + +// browser中图片间的margin +#define SDPhotoBrowserImageViewMargin 10 + +// browser中显示图片动画时长 +#define SDPhotoBrowserShowImageAnimationDuration 0.4f + +// browser中显示图片动画时长 +#define SDPhotoBrowserHideImageAnimationDuration 0.4f + +// 图片下载进度指示进度显示样式(SDWaitingViewModeLoopDiagram 环形,SDWaitingViewModePieDiagram 饼型) +#define SDWaitingViewProgressMode SDWaitingViewModeLoopDiagram + +// 图片下载进度指示器背景色 +#define SDWaitingViewBackgroundColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7] + +// 图片下载进度指示器内部控件间的间距 +#define SDWaitingViewItemMargin 10 + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDWaitingView.h b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDWaitingView.h new file mode 100755 index 0000000..d688e1e --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDWaitingView.h @@ -0,0 +1,17 @@ +// +// SDWaitingView.h +// SDPhotoBrowser +// +// Created by aier on 15-2-6. +// Copyright (c) 2015年 GSD. All rights reserved. +// + +#import +#import "SDPhotoBrowserConfig.h" + +@interface SDWaitingView : UIView + +@property (nonatomic, assign) CGFloat progress; +@property (nonatomic, assign) int mode; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDWaitingView.m b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDWaitingView.m new file mode 100755 index 0000000..ca8ae36 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/SDPhotoBrowser/SDWaitingView.m @@ -0,0 +1,93 @@ +// +// SDWaitingView.m +// SDPhotoBrowser +// +// Created by aier on 15-2-6. +// Copyright (c) 2015年 GSD. All rights reserved. +// + +#import "SDWaitingView.h" + +//// 图片下载进度指示器背景色 +//#define SDWaitingViewBackgroundColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7] +// +//// 图片下载进度指示器内部控件间的间距 +// +//#define SDWaitingViewItemMargin 10 + + +@implementation SDWaitingView + + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = SDWaitingViewBackgroundColor; + self.layer.cornerRadius = 5; + self.clipsToBounds = YES; + self.mode = SDWaitingViewModeLoopDiagram; + } + return self; +} + +- (void)setProgress:(CGFloat)progress +{ + _progress = progress; +// NSLog(@"%@",[NSThread currentThread]); + //将重绘操作放在主线程,解决自动布局控制台报错的问题 + dispatch_async(dispatch_get_main_queue(), ^{ + + [self setNeedsDisplay]; + if (progress >= 1) { + [self removeFromSuperview]; + } + }); +} + +- (void)drawRect:(CGRect)rect +{ + CGContextRef ctx = UIGraphicsGetCurrentContext(); + + CGFloat xCenter = rect.size.width * 0.5; + CGFloat yCenter = rect.size.height * 0.5; + [[UIColor whiteColor] set]; + + switch (self.mode) { + case SDWaitingViewModePieDiagram: + { + CGFloat radius = MIN(rect.size.width * 0.5, rect.size.height * 0.5) - SDWaitingViewItemMargin; + + + CGFloat w = radius * 2 + SDWaitingViewItemMargin; + CGFloat h = w; + CGFloat x = (rect.size.width - w) * 0.5; + CGFloat y = (rect.size.height - h) * 0.5; + CGContextAddEllipseInRect(ctx, CGRectMake(x, y, w, h)); + CGContextFillPath(ctx); + + [SDWaitingViewBackgroundColor set]; + CGContextMoveToPoint(ctx, xCenter, yCenter); + CGContextAddLineToPoint(ctx, xCenter, 0); + CGFloat to = - M_PI * 0.5 + self.progress * M_PI * 2 + 0.001; // 初始值 + CGContextAddArc(ctx, xCenter, yCenter, radius, - M_PI * 0.5, to, 1); + CGContextClosePath(ctx); + + CGContextFillPath(ctx); + } + break; + + default: + { + CGContextSetLineWidth(ctx, 15); + CGContextSetLineCap(ctx, kCGLineCapRound); + CGFloat to = - M_PI * 0.5 + self.progress * M_PI * 2 + 0.05; // 初始值0.05 + CGFloat radius = MIN(rect.size.width, rect.size.height) * 0.5 - SDWaitingViewItemMargin; + CGContextAddArc(ctx, xCenter, yCenter, radius, - M_PI * 0.5, to, 0); + CGContextStrokePath(ctx); + } + break; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/TYMapNavSheet/TYMapNavSheet.h b/XinjiangProject/XinjiangProject/ThirdParty/TYMapNavSheet/TYMapNavSheet.h new file mode 100644 index 0000000..3598235 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/TYMapNavSheet/TYMapNavSheet.h @@ -0,0 +1,28 @@ +// +// TYMapNavSheet.h +// TYGDmap +// +// Created by TianYang on 15/12/10. +// Copyright © 2015年 Tianyang. All rights reserved. +// + +#import +#import +@interface TYMapNavSheet : UIView +/** + LocationDic 中包括出发地的经纬度、出发地地名、目的地经纬度、目的地名称四个数据。 + 其中出发地经纬度可不传(默认为当前位置经纬度) + 出发地和目的地的地名也可以不传 默认通过经纬度 反编译得到(可能会有误差) + 如果不传可能会造成误差 所以建议全部传 + 所对应Key 为 + startName endName + */ +- (void) ShowMapNavSheetSuperView:(UIViewController *)ViewColtroller withLocationDic:(NSMutableDictionary*)LocationNameDic withstartCoor:(CLLocationCoordinate2D)startCoor withendCoor:(CLLocationCoordinate2D)endCoor; + +/** + iOS8.3 一下的需要实现这个方法 把sheet 的点击事件传递回来 参数为Btn 的index + + */ +- (void) actionSheetBtnClick:(NSInteger)BtnIndex; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/TYMapNavSheet/TYMapNavSheet.m b/XinjiangProject/XinjiangProject/ThirdParty/TYMapNavSheet/TYMapNavSheet.m new file mode 100644 index 0000000..cff354e --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/TYMapNavSheet/TYMapNavSheet.m @@ -0,0 +1,167 @@ +// +// TYMapNavSheet.m +// TYGDmap +// +// Created by TianYang on 15/12/10. +// Copyright © 2015年 Tianyang. All rights reserved. +// + +#import "TYMapNavSheet.h" + +# define IOS8 [[[UIDevice currentDevice] systemVersion] floatValue] > 8.3 +@interface TYMapNavSheet () +{ + NSMutableArray * TYMapSheetTitleArray; + NSMutableDictionary * TYMapNavMutDic; + NSMutableDictionary * TYMapNavDateMutDic; + + CLLocationCoordinate2D _startCoor; + CLLocationCoordinate2D _endCoor; + NSMutableDictionary * _Dic; + +} +@end + + +@implementation TYMapNavSheet + +- (id)init +{ + self = [super init]; + if (self) + { + self.backgroundColor = [UIColor clearColor]; + } + return self; +} + +-(void) AddMapNamewithLocationDic:(NSMutableDictionary*)LocationDataDic withstartCoor:(CLLocationCoordinate2D)startCoor withendCoor:(CLLocationCoordinate2D)endCoor +{ + TYMapSheetTitleArray = [[NSMutableArray alloc]init]; + TYMapNavDateMutDic = [[NSMutableDictionary alloc]init]; + + _startCoor = startCoor; + _endCoor = endCoor; + _Dic = [[NSMutableDictionary alloc]initWithDictionary:LocationDataDic]; + + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]]) { + + NSString *TYurlString = [NSString stringWithFormat:@"baidumap://map/direction?origin=latlng:%f,%f|name:%@&destination=latlng:%f,%f|name:%@&mode=transit", + _startCoor.latitude,_startCoor.longitude ,[LocationDataDic objectForKey:@"startName"],_endCoor.latitude , _endCoor.longitude,[LocationDataDic objectForKey:@"toName"] ]; + NSDictionary *dic = @{@"name": @"百度地图", + @"url": TYurlString}; + [TYMapSheetTitleArray addObject:dic]; + + } + if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"iosamap://"]]){ + NSString *TYurlString = [NSString stringWithFormat:@"iosamap://navi?sourceApplication=%@&backScheme=applicationScheme&poiname=fangheng&poiid=BGVIS&lat=%f&lon=%f&dev=0&style=3", + [LocationDataDic objectForKey:@"toName"], _endCoor.latitude, _endCoor.longitude]; + + NSDictionary *dic = @{@"name": @"高德地图", + @"url": TYurlString}; + [TYMapSheetTitleArray addObject:dic]; + + } + if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]){ + NSString *TYurlString = [NSString stringWithFormat:@"comgooglemaps://?saddr=&daddr=%f,%f¢er=%f,%f&directionsmode=transit", _endCoor.latitude, _endCoor.longitude, _startCoor.latitude, _startCoor.longitude]; + + NSDictionary *dic = @{@"name": @"谷歌地图", + @"url": TYurlString}; + [TYMapSheetTitleArray addObject:dic]; + + } + + //腾讯地图 + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"qqmap://"]]) { + NSMutableDictionary *qqMapDic = [NSMutableDictionary dictionary]; + NSString *urlString = [[NSString stringWithFormat:@"qqmap://map/routeplan?from=我的位置&type=drive&tocoord=%f,%f&to=终点&coord_type=1&policy=0",_endCoor.latitude, _endCoor.longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *dic = @{@"name": @"腾讯地图", + @"url": urlString}; + [TYMapSheetTitleArray addObject:dic]; + } + +} + +-(void) AddSheetViewsuperView:(UIViewController *)superViewColtroller withLocationDic:(NSMutableDictionary*)TYMapLocationDic withstartCoor:(CLLocationCoordinate2D)startCoor withendCoor:(CLLocationCoordinate2D)endCoor +{ + [self AddMapNamewithLocationDic:TYMapLocationDic withstartCoor:startCoor withendCoor:endCoor]; + + if (IOS8) { + UIAlertController * TYMapNavSheetController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + [TYMapNavSheetController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + //按钮触发的方法 + }]]; + [TYMapNavSheetController addAction:[UIAlertAction actionWithTitle:@"使用系统自带地图导航" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + //按钮触发的方法 + MKMapItem *currentLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:startCoor addressDictionary:nil]]; + //目的地的位置 + MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:endCoor addressDictionary:nil ]]; + toLocation.name = [TYMapLocationDic objectForKey:@"endName"]; + currentLocation.name = [TYMapLocationDic objectForKey:@"startName"];; + NSArray *items = [NSArray arrayWithObjects:currentLocation, toLocation, nil]; + NSDictionary *options = @{ MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving, MKLaunchOptionsMapTypeKey: [NSNumber numberWithInteger:MKMapTypeStandard], MKLaunchOptionsShowsTrafficKey:@YES }; + //打开苹果自身地图应用,并呈现特定的item + [MKMapItem openMapsWithItems:items launchOptions:options]; + }]]; + for (NSDictionary * Dic in TYMapSheetTitleArray) { + [TYMapNavSheetController addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:@"使用%@导航", [Dic objectForKey:@"name"]] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + //按钮触发的方法 + NSDictionary *mapDic = Dic; + NSString *urlString = mapDic[@"url"]; + urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSURL *url = [NSURL URLWithString:urlString]; + [[UIApplication sharedApplication] openURL:url]; + }]]; + } + [superViewColtroller presentViewController:TYMapNavSheetController animated:YES completion:nil]; + }else{ + UIActionSheet * TYMapNavSheet = [[UIActionSheet alloc] init]; + [TYMapNavSheet addButtonWithTitle:@"使用系统自带地图导航"]; + for (NSDictionary * Dic in TYMapSheetTitleArray) { + [TYMapNavSheet addButtonWithTitle:[NSString stringWithFormat:@"使用%@导航", [Dic objectForKey:@"name"]]]; + } + [TYMapNavSheet addButtonWithTitle:@"取消"]; + TYMapNavSheet.delegate = superViewColtroller; + [TYMapNavSheet showInView:superViewColtroller.view]; + } +} + +-(void) actionsheetClick:(NSInteger)BtnIndex +{ + if (BtnIndex == 0) { + // 调用苹果自带的地图导航 + //起点 + MKMapItem *currentLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:_startCoor addressDictionary:nil]]; + //目的地的位置 + MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:_endCoor addressDictionary:nil ]]; + toLocation.name = [_Dic objectForKey:@"endName"]; + currentLocation.name = [_Dic objectForKey:@"startName"]; + NSArray *items = [NSArray arrayWithObjects:currentLocation, toLocation, nil]; + NSDictionary *options = @{ MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving, MKLaunchOptionsMapTypeKey: [NSNumber numberWithInteger:MKMapTypeStandard], MKLaunchOptionsShowsTrafficKey:@YES }; + //打开苹果自身地图应用,并呈现特定的item + [MKMapItem openMapsWithItems:items launchOptions:options]; + + } else{ + if (BtnIndex < [TYMapSheetTitleArray count]+1) { + NSDictionary *mapDic = TYMapSheetTitleArray[BtnIndex-1]; + NSString *urlString = mapDic[@"url"]; + urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSURL *url = [NSURL URLWithString:urlString]; + [[UIApplication sharedApplication] openURL:url]; + } + } +} + + + +- (void) ShowMapNavSheetSuperView:(UIViewController *)ViewColtroller withLocationDic:(NSMutableDictionary*)LocationNameDic withstartCoor:(CLLocationCoordinate2D)startCoor withendCoor:(CLLocationCoordinate2D)endCoor{ + [self AddSheetViewsuperView:ViewColtroller withLocationDic:LocationNameDic withstartCoor:startCoor withendCoor:endCoor ]; +} + +-(void) actionSheetBtnClick:(NSInteger)BtnIndex +{ + [self actionsheetClick:BtnIndex]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.h b/XinjiangProject/XinjiangProject/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.h new file mode 100644 index 0000000..de88d4d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.h @@ -0,0 +1,18 @@ +// +// UIPlaceHolderTextView.h +// MobileProject 带有提示输入的TextView +// +// Created by wujunyang on 16/1/14. +// Copyright © 2016年 wujunyang. All rights reserved. +// + +#import + +@interface UIPlaceHolderTextView : UITextView + +@property (nonatomic, strong) NSString *placeholder; + +@property (nonatomic, strong) UIColor *placeholderColor; + +-(void)textChanged:(NSNotification*)notification; +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.m b/XinjiangProject/XinjiangProject/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.m new file mode 100644 index 0000000..e86f46d --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.m @@ -0,0 +1,119 @@ +// +// UIPlaceHolderTextView.m +// MobileProject +// +// Created by wujunyang on 16/1/14. +// Copyright © 2016年 wujunyang. All rights reserved. +// + +#import "UIPlaceHolderTextView.h" + +@interface UIPlaceHolderTextView() +@property (nonatomic, strong) UILabel *placeHolderLabel; +@end + +@implementation UIPlaceHolderTextView +CGFloat const UI_PLACEHOLDER_TEXT_CHANGED_ANIMATION_DURATION = 0.25; + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +#if __has_feature(objc_arc) +#else + [_placeHolderLabel release]; _placeHolderLabel = nil; + [_placeholderColor release]; _placeholderColor = nil; + [_placeholder release]; _placeholder = nil; + [super dealloc]; +#endif +} + +- (void)awakeFromNib +{ + [super awakeFromNib]; + + if (!self.placeholder) { + _placeholder = @""; + } + + if (!self.placeholderColor) { + [self setPlaceholderColor:[UIColor lightGrayColor]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil]; +} + +- (id)initWithFrame:(CGRect)frame +{ + if( (self = [super initWithFrame:frame]) ) + { + _placeholder = @""; + [self setPlaceholderColor:[UIColor lightGrayColor]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil]; + } + return self; +} + +- (void)textChanged:(NSNotification *)notification +{ + if([[self placeholder] length] == 0) + { + return; + } + + [UIView animateWithDuration:UI_PLACEHOLDER_TEXT_CHANGED_ANIMATION_DURATION animations:^{ + if([[self text] length] == 0) + { + [[self viewWithTag:999] setAlpha:1]; + } + else + { + [[self viewWithTag:999] setAlpha:0]; + } + }]; +} + +- (void)setText:(NSString *)text { + [super setText:text]; + [self textChanged:nil]; +} + +- (void)drawRect:(CGRect)rect +{ + if( [[self placeholder] length] > 0 ) + { + UIEdgeInsets insets = self.textContainerInset; + if (_placeHolderLabel == nil ) + { + + _placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(insets.left+kRealValue(15),insets.top,self.bounds.size.width - (insets.left +insets.right+kRealValue(30)),1.0)]; + _placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping; + _placeHolderLabel.font = self.font; + _placeHolderLabel.backgroundColor = [UIColor clearColor]; + _placeHolderLabel.textColor = self.placeholderColor; + _placeHolderLabel.alpha = 0; + _placeHolderLabel.tag = 999; + _placeHolderLabel.numberOfLines = 3; + [self addSubview:_placeHolderLabel]; + } + _placeHolderLabel.text = self.placeholder; + [_placeHolderLabel sizeToFit]; + [_placeHolderLabel setFrame:CGRectMake(insets.left+5,insets.top,self.bounds.size.width - (insets.left +insets.right+10),CGRectGetHeight(_placeHolderLabel.frame))]; + [self sendSubviewToBack:_placeHolderLabel]; + } + + if( [[self text] length] == 0 && [[self placeholder] length] > 0 ) + { + [[self viewWithTag:999] setAlpha:1]; + } + + [super drawRect:rect]; +} +- (void)setPlaceholder:(NSString *)placeholder{ + if (_placeholder != placeholder) { + _placeholder = placeholder; + [self setNeedsDisplay]; + } + +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/UIViewAdditions.h b/XinjiangProject/XinjiangProject/ThirdParty/UIViewAdditions.h new file mode 100755 index 0000000..d610b15 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/UIViewAdditions.h @@ -0,0 +1,58 @@ +#import +#import + +@interface UIView (TTCategory) + +@property(nonatomic) CGFloat left; +@property(nonatomic) CGFloat top; +@property(nonatomic) CGFloat right; +@property(nonatomic) CGFloat bottom; + +@property(nonatomic) CGFloat width; +@property(nonatomic) CGFloat height; + +@property(nonatomic) CGFloat centerX; +@property(nonatomic) CGFloat centerY; + +@property(nonatomic,readonly) CGFloat screenX; +@property(nonatomic,readonly) CGFloat screenY; +@property(nonatomic,readonly) CGFloat screenViewX; +@property(nonatomic,readonly) CGFloat screenViewY; +@property(nonatomic,readonly) CGRect screenFrame; + +@property(nonatomic) CGPoint origin; +@property(nonatomic) CGSize size; + +@property(nonatomic) BOOL visible; + +/** + * Finds the first descendant view (including this view) that is a member of a particular class. + */ +- (UIView*)descendantOrSelfWithClass:(Class)cls; + +/** + * Finds the first ancestor view (including this view) that is a member of a particular class. + */ +- (UIView*)ancestorOrSelfWithClass:(Class)cls; + +/** + * Removes all subviews. + */ +- (void)removeAllSubviews; + + +/** + * Calculates the offset of this view from another view in screen coordinates. + */ +- (CGPoint)offsetFromView:(UIView*)otherView; + + +/** + * The view controller whose view contains this view. + */ +- (UIViewController*)viewController; + + +- (void)addSubviews:(NSArray *)views; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/UIViewAdditions.m b/XinjiangProject/XinjiangProject/ThirdParty/UIViewAdditions.m new file mode 100755 index 0000000..842ce86 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/UIViewAdditions.m @@ -0,0 +1,227 @@ +#import "UIViewAdditions.h" + + +@implementation UIView (TTCategory) + +- (BOOL)visible{ + return !self.hidden; +} + +- (void)setVisible:(BOOL)visible{ + self.hidden = !visible; +} + +- (CGFloat)left { + return self.frame.origin.x; +} + +- (void)setLeft:(CGFloat)x { + CGRect frame = self.frame; + frame.origin.x = x; + self.frame = frame; +} + +- (CGFloat)top { + return self.frame.origin.y; +} + +- (void)setTop:(CGFloat)y { + CGRect frame = self.frame; + frame.origin.y = y; + self.frame = frame; +} + +- (CGFloat)right { + return self.frame.origin.x + self.frame.size.width; +} + +- (void)setRight:(CGFloat)right { + CGRect frame = self.frame; + frame.origin.x = right - frame.size.width; + self.frame = frame; + +} + +- (CGFloat)bottom { + return self.frame.origin.y + self.frame.size.height; +} + +- (void)setBottom:(CGFloat)bottom { + CGRect frame = self.frame; + frame.origin.y = bottom - frame.size.height; + self.frame = frame; +} + +- (CGFloat)centerX { + return self.center.x; +} + +- (void)setCenterX:(CGFloat)centerX { + self.center = CGPointMake(centerX, self.center.y); +} + +- (CGFloat)centerY { + return self.center.y; +} + +- (void)setCenterY:(CGFloat)centerY { + self.center = CGPointMake(self.center.x, centerY); +} + +- (CGFloat)width { + return self.frame.size.width; +} + +- (void)setWidth:(CGFloat)width { + CGRect frame = self.frame; + frame.size.width = width; + self.frame = frame; +} + +- (CGFloat)height { + return self.frame.size.height; +} + +- (void)setHeight:(CGFloat)height { + CGRect frame = self.frame; + frame.size.height = height; + self.frame = frame; +} + +- (CGFloat)screenX { + CGFloat x = 0; + for (UIView* view = self; view; view = view.superview) { + x += view.left; + } + return x; +} + +- (CGFloat)screenY { + CGFloat y = 0; + for (UIView* view = self; view; view = view.superview) { + y += view.top; + } + return y; +} + +- (CGFloat)screenViewX { + CGFloat x = 0; + for (UIView* view = self; view; view = view.superview) { + x += view.left; + + if ([view isKindOfClass:[UIScrollView class]]) { + UIScrollView* scrollView = (UIScrollView*)view; + x -= scrollView.contentOffset.x; + } + } + + return x; +} + +- (CGFloat)screenViewY { + CGFloat y = 0; + for (UIView* view = self; view; view = view.superview) { + y += view.top; + + if ([view isKindOfClass:[UIScrollView class]]) { + UIScrollView* scrollView = (UIScrollView*)view; + y -= scrollView.contentOffset.y; + } + } + return y; +} + +- (CGRect)screenFrame { + return CGRectMake(self.screenViewX, self.screenViewY, self.width, self.height); +} + +- (CGPoint)origin { + return self.frame.origin; +} + +- (void)setOrigin:(CGPoint)origin { + CGRect frame = self.frame; + frame.origin = origin; + self.frame = frame; +} + +- (CGSize)size { + return self.frame.size; +} + +- (void)setSize:(CGSize)size { + CGRect frame = self.frame; + frame.size = size; + self.frame = frame; +} + +- (CGPoint)offsetFromView:(UIView*)otherView { + CGFloat x = 0, y = 0; + for (UIView* view = self; view && view != otherView; view = view.superview) { + x += view.left; + y += view.top; + } + return CGPointMake(x, y); +} +/* + - (CGFloat)orientationWidth { + return UIInterfaceOrientationIsLandscape(TTInterfaceOrientation()) + ? self.height : self.width; + } + + - (CGFloat)orientationHeight { + return UIInterfaceOrientationIsLandscape(TTInterfaceOrientation()) + ? self.width : self.height; + } + */ +- (UIView*)descendantOrSelfWithClass:(Class)cls { + if ([self isKindOfClass:cls]) + return self; + + for (UIView* child in self.subviews) { + UIView* it = [child descendantOrSelfWithClass:cls]; + if (it) + return it; + } + + return nil; +} + +- (UIView*)ancestorOrSelfWithClass:(Class)cls { + if ([self isKindOfClass:cls]) { + return self; + } else if (self.superview) { + return [self.superview ancestorOrSelfWithClass:cls]; + } else { + return nil; + } +} + +- (void)removeAllSubviews { + while (self.subviews.count) { + UIView* child = self.subviews.lastObject; + [child removeFromSuperview]; + } +} + + + +- (UIViewController*)viewController { + for (UIView* next = [self superview]; next; next = next.superview) { + UIResponder* nextResponder = [next nextResponder]; + if ([nextResponder isKindOfClass:[UIViewController class]]) { + return (UIViewController*)nextResponder; + } + } + return nil; +} + + +- (void)addSubviews:(NSArray *)views +{ + for (UIView* v in views) { + [self addSubview:v]; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.h new file mode 100644 index 0000000..f9a63ce --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.h @@ -0,0 +1,18 @@ +// +// UIImage+XLExtension.h +// XLPhotoBrowserDemo +// +// Created by ehang on 2016/10/26. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import + +@interface UIImage (XLExtension) + +/** + * 返回一张指定size的指定颜色的纯色图片 + */ ++ (UIImage *)xl_imageWithColor:(UIColor *)color size:(CGSize)size; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.m new file mode 100644 index 0000000..9fb16d0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.m @@ -0,0 +1,34 @@ +// +// UIImage+XLExtension.m +// XLPhotoBrowserDemo +// +// Created by ehang on 2016/10/26. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import "UIImage+XLExtension.h" + +@implementation UIImage (XLExtension) + +/** + * 返回一张指定size的指定颜色的纯色图片 + */ ++ (UIImage *)xl_imageWithColor:(UIColor *)color size:(CGSize)size +{ + if (size.width <= 0 ) { + size = CGSizeMake(3, 3); + } + CGRect rect = CGRectMake(0, 0, size.width, size.height); + UIGraphicsBeginImageContext(rect.size); + CGContextRef context = UIGraphicsGetCurrentContext(); + + CGContextSetFillColorWithColor(context, [color CGColor]); + CGContextFillRect(context, rect); + + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return image; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.h new file mode 100644 index 0000000..512b12a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.h @@ -0,0 +1,117 @@ +// +// UIView+XLExtension.h +// TopHot +// +// Created by Liushannoon on 16/4/20. +// Copyright © 2016年 Liushannoon. All rights reserved. +// + +#import + +#define XLScreenBounds [UIScreen mainScreen].bounds +#define XLScreenSize [UIScreen mainScreen].bounds.size +#define XLScreenW [UIScreen mainScreen].bounds.size.width +#define XLScreenH [UIScreen mainScreen].bounds.size.height +#define xl_autoSizeScaleX ([UIScreen mainScreen].bounds.size.width / 375) +#define xl_autoSizeScaleY ([UIScreen mainScreen].bounds.size.height / 667) + +#define XLDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead) +#define XLKeyWindow [UIApplication sharedApplication].windows.firstObject + +/** + * 动画类型 + */ +typedef NS_ENUM(NSUInteger, XLAnimationType){ + /** + * 弹性动画放大 + */ + XLAnimationTypeToBigger = 1, + /** + * 缩小的弹性动画 + */ + XLAnimationTypeToSmaller = 2 +}; + +@interface UIView (XLExtension) + +@property (nonatomic, assign) CGFloat height XLDeprecated("请使用xl_height"); +@property (nonatomic, assign) CGFloat width XLDeprecated("请使用xl_width"); +@property (nonatomic, assign) CGFloat x XLDeprecated("请使用xl_x"); +@property (nonatomic, assign) CGFloat y XLDeprecated("请使用xl_y"); +@property (nonatomic, assign) CGFloat centerX XLDeprecated("请使用xl_centerX"); +@property (nonatomic, assign) CGFloat centerY XLDeprecated("请使用xl_centerY"); + +@property (nonatomic, assign) CGFloat xl_height; +@property (nonatomic, assign) CGFloat xl_width; +@property (nonatomic, assign) CGFloat xl_x; +@property (nonatomic, assign) CGFloat xl_y; +@property (nonatomic, assign) CGSize xl_size; +@property (nonatomic, assign) CGFloat xl_centerX; +@property (nonatomic, assign) CGFloat xl_centerY; + +/** + * 判断一个控件是否真正显示在主窗口 + */ +- (BOOL)xl_isShowingOnKeyWindow; + +/** + * 加载xibview + */ ++ (instancetype)xl_viewFromXib ; + +/** + * 显示一个5*5点的红色提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + */ +- (void)xl_showRedTipViewInRedX:(CGFloat)redX redY:(CGFloat)redY XLDeprecated("请使用其他同类方法"); +/** + * 在view上面绘制一个指定width宽度的红色提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + * @param width 宽度 + */ +- (void)xl_showRedTipViewInRedX:(CGFloat)redX redY:(CGFloat)redY redTipViewWidth:(CGFloat)width ; +/** + * 在view上面绘制一个指定width宽度的 指定颜色的提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + * @param width 圆点的直径 + * @param backgroundColor 圆点的颜色 + */ +- (void)xl_showRedTipViewInRedX:(CGFloat)redX redY:(CGFloat)redY redTipViewWidth:(CGFloat)width backgroundColor:(UIColor *)backgroundColor; +/** + * 显示一个5*5点的红色提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + * @param numberCount 展示的数字 + */ +- (void)xl_showRedTipViewWithNumberCountInRedX:(CGFloat)redX redY:(CGFloat)redY numberCount:(NSInteger)numberCount; + +/** + * 隐藏红色提醒圆点 + */ +- (void)xl_hideRedTipView; + +/** + * 类方法,对指定的layer进行弹性动画 + * + * @param layer 进行动画的图层 + * @param type 动画类型 + */ ++ (void)xl_showOscillatoryAnimationWithLayer:(CALayer *)layer type:(XLAnimationType)type; +/** + * 给视图添加虚线边框 + * + * @param lineWidth 线宽 + * @param lineMargin 每条虚线之间的间距 + * @param lineLength 每条虚线的长度 + * @param lineColor 每条虚线的颜色 + */ +- (void)xl_addDottedLineBorderWithLineWidth:(CGFloat)lineWidth lineMargin:(CGFloat)lineMargin lineLength:(CGFloat)lineLength lineColor:(UIColor *)lineColor; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.m new file mode 100644 index 0000000..53f7415 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.m @@ -0,0 +1,346 @@ +// +// UIView+XLExtension.m +// TopHot +// +// Created by Liushannoon on 16/4/20. +// Copyright © 2016年 Liushannoon. All rights reserved. +// + +#import "UIView+XLExtension.h" +#import + +@implementation UIView (XLExtension) + +#pragma mark - // 添加一个红点属性 + +static char RedTipViewKey; + +- (UILabel *)redTipView +{ + return objc_getAssociatedObject(self,&RedTipViewKey); +} + +- (void)setRedTipView:(UILabel *)redTipView +{ + objc_setAssociatedObject(self, &RedTipViewKey, redTipView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +/** + * 显示一个5*5点的红色提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + */ +- (void)xl_showRedTipViewInRedX:(CGFloat)redX redY:(CGFloat)redY +{ + [self xl_showRedTipViewInRedX:redX redY:redY redTipViewWidth:5]; +} + +/** + * 在view上面绘制一个指定width宽度的红色提醒远点 + * + * @param redX x坐标 + * @param redY y坐标 + * @param width 宽度 + */ +- (void)xl_showRedTipViewInRedX:(CGFloat)redX redY:(CGFloat)redY redTipViewWidth:(CGFloat)width +{ + [self xl_showRedTipViewInRedX:redX redY:redY redTipViewWidth:width backgroundColor:[UIColor redColor]]; +} + +/** + * 在view上面绘制一个指定width宽度的 指定颜色的提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + * @param width 圆点的直径 + * @param backgroundColor 圆点的颜色 + */ +- (void)xl_showRedTipViewInRedX:(CGFloat)redX redY:(CGFloat)redY redTipViewWidth:(CGFloat)width backgroundColor:(UIColor *)backgroundColor +{ + if (!self.redTipView) { + self.redTipView = [[UILabel alloc] init]; + self.redTipView.backgroundColor = backgroundColor; + self.redTipView.xl_width = width; + self.redTipView.xl_height = width; + self.redTipView.layer.cornerRadius = self.redTipView.xl_height * 0.5; + self.redTipView.layer.masksToBounds = YES; + [self insertSubview:self.redTipView atIndex:self.subviews.count]; + } + [self bringSubviewToFront:self.redTipView]; + self.redTipView.xl_x = redX; + self.redTipView.xl_y = redY; + self.redTipView.hidden = NO; +} + +/** + * 显示一个5*5点的红色提醒圆点 + * + * @param redX x坐标 + * @param redY y坐标 + * @param numberCount 展示的数字 + */ +- (void)xl_showRedTipViewWithNumberCountInRedX:(CGFloat)redX redY:(CGFloat)redY numberCount:(NSInteger)numberCount +{ + if (!self.redTipView) { + self.redTipView = [[UILabel alloc] init]; + self.redTipView.backgroundColor = [UIColor redColor]; + } + self.redTipView.xl_x = redX; + self.redTipView.xl_y = redY; + self.redTipView.text = [NSString stringWithFormat:@"%zd",numberCount]; + self.redTipView.textAlignment = NSTextAlignmentCenter; + self.redTipView.textColor = [UIColor whiteColor]; + self.redTipView.font = [UIFont systemFontOfSize:13]; + [self.redTipView sizeToFit]; + self.redTipView.xl_width += 8.5; + self.redTipView.layer.cornerRadius = self.redTipView.xl_height * 0.5; + self.redTipView.layer.masksToBounds = YES; + [self insertSubview:self.redTipView atIndex:self.subviews.count]; + self.redTipView.hidden = NO; +} + +/** + * 隐藏红色提醒圆点 + */ +- (void)xl_hideRedTipView +{ + self.redTipView.hidden = YES; +} + + +#pragma mark - 计算frame + +- (CGSize)xl_size +{ + return self.frame.size; +} + +- (void)setXl_size:(CGSize)xl_size +{ + CGRect frame = self.frame; + frame.size = xl_size; + self.frame = frame; +} + +- (CGFloat)xl_width +{ + return self.frame.size.width; +} + +- (void)setXl_width:(CGFloat)xl_width +{ + CGRect rect = self.frame; + rect.size.width = xl_width; + self.frame = rect; +} + +- (CGFloat)xl_height +{ + return self.frame.size.height; +} + +- (void)setXl_height:(CGFloat)xl_height +{ + CGRect rect = self.frame; + rect.size.height = xl_height; + self.frame = rect; +} + +- (CGFloat)xl_x +{ + return self.frame.origin.x; +} + +- (void)setXl_x:(CGFloat)xl_x +{ + CGRect rect = self.frame; + rect.origin.x = xl_x; + self.frame = rect; +} + +- (CGFloat)xl_y +{ + return self.frame.origin.y; +} + +- (void)setXl_y:(CGFloat)xl_y +{ + CGRect rect = self.frame; + rect.origin.y = xl_y; + self.frame = rect; +} + +- (CGFloat)xl_centerX +{ + return self.center.x; +} + +- (void)setXl_centerX:(CGFloat)xl_centerX +{ + CGPoint point = self.center; + point.x = xl_centerX; + self.center = point; +} + +- (CGFloat)xl_centerY +{ + return self.center.y; +} + +- (void)setXl_centerY:(CGFloat)xl_centerY +{ + CGPoint point = self.center; + point.y = xl_centerY; + self.center = point; +} + +- (CGFloat)height +{ + return self.frame.size.height; +} + +- (void)setHeight:(CGFloat)height +{ + CGRect rect = self.frame; + rect.size.height = height; + self.frame = rect; +} + +- (CGFloat)width +{ + return self.frame.size.width; +} + +- (void)setWidth:(CGFloat)width +{ + CGRect rect = self.frame; + rect.size.width = width; + self.frame = rect; +} + +- (CGFloat)x +{ + return self.frame.origin.x; +} + +- (void)setX:(CGFloat)x +{ + CGRect rect = self.frame; + rect.origin.x = x; + self.frame = rect; +} + +- (CGFloat)y +{ + return self.frame.origin.y; +} + +- (void)setY:(CGFloat)y +{ + CGRect rect = self.frame; + rect.origin.y = y; + self.frame = rect; +} + +- (CGFloat)centerX +{ + return self.center.x; +} + +- (CGFloat)centerY +{ + return self.center.y; +} + +- (void)setCenterX:(CGFloat)centerX +{ + CGPoint point = self.center; + point.x = centerX; + self.center = point; +} + +- (void)setCenterY:(CGFloat)centerY +{ + CGPoint point = self.center; + point.y = centerY; + self.center = point; +} + +/** + * 判断是否在窗口上面 + */ +- (BOOL)xl_isShowingOnKeyWindow +{ + // 主窗口 + UIWindow *keyWindow = XLKeyWindow; + + // 以主窗口左上角为坐标原点, 计算self的矩形框 + CGRect newFrame = [keyWindow convertRect:self.frame fromView:self.superview]; + CGRect winBounds = keyWindow.bounds; + + // 主窗口的bounds 和 self的矩形框 是否有重叠 + BOOL intersects = CGRectIntersectsRect(newFrame, winBounds); + + return !self.isHidden && self.alpha > 0.01 && self.window == keyWindow && intersects; +} + ++ (instancetype)xl_viewFromXib +{ + return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject]; +} + +/** + * 对指定的layer进行弹性动画 + * + * @param layer 进行动画的图层 + * @param type 动画类型 + */ ++ (void)xl_showOscillatoryAnimationWithLayer:(CALayer *)layer type:(XLAnimationType)type +{ + NSNumber *animationScale1 = type == XLAnimationTypeToBigger ? @(1.15) : @(0.5); + NSNumber *animationScale2 = type == XLAnimationTypeToBigger ? @(0.92) : @(1.15); + + [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{ + [layer setValue:animationScale1 forKeyPath:@"transform.scale"]; + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{ + [layer setValue:animationScale2 forKeyPath:@"transform.scale"]; + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{ + [layer setValue:@(1.0) forKeyPath:@"transform.scale"]; + } completion:nil]; + }]; + }]; +} + +/** + * 给视图添加虚线边框 + * + * @param lineWidth 线宽 + * @param lineMargin 每条虚线之间的间距 + * @param lineLength 每条虚线的长度 + * @param lineColor 每条虚线的颜色 + */ +- (void)xl_addDottedLineBorderWithLineWidth:(CGFloat)lineWidth lineMargin:(CGFloat)lineMargin lineLength:(CGFloat)lineLength lineColor:(UIColor *)lineColor; +{ + CAShapeLayer *border = [CAShapeLayer layer]; + + border.strokeColor = lineColor.CGColor; + + border.fillColor = nil; + + border.path = [UIBezierPath bezierPathWithRect:self.bounds].CGPath; + + border.frame = self.bounds; + + border.lineWidth = lineWidth; + + border.lineCap = @"round"; + + border.lineDashPattern = @[@(lineLength), @(lineMargin)]; + + [self.layer addSublayer:border]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.h new file mode 100755 index 0000000..74e0576 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.h @@ -0,0 +1,65 @@ +// +// FSActionSheet.h +// FSActionSheet +// +// Created by Steven on 6/7/16. +// Copyright © 2016年 Steven. All rights reserved. +// + +#import +#import "FSActionSheetItem.h" +#import "FSActionSheetConfig.h" + +@class FSActionSheet; +@protocol FSActionSheetDelegate + +@optional +- (void)FSActionSheet:(FSActionSheet *)actionSheet selectedIndex:(NSInteger)selectedIndex; + +@end + +@interface FSActionSheet : UIView + +@property (nonatomic, weak) id delegate; ///< 代理对象 +@property (nonatomic, assign) FSContentAlignment contentAlignment; ///< 默认是FSContentAlignmentCenter. +@property (nonatomic, assign) BOOL hideOnTouchOutside; ///< 是否开启点击半透明层隐藏弹窗, 默认为YES. + +/*! @author Steven + * @brief 单文本选项快速初始化 + * @param title 标题 + * @param delegate 代理 + * @param cancelButtonTitle 取消按钮标题 + * @param highlightedButtonTitle 高亮按钮标题 + * @param otherButtonTitles 其他按钮标题集合 + */ +- (instancetype)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle highlightedButtonTitle:(NSString *)highlightedButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles; +/*! @author Steven + * @brief 单文本选项快速初始化 + * @param title 标题 + * @param delegate 代理 + * @param cancelButtonTitle 取消按钮标题 + * @param highlightedButtonTitle 高亮按钮标题 + * @param otherButtonTitles 其他按钮标题集合 + * @param sourceWindow 展示的目标窗口,如果不传递,内部会自动创建一个window + */ +- (instancetype)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle highlightedButtonTitle:(NSString *)highlightedButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles sourceWindow:(UIWindow *)sourceWindow; +/*! @author Steven + * @brief 在外部组装选项按钮item + * @param title 标题 + * @param cancelTitle 取消按钮标题 + * @param items 选项按钮item + */ +- (instancetype)initWithTitle:(NSString *)title cancelTitle:(NSString *)cancelTitle items:(NSArray *)items; + +/*! @author Steven + * @brief 单展示, 不绑定block回调 + */ +- (void)show; + +/*! @author Steven + * @brief 展示并绑定block回调 + * @param selectedHandler 选择选项按钮回调. + */ +- (void)showWithSelectedCompletion:(FSActionSheetHandler)selectedHandler; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.m new file mode 100755 index 0000000..0d2a05a --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.m @@ -0,0 +1,469 @@ +// +// FSActionSheet.m +// FSActionSheet +// +// Created by Steven on 6/7/16. +// Copyright © 2016年 Steven. All rights reserved. +// + +#import "FSActionSheet.h" +#import "FSActionSheetCell.h" + +CGFloat const kFSActionSheetSectionHeight = 10; ///< 分区间距 + +@interface FSActionSheet () + +@property (nonatomic, copy) NSString *title; +@property (nonatomic, copy) NSString *cancelTitle; +@property (nonatomic, copy) NSArray *items; +@property (nonatomic, copy) FSActionSheetHandler selectedHandler; + +@property (nonatomic, strong) UIWindow *popupWindow; +@property (nonatomic, weak) UIViewController *popupVC; +@property (nonatomic, weak) UIView *controllerView; +@property (nonatomic, strong) UIView *backView; +@property (nonatomic, strong) UITableView *tableView; +@property (nonatomic, weak) UILabel *titleLabel; + +@property (nonatomic, strong) NSLayoutConstraint *heightConstraint; ///< 内容高度约束 + +@end + +static NSString * const kFSActionSheetCellIdentifier = @"kFSActionSheetCellIdentifier"; + +@implementation FSActionSheet + +- (instancetype)init { + return [self initWithTitle:nil cancelTitle:nil items:nil]; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +/*! @brief 单文本选项快速初始化 */ +- (instancetype)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle highlightedButtonTitle:(NSString *)highlightedButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles { + if (!(self = [super init])) return nil; + + [self commonInit]; + + NSMutableArray *titleItems = [@[] mutableCopy]; + // 普通按钮 + for (NSString *otherTitle in otherButtonTitles) { + if (otherTitle && otherTitle.length > 0) { + [titleItems addObject:FSActionSheetTitleItemMake(FSActionSheetTypeNormal, otherTitle)]; + } + } + // 高亮按钮, 高亮按钮放在最下面. + if (highlightedButtonTitle && highlightedButtonTitle.length > 0) { + [titleItems addObject:FSActionSheetTitleItemMake(FSActionSheetTypeHighlighted, highlightedButtonTitle)]; + } + + self.title = title?:@""; + self.delegate = delegate; + self.cancelTitle = (cancelButtonTitle && cancelButtonTitle.length != 0)?cancelButtonTitle:@"取消"; + self.items = titleItems; + + [self addSubview:self.tableView]; + + return self; +} + +- (instancetype)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle highlightedButtonTitle:(NSString *)highlightedButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles sourceWindow:(UIWindow *)sourceWindow +{ + if (!(self = [super init])) return nil; + _popupWindow = sourceWindow; + _popupVC = sourceWindow.rootViewController; + _controllerView = sourceWindow.rootViewController.view; + + [self commonInit]; + + NSMutableArray *titleItems = [@[] mutableCopy]; + // 普通按钮 + for (NSString *otherTitle in otherButtonTitles) { + if (otherTitle && otherTitle.length > 0) { + [titleItems addObject:FSActionSheetTitleItemMake(FSActionSheetTypeNormal, otherTitle)]; + } + } + // 高亮按钮, 高亮按钮放在最下面. + if (highlightedButtonTitle && highlightedButtonTitle.length > 0) { + [titleItems addObject:FSActionSheetTitleItemMake(FSActionSheetTypeHighlighted, highlightedButtonTitle)]; + } + + self.title = title?:@""; + self.delegate = delegate; + self.cancelTitle = (cancelButtonTitle && cancelButtonTitle.length != 0)?cancelButtonTitle:@"取消"; + self.items = titleItems; + + [self addSubview:self.tableView]; + + return self; +} + +/*! @brief 在外部组装选项按钮item */ +- (instancetype)initWithTitle:(NSString *)title cancelTitle:(NSString *)cancelTitle items:(NSArray *)items { + if (!(self = [super init])) return nil; + + [self commonInit]; + + self.title = title?:@""; + self.cancelTitle = (cancelTitle && cancelTitle.length != 0)?cancelTitle:@"取消"; + self.items = items?:@[]; + + [self addSubview:self.tableView]; + + return self; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + self.tableView.frame = self.bounds; +} + +// 默认设置 +- (void)commonInit { + self.backgroundColor = FSActionSheetColorWithString(FSActionSheetBackColor); + self.translatesAutoresizingMaskIntoConstraints = NO; // 允许约束 + + _contentAlignment = FSContentAlignmentCenter; // 默认样式为居中 + _hideOnTouchOutside = YES; // 默认点击半透明层隐藏弹窗 + + self.popupWindow.bounds = [UIScreen mainScreen].bounds; + + // 监听屏幕旋转 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil]; +} + +// 屏幕旋转通知回调 +- (void)orientationDidChange:(NSNotification *)notification { + if (_title.length > 0) { + // 更新头部标题的高度 + CGFloat newHeaderHeight = [self heightForHeaderView]; + CGRect newHeaderRect = _tableView.tableHeaderView.frame; + newHeaderRect.size.height = newHeaderHeight; + _tableView.tableHeaderView.frame = newHeaderRect; + self.tableView.tableHeaderView = self.tableView.tableHeaderView; + // 适配当前内容高度 + [self fixContentHeight]; + } +} + +#pragma mark - private +// 计算title在设定宽度下的富文本高度 +- (CGFloat)heightForHeaderView { + CGFloat labelHeight = [_titleLabel.attributedText boundingRectWithSize:CGSizeMake([self currentScreenWidth] - FSActionSheetDefaultMargin*2, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size.height; + CGFloat headerHeight = ceil(labelHeight)+FSActionSheetDefaultMargin*2; + + return headerHeight; +} + +// 整个弹窗内容的高度 +- (CGFloat)contentHeight { + CGFloat titleHeight = (_title.length > 0)?[self heightForHeaderView]:0; + CGFloat rowHeightSum = (_items.count+1)*FSActionSheetRowHeight+kFSActionSheetSectionHeight; + CGFloat contentHeight = titleHeight+rowHeightSum; + + return contentHeight; +} + +// 适配屏幕高度, 弹出窗高度不应该高于屏幕的设定比例 +- (void)fixContentHeight { + CGFloat contentMaxHeight = [self currentScreenHeight] * FSActionSheetContentMaxScale; + CGFloat contentHeight = [self contentHeight]; + if (contentHeight > contentMaxHeight) { + contentHeight = contentMaxHeight; + self.tableView.scrollEnabled = YES; + } else { + self.tableView.scrollEnabled = NO; + } + + _heightConstraint.constant = contentHeight; +} + +/// 屏幕当前宽度 +- (CGFloat)currentScreenWidth { + CGFloat currentScreenWidth; + CGSize screenSize = [UIScreen mainScreen].bounds.size; + CGFloat screenWidth = fmin(screenSize.width, screenSize.height); // 该值为屏幕竖屏下的屏幕宽度 + CGFloat screenHeight = fmax(screenSize.width, screenSize.height); // 该值为屏幕竖屏下的屏幕高度 + // 判断屏幕方向 + UIInterfaceOrientation orientation = [_popupVC preferredInterfaceOrientationForPresentation]; + // 横屏 + if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { + currentScreenWidth = screenHeight; + } else { + currentScreenWidth = screenWidth; + } + + return currentScreenWidth; +} + +/// 屏幕当前高度 +- (CGFloat)currentScreenHeight { + CGFloat currentScreenHeight; + CGSize screenSize = [UIScreen mainScreen].bounds.size; + CGFloat screenWidth = fmin(screenSize.width, screenSize.height); // 该值为屏幕竖屏下的屏幕宽度 + CGFloat screenHeight = fmax(screenSize.width, screenSize.height); // 该值为屏幕竖屏下的屏幕高度 + // 判断屏幕方向 + UIInterfaceOrientation orientation = [_popupVC preferredInterfaceOrientationForPresentation]; + // 横屏 + if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { + currentScreenHeight = screenWidth; + } else { + currentScreenHeight = screenHeight; + } + + return currentScreenHeight; +} + +// 适配标题偏移方向 +- (void)updateTitleAttributeText { + if (_title.length == 0 || !_titleLabel) return; + + // 富文本相关配置 + NSRange attributeRange = NSMakeRange(0, _title.length); + UIFont *titleFont = [UIFont systemFontOfSize:14]; + UIColor *titleTextColor = FSActionSheetColorWithString(FSActionSheetTitleColor); + CGFloat lineSpacing = FSActionSheetTitleLineSpacing; + CGFloat kernSpacing = FSActionSheetTitleKernSpacing; + + NSMutableAttributedString *titleAttributeString = [[NSMutableAttributedString alloc] initWithString:_title]; + NSMutableParagraphStyle *titleStyle = [[NSMutableParagraphStyle alloc] init]; + // 行距 + titleStyle.lineSpacing = lineSpacing; + // 内容偏移样式 + switch (_contentAlignment) { + case FSContentAlignmentLeft: { + titleStyle.alignment = NSTextAlignmentLeft; + break; + } + case FSContentAlignmentCenter: { + titleStyle.alignment = NSTextAlignmentCenter; + break; + } + case FSContentAlignmentRight: { + titleStyle.alignment = NSTextAlignmentRight; + break; + } + } + [titleAttributeString addAttribute:NSParagraphStyleAttributeName value:titleStyle range:attributeRange]; + // 字距 + [titleAttributeString addAttribute:NSKernAttributeName value:@(kernSpacing) range:attributeRange]; + // 字体 + [titleAttributeString addAttribute:NSFontAttributeName value:titleFont range:attributeRange]; + // 颜色 + [titleAttributeString addAttribute:NSForegroundColorAttributeName value:titleTextColor range:attributeRange]; + _titleLabel.attributedText = titleAttributeString; +} + +// 点击背景半透明遮罩层隐藏 +- (void)backViewGesture { + [self hideWithCompletion:nil]; +} + +// 隐藏 +- (void)hideWithCompletion:(void(^)())completion { + [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ + _backView.alpha = 0; + CGRect newFrame = self.frame; + newFrame.origin.y = CGRectGetMaxY(_controllerView.frame); + self.frame = newFrame; + } completion:^(BOOL finished) { + [[[UIApplication sharedApplication].delegate window] makeKeyWindow]; + if (completion) completion(); + [_backView removeFromSuperview]; + _backView = nil; + [_tableView removeFromSuperview]; + _tableView = nil; + [self removeFromSuperview]; + self.popupWindow = nil; + self.selectedHandler = nil; + }]; +} + +#pragma mark - public +/*! @brief 单展示, 不绑定block回调 */ +- (void)show { + [self showWithSelectedCompletion:NULL]; +} + +/*! @brief 展示并绑定block回调 */ +- (void)showWithSelectedCompletion:(FSActionSheetHandler)selectedHandler { + self.selectedHandler = selectedHandler; + + _backView = [[UIView alloc] init]; + _backView.alpha = 0; + _backView.backgroundColor = [UIColor blackColor]; + _backView.userInteractionEnabled = _hideOnTouchOutside; + _backView.translatesAutoresizingMaskIntoConstraints = NO; + [_backView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backViewGesture)]]; + [_controllerView addSubview:_backView]; + [_controllerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_backView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_backView)]]; + [_controllerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_backView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_backView)]]; + + [self.tableView reloadData]; + // 内容高度 + CGFloat contentHeight = self.tableView.contentSize.height; + // 适配屏幕高度 + CGFloat contentMaxHeight = CGRectGetHeight(self.popupWindow.frame)*FSActionSheetContentMaxScale; + if (contentHeight > contentMaxHeight) { + self.tableView.scrollEnabled = YES; + contentHeight = contentMaxHeight; + } + [_controllerView addSubview:self]; + + CGFloat selfW = CGRectGetWidth(_controllerView.frame); + CGFloat selfH = contentHeight; + CGFloat selfX = 0; + CGFloat selfY = CGRectGetMaxY(_controllerView.frame); + self.frame = CGRectMake(selfX, selfY, selfW, selfH); + + [self.popupWindow makeKeyAndVisible]; + + [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ + _backView.alpha = 0.38; + CGRect newFrame = self.frame; + newFrame.origin.y = CGRectGetMaxY(_controllerView.frame)-selfH; + self.frame = newFrame; + } completion:^(BOOL finished) { + // constraint + [_controllerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[self]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(self)]]; + [_controllerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[self]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(self)]]; + self.heightConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:contentHeight]; + [_controllerView addConstraint:_heightConstraint]; + }]; +} + +#pragma mark - getter +- (UIWindow *)popupWindow { + if (_popupWindow) return _popupWindow; + + _popupWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + _popupWindow.windowLevel = UIWindowLevelStatusBar+1; + _popupWindow.rootViewController = [[UIViewController alloc] init]; + _popupVC = _popupWindow.rootViewController; + _controllerView = _popupVC.view; + + return _popupWindow; +} +- (UITableView *)tableView { + if (_tableView) return _tableView; + + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.scrollEnabled = NO; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.backgroundColor = self.backgroundColor; + _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + + [_tableView registerClass:[FSActionSheetCell class] forCellReuseIdentifier:kFSActionSheetCellIdentifier]; + + if (_title.length > 0) { + _tableView.tableHeaderView = [self headerView]; + } + + return _tableView; +} + +// tableHeaderView作为title部分 +- (UIView *)headerView { + UIView *headerView = [[UIView alloc] init]; + headerView.backgroundColor = FSActionSheetColorWithString(FSActionSheetRowNormalColor); + + // 标题 + UILabel *titleLabel = [[UILabel alloc] init]; + titleLabel.numberOfLines = 0; + titleLabel.backgroundColor = headerView.backgroundColor; + titleLabel.translatesAutoresizingMaskIntoConstraints = NO; + [headerView addSubview:titleLabel]; + self.titleLabel = titleLabel; + // 设置富文本标题内容 + [self updateTitleAttributeText]; + + // 标题内容边距 (ps: 要修改这个边距不要在这里修改这个labelMargin, 要到配置类中修改 FSActionSheetDefaultMargin, 不然可能出现界面适配错乱). + CGFloat labelMargin = FSActionSheetDefaultMargin; + // 计算内容高度 + CGFloat headerHeight = [self heightForHeaderView]; + headerView.frame = CGRectMake(0, 0, CGRectGetWidth(self.popupWindow.frame), headerHeight); + + // titleLabel constraint + [headerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-labelMargin-[titleLabel]-labelMargin-|" + options:0.0 + metrics:@{@"labelMargin" : @(labelMargin)} + views:NSDictionaryOfVariableBindings(titleLabel)]]; + [headerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-labelMargin-[titleLabel]" + options:0.0 + metrics:@{@"labelMargin" : @(labelMargin)} + views:NSDictionaryOfVariableBindings(titleLabel)]]; + + return headerView; +} + +#pragma mark - setter +- (void)setContentAlignment:(FSContentAlignment)contentAlignment { + if (_contentAlignment != contentAlignment) { + _contentAlignment = contentAlignment; + [self updateTitleAttributeText]; + } +} + +#pragma mark - delegate +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 2; +} +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return (section == 1)?1:_items.count; +} +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return FSActionSheetRowHeight; +} +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return (section == 1)?kFSActionSheetSectionHeight:CGFLOAT_MIN; +} +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + FSActionSheetCell *cell = [tableView dequeueReusableCellWithIdentifier:kFSActionSheetCellIdentifier]; + return cell; +} +- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { + FSActionSheetCell *sheetCell = (FSActionSheetCell *)cell; + if (indexPath.section == 0) { + sheetCell.item = _items[indexPath.row]; + sheetCell.hideTopLine = NO; + // 当有标题时隐藏第一单元格的顶部线条 + if (indexPath.row == 0 && (!_title || _title.length == 0)) { + sheetCell.hideTopLine = YES; + } + } else { + // 默认取消的单元格没有附带icon + FSActionSheetItem *cancelItem = FSActionSheetTitleItemMake(FSActionSheetTypeNormal, _cancelTitle); + // 如果其它单元格中附带icon的话则添加上默认的取消icon. + for (FSActionSheetItem *item in _items) { + if (item.image) { + cancelItem = FSActionSheetTitleWithImageItemMake(FSActionSheetTypeNormal, [UIImage imageNamed:@"FSActionSheet_cancel"], _cancelTitle); + break; + } + } + sheetCell.item = cancelItem; + sheetCell.hideTopLine = YES; + } + sheetCell.contentAlignment = _contentAlignment; +} +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + // 延迟0.1秒隐藏让用户既看到点击效果又不影响体验 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1*NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + __weak __typeof(&*self)weakSelf = self; + [self hideWithCompletion:^{ + if (indexPath.section == 0) { + if (_selectedHandler) { + _selectedHandler(indexPath.row); + } + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(FSActionSheet:selectedIndex:)]) { + [weakSelf.delegate FSActionSheet:self selectedIndex:indexPath.row]; + } + } + }]; + }); +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.h new file mode 100755 index 0000000..3fedab5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.h @@ -0,0 +1,19 @@ +// +// FSActionSheetCell.h +// FSActionSheet +// +// Created by Steven on 6/7/16. +// Copyright © 2016年 Steven. All rights reserved. +// + +#import +#import "FSActionSheetConfig.h" +@class FSActionSheetItem; + +@interface FSActionSheetCell : UITableViewCell + +@property (nonatomic, assign) FSContentAlignment contentAlignment; +@property (nonatomic, strong) FSActionSheetItem *item; +@property (nonatomic, assign) BOOL hideTopLine; ///< 是否隐藏顶部线条 + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.m new file mode 100755 index 0000000..1b564bf --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.m @@ -0,0 +1,141 @@ +// +// FSActionSheetCell.m +// FSActionSheet +// +// Created by Steven on 6/7/16. +// Copyright © 2016年 Steven. All rights reserved. +// + +#import "FSActionSheetCell.h" +#import "FSActionSheetItem.h" + +@interface FSActionSheetCell () + +@property (nonatomic, strong) UIButton *titleButton; +@property (nonatomic, weak) UIView *topLine; ///< 顶部线条 + +@end + +@implementation FSActionSheetCell + +- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { + [super setHighlighted:highlighted animated:animated]; + + if (highlighted) { + self.contentView.backgroundColor = FSActionSheetColorWithString(FSActionSheetRowHighlightedColor); + } else { + [UIView animateWithDuration:0.25 animations:^{ + self.contentView.backgroundColor = self.backgroundColor; + }]; + } +} + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (!(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) return nil; + + self.backgroundColor = FSActionSheetColorWithString(FSActionSheetRowNormalColor); + self.contentView.backgroundColor = self.backgroundColor; + self.selectionStyle = UITableViewCellSelectionStyleNone; + _contentAlignment = FSContentAlignmentCenter; + + [self setupSubviews]; + + return self; +} + +- (void)setupSubviews { + _titleButton = [UIButton buttonWithType:UIButtonTypeSystem]; + _titleButton.tintColor = FSActionSheetColorWithString(FSActionSheetItemNormalColor); + _titleButton.titleLabel.font = [UIFont systemFontOfSize:FSActionSheetItemTitleFontSize]; + _titleButton.userInteractionEnabled = NO; + _titleButton.translatesAutoresizingMaskIntoConstraints = NO; + [self.contentView addSubview:_titleButton]; + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_titleButton]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_titleButton)]]; + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_titleButton]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_titleButton)]]; + + // 顶部线条 + UIView *topLine = [[UIView alloc] init]; + topLine.backgroundColor = FSActionSheetColorWithString(FSActionSheetRowTopLineColor); + topLine.translatesAutoresizingMaskIntoConstraints = NO; + [self.contentView addSubview:topLine]; + self.topLine = topLine; + CGFloat lineHeight = 1/[UIScreen mainScreen].scale; ///< 线条高度 + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[topLine]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(topLine)]]; + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[topLine(lineHeight)]" options:0 metrics:@{@"lineHeight":@(lineHeight)} views:NSDictionaryOfVariableBindings(topLine)]]; +} + +- (void)setItem:(FSActionSheetItem *)item { + _item = item; + + // 前景色设置, 如果有自定义前景色则使用自定义的前景色, 否则使用预配置的颜色值. + UIColor *tintColor; + if (item.tintColor) { + tintColor = item.tintColor; + } else { + if (_item.type == FSActionSheetTypeNormal) { + tintColor = FSActionSheetColorWithString(FSActionSheetItemNormalColor); + } else { + tintColor = FSActionSheetColorWithString(FSActionSheetItemHighlightedColor); + } + } + _titleButton.tintColor = tintColor; + + // 调整图片与标题的间距 + _titleButton.imageEdgeInsets = UIEdgeInsetsMake(0, _item.image?-FSActionSheetItemContentSpacing/2:0, + _item.image?1:0, _item.image?FSActionSheetItemContentSpacing/2:0); + _titleButton.titleEdgeInsets = UIEdgeInsetsMake(_item.image?1:0, _item.image?FSActionSheetItemContentSpacing/2:0, + 0, _item.image?-FSActionSheetItemContentSpacing/2:0); + // 设置图片与标题 + [_titleButton setTitle:item.title forState:UIControlStateNormal]; + [_titleButton setImage:item.image forState:UIControlStateNormal]; +} + +- (void)setContentAlignment:(FSContentAlignment)contentAlignment { + if (_contentAlignment == contentAlignment) return; + + _contentAlignment = contentAlignment; + // 更新button的图片和标题Edge + [self updateButtonContentEdge]; + // 设置内容偏移 + switch (_contentAlignment) { + // 局左 + case FSContentAlignmentLeft: { + _titleButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + _titleButton.contentEdgeInsets = UIEdgeInsetsMake(0, FSActionSheetDefaultMargin, 0, -FSActionSheetDefaultMargin); + break; + } + // 居中 + case FSContentAlignmentCenter: { + _titleButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; + _titleButton.contentEdgeInsets = UIEdgeInsetsZero; + break; + } + // 居右 + case FSContentAlignmentRight: { + _titleButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; + _titleButton.contentEdgeInsets = UIEdgeInsetsMake(0, -FSActionSheetDefaultMargin, 0, FSActionSheetDefaultMargin); + break; + } + } +} + +// 更新button图片与标题的edge +- (void)updateButtonContentEdge { + if (!_item.image) return; + if (_contentAlignment == FSContentAlignmentRight) { + CGFloat titleWidth = [[_titleButton titleForState:UIControlStateNormal] sizeWithAttributes:@{NSFontAttributeName:_titleButton.titleLabel.font}].width; + _titleButton.imageEdgeInsets = UIEdgeInsetsMake(0, titleWidth, 1, -titleWidth); + _titleButton.titleEdgeInsets = UIEdgeInsetsMake(1, -_item.image.size.width-FSActionSheetItemContentSpacing, + 0, _item.image.size.width+FSActionSheetItemContentSpacing); + } else { + _titleButton.imageEdgeInsets = UIEdgeInsetsMake(0, -FSActionSheetItemContentSpacing/2, 1, FSActionSheetItemContentSpacing/2); + _titleButton.titleEdgeInsets = UIEdgeInsetsMake(1, FSActionSheetItemContentSpacing/2, 0, -FSActionSheetItemContentSpacing/2); + } +} + +- (void)setHideTopLine:(BOOL)hideTopLine { + _topLine.hidden = hideTopLine; +} + +@end + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.h new file mode 100755 index 0000000..693ce72 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.h @@ -0,0 +1,103 @@ +// +// FSActionSheetConfig.h +// FSActionSheet +// +// Created by Steven on 6/7/16. +// Copyright © 2016 Steven. All rights reserved. +// + + +#import +#import + +// 选择选项block回调 +typedef void(^FSActionSheetHandler)(NSInteger selectedIndex); + +// 选项类型枚举 +typedef NS_ENUM(NSInteger, FSActionSheetType) { + FSActionSheetTypeNormal = 0, // 正常状态 + FSActionSheetTypeHighlighted, // 高亮状态 +}; + +// 内容偏移枚举 +typedef NS_ENUM(NSInteger, FSContentAlignment) { + FSContentAlignmentLeft = 0, // 内容紧靠左边 + FSContentAlignmentCenter, // 内容居中 + FSContentAlignmentRight, // 内容紧靠右边 +}; + + +// float +UIKIT_EXTERN CGFloat const FSActionSheetDefaultMargin; ///< 默认边距 (标题四边边距, 选项靠左或靠右时距离边缘的距离), default is 10. +UIKIT_EXTERN CGFloat const FSActionSheetContentMaxScale; ///< 弹窗内容高度与屏幕高度的默认比例, default is 0.65. +UIKIT_EXTERN CGFloat const FSActionSheetRowHeight; ///< 行高, default is 44. +UIKIT_EXTERN CGFloat const FSActionSheetTitleLineSpacing; ///< 标题行距, default is 2.5. +UIKIT_EXTERN CGFloat const FSActionSheetTitleKernSpacing; ///< 标题字距, default is 0.5. +UIKIT_EXTERN CGFloat const FSActionSheetItemTitleFontSize; ///< 选项文字字体大小, default is 16. +UIKIT_EXTERN CGFloat const FSActionSheetItemContentSpacing; ///< 选项图片和文字的间距, default is 5. +// color +UIKIT_EXTERN NSString * const FSActionSheetTitleColor; ///< 标题颜色, default is #888888 +UIKIT_EXTERN NSString * const FSActionSheetBackColor; ///< 背景颜色, default is #E8E8ED +UIKIT_EXTERN NSString * const FSActionSheetRowNormalColor; ///< 单元格背景颜色, default is #FBFBFE +UIKIT_EXTERN NSString * const FSActionSheetRowHighlightedColor; ///< 选中高亮颜色, default is #F1F1F5 +UIKIT_EXTERN NSString * const FSActionSheetRowTopLineColor; ///< 单元格顶部线条颜色, default is #D7D7D8 +UIKIT_EXTERN NSString * const FSActionSheetItemNormalColor; ///< 选项默认颜色, default is #000000 +UIKIT_EXTERN NSString * const FSActionSheetItemHighlightedColor; ///< 选项高亮颜色, default is #E64340 + +/*! @brief 将十六进制颜色值字符串转化为对应颜色 + * @param aColorString 十六进制颜色字符串 + */ +NS_INLINE UIColor *FSActionSheetColorWithString(NSString *aColorString) { + if (aColorString.length == 0) { + return nil; + } + + if ([aColorString hasPrefix:@"#"]) { + aColorString = [aColorString substringFromIndex:1]; + } + + if (aColorString.length == 6) { + int len = (int)aColorString.length/3; + unsigned int a[3]; + for (int i=0; i<3; i++) { + NSRange range; + range.location = i*len; + range.length = len; + NSString *str = [aColorString substringWithRange:range]; + [[NSScanner scannerWithString:str] scanHexInt:a+i]; + if (len == 1) { + a[i] *= 17; + } + } + return [UIColor colorWithRed:a[0]/255.0f green:a[1]/255.0f blue:a[2]/255.0f alpha:1]; + } + else if (aColorString.length == 8) { + int len = (int)aColorString.length/4; + unsigned int a[4]; + for (int i=0; i<4; i++) { + NSRange range; + range.location = i*len; + range.length = len; + NSString *str = [aColorString substringWithRange:range]; + [[NSScanner scannerWithString:str] scanHexInt:a+i]; + if (len == 1) { + a[i] *= 17; + } + } + return [UIColor colorWithRed:a[0]/255.0f green:a[1]/255.0f blue:a[2]/255.0f alpha:a[3]/255.0f]; + } + else if (aColorString.length <= 2) { + unsigned int gray; + [[NSScanner scannerWithString:aColorString] scanHexInt:&gray]; + if (aColorString.length == 1) + { + gray *= 17; + } + return [UIColor colorWithWhite:gray/255.0f alpha:1]; + } + + return nil; +} + + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.m new file mode 100755 index 0000000..44f204f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.m @@ -0,0 +1,26 @@ +// +// FSActionSheetConfig.m +// FSActionSheet +// +// Created by Steven on 6/8/16. +// Copyright © 2016 Steven. All rights reserved. +// + +#import "FSActionSheetConfig.h" + +// float +CGFloat const FSActionSheetDefaultMargin = 10; ///< 默认边距 (标题四边边距, 选项靠左或靠右时距离边缘的距离) +CGFloat const FSActionSheetContentMaxScale = 0.65; ///< 弹窗内容高度与屏幕高度的默认比例 +CGFloat const FSActionSheetRowHeight = 44; ///< 行高 +CGFloat const FSActionSheetTitleLineSpacing = 2.5; ///< 标题行距 +CGFloat const FSActionSheetTitleKernSpacing = 0.5; ///< 标题字距 +CGFloat const FSActionSheetItemTitleFontSize = 16; ///< 选项文字字体大小, default is 16. +CGFloat const FSActionSheetItemContentSpacing = 5; ///< 选项图片和文字的间距 +// color +NSString * const FSActionSheetTitleColor = @"#888888"; ///< 标题颜色 +NSString * const FSActionSheetBackColor = @"#E8E8ED"; ///< 背景颜色 +NSString * const FSActionSheetRowNormalColor = @"#FBFBFE"; ///< 单元格背景颜色 +NSString * const FSActionSheetRowHighlightedColor = @"#F1F1F5"; ///< 选中高亮颜色 +NSString * const FSActionSheetRowTopLineColor = @"#D7D7D8"; ///< 单元格顶部线条颜色 +NSString * const FSActionSheetItemNormalColor = @"#000000"; ///< 选项默认颜色 +NSString * const FSActionSheetItemHighlightedColor = @"#E64340"; ///< 选项高亮颜色 diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.h new file mode 100755 index 0000000..9e9e3a6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.h @@ -0,0 +1,64 @@ +// +// FSActionSheetItem.h +// FSActionSheet +// +// Created by Steven on 16/5/11. +// Copyright © 2016年 Steven. All rights reserved. +// + +#import +#import "FSActionSheetConfig.h" + +@interface FSActionSheetItem : NSObject + +@property (nonatomic, assign) FSActionSheetType type; ///< 选项类型, 有 默认 和 高亮 两种类型. +@property (nonatomic, strong) UIImage *image; ///< 选项图标, 建议image的size为 @2x: 46x46, @3x: 69x69. +@property (nonatomic, copy) NSString *title; ///< 选项标题 +@property (nonatomic, strong) UIColor *tintColor; ///< 选项前景色, 如果设置了这个颜色的话, 则无论选项设置的图标是什么颜色都会被修改为当前设置的这个颜色, + ///< 同时这个颜色也会是标题的文本颜色. + ++ (instancetype)itemWithType:(FSActionSheetType)type image:(UIImage *)image title:(NSString *)title tintColor:(UIColor *)tintColor; + +@end + +/*! @author Steven + * @brief 单标题的选项 + * @param type 类型 + * @param title 标题 + */ +NS_INLINE FSActionSheetItem *FSActionSheetTitleItemMake(FSActionSheetType type, NSString *title) { + return [FSActionSheetItem itemWithType:type image:nil title:title tintColor:nil]; +} + +/*! @author Steven + * @brief 标题和图标的选项 + * @param type 类型 + * @param image 图片 + * @param title 标题 + */ +NS_INLINE FSActionSheetItem *FSActionSheetTitleWithImageItemMake(FSActionSheetType type, UIImage *image, NSString *title) { + return [FSActionSheetItem itemWithType:type image:image title:title tintColor:nil]; +} + +/*! @author Steven + * @brief 单标题且自定义前景色的选项 + * @param type 类型 + * @param title 标题 + * @param tintColor 自定义前景色 + */ +NS_INLINE FSActionSheetItem *FSActionSheetTitleWithColorItemMake(FSActionSheetType type, NSString *title, UIColor *tintColor) { + return [FSActionSheetItem itemWithType:type image:nil title:title tintColor:tintColor]; +} + +/*! @author Steven + * @brief 标题和图片并且自定义前景色的选项 + * @param type 类型 + * @param title 标题 + * @param image 图片 + * @param tintColor 自定义前景色 + */ +NS_INLINE FSActionSheetItem *FSActionSheetItemMake(FSActionSheetType type, UIImage *image, NSString *title, UIColor *tintColor) { + return [FSActionSheetItem itemWithType:type image:image title:title tintColor:tintColor]; +} + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.m new file mode 100755 index 0000000..3a0d5c1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.m @@ -0,0 +1,24 @@ +// +// FSActionSheetItem.m +// FSActionSheet +// +// Created by Steven on 16/5/11. +// Copyright © 2016年 Steven. All rights reserved. +// + +#import "FSActionSheetItem.h" + +@implementation FSActionSheetItem + ++ (instancetype)itemWithType:(FSActionSheetType)type image:(UIImage *)image title:(NSString *)title tintColor:(UIColor *)tintColor { + + FSActionSheetItem *item = [[FSActionSheetItem alloc] init]; + item.type = type; + item.image = image; + item.title = title; + item.tintColor = tintColor; + + return item; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@2x.png b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@2x.png new file mode 100755 index 0000000..f0c3617 Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@2x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@3x.png b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@3x.png new file mode 100755 index 0000000..6f45e2c Binary files /dev/null and b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@3x.png differ diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.h new file mode 100644 index 0000000..5ec48ee --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.h @@ -0,0 +1,186 @@ +// +// XLPhotoBrowser.h +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/16. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import +#import +#import "XLPhotoBrowserTypeDefine.h" + +@class XLPhotoBrowser; + +@protocol XLPhotoBrowserDelegate + +@optional + +/** + * 点击底部actionSheet回调,对于图片添加了长按手势的底部功能组件 + * + * @param browser 图片浏览器 + * @param actionSheetindex 点击的actionSheet索引 + * @param currentImageIndex 当前展示的图片索引 + */ +- (void)photoBrowser:(XLPhotoBrowser *)browser clickActionSheetIndex:(NSInteger)actionSheetindex currentImageIndex:(NSInteger)currentImageIndex; + +@end + +@protocol XLPhotoBrowserDatasource + +@optional +/** + * 返回这个位置的占位图片 , 也可以是原图(如果不实现此方法,会默认使用placeholderImage) + * + * @param browser 浏览器 + * @param index 位置索引 + * + * @return 占位图片 + */ +- (UIImage *)photoBrowser:(XLPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index; + +/** + * 返回指定位置的高清图片URL + * + * @param browser 浏览器 + * @param index 位置索引 + * + * @return 返回高清大图索引 + */ +- (NSURL *)photoBrowser:(XLPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index; +/** + * 返回指定位置的ALAsset对象,从其中获取图片 + * + * @param browser 浏览器 + * @param index 位置索引 + * + * @return 返回高清大图索引 + */ +- (ALAsset *)photoBrowser:(XLPhotoBrowser *)browser assetForIndex:(NSInteger)index; +/** + * 返回指定位置图片的UIImageView,用于做图片浏览器弹出放大和消失回缩动画等 + * 如果没有实现这个方法,没有回缩动画,如果传过来的view不正确,可能会影响回缩动画 + * + * @param browser 浏览器 + * @param index 位置索引 + * + * @return 展示图片的UIImageView + */ +- (UIImageView *)photoBrowser:(XLPhotoBrowser *)browser sourceImageViewForIndex:(NSInteger)index; + +@end + +@interface XLPhotoBrowser : UIView + +/** + * 用户点击的图片视图,用于做图片浏览器弹出的放大动画,不给次属性赋值会通过代理方法photoBrowser: sourceImageViewForIndex:尝试获取,如果还是获取不到则没有弹出放大动画 + */ +@property (nonatomic, weak) UIImageView *sourceImageView; +/** + * 当前显示的图片位置索引 , 默认是0 + */ +@property (nonatomic, assign ) NSInteger currentImageIndex; +/** + * 浏览的图片数量,大于0 + */ +@property (nonatomic, assign ) NSInteger imageCount; +/** + * datasource + */ +@property (nonatomic, weak) id datasource; +/** + * delegate + */ +@property (nonatomic , weak) id delegate; +/** + * browser style + */ +@property (nonatomic , assign) XLPhotoBrowserStyle browserStyle; +/** + * 占位图片,可选(默认是一张灰色的100*100像素图片) + * 当没有实现数据源中placeholderImageForIndex方法时,默认会使用这个占位图片 + */ +@property(nonatomic, strong) UIImage *placeholderImage; + + +#pragma mark ---------------------- +#pragma mark 自定义PageControl样式接口 + +/** + * 是否在只有一张图时隐藏pagecontrol,默认为YES + */ +@property(nonatomic) BOOL hidesForSinglePage; +/** + * pagecontrol 样式,默认为XLPhotoBrowserPageControlStyleAnimated样式 + */ +@property (nonatomic, assign) XLPhotoBrowserPageControlStyle pageControlStyle; +/** + * 分页控件位置 , 默认为XLPhotoBrowserPageControlAlimentCenter + */ +@property (nonatomic, assign) XLPhotoBrowserPageControlAliment pageControlAliment; +/** + * 当前分页控件小圆标颜色 + */ +@property (nonatomic, strong) UIColor *currentPageDotColor; +/** + * 其他分页控件小圆标颜色 + */ +@property (nonatomic, strong) UIColor *pageDotColor; +/** + * 当前分页控件小圆标图片 + */ +@property (nonatomic, strong) UIImage *currentPageDotImage; +/** + * 其他分页控件小圆标图片 + */ +@property (nonatomic, strong) UIImage *pageDotImage; + + +#pragma mark ---------------------- +#pragma mark XLPhotoBrowser控制接口 + +/** + * 快速创建并进入图片浏览器 , 同时传入数据源对象 + * + * @param currentImageIndex 开始展示的图片索引 + * @param imageCount 图片数量 + * @param datasource 数据源 + * + */ ++ (instancetype)showPhotoBrowserWithCurrentImageIndex:(NSInteger)currentImageIndex imageCount:(NSUInteger)imageCount datasource:(id)datasource; + +/** + 一行代码展示 (在某些使用场景,不需要做很复杂的操作,例如不需要长按弹出actionSheet,从而不需要实现数据源方法和代理方法,那么可以选择这个方法,直接传数据源数组进来,框架内部做处理) + + @param images 图片数据源数组(数组内部可以是UIImage/NSURL网络图片地址/ALAsset,但只能是其中一种) + @param currentImageIndex 展示第几张,从0开始 + + @return XLPhotoBrowser实例对象 + */ ++ (instancetype)showPhotoBrowserWithImages:(NSArray *)images currentImageIndex:(NSInteger)currentImageIndex; + +/** + * 初始化底部ActionSheet弹框数据 , 不实现此方法,则没有类似微信那种长按手势弹框 + * + * @param title ActionSheet的title + * @param delegate XLPhotoBrowserDelegate + * @param cancelButtonTitle 取消按钮文字 + * @param deleteButtonTitle 删除按钮文字,如果为nil,不显示删除按钮 + * @param otherButtonTitle 其他按钮数组 + */ +- (void)setActionSheetWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle deleteButtonTitle:( NSString *)deleteButtonTitle otherButtonTitles:( NSString *)otherButtonTitle, ... NS_REQUIRES_NIL_TERMINATION; +/** + * 保存当前展示的图片 + */ +- (void)saveCurrentShowImage; +/** + * 进入图片浏览器 + */ +- (void)show; +/** + * 退出 + */ +- (void)dismiss; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.m new file mode 100644 index 0000000..ab267ab --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.m @@ -0,0 +1,1085 @@ +// +// XLPhotoBrowser.m +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/16. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import "XLPhotoBrowser.h" +#import "XLZoomingScrollView.h" +#import "TAPageControl.h" +#import "FSActionSheetConfig.h" +#import "FSActionSheet.h" +#import "XLPhotoBrowserConfig.h" + +#define BaseTag 100 + +@interface XLPhotoBrowser () + +@property (nonatomic , strong) UIWindow *photoBrowserWindow; + +/** + * 存放所有图片的容器 + */ +@property (nonatomic , strong) UIScrollView *scrollView; +/** + * 保存图片的过程指示菊花 + */ +@property (nonatomic , strong) UIActivityIndicatorView *indicatorView; +/** + * 保存图片的结果指示label + */ +@property (nonatomic , strong) UILabel *savaImageTipLabel; +/** + * 正在使用的XLZoomingScrollView对象集 + */ +@property (nonatomic , strong) NSMutableSet *visibleZoomingScrollViews; +/** + * 循环利用池中的XLZoomingScrollView对象集,用于循环利用 + */ +@property (nonatomic , strong) NSMutableSet *reusableZoomingScrollViews; +/** + * pageControl + */ +@property (nonatomic , strong) UIControl *pageControl; +/** + * index label + */ +@property (nonatomic , strong) UILabel *indexLabel; +/** + * 保存按钮 + */ +@property (nonatomic , strong) UIButton *saveButton; + + +/** + * 返回按钮 + */ +@property (nonatomic , strong) UIButton * backButton; +/** + * ActionSheet的otherbuttontitles + */ +@property (nonatomic , strong) NSArray *actionOtherButtonTitles; +/** + * ActionSheet的title + */ +@property (nonatomic , strong) NSString *actionSheetTitle; +/** + * actionSheet的取消按钮title + */ +@property (nonatomic , strong) NSString *actionSheetCancelTitle; +/** + * actionSheet的高亮按钮title + */ +@property (nonatomic , strong) NSString *actionSheetDeleteButtonTitle; +@property (nonatomic, assign) CGSize pageControlDotSize; +@property(nonatomic, strong) NSArray *images; + +@end + +@implementation XLPhotoBrowser + +#pragma mark - set / get + +- (UILabel *)savaImageTipLabel +{ + if (_savaImageTipLabel == nil) { + _savaImageTipLabel = [[UILabel alloc] init]; + _savaImageTipLabel.textColor = [UIColor whiteColor]; + _savaImageTipLabel.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.90f]; + _savaImageTipLabel.textAlignment = NSTextAlignmentCenter; + _savaImageTipLabel.font = [UIFont boldSystemFontOfSize:17]; + } + return _savaImageTipLabel; +} + +- (UIActivityIndicatorView *)indicatorView +{ + if (!_indicatorView) { + _indicatorView = [[UIActivityIndicatorView alloc] init]; + _indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + } + return _indicatorView; +} + +- (UIImage *)placeholderImage +{ + if (!_placeholderImage) { + _placeholderImage = [UIImage xl_imageWithColor:[UIColor grayColor] size:CGSizeMake(100, 100)]; + } + return _placeholderImage; +} + +- (UIWindow *)photoBrowserWindow +{ + if (!_photoBrowserWindow) { + _photoBrowserWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + _photoBrowserWindow.windowLevel = MAXFLOAT; +// _photoBrowserWindow.windowLevel = UIWindowLevelAlert;//2000的优先级,这样不会遮盖UIAlertView的提示弹框 + UIViewController *tempVC = [[UIViewController alloc] init]; + tempVC.view.backgroundColor = XLPhotoBrowserBackgrounColor; +; + _photoBrowserWindow.rootViewController = tempVC; + // NSEnumerator *frontToBackWindows = [UIApplication.sharedApplication.windows reverseObjectEnumerator]; + // for (UIWindow *window in frontToBackWindows) { + // BOOL windowOnMainScreen = window.screen == UIScreen.mainScreen; + // BOOL windowIsVisible = !window.hidden && window.alpha > 0; + // BOOL windowLevelSupported = (window.windowLevel >= UIWindowLevelNormal); + // BOOL windowSizeIsEqualToScreen = (window.xl_width == XLScreenW && window.xl_height == XLScreenH); + // if(windowOnMainScreen && windowIsVisible && windowLevelSupported && windowSizeIsEqualToScreen) { + // return window; + // } + // } + // + // XLPBLog(@"XLPhotoBrowser在当前工程未匹配到合适的window,请根据工程架构酌情调整此方法,匹配最优窗口"); + // if (XLPhotoBrowserDebug) { + // NSAssert(false, @"XLPhotoBrowser在当前工程未匹配到window,请根据工程架构酌情调整findTheMainWindow方法,匹配最优窗口"); + // } + // + // UIWindow * delegateWindow = [[[UIApplication sharedApplication] delegate] window]; + // return delegateWindow; + + } + return _photoBrowserWindow; +} + +- (void)setCurrentPageDotColor:(UIColor *)currentPageDotColor +{ + _currentPageDotColor = currentPageDotColor; + if ([self.pageControl isKindOfClass:[TAPageControl class]]) { + TAPageControl *pageControl = (TAPageControl *)_pageControl; + pageControl.dotColor = currentPageDotColor; + } else { + UIPageControl *pageControl = (UIPageControl *)_pageControl; + pageControl.currentPageIndicatorTintColor = currentPageDotColor; + } +} + +- (void)setPageDotColor:(UIColor *)pageDotColor +{ + _pageDotColor = pageDotColor; + if ([self.pageDotColor isKindOfClass:[UIPageControl class]]) { + UIPageControl *pageControl = (UIPageControl *)_pageControl; + pageControl.pageIndicatorTintColor = pageDotColor; + } +} + +- (void)setCurrentPageDotImage:(UIImage *)currentPageDotImage +{ + _currentPageDotImage = currentPageDotImage; + [self setCustomPageControlDotImage:currentPageDotImage isCurrentPageDot:YES]; +} + +- (void)setPageDotImage:(UIImage *)pageDotImage +{ + _pageDotImage = pageDotImage; + [self setCustomPageControlDotImage:pageDotImage isCurrentPageDot:NO]; +} + +- (void)setCustomPageControlDotImage:(UIImage *)image isCurrentPageDot:(BOOL)isCurrentPageDot +{ + if (!image || !self.pageControl) return; + if ([self.pageControl isKindOfClass:[TAPageControl class]]) { + TAPageControl *pageControl = (TAPageControl *)_pageControl; + if (isCurrentPageDot) { + pageControl.currentDotImage = image; + } else { + pageControl.dotImage = image; + } + } else { + UIPageControl *pageControl = (UIPageControl *)_pageControl; + if (isCurrentPageDot) { + [pageControl setValue:image forKey:@"_currentPageImage"]; + } else { + [pageControl setValue:image forKey:@"_pageImage"]; + } + } +} + +- (void)setPageControlStyle:(XLPhotoBrowserPageControlStyle)pageControlStyle +{ + XLLogFunc; + _pageControlStyle = pageControlStyle; + [self setUpPageControl]; + [self updateIndexVisible]; +} + +- (void)setHidesForSinglePage:(BOOL)hidesForSinglePage +{ + _hidesForSinglePage = hidesForSinglePage; + [self updateIndexVisible]; +} + +- (void)setBrowserStyle:(XLPhotoBrowserStyle)browserStyle +{ + _browserStyle = browserStyle; + [self updateIndexVisible]; +} + +- (void)setPageControlAliment:(XLPhotoBrowserPageControlAliment)pageControlAliment +{ + _pageControlAliment = pageControlAliment; + switch (self.pageControlAliment) { + case XLPhotoBrowserPageControlAlimentLeft: + { + self.pageControl.xl_x = 10; + } + break; + case XLPhotoBrowserPageControlAlimentRight: + { + self.pageControl.xl_x = (self.xl_width - self.pageControl.xl_width) - 10; + } + break; + case XLPhotoBrowserPageControlAlimentCenter: + default: + { + self.pageControl.xl_x = (self.xl_width - self.pageControl.xl_width) * 0.5; + } + break; + } +} + +#pragma mark - initial + +- (void)awakeFromNib +{ + [super awakeFromNib]; + [self initial]; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + [self initial]; + } + return self; +} + +- (void)initial +{ + self.backgroundColor = XLPhotoBrowserBackgrounColor; + self.visibleZoomingScrollViews = [[NSMutableSet alloc] init]; + self.reusableZoomingScrollViews = [[NSMutableSet alloc] init]; + [self placeholderImage]; + + _pageControlAliment = XLPhotoBrowserPageControlAlimentCenter; + _pageControlDotSize = CGSizeMake(10, 10); + _pageControlStyle = XLPhotoBrowserPageControlStyleAnimated; + _hidesForSinglePage = YES; + _currentPageDotColor = [UIColor whiteColor]; + _pageDotColor = [UIColor lightGrayColor]; + _browserStyle = XLPhotoBrowserStylePageControl; + + self.currentImageIndex = 0; + self.imageCount = 0; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil]; + +} + +- (void)iniaialUI +{ + XLLogFunc; + + [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + self.scrollView = [[UIScrollView alloc] init]; + self.scrollView.delegate = self; + self.scrollView.showsHorizontalScrollIndicator = NO; + self.scrollView.showsVerticalScrollIndicator = NO; + self.scrollView.pagingEnabled = YES; + self.scrollView.backgroundColor = [UIColor clearColor]; + [self addSubview:self.scrollView]; + + if (self.currentImageIndex == 0) { // 如果刚进入的时候是0,不会调用scrollViewDidScroll:方法,不会展示第一张图片 + XLFormatLog(@"self.currentImageIndex == %zd",self.currentImageIndex); + [self showPhotos]; + } + + [self setUpPageControl]; + + // 添加XLPhotoBrowserStyleSimple相关控件 + UILabel *indexLabel = [[UILabel alloc] init]; + indexLabel.textAlignment = NSTextAlignmentCenter; + indexLabel.textColor = [UIColor whiteColor]; + indexLabel.font = [UIFont systemFontOfSize:18]; + indexLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; + indexLabel.clipsToBounds = YES; + self.indexLabel = indexLabel; + [self addSubview:indexLabel]; + UIButton *saveButton = [[UIButton alloc] init]; + [saveButton setTitle:@"保存" forState:UIControlStateNormal]; + [saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + saveButton.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.90f]; + saveButton.layer.cornerRadius = 5; + saveButton.clipsToBounds = YES; + [saveButton addTarget:self action:@selector(saveImage) forControlEvents:UIControlEventTouchUpInside]; + self.saveButton = saveButton; + [self addSubview:saveButton]; + + UIButton * backButton = [[UIButton alloc] init]; + [backButton setTitle:@"退出" forState:UIControlStateNormal]; + [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + backButton.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.90f]; + backButton.layer.cornerRadius = 5; + backButton.clipsToBounds = YES; + [backButton addTarget:self action:@selector(backImage) forControlEvents:UIControlEventTouchUpInside]; + self.backButton = backButton; + [self addSubview:backButton]; + + + + + [self showFirstImage]; + [self updateIndexContent]; + [self updateIndexVisible]; +} + +- (void)backImage { + + [self dismiss]; +} + +- (void)setUpPageControl +{ + XLLogFunc; + if (_pageControl) { + [_pageControl removeFromSuperview]; + _pageControl = nil; + // 重新加载数据时调整 + } + switch (self.pageControlStyle) { + case XLPhotoBrowserPageControlStyleAnimated: + { + TAPageControl *pageControl = [[TAPageControl alloc] init]; + _pageControl = pageControl; + pageControl.numberOfPages = self.imageCount; + pageControl.dotColor = self.currentPageDotColor; + pageControl.currentPage = self.currentImageIndex; + pageControl.userInteractionEnabled = NO; + [self addSubview:pageControl]; + } + break; + case XLPhotoBrowserPageControlStyleClassic: + { + UIPageControl *pageControl = [[UIPageControl alloc] init]; + _pageControl = pageControl; + pageControl.numberOfPages = self.imageCount; + pageControl.currentPageIndicatorTintColor = self.currentPageDotColor; + pageControl.pageIndicatorTintColor = self.pageDotColor; + pageControl.userInteractionEnabled = NO; + [self addSubview:pageControl]; + pageControl.currentPage = self.currentImageIndex; + } + break; + default: + break; + } + + // 重设pagecontroldot图片 + self.currentPageDotImage = self.currentPageDotImage; + self.pageDotImage = self.pageDotImage; +} + +- (void)dealloc +{ + [self.reusableZoomingScrollViews removeAllObjects]; + [self.visibleZoomingScrollViews removeAllObjects]; +} + +#pragma mark - layout + +- (void)orientationDidChange +{ + XLLogFunc; + self.scrollView.delegate = nil; // 旋转期间,禁止调用scrollView的代理事件等 + XLZoomingScrollView *temp = [self zoomingScrollViewAtIndex:self.currentImageIndex]; + [temp.scrollview setZoomScale:1.0 animated:YES]; + [self updateFrames]; + self.scrollView.delegate = self; +} + +- (void)updateFrames +{ + XLLogFunc; + self.frame = [UIScreen mainScreen].bounds; + CGRect rect = self.bounds; + rect.size.width += XLPhotoBrowserImageViewMargin; + self.scrollView.frame = rect; // frame修改的时候,也会触发scrollViewDidScroll,不是每次都触发 + self.scrollView.xl_x = 0; + self.scrollView.contentSize = CGSizeMake((self.scrollView.xl_width) * self.imageCount, 0); + self.scrollView.contentOffset = CGPointMake(self.currentImageIndex * (self.scrollView.xl_width), 0);// 回触发scrollViewDidScroll + [self.scrollView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (obj.tag >= BaseTag) { + obj.frame = CGRectMake((self.scrollView.xl_width) * (obj.tag - BaseTag), 0, self.xl_width, self.xl_height); + } + }]; + + self.saveButton.frame = CGRectMake(30, self.xl_height - 70, 50, 25); + self.backButton.frame = CGRectMake(30, kStatusBarHeight + 30, 50, 25); + + self.indexLabel.bounds = CGRectMake(0, 0, 80, 30); + self.indexLabel.xl_centerX = self.xl_width * 0.5; + self.indexLabel.xl_centerY = 35; + self.indexLabel.layer.cornerRadius = self.indexLabel.xl_height * 0.5; + + self.savaImageTipLabel.layer.cornerRadius = 5; + self.savaImageTipLabel.clipsToBounds = YES; + [self.savaImageTipLabel sizeToFit]; + self.savaImageTipLabel.xl_height = 30; + self.savaImageTipLabel.xl_width += 20; + self.savaImageTipLabel.center = self.center; + + self.indicatorView.center = self.center; + + CGSize size = CGSizeZero; + if ([self.pageControl isKindOfClass:[TAPageControl class]]) { + TAPageControl *pageControl = (TAPageControl *)_pageControl; + size = [pageControl sizeForNumberOfPages:self.imageCount]; + // TAPageControl 本身设计的缺陷,如果TAPageControl在设置颜色等属性以后再给frame,里面的圆点位置可能不正确 , 但是调用sizeToFit 又会改变TAPageControl的显隐状态,所以还需要 + BOOL hidden = pageControl.hidden; + [pageControl sizeToFit]; + pageControl.hidden = hidden; + } else { + size = CGSizeMake(self.imageCount * self.pageControlDotSize.width * 1.2, self.pageControlDotSize.height); + } + CGFloat x; + switch (self.pageControlAliment) { + case XLPhotoBrowserPageControlAlimentCenter: + { + x = (self.xl_width - size.width) * 0.5; + } + break; + case XLPhotoBrowserPageControlAlimentLeft: + { + x = 10; + } + break; + case XLPhotoBrowserPageControlAlimentRight: + { + x = self.xl_width - size.width - 10; + } + break; + default: + break; + } + CGFloat y = self.xl_height - size.height - 10; + self.pageControl.frame = CGRectMake(x, y, size.width, size.height); +} + +- (void)layoutSubviews +{ + XLLogFunc; + [super layoutSubviews]; + [self updateFrames]; +} + +#pragma mark - private -- 长按图片相关 + +- (void)longPress:(UILongPressGestureRecognizer *)longPress +{ + XLZoomingScrollView *currentZoomingScrollView = [self zoomingScrollViewAtIndex:self.currentImageIndex]; + if (longPress.state == UIGestureRecognizerStateBegan) { + XLPBLog(@"UIGestureRecognizerStateBegan , currentZoomingScrollView.progress %f",currentZoomingScrollView.progress); + if (currentZoomingScrollView.progress < 1.0) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self longPress:longPress]; + }); + return; + } + + if (self.actionOtherButtonTitles.count <= 0 && self.actionSheetDeleteButtonTitle.length <= 0 && self.actionSheetTitle.length <= 0) { + return; + } + FSActionSheet *actionSheet = [[FSActionSheet alloc] initWithTitle:self.actionSheetTitle delegate:nil cancelButtonTitle:self.actionSheetCancelTitle highlightedButtonTitle:self.actionSheetDeleteButtonTitle otherButtonTitles:self.actionOtherButtonTitles sourceWindow:self.photoBrowserWindow]; + __weak typeof(self) weakSelf = self; + // 展示并绑定选择回调 + [actionSheet showWithSelectedCompletion:^(NSInteger selectedIndex) { + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(photoBrowser:clickActionSheetIndex:currentImageIndex:)]) { + [weakSelf.delegate photoBrowser:weakSelf clickActionSheetIndex:selectedIndex currentImageIndex:weakSelf.currentImageIndex]; + } + }]; + } +} + +/** + 具体的删除逻辑,请根据自己项目的实际情况,自行处理 + */ +//- (void)delete +//{ +// if (self.currentImageIndex == 0) { +// XLZoomingScrollView *currentZoomingScrollView = [self zoomingScrollViewAtIndex:self.currentImageIndex]; +// [self.reusableZoomingScrollViews addObject:currentZoomingScrollView]; +// [currentZoomingScrollView prepareForReuse]; +// [currentZoomingScrollView removeFromSuperview]; +// [self.visibleZoomingScrollViews minusSet:self.reusableZoomingScrollViews]; +// } +// self.currentImageIndex --; +// self.imageCount --; +// if (self.currentImageIndex == -1 && self.imageCount == 0) { +// [self dismiss]; +// } else { +// self.currentImageIndex = (self.currentImageIndex == (-1) ? 0 : self.currentImageIndex); +// if (self.currentImageIndex == 0) { +// [self setUpImageForZoomingScrollViewAtIndex:0]; +// [self updatePageControlIndex]; +// [self showPhotos]; +// } +// +// self.scrollView.contentSize = CGSizeMake((self.scrollView.frame.size.width) * self.imageCount, 0); +// self.scrollView.contentOffset = CGPointMake(self.currentImageIndex * (self.scrollView.frame.size.width), 0); +// } +// UIPageControl *pageControl = (UIPageControl *)self.pageControl; +// pageControl.numberOfPages = self.imageCount; +// [self updatePageControlIndex]; +//} + +#pragma mark - private -- save image + +- (void)saveImage +{ + XLZoomingScrollView *zoomingScrollView = [self zoomingScrollViewAtIndex:self.currentImageIndex]; + if (zoomingScrollView.progress < 1.0) { + self.savaImageTipLabel.text = XLPhotoBrowserLoadingImageText; + [self addSubview:self.savaImageTipLabel]; + [self.savaImageTipLabel performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.0]; + return; + } + UIImageWriteToSavedPhotosAlbum(zoomingScrollView.currentImage, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL); + [self addSubview:self.indicatorView]; + [self.indicatorView startAnimating]; +} + +- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; +{ + [self.indicatorView removeFromSuperview]; + [self addSubview:self.savaImageTipLabel]; + if (error) { + self.savaImageTipLabel.text = XLPhotoBrowserSaveImageFailText; + } else { + self.savaImageTipLabel.text = XLPhotoBrowserSaveImageSuccessText; + } + [self.savaImageTipLabel performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.0]; +} + +#pragma mark - private ---loadimage + +- (void)showPhotos +{ + XLLogFunc; + // 只有一张图片 + if (self.imageCount == 1) { + [self setUpImageForZoomingScrollViewAtIndex:0]; + return; + } + + CGRect visibleBounds = self.scrollView.bounds; + NSInteger firstIndex = floor((CGRectGetMinX(visibleBounds)) / CGRectGetWidth(visibleBounds)); + NSInteger lastIndex = floor((CGRectGetMaxX(visibleBounds)-1) / CGRectGetWidth(visibleBounds)); + + if (firstIndex < 0) { + firstIndex = 0; + } + if (firstIndex >= self.imageCount) { + firstIndex = self.imageCount - 1; + } + if (lastIndex < 0){ + lastIndex = 0; + } + if (lastIndex >= self.imageCount) { + lastIndex = self.imageCount - 1; + } + + // 回收不再显示的zoomingScrollView + NSInteger zoomingScrollViewIndex = 0; + for (XLZoomingScrollView *zoomingScrollView in self.visibleZoomingScrollViews) { + zoomingScrollViewIndex = zoomingScrollView.tag - BaseTag; + if (zoomingScrollViewIndex < firstIndex || zoomingScrollViewIndex > lastIndex) { + [self.reusableZoomingScrollViews addObject:zoomingScrollView]; + [zoomingScrollView prepareForReuse]; + [zoomingScrollView removeFromSuperview]; + } + } + + // _visiblePhotoViews 减去 _reusablePhotoViews中的元素 + [self.visibleZoomingScrollViews minusSet:self.reusableZoomingScrollViews]; + while (self.reusableZoomingScrollViews.count > 2) { // 循环利用池中最多保存两个可以用对象 + [self.reusableZoomingScrollViews removeObject:[self.reusableZoomingScrollViews anyObject]]; + } + + // 展示图片 + for (NSInteger index = firstIndex; index <= lastIndex; index++) { + if (![self isShowingZoomingScrollViewAtIndex:index]) { + [self setUpImageForZoomingScrollViewAtIndex:index]; + } + } +} + +/** + * 判断指定的某个位置图片是否在显示 + */ +- (BOOL)isShowingZoomingScrollViewAtIndex:(NSInteger)index +{ + for (XLZoomingScrollView* view in self.visibleZoomingScrollViews) { + if ((view.tag - BaseTag) == index) { + return YES; + } + } + return NO; +} + +/** + * 获取指定位置的XLZoomingScrollView , 三级查找,正在显示的池,回收池,创建新的并赋值 + * + * @param index 指定位置索引 + */ +- (XLZoomingScrollView *)zoomingScrollViewAtIndex:(NSInteger)index +{ + for (XLZoomingScrollView* zoomingScrollView in self.visibleZoomingScrollViews) { + if ((zoomingScrollView.tag - BaseTag) == index) { + return zoomingScrollView; + } + } + XLZoomingScrollView* zoomingScrollView = [self dequeueReusableZoomingScrollView]; + [self setUpImageForZoomingScrollViewAtIndex:index]; + return zoomingScrollView; +} + +/** + * 加载指定位置的图片 + */ +- (void)setUpImageForZoomingScrollViewAtIndex:(NSInteger)index +{ + XLLogFunc; + XLZoomingScrollView *zoomingScrollView = [self dequeueReusableZoomingScrollView]; + zoomingScrollView.zoomingScrollViewdelegate = self; + [zoomingScrollView addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)]]; + zoomingScrollView.tag = BaseTag + index; + zoomingScrollView.frame = CGRectMake((self.scrollView.xl_width) * index, 0, self.xl_width, self.xl_height); + self.currentImageIndex = index; + if ([self highQualityImageURLForIndex:index]) { // 如果提供了高清大图数据源,就去加载 + [zoomingScrollView setShowHighQualityImageWithURL:[self highQualityImageURLForIndex:index] placeholderImage:[self placeholderImageForIndex:index]]; + } else if ([self assetForIndex:index]) { + ALAsset *asset = [self assetForIndex:index]; + CGImageRef imageRef = asset.defaultRepresentation.fullScreenImage; + [zoomingScrollView setShowImage:[UIImage imageWithCGImage:imageRef]]; + CGImageRelease(imageRef); + } else { + [zoomingScrollView setShowImage:[self placeholderImageForIndex:index]]; + } + + [self.visibleZoomingScrollViews addObject:zoomingScrollView]; + [self.scrollView addSubview:zoomingScrollView]; +} + +/** + * 从缓存池中获取一个XLZoomingScrollView对象 + */ +- (XLZoomingScrollView *)dequeueReusableZoomingScrollView +{ + XLZoomingScrollView *photoView = [self.reusableZoomingScrollViews anyObject]; + if (photoView) { + [self.reusableZoomingScrollViews removeObject:photoView]; + } else { + photoView = [[XLZoomingScrollView alloc] init]; + } + return photoView; +} + +/** + * 获取指定位置的占位图片,和外界的数据源交互 + */ +- (UIImage *)placeholderImageForIndex:(NSInteger)index +{ + if (self.datasource && [self.datasource respondsToSelector:@selector(photoBrowser:placeholderImageForIndex:)]) { + return [self.datasource photoBrowser:self placeholderImageForIndex:index]; + } else if(self.images.count>index) { + if ([self.images[index] isKindOfClass:[UIImage class]]) { + return self.images[index]; + } else { + return self.placeholderImage; + } + } + return self.placeholderImage; +} + +/** + * 获取指定位置的高清大图URL,和外界的数据源交互 + */ +- (NSURL *)highQualityImageURLForIndex:(NSInteger)index +{ + if (self.datasource && [self.datasource respondsToSelector:@selector(photoBrowser:highQualityImageURLForIndex:)]) { + NSURL *url = [self.datasource photoBrowser:self highQualityImageURLForIndex:index]; + if (!url) { + XLPBLog(@"高清大图URL数据 为空,请检查代码 , 图片索引:%zd",index); + return nil; + } + if ([url isKindOfClass:[NSString class]]) { + url = [NSURL URLWithString:(NSString *)url]; + } + if (![url isKindOfClass:[NSURL class]]) { + // NSAssert([url isKindOfClass:[NSURL class]], @"高清大图URL数据有问题,不是NSString也不是NSURL"); + XLPBLog(@"高清大图URL数据有问题,不是NSString也不是NSURL , 错误数据:%@ , 图片索引:%zd",url,index); + return nil; + } + return url; + } else if(self.images.count>index) { + if ([self.images[index] isKindOfClass:[NSURL class]]) { + return self.images[index]; + } else if ([self.images[index] isKindOfClass:[NSString class]]) { + NSURL *url = [NSURL URLWithString:self.images[index]]; + return url; + } else { + return nil; + } + } + return nil; +} + +/** + * 获取指定位置的 ALAsset,获取图片 + */ +- (ALAsset *)assetForIndex:(NSInteger)index +{ + if (self.datasource && [self.datasource respondsToSelector:@selector(photoBrowser:assetForIndex:)]) { + return [self.datasource photoBrowser:self assetForIndex:index]; + } else if (self.images.count > index) { + if ([self.images[index] isKindOfClass:[ALAsset class]]) { + return self.images[index]; + } else { + return nil; + } + } + return nil; +} + +/** + * 获取多图浏览,指定位置图片的UIImageView视图,用于做弹出放大动画和回缩动画 + */ +- (UIView *)sourceImageViewForIndex:(NSInteger)index +{ + if (self.datasource && [self.datasource respondsToSelector:@selector(photoBrowser:sourceImageViewForIndex:)]) { + return [self.datasource photoBrowser:self sourceImageViewForIndex:index]; + } + return nil; +} + +/** + * 第一个展示的图片 , 点击图片,放大的动画就是从这里来的 + */ +- (void)showFirstImage +{ + // 获取到用户点击的那个UIImageView对象,进行坐标转化 + CGRect startRect; + if (!self.sourceImageView) { + if(self.datasource && [self.datasource respondsToSelector:@selector(photoBrowser:sourceImageViewForIndex:)]) { + self.sourceImageView = [self.datasource photoBrowser:self sourceImageViewForIndex:self.currentImageIndex]; + } else { + [UIView animateWithDuration:0.25 animations:^{ + self.alpha = 1.0; + }]; + XLPBLog(@"需要提供源视图才能做弹出/退出图片浏览器的缩放动画"); + return; + } + } + startRect = [self.sourceImageView.superview convertRect:self.sourceImageView.frame toView:self]; + + UIImageView *tempView = [[UIImageView alloc] init]; + tempView.image = [self placeholderImageForIndex:self.currentImageIndex]; + tempView.frame = startRect; + [self addSubview:tempView]; + + CGRect targetRect; // 目标frame + UIImage *image = self.sourceImageView.image; + + //TODO 完善image为空的闪退 + if (image == nil) { + ///objc[1903]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x1110ec998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x110e6b880). One of the two will be used. Which one is undefined. + //(lldb) po tempView.frame + // (origin = (x = 15, y = 100), size = (width = 100, height = 100)) + // + // (lldb) po targetRect + // (origin = (x = 0, y = NaN), size = (width = 414, height = NaN)) + + + XLPBLog(@"需要提供源视图才能做弹出/退出图片浏览器的缩放动画"); + return; + } + CGFloat imageWidthHeightRatio = image.size.width / image.size.height; + CGFloat width = XLScreenW; + CGFloat height = XLScreenW / imageWidthHeightRatio; + CGFloat x = 0; + CGFloat y; + if (height > XLScreenH) { + y = 0; + } else { + y = (XLScreenH - height ) * 0.5; + } + targetRect = CGRectMake(x, y, width, height); + self.scrollView.hidden = YES; + self.alpha = 1.0; + + // 动画修改图片视图的frame , 居中同时放大 + [UIView animateWithDuration:XLPhotoBrowserShowImageAnimationDuration animations:^{ + tempView.frame = targetRect; + } completion:^(BOOL finished) { + [tempView removeFromSuperview]; + self.scrollView.hidden = NO; + }]; +} + +#pragma mark - XLZoomingScrollViewDelegate + +/** + * 单击图片,退出浏览 + */ +- (void)zoomingScrollView:(XLZoomingScrollView *)zoomingScrollView singleTapDetected:(UITapGestureRecognizer *)singleTap +{ + [UIView animateWithDuration:0.1 animations:^{ + [self.savaImageTipLabel removeFromSuperview]; + [self.indicatorView removeFromSuperview]; + } completion:^(BOOL finished) { + [self.savaImageTipLabel removeFromSuperview]; + [self.indicatorView removeFromSuperview]; + }]; + NSInteger currentIndex = zoomingScrollView.tag - BaseTag; + UIView *sourceView = [self sourceImageViewForIndex:currentIndex]; + if (sourceView == nil) { + [self dismiss]; + return; + } + self.scrollView.hidden = YES; + self.pageControl.hidden = YES; + self.indexLabel.hidden = YES; + self.saveButton.hidden = YES; + self.backButton.hidden = YES; + CGRect targetTemp = [sourceView.superview convertRect:sourceView.frame toView:self]; + + UIImageView *tempView = [[UIImageView alloc] init]; + tempView.contentMode = sourceView.contentMode; + tempView.clipsToBounds = YES; + tempView.image = zoomingScrollView.currentImage; + tempView.frame = CGRectMake( - zoomingScrollView.scrollview.contentOffset.x + zoomingScrollView.imageView.xl_x, - zoomingScrollView.scrollview.contentOffset.y + zoomingScrollView.imageView.xl_y, zoomingScrollView.imageView.xl_width, zoomingScrollView.imageView.xl_height); + [self addSubview:tempView]; + + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; + [UIView animateWithDuration:0.1 animations:^{ + tempView.frame = targetTemp; + self.backgroundColor = [UIColor clearColor]; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} + +#pragma mark - UIScrollViewDelegate + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView +{ + XLLogFunc; + [self showPhotos]; + NSInteger pageNum = floor((scrollView.contentOffset.x + scrollView.bounds.size.width * 0.5) / scrollView.bounds.size.width); + self.currentImageIndex = pageNum == self.imageCount ? pageNum - 1 : pageNum; + [self updateIndexContent]; +} + +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView +{ + NSInteger pageNum = floor((scrollView.contentOffset.x + scrollView.bounds.size.width * 0.5) / scrollView.bounds.size.width); + self.currentImageIndex = pageNum == self.imageCount ? pageNum - 1 : pageNum; + [self updateIndexContent]; +} + +#pragma mark - 图片索引的显示内容和显隐逻辑 + +/** + 更新索引指示控件的显隐逻辑 + */ +- (void)updateIndexVisible +{ + switch (self.browserStyle) { + case XLPhotoBrowserStylePageControl: + { + self.pageControl.hidden = NO; + self.indexLabel.hidden = YES; + self.saveButton.hidden = YES; + } + break; + case XLPhotoBrowserStyleIndexLabel: + { + self.indexLabel.hidden = NO; + self.pageControl.hidden = YES; + self.saveButton.hidden = YES; + + } + break; + case XLPhotoBrowserStyleSimple: + { + self.indexLabel.hidden = NO; + self.saveButton.hidden = NO; + self.pageControl.hidden = YES; + + } + break; + default: + break; + } + + if (self.imageCount == 1 && self.hidesForSinglePage == YES) { + self.indexLabel.hidden = YES; + self.pageControl.hidden = YES; + } +} + +/** + * 修改图片指示索引内容 + */ +- (void)updateIndexContent +{ + UIPageControl *pageControl = (UIPageControl *)self.pageControl; + pageControl.currentPage = self.currentImageIndex; + NSString *title = [NSString stringWithFormat:@"%zd / %zd",self.currentImageIndex+1,self.imageCount]; + self.indexLabel.text = title; +} + +#pragma mark - public method + +/** + * 快速创建并进入图片浏览器 + * + * @param currentImageIndex 开始展示的图片索引 + * @param imageCount 图片数量 + * @param datasource 数据源 + * + */ ++ (instancetype)showPhotoBrowserWithCurrentImageIndex:(NSInteger)currentImageIndex imageCount:(NSUInteger)imageCount datasource:(id)datasource +{ + XLPhotoBrowser *browser = [[XLPhotoBrowser alloc] init]; + browser.imageCount = imageCount; + browser.currentImageIndex = currentImageIndex; + browser.datasource = datasource; + [browser show]; + return browser; +} + +///** +// * 进入图片浏览器 +// * +// * @param index 从哪一张开始浏览,默认第一章 +// * @param imageCount 要浏览图片的总个数 +// */ +//- (void)showWithImageIndex:(NSInteger)index imageCount:(NSInteger)imageCount datasource:(id)datasource +//{ +// self.currentImageIndex = index; +// self.imageCount = imageCount; +// self.datasource = datasource; +// [self show]; +//} + +- (void)show +{ + if (self.imageCount <= 0) { + return; + } + if (self.currentImageIndex >= self.imageCount) { + self.currentImageIndex = self.imageCount - 1; + } + if (self.currentImageIndex < 0) { + self.currentImageIndex = 0; + } + + self.frame = self.photoBrowserWindow.bounds; + self.alpha = 0.0; + [self.photoBrowserWindow.rootViewController.view addSubview:self]; + [self.photoBrowserWindow makeKeyAndVisible]; + [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; + [self iniaialUI]; +} + +/** + * 退出 + */ +- (void)dismiss +{ + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; + [UIView animateWithDuration:XLPhotoBrowserHideImageAnimationDuration animations:^{ + self.alpha = 0.0; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + self.photoBrowserWindow = nil; + }]; +} + +/** + * 初始化底部ActionSheet弹框数据 + * + * @param title ActionSheet的title + * @param delegate XLPhotoBrowserDelegate + * @param cancelButtonTitle 取消按钮文字 + * @param deleteButtonTitle 删除按钮文字 + * @param otherButtonTitles 其他按钮数组 + */ +- (void)setActionSheetWithTitle:(nullable NSString *)title delegate:(nullable id)delegate cancelButtonTitle:(nullable NSString *)cancelButtonTitle deleteButtonTitle:(nullable NSString *)deleteButtonTitle otherButtonTitles:(nullable NSString *)otherButtonTitle, ... +{ + NSMutableArray *otherButtonTitlesArray = [NSMutableArray array]; + NSString *buttonTitle; + va_list argumentList; + if (otherButtonTitle) { + [otherButtonTitlesArray addObject:otherButtonTitle]; + va_start(argumentList, otherButtonTitle); + while ((buttonTitle = va_arg(argumentList, id))) { + [otherButtonTitlesArray addObject:buttonTitle]; + } + va_end(argumentList); + } + self.actionOtherButtonTitles = otherButtonTitlesArray; + self.actionSheetTitle = title; + self.actionSheetCancelTitle = cancelButtonTitle; + self.actionSheetDeleteButtonTitle = deleteButtonTitle; + if (delegate) { + self.delegate = delegate; + } +} + +/** + * 保存当前展示的图片 + */ +- (void)saveCurrentShowImage +{ + [self saveImage]; +} + +#pragma mark - public method --> XLPhotoBrowser简易使用方式:一行代码展示 + +/** + 一行代码展示(在某些使用场景,不需要做很复杂的操作,例如不需要长按弹出actionSheet,从而不需要实现数据源方法和代理方法,那么可以选择这个方法,直接传数据源数组进来,框架内部做处理) + + @param images 图片数据源数组(,内部可以是UIImage/NSURL网络图片地址/ALAsset) + @param currentImageIndex 展示第几张 + + @return XLPhotoBrowser实例对象 + */ ++ (instancetype)showPhotoBrowserWithImages:(NSArray *)images currentImageIndex:(NSInteger)currentImageIndex +{ + if (images.count <=0 || images ==nil) { + XLPBLog(@"一行代码展示图片浏览的方法,传入的数据源为空,请检查传入数据源"); + return nil; + } + + //检查数据源对象是否非法 + for (id image in images) { + if (![image isKindOfClass:[UIImage class]] && ![image isKindOfClass:[NSString class]] && ![image isKindOfClass:[NSURL class]] && ![image isKindOfClass:[ALAsset class]]) { + XLPBLog(@"识别到非法数据格式,请检查传入数据是否为 NSString/NSURL/ALAsset 中一种"); + return nil; + } + } + + XLPhotoBrowser *browser = [[XLPhotoBrowser alloc] init]; + browser.imageCount = images.count; + browser.currentImageIndex = currentImageIndex; + browser.images = images; + [browser show]; + return browser; +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserConfig.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserConfig.h new file mode 100644 index 0000000..26b51f1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserConfig.h @@ -0,0 +1,79 @@ +// +// XLPhotoBrowserConfig.h +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/16. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import "UIView+XLExtension.h" +#import "UIImage+XLExtension.h" +#import "XLPhotoBrowserTypeDefine.h" + +#import + +#define XLPhotoBrowserDebug 1 +//是否开启断言调试模式 +#define IsOpenAssertDebug 1 +#define XLPhotoBrowserVersion @"1.2.0" + +/** + * 进度视图类型类型 + */ +typedef NS_ENUM(NSUInteger, XLProgressViewMode){ + /** + * 圆环形 + */ + XLProgressViewModeLoopDiagram = 1, + /** + * 圆饼型 + */ + XLProgressViewModePieDiagram = 2 +}; + +// 图片保存成功提示文字 +#define XLPhotoBrowserSaveImageSuccessText @" ^_^ 保存成功 "; +// 图片保存失败提示文字 +#define XLPhotoBrowserSaveImageFailText @" >_< 保存失败 "; +// 网络图片加载失败的提示文字 +#define XLPhotoBrowserLoadNetworkImageFail @">_< 图片加载失败" +#define XLPhotoBrowserLoadingImageText @" >_< 图片加载中,请稍后 "; + +// browser背景颜色 +#define XLPhotoBrowserBackgrounColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.95] +// browser 图片间的margin +#define XLPhotoBrowserImageViewMargin 10 +// browser中显示图片动画时长 +#define XLPhotoBrowserShowImageAnimationDuration 0.4f +// browser中显示图片动画时长 +#define XLPhotoBrowserHideImageAnimationDuration 0.4f + +// 图片下载进度指示进度显示样式(XLProgressViewModeLoopDiagram 环形,XLProgressViewModePieDiagram 饼型) +#define XLProgressViewProgressMode XLProgressViewModeLoopDiagram +// 图片下载进度指示器背景色 +#define XLProgressViewBackgroundColor [UIColor clearColor] +// 图片下载进度指示器圆环/圆饼颜色 +#define XLProgressViewStrokeColor [UIColor whiteColor] +// 图片下载进度指示器内部控件间的间距 +#define XLProgressViewItemMargin 10 +// 圆环形图片下载进度指示器 环线宽度 +#define XLProgressViewLoopDiagramLineWidth 8 + +#define XLPBLog(...) XLFormatLog(__VA_ARGS__) + +#if XLPhotoBrowserDebug +#define XLFormatLog(...)\ +{\ +NSString *string = [NSString stringWithFormat:__VA_ARGS__];\ +NSLog(@"\n===========================\n===========================\n=== XLPhotoBrowser' Log ===\n提示信息:%@\n所在方法:%s\n所在行数:%d\n===========================\n===========================",string,__func__,__LINE__);\ +} + +#define XLLogFunc NSLog(@"%s",__func__) + +#else +#define XLFormatLog(...) +#define XLLogFunc +#endif + + + diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserTypeDefine.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserTypeDefine.h new file mode 100644 index 0000000..b7ded20 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserTypeDefine.h @@ -0,0 +1,59 @@ +// +// XLPhotoBrowserTypeDefine.h +// XLPhotoBrowserDemo +// +// Created by XL on 2017/5/22. +// Copyright © 2017年 LiuShannoon. All rights reserved. +// + +/** + * 图片浏览器的样式 + */ +typedef NS_ENUM(NSUInteger, XLPhotoBrowserStyle){ + /** + * 长按图片弹出功能组件,底部一个PageControl + */ + XLPhotoBrowserStylePageControl = 1, + /** + * 长按图片弹出功能组件,顶部一个索引UILabel + */ + XLPhotoBrowserStyleIndexLabel = 2, + /** + * 没有长按图片弹出的功能组件,顶部一个索引UILabel,底部一个保存图片按钮 + */ + XLPhotoBrowserStyleSimple = 3 +}; + +/** + * pageControl的位置 + */ +typedef NS_ENUM(NSUInteger, XLPhotoBrowserPageControlAliment){ + /** + * pageControl在右边 + */ + XLPhotoBrowserPageControlAlimentRight = 1, + /** + * pageControl 中间 + */ + XLPhotoBrowserPageControlAlimentCenter = 2, + XLPhotoBrowserPageControlAlimentLeft = 3 +}; + +/** + * pageControl的样式 + */ +typedef NS_ENUM(NSUInteger, XLPhotoBrowserPageControlStyle){ + /** + * 系统自带经典样式 + */ + XLPhotoBrowserPageControlStyleClassic = 1, + /** + * 动画效果pagecontrol + */ + XLPhotoBrowserPageControlStyleAnimated = 2, + /** + * 不显示pagecontrol + */ + XLPhotoBrowserPageControlStyleNone = 3 + +}; diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.h new file mode 100644 index 0000000..c5a247f --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.h @@ -0,0 +1,17 @@ +// +// XLProgressView.h +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/17. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import +#import "XLPhotoBrowserConfig.h" + +@interface XLProgressView : UIView + +@property (nonatomic, assign) CGFloat progress; +@property (nonatomic, assign) XLProgressViewMode mode; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.m new file mode 100644 index 0000000..7d132bb --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.m @@ -0,0 +1,80 @@ +// +// XLProgressView.m +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/17. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import "XLProgressView.h" + +@implementation XLProgressView + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = XLProgressViewBackgroundColor; + self.layer.cornerRadius = 5; + self.clipsToBounds = YES; + self.mode = XLProgressViewProgressMode; + } + return self; +} + +- (void)setProgress:(CGFloat)progress +{ + _progress = progress; + [self setNeedsDisplay]; + if (progress >= 1) { + [self removeFromSuperview]; + } +} + +- (void)drawRect:(CGRect)rect +{ + CGContextRef ctx = UIGraphicsGetCurrentContext(); + + CGFloat xCenter = rect.size.width * 0.5; + CGFloat yCenter = rect.size.height * 0.5; + [self.backgroundColor setFill]; + [XLProgressViewStrokeColor setStroke]; + + switch (self.mode) { + case XLProgressViewModePieDiagram: + { + CGFloat radius = MIN(rect.size.width * 0.5, rect.size.height * 0.5) - XLProgressViewItemMargin; + + CGFloat w = radius * 2 + XLProgressViewItemMargin; + CGFloat h = w; + CGFloat x = (rect.size.width - w) * 0.5; + CGFloat y = (rect.size.height - h) * 0.5; + CGContextAddEllipseInRect(ctx, CGRectMake(x, y, w, h)); + CGContextSetLineWidth(ctx, XLProgressViewLoopDiagramLineWidth * 0.5); + CGContextStrokePath(ctx); + + [XLProgressViewStrokeColor setFill]; + CGContextMoveToPoint(ctx, xCenter, yCenter); + CGContextAddLineToPoint(ctx, xCenter, 0); + CGFloat to = - M_PI * 0.5 + self.progress * M_PI * 2 + 0.001; // 初始值 + CGContextAddArc(ctx, xCenter, yCenter, radius, - M_PI * 0.5, to, 0); + CGContextClosePath(ctx); + CGContextFillPath(ctx); + } + break; + + default: + { + CGContextSetLineWidth(ctx, XLProgressViewLoopDiagramLineWidth); + CGContextSetLineCap(ctx, kCGLineCapRound); + [XLProgressViewStrokeColor setStroke]; + CGFloat to = - M_PI * 0.5 + self.progress * M_PI * 2 + 0.05; // 初始值0.05 + CGFloat radius = MIN(rect.size.width, rect.size.height) * 0.5 - XLProgressViewItemMargin; + CGContextAddArc(ctx, xCenter, yCenter, radius, - M_PI * 0.5, to, 0); + CGContextStrokePath(ctx); + } + break; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.h b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.h new file mode 100644 index 0000000..5c47276 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.h @@ -0,0 +1,78 @@ +// +// XLZoomingScrollView.h +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/15. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import +#import "UIView+XLExtension.h" + +@class XLZoomingScrollView; + +@protocol XLZoomingScrollViewDelegate + +/** + * 单击图像时调用 + * + * @param zoomingScrollView 图片缩放视图 + * @param singleTap 用户单击手势 + */ +- (void)zoomingScrollView:(XLZoomingScrollView *)zoomingScrollView singleTapDetected:(UITapGestureRecognizer *)singleTap; + +@optional +/** + * 图片加载进度 + * + * @param zoomingScrollView 图片缩放视图 + * @param progress 加载进度 , 0 - 1.0 + */ +- (void)zoomingScrollView:(XLZoomingScrollView *)zoomingScrollView imageLoadProgress:(CGFloat)progress; + +@end + + +@interface XLZoomingScrollView : UIView + +/** + * zoomingScrollViewdelegate + */ +@property (nonatomic , weak) id zoomingScrollViewdelegate; +/** + * 图片加载进度 + */ +@property (nonatomic, assign) CGFloat progress; +/** + * 展示的图片 + */ +@property (nonatomic , strong , readonly) UIImage *currentImage; +/** + * 展示图片的UIImageView视图 , 回缩的动画用 + */ +@property (nonatomic , weak , readonly) UIImageView *imageView; +@property (nonatomic , strong , readonly) UIScrollView *scrollview; + +/** + * 显示图片 + * + * @param url 图片的高清大图链接 + * @param placeholder 占位的缩略图 / 或者是高清大图都可以 + */ +- (void)setShowHighQualityImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder; +/** + * 显示图片 + * + * @param image 图片 + */ +- (void)setShowImage:(UIImage *)image; +/** + * 调整尺寸 + */ +- (void)setMaxAndMinZoomScales; +/** + * 重用,清理资源 + */ +- (void)prepareForReuse; + +@end diff --git a/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.m b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.m new file mode 100644 index 0000000..559c882 --- /dev/null +++ b/XinjiangProject/XinjiangProject/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.m @@ -0,0 +1,331 @@ +// +// XLZoomingScrollView.m +// XLPhotoBrowserDemo +// +// Created by Liushannoon on 16/7/15. +// Copyright © 2016年 LiuShannoon. All rights reserved. +// + +#import "XLZoomingScrollView.h" +#import "XLProgressView.h" +#import "SDImageCache.h" + +@interface XLZoomingScrollView () +{ + UIScrollView *_scrollview; +} + +@property (nonatomic , strong) UIImageView *photoImageView; +@property (nonatomic , strong) XLProgressView *progressView; +@property (nonatomic , strong) UILabel *stateLabel; +@property (nonatomic, assign) BOOL hasLoadedImage; +@property (nonatomic , strong) NSURL *imageURL; + +@end + +@implementation XLZoomingScrollView + +#pragma mark - set / get + +- (void)setProgress:(CGFloat)progress +{ + _progress = progress; + self.progressView.progress = progress; + if ([self.zoomingScrollViewdelegate respondsToSelector:@selector(zoomingScrollView:imageLoadProgress:)]) { + [self.zoomingScrollViewdelegate zoomingScrollView:self imageLoadProgress:progress]; + } +} + +- (UIImageView *)imageView +{ + return self.photoImageView; +} + +- (UIImage *)currentImage +{ + return self.photoImageView.image; +} + +- (UIImageView *)photoImageView +{ + if (_photoImageView == nil) { + _photoImageView = [[UIImageView alloc] init]; + _photoImageView.backgroundColor = [UIColor clearColor]; + } + + return _photoImageView; +} + +- (UIScrollView *)scrollview +{ + if (!_scrollview) { + _scrollview = [[UIScrollView alloc] init]; + [_scrollview addSubview:self.photoImageView]; + _scrollview.delegate = self; + _scrollview.clipsToBounds = YES; + _scrollview.showsVerticalScrollIndicator = NO; + _scrollview.showsHorizontalScrollIndicator = NO; + } + return _scrollview; +} + +- (UILabel *)stateLabel +{ + if (_stateLabel == nil) { + _stateLabel = [[UILabel alloc] init]; + _stateLabel.text = XLPhotoBrowserLoadNetworkImageFail; + _stateLabel.font = [UIFont systemFontOfSize:16]; + _stateLabel.textColor = [UIColor whiteColor]; + _stateLabel.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8]; + _stateLabel.layer.cornerRadius = 5; + _stateLabel.clipsToBounds = YES; + _stateLabel.textAlignment = NSTextAlignmentCenter; + } + return _stateLabel; +} + +- (XLProgressView *)progressView +{ + if (_progressView == nil) { + _progressView = [[XLProgressView alloc] init]; + } + return _progressView; +} + +#pragma mark - initial UI + +- (void)awakeFromNib +{ + [super awakeFromNib]; + [self initial]; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + [self initial]; + } + return self; +} + +/** + * 初始化 + */ +- (void)initial +{ + [self addSubview:self.scrollview]; + + UITapGestureRecognizer *singleTapBackgroundView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapBackgroundView:)]; + UITapGestureRecognizer *doubleTapBackgroundView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTapBackgroundView:)]; + doubleTapBackgroundView.numberOfTapsRequired = 2; + [singleTapBackgroundView requireGestureRecognizerToFail:doubleTapBackgroundView]; + [self addGestureRecognizer:singleTapBackgroundView]; + [self addGestureRecognizer:doubleTapBackgroundView]; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + + self.stateLabel.bounds = CGRectMake(0, 0, 160, 30); + self.stateLabel.center = CGPointMake(self.bounds.size.width * 0.5, self.bounds.size.height * 0.5); + self.progressView.bounds = CGRectMake(0, 0, 100, 100); + self.progressView.xl_centerX = self.xl_width * 0.5; + self.progressView.xl_centerY = self.xl_height * 0.5; + self.scrollview.frame = self.bounds; + + [self setMaxAndMinZoomScales]; +} + +#pragma mark - UIScrollViewDelegate + +- (void)scrollViewDidZoom:(UIScrollView *)scrollView +{ + self.photoImageView.center = [self centerOfScrollViewContent:scrollView]; +} + +- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView +{ + return self.photoImageView; +} + +- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view +{ + self.scrollview.scrollEnabled = YES; +} + +- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale +{ + self.scrollview.userInteractionEnabled = YES; +} + +#pragma mark - private method - 手势处理,缩放图片 + +- (CGPoint)centerOfScrollViewContent:(UIScrollView *)scrollView +{ + CGFloat offsetX = (scrollView.bounds.size.width > scrollView.contentSize.width)? + (scrollView.bounds.size.width - scrollView.contentSize.width) * 0.5 : 0.0; + CGFloat offsetY = (scrollView.bounds.size.height > scrollView.contentSize.height)? + (scrollView.bounds.size.height - scrollView.contentSize.height) * 0.5 : 0.0; + CGPoint actualCenter = CGPointMake(scrollView.contentSize.width * 0.5 + offsetX, + scrollView.contentSize.height * 0.5 + offsetY); + return actualCenter; +} + +- (CGRect)zoomRectForScale:(CGFloat)scale withCenter:(CGPoint)center +{ + CGFloat height = self.frame.size.height / scale; + CGFloat width = self.frame.size.width / scale; + CGFloat x = center.x - width * 0.5; + CGFloat y = center.y - height * 0.5; + return CGRectMake(x, y, width, height); +} + +- (void)singleTapBackgroundView:(UITapGestureRecognizer *)singleTap +{ + if (self.zoomingScrollViewdelegate && [self.zoomingScrollViewdelegate respondsToSelector:@selector(zoomingScrollView:singleTapDetected:)]) { + [self.zoomingScrollViewdelegate zoomingScrollView:self singleTapDetected:singleTap]; + } +} + +- (void)doubleTapBackgroundView:(UITapGestureRecognizer *)doubleTap +{ + if (!self.hasLoadedImage) { + return; + } + self.scrollview.userInteractionEnabled = NO; + + + if (self.scrollview.zoomScale > self.scrollview.minimumZoomScale) { + [self.scrollview setZoomScale:self.scrollview.minimumZoomScale animated:YES]; + } else { + CGPoint point = [doubleTap locationInView:doubleTap.view]; + CGFloat touchX = point.x; + CGFloat touchY = point.y; + touchX *= 1/self.scrollview.zoomScale; + touchY *= 1/self.scrollview.zoomScale; + touchX += self.scrollview.contentOffset.x; + touchY += self.scrollview.contentOffset.y; + CGRect zoomRect = [self zoomRectForScale:self.scrollview.maximumZoomScale withCenter:CGPointMake(touchX, touchY)]; + [self.scrollview zoomToRect:zoomRect animated:YES]; + } +} + +- (void)resetZoomScale +{ + self.scrollview.maximumZoomScale = 1.0; + self.scrollview.minimumZoomScale = 1.0; +} + +#pragma mark - public method + +/** + * 显示图片 + * + * @param image 图片 + */ +- (void)setShowImage:(UIImage *)image +{ + self.photoImageView.image = image; + [self setMaxAndMinZoomScales]; + [self setNeedsLayout]; + self.progress = 1.0; + self.hasLoadedImage = YES; +} + +/** + * 显示图片 + * + * @param url 图片的高清大图链接 + * @param placeholder 占位的缩略图 / 或者是高清大图都可以 + */ +- (void)setShowHighQualityImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder +{ + if (!url) { + [self setShowImage:placeholder]; + return; + } + + UIImage *cacheImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:[url absoluteString]]; + if (cacheImage) { + [self setShowImage:cacheImage]; + return; + } + + self.photoImageView.image = placeholder; + [self setMaxAndMinZoomScales]; + + __weak typeof(self) weakSelf = self; + + [self addSubview:self.progressView];; + self.progressView.mode = XLProgressViewProgressMode; + self.imageURL = url; + + // TODO 失败点击重新下载功能 + [weakSelf.photoImageView sd_setImageWithURL:url placeholderImage:placeholder options:SDWebImageRetryFailed| SDWebImageLowPriority| SDWebImageHandleCookies progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { + dispatch_async(dispatch_get_main_queue(), ^{ + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([strongSelf.imageURL isEqual:targetURL] && expectedSize > 0) { + strongSelf.progress = (CGFloat)receivedSize / expectedSize ; + } + }); + } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf.progressView removeFromSuperview]; + if (error) { + [strongSelf setMaxAndMinZoomScales]; + [strongSelf addSubview:strongSelf.stateLabel]; + XLPBLog(@"加载图片失败 , 图片链接imageURL = %@ , 错误信息: %@ ,检查是否开启允许HTTP请求",imageURL,error); + } else { + [strongSelf.stateLabel removeFromSuperview]; + [UIView animateWithDuration:0.25 animations:^{ + [strongSelf setShowImage:image]; + [strongSelf.photoImageView setNeedsDisplay]; + [strongSelf setMaxAndMinZoomScales]; + }]; + } + }]; +} + +/** + * 根据图片和屏幕比例关系,调整最大和最小伸缩比例 + */ +- (void)setMaxAndMinZoomScales +{ + // self.photoImageView的初始位置 + UIImage *image = self.photoImageView.image; + if (image == nil || image.size.height==0) { + return; + } + CGFloat imageWidthHeightRatio = image.size.width / image.size.height; + self.photoImageView.xl_width = self.xl_width; + self.photoImageView.xl_height = self.xl_width / imageWidthHeightRatio; + self.photoImageView.xl_x = 0; + if (self.photoImageView.xl_height > XLScreenH) { + self.photoImageView.xl_y = 0; + self.scrollview.scrollEnabled = YES; + } else { + self.photoImageView.xl_y = (XLScreenH - self.photoImageView.xl_height ) * 0.5; + self.scrollview.scrollEnabled = NO; + } + self.scrollview.maximumZoomScale = MAX(XLScreenH / self.photoImageView.xl_height, 3.0); + self.scrollview.minimumZoomScale = 1.0; + self.scrollview.zoomScale = 1.0; + self.scrollview.contentSize = CGSizeMake(self.photoImageView.xl_width, MAX(self.photoImageView.xl_height, XLScreenH)); +} + +/** + * 重用,清理资源 + */ +- (void)prepareForReuse +{ +// NSLog(@"prepareForReuse: strongSelf %@ , strongSelf.imageURL = %@ , progress = %f" , self , self.imageURL,self.progress); + [self setMaxAndMinZoomScales]; + self.progress = 0; + self.photoImageView.image = nil; + self.hasLoadedImage = NO; + [self.stateLabel removeFromSuperview]; + [self.progressView removeFromSuperview]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/CommonUtility.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/CommonUtility.h new file mode 100755 index 0000000..1ae0638 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/CommonUtility.h @@ -0,0 +1,46 @@ +// +// CommonUtility.h +// SearchV3Demo +// +// Created by songjian on 13-8-22. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +@import Foundation; + + +@interface CommonUtility : NSObject + ++ (CLLocationCoordinate2D *)coordinatesForString:(NSString *)string + coordinateCount:(NSUInteger *)coordinateCount + parseToken:(NSString *)token; + ++ (MAPolyline *)polylineForCoordinateString:(NSString *)coordinateString; ++ (MAPolyline *)polylineForBusLine:(AMapBusLine *)busLine; + ++ (MAMapRect)unionMapRect1:(MAMapRect)mapRect1 mapRect2:(MAMapRect)mapRect2; + ++ (MAMapRect)mapRectUnion:(MAMapRect *)mapRects count:(NSUInteger)count; + ++ (MAMapRect)mapRectForOverlays:(NSArray *)overlays; + + ++ (MAMapRect)minMapRectForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count; + ++ (MAMapRect)minMapRectForAnnotations:(NSArray *)annotations; + ++ (NSString *)getApplicationScheme; ++ (NSString *)getApplicationName; + ++ (double)distanceToPoint:(MAMapPoint)p fromLineSegmentBetween:(MAMapPoint)l1 and:(MAMapPoint)l2; + ++ (BOOL)polylineHitTestWithCoordinate:(CLLocationCoordinate2D)coordinate + mapView:(MAMapView*)mapView + polylinePoints:(MAMapPoint*)polylinePoints + pointCount:(NSInteger)pointCount + lineWidth:(CGFloat)lineWidth; ++ (CLLocationCoordinate2D)fetchPointPolylinePoints:(NSArray *)polys mapView:(MAMapView*)mapView index:(NSInteger)index selected:(NSInteger)slect; + ++ (long )getNowTimeTimestamp; ++ (NSString *)getForeverTime:(long)timeInter; +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/CommonUtility.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/CommonUtility.m new file mode 100755 index 0000000..d0ecd78 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/CommonUtility.m @@ -0,0 +1,367 @@ +// +// CommonUtility.m +// SearchV3Demo +// +// Created by songjian on 13-8-22. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "CommonUtility.h" +//#import "LineDashPolyline.h" + +@implementation CommonUtility + ++ (CLLocationCoordinate2D *)coordinatesForString:(NSString *)string + coordinateCount:(NSUInteger *)coordinateCount + parseToken:(NSString *)token +{ + if (string == nil) { + return NULL; + } + if (token == nil) { + token = @","; + } + NSString *str = @""; + if (![token isEqualToString:@","]) { + str = [string stringByReplacingOccurrencesOfString:token withString:@","]; + } + else { + str = [NSString stringWithString:string]; + } + NSArray *components = [str componentsSeparatedByString:@","]; + NSUInteger count = [components count] / 2; + if (coordinateCount != NULL) { + *coordinateCount = count; + } + CLLocationCoordinate2D *coordinates = (CLLocationCoordinate2D*)malloc(count * sizeof(CLLocationCoordinate2D)); + + for (int i = 0; i < count; i++) { + coordinates[i].longitude = [[components objectAtIndex:2 * i] doubleValue]; + coordinates[i].latitude = [[components objectAtIndex:2 * i + 1] doubleValue]; + } + + return coordinates; +} + ++ (MAPolyline *)polylineForCoordinateString:(NSString *)coordinateString +{ + if (coordinateString.length == 0) + { + return nil; + } + + NSUInteger count = 0; + + CLLocationCoordinate2D *coordinates = [self coordinatesForString:coordinateString + coordinateCount:&count + parseToken:@";"]; + + MAPolyline *polyline = [MAPolyline polylineWithCoordinates:coordinates count:count]; + + free(coordinates), coordinates = NULL; + + return polyline; +} + ++ (MAPolyline *)polylineForBusLine:(AMapBusLine *)busLine +{ + if (busLine == nil) + { + return nil; + } + + return [self polylineForCoordinateString:busLine.polyline]; +} + ++ (MAMapRect)unionMapRect1:(MAMapRect)mapRect1 mapRect2:(MAMapRect)mapRect2 +{ + CGRect rect1 = CGRectMake(mapRect1.origin.x, mapRect1.origin.y, mapRect1.size.width, mapRect1.size.height); + CGRect rect2 = CGRectMake(mapRect2.origin.x, mapRect2.origin.y, mapRect2.size.width, mapRect2.size.height); + + CGRect unionRect = CGRectUnion(rect1, rect2); + + return MAMapRectMake(unionRect.origin.x, unionRect.origin.y, unionRect.size.width, unionRect.size.height); +} + ++ (MAMapRect)mapRectUnion:(MAMapRect *)mapRects count:(NSUInteger)count +{ + if (mapRects == NULL || count == 0) + { + NSLog(@"%s: 无效的参数.", __func__); + return MAMapRectZero; + } + + MAMapRect unionMapRect = mapRects[0]; + + for (int i = 1; i < count; i++) + { + unionMapRect = [self unionMapRect1:unionMapRect mapRect2:mapRects[i]]; + } + + return unionMapRect; +} + ++ (MAMapRect)mapRectForOverlays:(NSArray *)overlays +{ + if (overlays.count == 0) + { + NSLog(@"%s: 无效的参数.", __func__); + return MAMapRectZero; + } + + MAMapRect mapRect; + + MAMapRect *buffer = (MAMapRect*)malloc(overlays.count * sizeof(MAMapRect)); + + [overlays enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + buffer[idx] = [obj boundingMapRect]; + }]; + + mapRect = [self mapRectUnion:buffer count:overlays.count]; + + free(buffer), buffer = NULL; + + return mapRect; +} + ++ (MAMapRect)minMapRectForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count +{ + if (mapPoints == NULL || count <= 1) + { + NSLog(@"%s: 无效的参数.", __func__); + return MAMapRectZero; + } + + CGFloat minX = mapPoints[0].x, minY = mapPoints[0].y; + CGFloat maxX = minX, maxY = minY; + + /* Traverse and find the min, max. */ + for (int i = 1; i < count; i++) + { + MAMapPoint point = mapPoints[i]; + + if (point.x < minX) + { + minX = point.x; + } + + if (point.x > maxX) + { + maxX = point.x; + } + + if (point.y < minY) + { + minY = point.y; + } + + if (point.y > maxY) + { + maxY = point.y; + } + } + + /* Construct outside min rectangle. */ + return MAMapRectMake(minX, minY, fabs(maxX - minX), fabs(maxY - minY)); +} + ++ (MAMapRect)minMapRectForAnnotations:(NSArray *)annotations +{ + if (annotations.count <= 1) + { + NSLog(@"%s: 无效的参数.", __func__); + return MAMapRectZero; + } + + MAMapPoint *mapPoints = (MAMapPoint*)malloc(annotations.count * sizeof(MAMapPoint)); + + [annotations enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + mapPoints[idx] = MAMapPointForCoordinate([obj coordinate]); + }]; + + MAMapRect minMapRect = [self minMapRectForMapPoints:mapPoints count:annotations.count]; + + free(mapPoints), mapPoints = NULL; + + return minMapRect; +} + ++ (NSString *)getApplicationName +{ + NSDictionary *bundleInfo = [[NSBundle mainBundle] infoDictionary]; + return [bundleInfo valueForKey:@"CFBundleDisplayName"] ?: [bundleInfo valueForKey:@"CFBundleName"]; +} + ++ (NSString *)getApplicationScheme +{ + NSDictionary *bundleInfo = [[NSBundle mainBundle] infoDictionary]; + NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; + NSArray *URLTypes = [bundleInfo valueForKey:@"CFBundleURLTypes"]; + + NSString *scheme; + for (NSDictionary *dic in URLTypes) + { + NSString *URLName = [dic valueForKey:@"CFBundleURLName"]; + if ([URLName isEqualToString:bundleIdentifier]) + { + scheme = [[dic valueForKey:@"CFBundleURLSchemes"] objectAtIndex:0]; + break; + } + } + + return scheme; +} + ++ (double)distanceToPoint:(MAMapPoint)p fromLineSegmentBetween:(MAMapPoint)l1 and:(MAMapPoint)l2 +{ + double A = p.x - l1.x; + double B = p.y - l1.y; + double C = l2.x - l1.x; + double D = l2.y - l1.y; + + double dot = A * C + B * D; + double len_sq = C * C + D * D; + double param = dot / len_sq; + + double xx, yy; + + if (param < 0 || (l1.x == l2.x && l1.y == l2.y)) { + xx = l1.x; + yy = l1.y; + } + else if (param > 1) { + xx = l2.x; + yy = l2.y; + } + else { + xx = l1.x + param * C; + yy = l1.y + param * D; + } + + return MAMetersBetweenMapPoints(p, MAMapPointMake(xx, yy)); +} + ++ (CLLocationCoordinate2D)fetchPointPolylinePoints:(NSArray *)polys mapView:(MAMapView*)mapView index:(NSInteger)index selected:(NSInteger)slect +{ + MAPolyline *poly = [polys objectAtIndex:index]; + MAMapPoint *polylinePoints = poly.points; + NSInteger currentcount = poly.pointCount; + NSInteger kCount = 0; + static NSInteger totalColt = 4; + CLLocationCoordinate2D kcoord = kCLLocationCoordinate2DInvalid; + for (NSInteger i = currentcount-1; i >= 0; i -=5) { + MAMapPoint point = polylinePoints[i]; + CLLocationCoordinate2D coord = MACoordinateForMapPoint(point); + BOOL isInside = YES; + + if (index == 0 ) { //这个地方有个逻辑是,点选poly时,有重复路线的polyline时,优先数组中排第0位的poly响应,所以这些重复点是可以返给0位的poly + MAPolyline *kpoly = [polys objectAtIndex:slect]; + MAMapPoint *kpolylinePts = kpoly.points; + NSInteger kcount = kpoly.pointCount; + isInside = [self polylineHitTestWithCoordinate:coord mapView:mapView polylinePoints:kpolylinePts pointCount:kcount lineWidth:60]; + }else{ + for (NSInteger j = 0; j < polys.count; j ++) { + if (j != index) { + MAPolyline *kpoly = [polys objectAtIndex:j]; + MAMapPoint *kpolylinePts = kpoly.points; + NSInteger kcount = kpoly.pointCount; + isInside = [self polylineHitTestWithCoordinate:coord mapView:mapView polylinePoints:kpolylinePts pointCount:kcount lineWidth:60]; + if (isInside) { + break; + } + } + } + } + + if (!isInside) { + kcoord = coord; + kCount ++; + if (kCount >= totalColt) { + break; + } + } + } + return kcoord; +} + +//点击地图时,判断是否点击在polyline线上 ++ (BOOL)polylineHitTestWithCoordinate:(CLLocationCoordinate2D)coordinate + mapView:(MAMapView*)mapView + polylinePoints:(MAMapPoint*)polylinePoints + pointCount:(NSInteger)pointCount + lineWidth:(CGFloat)lineWidth { + if(pointCount <= 1 || polylinePoints == NULL || !mapView) { + return NO; + } + + CGPoint cgp1 = [mapView convertCoordinate:coordinate toPointToView:mapView]; + CGPoint cgp2 = CGPointMake(cgp1.x + lineWidth * 0.5, cgp1.y); + MAMapPoint tappedMapPoint = MAMapPointForCoordinate(coordinate); + MAMapPoint mapPoint2 = MAMapPointForCoordinate([mapView convertPoint:cgp2 toCoordinateFromView:mapView]); + CGFloat lengthSq = (tappedMapPoint.x - mapPoint2.x)*(tappedMapPoint.x - mapPoint2.x) + (tappedMapPoint.y - mapPoint2.y)*(tappedMapPoint.y - mapPoint2.y); + + + BOOL hit = NO; + for(int i = 0; i < pointCount - 1; ++i) { + MAMapPoint begin = polylinePoints[i]; + MAMapPoint end = polylinePoints[i+1]; + + CGFloat length2BeginSq = (tappedMapPoint.x - begin.x)*(tappedMapPoint.x - begin.x) + (tappedMapPoint.y - begin.y)*(tappedMapPoint.y - begin.y); + if(length2BeginSq < lengthSq) { + hit = YES; + break; + } + + CGFloat length2EndSq = (tappedMapPoint.x - end.x)*(tappedMapPoint.x - end.x) + (tappedMapPoint.y - end.y)*(tappedMapPoint.y - end.y); + if(length2EndSq < lengthSq) { + hit = YES; + break; + } + + MAMapPoint mappedPoint = [self getVerticalMappedPointOfPoint:tappedMapPoint toLineWithBegin:begin andEnd:end]; + CGFloat length2MappedPointSq = (tappedMapPoint.x - mappedPoint.x)*(tappedMapPoint.x - mappedPoint.x) + (tappedMapPoint.y - mappedPoint.y)*(tappedMapPoint.y - mappedPoint.y); + if(length2MappedPointSq < lengthSq && + mappedPoint.y <= fmax(begin.y, end.y) && mappedPoint.y >= fmin(begin.y, end.y) && + mappedPoint.x <= fmax(begin.x, end.x) && mappedPoint.x >= fmin(begin.x, end.x)) { + hit = YES; + break; + } + } + + return hit; +} + ++ (MAMapPoint)getVerticalMappedPointOfPoint:(MAMapPoint)pt toLineWithBegin:(MAMapPoint)begin andEnd:(MAMapPoint)end { + MAMapPoint retVal; + + double dx = begin.x - end.x; + double dy = begin.y - end.y; + if(fabs(dx) < 0.00000001 && fabs(dy) < 0.00000001 ) { + retVal = begin; + return retVal; + } + + double u = (pt.x - begin.x)*(begin.x - end.x) + + (pt.y - begin.y)*(begin.y - end.y); + u = u/((dx*dx)+(dy*dy)); + + retVal.x = begin.x + u*dx; + retVal.y = begin.y + u*dy; + + return retVal; +} + ++ (long )getNowTimeTimestamp{ + NSDate *datenow = [NSDate date]; + return [datenow timeIntervalSince1970]; +} + ++ (NSString *)getForeverTime:(long)timeInter{ + NSDateFormatter *_dateFormatter = [[NSDateFormatter alloc] init]; + [_dateFormatter setDateFormat:@"hh:mm"]; + NSDate *stampDate = [NSDate dateWithTimeIntervalSince1970:timeInter]; + NSString* dateString = [_dateFormatter stringFromDate:stampDate]; + return dateString; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/ErrorInfoUtility.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/ErrorInfoUtility.h new file mode 100644 index 0000000..8816a55 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/ErrorInfoUtility.h @@ -0,0 +1,15 @@ +// +// ErrorInfoUtility.h +// MAMapKit_2D_Demo +// +// Created by hanxiaoming on 16/11/30. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import + +@interface ErrorInfoUtility : NSObject + ++ (NSString *)errorDescriptionWithCode:(NSInteger)errorCode; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/ErrorInfoUtility.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/ErrorInfoUtility.m new file mode 100644 index 0000000..9634986 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/ErrorInfoUtility.m @@ -0,0 +1,78 @@ +// +// ErrorInfoUtility.m +// MAMapKit_2D_Demo +// +// Created by hanxiaoming on 16/11/30. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import "ErrorInfoUtility.h" +#import + +#define kErrorInfoUrl @"http://lbs.amap.com/api/ios-sdk/guide/map-tool/errorcode/" + +@implementation ErrorInfoUtility + ++ (NSDictionary *)errorInfoMapping +{ + static NSDictionary *errorInfoMapping = nil; + if (errorInfoMapping == nil) + { + errorInfoMapping = @{@(AMapSearchErrorOK):@"没有错误", + @(AMapSearchErrorInvalidSignature):@"无效签名", + @(AMapSearchErrorInvalidUserKey):@"key非法或过期", + @(AMapSearchErrorServiceNotAvailable):@"没有权限使用相应的接口", + @(AMapSearchErrorDailyQueryOverLimit):@"访问已超出日访问量", + @(AMapSearchErrorTooFrequently):@"用户访问过于频繁", + @(AMapSearchErrorInvalidUserIP):@"用户IP无效", + @(AMapSearchErrorInvalidUserDomain):@"用户域名无效", + @(AMapSearchErrorInvalidUserSCode):@"安全码验证错误,bundleID与key不对应", + @(AMapSearchErrorUserKeyNotMatch):@"请求key与绑定平台不符", + @(AMapSearchErrorIPQueryOverLimit):@"IP请求超限", + @(AMapSearchErrorNotSupportHttps):@"不支持HTTPS请求", + @(AMapSearchErrorInsufficientPrivileges):@"权限不足,服务请求被拒绝", + @(AMapSearchErrorUserKeyRecycled):@"开发者key被删除,无法正常使用", + + @(AMapSearchErrorInvalidResponse):@"请求服务响应错误", + @(AMapSearchErrorInvalidEngineData):@"引擎返回数据异常", + @(AMapSearchErrorConnectTimeout):@"服务端请求链接超时", + @(AMapSearchErrorReturnTimeout):@"读取服务结果超时", + @(AMapSearchErrorInvalidParams):@"请求参数非法", + @(AMapSearchErrorMissingRequiredParams):@"缺少必填参数", + @(AMapSearchErrorIllegalRequest):@"请求协议非法", + @(AMapSearchErrorServiceUnknown):@"其他服务端未知错误", + + @(AMapSearchErrorClientUnknown):@"客户端未知错误,服务返回结果为空或其他错误", + @(AMapSearchErrorInvalidProtocol):@"协议解析错误,通常是返回结果无法解析", + @(AMapSearchErrorTimeOut):@"连接超时", + @(AMapSearchErrorBadURL):@"URL异常", + @(AMapSearchErrorCannotFindHost):@"找不到主机", + @(AMapSearchErrorCannotConnectToHost):@"服务器连接失败", + @(AMapSearchErrorNotConnectedToInternet):@"连接异常,通常为没有网络的情况", + @(AMapSearchErrorCancelled):@"连接取消", + + @(AMapSearchErrorTableIDNotExist):@"table id 格式不正确", + @(AMapSearchErrorIDNotExist):@"id 不存在", + @(AMapSearchErrorServiceMaintenance):@"服务器维护中", + @(AMapSearchErrorEngineTableIDNotExist):@"key对应的table id 不存在", + @(AMapSearchErrorInvalidNearbyUserID):@"找不到对应userID的信息", + @(AMapSearchErrorNearbyKeyNotBind):@"key未开通“附近”功能", + @(AMapSearchErrorOutOfService):@"规划点(包括起点、终点、途经点)不在中国范围内", + @(AMapSearchErrorNoRoadsNearby):@"规划点(包括起点、终点、途经点)附近搜不到道路", + @(AMapSearchErrorRouteFailed):@"路线计算失败,通常是由于道路连通关系导致", + @(AMapSearchErrorOverDirectionRange):@"起点终点距离过长", + @(AMapSearchErrorShareLicenseExpired):@"短串分享认证失败", + @(AMapSearchErrorShareFailed):@"短串请求失败",}; + } + + return errorInfoMapping; +} + ++ (NSString *)errorDescriptionWithCode:(NSInteger)errorCode +{ +// AMapSearchError.h + NSString *description = [NSString stringWithFormat:@"错误信息:%@。请在头文件中查看错误信息或者访问【%@】了解详细信息。", [[self errorInfoMapping] objectForKey:@(errorCode)], kErrorInfoUrl]; + return description; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchNearByController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchNearByController.h new file mode 100644 index 0000000..c0798e8 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchNearByController.h @@ -0,0 +1,13 @@ +// +// PoiSearchNearByController.h +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import + +@interface PoiSearchNearByController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchNearByController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchNearByController.m new file mode 100644 index 0000000..429c86a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchNearByController.m @@ -0,0 +1,141 @@ +// +// PoiSearchNearByController.m +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import "PoiSearchNearByController.h" +#import "POIAnnotation.h" +#import "CommonUtility.h" + +@interface PoiSearchNearByController () + +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, strong) MAMapView *mapView; + +@end + +@implementation PoiSearchNearByController +#pragma mark - Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + + [self.view addSubview:self.mapView]; + + self.search = [[AMapSearchAPI alloc] init]; + self.search.delegate = self; + + [self searchPoiByCenterCoordinate]; +} + +#pragma mark - MAMapViewDelegate + +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control +{ + id annotation = view.annotation; + + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + POIAnnotation *poiAnnotation = (POIAnnotation*)annotation; + +// PoiDetailViewController *detail = [[PoiDetailViewController alloc] init]; +// detail.poi = poiAnnotation.poi; +// +// /* 进入POI详情页面. */ +// [self.navigationController pushViewController:detail animated:YES]; + } +} + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + static NSString *poiIdentifier = @"poiIdentifier"; + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:poiIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:poiIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + + return nil; +} + +#pragma mark - AMapSearchDelegate +- (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error +{ +// NSLog(@"Error: %@ - %@", error, [ErrorInfoUtility errorDescriptionWithCode:error.code]); +} + +/* POI 搜索回调. */ +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response +{ + if (response.pois.count == 0) + { + return; + } + + NSMutableArray *poiAnnotations = [NSMutableArray arrayWithCapacity:response.pois.count]; + + [response.pois enumerateObjectsUsingBlock:^(AMapPOI *obj, NSUInteger idx, BOOL *stop) { + + [poiAnnotations addObject:[[POIAnnotation alloc] initWithPOI:obj]]; + + }]; + + /* 将结果以annotation的形式加载到地图上. */ + [self.mapView addAnnotations:poiAnnotations]; + + /* 如果只有一个结果,设置其为中心点. */ + if (poiAnnotations.count == 1) + { + [self.mapView setCenterCoordinate:[poiAnnotations[0] coordinate]]; + } + /* 如果有多个结果, 设置地图使所有的annotation都可见. */ + else + { + [self.mapView showAnnotations:poiAnnotations animated:NO]; + } +} + +#pragma mark - Utility + +/* 根据中心点坐标来搜周边的POI. */ +- (void)searchPoiByCenterCoordinate +{ + AMapPOIAroundSearchRequest *request = [[AMapPOIAroundSearchRequest alloc] init]; + + request.location = [AMapGeoPoint locationWithLatitude:39.990459 longitude:116.481476]; + request.keywords = @"电影院"; + /* 按照距离排序. */ + request.sortrule = 0; + request.showFieldsType = AMapPOISearchShowFieldsTypeAll; + [self.search AMapPOIAroundSearch:request]; +} + +#pragma mark - Handle Action + +- (void)returnAction +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerIdController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerIdController.h new file mode 100644 index 0000000..cab480d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerIdController.h @@ -0,0 +1,13 @@ +// +// PoiSearchPerIdController.h +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import + +@interface PoiSearchPerIdController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerIdController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerIdController.m new file mode 100644 index 0000000..783b29c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerIdController.m @@ -0,0 +1,141 @@ +// +// PoiSearchPerIdController.m +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import "PoiSearchPerIdController.h" +#import "POIAnnotation.h" +#import "CommonUtility.h" + +#define kPoiIdentifier @"B000A7ZQYC" + +@interface PoiSearchPerIdController () + +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, strong) MAMapView *mapView; + +@end + +@implementation PoiSearchPerIdController +#pragma mark - Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + + [self.view addSubview:self.mapView]; + + self.search = [[AMapSearchAPI alloc] init]; + self.search.delegate = self; + + [self searchPoiByID:kPoiIdentifier]; +} + +#pragma mark - MAMapViewDelegate + +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control +{ + id annotation = view.annotation; + + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + POIAnnotation *poiAnnotation = (POIAnnotation*)annotation; + +// PoiDetailViewController *detail = [[PoiDetailViewController alloc] init]; +// detail.poi = poiAnnotation.poi; +// +// /* 进入POI详情页面. */ +// [self.navigationController pushViewController:detail animated:YES]; + } +} + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + static NSString *poiIdentifier = @"poiIdentifier"; + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:poiIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:poiIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + + return nil; +} + +#pragma mark - AMapSearchDelegate +- (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error +{ +// NSLog(@"Error: %@ - %@", error, [ErrorInfoUtility errorDescriptionWithCode:error.code]); +} + +/* POI 搜索回调. */ +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response +{ + if (response.pois.count == 0) + { + return; + } + + NSMutableArray *poiAnnotations = [NSMutableArray arrayWithCapacity:response.pois.count]; + + [response.pois enumerateObjectsUsingBlock:^(AMapPOI *obj, NSUInteger idx, BOOL *stop) { + + [poiAnnotations addObject:[[POIAnnotation alloc] initWithPOI:obj]]; + + }]; + + /* 将结果以annotation的形式加载到地图上. */ + [self.mapView addAnnotations:poiAnnotations]; + + /* 如果只有一个结果,设置其为中心点. */ + if (poiAnnotations.count == 1) + { + [self.mapView setCenterCoordinate:[poiAnnotations[0] coordinate]]; + } + /* 如果有多个结果, 设置地图使所有的annotation都可见. */ + else + { + [self.mapView showAnnotations:poiAnnotations animated:NO]; + } +} + +#pragma mark - Utility + +/* 根据ID来搜索POI. */ +- (void)searchPoiByID:(NSString *)poiId +{ + AMapPOIIDSearchRequest *request = [[AMapPOIIDSearchRequest alloc] init]; + + request.uid = poiId; + request.showFieldsType = AMapPOISearchShowFieldsTypeAll; + [self.search AMapPOIIDSearch:request]; + +} + +#pragma mark - Handle Action + +- (void)returnAction +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerKeywordController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerKeywordController.h new file mode 100644 index 0000000..bb85143 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerKeywordController.h @@ -0,0 +1,41 @@ +// +// PoiSearchPerKeywordController.h +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import + + +@interface AMapPOISearchResponse_OnePage : NSObject + +@property (nonatomic, assign) NSInteger pageNum; +@property (nonatomic, assign) NSInteger offset; +@property (nonatomic, assign) NSInteger status; //-1:未开始 0:成功 1:失败 +@property (nonatomic, strong) NSArray *pois; + +@end + +@interface AMapPOISearchResponse_AllResults : NSObject + +@property (nonatomic, assign) NSInteger totalCount; +@property (nonatomic, assign) NSInteger offset; +@property (nonatomic, strong) NSMutableArray *allPages; + +@end + +typedef void(^MAKeyWordsPOISearchCallback)(AMapPOISearchResponse_AllResults* result); + +@interface MAAllResultsSearch : NSObject + +@property (nonatomic, strong) AMapSearchAPI *searchAPI; + +- (void)searchAllPOIsWith:(AMapPOIKeywordsSearchRequest *)req resultCallback:(MAKeyWordsPOISearchCallback)resultCallback; + +@end + +@interface PoiSearchPerKeywordController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerKeywordController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerKeywordController.m new file mode 100644 index 0000000..8a1df84 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchPerKeywordController.m @@ -0,0 +1,325 @@ +// +// PoiSearchPerKeywordController.m +// MAMapKit_2D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import "PoiSearchPerKeywordController.h" +#import "POIAnnotation.h" +//#import "PoiDetailViewController.h" +#import "CommonUtility.h" + + +@interface PoiSearchPerKeywordController () + +@property (nonatomic, strong) MAAllResultsSearch *search; +@property (nonatomic, strong) MAMapView *mapView; +@property (nonatomic, strong) UISearchBar *searchBar; + +@end + +@implementation PoiSearchPerKeywordController +#pragma mark - Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + [self.view addSubview:self.mapView]; + + self.search = [[MAAllResultsSearch alloc] init]; + + [self initSearchBar]; +} + +#pragma mark - +- (void)initSearchBar +{ + self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero]; + self.searchBar.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; + self.searchBar.barStyle = UIBarStyleBlack; + self.searchBar.delegate = self; + self.searchBar.placeholder = @"请输入关键字"; + self.searchBar.keyboardType = UIKeyboardTypeDefault; + + self.navigationItem.titleView = self.searchBar; + + [self.searchBar sizeToFit]; +} + +#pragma mark - UISearchBarDelegate +- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar +{ + [self.searchBar setShowsCancelButton:YES]; +} + +- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar +{ + [self.searchBar setShowsCancelButton:NO]; +} + +- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar +{ + [self.searchBar resignFirstResponder]; +} + +- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { + [self.searchBar resignFirstResponder]; + + if(self.searchBar.text.length == 0) { + return; + } + + [self searchPoiByKeyword:self.searchBar.text]; +} + +#pragma mark - MAMapViewDelegate + +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control +{ + id annotation = view.annotation; + + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + POIAnnotation *poiAnnotation = (POIAnnotation*)annotation; + +// PoiDetailViewController *detail = [[PoiDetailViewController alloc] init]; +// detail.poi = poiAnnotation.poi; +// +// /* 进入POI详情页面. */ +// [self.navigationController pushViewController:detail animated:YES]; + } +} + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + static NSString *poiIdentifier = @"poiIdentifier"; + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:poiIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:poiIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + + return nil; +} + +#pragma mark - AMapSearchDelegate +- (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error +{ + NSLog(@"Error: %@ - %@", error, [ErrorInfoUtility errorDescriptionWithCode:error.code]); +} + +/* POI 搜索回调. */ +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response +{ + [self.mapView removeAnnotations:self.mapView.annotations]; + + if (response.pois.count == 0) + { + return; + } + + NSMutableArray *poiAnnotations = [NSMutableArray arrayWithCapacity:response.pois.count]; + + [response.pois enumerateObjectsUsingBlock:^(AMapPOI *obj, NSUInteger idx, BOOL *stop) { + + [poiAnnotations addObject:[[POIAnnotation alloc] initWithPOI:obj]]; + + }]; + + /* 将结果以annotation的形式加载到地图上. */ + [self.mapView addAnnotations:poiAnnotations]; + + /* 如果只有一个结果,设置其为中心点. */ + if (poiAnnotations.count == 1) + { + [self.mapView setCenterCoordinate:[poiAnnotations[0] coordinate]]; + } + /* 如果有多个结果, 设置地图使所有的annotation都可见. */ + else + { + [self.mapView showAnnotations:poiAnnotations animated:NO]; + } +} + +- (void)onPoiSearchDone:(AMapPOISearchResponse_AllResults *)allResult { + [self.mapView removeAnnotations:self.mapView.annotations]; + + NSMutableArray *poiAnnotations = [NSMutableArray array]; + for(AMapPOISearchResponse_OnePage *page in allResult.allPages) { + [page.pois enumerateObjectsUsingBlock:^(AMapPOI *obj, NSUInteger idx, BOOL *stop) { + [poiAnnotations addObject:[[POIAnnotation alloc] initWithPOI:obj]]; + }]; + } + + /* 将结果以annotation的形式加载到地图上. */ + [self.mapView addAnnotations:poiAnnotations]; + + /* 如果只有一个结果,设置其为中心点. */ + if (poiAnnotations.count == 1) + { + [self.mapView setCenterCoordinate:[poiAnnotations[0] coordinate]]; + } + /* 如果有多个结果, 设置地图使所有的annotation都可见. */ + else + { + [self.mapView showAnnotations:poiAnnotations animated:NO]; + } +} + +#pragma mark - Utility +/* 根据关键字来搜索POI. */ +- (void)searchPoiByKeyword:(NSString *)keyword +{ + AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init]; + request.keywords = keyword; + request.city = @"北京"; + request.showFieldsType = AMapPOISearchShowFieldsTypeAll; + request.offset = 50; + + __weak typeof(self) weakSelf = self; + [self.search searchAllPOIsWith:request resultCallback:^(AMapPOISearchResponse_AllResults *result) { + [weakSelf onPoiSearchDone:result]; + }]; +} + +#pragma mark - Handle Action + +- (void)returnAction +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +@end + +@implementation AMapPOISearchResponse_OnePage +@end +@implementation AMapPOISearchResponse_AllResults +@end + +@interface MAAllResultsSearch () +@property (nonatomic, copy) MAKeyWordsPOISearchCallback resultCallback; +@property (nonatomic, strong) AMapPOIKeywordsSearchRequest *firstReq; +@property (nonatomic, strong) AMapPOISearchResponse_AllResults *allAroundPoiResults; + +@end + +@implementation MAAllResultsSearch + +- (id)init { + self = [super init]; + if(self) { + self.searchAPI = [[AMapSearchAPI alloc] init]; + self.searchAPI.delegate = self; + } + + return self; +} + +- (void)searchAllPOIsWith:(AMapPOIKeywordsSearchRequest *)req resultCallback:(MAKeyWordsPOISearchCallback)resultCallback { + self.firstReq = req; + self.resultCallback = resultCallback; + [self.searchAPI AMapPOIKeywordsSearch:req]; +} + +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response { + BOOL allFinished = YES; + + if(self.firstReq == request) { + self.allAroundPoiResults = [[AMapPOISearchResponse_AllResults alloc] init]; + self.allAroundPoiResults.offset = request.offset; + self.allAroundPoiResults.totalCount = response.count; + self.allAroundPoiResults.allPages = [NSMutableArray array]; + + AMapPOISearchResponse_OnePage *page = [[AMapPOISearchResponse_OnePage alloc] init]; + page.pageNum = 1; + page.pois = response.pois; + page.status = 0; + page.offset = request.offset; + [self.allAroundPoiResults.allPages addObject:page]; + + NSInteger pageCount = response.count / request.offset; + if(response.count % request.offset > 0) { + pageCount += 1; + } + + if(pageCount > 1) { + allFinished = NO; + } + + for(int i = 2; i <= pageCount; ++i) { + AMapPOISearchResponse_OnePage *page = [[AMapPOISearchResponse_OnePage alloc] init]; + page.pageNum = i; + page.status = -1; + page.offset = request.offset; + [self.allAroundPoiResults.allPages addObject:page]; + + AMapPOIKeywordsSearchRequest *remainReq = [[AMapPOIKeywordsSearchRequest alloc] init]; + remainReq.keywords = self.firstReq.keywords; + remainReq.location = self.firstReq.location; + remainReq.city = self.firstReq.city; + remainReq.cityLimit = self.firstReq.cityLimit; + + remainReq.types = self.firstReq.types; + remainReq.sortrule = self.firstReq.sortrule; + + remainReq.page = i; + remainReq.offset = self.firstReq.offset; + remainReq.showFieldsType = self.firstReq.showFieldsType; + + [self.searchAPI AMapPOIKeywordsSearch:remainReq]; + } + + } else { + NSInteger pageNum = request.page; + AMapPOISearchResponse_OnePage *page = [self.allAroundPoiResults.allPages objectAtIndex:pageNum - 1]; + page.status = 0; + page.pois = response.pois; + + for(AMapPOISearchResponse_OnePage *page in self.allAroundPoiResults.allPages) { + if(page.status == -1) { + allFinished = NO; + break; + } + } + + } + + if(allFinished) { + if(self.resultCallback) { + self.resultCallback(self.allAroundPoiResults); + } + } + +} + +- (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error +{ + NSLog(@"Error: %@ - %@", error, [ErrorInfoUtility errorDescriptionWithCode:error.code]); + + AMapPOISearchBaseRequest *req = (AMapPOISearchBaseRequest *)request; + NSInteger pageNum = req.page; + AMapPOISearchResponse_OnePage *page = [self.allAroundPoiResults.allPages objectAtIndex:pageNum - 1]; + page.status = 1; +} + +@end + diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchWithInPolygonController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchWithInPolygonController.h new file mode 100644 index 0000000..b047649 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchWithInPolygonController.h @@ -0,0 +1,13 @@ +// +// PoiSearchWithInPolygonController.h +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import + +@interface PoiSearchWithInPolygonController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchWithInPolygonController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchWithInPolygonController.m new file mode 100644 index 0000000..c73eca6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/PoiSearchWithInPolygonController.m @@ -0,0 +1,145 @@ +// +// PoiSearchWithInPolygonController.m +// MAMapKit_3D_Demo +// +// Created by shaobin on 16/8/11. +// Copyright © 2016年 Autonavi. All rights reserved. +// + +#import "PoiSearchWithInPolygonController.h" +#import "POIAnnotation.h" +#import "CommonUtility.h" + +@interface PoiSearchWithInPolygonController () + +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic, strong) MAMapView *mapView; + +@end + +@implementation PoiSearchWithInPolygonController +#pragma mark - Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + + [self.view addSubview:self.mapView]; + + self.search = [[AMapSearchAPI alloc] init]; + self.search.delegate = self; + + [self searchPoiByPolygon]; +} + +#pragma mark - MAMapViewDelegate + +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control +{ + id annotation = view.annotation; + + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + POIAnnotation *poiAnnotation = (POIAnnotation*)annotation; + +// PoiDetailViewController *detail = [[PoiDetailViewController alloc] init]; +// detail.poi = poiAnnotation.poi; +// + /* 进入POI详情页面. */ +// [self.navigationController pushViewController:detail animated:YES]; + } +} + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[POIAnnotation class]]) + { + static NSString *poiIdentifier = @"poiIdentifier"; + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:poiIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:poiIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + + return nil; +} + +#pragma mark - AMapSearchDelegate +- (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error +{ +// NSLog(@"Error: %@ - %@", error, [ErrorInfoUtility errorDescriptionWithCode:error.code]); +} + +/* POI 搜索回调. */ +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response +{ + if (response.pois.count == 0) + { + return; + } + + NSMutableArray *poiAnnotations = [NSMutableArray arrayWithCapacity:response.pois.count]; + + [response.pois enumerateObjectsUsingBlock:^(AMapPOI *obj, NSUInteger idx, BOOL *stop) { + + [poiAnnotations addObject:[[POIAnnotation alloc] initWithPOI:obj]]; + + }]; + + /* 将结果以annotation的形式加载到地图上. */ + [self.mapView addAnnotations:poiAnnotations]; + + /* 如果只有一个结果,设置其为中心点. */ + if (poiAnnotations.count == 1) + { + [self.mapView setCenterCoordinate:[poiAnnotations[0] coordinate]]; + } + /* 如果有多个结果, 设置地图使所有的annotation都可见. */ + else + { + [self.mapView showAnnotations:poiAnnotations animated:NO]; + } +} + +#pragma mark - Utility +/* 在指定的范围内搜索POI. */ +- (void)searchPoiByPolygon +{ + NSArray *points = [NSArray arrayWithObjects: + [AMapGeoPoint locationWithLatitude:39.990459 longitude:116.481476], + [AMapGeoPoint locationWithLatitude:39.890459 longitude:116.581476], + nil]; + AMapGeoPolygon *polygon = [AMapGeoPolygon polygonWithPoints:points]; + + AMapPOIPolygonSearchRequest *request = [[AMapPOIPolygonSearchRequest alloc] init]; + + request.polygon = polygon; + request.keywords = @"Apple"; + request.showFieldsType = AMapPOISearchShowFieldsTypeAll; + + [self.search AMapPOIPolygonSearch:request]; +} + +#pragma mark - Handle Action + +- (void)returnAction +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/TipViewController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/TipViewController.h new file mode 100755 index 0000000..e28cced --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/TipViewController.h @@ -0,0 +1,11 @@ +// +// GeoViewController.h +// SearchV3Demo +// +// Created by songjian on 13-8-14. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +@interface TipViewController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/TipViewController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/TipViewController.m new file mode 100755 index 0000000..9544260 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/TipViewController.m @@ -0,0 +1,434 @@ +// +// GeoViewController.m +// SearchV3Demo +// +// Created by songjian on 13-8-14. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "TipViewController.h" +#import "CommonUtility.h" +#import "AMapTipAnnotation.h" +#import "BusStopAnnotation.h" +#import "POIAnnotation.h" +//#import "PoiDetailViewController.h" +//#import "TipDetailViewController.h" + +#define TipPlaceHolder @"名称" +#define BusLinePaddingEdge 20 + +@interface TipViewController () + +@property (nonatomic, strong) MAMapView *mapView; +@property (nonatomic, strong) AMapSearchAPI *search; + +@property (nonatomic, strong) UISearchController *searchController; +@property (nonatomic, strong) UITableView *tableView; + +@property (nonatomic, strong) NSMutableArray *tips; +@property (nonatomic, strong) NSMutableArray *busLines; + +@end + +@implementation TipViewController + +#pragma mark - Life Cycle + +- (id)init +{ + if (self = [super init]) + { + self.tips = [NSMutableArray array]; + self.busLines = [NSMutableArray array]; + } + + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + [self.view addSubview:self.mapView]; + + self.search = [[AMapSearchAPI alloc] init]; + self.search.delegate = self; + + [self initSearchController]; + [self initTableView]; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + self.searchController.active = NO; +} + +#pragma mark - action handling + +- (void)returnAction +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +#pragma mark - Utility + +/* 输入提示 搜索.*/ +- (void)searchTipsWithKey:(NSString *)key +{ + if (key.length == 0) + { + return; + } + + AMapInputTipsSearchRequest *tips = [[AMapInputTipsSearchRequest alloc] init]; + tips.keywords = key; + tips.city = @"北京"; + // tips.cityLimit = YES; 是否限制城市 + + [self.search AMapInputTipsSearch:tips]; +} + +/* 清除annotations & overlays */ +- (void)clear +{ + [self.mapView removeAnnotations:self.mapView.annotations]; + [self.mapView removeOverlays:self.mapView.overlays]; +} + +- (void)clearAndShowAnnotationWithTip:(AMapTip *)tip +{ + /* 清除annotations & overlays */ + [self clear]; + + if (tip.uid != nil && tip.location != nil) /* 可以直接在地图打点 */ + { + AMapTipAnnotation *annotation = [[AMapTipAnnotation alloc] initWithMapTip:tip]; + [self.mapView addAnnotation:annotation]; + [self.mapView setCenterCoordinate:annotation.coordinate]; + [self.mapView selectAnnotation:annotation animated:YES]; + } + else if (tip.uid != nil && tip.location == nil)/* 公交路线,显示出来*/ + { + AMapBusLineIDSearchRequest *request = [[AMapBusLineIDSearchRequest alloc] init]; + request.city = @"北京"; + request.uid = tip.uid; + request.requireExtension = YES; + + [self.search AMapBusLineIDSearch:request]; + } + else if(tip.uid == nil && tip.location == nil)/* 品牌名,进行POI关键字搜索 */ + { + AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init]; + + request.keywords = tip.name; + request.city = @"北京"; + [self.search AMapPOIKeywordsSearch:request]; + } +} + +/* 展示公交线路 */ +- (void)presentCurrentBusLine +{ + AMapBusLine *busLine = [self.busLines firstObject]; + + if (busLine == nil) + { + return; + } + + NSMutableArray *busStopAnnotations = [NSMutableArray array]; + + [busLine.busStops enumerateObjectsUsingBlock:^(AMapBusStop *busStop, NSUInteger idx, BOOL *stop) { + BusStopAnnotation *annotation = [[BusStopAnnotation alloc] initWithBusStop:busStop]; + + [busStopAnnotations addObject:annotation]; + }]; + + [self.mapView addAnnotations:busStopAnnotations]; + + MAPolyline *polyline = [CommonUtility polylineForBusLine:busLine]; + + [self.mapView addOverlay:polyline]; + + [self.mapView setVisibleMapRect:polyline.boundingMapRect edgePadding:UIEdgeInsetsMake(BusLinePaddingEdge, BusLinePaddingEdge, BusLinePaddingEdge, BusLinePaddingEdge) animated:YES]; +} + +- (void)gotoDetailForTip:(AMapTip *)tip +{ + if (tip != nil) + { +// TipDetailViewController *tipDetailViewController = [[TipDetailViewController alloc] init]; +// tipDetailViewController.tip = tip; +// +// [self.navigationController pushViewController:tipDetailViewController animated:YES]; + } +} + +- (void)gotoDetailForBusStop:(AMapBusStop *)busStop +{ + if (busStop != nil) + { +// BusStopDetailViewController *busStopDetailViewController = [[BusStopDetailViewController alloc] init]; +// busStopDetailViewController.busStop = busStop; +// +// [self.navigationController pushViewController:busStopDetailViewController animated:YES]; + } +} + +- (void)gotoDetailForPoi:(AMapPOI *)poi +{ + if (poi != nil) + { +// PoiDetailViewController *detail = [[PoiDetailViewController alloc] init]; +// detail.poi = poi; +// +// [self.navigationController pushViewController:detail animated:YES]; + } +} + +#pragma mark - MAMapViewDelegate + +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control +{ + if ([view.annotation isKindOfClass:[AMapTipAnnotation class]]) + { + [self gotoDetailForTip:[(AMapTipAnnotation *)view.annotation tip]]; + } + else if ([view.annotation isKindOfClass:[BusStopAnnotation class]]) + { + [self gotoDetailForBusStop:[(BusStopAnnotation*)view.annotation busStop]]; + } + else if ([view.annotation isKindOfClass:[POIAnnotation class]]) + { + [self gotoDetailForPoi:[(POIAnnotation *)view.annotation poi]]; + } +} + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[AMapTipAnnotation class]]) + { + static NSString *tipIdentifier = @"tipIdentifier"; + + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:tipIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:tipIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + else if ([annotation isKindOfClass:[BusStopAnnotation class]]) + { + static NSString *busStopIdentifier = @"busStopIdentifier"; + + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:busStopIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation + reuseIdentifier:busStopIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + else if ([annotation isKindOfClass:[POIAnnotation class]]) + { + static NSString *poiIdentifier = @"poiIdentifier"; + MAPinAnnotationView *poiAnnotationView = (MAPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:poiIdentifier]; + if (poiAnnotationView == nil) + { + poiAnnotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:poiIdentifier]; + } + + poiAnnotationView.canShowCallout = YES; + poiAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + + return poiAnnotationView; + } + + return nil; +} + +- (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id)overlay +{ + if ([overlay isKindOfClass:[MAPolyline class]]) + { + MAPolylineRenderer *polylineRenderer = [[MAPolylineRenderer alloc] initWithPolyline:overlay]; + + polylineRenderer.lineWidth = 4.f; + polylineRenderer.strokeColor = [UIColor magentaColor]; + + return polylineRenderer; + } + + return nil; +} + +#pragma mark - AMapSearchDelegate + +- (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error +{ +// NSLog(@"Error: %@ - %@", error, [ErrorInfoUtility errorDescriptionWithCode:error.code]); +} + +/* 输入提示回调. */ +- (void)onInputTipsSearchDone:(AMapInputTipsSearchRequest *)request response:(AMapInputTipsSearchResponse *)response +{ + if (response.count == 0) + { + return; + } + + [self.tips setArray:response.tips]; + [self.tableView reloadData]; +} + +/* 公交搜索回调. */ +- (void)onBusLineSearchDone:(AMapBusLineBaseSearchRequest *)request response:(AMapBusLineSearchResponse *)response +{ + if (response.buslines.count != 0) + { + [self.busLines setArray:response.buslines]; + + [self presentCurrentBusLine]; + } +} + +/* POI 搜索回调. */ +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response +{ + [self.mapView removeAnnotations:self.mapView.annotations]; + + if (response.pois.count == 0) + { + return; + } + + NSMutableArray *poiAnnotations = [NSMutableArray arrayWithCapacity:response.pois.count]; + + [response.pois enumerateObjectsUsingBlock:^(AMapPOI *obj, NSUInteger idx, BOOL *stop) { + + [poiAnnotations addObject:[[POIAnnotation alloc] initWithPOI:obj]]; + + }]; + + /* 将结果以annotation的形式加载到地图上. */ + [self.mapView addAnnotations:poiAnnotations]; + + /* 如果只有一个结果,设置其为中心点. */ + if (poiAnnotations.count == 1) + { + [self.mapView setCenterCoordinate:[poiAnnotations[0] coordinate]]; + } + /* 如果有多个结果, 设置地图使所有的annotation都可见. */ + else + { + [self.mapView showAnnotations:poiAnnotations animated:NO]; + } +} + +#pragma mark - UISearchResultsUpdating + +- (void)updateSearchResultsForSearchController:(UISearchController *)searchController +{ + self.tableView.hidden = !searchController.isActive; + [self searchTipsWithKey:searchController.searchBar.text]; + + if (searchController.isActive && searchController.searchBar.text.length > 0) + { + searchController.searchBar.placeholder = searchController.searchBar.text; + } +} + +#pragma mark - UITableViewDataSource + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.tips.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *tipCellIdentifier = @"tipCellIdentifier"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tipCellIdentifier]; + + if (cell == nil) + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle + reuseIdentifier:tipCellIdentifier]; + cell.imageView.image = [UIImage imageNamed:@"locate"]; + } + + AMapTip *tip = self.tips[indexPath.row]; + + if (tip.location == nil) + { + cell.imageView.image = [UIImage imageNamed:@"search"]; + } + + cell.textLabel.text = tip.name; + cell.detailTextLabel.text = tip.address; + + return cell; +} + +#pragma mark - UITableViewDelegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + AMapTip *tip = self.tips[indexPath.row]; + + [self clearAndShowAnnotationWithTip:tip]; + + self.searchController.active = NO; +} + +#pragma mark - Initialization + +- (void)initTableView +{ + // CGFloat tableY = CGRectGetMaxY(self.navigationController.navigationBar.frame); + self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain]; + + self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.hidden = YES; + + [self.view addSubview:self.tableView]; +} + +- (void)initSearchController +{ + self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; + + self.searchController.searchResultsUpdater = self; + self.searchController.dimsBackgroundDuringPresentation = NO; + self.searchController.hidesNavigationBarDuringPresentation = NO; + + self.searchController.searchBar.delegate = self; + self.searchController.searchBar.placeholder = @"请输入关键字"; + [self.searchController.searchBar sizeToFit]; + + + self.navigationItem.titleView = self.searchController.searchBar; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/AMapTipAnnotation.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/AMapTipAnnotation.h new file mode 100644 index 0000000..8b7d05d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/AMapTipAnnotation.h @@ -0,0 +1,31 @@ +// +// AMapTipAnnotation.h +// officialDemo2D +// +// Created by PC on 15/8/25. +// Copyright (c) 2015年 AutoNavi. All rights reserved. +// + +#import + + +@interface AMapTipAnnotation : NSObject + +- (instancetype)initWithMapTip:(AMapTip *)tip; + +@property (nonatomic, readonly, strong) AMapTip *tip; +@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; + +/*! + @brief 获取annotation标题 + @return 返回annotation的标题信息 + */ +- (NSString *)title; + +/*! + @brief 获取annotation副标题 + @return 返回annotation的副标题信息 + */ +- (NSString *)subtitle; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/AMapTipAnnotation.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/AMapTipAnnotation.m new file mode 100644 index 0000000..44a2527 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/AMapTipAnnotation.m @@ -0,0 +1,46 @@ +// +// AMapTipAnnotation.m +// officialDemo2D +// +// Created by PC on 15/8/25. +// Copyright (c) 2015年 AutoNavi. All rights reserved. +// + +#import "AMapTipAnnotation.h" + +@interface AMapTipAnnotation() + +@property (nonatomic, readwrite, strong) AMapTip *tip; + +@end + + +@implementation AMapTipAnnotation + +- (NSString *)title +{ + return self.tip.name; +} + + +- (NSString *)subtitle +{ + return self.tip.address; +} + +- (CLLocationCoordinate2D)coordinate +{ + return CLLocationCoordinate2DMake(self.tip.location.latitude, self.tip.location.longitude); +} + +- (instancetype)initWithMapTip:(AMapTip *)tip +{ + self = [super init]; + if (self) + { + self.tip = tip; + } + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/BusStopAnnotation.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/BusStopAnnotation.h new file mode 100755 index 0000000..5478849 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/BusStopAnnotation.h @@ -0,0 +1,31 @@ +// +// BusStopAnnotation.h +// SearchV3Demo +// +// Created by songjian on 13-8-26. +// Copyright (c) 2013年 songjian. All rights reserved. +// + + + +@interface BusStopAnnotation : NSObject + +- (id)initWithBusStop:(AMapBusStop *)busStop; + +@property (nonatomic, readonly, strong) AMapBusStop *busStop; + +@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; + +/*! + @brief 获取annotation标题 + @return 返回annotation的标题信息 + */ +- (NSString *)title; + +/*! + @brief 获取annotation副标题 + @return 返回annotation的副标题信息 + */ +- (NSString *)subtitle; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/BusStopAnnotation.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/BusStopAnnotation.m new file mode 100755 index 0000000..0a732f0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/BusStopAnnotation.m @@ -0,0 +1,49 @@ +// +// BusStopAnnotation.m +// SearchV3Demo +// +// Created by songjian on 13-8-26. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "BusStopAnnotation.h" + +@interface BusStopAnnotation () + +@property (nonatomic, readwrite, strong) AMapBusStop *busStop; + +@end + +@implementation BusStopAnnotation +@synthesize busStop = _busStop; + +#pragma mark - MAAnnotation Protocol + +- (NSString *)title +{ + return self.busStop.name; +} + +- (NSString *)subtitle +{ + return [NSString stringWithFormat:@"ID = %@", self.busStop.uid]; +} + +- (CLLocationCoordinate2D)coordinate +{ + return CLLocationCoordinate2DMake(self.busStop.location.latitude, self.busStop.location.longitude); +} + +#pragma mark - Life Cycle + +- (id)initWithBusStop:(AMapBusStop *)busStop +{ + if (self = [super init]) + { + self.busStop = busStop; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/POIAnnotation.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/POIAnnotation.h new file mode 100755 index 0000000..e357e4d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/POIAnnotation.h @@ -0,0 +1,31 @@ +// +// POIAnnotation.h +// SearchV3Demo +// +// Created by songjian on 13-8-16. +// Copyright (c) 2013年 songjian. All rights reserved. +// + + + +@interface POIAnnotation : NSObject + +- (id)initWithPOI:(AMapPOI *)poi; + +@property (nonatomic, readonly, strong) AMapPOI *poi; + +@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; + +/*! + @brief 获取annotation标题 + @return 返回annotation的标题信息 + */ +- (NSString *)title; + +/*! + @brief 获取annotation副标题 + @return 返回annotation的副标题信息 + */ +- (NSString *)subtitle; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/POIAnnotation.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/POIAnnotation.m new file mode 100755 index 0000000..5d7a482 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/POI/model/POIAnnotation.m @@ -0,0 +1,48 @@ +// +// POIAnnotation.m +// SearchV3Demo +// +// Created by songjian on 13-8-16. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "POIAnnotation.h" + +@interface POIAnnotation () + +@property (nonatomic, readwrite, strong) AMapPOI *poi; + +@end + +@implementation POIAnnotation +@synthesize poi = _poi; + +#pragma mark - MAAnnotation Protocol + +- (NSString *)title +{ + return self.poi.name; +} + +- (NSString *)subtitle +{ + return self.poi.address; +} + +- (CLLocationCoordinate2D)coordinate +{ + return CLLocationCoordinate2DMake(self.poi.location.latitude, self.poi.location.longitude); +} + +#pragma mark - Life Cycle + +- (id)initWithPOI:(AMapPOI *)poi +{ + if (self = [super init]) + { + self.poi = poi; + } + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/UIView+Toast.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/UIView+Toast.h new file mode 100644 index 0000000..6f522ef --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/UIView+Toast.h @@ -0,0 +1,408 @@ +// +// UIView+Toast.h +// Toast +// +// Copyright (c) 2011-2015 Charles Scalesse. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +extern const NSString * CSToastPositionTop; +extern const NSString * CSToastPositionCenter; +extern const NSString * CSToastPositionBottom; + +@class CSToastStyle; + +/** + Toast is an Objective-C category that adds toast notifications to the UIView + object class. It is intended to be simple, lightweight, and easy to use. Most + toast notifications can be triggered with a single line of code. + + The `makeToast:` methods create a new view and then display it as toast. + + The `showToast:` methods display any view as toast. + + */ +@interface UIView (Toast) + +/** + Creates and presents a new toast view with a message and displays it with the + default duration and position. Styled using the shared style. + + @param message The message to be displayed + */ +- (void)makeToast:(NSString *)message; + +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration; + +/** + Creates and presents a new toast view with a message. Duration and position + can be set explicitly. Styled using the shared style. + + @param message The message to be displayed + @param duration The toast duration + @param position The toast's center point. Can be one of the predefined CSToastPosition + constants or a `CGPoint` wrapped in an `NSValue` object. + */ +- (void)makeToast:(NSString *)message + duration:(NSTimeInterval)duration + position:(id)position; + +/** + Creates and presents a new toast view with a message. Duration, position, and + style can be set explicitly. + + @param message The message to be displayed + @param duration The toast duration + @param position The toast's center point. Can be one of the predefined CSToastPosition + constants or a `CGPoint` wrapped in an `NSValue` object. + @param style The style. The shared style will be used when nil + */ +- (void)makeToast:(NSString *)message + duration:(NSTimeInterval)duration + position:(id)position + style:(CSToastStyle *)style; + +/** + Creates and presents a new toast view with a message, title, and image. Duration, + position, and style can be set explicitly. The completion block executes when the + toast view completes. `didTap` will be `YES` if the toast view was dismissed from + a tap. + + @param message The message to be displayed + @param duration The toast duration + @param position The toast's center point. Can be one of the predefined CSToastPosition + constants or a `CGPoint` wrapped in an `NSValue` object. + @param title The title + @param image The image + @param style The style. The shared style will be used when nil + @param completion The completion block, executed after the toast view disappears. + didTap will be `YES` if the toast view was dismissed from a tap. + */ +- (void)makeToast:(NSString *)message + duration:(NSTimeInterval)duration + position:(id)position + title:(NSString *)title + image:(UIImage *)image + style:(CSToastStyle *)style + completion:(void(^)(BOOL didTap))completion; + +/** + Creates a new toast view with any combination of message, title, and image. + The look and feel is configured via the style. Unlike the `makeToast:` methods, + this method does not present the toast view automatically. One of the showToast: + methods must be used to present the resulting view. + + @warning if message, title, and image are all nil, this method will return nil. + + @param message The message to be displayed + @param title The title + @param image The image + @param style The style. The shared style will be used when nil + @return The newly created toast view + */ +- (UIView *)toastViewForMessage:(NSString *)message + title:(NSString *)title + image:(UIImage *)image + style:(CSToastStyle *)style; + +/** + Creates and displays a new toast activity indicator view at a specified position. + + @warning Only one toast activity indicator view can be presented per superview. Subsequent + calls to `makeToastActivity:` will be ignored until hideToastActivity is called. + + @warning `makeToastActivity:` works independently of the showToast: methods. Toast activity + views can be presented and dismissed while toast views are being displayed. `makeToastActivity:` + has no effect on the queueing behavior of the showToast: methods. + + @param position The toast's center point. Can be one of the predefined CSToastPosition + constants or a `CGPoint` wrapped in an `NSValue` object. + */ +- (void)makeToastActivity:(id)position; + +/** + Dismisses the active toast activity indicator view. + */ +- (void)hideToastActivity; + +/** + Displays any view as toast using the default duration and position. + + @param toast The view to be displayed as toast + */ +- (void)showToast:(UIView *)toast; + +/** + Displays any view as toast at a provided position and duration. The completion block + executes when the toast view completes. `didTap` will be `YES` if the toast view was + dismissed from a tap. + + @param toast The view to be displayed as toast + @param duration The notification duration + @param position The toast's center point. Can be one of the predefined CSToastPosition + constants or a `CGPoint` wrapped in an `NSValue` object. + @param completion The completion block, executed after the toast view disappears. + didTap will be `YES` if the toast view was dismissed from a tap. + */ +- (void)showToast:(UIView *)toast + duration:(NSTimeInterval)duration + position:(id)position + completion:(void(^)(BOOL didTap))completion; + +@end + +/** + `CSToastStyle` instances define the look and feel for toast views created via the + `makeToast:` methods as well for toast views created directly with + `toastViewForMessage:title:image:style:`. + + @warning `CSToastStyle` offers relatively simple styling options for the default + toast view. If you require a toast view with more complex UI, it probably makes more + sense to create your own custom UIView subclass and present it with the `showToast:` + methods. + */ +@interface CSToastStyle : NSObject + +/** + The background color. Default is `[UIColor blackColor]` at 80% opacity. + */ +@property (strong, nonatomic) UIColor *backgroundColor; + +/** + The title color. Default is `[UIColor whiteColor]`. + */ +@property (strong, nonatomic) UIColor *titleColor; + +/** + The message color. Default is `[UIColor whiteColor]`. + */ +@property (strong, nonatomic) UIColor *messageColor; + +/** + A percentage value from 0.0 to 1.0, representing the maximum width of the toast + view relative to it's superview. Default is 0.8 (80% of the superview's width). + */ +@property (assign, nonatomic) CGFloat maxWidthPercentage; + +/** + A percentage value from 0.0 to 1.0, representing the maximum height of the toast + view relative to it's superview. Default is 0.8 (80% of the superview's height). + */ +@property (assign, nonatomic) CGFloat maxHeightPercentage; + +/** + The spacing from the horizontal edge of the toast view to the content. When an image + is present, this is also used as the padding between the image and the text. + Default is 10.0. + */ +@property (assign, nonatomic) CGFloat horizontalPadding; + +/** + The spacing from the vertical edge of the toast view to the content. When a title + is present, this is also used as the padding between the title and the message. + Default is 10.0. + */ +@property (assign, nonatomic) CGFloat verticalPadding; + +/** + The corner radius. Default is 10.0. + */ +@property (assign, nonatomic) CGFloat cornerRadius; + +/** + The title font. Default is `[UIFont boldSystemFontOfSize:16.0]`. + */ +@property (strong, nonatomic) UIFont *titleFont; + +/** + The message font. Default is `[UIFont systemFontOfSize:16.0]`. + */ +@property (strong, nonatomic) UIFont *messageFont; + +/** + The title text alignment. Default is `NSTextAlignmentLeft`. + */ +@property (assign, nonatomic) NSTextAlignment titleAlignment; + +/** + The message text alignment. Default is `NSTextAlignmentLeft`. + */ +@property (assign, nonatomic) NSTextAlignment messageAlignment; + +/** + The maximum number of lines for the title. The default is 0 (no limit). + */ +@property (assign, nonatomic) NSInteger titleNumberOfLines; + +/** + The maximum number of lines for the message. The default is 0 (no limit). + */ +@property (assign, nonatomic) NSInteger messageNumberOfLines; + +/** + Enable or disable a shadow on the toast view. Default is `NO`. + */ +@property (assign, nonatomic) BOOL displayShadow; + +/** + The shadow color. Default is `[UIColor blackColor]`. + */ +@property (strong, nonatomic) UIColor *shadowColor; + +/** + A value from 0.0 to 1.0, representing the opacity of the shadow. + Default is 0.8 (80% opacity). + */ +@property (assign, nonatomic) CGFloat shadowOpacity; + +/** + The shadow radius. Default is 6.0. + */ +@property (assign, nonatomic) CGFloat shadowRadius; + +/** + The shadow offset. The default is `CGSizeMake(4.0, 4.0)`. + */ +@property (assign, nonatomic) CGSize shadowOffset; + +/** + The image size. The default is `CGSizeMake(80.0, 80.0)`. + */ +@property (assign, nonatomic) CGSize imageSize; + +/** + The size of the toast activity view when `makeToastActivity:` is called. + Default is `CGSizeMake(100.0, 100.0)`. + */ +@property (assign, nonatomic) CGSize activitySize; + +/** + The fade in/out animation duration. Default is 0.2. + */ +@property (assign, nonatomic) NSTimeInterval fadeDuration; + +/** + Creates a new instance of `CSToastStyle` with all the default values set. + */ +- (instancetype)initWithDefaultStyle NS_DESIGNATED_INITIALIZER; + +/** + @warning Only the designated initializer should be used to create + an instance of `CSToastStyle`. + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +/** + `CSToastManager` provides general configuration options for all toast + notifications. Backed by a singleton instance. + */ +@interface CSToastManager : NSObject + +/** + Sets the shared style on the singleton. The shared style is used whenever + a `makeToast:` method (or `toastViewForMessage:title:image:style:`) is called + with with a nil style. By default, this is set to `CSToastStyle`'s default + style. + + @param sharedStyle sharedStyle + */ ++ (void)setSharedStyle:(CSToastStyle *)sharedStyle; + +/** + Gets the shared style from the singlton. By default, this is + `CSToastStyle`'s default style. + + @return the shared style + */ ++ (CSToastStyle *)sharedStyle; + +/** + Enables or disables tap to dismiss on toast views. Default is `YES`. + + @param tapToDismissEnabled tapToDismissEnabled + */ ++ (void)setTapToDismissEnabled:(BOOL)tapToDismissEnabled; + +/** + Returns `YES` if tap to dismiss is enabled, otherwise `NO`. + Default is `YES`. + + @return BOOL + */ ++ (BOOL)isTapToDismissEnabled; + +/** + Enables or disables queueing behavior for toast views. When `YES`, + toast views will appear one after the other. When `NO`, multiple Toast + views will appear at the same time (potentially overlapping depending + on their positions). This has no effect on the toast activity view, + which operates independently of normal toast views. Default is `YES`. + + @param queueEnabled queueEnabled + */ ++ (void)setQueueEnabled:(BOOL)queueEnabled; + +/** + Returns `YES` if the queue is enabled, otherwise `NO`. + Default is `YES`. + + @return BOOL + */ ++ (BOOL)isQueueEnabled; + +/** + Sets the default duration. Used for the `makeToast:` and + `showToast:` methods that don't require an explicit duration. + Default is 3.0. + + @param duration The toast duration + */ ++ (void)setDefaultDuration:(NSTimeInterval)duration; + +/** + Returns the default duration. Default is 3.0. + + @return duration The toast duration +*/ ++ (NSTimeInterval)defaultDuration; + +/** + Sets the default position. Used for the `makeToast:` and + `showToast:` methods that don't require an explicit position. + Default is `CSToastPositionBottom`. + + @param position The default center point. Can be one of the predefined + CSToastPosition constants or a `CGPoint` wrapped in an `NSValue` object. + */ ++ (void)setDefaultPosition:(id)position; + +/** + Returns the default toast position. Default is `CSToastPositionBottom`. + + @return position The default center point. Will be one of the predefined + CSToastPosition constants or a `CGPoint` wrapped in an `NSValue` object. + */ ++ (id)defaultPosition; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/UIView+Toast.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/UIView+Toast.m new file mode 100644 index 0000000..c4c699d --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/UIView+Toast.m @@ -0,0 +1,535 @@ +// +// UIView+Toast.m +// Toast +// +// Copyright (c) 2011-2015 Charles Scalesse. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import "UIView+Toast.h" +#import +#import + +NSString * CSToastPositionTop = @"CSToastPositionTop"; +NSString * CSToastPositionCenter = @"CSToastPositionCenter"; +NSString * CSToastPositionBottom = @"CSToastPositionBottom"; + +// Keys for values associated with toast views +static const NSString * CSToastTimerKey = @"CSToastTimerKey"; +static const NSString * CSToastDurationKey = @"CSToastDurationKey"; +static const NSString * CSToastPositionKey = @"CSToastPositionKey"; +static const NSString * CSToastCompletionKey = @"CSToastCompletionKey"; + +// Keys for values associated with self +static const NSString * CSToastActiveToastViewKey = @"CSToastActiveToastViewKey"; +static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey"; +static const NSString * CSToastQueueKey = @"CSToastQueueKey"; + +@interface UIView (ToastPrivate) + +/** + These private methods are being prefixed with "cs_" to reduce the likelihood of non-obvious + naming conflicts with other UIView methods. + + @discussion Should the public API also use the cs_ prefix? Technically it should, but it + results in code that is less legible. The current public method names seem unlikely to cause + conflicts so I think we should favor the cleaner API for now. + */ +- (void)cs_showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)position; +- (void)cs_hideToast:(UIView *)toast; +- (void)cs_hideToast:(UIView *)toast fromTap:(BOOL)fromTap; +- (void)cs_toastTimerDidFinish:(NSTimer *)timer; +- (void)cs_handleToastTapped:(UITapGestureRecognizer *)recognizer; +- (CGPoint)cs_centerPointForPosition:(id)position withToast:(UIView *)toast; +- (NSMutableArray *)cs_toastQueue; + +@end + +@implementation UIView (Toast) + +#pragma mark - Make Toast Methods + +- (void)makeToast:(NSString *)message { + [self makeToast:message duration:[CSToastManager defaultDuration] position:[CSToastManager defaultPosition] style:nil]; +} + +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration { + [self makeToast:message duration:duration position:[CSToastManager defaultPosition] style:nil]; +} + +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position { + [self makeToast:message duration:duration position:position style:nil]; +} + +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position style:(CSToastStyle *)style { + UIView *toast = [self toastViewForMessage:message title:nil image:nil style:style]; + [self showToast:toast duration:duration position:position completion:nil]; +} + +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position title:(NSString *)title image:(UIImage *)image style:(CSToastStyle *)style completion:(void(^)(BOOL didTap))completion { + UIView *toast = [self toastViewForMessage:message title:title image:image style:style]; + [self showToast:toast duration:duration position:position completion:completion]; +} + +#pragma mark - Show Toast Methods + +- (void)showToast:(UIView *)toast { + [self showToast:toast duration:[CSToastManager defaultDuration] position:[CSToastManager defaultPosition] completion:nil]; +} + +- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)position completion:(void(^)(BOOL didTap))completion { + // sanity + if (toast == nil) return; + + // store the completion block on the toast view + objc_setAssociatedObject(toast, &CSToastCompletionKey, completion, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + if ([CSToastManager isQueueEnabled] && objc_getAssociatedObject(self, &CSToastActiveToastViewKey) != nil) { + // we're about to queue this toast view so we need to store the duration and position as well + objc_setAssociatedObject(toast, &CSToastDurationKey, @(duration), OBJC_ASSOCIATION_RETAIN_NONATOMIC); + objc_setAssociatedObject(toast, &CSToastPositionKey, position, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // enqueue + [self.cs_toastQueue addObject:toast]; + } else { + // present + [self cs_showToast:toast duration:duration position:position]; + } +} + +#pragma mark - Private Show/Hide Methods + +- (void)cs_showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)position { + toast.center = [self cs_centerPointForPosition:position withToast:toast]; + toast.alpha = 0.0; + + if ([CSToastManager isTapToDismissEnabled]) { + UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cs_handleToastTapped:)]; + [toast addGestureRecognizer:recognizer]; + toast.userInteractionEnabled = YES; + toast.exclusiveTouch = YES; + } + + // set the active toast + objc_setAssociatedObject(self, &CSToastActiveToastViewKey, toast, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + [self addSubview:toast]; + + [UIView animateWithDuration:[[CSToastManager sharedStyle] fadeDuration] + delay:0.0 + options:(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction) + animations:^{ + toast.alpha = 1.0; + } completion:^(BOOL finished) { + NSTimer *timer = [NSTimer timerWithTimeInterval:duration target:self selector:@selector(cs_toastTimerDidFinish:) userInfo:toast repeats:NO]; + [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; + objc_setAssociatedObject(toast, &CSToastTimerKey, timer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + }]; +} + +- (void)cs_hideToast:(UIView *)toast { + [self cs_hideToast:toast fromTap:NO]; +} + +- (void)cs_hideToast:(UIView *)toast fromTap:(BOOL)fromTap { + [UIView animateWithDuration:[[CSToastManager sharedStyle] fadeDuration] + delay:0.0 + options:(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) + animations:^{ + toast.alpha = 0.0; + } completion:^(BOOL finished) { + [toast removeFromSuperview]; + + // clear the active toast + objc_setAssociatedObject(self, &CSToastActiveToastViewKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // execute the completion block, if necessary + void (^completion)(BOOL didTap) = objc_getAssociatedObject(toast, &CSToastCompletionKey); + if (completion) { + completion(fromTap); + } + + if ([self.cs_toastQueue count] > 0) { + // dequeue + UIView *nextToast = [[self cs_toastQueue] firstObject]; + [[self cs_toastQueue] removeObjectAtIndex:0]; + + // present the next toast + NSTimeInterval duration = [objc_getAssociatedObject(nextToast, &CSToastDurationKey) doubleValue]; + id position = objc_getAssociatedObject(nextToast, &CSToastPositionKey); + [self cs_showToast:nextToast duration:duration position:position]; + } + }]; +} + +#pragma mark - View Construction + +- (UIView *)toastViewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image style:(CSToastStyle *)style { + // sanity + if(message == nil && title == nil && image == nil) return nil; + + // default to the shared style + if (style == nil) { + style = [CSToastManager sharedStyle]; + } + + // dynamically build a toast view with any combination of message, title, & image + UILabel *messageLabel = nil; + UILabel *titleLabel = nil; + UIImageView *imageView = nil; + + UIView *wrapperView = [[UIView alloc] init]; + wrapperView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); + wrapperView.layer.cornerRadius = style.cornerRadius; + + if (style.displayShadow) { + wrapperView.layer.shadowColor = style.shadowColor.CGColor; + wrapperView.layer.shadowOpacity = style.shadowOpacity; + wrapperView.layer.shadowRadius = style.shadowRadius; + wrapperView.layer.shadowOffset = style.shadowOffset; + } + + wrapperView.backgroundColor = style.backgroundColor; + + if(image != nil) { + imageView = [[UIImageView alloc] initWithImage:image]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + imageView.frame = CGRectMake(style.horizontalPadding, style.verticalPadding, style.imageSize.width, style.imageSize.height); + } + + CGRect imageRect = CGRectZero; + + if(imageView != nil) { + imageRect.origin.x = style.horizontalPadding; + imageRect.origin.y = style.verticalPadding; + imageRect.size.width = imageView.bounds.size.width; + imageRect.size.height = imageView.bounds.size.height; + } + + if (title != nil) { + titleLabel = [[UILabel alloc] init]; + titleLabel.numberOfLines = style.titleNumberOfLines; + titleLabel.font = style.titleFont; + titleLabel.textAlignment = style.titleAlignment; + titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; + titleLabel.textColor = style.titleColor; + titleLabel.backgroundColor = [UIColor clearColor]; + titleLabel.alpha = 1.0; + titleLabel.text = title; + + // size the title label according to the length of the text + CGSize maxSizeTitle = CGSizeMake((self.bounds.size.width * style.maxWidthPercentage) - imageRect.size.width, self.bounds.size.height * style.maxHeightPercentage); + CGSize expectedSizeTitle = [titleLabel sizeThatFits:maxSizeTitle]; + // UILabel can return a size larger than the max size when the number of lines is 1 + expectedSizeTitle = CGSizeMake(MIN(maxSizeTitle.width, expectedSizeTitle.width), MIN(maxSizeTitle.height, expectedSizeTitle.height)); + titleLabel.frame = CGRectMake(0.0, 0.0, expectedSizeTitle.width, expectedSizeTitle.height); + } + + if (message != nil) { + messageLabel = [[UILabel alloc] init]; + messageLabel.numberOfLines = style.messageNumberOfLines; + messageLabel.font = style.messageFont; + messageLabel.textAlignment = style.messageAlignment; + messageLabel.lineBreakMode = NSLineBreakByTruncatingTail; + messageLabel.textColor = style.messageColor; + messageLabel.backgroundColor = [UIColor clearColor]; + messageLabel.alpha = 1.0; + messageLabel.text = message; + + CGSize maxSizeMessage = CGSizeMake((self.bounds.size.width * style.maxWidthPercentage) - imageRect.size.width, self.bounds.size.height * style.maxHeightPercentage); + CGSize expectedSizeMessage = [messageLabel sizeThatFits:maxSizeMessage]; + // UILabel can return a size larger than the max size when the number of lines is 1 + expectedSizeMessage = CGSizeMake(MIN(maxSizeMessage.width, expectedSizeMessage.width), MIN(maxSizeMessage.height, expectedSizeMessage.height)); + messageLabel.frame = CGRectMake(0.0, 0.0, expectedSizeMessage.width, expectedSizeMessage.height); + } + + CGRect titleRect = CGRectZero; + + if(titleLabel != nil) { + titleRect.origin.x = imageRect.origin.x + imageRect.size.width + style.horizontalPadding; + titleRect.origin.y = style.verticalPadding; + titleRect.size.width = titleLabel.bounds.size.width; + titleRect.size.height = titleLabel.bounds.size.height; + } + + CGRect messageRect = CGRectZero; + + if(messageLabel != nil) { + messageRect.origin.x = imageRect.origin.x + imageRect.size.width + style.horizontalPadding; + messageRect.origin.y = titleRect.origin.y + titleRect.size.height + style.verticalPadding; + messageRect.size.width = messageLabel.bounds.size.width; + messageRect.size.height = messageLabel.bounds.size.height; + } + + CGFloat longerWidth = MAX(titleRect.size.width, messageRect.size.width); + CGFloat longerX = MAX(titleRect.origin.x, messageRect.origin.x); + + // Wrapper width uses the longerWidth or the image width, whatever is larger. Same logic applies to the wrapper height. + CGFloat wrapperWidth = MAX((imageRect.size.width + (style.horizontalPadding * 2.0)), (longerX + longerWidth + style.horizontalPadding)); + CGFloat wrapperHeight = MAX((messageRect.origin.y + messageRect.size.height + style.verticalPadding), (imageRect.size.height + (style.verticalPadding * 2.0))); + + wrapperView.frame = CGRectMake(0.0, 0.0, wrapperWidth, wrapperHeight); + + if(titleLabel != nil) { + titleLabel.frame = titleRect; + [wrapperView addSubview:titleLabel]; + } + + if(messageLabel != nil) { + messageLabel.frame = messageRect; + [wrapperView addSubview:messageLabel]; + } + + if(imageView != nil) { + [wrapperView addSubview:imageView]; + } + + return wrapperView; +} + +#pragma mark - Queue + +- (NSMutableArray *)cs_toastQueue { + NSMutableArray *cs_toastQueue = objc_getAssociatedObject(self, &CSToastQueueKey); + if (cs_toastQueue == nil) { + cs_toastQueue = [[NSMutableArray alloc] init]; + objc_setAssociatedObject(self, &CSToastQueueKey, cs_toastQueue, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + return cs_toastQueue; +} + +#pragma mark - Events + +- (void)cs_toastTimerDidFinish:(NSTimer *)timer { + [self cs_hideToast:(UIView *)timer.userInfo]; +} + +- (void)cs_handleToastTapped:(UITapGestureRecognizer *)recognizer { + UIView *toast = recognizer.view; + NSTimer *timer = (NSTimer *)objc_getAssociatedObject(toast, &CSToastTimerKey); + [timer invalidate]; + + [self cs_hideToast:toast fromTap:YES]; +} + +#pragma mark - Activity Methods + +- (void)makeToastActivity:(id)position { + // sanity + UIView *existingActivityView = (UIView *)objc_getAssociatedObject(self, &CSToastActivityViewKey); + if (existingActivityView != nil) return; + + CSToastStyle *style = [CSToastManager sharedStyle]; + + UIView *activityView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, style.activitySize.width, style.activitySize.height)]; + activityView.center = [self cs_centerPointForPosition:position withToast:activityView]; + activityView.backgroundColor = style.backgroundColor; + activityView.alpha = 0.0; + activityView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); + activityView.layer.cornerRadius = style.cornerRadius; + + if (style.displayShadow) { + activityView.layer.shadowColor = style.shadowColor.CGColor; + activityView.layer.shadowOpacity = style.shadowOpacity; + activityView.layer.shadowRadius = style.shadowRadius; + activityView.layer.shadowOffset = style.shadowOffset; + } + + UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + activityIndicatorView.center = CGPointMake(activityView.bounds.size.width / 2, activityView.bounds.size.height / 2); + [activityView addSubview:activityIndicatorView]; + [activityIndicatorView startAnimating]; + + // associate the activity view with self + objc_setAssociatedObject (self, &CSToastActivityViewKey, activityView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + [self addSubview:activityView]; + + [UIView animateWithDuration:style.fadeDuration + delay:0.0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + activityView.alpha = 1.0; + } completion:nil]; +} + +- (void)hideToastActivity { + UIView *existingActivityView = (UIView *)objc_getAssociatedObject(self, &CSToastActivityViewKey); + if (existingActivityView != nil) { + [UIView animateWithDuration:[[CSToastManager sharedStyle] fadeDuration] + delay:0.0 + options:(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) + animations:^{ + existingActivityView.alpha = 0.0; + } completion:^(BOOL finished) { + [existingActivityView removeFromSuperview]; + objc_setAssociatedObject (self, &CSToastActivityViewKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + }]; + } +} + +#pragma mark - Helpers + +- (CGPoint)cs_centerPointForPosition:(id)point withToast:(UIView *)toast { + CSToastStyle *style = [CSToastManager sharedStyle]; + + if([point isKindOfClass:[NSString class]]) { + if([point caseInsensitiveCompare:CSToastPositionTop] == NSOrderedSame) { + return CGPointMake(self.bounds.size.width/2, (toast.frame.size.height / 2) + style.verticalPadding); + } else if([point caseInsensitiveCompare:CSToastPositionCenter] == NSOrderedSame) { + return CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); + } + } else if ([point isKindOfClass:[NSValue class]]) { + return [point CGPointValue]; + } + + // default to bottom + return CGPointMake(self.bounds.size.width/2, (self.bounds.size.height - (toast.frame.size.height / 2)) - style.verticalPadding); +} + +@end + +@implementation CSToastStyle + +#pragma mark - Constructors + +- (instancetype)initWithDefaultStyle { + self = [super init]; + if (self) { + self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8]; + self.titleColor = [UIColor whiteColor]; + self.messageColor = [UIColor whiteColor]; + self.maxWidthPercentage = 0.8; + self.maxHeightPercentage = 0.8; + self.horizontalPadding = 10.0; + self.verticalPadding = 10.0; + self.cornerRadius = 10.0; + self.titleFont = [UIFont boldSystemFontOfSize:16.0]; + self.messageFont = [UIFont systemFontOfSize:16.0]; + self.titleAlignment = NSTextAlignmentLeft; + self.messageAlignment = NSTextAlignmentLeft; + self.titleNumberOfLines = 0; + self.messageNumberOfLines = 0; + self.displayShadow = NO; + self.shadowOpacity = 0.8; + self.shadowRadius = 6.0; + self.shadowOffset = CGSizeMake(4.0, 4.0); + self.imageSize = CGSizeMake(80.0, 80.0); + self.activitySize = CGSizeMake(100.0, 100.0); + self.fadeDuration = 0.2; + } + return self; +} + +- (void)setMaxWidthPercentage:(CGFloat)maxWidthPercentage { + _maxWidthPercentage = MAX(MIN(maxWidthPercentage, 1.0), 0.0); +} + +- (void)setMaxHeightPercentage:(CGFloat)maxHeightPercentage { + _maxHeightPercentage = MAX(MIN(maxHeightPercentage, 1.0), 0.0); +} + +- (instancetype)init NS_UNAVAILABLE { + return nil; +} + +@end + +@interface CSToastManager () + +@property (strong, nonatomic) CSToastStyle *sharedStyle; +@property (assign, nonatomic, getter=isTapToDismissEnabled) BOOL tapToDismissEnabled; +@property (assign, nonatomic, getter=isQueueEnabled) BOOL queueEnabled; +@property (assign, nonatomic) NSTimeInterval defaultDuration; +@property (strong, nonatomic) id defaultPosition; + +@end + +@implementation CSToastManager + +#pragma mark - Constructors + ++ (instancetype)sharedManager { + static CSToastManager *_sharedManager = nil; + static dispatch_once_t oncePredicate; + dispatch_once(&oncePredicate, ^{ + _sharedManager = [[self alloc] init]; + }); + + return _sharedManager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + self.sharedStyle = [[CSToastStyle alloc] initWithDefaultStyle]; + self.tapToDismissEnabled = YES; + self.queueEnabled = YES; + self.defaultDuration = 0.3; + self.defaultPosition = CSToastPositionBottom; + } + return self; +} + +#pragma mark - Singleton Methods + ++ (void)setSharedStyle:(CSToastStyle *)sharedStyle { + [[self sharedManager] setSharedStyle:sharedStyle]; +} + ++ (CSToastStyle *)sharedStyle { + return [[self sharedManager] sharedStyle]; +} + ++ (void)setTapToDismissEnabled:(BOOL)tapToDismissEnabled { + [[self sharedManager] setTapToDismissEnabled:tapToDismissEnabled]; +} + ++ (BOOL)isTapToDismissEnabled { + return [[self sharedManager] isTapToDismissEnabled]; +} + ++ (void)setQueueEnabled:(BOOL)queueEnabled { + [[self sharedManager] setQueueEnabled:queueEnabled]; +} + ++ (BOOL)isQueueEnabled { + return [[self sharedManager] isQueueEnabled]; +} + ++ (void)setDefaultDuration:(NSTimeInterval)duration { + [[self sharedManager] setDefaultDuration:duration]; +} + ++ (NSTimeInterval)defaultDuration { + return [[self sharedManager] defaultDuration]; +} + ++ (void)setDefaultPosition:(id)position { + if ([position isKindOfClass:[NSString class]] || [position isKindOfClass:[NSValue class]]) { + [[self sharedManager] setDefaultPosition:position]; + } +} + ++ (id)defaultPosition { + return [[self sharedManager] defaultPosition]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnimatedAnnotationViewController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnimatedAnnotationViewController.h new file mode 100755 index 0000000..b8b4071 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnimatedAnnotationViewController.h @@ -0,0 +1,11 @@ +// +// AnimatedAnnotationViewController.h +// Category_demo2D +// +// Created by 刘博 on 13-11-8. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +@interface AnimatedAnnotationViewController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnimatedAnnotationViewController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnimatedAnnotationViewController.m new file mode 100755 index 0000000..9432003 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnimatedAnnotationViewController.m @@ -0,0 +1,120 @@ +// +// AnimatedAnnotationViewController.m +// Category_demo2D +// +// Created by 刘博 on 13-11-8. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "AnimatedAnnotationViewController.h" +#import "AnimatedAnnotation.h" +#import "AnimatedAnnotationView.h" + +@interface AnimatedAnnotationViewController () + +@property (nonatomic, strong) MAMapView *mapView; +@property (nonatomic, strong) AnimatedAnnotation *animatedCarAnnotation; +@property (nonatomic, strong) AnimatedAnnotation *animatedTrainAnnotation; + +@end + +@implementation AnimatedAnnotationViewController + +@synthesize animatedCarAnnotation = _animatedCarAnnotation; +@synthesize animatedTrainAnnotation = _animatedTrainAnnotation; + +#pragma mark - Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + + [self.view addSubview:self.mapView]; + + [self addCarAnnotationWithCoordinate:CLLocationCoordinate2DMake(39.948691, 116.492479)]; + [self addTrainAnnotationWithCoordinate:CLLocationCoordinate2DMake(39.843349, 116.315633)]; + +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + [self.mapView selectAnnotation:self.animatedTrainAnnotation animated:YES]; +} + +#pragma mark - action handle +- (void)returnAction { + [self.navigationController popViewControllerAnimated:YES]; +} + +#pragma mark - MAMapViewDelegate + +- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation +{ + if ([annotation isKindOfClass:[AnimatedAnnotation class]]) + { + static NSString *animatedAnnotationIdentifier = @"AnimatedAnnotationIdentifier"; + + AnimatedAnnotationView *annotationView = (AnimatedAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:animatedAnnotationIdentifier]; + + if (annotationView == nil) + { + annotationView = [[AnimatedAnnotationView alloc] initWithAnnotation:annotation + reuseIdentifier:animatedAnnotationIdentifier]; + + annotationView.canShowCallout = YES; + annotationView.draggable = YES; + } + + return annotationView; + } + + return nil; +} + +#pragma mark - Utility + +-(void)addCarAnnotationWithCoordinate:(CLLocationCoordinate2D)coordinate +{ + NSMutableArray *carImages = [[NSMutableArray alloc] init]; + [carImages addObject:[UIImage imageNamed:@"animatedCar_1.png"]]; + [carImages addObject:[UIImage imageNamed:@"animatedCar_2.png"]]; + [carImages addObject:[UIImage imageNamed:@"animatedCar_3.png"]]; + [carImages addObject:[UIImage imageNamed:@"animatedCar_4.png"]]; + [carImages addObject:[UIImage imageNamed:@"animatedCar_3.png"]]; + [carImages addObject:[UIImage imageNamed:@"animatedCar_4.png"]]; + + self.animatedCarAnnotation = [[AnimatedAnnotation alloc] initWithCoordinate:coordinate]; + self.animatedCarAnnotation.animatedImages = carImages; + self.animatedCarAnnotation.title = @"AutoNavi"; + self.animatedCarAnnotation.subtitle = [NSString stringWithFormat:@"Car: %lu images",(unsigned long)[self.animatedCarAnnotation.animatedImages count]]; + + [self.mapView addAnnotation:self.animatedCarAnnotation]; +} + +-(void)addTrainAnnotationWithCoordinate:(CLLocationCoordinate2D)coordinate +{ + NSMutableArray *trainImages = [[NSMutableArray alloc] init]; + [trainImages addObject:[UIImage imageNamed:@"animatedTrain_1.png"]]; + [trainImages addObject:[UIImage imageNamed:@"animatedTrain_2.png"]]; + [trainImages addObject:[UIImage imageNamed:@"animatedTrain_3.png"]]; + [trainImages addObject:[UIImage imageNamed:@"animatedTrain_4.png"]]; + + self.animatedTrainAnnotation = [[AnimatedAnnotation alloc] initWithCoordinate:coordinate]; + self.animatedTrainAnnotation.animatedImages = trainImages; + self.animatedTrainAnnotation.title = @"AutoNavi"; + self.animatedTrainAnnotation.subtitle = [NSString stringWithFormat:@"Train: %lu images",(unsigned long)[self.animatedTrainAnnotation.animatedImages count]]; + + [self.mapView addAnnotation:self.animatedTrainAnnotation]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnnotationViewController.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnnotationViewController.h new file mode 100755 index 0000000..c0acb77 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnnotationViewController.h @@ -0,0 +1,12 @@ +// +// AnnotationViewController.h +// Category_demo +// +// Created by songjian on 13-3-21. +// Copyright (c) 2013年 songjian. All rights reserved. +// + + +@interface AnnotationViewController : UIViewController + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnnotationViewController.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnnotationViewController.m new file mode 100755 index 0000000..343e2db --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/AnnotationViewController.m @@ -0,0 +1,177 @@ +// +// AnnotationViewController.m +// Category_demo +// +// Created by songjian on 13-3-21. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "AnnotationViewController.h" + +enum { + AnnotationViewControllerAnnotationTypeRed = 0, + AnnotationViewControllerAnnotationTypeGreen, + AnnotationViewControllerAnnotationTypePurple +}; + +@interface AnnotationViewController () + +@property (nonatomic, strong) MAMapView *mapView; +@property (nonatomic, strong) NSMutableArray *annotations; + +@end + +@implementation AnnotationViewController + +#pragma mark - Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + [self initAnnotations]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" + style:UIBarButtonItemStylePlain + target:self + action:@selector(returnAction)]; + + self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.mapView.delegate = self; + + [self.view addSubview:self.mapView]; + + [self.mapView addAnnotations:self.annotations]; + [self.mapView showAnnotations:self.annotations animated:YES]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + +} + +#pragma mark - Action Handlers +- (void)returnAction +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +#pragma mark - Initialization +- (void)initAnnotations +{ + self.annotations = [NSMutableArray array]; + + CLLocationCoordinate2D coordinates[10] = { + {39.992520, 116.336170}, + {39.992520, 116.336170}, + {39.998293, 116.352343}, + {40.004087, 116.348904}, + {40.001442, 116.353915}, + {39.989105, 116.353915}, + {39.989098, 116.360200}, + {39.998439, 116.360201}, + {39.979590, 116.324219}, + {39.978234, 116.352792}}; + + for (int i = 0; i < 10; ++i) + { + MAPointAnnotation *a1 = [[MAPointAnnotation alloc] init]; + a1.coordinate = coordinates[i]; + a1.title = [NSString stringWithFormat:@"anno: %d", i]; + [self.annotations addObject:a1]; + } +} + +#pragma mark - Map Delegate + +/*! + @brief 根据anntation生成对应的View + @param mapView 地图View + @param annotation 指定的标注 + @return 生成的标注View + */ +- (MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id )annotation { + if ([annotation isKindOfClass:[MAPointAnnotation class]]) + { + static NSString *pointReuseIndetifier = @"pointReuseIndetifier"; + MAPinAnnotationView *annotationView = (MAPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier]; + if (annotationView == nil) + { + annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndetifier]; + } + + annotationView.canShowCallout = YES; + annotationView.animatesDrop = YES; + annotationView.draggable = YES; + annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; + annotationView.pinColor = [self.annotations indexOfObject:annotation] % 3; + + return annotationView; + } + + return nil; +} + +/*! + @brief 当mapView新添加annotation views时调用此接口 + @param mapView 地图View + @param views 新添加的annotation views + */ +- (void)mapView:(MAMapView *)mapView didAddAnnotationViews:(NSArray *)views { + +} + +/*! + @brief 当选中一个annotation views时调用此接口 + @param mapView 地图View + @param views 选中的annotation views + */ +- (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view { + +} + +/*! + @brief 当取消选中一个annotation views时调用此接口 + @param mapView 地图View + @param views 取消选中的annotation views + */ +- (void)mapView:(MAMapView *)mapView didDeselectAnnotationView:(MAAnnotationView *)view { + +} + +/*! + @brief 标注view的accessory view(必须继承自UIControl)被点击时调用此接口 + @param mapView 地图View + @param annotationView callout所属的标注view + @param control 对应的control + */ +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { + +} + +/** + * 标注view的calloutview整体点击时调用此接口 + * + * @param mapView 地图的view + * @param view calloutView所属的annotationView + */ +- (void)mapView:(MAMapView *)mapView didAnnotationViewCalloutTapped:(MAAnnotationView *)view { + +} + +/*! + @brief 拖动annotation view时view的状态变化,ios3.2以后支持 + @param mapView 地图View + @param view annotation view + @param newState 新状态 + @param oldState 旧状态 + */ +- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view didChangeDragState:(MAAnnotationViewDragState)newState fromOldState:(MAAnnotationViewDragState)oldState { + +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/AnimatedAnnotation.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/AnimatedAnnotation.h new file mode 100755 index 0000000..728a14e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/AnimatedAnnotation.h @@ -0,0 +1,23 @@ +// +// AnimatedAnnotation.h +// Category_demo2D +// +// Created by 刘博 on 13-11-8. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +@import Foundation; +@import MAMapKit; + +@interface AnimatedAnnotation : NSObject + +@property (nonatomic, assign) CLLocationCoordinate2D coordinate; + +@property (nonatomic, copy) NSString *title; +@property (nonatomic, copy) NSString *subtitle; + +@property (nonatomic, strong) NSArray *animatedImages; + +- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/AnimatedAnnotation.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/AnimatedAnnotation.m new file mode 100755 index 0000000..dec466c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/AnimatedAnnotation.m @@ -0,0 +1,30 @@ +// +// AnimatedAnnotation.m +// Category_demo2D +// +// Created by 刘博 on 13-11-8. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "AnimatedAnnotation.h" + +@implementation AnimatedAnnotation + +@synthesize title = _title; +@synthesize subtitle = _subtitle; +@synthesize coordinate = _coordinate; + +@synthesize animatedImages = _animatedImages; + +#pragma mark - life cycle + +- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate +{ + if (self = [super init]) + { + self.coordinate = coordinate; + } + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/MATrackPointAnnotation.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/MATrackPointAnnotation.h new file mode 100644 index 0000000..172609e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/MATrackPointAnnotation.h @@ -0,0 +1,19 @@ +// +// MATrackPointAnnotation.h +// TrackMapDemo +// +// Created by zuola on 2019/5/13. +// Copyright © 2019 zuola. All rights reserved. +// + +@import Foundation; +@import MAMapKit; + +NS_ASSUME_NONNULL_BEGIN + +@interface MATrackPointAnnotation : MAPointAnnotation +@property (nonatomic, assign) NSInteger type;//0-gas,1-service,2-Violation + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/MATrackPointAnnotation.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/MATrackPointAnnotation.m new file mode 100644 index 0000000..5e28c26 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/model/MATrackPointAnnotation.m @@ -0,0 +1,13 @@ +// +// MATrackPointAnnotation.m +// TrackMapDemo +// +// Created by zuola on 2019/5/13. +// Copyright © 2019 zuola. All rights reserved. +// + +#import "MATrackPointAnnotation.h" + +@implementation MATrackPointAnnotation + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/AnimatedAnnotationView.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/AnimatedAnnotationView.h new file mode 100755 index 0000000..02ac32e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/AnimatedAnnotationView.h @@ -0,0 +1,16 @@ +// +// AnimatedAnnotationView.h +// Category_demo2D +// +// Created by 刘博 on 13-11-8. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +@import Foundation; +@import MAMapKit; + +@interface AnimatedAnnotationView : MAAnnotationView + +@property (nonatomic, strong) UIImageView *imageView; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/AnimatedAnnotationView.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/AnimatedAnnotationView.m new file mode 100755 index 0000000..3fc1ab6 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/AnimatedAnnotationView.m @@ -0,0 +1,64 @@ +// +// AnimatedAnnotationView.m +// Category_demo2D +// +// Created by 刘博 on 13-11-8. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "AnimatedAnnotationView.h" +#import "AnimatedAnnotation.h" + +#define kWidth 60.f +#define kHeight 60.f +#define kTimeInterval 0.15f + +@implementation AnimatedAnnotationView + +@synthesize imageView = _imageView; + +#pragma mark - Life Cycle + +- (id)initWithAnnotation:(id)annotation reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]; + + if (self) + { + [self setBounds:CGRectMake(0.f, 0.f, kWidth, kHeight)]; + [self setBackgroundColor:[UIColor clearColor]]; + + self.imageView = [[UIImageView alloc] initWithFrame:self.bounds]; + [self addSubview:self.imageView]; + } + + return self; +} + +#pragma mark - Utility + +- (void)updateImageView +{ + AnimatedAnnotation *animatedAnnotation = (AnimatedAnnotation *)self.annotation; + + if ([self.imageView isAnimating]) + { + [self.imageView stopAnimating]; + } + + self.imageView.animationImages = animatedAnnotation.animatedImages; + self.imageView.animationDuration = kTimeInterval * [animatedAnnotation.animatedImages count]; + self.imageView.animationRepeatCount = 0; + [self.imageView startAnimating]; +} + +#pragma mark - Override + +- (void)setAnnotation:(id)annotation +{ + [super setAnnotation:annotation]; + + [self updateImageView]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomAnnotationView.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomAnnotationView.h new file mode 100755 index 0000000..9ebc288 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomAnnotationView.h @@ -0,0 +1,20 @@ +// +// CustomAnnotationView.h +// CustomAnnotationDemo +// +// Created by songjian on 13-3-11. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +@import UIKit; +@import MAMapKit; + +@interface CustomAnnotationView : MAAnnotationView + +@property (nonatomic, copy) NSString *name; + +@property (nonatomic, strong) UIImage *portrait; + +@property (nonatomic, strong) UIView *calloutView; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomAnnotationView.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomAnnotationView.m new file mode 100755 index 0000000..568ce65 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomAnnotationView.m @@ -0,0 +1,166 @@ +// +// CustomAnnotationView.m +// CustomAnnotationDemo +// +// Created by songjian on 13-3-11. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "CustomAnnotationView.h" +#import "CustomCalloutView.h" + +#define kWidth 30 +#define kHeight 30.f + +#define kHoriMargin 5.f +#define kVertMargin 5.f + +#define kPortraitWidth 50.f +#define kPortraitHeight 50.f + +#define kCalloutWidth 200.0 +#define kCalloutHeight 70.0 + +@interface CustomAnnotationView () + +@property (nonatomic, strong) UIImageView *portraitImageView; +@property (nonatomic, strong) UILabel *nameLabel; + +@end + +@implementation CustomAnnotationView + +@synthesize calloutView; +@synthesize portraitImageView = _portraitImageView; +@synthesize nameLabel = _nameLabel; + +#pragma mark - Handle Action + +- (void)btnAction +{ + CLLocationCoordinate2D coorinate = [self.annotation coordinate]; + + NSLog(@"coordinate = {%f, %f}", coorinate.latitude, coorinate.longitude); +} + +#pragma mark - Override + +- (NSString *)name +{ + return self.nameLabel.text; +} + +- (void)setName:(NSString *)name +{ + self.nameLabel.text = name; +} + +- (UIImage *)portrait +{ + return self.portraitImageView.image; +} + +- (void)setPortrait:(UIImage *)portrait +{ + self.portraitImageView.image = portrait; +} + +- (void)setSelected:(BOOL)selected +{ + [self setSelected:selected animated:NO]; +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated +{ + if (self.selected == selected) + { + return; + } + + if (selected) + { + if (self.calloutView == nil) + { + /* Construct custom callout. */ + self.calloutView = [[CustomCalloutView alloc] initWithFrame:CGRectMake(0, 0, kCalloutWidth, kCalloutHeight)]; + self.calloutView.center = CGPointMake(CGRectGetWidth(self.bounds) / 2.f + self.calloutOffset.x, + -CGRectGetHeight(self.calloutView.bounds) / 2.f + self.calloutOffset.y); + + UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + btn.frame = CGRectMake(10, 10, 40, 30); + [btn setTitle:@"" forState:UIControlStateNormal]; + [btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; + [btn setBackgroundColor:[UIColor whiteColor]]; +// btn.titleLabel.font = SYSTEMFONT(13) +// btn.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; + [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside]; + + [self.calloutView addSubview:btn]; + + UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(60, 10, 120, 40)]; + name.backgroundColor = [UIColor clearColor]; + name.textColor = [UIColor whiteColor]; + name.numberOfLines = 0; + name.font = SYSTEMFONT(13); + name.text = self.name; + + [self.calloutView addSubview:name]; + } + + [self addSubview:self.calloutView]; + } + else + { + [self.calloutView removeFromSuperview]; + } + + [super setSelected:selected animated:animated]; +} + +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event +{ + BOOL inside = [super pointInside:point withEvent:event]; + /* Points that lie outside the receiver’s bounds are never reported as hits, + even if they actually lie within one of the receiver’s subviews. + This can occur if the current view’s clipsToBounds property is set to NO and the affected subview extends beyond the view’s bounds. + */ + if (!inside && self.selected) + { + inside = [self.calloutView pointInside:[self convertPoint:point toView:self.calloutView] withEvent:event]; + } + + return inside; +} + +#pragma mark - Life Cycle + +- (id)initWithAnnotation:(id)annotation reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]; + + if (self) + { + self.bounds = CGRectMake(0.f, 0.f, kWidth, kHeight); + + self.backgroundColor = [UIColor grayColor]; + + /* Create portrait image view and add to view hierarchy. */ + self.portraitImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kHoriMargin, kVertMargin, kPortraitWidth, kPortraitHeight)]; + [self addSubview:self.portraitImageView]; + + /* Create name label. */ + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kPortraitWidth + kHoriMargin, + kVertMargin, + kWidth - kPortraitWidth - kHoriMargin, + kHeight - 2 * kVertMargin)]; + self.nameLabel.backgroundColor = [UIColor clearColor]; + self.nameLabel.textAlignment = NSTextAlignmentCenter; + self.nameLabel.textColor = [UIColor whiteColor]; + self.nameLabel.font = [UIFont systemFontOfSize:15.f]; + [self addSubview:self.nameLabel]; + } + + return self; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomCalloutView.h b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomCalloutView.h new file mode 100755 index 0000000..9c106dc --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomCalloutView.h @@ -0,0 +1,13 @@ +// +// CustomCalloutView.h +// Category_demo2D +// +// Created by xiaoming han on 13-5-22. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import + +@interface CustomCalloutView : UIView + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomCalloutView.m b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomCalloutView.m new file mode 100755 index 0000000..0853fc5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/3DMAP/annotation/view/CustomCalloutView.m @@ -0,0 +1,70 @@ +// +// CustomCalloutView.m +// Category_demo2D +// +// Created by xiaoming han on 13-5-22. +// Copyright (c) 2013年 songjian. All rights reserved. +// + +#import "CustomCalloutView.h" +#import + +#define kArrorHeight 10 + +@implementation CustomCalloutView + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + } + return self; +} + +#pragma mark - draw rect + +- (void)drawRect:(CGRect)rect +{ + + [self drawInContext:UIGraphicsGetCurrentContext()]; + + self.layer.shadowColor = [[UIColor blackColor] CGColor]; + self.layer.shadowOpacity = 1.0; + self.layer.shadowOffset = CGSizeMake(0.0f, 0.0f); + +} + +- (void)drawInContext:(CGContextRef)context +{ + + CGContextSetLineWidth(context, 2.0); + CGContextSetFillColorWithColor(context, [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.8].CGColor); + + [self getDrawPath:context]; + CGContextFillPath(context); + +} + +- (void)getDrawPath:(CGContextRef)context +{ + CGRect rrect = self.bounds; + CGFloat radius = 6.0; + CGFloat minx = CGRectGetMinX(rrect), + midx = CGRectGetMidX(rrect), + maxx = CGRectGetMaxX(rrect); + CGFloat miny = CGRectGetMinY(rrect), + maxy = CGRectGetMaxY(rrect)-kArrorHeight; + + CGContextMoveToPoint(context, midx+kArrorHeight, maxy); + CGContextAddLineToPoint(context,midx, maxy+kArrorHeight); + CGContextAddLineToPoint(context,midx-kArrorHeight, maxy); + + CGContextAddArcToPoint(context, minx, maxy, minx, miny, radius); + CGContextAddArcToPoint(context, minx, minx, maxx, miny, radius); + CGContextAddArcToPoint(context, maxx, miny, maxx, maxx, radius); + CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, radius); + CGContextClosePath(context); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/DashesLineView.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/DashesLineView.h new file mode 100644 index 0000000..6c765df --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/DashesLineView.h @@ -0,0 +1,15 @@ +// +// DashesLineView.h +// CustomGraphView +// +// Created by Saborka on 3/1/2017. +// https://github.com/Saborka/CustomGraphView +// + +#import + +@interface DashesLineView : UIView + +@property(nonatomic, strong) UIColor *lineColor;//虚线颜色 + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/DashesLineView.m b/XinjiangProject/XinjiangProject/Utils/CustomGraph/DashesLineView.m new file mode 100644 index 0000000..d502089 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/DashesLineView.m @@ -0,0 +1,65 @@ +// +// DashesLineView.m +// CustomGraphView +// +// Created by Saborka on 3/1/2017. +// https://github.com/Saborka/CustomGraphView +// + +#import "DashesLineView.h" +#import + +@implementation DashesLineView + +- (id)initWithFrame:(CGRect)frame +{ + self= [super initWithFrame:frame]; + if(self) { + // Initialization code + [self setup]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + [self setup]; + } + return self; +} + +- (void)setup +{ + self.lineColor = [UIColor colorWithWhite:0.898 alpha:1.000]; + self.backgroundColor = [UIColor clearColor]; +} + +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect +{ + CAShapeLayer *shapeLayer = [CAShapeLayer layer]; + [shapeLayer setBounds:self.bounds]; + [shapeLayer setPosition:CGPointMake(CGRectGetWidth(self.frame) / 2, CGRectGetHeight(self.frame))]; + [shapeLayer setFillColor:[UIColor clearColor].CGColor]; + // 设置虚线颜色为blackColor + [shapeLayer setStrokeColor:self.lineColor.CGColor]; + // 设置虚线宽度 + [shapeLayer setLineWidth:CGRectGetHeight(self.frame)]; + [shapeLayer setLineJoin:kCALineJoinRound]; + // 设置线宽,线间距 + [shapeLayer setLineDashPattern:[NSArray arrayWithObjects:[NSNumber numberWithInt:5], [NSNumber numberWithInt:3], nil]]; + // 设置路径 + CGMutablePathRef path = CGPathCreateMutable(); + CGPathMoveToPoint(path, NULL, 0, 0); + CGPathAddLineToPoint(path, NULL, CGRectGetWidth(self.frame), 0); + [shapeLayer setPath:path]; + CGPathRelease(path); + // 把绘制好的虚线添加上来 + [self.layer addSublayer:shapeLayer]; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphBar.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphBar.h new file mode 100644 index 0000000..9bf52dd --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphBar.h @@ -0,0 +1,16 @@ +// +// GraphBar.h +// mworkingHaier +// +// Created by Saborka on 27/12/2016. +// Chttps://github.com/Saborka/CustomGraphView +// + +#import + +@interface GraphBar : UIView + +@property (strong, nonatomic) UIColor *barColor; +@property (assign, nonatomic) CGFloat barValue; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphBar.m b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphBar.m new file mode 100644 index 0000000..9436ff9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphBar.m @@ -0,0 +1,73 @@ +// +// GraphBar.m +// mworkingHaier +// +// Created by Saborka on 27/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import "GraphBar.h" + +@interface GraphBar () + +@property (strong, nonatomic) CAShapeLayer *shapeLayer; + +@end + +@implementation GraphBar + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + _shapeLayer = [CAShapeLayer layer]; + _shapeLayer.lineCap = kCALineCapButt; + _shapeLayer.fillColor = [[UIColor whiteColor] CGColor]; + _shapeLayer.lineWidth = self.frame.size.width; + _shapeLayer.strokeEnd = 0.0; + self.clipsToBounds = YES; + [self.layer addSublayer:_shapeLayer]; + } + return self; +} + +- (void)setBarColor:(UIColor *)barColor +{ + _barColor = barColor; + _shapeLayer.strokeColor = barColor.CGColor; +} + +- (void)setBarValue:(CGFloat)barValue +{ + _barValue = barValue; + + UIBezierPath *barLine = [UIBezierPath bezierPath]; + [barLine moveToPoint:CGPointMake(self.width/2.0, self.height)]; + [barLine addLineToPoint:CGPointMake(self.width/2.0, (1 - barValue) * self.height)]; + + [barLine setLineWidth:1.0]; + [barLine setLineCapStyle:kCGLineCapSquare]; + _shapeLayer.path = barLine.CGPath; + if (_barColor) { + _shapeLayer.strokeColor = [_barColor CGColor]; + } + + CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; + pathAnimation.duration = 1.0; + pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; + pathAnimation.toValue = [NSNumber numberWithFloat:1.0f]; + [_shapeLayer addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; + + _shapeLayer.strokeEnd = 1.0; +} + +- (void)drawRect:(CGRect)rect +{ + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor); + CGContextFillRect(context, rect); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphConstants.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphConstants.h new file mode 100644 index 0000000..0daa07b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphConstants.h @@ -0,0 +1,82 @@ +// +// GraphConstants.h +// mworkingHaier +// +// Created by Saborka on 27/12/2016. +// Chttps://github.com/Saborka/CustomGraphView +// + +#ifndef GraphConstants_h +#define GraphConstants_h + +/** + * 图总共高度 + */ +#define GraphTotalHeight 221 + +/** + * X轴 底部高度 + */ +#define GraphXBottomHeight 20 + +/** + * 各种颜色 + */ + +#define LineBlueColor RGBA(90,189, 252,1) +#define LinePurpleColor RGBA(235,115, 246,1) +#define LineOrangeColor RGBA(253,114, 144,1) +#define BarYellowColor RGBA(253,186, 113, 0.8) +#define BarBlueColor RGBA(51,206, 245, 0.8) + +#define LineBlueAlphaColor RGBA(90, 189, 252, 0.8) +#define LinePurpleAlphaColor RGBA(235,115, 246, 0.8) +#define LineOrangeAlphaColor RGBA(253,114, 144, 0.5) +#define BarYellowAlphaColor RGBA(253,186, 113, 0.8) +#define BarBlueAlphaColor RGBA(51,206, 245, 0.8) + +/** + * 柱状图宽度和柱状图之前间距 + */ +#define GraphBarWidthAndGap 12 + +/** + * 折线固定宽度 + */ + +#define GraphLineWidth 2 + +/** + * X,Y轴坐标字号 + */ +#define GraphFontSize 12 + +/** + * Y轴标题以及水平线颜色 + */ +#define GraphYAxisFontColor UIColorHex(0xdbdbdb) + +/** + * X轴标题颜色 + */ +#define GraphXAxisFontColor UIColorHex(0xb3b3b3) +#define GraphXAxisHighlightFontColor RGBA(33,33, 33,1) + +#define BaseCoverTag 1000 +#define BaseDotTag 10000 +#define BasePopTag 500 +#define BaseXAxisTag 200 + + +/** + * 圆环的半径,描边 + */ +#define DotRadius 6 +#define DotBorderWidth 1.5 + +/** + * 圆环和浮层间距 + */ +#define GapBetweenDotAndPop 20 + +#endif /* GraphConstants_h */ diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphDot.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphDot.h new file mode 100644 index 0000000..ddcb420 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphDot.h @@ -0,0 +1,19 @@ +// +// GraphDot.h +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import + +@interface GraphDot : UIView + +- (instancetype)initWithCenter:(CGPoint)center + radius:(CGFloat)radius + borderColor:(UIColor *)borderColor; + +@property (assign, nonatomic) CGFloat dotBorderWidth; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphDot.m b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphDot.m new file mode 100644 index 0000000..0072b05 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphDot.m @@ -0,0 +1,38 @@ +// +// GraphDot.m +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import "GraphDot.h" + +@interface GraphDot () + +@end + +@implementation GraphDot + +- (instancetype)initWithCenter:(CGPoint)center + radius:(CGFloat)radius + borderColor:(UIColor *)borderColor +{ + self = [super init]; + if (self) { + self.frame = CGRectMake(center.x - radius, center.y - radius, radius * 2.0, radius * 2.0); + self.backgroundColor = [UIColor whiteColor]; + self.layer.masksToBounds = YES; + self.layer.cornerRadius = radius; + self.layer.borderColor = borderColor.CGColor; + } + return self; +} + +- (void)setDotBorderWidth:(CGFloat)dotBorderWidth +{ + _dotBorderWidth = dotBorderWidth; + self.layer.borderWidth = dotBorderWidth; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphLine.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphLine.h new file mode 100644 index 0000000..41afa3f --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphLine.h @@ -0,0 +1,38 @@ +// +// GraphLine.h +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import +#import "GraphPopView.h" +#import "GraphDot.h" + +@class GraphLine; + +@protocol GraphCurrentSelectDelegate + +@optional + +//当前高亮 +- (void)graphLineView:(GraphLine *)graphLine currentSelectIndex:(NSInteger)index; + +@end + +@interface GraphLine : UIView + +@property (weak, nonatomic) id delegate; +@property (strong, nonatomic) GraphDot *dot; +@property (strong, nonatomic) GraphPopView *pop; +@property (strong, nonatomic) UIColor *lineColor; +@property (strong, nonatomic) UIColor *lineAlphaColor; +@property (assign, nonatomic) CGFloat lineWidth; +@property (strong, nonatomic) NSArray *valueArray; +@property (assign, nonatomic) CGFloat xScaleLength; +@property (assign, nonatomic) CGFloat maxValue; + +- (void)reloadDataWithAnimation:(BOOL)animation; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphLine.m b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphLine.m new file mode 100644 index 0000000..9fcee24 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphLine.m @@ -0,0 +1,191 @@ +// +// GraphLine.m +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import "GraphLine.h" +#import "GraphDot.h" +#import "GraphConstants.h" + +@interface GraphLine () + +/** + * 存储折线上每个点,方便后续处理 + */ +@property (strong, nonatomic) NSMutableArray *pointArray; +@property (strong, nonatomic) CAShapeLayer *shapeLayer; +@property (assign, nonatomic) NSInteger lastSelectIndex; + +@end + +@implementation GraphLine + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.lastSelectIndex = -1; + } + return self; +} + +- (void)reloadDataWithAnimation:(BOOL)animation +{ + [self clear]; + [self drawLine]; + [self drawGradient]; + [self createCovers]; +} + +/** + * 画折线图 + */ +- (void)drawLine +{ + self.pointArray = [NSMutableArray array]; + UIBezierPath *linePath = [[UIBezierPath alloc] init]; + for (int i = 0; i < self.valueArray.count; i++) { + CGFloat pointX = self.xScaleLength * i; + CGFloat value = [self.valueArray[i] floatValue]; + CGFloat percent = value / self.maxValue; + CGFloat pointY = (1 - percent) * GraphTotalHeight; + CGPoint point = CGPointMake(pointX, pointY); + [self.pointArray addObject:[NSValue valueWithCGPoint:point]]; + + if (i == 0) { + [linePath moveToPoint:point]; + } else { + [linePath addLineToPoint:point]; + } + } + _shapeLayer = [CAShapeLayer layer]; + _shapeLayer.zPosition = 0.0f; + _shapeLayer.strokeColor = _lineColor.CGColor; + _shapeLayer.lineWidth = _lineWidth; + _shapeLayer.lineCap = kCALineCapRound; + _shapeLayer.lineJoin = kCALineJoinRound; + _shapeLayer.frame = self.frame; + _shapeLayer.fillColor = [UIColor clearColor].CGColor; + _shapeLayer.path = linePath.CGPath; + [self.layer addSublayer:_shapeLayer]; + +} + +- (void)drawGradient +{ + /** + * 添加渐变色 + */ + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.frame = self.bounds; + gradientLayer.colors = @[(__bridge id)_lineAlphaColor.CGColor,(__bridge id)[UIColor colorWithWhite:1 alpha:0.1].CGColor]; + + gradientLayer.locations= @[@0.0,@1.0]; + gradientLayer.startPoint = CGPointMake(0.0,0.0); + gradientLayer.endPoint = CGPointMake(0.0,1); + + UIBezierPath *gradientPath = [[UIBezierPath alloc] init]; + //渐变面积的第一个点和最后一个点都是对应折线点最下面的点,中间的点与折线上的点相同 + [gradientPath moveToPoint:CGPointMake(0, GraphTotalHeight)]; + + for (int i = 0; i < self.pointArray.count; i ++) { + [gradientPath addLineToPoint:[self.pointArray[i] CGPointValue]]; + } + + CGPoint endPoint = [[self.pointArray lastObject] CGPointValue]; + endPoint = CGPointMake(endPoint.x, GraphTotalHeight); + [gradientPath addLineToPoint:endPoint]; + CAShapeLayer *arc = [CAShapeLayer layer]; + arc.path = gradientPath.CGPath; + gradientLayer.mask = arc; + [self.layer addSublayer:gradientLayer]; +} + +/** + * 分散一个个的可点击区域 + */ +- (void)createCovers +{ + for (int i = 0; i < self.pointArray.count; i++) { + UIView *cover = [[UIView alloc] init]; + cover.tag = BaseCoverTag + i; + + if (i == 0) { + cover.frame = CGRectMake(0, 0, self.xScaleLength / 2, GraphTotalHeight); + [self addSubview:cover]; + } + else if (i == self.pointArray.count - 1) { + CGPoint lastPoint = [[self.pointArray objectAtIndex:i] CGPointValue]; + cover.frame = CGRectMake(lastPoint.x - self.xScaleLength / 2, 0, self.xScaleLength / 2, GraphTotalHeight); + [self addSubview:cover]; + } + else { + CGPoint point = [[self.pointArray objectAtIndex:i] CGPointValue]; + cover.frame = CGRectMake(point.x - self.xScaleLength / 2, 0, self.xScaleLength, GraphTotalHeight); + [self addSubview:cover]; + } + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(coverTapped:)]; + [cover addGestureRecognizer:tap]; + } +} + +- (void)coverTapped:(UITapGestureRecognizer *)tap +{ + NSInteger index = tap.view.tag - BaseCoverTag; + CGPoint point = [[self.pointArray objectAtIndex:index] CGPointValue]; + + if (self.delegate && [self.delegate respondsToSelector:@selector(graphLineView:currentSelectIndex:)]) { + [self.delegate graphLineView:self currentSelectIndex:index]; + } + + /** + * 圆环及浮层 + */ + + if (self.lastSelectIndex != -1) { + GraphDot *lastDot = (GraphDot *)[self viewWithTag:BaseDotTag + self.lastSelectIndex]; + [lastDot removeFromSuperview]; + + GraphPopView *lastPop = (GraphPopView *)[self viewWithTag:BasePopTag + self.lastSelectIndex]; + [lastPop removeFromSuperview]; + } + + GraphDot *dot = [[GraphDot alloc] initWithCenter:point radius:DotRadius borderColor:self.lineColor]; + dot.tag = BaseDotTag + index; + dot.dotBorderWidth = 1.5; + [self addSubview:dot]; + + GraphPopView *pop = [[GraphPopView alloc] initWithFrame:CGRectZero bgColor:self.lineColor string:[self.valueArray objectAtIndex:index]]; + pop.center = point; + + CGFloat popY = point.y + GapBetweenDotAndPop; + if (popY + pop.height > GraphTotalHeight - GraphXBottomHeight) { //如果pop底端超过x坐标 就把popview放在dot上面 + popY = popY - 3 * GapBetweenDotAndPop; + } + pop.top = popY; + pop.tag = index + BasePopTag; + + [self addSubview:pop]; + + self.lastSelectIndex = index; +} + +/** + * 移除圆环,浮层 + */ +- (void)clear +{ + for (UIView *subView in self.subviews) { + [subView removeFromSuperview]; + } + + for (CALayer *subLayer in self.layer.sublayers) { + [subLayer removeFromSuperlayer]; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphPopView.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphPopView.h new file mode 100644 index 0000000..a7b00d3 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphPopView.h @@ -0,0 +1,18 @@ +// +// GraphPopView.h +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import + +@interface GraphPopView : UIView + +- (instancetype)initWithFrame:(CGRect)frame + bgColor:(UIColor *)bgColor + string:(NSString *)string; + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphPopView.m b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphPopView.m new file mode 100644 index 0000000..44a48ba --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphPopView.m @@ -0,0 +1,70 @@ + +// +// GraphPopView.m +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import "GraphPopView.h" + +static CGFloat const popHeight = 25; + +@interface GraphPopView () + +@property (strong, nonatomic) UIColor *bgColor; +@property (strong, nonatomic) NSString *numberString; +@property (strong, nonatomic) UILabel *numberLabel; + +@end + +@implementation GraphPopView + +- (instancetype)initWithFrame:(CGRect)frame + bgColor:(UIColor *)bgColor + string:(NSString *)string +{ + self = [super initWithFrame:frame]; + if (self) { + _numberString = string; + _bgColor = bgColor; + [self uiConfig]; + } + return self; +} + +- (void)uiConfig +{ + self.backgroundColor = _bgColor; + CGFloat width = [self getWidthWithString:[NSString stringWithFormat:@"%@人",_numberString] withSize:CGSizeMake(kScreenWidth , popHeight) font:[UIFont fontWithName:@"PingFangSC-Regular" size:12]]; + self.width = width + 20; + self.height = popHeight; + [self addSubview:self.numberLabel]; +} + +//获得label宽度 +- (CGFloat)getWidthWithString:(NSString *)string withSize:(CGSize)size font:(UIFont *)font +{ + if (!string.length) { + return 0; + } + + float width = [string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil].size.width; + width = ceilf(width); + return width; +} + +- (UILabel *)numberLabel +{ + if (!_numberLabel) { + _numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, popHeight)]; + _numberLabel.textColor = [UIColor whiteColor]; + _numberLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:12]; + _numberLabel.text = [NSString stringWithFormat:@"%@人",_numberString] ; + _numberLabel.textAlignment = NSTextAlignmentCenter; + } + return _numberLabel; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphView.h b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphView.h new file mode 100644 index 0000000..4a32853 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphView.h @@ -0,0 +1,71 @@ +// +// GraphView.h +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import + +@interface GraphView : UIView + +/** + * X轴 坐标数据 + */ +@property (strong, nonatomic) NSArray *xTitleArray; + +/** + * Y轴 坐标数据 + */ +@property (strong, nonatomic) NSArray *yTitleArray; + +/** + * 目标,实际折线图数据,bar数据 + */ +@property (strong, nonatomic) NSArray *targetValues; +@property (strong, nonatomic) NSArray *actualValues; +@property (strong, nonatomic) NSArray *targetBarValues; +@property (strong, nonatomic) NSArray *actualBarValues; + +/** + * 有木有柱状图 + */ +@property (assign, nonatomic) BOOL needBar; + +/** + * 是成交还是回款,折线图颜色不同 + */ +@property (assign, nonatomic) BOOL isDeal; + +/** + * X轴 单位长度 + */ +@property (assign, nonatomic) CGFloat xScaleLength; + +/** + * Y轴 最大值 + */ +@property (assign, nonatomic) CGFloat yMaxValue; + +/** + * 画图 + */ +- (void)drawGraph; + +/** + * 刷数据 + */ +- (void)reloadData; + +/* + 折线图颜色 + */ +@property (assign, nonatomic) UIColor * chatLineColor; + +@property (assign, nonatomic) UIColor * shardColor; + +@property (assign, nonatomic) UIColor * popColor; + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphView.m b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphView.m new file mode 100644 index 0000000..eabeef1 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/CustomGraph/GraphView.m @@ -0,0 +1,217 @@ + +// +// GraphView.m +// mworkingHaier +// +// Created by Saborka on 26/12/2016. +// https://github.com/Saborka/CustomGraphView +// + +#import "GraphView.h" +#import "DashesLineView.h" +#import "GraphLine.h" +#import "GraphConstants.h" +#import "GraphBar.h" + + +@interface GraphView () + +@property (strong, nonatomic) UIScrollView *scrollView; +/** + * 目标 折线 + */ +@property (strong, nonatomic) GraphLine *targetLine; + +/** + * 实际折线 + */ +@property (strong, nonatomic) GraphLine *actualLine; + +//X轴底部view +@property (strong, nonatomic) UIView *bottomView; + + +@end + +@implementation GraphView + +- (void)drawGraph +{ + self.width = [UIScreen mainScreen].bounds.size.width; + self.height = GraphTotalHeight; + [self addSubview:self.scrollView]; + [self drawGrid]; + [self drawLine]; + if (_needBar) { + [self drawBar]; + } +} + +/** + * 先画格子 + */ + +- (void)drawGrid +{ + [self drawXAxis]; + [self drawYAxis]; +} + +/** + * 画x坐标 + */ + +- (void)drawXAxis +{ + //底部 + self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.height - GraphXBottomHeight, kScreenWidth, GraphXBottomHeight)]; + self.bottomView.backgroundColor = KRedColor; + + //分割线 + UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0.5)]; + lineView.backgroundColor = UIColorHex(0xf5f5f5); + [self.bottomView addSubview:lineView]; +// + [self.scrollView addSubview:self.bottomView]; + + for (int i = 0; i < _xTitleArray.count; i++) { + UILabel *axisLabel = [self createAxisLabelIsXaxis:YES]; + axisLabel.tag = BaseXAxisTag + i; + axisLabel.text = [_xTitleArray objectAtIndex:i]; + axisLabel.left = _xScaleLength * i; + [self.bottomView addSubview:axisLabel]; + + DashesLineView *line = [[DashesLineView alloc] initWithFrame:CGRectMake( _xScaleLength * i, 0, 1, GraphTotalHeight)]; + [self addSubview:line]; + [self sendSubviewToBack:line]; + + } +} + +/** + * 画y坐标 + */ + +- (void)drawYAxis +{ + for (int i = 0; i < _yTitleArray.count; i++) { + //水平辅助线 + DashesLineView *line = [[DashesLineView alloc] initWithFrame:CGRectMake(52 , GraphTotalHeight / _yTitleArray.count * i - 10, kScreenWidth - 104, 1)]; + [self addSubview:line]; + [self sendSubviewToBack:line]; + +// //字 +// if (i > 0) { + UILabel *numLabel = [self createAxisLabelIsXaxis:NO]; + numLabel.top = line.top - 19; + numLabel.text = [_yTitleArray objectAtIndex:i]; + [self addSubview:numLabel]; + [self sendSubviewToBack:numLabel]; +// } + } +} + +- (UILabel *)createAxisLabelIsXaxis:(BOOL)xAxis +{ + CGFloat left = xAxis ? 0 : 15; + CGFloat width = xAxis ? _xScaleLength : kScreenWidth - 50 - 10; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(left, 0, width, GraphXBottomHeight)]; + label.textColor = xAxis ? GraphXAxisFontColor : GraphYAxisFontColor; + label.font = [UIFont fontWithName:@"PingFangSC-Regular" size:GraphFontSize]; + label.textAlignment = xAxis ? NSTextAlignmentCenter : NSTextAlignmentLeft; + return label; + +} + +- (void)reloadData +{ + +} + +/** + * 画折线 + */ + +- (void)drawLine +{ + self.targetLine = [self createLineIsTarget:YES]; + self.actualLine = [self createLineIsTarget:NO]; + [self.scrollView addSubview:self.targetLine]; + [self.scrollView addSubview:self.actualLine]; + [self.targetLine reloadDataWithAnimation:YES]; + [self.actualLine reloadDataWithAnimation:YES]; +} + +- (GraphLine *)createLineIsTarget:(BOOL)isTarget +{ + GraphLine *line = [[GraphLine alloc] initWithFrame:CGRectMake(0, 0, self.scrollView.contentSize.width, self.scrollView.contentSize.height - GraphXBottomHeight)]; + line.delegate = self; + line.xScaleLength = self.xScaleLength; + line.lineWidth = 2; + line.maxValue = self.yMaxValue; + if (isTarget) { + line.lineColor = self.chatLineColor; + line.lineAlphaColor = LineBlueAlphaColor; + line.valueArray = self.targetValues; + } else { + line.lineColor = self.isDeal ? LinePurpleColor : self.chatLineColor; + line.lineAlphaColor = self.isDeal ? LinePurpleAlphaColor : self.chatLineColor; + line.valueArray = self.actualValues; + } + return line; +} + +/** + * 画柱状图 + */ +- (void)drawBar +{ + /* + CGFloat targetX = (self.xScaleLength - 3*GraphBarWidthAndGap) / 2; + CGFloat actualX = targetX + GraphBarWidthAndGap * 2; + for (int i = 0; i < self.targetBarValues.count; i++) { + GraphBar *targetBar = [[GraphBar alloc] initWithFrame:CGRectMake(targetX + self.xScaleLength * i, 0, GraphBarWidthAndGap, self.height - GraphXBottomHeight-1)]; + targetBar.barColor = BarBlueColor; + CGFloat targetValue = [[self.targetBarValues objectAtIndex:i] floatValue] / self.yMaxValue; + targetBar.barValue = targetValue; + [_scrollView addSubview:targetBar]; + } + + for (int i = 0; i < self.actualBarValues.count; i++) { + GraphBar *actualBar = [[GraphBar alloc] initWithFrame:CGRectMake(actualX+ self.xScaleLength * i, 0, GraphBarWidthAndGap, self.height - GraphXBottomHeight-1)]; + actualBar.barColor = BarYellowColor; + CGFloat actualValue = [[self.actualBarValues objectAtIndex:i] floatValue] / self.yMaxValue; + actualBar.barValue = actualValue; + [_scrollView addSubview:actualBar]; + } + */ +} + +//高亮当前的x轴 +- (void)graphLineView:(GraphLine *)graphLine currentSelectIndex:(NSInteger)index +{ + + for (int i = 0; i < self.xTitleArray.count; i++) { + UILabel *label = (UILabel *)[self.bottomView viewWithTag:i + BaseXAxisTag]; + if (i == index) { + [label setTextColor:GraphXAxisHighlightFontColor]; + } else { + [label setTextColor:GraphXAxisFontColor]; + } + } +} + +- (UIScrollView *)scrollView +{ + if (!_scrollView) { + _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(52 , 0, self.width, self.height)]; + _scrollView.minimumZoomScale = 0.5; + _scrollView.maximumZoomScale = 2; + _scrollView.showsHorizontalScrollIndicator = NO; + _scrollView.delegate = self; + _scrollView.contentSize = CGSizeMake(_xScaleLength * _xTitleArray.count, self.height); + } + return _scrollView; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/HQCommonUtils.h b/XinjiangProject/XinjiangProject/Utils/HQCommonUtils.h new file mode 100644 index 0000000..c324089 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/HQCommonUtils.h @@ -0,0 +1,110 @@ +// +// HQCommonUtils.h +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQCommonUtils : NSObject + + + +/** + * 判断APP是否第一次运行。使用UserDefault来记录的,key为RunCount + * @return 返回BOOL值。YES表示第一次运行APP,NO相反 + */ ++ (BOOL)isFirstRunApp; + +/** + * 判断用户是否第一次登录。使用UserDefault来记录的,key为LoginCount + * @return 返回BOOL值。YES表示第一次登录,NO相反 + */ ++ (BOOL)isFirstLogin; + +/** + * 判断APP是否登录 + */ ++ (BOOL)isLogin; + ++ (NSString *)loginID; + ++ (NSString *)loginToken; + ++ (NSString *)SFZHID; + ++ (NSString * )departId; + ++(BOOL)isMobileNumber:(nullable NSString *)mobileNum; + +//归档和解归档 ++ (void)keyedArchiverWithData:(nullable id)responseObject key:(NSString *)key; ++ (nullable id)keyedUnarchiverWithKey:(NSString *)key; +//编码问题 ++(NSString*)DataTOjsonString:(id)object; + + +//计算UILabel的高度(带有行间距的情况) ++(CGFloat)getSpaceLabelHeight:(UILabel *)label + withStr:(NSString*)str + withFont:(UIFont*)font + withWidth:(CGFloat)width + withLineSpacing:(CGFloat)linespace; + +//计算宽度 ++(CGFloat)getLengthFromText:(NSString *)text andFontSize:(CGFloat)fontSize; + + ++ (NSMutableAttributedString *)firstString:(NSString *)firstString + firstColor:(UIColor *)firstColor firstSize:(CGFloat)firstSize secondString:(NSString *)secondString secondColor:(UIColor *)secondColor secondSize:(CGFloat)secondSize + thirdString:(NSString *)thirdString thirdColor:(UIColor *)thirdColor thirdSize:(CGFloat)thirdSize; + +/* + 添加阴影 : 注意与贝塞尔裁圆 + */ ++ (void)addShadowToView:(UIView *)shadowView; + ++(UITextField*)createTextFieldWithplaceholder:(NSString*)placeholder passWord:(BOOL)YESorNO leftImageView:(UIView*)leftView isShowLeft:(BOOL)isLeft rightImageView:(UIView*)rightView isShowRight:(BOOL)isRigt Font:(float)font textColor:(UIColor *)color; + +// 文字添加图片 + ++ (NSMutableAttributedString *)inputString:(NSString *)infoString imageName:(NSString *)imageName atindex:(NSInteger)index; + + +/* + 获取当前控制器 + */ + ++ (UIViewController *)getCurrentVC; + +/* + 获取view所在的控制器 + */ + ++ (UIViewController *)viewControllerOfView:(UIView *)view; + + ++ (UIImage *)stringToImage:(NSString *)str; + +///将时间戳转为日期时间 + +/// @param timestamp 时间戳 + +/// @param dateFormat 日期样式 YYYY-MM-dd HH:mm:ss + ++ (NSString *)getTimeFromTimestamp:(NSInteger )timestamp andDateFormat:(NSString *)dateFormat; + +///将日期时间转为时间戳 ++ (NSString *)getTimestampFromTime:(NSString *)CurrentTime; + +//判断是否有中文 ++(BOOL)IsChinese:(NSString *)str; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Utils/HQCommonUtils.m b/XinjiangProject/XinjiangProject/Utils/HQCommonUtils.m new file mode 100644 index 0000000..22ecd8c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/HQCommonUtils.m @@ -0,0 +1,450 @@ +// +// HQCommonUtils.m +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "HQCommonUtils.h" +#import "HQUserInfo.h" + +@implementation HQCommonUtils + ++ (BOOL)isFirstRunApp +{ + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + NSInteger runCount = [ud integerForKey:@"RunCount"]; + if (0 == runCount) + { + [ud setInteger:++runCount forKey:@"RunCount"]; + [ud synchronize]; + return YES; + } + return NO; +} + ++ (BOOL)isFirstLogin +{ + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + NSInteger loginCount = [ud integerForKey:@"LoginCount"]; + if (0 == loginCount) + { + [ud setInteger:++loginCount forKey:@"LoginCount"]; + [ud synchronize]; + return YES; + } + return NO; +} + ++ (BOOL)isLogin +{ + if ([self keyedUnarchiverWithKey:LoginUserInfo] == nil) + { + return NO; + } + return YES; +} + + ++ (NSString *)loginID +{ + NSString *string = nil; + if ([self isLogin]) + { + HQUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.user_id]; + } + else + { + string = @""; + } + + + return string; +} + ++ (NSString *)loginToken { + + NSString *string = nil; + if ([self isLogin]) + { + HQUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.token]; + } + else + { + string = @"未登录"; + } + + + return string; +} + ++ (NSString *)SFZHID +{ + NSString *string = nil; + if ([self isLogin]) + { + HQUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.idCard]; + } + else + { + string = @""; + } + + + return string; +} + ++ (NSString * )departId { + + NSString *string = nil; + if ([self isLogin]) + { + HQUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.depart_id]; + } + else + { + string = @""; + } + + return string; +} + + ++(CGFloat)getLengthFromText:(NSString *)text andFontSize:(CGFloat)fontSize{ + NSDictionary *attrbute = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]}; + return [text boundingRectWithSize:CGSizeMake(MAXFLOAT, 50) + options:NSStringDrawingUsesLineFragmentOrigin attributes:attrbute context:nil].size.width;; +} +/*! + * @brief 把格式化的JSON格式的字符串转换成字典 + * @param jsonString JSON格式的字符串 + * @return 返回字典 + */ ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString +{ + if (jsonString == nil) { + return nil; + } + + NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; + NSError *err; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData + options:NSJSONReadingMutableContainers + error:&err]; + if(err) { + NSLog(@"json解析失败:%@",err); + return nil; + } + return dic; +} + + + ++(BOOL)isMobileNumber:(NSString *)mobileNum +{ + //手机号以13, 15,18,17开头,八个 \d 数字字符 + NSString *mobileRegex = @"[1][3456789][0-9]{9}"; + NSPredicate *mobilePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", mobileRegex]; + + return [mobilePredicate evaluateWithObject:mobileNum]; + +} + ++ (void)keyedArchiverWithData:(nullable id)responseObject key:(NSString *)key +{ + NSMutableData *saveData = [NSMutableData data]; + NSKeyedArchiver *keyedArchiver = [[NSKeyedArchiver alloc]initForWritingWithMutableData:saveData]; + [keyedArchiver encodeObject:responseObject forKey:key]; + [keyedArchiver finishEncoding]; + + // 获取沙盒目录 + NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:key]; + if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) + { + [[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil]; + } + //写到文件中 + [saveData writeToFile:fullPath atomically:YES]; +} ++ (nullable id)keyedUnarchiverWithKey:(NSString *)key +{ + // 获取数据目录 + NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:key]; + + NSData *saveData = [NSData dataWithContentsOfFile:fullPath]; + + NSKeyedUnarchiver *keyedUnarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:saveData]; + + return [keyedUnarchiver decodeObjectForKey:key]; +} ++(NSString*)DataTOjsonString:(id)object +{ + NSString *jsonString = nil; + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object + options:NSJSONWritingPrettyPrinted + error:&error]; + if (!jsonData) { + } else { + jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + } + return jsonString; +} +//计算UILabel的高度(带有行间距的情况) ++(CGFloat)getSpaceLabelHeight:(UILabel *)label + withStr:(NSString*)str + withFont:(UIFont*)font + withWidth:(CGFloat)width + withLineSpacing:(CGFloat)linespace{ + NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init]; + paraStyle.lineBreakMode = NSLineBreakByCharWrapping; + paraStyle.alignment = NSTextAlignmentLeft; + //设置行间距 + paraStyle.lineSpacing = linespace; + paraStyle.hyphenationFactor = 1.0; + paraStyle.firstLineHeadIndent = 0.0; + paraStyle.paragraphSpacingBefore = 0.0; + paraStyle.headIndent = 0; + paraStyle.tailIndent = 0; + //设置字间距 NSKernAttributeName:@1.5f + NSDictionary *dic = @{NSFontAttributeName:font, + NSParagraphStyleAttributeName:paraStyle, + NSKernAttributeName:@1.0f + }; + if(str.length < 1) { + str = @" "; + } + NSAttributedString *attributeStr = [[NSAttributedString alloc] initWithString:str attributes:dic]; + CGSize size = [str boundingRectWithSize:CGSizeMake(width, MAXFLOAT) + options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size; + return size.height; +} + ++ (NSMutableAttributedString *)firstString:(NSString *)firstString + firstColor:(UIColor *)firstColor firstSize:(CGFloat)firstSize secondString:(NSString *)secondString secondColor:(UIColor *)secondColor secondSize:(CGFloat)secondSize + thirdString:(NSString *)thirdString thirdColor:(UIColor *)thirdColor thirdSize:(CGFloat)thirdSize{ + + + + NSMutableAttributedString * firstPart = [[NSMutableAttributedString alloc] initWithString:firstString]; + NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:firstSize],NSForegroundColorAttributeName:firstColor}; + [firstPart setAttributes:firstAttributes range:NSMakeRange(0,firstPart.length)]; + + NSMutableAttributedString * secondPart = [[NSMutableAttributedString alloc] initWithString:secondString]; + NSDictionary * secondAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:secondSize],NSForegroundColorAttributeName:secondColor}; + [secondPart setAttributes:secondAttributes range:NSMakeRange(0,secondPart.length)]; + [firstPart appendAttributedString:secondPart]; + + NSMutableAttributedString * thirdPart = [[NSMutableAttributedString alloc] initWithString:thirdString]; + NSDictionary * thirdAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:thirdSize],NSForegroundColorAttributeName:thirdColor}; + [thirdPart setAttributes:thirdAttributes range:NSMakeRange(0,thirdPart.length)]; + [firstPart appendAttributedString:thirdPart]; + + + + return firstPart; +} + ++ (void)addShadowToView:(UIView *)shadowView { + + shadowView.layer.masksToBounds = NO; + shadowView.backgroundColor = [UIColor whiteColor]; + shadowView.layer.shadowColor = UIColorHex(#929292).CGColor; + shadowView.layer.shadowOffset = CGSizeMake(0, 4); + shadowView.layer.shadowOpacity = 0.15; + shadowView.layer.shadowRadius = 5; + shadowView.layer.cornerRadius = 8; + +} + ++(UITextField*)createTextFieldWithplaceholder:(NSString*)placeholder passWord:(BOOL)YESorNO leftImageView:(UIView*)leftView isShowLeft:(BOOL)isLeft rightImageView:(UIView*)rightView isShowRight:(BOOL)isRigt Font:(float)font textColor:(UIColor *)color +{ + UITextField*textField=[[UITextField alloc]init]; + //灰色提示框 + textField.placeholder=placeholder; + //文字对齐方式 + textField.textAlignment=NSTextAlignmentLeft; + textField.secureTextEntry=YESorNO; + + //边框 + //textField.borderStyle=UITextBorderStyleLine; + //键盘类型 + textField.returnKeyType=UIReturnKeyDone; + //关闭首字母大写 + textField.autocapitalizationType=NO; + //清除按钮 + textField.clearButtonMode=NO; + //左图片 + if (isLeft == true) { + + textField.leftView=leftView; + textField.leftViewMode=UITextFieldViewModeAlways; + } + if (isRigt == true) { + textField.rightView=rightView; + //编辑状态下一直存在 + textField.rightViewMode=UITextFieldViewModeAlways; + } + //右图片 + + //自定义键盘 + //textField.inputView + //字体 + textField.font=[UIFont systemFontOfSize:font]; + //字体颜色 + + textField.textColor = color; + + return textField; +} + ++ (NSMutableAttributedString *)inputString:(NSString *)infoString imageName:(NSString *)imageName atindex:(NSInteger)index { + + NSMutableAttributedString *attri =  [[NSMutableAttributedString alloc] initWithString:infoString]; + + NSTextAttachment *attch = [[NSTextAttachment alloc] init]; + + attch.image = [UIImage imageNamed:imageName]; + + attch.bounds = CGRectMake(0, 0, 14.5, 16); + + NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attch]; + + [attri insertAttributedString:string atIndex:index]; + + return attri; +} +/* + 获取当前控制器 + */ + ++ (UIViewController *)getCurrentVC { + + return [self currentViewControllerWithRootViewController:[self getKeyWindow].rootViewController]; + +} + ++ (UIWindow *)getKeyWindow { + if (@available(iOS 13.0, *)) { + for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) { + if (windowScene.activationState == UISceneActivationStateForegroundActive) { + for (UIWindow *window in windowScene.windows) { + if (window.isKeyWindow) { + return window; + break; + } + } + } + } + } + else { + return [UIApplication sharedApplication].keyWindow; + } + return nil; +} + ++ (UIViewController*)currentViewControllerWithRootViewController:(UIViewController*)rootViewController { + if (rootViewController.presentedViewController) { + UIViewController* presentedViewController = rootViewController.presentedViewController; + return [self currentViewControllerWithRootViewController:presentedViewController]; + } else if ([rootViewController isKindOfClass:[UINavigationController class]]) { + UINavigationController* navigationController = (UINavigationController*)rootViewController; + return [self currentViewControllerWithRootViewController:navigationController.visibleViewController]; + } else if ([rootViewController isKindOfClass:[UITabBarController class]]) { + UITabBarController *tabBarController = (UITabBarController *)rootViewController; + return [self currentViewControllerWithRootViewController:tabBarController.selectedViewController]; + } else { + return rootViewController; + } +} + ++ (UIViewController *)viewControllerOfView:(UIView *)view { + // 遍历响应者链。返回第一个找到视图控制器 + UIResponder *responder = view; + while ((responder = [responder nextResponder])){ + if ([responder isKindOfClass: [UIViewController class]]){ + return (UIViewController *)responder; + } + } + // 如果没有找到则返回nil + return nil; +} + + ++ (UIImage *)stringToImage:(NSString *)str { + + NSData * imageData = [[NSData alloc] initWithBase64EncodedString:str options:NSDataBase64DecodingIgnoreUnknownCharacters]; + + UIImage * photo = [UIImage imageWithData:imageData]; + + return photo; +} + +///将时间戳转为日期时间 + +/// @param timestamp 时间戳 + +/// @param dateFormat 日期样式 YYYY-MM-dd HH:mm:ss + ++ (NSString *)getTimeFromTimestamp:(NSInteger )timestamp andDateFormat:(NSString *)dateFormat{ + + //将对象类型的时间转换为NSDate类型 +  NSTimeInterval _interval= timestamp / 1000.0; +   NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval]; +    NSDateFormatter *objDateformat = [[NSDateFormatter alloc] init]; + //设置时间格式 + + [objDateformat setDateFormat:dateFormat]; + + //将时间转换为字符串 + + NSString *timeStr = [objDateformat stringFromDate:date]; + + return timeStr; +} + ++ (NSString *)getTimestampFromTime:(NSString *)CurrentTime { + + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + + [formatter setDateStyle:NSDateFormatterMediumStyle]; + + [formatter setTimeStyle:NSDateFormatterShortStyle]; + + [formatter setDateFormat:@"yyyyMMddHHmmss"]; //(@"YYYY-MM-dd hh:mm:ss") ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制 + + //设置时区选择北京时间 + + NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"]; + + [formatter setTimeZone:timeZone]; + + NSDate* date = [formatter dateFromString:CurrentTime]; //------------将字符串按formatter转成nsdate + + //时间转时间戳的方法: + + NSInteger timeSp = [[NSNumber numberWithDouble:[date timeIntervalSince1970]] integerValue] * 1000; + + + return [NSString stringWithFormat:@"%ld",(long)timeSp]; +} + + +//判断是否有中文 ++(BOOL)IsChinese:(NSString *)str { for(int i=0; i< [str length];i++){ int a = [str characterAtIndex:i]; + if( a > 0x4e00 && a < 0x9fff) + + { + return YES; + } + + } + return NO; +} + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/LineTextField.h b/XinjiangProject/XinjiangProject/Utils/LineTextField.h new file mode 100644 index 0000000..ce8dba7 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/LineTextField.h @@ -0,0 +1,19 @@ +// +// LineTextField.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/21. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LineTextField : UITextField + +- (void)drawRect:(CGRect)rect; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Utils/LineTextField.m b/XinjiangProject/XinjiangProject/Utils/LineTextField.m new file mode 100644 index 0000000..ba1d133 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/LineTextField.m @@ -0,0 +1,26 @@ +// +// LineTextField.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/21. +// + +#import "LineTextField.h" + +@implementation LineTextField + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (void)drawRect:(CGRect)rect { + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSetFillColorWithColor(context, UIColorHex(#E0E0E0).CGColor); + CGContextFillRect(context, CGRectMake(kRealValue(15), CGRectGetHeight(self.frame) - 1, CGRectGetWidth(self.frame) - kRealValue(30), 1)); +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/PopAnimation/HQPopTool.h b/XinjiangProject/XinjiangProject/Utils/PopAnimation/HQPopTool.h new file mode 100644 index 0000000..78e1d87 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/PopAnimation/HQPopTool.h @@ -0,0 +1,36 @@ +// +// HQPopTool.h +// healthQuestion +// +// Created by xulei on 2022/8/31. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQPopTool : NSObject + ++ (instancetype)sharedInstance; + +/** + * + * 弹出视图 + * + * @param view 被弹出的视图 + * @param animated 是否需要动画 + */ +- (void)popView:(UIView *)view animated:(BOOL)animated; + +/** + * + * 关闭视图 + * + * @param animated 是否需要动画 + */ +- (void)closeAnimated:(BOOL)animated; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Utils/PopAnimation/HQPopTool.m b/XinjiangProject/XinjiangProject/Utils/PopAnimation/HQPopTool.m new file mode 100644 index 0000000..fe00924 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/PopAnimation/HQPopTool.m @@ -0,0 +1,74 @@ +// +// HQPopTool.m +// healthQuestion +// +// Created by xulei on 2022/8/31. +// + +#import "HQPopTool.h" + +@interface HQPopTool () + +/** + * + * 当前弹出的view + */ +@property (nonatomic, strong) UIView *currentView; + +@end + +@implementation HQPopTool + ++ (instancetype)sharedInstance { + static HQPopTool *_popTool = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _popTool = [[HQPopTool alloc] init]; + }); + return _popTool; +} + + +- (void)popView:(UIView *)view animated:(BOOL)animated { + _currentView = view; + CGFloat halfScreenWidth = [[UIScreen mainScreen] bounds].size.width * 0.5; + CGFloat halfScreenHeight = [[UIScreen mainScreen] bounds].size.height * 0.5; + // 屏幕中心 + CGPoint screenCenter = CGPointMake(halfScreenWidth, halfScreenHeight); + view.center = screenCenter; + UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; + [keyWindow addSubview:view]; + + if (animated) { + // 将view宽高缩至无限小(点) + view.transform = CGAffineTransformScale(CGAffineTransformIdentity, CGFLOAT_MIN, CGFLOAT_MIN); + [UIView animateWithDuration:0.3 animations:^{ + // 以动画的形式将view慢慢放大至原始大小的1.2倍 + view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.2, 1.2); + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.2 animations:^{ + // 以动画的形式将view恢复至原始大小 + view.transform = CGAffineTransformIdentity; + }]; + }]; + } +} + +- (void)closeAnimated:(BOOL)animated { + if (animated) { + [UIView animateWithDuration:0.2 animations:^{ + _currentView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.2, 1.2); + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.3 animations:^{ + _currentView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001); + } completion:^(BOOL finished) { + [_currentView removeFromSuperview]; + }]; + }]; + } else { + [_currentView removeFromSuperview]; + } +} + +@end + diff --git a/XinjiangProject/XinjiangProject/Utils/Star/FSXBStarRateView.h b/XinjiangProject/XinjiangProject/Utils/Star/FSXBStarRateView.h new file mode 100755 index 0000000..318640c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/Star/FSXBStarRateView.h @@ -0,0 +1,45 @@ +// +// FSXBStarRateView.h +// fs-iOS +// +// Created by ios on 2017/7/7. +// Copyright © 2017年 cn.com.shopec.car. All rights reserved. +// + +#import + +@class FSXBStarRateView; +typedef void(^finishBlock)(CGFloat currentScore); +typedef NS_ENUM(NSInteger, RateStyle) +{ + WholeStar = 0, //只能整星评论 + HalfStar = 1, //允许半星评论 + IncompleteStar = 2 //允许不完整星评论 +}; + +@protocol XBStarRateViewDelegate + +-(void)starRateView:(FSXBStarRateView *)starRateView currentScore:(CGFloat)currentScore; + +@end + +@interface FSXBStarRateView : UIView +@property (nonatomic,assign)BOOL isAnimation; //是否动画显示,默认NO +@property (nonatomic,assign)RateStyle rateStyle; //评分样式 默认是WholeStar +@property (nonatomic,assign)CGFloat currentScore; // 当前评分:0-5 默认0 +@property (nonatomic,assign)BOOL enable; +@property (nonatomic, weak) iddelegate; + + +/** + *通过代理的方法获取当前评分数currentScore + */ +-(instancetype)initWithFrame:(CGRect)frame; +-(instancetype)initWithFrame:(CGRect)frame numberOfStars:(NSInteger)numberOfStars rateStyle:(RateStyle)rateStyle isAnination:(BOOL)isAnimation delegate:(id)delegate; +/** + *通过Block传值的方法获取当前评分数currentScore + */ +-(instancetype)initWithFrame:(CGRect)frame finish:(finishBlock)finish; +-(instancetype)initWithFrame:(CGRect)frame numberOfStars:(NSInteger)numberOfStars rateStyle:(RateStyle)rateStyle isAnination:(BOOL)isAnimation finish:(finishBlock)finish; + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/Star/FSXBStarRateView.m b/XinjiangProject/XinjiangProject/Utils/Star/FSXBStarRateView.m new file mode 100755 index 0000000..eb31c2e --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/Star/FSXBStarRateView.m @@ -0,0 +1,149 @@ +// +// FSXBStarRateView.m +// fs-iOS +// +// Created by 白印潇 on 2017/7/7. +// Copyright © 2017年 cn.com.shopec.car. All rights reserved. +// + +#import "FSXBStarRateView.h" +#define ForegroundStarImage @"home_star" +#define BackgroundStarImage @"homestar_gray" + +typedef void(^completeBlock)(CGFloat currentScore); +@interface FSXBStarRateView() +@property (nonatomic, strong) UIView *foregroundStarView; +@property (nonatomic, strong) UIView *backgroundStarView; +@property (nonatomic, assign) NSInteger numberOfStars; +@property (nonatomic,strong)completeBlock complete; +@end + +@implementation FSXBStarRateView + +#pragma mark - 代理方式 + +- (instancetype)init { + if (self = [super init]) { + _numberOfStars = 5; + _rateStyle = WholeStar; + [self createStarView]; + } + return self; +} + +-(instancetype)initWithFrame:(CGRect)frame{ + if (self = [super initWithFrame:frame]) { + _numberOfStars = 5; + _rateStyle = WholeStar; + [self createStarView]; + } + return self; +} +-(instancetype)initWithFrame:(CGRect)frame numberOfStars:(NSInteger)numberOfStars rateStyle:(RateStyle)rateStyle isAnination:(BOOL)isAnimation delegate:(id)delegate{ + if (self = [super initWithFrame:frame]) { + _numberOfStars = numberOfStars; + _rateStyle = rateStyle; + _isAnimation = isAnimation; + _delegate = delegate; + [self createStarView]; + } + return self; +} +#pragma mark - block方式 +-(instancetype)initWithFrame:(CGRect)frame finish:(finishBlock)finish{ + if (self = [super initWithFrame:frame]) { + _numberOfStars = 5; + _rateStyle = WholeStar; + _complete = ^(CGFloat currentScore){ + finish(currentScore); + }; + [self createStarView]; + } + return self; +} +-(instancetype)initWithFrame:(CGRect)frame numberOfStars:(NSInteger)numberOfStars rateStyle:(RateStyle)rateStyle isAnination:(BOOL)isAnimation finish:(finishBlock)finish{ + if (self = [super initWithFrame:frame]) { + _numberOfStars = numberOfStars; + _rateStyle = rateStyle; + _isAnimation = isAnimation; + _complete = ^(CGFloat currentScore){ + finish(currentScore); + }; + [self createStarView]; + } + return self; +} +#pragma mark - private Method +-(void)createStarView{ + self.foregroundStarView = [self createStarViewWithImage:ForegroundStarImage]; + self.backgroundStarView = [self createStarViewWithImage:BackgroundStarImage]; + self.foregroundStarView.frame = CGRectMake(0, 0, self.bounds.size.width*_currentScore/self.numberOfStars, self.bounds.size.height); + [self addSubview:self.backgroundStarView]; + [self addSubview:self.foregroundStarView]; + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(userTapRateView:)]; + tapGesture.numberOfTapsRequired = 1; + [self addGestureRecognizer:tapGesture]; +} +-(UIView *)createStarViewWithImage:(NSString *)imageName { + UIView *view = [[UIView alloc] initWithFrame:self.bounds]; + view.clipsToBounds = YES; + view.backgroundColor = [UIColor clearColor]; + for (NSInteger i = 0; i < self.numberOfStars; i ++) + { + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]]; + imageView.frame = CGRectMake(i * self.bounds.size.width / self.numberOfStars, 0, self.bounds.size.width / self.numberOfStars, self.bounds.size.height); + imageView.contentMode = UIViewContentModeScaleAspectFit; + [view addSubview:imageView]; + } + return view; +} +-(void)userTapRateView:(UITapGestureRecognizer *)gesture { + + if (!self.enable) return; + CGPoint tapPoint = [gesture locationInView:self]; + CGFloat offset = tapPoint.x; + CGFloat realStarScore = offset / (self.bounds.size.width / self.numberOfStars); + switch (_rateStyle) { + case WholeStar: + { + self.currentScore = ceilf(realStarScore); + break; + } + case HalfStar: + self.currentScore = roundf(realStarScore)>realStarScore ? ceilf(realStarScore):(ceilf(realStarScore)-0.5); + break; + case IncompleteStar: + self.currentScore = realStarScore; + break; + default: + break; + } +} +-(void)layoutSubviews { + [super layoutSubviews]; + __weak FSXBStarRateView *weakSelf = self; + CGFloat animationTimeInterval = self.isAnimation ? 0.2 : 0; + [UIView animateWithDuration:animationTimeInterval animations:^{ + weakSelf.foregroundStarView.frame = CGRectMake(0, 0, weakSelf.bounds.size.width * weakSelf.currentScore/self.numberOfStars, weakSelf.bounds.size.height); + }]; +} +-(void)setCurrentScore:(CGFloat)currentScore { + if (_currentScore == currentScore) { + return; + } + if (currentScore < 0) { + _currentScore = 0; + } else if (currentScore > _numberOfStars) { + _currentScore = _numberOfStars; + } else { + _currentScore = currentScore; + } + if ([self.delegate respondsToSelector:@selector(starRateView:currentScore:)]) { + [self.delegate starRateView:self currentScore:_currentScore]; + } + if (self.complete) { + _complete(_currentScore); + } + [self setNeedsLayout]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Utils/TagsView/ZHTagListView.h b/XinjiangProject/XinjiangProject/Utils/TagsView/ZHTagListView.h new file mode 100644 index 0000000..c7e213c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/TagsView/ZHTagListView.h @@ -0,0 +1,49 @@ +// +// ZHTagListView.h +// +// Created by 李志华 on 2017/02/18. +// Copyright © 2017年 leezhihua. All rights reserved. +// + +#import + +@interface ZHTagListConfiguration : NSObject ++ (ZHTagListConfiguration *)defaultConfiguration; + +///标签高度,默认30 +@property (nonatomic, assign) CGFloat tagHeight; +///文字左右边距,确定标签宽度,默认10 +@property (nonatomic, assign) CGFloat tagTextMargin; +///标签文字字体,默认size=15 +@property (nonatomic, strong) UIFont * tagTextFont; +///标签文字颜色,默认grayColor +@property (nonatomic, strong) UIColor * tagTextColor; +///标签文字字数限制,默认八个字 +@property (nonatomic, assign) CGFloat limitWordNumber; +///标签最大宽度,默认0,此属性大于0时limitWordNumber失效 +@property (nonatomic, assign) CGFloat tagMaxWidth; +///标签左右间距,默认10 +@property (nonatomic, assign) CGFloat tagHorizontalSpace; +///标签上下间距,默认10 +@property (nonatomic, assign) CGFloat tagVerticalSpace; + ///标签视图四周边距,默认:UIEdgeInsetsZero +@property (nonatomic, assign) UIEdgeInsets tagListViewInset; + +@property (nonatomic, strong) UIColor * tagBackColor; + +@property (nonatomic, strong) UIColor *TagborderColor; + +@end + + +@interface ZHTagListView : UIView +///frame高度根据内容和边距确定 +- (instancetype)initWithFrame:(CGRect)frame configuration:(ZHTagListConfiguration *)configuration tagTexts:(NSArray *)tagTexts; + +@property (nonatomic, strong) NSArray * tagDataArray; + +@property (nonatomic, readonly, copy) NSArray *tagTexts; +@property (nonatomic, readonly, copy) NSArray *tagButtonList; + +@property (nonatomic, copy) void (^tagClickHandler)(ZHTagListView *tagListView, NSString *tagText, NSUInteger index); +@end diff --git a/XinjiangProject/XinjiangProject/Utils/TagsView/ZHTagListView.m b/XinjiangProject/XinjiangProject/Utils/TagsView/ZHTagListView.m new file mode 100644 index 0000000..40e48ec --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/TagsView/ZHTagListView.m @@ -0,0 +1,270 @@ +// +// ZHTagListView.m +// +// Created by 李志华 on 2017/02/18. +// Copyright © 2017年 leezhihua. All rights reserved. +// + +#import "ZHTagListView.h" +@implementation ZHTagListConfiguration ++ (ZHTagListConfiguration *)defaultConfiguration { + ZHTagListConfiguration *configuration = [[ZHTagListConfiguration alloc] init]; + configuration.tagHeight = 30; + configuration.tagTextMargin = 10; + configuration.tagTextFont = [UIFont systemFontOfSize:15]; + configuration.tagTextColor = [UIColor grayColor]; + configuration.limitWordNumber = 8; + configuration.tagMaxWidth = 0; + configuration.tagListViewInset = UIEdgeInsetsZero; + configuration.tagHorizontalSpace = 10.0; + configuration.tagVerticalSpace = 10.0; + return configuration; +} +@end + + +@interface ZHTagListView () +@property (nonatomic, strong) ZHTagListConfiguration *configuration; +@property (nonatomic, strong) NSMutableArray *tagBtnArray; +@property (nonatomic, copy) NSArray *tags; + +@end + + +@implementation ZHTagListView + +- (instancetype)initWithFrame:(CGRect)frame configuration:(ZHTagListConfiguration *)configuration tagTexts:(NSArray *)tagTexts { + self = [super initWithFrame:frame]; + if (self) { + self.configuration = configuration; + self.tagBtnArray = [NSMutableArray array]; + self.tags = tagTexts; + [self setupTagListView]; + } + return self; +} +- (void)setTagDataArray:(NSArray *)tagDataArray { + + _tagDataArray = tagDataArray; + self.tags = _tagDataArray; + while (self.subviews.count) { + [self.subviews.lastObject removeFromSuperview]; + } + [self.tagBtnArray removeAllObjects]; + + CGFloat kWidth = self.frame.size.width - self.configuration.tagListViewInset.left - self.configuration.tagListViewInset.right; + + CGFloat tagBtnX = self.configuration.tagListViewInset.left; + CGFloat tagBtnY = self.configuration.tagListViewInset.top; + CGFloat tagBtnH = self.configuration.tagHeight; + + for (int i = 0; i < self.tags.count; i++) { + UIButton *tagBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + //设置按钮的样式 + if (self.configuration.tagBackColor) { + + tagBtn.layer.borderColor = self.configuration.tagBackColor.CGColor; + }else + { + tagBtn.layer.borderColor = UIColorHex(#DEDEDE).CGColor; + } + tagBtn.layer.borderWidth = 0.5; + tagBtn.layer.cornerRadius = 5; + tagBtn.layer.masksToBounds = true; + [tagBtn setTitleColor:self.configuration.tagTextColor forState:UIControlStateNormal]; + tagBtn.titleLabel.font = self.configuration.tagTextFont; + if (self.configuration.tagBackColor) { + [tagBtn setBackgroundColor:self.configuration.tagBackColor]; + + } + [tagBtn.titleLabel setTextAlignment: NSTextAlignmentCenter]; + tagBtn.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; + + + NSString *tag = self.tags[i]; + if (self.configuration.tagMaxWidth <= 0) { + if (tag.length > self.configuration.limitWordNumber) { + tag = [NSString stringWithFormat:@"%@%@", [tag substringToIndex:self.configuration.limitWordNumber], @"..."]; + } + if ([tag containsString:@"\n"]) { + + NSArray *arr = [tag componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; + if (arr.count >= 1) { + NSString * firstString = arr[0]; + NSMutableAttributedString* mString = [[NSMutableAttributedString alloc] initWithString:tag]; + + NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:CFontColor2}; + [mString setAttributes:firstAttributes range:NSMakeRange(firstString.length,mString.length - firstString.length)]; + + [tagBtn setAttributedTitle:mString forState:UIControlStateNormal]; + } + }else { + [tagBtn setTitle:tag forState:UIControlStateNormal]; + } + } else { + if ([tag containsString:@"\n"]) { + + NSArray *arr = [tag componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; + if (arr.count >= 1) { + NSString * firstString = arr[0]; + NSMutableAttributedString* mString = [[NSMutableAttributedString alloc] initWithString:tag]; + + NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:CFontColor2}; + [mString setAttributes:firstAttributes range:NSMakeRange(firstString.length,mString.length - firstString.length)]; + + [tagBtn setAttributedTitle:mString forState:UIControlStateNormal]; + } + }else { + [tagBtn setTitle:tag forState:UIControlStateNormal]; + } + } + tagBtn.tag = 1000+i; + [tagBtn addTarget:self action:@selector(tagBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + //计算文字大小 + CGFloat tagBtnW = [tag boundingRectWithSize:CGSizeMake(MAXFLOAT, tagBtnH) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:tagBtn.titleLabel.font} context:nil].size.width; + tagBtnW += self.configuration.tagTextMargin*2; + if (self.configuration.tagMaxWidth > 0 && tagBtnW > self.configuration.tagMaxWidth) { + tagBtnW = self.configuration.tagMaxWidth; + } + //判断按钮是否超过屏幕的宽 + if ((tagBtnX + tagBtnW) > kWidth) { + tagBtnX = self.configuration.tagListViewInset.left; + tagBtnY += tagBtnH + self.configuration.tagVerticalSpace; + } + //frame + tagBtn.frame = CGRectMake(tagBtnX, tagBtnY, tagBtnW, tagBtnH); + tagBtnX += tagBtnW + self.configuration.tagHorizontalSpace; + + [self addSubview:tagBtn]; + [self.tagBtnArray addObject:tagBtn]; + if (i == self.tags.count - 1) { + CGRect rect = self.frame; + rect.size.height = CGRectGetMaxY(tagBtn.frame) + self.configuration.tagListViewInset.bottom; + self.frame = rect; + } + } +} + + +-(void)setupTagListView { + while (self.subviews.count) { + [self.subviews.lastObject removeFromSuperview]; + } + [self.tagBtnArray removeAllObjects]; + + CGFloat kWidth = self.frame.size.width - self.configuration.tagListViewInset.left - self.configuration.tagListViewInset.right; + + CGFloat tagBtnX = self.configuration.tagListViewInset.left; + CGFloat tagBtnY = self.configuration.tagListViewInset.top; + CGFloat tagBtnH = self.configuration.tagHeight; + + for (int i = 0; i < self.tags.count; i++) { + UIButton *tagBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + //设置按钮的样式 + if (self.configuration.tagBackColor) { + + tagBtn.layer.borderColor = self.configuration.tagBackColor.CGColor; + }else + { + + tagBtn.layer.borderColor = UIColorHex(#DEDEDE).CGColor; + } + tagBtn.layer.borderWidth = 0.5; + tagBtn.layer.cornerRadius = 5; + tagBtn.layer.masksToBounds = true; + [tagBtn setTitleColor:self.configuration.tagTextColor forState:UIControlStateNormal]; + if (self.configuration.tagBackColor) { + [tagBtn setBackgroundColor:self.configuration.tagBackColor]; + + } + tagBtn.titleLabel.font = self.configuration.tagTextFont; + tagBtn.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; +// tagBtn.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; + NSString *tag = self.tags[i]; + + + + + + if (self.configuration.tagMaxWidth <= 0) { + if (tag.length > self.configuration.limitWordNumber) { + tag = [NSString stringWithFormat:@"%@%@", [tag substringToIndex:self.configuration.limitWordNumber], @"..."]; + } + if ([tag containsString:@"\n"]) { + + NSArray *arr = [tag componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; + if (arr.count >= 1) { + NSString * firstString = arr[0]; + NSMutableAttributedString* mString = [[NSMutableAttributedString alloc] initWithString:tag]; + + NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:CFontColor2}; + [mString setAttributes:firstAttributes range:NSMakeRange(firstString.length,mString.length - firstString.length)]; + + [tagBtn setAttributedTitle:mString forState:UIControlStateNormal]; + } + }else { + [tagBtn setTitle:tag forState:UIControlStateNormal]; + } + } else { + if ([tag containsString:@"\n"]) { + + NSArray *arr = [tag componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; + if (arr.count >= 1) { + NSString * firstString = arr[0]; + NSMutableAttributedString* mString = [[NSMutableAttributedString alloc] initWithString:tag]; + + NSDictionary * firstAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:CFontColor2}; + [mString setAttributes:firstAttributes range:NSMakeRange(firstString.length,mString.length - firstString.length)]; + + [tagBtn setAttributedTitle:mString forState:UIControlStateNormal]; + } + }else { + + [tagBtn setTitle:tag forState:UIControlStateNormal]; + } + } + tagBtn.tag = 1000+i; + [tagBtn addTarget:self action:@selector(tagBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + //计算文字大小 + CGFloat tagBtnW = [tag boundingRectWithSize:CGSizeMake(MAXFLOAT, tagBtnH) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:tagBtn.titleLabel.font} context:nil].size.width; + tagBtnW += self.configuration.tagTextMargin*2; + if (self.configuration.tagMaxWidth > 0 && tagBtnW > self.configuration.tagMaxWidth) { + tagBtnW = self.configuration.tagMaxWidth; + } + //判断按钮是否超过屏幕的宽 + if ((tagBtnX + tagBtnW) > kWidth) { + tagBtnX = self.configuration.tagListViewInset.left; + tagBtnY += tagBtnH + self.configuration.tagVerticalSpace; + } + //frame + tagBtn.frame = CGRectMake(tagBtnX, tagBtnY, tagBtnW, tagBtnH); + tagBtnX += tagBtnW + self.configuration.tagHorizontalSpace; + + [self addSubview:tagBtn]; + [self.tagBtnArray addObject:tagBtn]; + if (i == self.tags.count - 1) { + CGRect rect = self.frame; + rect.size.height = CGRectGetMaxY(tagBtn.frame) + self.configuration.tagListViewInset.bottom; + self.frame = rect; + } + } +} + + +-(void)tagBtnClick:(UIButton *)btn { + if (self.tagClickHandler) { + self.tagClickHandler(self, btn.titleLabel.text, btn.tag-1000); + } +} + +- (NSArray *)tagTexts { + return self.tags; +} + +- (NSArray *)tagButtonList { + return self.tagBtnArray; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/ViewEffects/UIView+Effects.h b/XinjiangProject/XinjiangProject/Utils/ViewEffects/UIView+Effects.h new file mode 100644 index 0000000..bc4f825 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/ViewEffects/UIView+Effects.h @@ -0,0 +1,55 @@ +// +// UIView+Effects.h +// CCViewEffects +// +// Created by 佰道聚合 on 2017/9/8. +// Copyright © 2017年 cyd. All rights reserved. +// + +#import + +typedef UIView *(^ConrnerCorner) (UIRectCorner corner ); +typedef UIView *(^ConrnerRadius) (CGFloat radius ); + +typedef UIView *(^BorderColor ) (UIColor *color ); +typedef UIView *(^BorderWidth ) (CGFloat width ); + +typedef UIView *(^ShadowColor ) (UIColor *color ); +typedef UIView *(^ShadowOffset ) (CGSize size ); +typedef UIView *(^ShadowRadius ) (CGFloat radius ); +typedef UIView *(^ShadowOpacity) (CGFloat opacity); + +typedef UIView *(^BezierPath) (UIBezierPath *path ); +typedef UIView *(^ViewBounds) (CGRect rect ); + +typedef UIView *(^ShowVisual) (void); +typedef UIView *(^ClerVisual) (void); + +/** + 注意:在设置圆角和阴影时会去获取视图控件的bounds,所以在视图控件的bounds变化后,需要重新设置 + */ +@interface UIView (Effects) + +// 圆角 +@property(nonatomic, strong, readonly)ConrnerCorner conrnerCorner; // UIRectCorner 默认 UIRectCornerAllCorners +@property(nonatomic, strong, readonly)ConrnerRadius conrnerRadius; // 圆角半径 默认 0.0 + +// 边框 +@property(nonatomic, strong, readonly)BorderColor borderColor; // 边框颜色 默认 black +@property(nonatomic, strong, readonly)BorderWidth borderWidth; // 边框宽度 默认 0.0 + +// 阴影 +@property(nonatomic, strong, readonly)ShadowColor shadowColor; // 阴影颜色 默认 black +@property(nonatomic, strong, readonly)ShadowOffset shadowOffset; // 阴影偏移方向和距离 默认 {0.0,0.0} +@property(nonatomic, strong, readonly)ShadowRadius shadowRadius; // 阴影模糊度 默认 0.0 +@property(nonatomic, strong, readonly)ShadowOpacity shadowOpacity; // (0~1] 默认 0.0 + +// 路径 +@property(nonatomic, strong, readonly)BezierPath bezierPath; // 贝塞尔路径 默认 nil (有值时,radius属性将失效) +@property(nonatomic, strong, readonly)ViewBounds viewBounds; // 设置圆角时,会去获取视图的bounds属性,如果此时获取不到,则需要传入该参数,默认为 nil,如果传入该参数,则不会去回去视图的bounds属性了 + +// 调用 +@property(nonatomic, strong, readonly)ShowVisual showVisual; // 展示 +@property(nonatomic, strong, readonly)ClerVisual clerVisual; // 隐藏 + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/ViewEffects/UIView+Effects.m b/XinjiangProject/XinjiangProject/Utils/ViewEffects/UIView+Effects.m new file mode 100644 index 0000000..9e9c78c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/ViewEffects/UIView+Effects.m @@ -0,0 +1,391 @@ +// +// UIView+Effects.m +// CCViewEffects +// +// Created by 佰道聚合 on 2017/9/8. +// Copyright © 2017年 cyd. All rights reserved. +// + +#import "UIView+Effects.h" +#import + +#define kConrnerCorner "UIView.privateConrnerCorner" +#define kConrnerBounds "UIView.privateConrnerBounds" +#define kConrnerRadius "UIView.privateConrnerRadius" + +#define kBorderColor "UIView.privateBorderColor" +#define kBorderWidth "UIView.privateBorderWidth" + +#define kShadowOpacity "UIView.privateShadowOpacity" +#define kShadowRadius "UIView.privateShadowRadius" +#define kShadowOffset "UIView.privateShadowOffset" +#define kShadowColor "UIView.privateShadowColor" + +#define kBezierPath "UIView.privateBezierPath" +#define kViewBounds "UIView.privateViewBounds" + +#define kBackgroundView "UIView.BackgroundView" + +@implementation UIView (Effects) +@dynamic conrnerCorner, + conrnerRadius, + borderColor, + borderWidth, + shadowColor, + shadowOffset, + shadowRadius, + shadowOpacity, + showVisual, + clerVisual, + bezierPath, + viewBounds; + +#pragma mark - 添加私有属性 +// mark - 圆角 矩形 默认 AllCorners +- (void)setPrivateConrnerCorner:(UIRectCorner)corner { + objc_setAssociatedObject(self, kConrnerCorner, [NSNumber numberWithInteger:corner], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIRectCorner)privateConrnerCorner { + id corner = objc_getAssociatedObject(self, kConrnerCorner); + return corner ? [corner integerValue] : UIRectCornerAllCorners; +} + +// mark - 圆角 半径 默认 0.0 +- (void)setPrivateConrnerRadius:(CGFloat)radius { + objc_setAssociatedObject(self, kConrnerRadius, [NSNumber numberWithFloat:radius], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateConrnerRadius { + id radius = objc_getAssociatedObject(self, kConrnerRadius); + return radius ? [radius floatValue] : 0.0; +} + +// mark - 边框 宽度 默认 0.0 +- (void)setPrivateBorderWidth:(CGFloat)width { + objc_setAssociatedObject(self, kBorderWidth, [NSNumber numberWithFloat:width], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateBorderWidth { + id width = objc_getAssociatedObject(self, kBorderWidth); + return width ? [width floatValue] : 0.0; +} + +// mark - 边框 颜色 默认 黑色 +- (void)setPrivateBorderColor:(UIColor *)color { + objc_setAssociatedObject(self, kBorderColor, color, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIColor *)privateBorderColor { + id color = objc_getAssociatedObject(self, kBorderColor); + return color ? color : [UIColor blackColor]; +} + +// mark - 阴影 半径 默认 0.0 +- (void)setPrivateShadowRadius:(CGFloat)opacity { + objc_setAssociatedObject(self, kShadowOpacity, [NSNumber numberWithFloat:opacity], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateShadowRadius { + id radius = objc_getAssociatedObject(self, kShadowOpacity); + return radius ? [radius floatValue] : 0.0; +} + +// mark - 阴影 模糊度 默认 0.0 +- (void)setPrivateShadowOpacity:(CGFloat)radius { + objc_setAssociatedObject(self, kShadowRadius, [NSNumber numberWithFloat:radius], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateShadowOpacity { + id opacity = objc_getAssociatedObject(self, kShadowRadius); + return opacity ? [opacity floatValue] : 0.0; +} + +// mark - 阴影 偏移方向和距离 默认 {0.0,0.0} +- (void)setPrivateShadowOffset:(CGSize)offset { + objc_setAssociatedObject(self, kShadowOffset, NSStringFromCGSize(offset), OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGSize)privateShadowOffset { + id offset = objc_getAssociatedObject(self, kShadowOffset); + return offset ? CGSizeFromString(offset) : CGSizeZero; +} + +// mark - 阴影 颜色 默认 black +- (void)setPrivateShadowColor:(UIColor *)color { + objc_setAssociatedObject(self, kShadowColor, color, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIColor *)privateShadowColor { + id color = objc_getAssociatedObject(self, kShadowColor); + return color ? color : [UIColor blackColor]; +} + +// mark - 路径 默认 nil +- (void)setPrivateBezierPath:(UIBezierPath *)path { + objc_setAssociatedObject(self, kBezierPath, path, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIBezierPath *)privateBezierPath { + id path = objc_getAssociatedObject(self, kBezierPath); + return path ? path : nil; +} + +// mark - 视图 大小 默认 nil +- (void)setPrivateViewBounds:(CGRect)rect { + objc_setAssociatedObject(self, kViewBounds, NSStringFromCGRect(rect), OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGRect)privateViewBounds { + id path = objc_getAssociatedObject(self, kViewBounds); + return path ? CGRectFromString(path) : CGRectZero; +} + +// 阴影空视图,只在有圆角的时候使用 +- (UIView *)shadowBackgroundView { + return objc_getAssociatedObject(self, kBackgroundView); +} + +- (void)setShadowBackgroundView:(UIView *)backgroundView { + objc_setAssociatedObject(self, kBackgroundView, backgroundView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - 链式属性实现 +- (ConrnerCorner)conrnerCorner { + return ^(UIRectCorner corner) { + self.privateConrnerCorner = corner; + return self; + }; +} + +- (ConrnerRadius)conrnerRadius { + return ^(CGFloat radius) { + self.privateConrnerRadius = radius; + return self; + }; +} + +- (BorderColor)borderColor { + return ^(UIColor *color) { + self.privateBorderColor = color; + return self; + }; +} + +- (BorderWidth)borderWidth { + return ^(CGFloat width) { + self.privateBorderWidth = width; + return self; + }; +} + +- (ShadowOpacity)shadowOpacity { + return ^(CGFloat opacity) { + self.privateShadowOpacity = opacity; + return self; + }; +} + +- (ShadowRadius)shadowRadius { + return ^(CGFloat radius) { + self.privateShadowRadius = radius; + return self; + }; +} + +- (ShadowOffset)shadowOffset { + return ^(CGSize size) { + self.privateShadowOffset = size; + return self; + }; +} + +- (ShadowColor)shadowColor { + return ^(UIColor *color) { + self.privateShadowColor = color; + return self; + }; +} + +- (BezierPath)bezierPath { + return ^(UIBezierPath *path) { + self.privateBezierPath = path; + return self; + }; +} + +- (ViewBounds)viewBounds { + return ^(CGRect rect) { + self.privateViewBounds = rect; + return self; + }; +} + +#pragma mark - 方法实现 +- (ClerVisual)clerVisual { + return ^{ + // 阴影 + if (self.shadowBackgroundView) { + [self.shadowBackgroundView removeFromSuperview]; + self.shadowBackgroundView = nil; + } + + // 圆角、边框 + for (CALayer *layer in self.layer.sublayers) { + if ([layer.name isEqualToString:@"CCViewEffects"]) { + [layer removeFromSuperlayer]; + } + } + + // 恢复默认设置 + self.privateConrnerCorner = UIRectCornerAllCorners; + self.privateConrnerRadius = 0.0; + self.privateBorderColor = [UIColor blackColor]; + self.privateBorderWidth = 0.0; + self.privateShadowOpacity = 0.0; + self.privateShadowRadius = 0.0; + self.privateShadowOffset = CGSizeZero; + self.privateViewBounds = CGRectZero; + self.privateShadowColor = [UIColor blackColor]; + self.shadowBackgroundView = nil; + + self.layer.masksToBounds = NO; + self.layer.cornerRadius = 0.0; + self.layer.borderWidth = 0.0; + self.layer.borderColor = [UIColor blackColor].CGColor; + self.layer.shadowOpacity = 0.0; + self.layer.shadowPath = nil; + self.layer.shadowRadius = 0.0; + self.layer.shadowColor = [UIColor blackColor].CGColor; + self.layer.shadowOffset = CGSizeZero; + self.layer.mask = nil; + return self; + }; +} + +- (ShowVisual)showVisual { + return ^{ + // 阴影 + [self addShadow]; + // 边框、圆角 + [self addBorderAndRadius]; + return self; + }; +} + +#pragma mark - Private methods +-(CGRect)drawBounds { + // 1.如果传入了大小,则直接返回 + if (!CGRectEqualToRect(self.privateViewBounds, CGRectZero)) { + return self.privateViewBounds; + } + // 2.获取在自动布局时的视图大小 + if (self.superview != nil) { + [self.superview layoutIfNeeded]; + } + return self.bounds; +} + +-(UIBezierPath *)drawBezierPath { + if (self.privateBezierPath != nil) { + return self.privateBezierPath; + } + return [UIBezierPath bezierPathWithRoundedRect:[self drawBounds] + byRoundingCorners:self.privateConrnerCorner + cornerRadii:CGSizeMake(self.privateConrnerRadius, self.privateConrnerRadius)]; +} + +// 添加阴影 +-(void)addShadow { + UIView *shadowView = self; + // 同时存在阴影和圆角 + if ((self.privateShadowOpacity > 0 && self.privateConrnerRadius > 0) || self.privateBezierPath) { + if (self.shadowBackgroundView) { + [self.shadowBackgroundView removeFromSuperview]; + self.shadowBackgroundView = nil; + } + NSAssert(self.superview, @"添加阴影和圆角时,请先将view加到父视图上"); + shadowView = [[UIView alloc] initWithFrame:self.frame]; + shadowView.translatesAutoresizingMaskIntoConstraints = NO; + [self.superview insertSubview:shadowView belowSubview:self]; + [self.superview addConstraints:@[[NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeTop + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0]]]; + self.shadowBackgroundView = shadowView; + } + // 圆角 + if (self.privateConrnerRadius > 0 || self.privateBezierPath) { + UIBezierPath *shadowPath = [self drawBezierPath]; + shadowView.layer.shadowPath = shadowPath.CGPath; + } + // 阴影 + shadowView.layer.masksToBounds = NO; + shadowView.layer.shadowOpacity = self.privateShadowOpacity; + shadowView.layer.shadowRadius = self.privateShadowRadius; + shadowView.layer.shadowOffset = self.privateShadowOffset; + shadowView.layer.shadowColor = self.privateShadowColor.CGColor; +} + +// 添加圆角和边框 +-(void)addBorderAndRadius { + // 圆角或阴影或自定义曲线 + if (self.privateConrnerRadius > 0 || self.privateShadowOpacity > 0 || self.privateBezierPath) { + // 圆角 + if (self.privateConrnerRadius > 0 || self.privateBezierPath) { + UIBezierPath *path = [self drawBezierPath]; + CAShapeLayer *maskLayer = [CAShapeLayer layer]; + maskLayer.frame = self.bounds; + maskLayer.path = path.CGPath; + self.layer.mask = maskLayer; + } + // 边框 + if (self.privateBorderWidth > 0 || self.privateBezierPath) { + for (CALayer *layer in self.layer.sublayers) { + if ([layer.name isEqualToString:@"CCViewEffects"]) { + [layer removeFromSuperlayer]; + } + } + UIBezierPath *path = [self drawBezierPath]; + CAShapeLayer *layer = [[CAShapeLayer alloc]init]; + layer.name = @"CCViewEffects"; + layer.frame = self.bounds; + layer.path = path.CGPath; + layer.lineWidth = self.privateBorderWidth; + layer.strokeColor = self.privateBorderColor.CGColor; + layer.fillColor = [UIColor clearColor].CGColor; + [self.layer addSublayer:layer]; + } + } else { + // 只有边框 + self.layer.masksToBounds = true; + self.layer.borderWidth = self.privateBorderWidth; + self.layer.borderColor = self.privateBorderColor.CGColor; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XLCircle.h b/XinjiangProject/XinjiangProject/Utils/XLCircle.h new file mode 100644 index 0000000..046feb5 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XLCircle.h @@ -0,0 +1,22 @@ +// +// XLCircle.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XLCircle : UIView + +-(instancetype)initWithFrame:(CGRect)frame lineWidth:(float)lineWidth withProgressColor:(UIColor *)progressColor; + +@property (assign,nonatomic) float progress; + +@property (assign,nonatomic) CGFloat lineWidth; + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Utils/XLCircle.m b/XinjiangProject/XinjiangProject/Utils/XLCircle.m new file mode 100644 index 0000000..081561b --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XLCircle.m @@ -0,0 +1,146 @@ +// +// XLCircle.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/13. +// + +#import "XLCircle.h" + +static CGFloat endPointMargin = 1.0f; + +@interface XLCircle () +{ + CAShapeLayer* _trackLayer; + CAShapeLayer* _progressLayer; + UIImageView* _endPoint;//在终点位置添加一个点 + UIColor * _progressColor; +} +@end + +@implementation XLCircle + + +-(instancetype)initWithFrame:(CGRect)frame lineWidth:(float)lineWidth withProgressColor:(UIColor *)progressColor +{ + self = [super initWithFrame:frame]; + if (self) { + _lineWidth = lineWidth; + _progressColor = progressColor; + [self buildLayout]; + } + return self; +} + +-(void)buildLayout +{ + float centerX = self.bounds.size.width/2.0; + float centerY = self.bounds.size.height/2.0; + //半径 + float radius = (self.bounds.size.width-_lineWidth)/2.0; + + //创建贝塞尔路径 + UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(centerX, centerY) radius:radius startAngle:(-0.5f*M_PI) endAngle:1.5f*M_PI clockwise:YES]; + + //添加背景圆环 + + CAShapeLayer *backLayer = [CAShapeLayer layer]; + backLayer.frame = self.bounds; + backLayer.fillColor = [[UIColor clearColor] CGColor]; + backLayer.strokeColor = UIColorHex(#F5F7FB).CGColor; + backLayer.lineWidth = 5; + backLayer.path = [path CGPath]; + backLayer.strokeEnd = 1; + [self.layer addSublayer:backLayer]; + + //创建进度layer + _progressLayer = [CAShapeLayer layer]; + _progressLayer.frame = self.bounds; + _progressLayer.fillColor = [[UIColor clearColor] CGColor]; + //指定path的渲染颜色 + _progressLayer.strokeColor = _progressColor.CGColor; + _progressLayer.lineCap = kCALineCapRound; + _progressLayer.lineWidth = _lineWidth; + _progressLayer.path = [path CGPath]; + _progressLayer.strokeEnd = 0; + + //设置渐变颜色 + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.frame = self.bounds; + [gradientLayer setColors:[NSArray arrayWithObjects:(id)[_progressColor CGColor],(id)[_progressColor CGColor], nil]]; + gradientLayer.startPoint = CGPointMake(0, 0); + gradientLayer.endPoint = CGPointMake(0, 1); + [gradientLayer setMask:_progressLayer]; //用progressLayer来截取渐变层 + [self.layer addSublayer:gradientLayer]; + + + //用于显示结束位置的小点 + _endPoint = [[UIImageView alloc] init]; + _endPoint.frame = CGRectMake(0, 0, _lineWidth - endPointMargin*2,_lineWidth - endPointMargin*2); + _endPoint.hidden = true; + _endPoint.backgroundColor = UIColor.clearColor; +// _endPoint.image = [UIImage imageNamed:@"endPoint"]; + _endPoint.layer.masksToBounds = true; + _endPoint.layer.cornerRadius = _endPoint.bounds.size.width/2; + [self addSubview:_endPoint]; + + +} + +-(void)setProgress:(float)progress +{ + _progress = progress; + _progressLayer.strokeEnd = progress; + [self updateEndPoint]; + [_progressLayer removeAllAnimations]; +} + +//更新小点的位置 +-(void)updateEndPoint +{ + //转成弧度 + CGFloat angle = M_PI*2*_progress; + float radius = (self.bounds.size.width-_lineWidth)/2.0; + int index = (angle)/M_PI_2;//用户区分在第几象限内 + float needAngle = angle - index*M_PI_2;//用于计算正弦/余弦的角度 + float x = 0,y = 0;//用于保存_dotView的frame + switch (index) { + case 0: + NSLog(@"第一象限"); + x = radius + sinf(needAngle)*radius; + y = radius - cosf(needAngle)*radius; + break; + case 1: + NSLog(@"第二象限"); + x = radius + cosf(needAngle)*radius; + y = radius + sinf(needAngle)*radius; + break; + case 2: + NSLog(@"第三象限"); + x = radius - sinf(needAngle)*radius; + y = radius + cosf(needAngle)*radius; + break; + case 3: + NSLog(@"第四象限"); + x = radius - cosf(needAngle)*radius; + y = radius - sinf(needAngle)*radius; + break; + + default: + break; + } + + //更新圆环的frame + CGRect rect = _endPoint.frame; + rect.origin.x = x + endPointMargin; + rect.origin.y = y + endPointMargin; + _endPoint.frame = rect; + //移动到最前 + [self bringSubviewToFront:_endPoint]; + _endPoint.hidden = false; + if (_progress == 0 || _progress == 1) { + _endPoint.hidden = true; + } +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XLCircleProgress.h b/XinjiangProject/XinjiangProject/Utils/XLCircleProgress.h new file mode 100644 index 0000000..a270e06 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XLCircleProgress.h @@ -0,0 +1,22 @@ +// +// XLCircleProgress.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XLCircleProgress : UIView + + +-(instancetype)initWithFrame:(CGRect)frame withLineWidth:(CGFloat )lineWidth andColor:(UIColor *)progressColor; +@property (assign,nonatomic) float progress; + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Utils/XLCircleProgress.m b/XinjiangProject/XinjiangProject/Utils/XLCircleProgress.m new file mode 100644 index 0000000..4325b9c --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XLCircleProgress.m @@ -0,0 +1,55 @@ +// +// XLCircleProgress.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/13. +// + + +#import "XLCircleProgress.h" +#import "XLCircle.h" + +@implementation XLCircleProgress +{ + XLCircle* _circle; + UILabel *_percentLabel; + CGFloat _lineWidth; + UIColor * _progressColor; +} + +-(instancetype)initWithFrame:(CGRect)frame withLineWidth:(CGFloat )lineWidth andColor:(UIColor *)progressColor +{ + self = [super initWithFrame:frame]; + if (self) { + _lineWidth = lineWidth; + _progressColor = progressColor; + [self initUI]; + } + return self; +} + + +-(void)initUI +{ + + _percentLabel = [[UILabel alloc] initWithFrame:self.bounds]; + _percentLabel.textColor = [UIColor whiteColor]; + _percentLabel.textAlignment = NSTextAlignmentCenter; + _percentLabel.font = [UIFont boldSystemFontOfSize:50]; + _percentLabel.text = @"0%"; + [self addSubview:_percentLabel]; + + _circle = [[XLCircle alloc] initWithFrame:self.bounds lineWidth:_lineWidth withProgressColor:_progressColor]; + [self addSubview:_circle]; +} + +#pragma mark - +#pragma mark Setter方法 +-(void)setProgress:(float)progress +{ + _progress = progress; + _circle.progress = progress; + _percentLabel.text = [NSString stringWithFormat:@"%.0f%%",progress*100]; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XMButton/XMButton.h b/XinjiangProject/XinjiangProject/Utils/XMButton/XMButton.h new file mode 100755 index 0000000..9deaf2a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XMButton/XMButton.h @@ -0,0 +1,38 @@ +// +// XMButton.h +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. + +#import + + +struct SDEdge { + BOOL top; + BOOL left; + BOOL bottom; + BOOL right; +}; +typedef struct SDEdge SDEdge; + + +typedef NS_ENUM(NSUInteger, SDButtonStyle) { + SDButtonStyleNormal, // 默认 + SDButtonStyleTop, // 图标在上,文本在下(居中) +}; + +@interface XMButton : UIButton +@property (nonatomic, assign) SDButtonStyle style; +@property (nonatomic, assign) CGFloat interval; //图片和文字的间隔 + +@property (nonatomic, assign) CGFloat cornerRadius; +@property (nonatomic, assign) CGFloat imageW; +@property (nonatomic, assign) CGFloat imageX; +@property (nonatomic, assign) CGFloat imageY; +@property (nonatomic, assign) CGFloat imageH; +@property (nonatomic, assign) CGFloat imageToTitle; + +@property (nonatomic, assign) SDEdge edge; +@property (nonatomic, strong) UIColor *lineColor; +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XMButton/XMButton.m b/XinjiangProject/XinjiangProject/Utils/XMButton/XMButton.m new file mode 100755 index 0000000..e2ebde9 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XMButton/XMButton.m @@ -0,0 +1,147 @@ +// +// XMButton.m +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. + +#import "XMButton.h" +#import "XMCommonUtils.h" + +#define ButtonWidth self.bounds.size.width +#define ButtonHeight self.bounds.size.height + +@implementation XMButton +#pragma mark - 重写setter方法 +- (void)setCornerRadius:(CGFloat)cornerRadius +{ + self.layer.masksToBounds = YES; + self.layer.cornerRadius = cornerRadius; +} + + +#pragma mark - 重新布局subview +- (void)layoutSubviews +{ + [super layoutSubviews]; + + switch (_style) + { + case SDButtonStyleNormal: + self.imageView.width = self.imageW; + self.imageView.height = self.imageH; + [self layoutSubviewsWithStyleNormal]; + break; + case SDButtonStyleTop: + self.imageView.frame = CGRectMake(self.imageX, self.imageY,self.imageW, self.imageH); + [self layoutSubviewsWithStyleTop]; + break; + default: + self.imageView.width = self.imageW; + self.imageView.height = self.imageH; + [self layoutSubviewsWithStyleNormal]; + break; + } + + +} +- (void)layoutSubviewsWithStyleNormal +{ + CGRect titleFrame = self.titleLabel.frame; + CGRect imageFrame = self.imageView.frame; + + CGFloat subviewsWidth = CGRectGetWidth(titleFrame) + CGRectGetWidth(imageFrame); + if (subviewsWidth+_interval <= ButtonWidth) + { + imageFrame.origin.x = self.imageX; + imageFrame.origin.y = (ButtonHeight-self.imageH)/2; + titleFrame.size.height = self.ButtonHeight; + titleFrame.origin.x = imageFrame.origin.x+self.imageW+_imageToTitle; + + titleFrame.origin.y = 0; + } + else + { + imageFrame.origin.x = 0; + titleFrame.origin.x = ButtonWidth - CGRectGetWidth(titleFrame); + } + self.titleLabel.textAlignment = NSTextAlignmentLeft; + self.titleLabel.frame = titleFrame; + self.imageView.frame = imageFrame; +} +- (void)layoutSubviewsWithStyleTop +{ + CGRect titleFrame = self.titleLabel.frame; + CGRect imageFrame = self.imageView.frame; + + self.titleLabel.textAlignment = NSTextAlignmentCenter; + + CGFloat subviewsHeight = CGRectGetHeight(titleFrame) + CGRectGetHeight(imageFrame); + if (subviewsHeight+_interval <= ButtonHeight) + { + + titleFrame.origin.x = 0; + titleFrame.origin.y = imageFrame.origin.y + CGRectGetHeight(imageFrame) + _interval; + titleFrame.size.width = ButtonWidth; + } + else + { + imageFrame.origin.x = (ButtonWidth - CGRectGetWidth(imageFrame)) / 4; + imageFrame.origin.y = 0; + + titleFrame.origin.x = 0; + titleFrame.origin.y = ButtonHeight - CGRectGetHeight(titleFrame); + titleFrame.size.width = ButtonWidth; + } + self.imageView.contentMode = UIViewContentModeScaleAspectFill; + self.imageView.clipsToBounds = YES; + self.titleLabel.frame = titleFrame; + self.imageView.frame = imageFrame; +} + +- (void)drawRect:(CGRect)rect +{ + [super drawRect:rect]; + + if (_edge.top) + { + [XMCommonUtils drawLine:self + lineWidth:1.0 + lineColor:(_lineColor ? _lineColor : UIColorLine) + startPoint:CGPointMake(0, 0) + interPoints:nil + endPoint:CGPointMake(self.width, 0)]; + } + if (_edge.left) + { + [XMCommonUtils drawLine:self + lineWidth:1.0 + lineColor:(_lineColor ? _lineColor : UIColorLine) + startPoint:CGPointMake(0, 0) + interPoints:nil + endPoint:CGPointMake(0, self.height)]; + } + if (_edge.bottom) + { + [XMCommonUtils drawLine:self + lineWidth:1.0 + lineColor:(_lineColor ? _lineColor : UIColorLine) + startPoint:CGPointMake(0, self.height) + interPoints:nil + endPoint:CGPointMake(self.width, self.height)]; + } + if (_edge.right) + { + [XMCommonUtils drawLine:self + lineWidth:1.0 + lineColor:(_lineColor ? _lineColor : UIColorLine) + startPoint:CGPointMake(self.width, 0) + interPoints:nil + endPoint:CGPointMake(self.width, self.height)]; + } + +} + + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XMButton/XMCommonUtils.h b/XinjiangProject/XinjiangProject/Utils/XMButton/XMCommonUtils.h new file mode 100755 index 0000000..aa36094 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XMButton/XMCommonUtils.h @@ -0,0 +1,132 @@ +// +// XMCommonUtils.h +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. + +#import +#import +@interface SDWeakTimerTarget : NSObject +@property (nonatomic, weak) id target; +@property (nonatomic, weak) NSTimer * timer; +@property (nonatomic, assign) SEL selector; +@end + + +@interface XMCommonUtils : NSObject +/** + * 返回NSTimer对象,与系统的方法的区别是:次方法中的Target是一个弱引用对象 + * + * @param interval 时间间隔 + * @param aTarget 对象 + * @param aSelector SEL + * @param userInfo + * @param repeats 是否重复 + * + * @return NSTimer对象 + */ ++ (NSTimer *) scheduledTimerWithTimeInterval:(NSTimeInterval)interval + target:(id)aTarget + selector:(SEL)aSelector + userInfo:(id)userInfo + repeats:(BOOL)repeats; + + + +/** + * 判断APP是否第一次运行。使用UserDefault来记录的,key为RunCount + * @return 返回BOOL值。YES表示第一次运行APP,NO相反 + */ ++ (BOOL)isFirstRunApp; + +/** + * 判断用户是否第一次登录。使用UserDefault来记录的,key为LoginCount + * @return 返回BOOL值。YES表示第一次登录,NO相反 + */ ++ (BOOL)isFirstLogin; + +/** + * 判断APP是否登录 + */ ++ (BOOL)isLogin; + ++ (NSString *)loginID; + +//编码问题 ++(NSString*)DataTOjsonString:(id)object; + + + + + + ++ (BOOL)validatePassword:(NSString *)mobile; + +/** +* 返回一个layer动画 +* +* @param type 动画的类型 fade moveIn push reveal cube(立方) rippleEffect(波纹) suckEffect(吸; 吮) +oglFlip(弹,掷) pageCurl pageUnCurl cameraIrisHollowOpen cameraIrisHollowClose等 +* @param subtype 方向的类型。 fromLeft, fromRight, fromTop, fromBottom +* @param duration 动画时长 +* @return CATransition对象 +*/ ++ (CATransition *)layerAnimationWithType:(NSString *)type + subtype:(NSString *)subtype + duration:(NSInteger)duration; + +//画虚线 ++ (CAShapeLayer *)drawDashLine:(UIView *)superView + lineWidth:(CGFloat)lineWidth + lineColor:(UIColor *)lineColor + lineProperty:(NSArray *)lineProperty + startPoint:(CGPoint)startPoint + endPoint:(CGPoint)endPoint; +//画实线 ++ (CAShapeLayer *)drawLine:(UIView *)superView + lineWidth:(CGFloat)lineWidth + lineColor:(UIColor *)lineColor + startPoint:(CGPoint)startPoint + interPoints:(NSArray *)interPoints + endPoint:(CGPoint)endPoint; +//画文字 ++ (CATextLayer *)drawText:(UIView *)superView + frame:(CGRect)frame + text:(NSString *)text + textColor:(UIColor *)textColor + font:(UIFont *)font; ++ (CATextLayer *)drawText:(UIView *)superView + frame:(CGRect)frame + alignmentMode:(NSString *)alignmentMode + text:(NSString *)text + textColor:(UIColor *)textColor + font:(UIFont *)font; + ++ (CGSize)sizeOfString:(NSString *)text + withWidth:(float)width + font:(UIFont *)font; + + + ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString; + +//存储plist文件 ++ (void)saveArrayDataForPlistFile:(NSMutableArray *)array + fileName:(NSString *)fileName; +//读取plist文件数据 ++ (NSArray *)readArrayDataFromePlistFile:(NSString *)fileName; ++(CGFloat)getSpaceLabelHeight:(UILabel *)label + withStr:(NSString*)str + withFont:(UIFont*)font + withWidth:(CGFloat)width + withLineSpacing:(CGFloat)linespace; + +//归档和解归档 ++ (void)keyedArchiverWithData:(nullable id)responseObject key:(NSString *)key; ++ (nullable id)keyedUnarchiverWithKey:(NSString *)key; + + + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XMButton/XMCommonUtils.m b/XinjiangProject/XinjiangProject/Utils/XMButton/XMCommonUtils.m new file mode 100755 index 0000000..2fc0e36 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XMButton/XMCommonUtils.m @@ -0,0 +1,366 @@ +// +// XMCommonUtils.m +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// +#import "XMCommonUtils.h" +#import "XMKeychainTool.h" +#import "HQUserInfo.h" + + +@implementation SDWeakTimerTarget +- (void) fire:(NSTimer *)timer +{ + if(self.target) + { + //传递消息的一种机制 + [self.target performSelector:self.selector withObject:timer.userInfo]; + } + else + { + [self.timer invalidate]; + } +} +@end + + + +@implementation XMCommonUtils ++ (NSTimer *) scheduledTimerWithTimeInterval:(NSTimeInterval)interval + target:(id)aTarget + selector:(SEL)aSelector + userInfo:(id)userInfo + repeats:(BOOL)repeats +{ + SDWeakTimerTarget* timerTarget = [[SDWeakTimerTarget alloc] init]; + timerTarget.target = aTarget; + timerTarget.selector = aSelector; + timerTarget.timer = [NSTimer scheduledTimerWithTimeInterval:interval + target:timerTarget + selector:@selector(fire:) + userInfo:userInfo + repeats:repeats]; + return timerTarget.timer; +} + + + + ++ (BOOL)isFirstRunApp +{ + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + NSInteger runCount = [ud integerForKey:@"RunCount"]; + if (0 == runCount) + { + [ud setInteger:++runCount forKey:@"RunCount"]; + [ud synchronize]; + return YES; + } + return NO; +} + ++ (BOOL)isFirstLogin +{ + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + NSInteger loginCount = [ud integerForKey:@"LoginCount"]; + if (0 == loginCount) + { + [ud setInteger:++loginCount forKey:@"LoginCount"]; + [ud synchronize]; + return YES; + } + return NO; +} + + ++ (BOOL)isLogin +{ + if ([self keyedUnarchiverWithKey:LoginUserInfo] == nil) + { + return NO; + } + return YES; +} + + ++ (NSString *)loginID +{ + NSString *string = nil; + if ([self isLogin]) + { + HQUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.user_id]; + } + else + { + string = @"0"; + } + + + return string; +} + + + + ++ (CATransition *)layerAnimationWithType:(NSString *)type + subtype:(NSString *)subtype + duration:(NSInteger)duration +{ + CATransition *animation = [CATransition animation]; + animation.type = type; //@"rippleEffect" + animation.subtype = subtype;//`fromLeft', `fromRight', `fromTop' `fromBottom'. + animation.duration = duration; + + return animation; +} + +//验证手机号 ++ (BOOL)validatePassword:(NSString *)mobile +{ + //手机号以13, 15,18,17开头,八个 \d 数字字符 + NSString *regex = @"(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}"; + NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; + + return [pred evaluateWithObject:mobile]; +} + + + + +//画虚线 ++ (CAShapeLayer *)drawDashLine:(UIView *)superView + lineWidth:(CGFloat)lineWidth + lineColor:(UIColor *)lineColor + lineProperty:(NSArray *)lineProperty + startPoint:(CGPoint)startPoint + endPoint:(CGPoint)endPoint +{ + CAShapeLayer *shapeLayer = [CAShapeLayer layer]; + shapeLayer.frame = superView.bounds; + shapeLayer.fillColor = [UIColor clearColor].CGColor; + shapeLayer.lineWidth = lineWidth; //虚线宽度 + shapeLayer.strokeColor = lineColor.CGColor; //虚线颜色 + shapeLayer.lineJoin = kCALineCapRound; + shapeLayer.lineDashPattern = lineProperty; //@[@6,@3] 6表示线宽,3表示线间隔 + + CGMutablePathRef path = CGPathCreateMutable(); + CGPathMoveToPoint(path, NULL, startPoint.x, startPoint.y); + CGPathAddLineToPoint(path, NULL, endPoint.x, endPoint.y); + + shapeLayer.path = path; + CGPathRelease(path); + + [superView.layer addSublayer:shapeLayer]; + return shapeLayer; +} +//画实线 ++ (CAShapeLayer *)drawLine:(UIView *)superView + lineWidth:(CGFloat)lineWidth + lineColor:(UIColor *)lineColor + startPoint:(CGPoint)startPoint + interPoints:(NSArray *)interPoints + endPoint:(CGPoint)endPoint +{ + UIBezierPath *path = [UIBezierPath bezierPath]; + [path moveToPoint:startPoint]; + for (NSValue *pointValue in interPoints) + { + [path addLineToPoint:pointValue.CGPointValue]; + } + [path addLineToPoint:endPoint]; + + CAShapeLayer *shapeLayer = [CAShapeLayer layer]; + shapeLayer.frame = superView.bounds; + shapeLayer.fillColor = [UIColor clearColor].CGColor; + shapeLayer.lineWidth = lineWidth; //虚线宽度 + shapeLayer.strokeColor = lineColor.CGColor; //虚线颜色 + shapeLayer.lineJoin = kCALineJoinBevel; + shapeLayer.path = path.CGPath; + + [superView.layer addSublayer:shapeLayer]; + return shapeLayer; +} +//画文字 ++ (CATextLayer *)drawText:(UIView *)superView + frame:(CGRect)frame + text:(NSString *)text + textColor:(UIColor *)textColor + font:(UIFont *)font +{ + return [self drawText:superView + frame:frame + alignmentMode:kCAAlignmentCenter + text:text + textColor:textColor + font:font]; +} ++ (CATextLayer *)drawText:(UIView *)superView + frame:(CGRect)frame + alignmentMode:(NSString *)alignmentMode + text:(NSString *)text + textColor:(UIColor *)textColor + font:(UIFont *)font +{ + CATextLayer *textLayer = [[CATextLayer alloc] init]; + [textLayer setFrame:frame]; + [textLayer setAlignmentMode:alignmentMode]; + [textLayer setForegroundColor:[textColor CGColor]]; + [textLayer setBackgroundColor:[[UIColor clearColor] CGColor]]; + [textLayer setContentsScale:[UIScreen mainScreen].scale]; + // [textLayer setTruncationMode:kCATruncationEnd]; //如何将字符串截断以适应图层大小 + + + CFStringRef fontName = (__bridge CFStringRef)font.fontName; + CGFontRef fontRef = CGFontCreateWithFontName(fontName); + textLayer.font = fontRef; + textLayer.fontSize = font.pointSize; + CGFontRelease(fontRef); + + [textLayer setString:text]; + + [superView.layer addSublayer:textLayer]; + return textLayer; +} + ++ (CGSize)sizeOfString:(NSString *)text + withWidth:(float)width + font:(UIFont *)font +{ + CGSize size = CGSizeMake(width, MAXFLOAT); + + if ([text respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) { + NSDictionary *tdic = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]; + size = [text boundingRectWithSize:size + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading + attributes:tdic + context:nil].size; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + size = [text sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping]; +#pragma clang diagnostic pop + } + + return size; +} + + + +/*! + * @brief 把格式化的JSON格式的字符串转换成字典 + * @param jsonString JSON格式的字符串 + * @return 返回字典 + */ ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString +{ + if (jsonString == nil) { + return nil; + } + + NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; + NSError *err; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData + options:NSJSONReadingMutableContainers + error:&err]; + if(err) { + NSLog(@"json解析失败:%@",err); + return nil; + } + return dic; +} + + ++ (void)keyedArchiverWithData:(nullable id)responseObject key:(NSString *)key +{ + NSMutableData *saveData = [NSMutableData data]; + NSKeyedArchiver *keyedArchiver = [[NSKeyedArchiver alloc]initForWritingWithMutableData:saveData]; + [keyedArchiver encodeObject:responseObject forKey:key]; + [keyedArchiver finishEncoding]; + + // 获取沙盒目录 + NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:key]; + if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) + { + [[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil]; + } + //写到文件中 + [saveData writeToFile:fullPath atomically:YES]; +} ++ (nullable id)keyedUnarchiverWithKey:(NSString *)key +{ + // 获取数据目录 + NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:key]; + + NSData *saveData = [NSData dataWithContentsOfFile:fullPath]; + + NSKeyedUnarchiver *keyedUnarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:saveData]; + + return [keyedUnarchiver decodeObjectForKey:key]; +} ++(NSString*)DataTOjsonString:(id)object +{ + NSString *jsonString = nil; + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object + options:NSJSONWritingPrettyPrinted + error:&error]; + if (!jsonData) { + } else { + jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + } + return jsonString; +} +//存储plist文件 ++(void)saveArrayDataForPlistFile:(NSMutableArray *)array + fileName:(NSString *)fileName +{ + + NSString *docPath=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; + NSString *filePath = [docPath stringByAppendingPathComponent: + [fileName stringByAppendingString:@".plist"]]; + + [array writeToFile:filePath atomically:YES]; +} ++(NSArray *)readArrayDataFromePlistFile:(NSString *)fileName +{ + NSString *docPath=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; + NSString *filePath = [docPath stringByAppendingPathComponent: + [fileName stringByAppendingString:@".plist"]]; + NSArray *arr= [NSArray arrayWithContentsOfFile:filePath]; + return arr; +} + +//计算UILabel的高度(带有行间距的情况) ++(CGFloat)getSpaceLabelHeight:(UILabel *)label + withStr:(NSString*)str + withFont:(UIFont*)font + withWidth:(CGFloat)width + withLineSpacing:(CGFloat)linespace{ + NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init]; + paraStyle.lineBreakMode = NSLineBreakByCharWrapping; + paraStyle.alignment = NSTextAlignmentLeft; + //设置行间距 + paraStyle.lineSpacing = linespace; + paraStyle.hyphenationFactor = 1.0; + paraStyle.firstLineHeadIndent = 0.0; + paraStyle.paragraphSpacingBefore = 0.0; + paraStyle.headIndent = 0; + paraStyle.tailIndent = 0; + //设置字间距 NSKernAttributeName:@1.5f + NSDictionary *dic = @{NSFontAttributeName:font, + NSParagraphStyleAttributeName:paraStyle, + NSKernAttributeName:@1.0f + }; + NSAttributedString *attributeStr = [[NSAttributedString alloc] initWithString:str attributes:dic]; + label.attributedText = attributeStr; + CGSize size = [str boundingRectWithSize:CGSizeMake(width, MAXFLOAT) + options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size; + return size.height; +} + + + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransition.h b/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransition.h new file mode 100755 index 0000000..5beac61 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransition.h @@ -0,0 +1,17 @@ +// +// XYTransition.h +// UniversalApp +// +// Created by 徐阳 on 2017/6/30. +// Copyright © 2017年 徐阳. All rights reserved. +// + +#import + +@interface XYTransition : NSObject + +@property(nonatomic,assign) BOOL isPush;//是否是push,反之则是pop + +@property (nonatomic, assign) NSTimeInterval animationDuration;//动画时长 + +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransition.m b/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransition.m new file mode 100755 index 0000000..61fd091 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransition.m @@ -0,0 +1,187 @@ +// +// XYTransition.m +// UniversalApp +// +// Created by 徐阳 on 2017/6/30. +// Copyright © 2017年 徐阳. All rights reserved. +// + +#import "XYTransition.h" +#import "XYTransitionProtocol.h" + +@interface XYTransition() + +@property (nonatomic, assign) CGFloat animationScale;//缩放比例 + +@end + +@implementation XYTransition + +-(instancetype)init{ + self = [super init]; + if (self) { + self.animationDuration = 0.3; + } + return self; +} + +- (NSTimeInterval)transitionDuration:(id)transitionContext +{ + return self.animationDuration; +} + +- (void)animateTransition:(id)transitionContext +{ + if (_isPush) { + [self pushAnimateTransition:transitionContext]; + }else{ + [self popAnimateTransition:transitionContext]; + } +} + +#pragma mark ————— push ————— +- (void)pushAnimateTransition:(id)transitionContext +{ + //获取跳转的Controller和目标Controller + UIViewController * fromVC = (UIViewController * )[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; + UIViewController * toVC = (UIViewController * )[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + //from和to的两个视图 + __block UIView * fromView = fromVC.view; + __block UIView * toView = toVC.view; + + //container容器加入要显示的视图 不加入fromVC 返回的时候就无法返回 + UIView * containerView = [transitionContext containerView]; + [containerView addSubview:fromView]; + [containerView addSubview:toView]; + + //转场动画的目标View + UIView *fromCellView = [fromVC targetTransitionView]; + UIView *toCellView = [toVC targetTransitionView]; + + //获取cell相对左上角坐标 计算相对坐标 + CGPoint nowViewPoint = [fromCellView convertPoint:CGPointZero toView:nil]; + + //获取当前view相对窗口坐标 + CGPoint toViewPoint = [toCellView convertPoint:CGPointZero toView:nil]; + + toView.hidden = YES; + + + //复制一个Cell用于显示动画效果 + __block UIImageView * snapShot =[[UIImageView alloc] initWithImage:[fromCellView snapshotImage]]; + snapShot.backgroundColor = [UIColor clearColor]; + [containerView addSubview:snapShot]; + + [snapShot setOrigin:nowViewPoint]; + //计算缩放比例 + _animationScale = MAX([toVC targetTransitionView].width, snapShot.width) / MIN([toVC targetTransitionView].width, snapShot.width); + CGRect originFrame = fromView.frame; + [UIView animateWithDuration:self.animationDuration animations:^{ + //设置缩放变换 x,y分别放大多少倍 + snapShot.transform = CGAffineTransformMakeScale(_animationScale,_animationScale); + [snapShot setOrigin:toViewPoint]; + + fromView.alpha = 0; + fromView.transform = snapShot.transform; + fromView.frame = CGRectMake(-(nowViewPoint.x)*_animationScale, + -(nowViewPoint.y)*_animationScale + toViewPoint.y, + fromVC.view.frame.size.width, + fromVC.view.frame.size.height); + kAppDelegate.mainTabBar.tabBar.alpha = 0; + } completion:^(BOOL finished) { + if (finished) { + //没有这句过滤动画就不会结束 + [snapShot removeFromSuperview]; + toView.hidden = NO; + fromView.alpha = 1; + fromVC.view.transform = CGAffineTransformIdentity; + fromVC.view.frame = originFrame; + [transitionContext completeTransition:!transitionContext.transitionWasCancelled]; + } + }]; + +} + +#pragma mark ————— pop ————— +- (void)popAnimateTransition:(id)transitionContext +{ + //获取跳转VC和目标VC + UIViewController * fromVC = (UIViewController*)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; + UIViewController * toVC = (UIViewController*)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + + //添加要跳转的视图并且先隐藏掉 + UIView * containerView = [transitionContext containerView]; + __block UIView * toView = toVC.view; + [containerView addSubview:toView]; + toView.hidden = YES; + + //来源View + UIView *fromCellView = [fromVC targetTransitionView]; + + //转场动画的目标View + UIView *toCellView = [toVC targetTransitionView]; + + //获取相对窗口的坐标 + CGPoint leftUperPoint = [toCellView convertPoint:CGPointZero toView:nil]; + + //获取当前view相对窗口坐标 + CGPoint nowViewPoint = [fromCellView convertPoint:CGPointZero toView:nil]; + + //计算cell偏移量 为了更好的现实动画 +// CGFloat offsetY = fromVC.navigationController.navigationBarHidden ? 0.0 : 64; + //复制一份截图用于动画过程 + __block UIImageView * snapShot =[[UIImageView alloc] initWithImage:[toCellView snapshotImage]]; + + //计算缩放比例 + _animationScale = MAX(fromCellView.width, snapShot.width) / MIN(fromCellView.width, snapShot.width); + + [containerView addSubview:snapShot]; + snapShot.backgroundColor = [UIColor clearColor]; + //将目标View先放大到跟当前view一样大,然后在动画中缩小,实现动画pop效果 + snapShot.transform = CGAffineTransformMakeScale(_animationScale, _animationScale); + [snapShot setOrigin:CGPointMake(0, nowViewPoint.y)]; + //用于动画设置淡出缩小效果 + CGRect originFrame = toView.frame; + toView.hidden = NO; + toView.alpha = 0; + toView.transform = snapShot.transform; + + toView.frame = CGRectMake(-(leftUperPoint.x * _animationScale), -((leftUperPoint.y - nowViewPoint.y) * _animationScale + nowViewPoint.y), + toView.frame.size.width, toView.frame.size.height); + + + toCellView.hidden = YES; + //添加一个百色淡出效果 + __block UIView *whiteViewContainer = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + whiteViewContainer.backgroundColor = [UIColor whiteColor]; + + [containerView addSubview:whiteViewContainer]; + [containerView insertSubview:whiteViewContainer belowSubview:toView]; + kAppDelegate.mainTabBar.tabBar.alpha = 0; + [UIView animateWithDuration:self.animationDuration animations:^{ + snapShot.transform = CGAffineTransformIdentity; //恢复原来大小 + [snapShot setOrigin:leftUperPoint]; //设置相对位置 + toView.transform = CGAffineTransformIdentity; + toView.alpha = 1.0; + [toView setFrame:originFrame]; + kAppDelegate.mainTabBar.tabBar.alpha = 1; + } completion:^(BOOL finished) { + // if (finished) { + if (transitionContext.transitionWasCancelled) { + NSLog(@"动画取消"); + kAppDelegate.mainTabBar.tabBar.alpha = 0; + }else{ + NSLog(@"动画完成"); + } + + [snapShot removeFromSuperview]; + [whiteViewContainer removeFromSuperview]; + toCellView.hidden = NO; + toView.transform = CGAffineTransformIdentity; + toView.frame = originFrame; + [transitionContext completeTransition:!transitionContext.transitionWasCancelled]; + + // } + }]; +} +@end diff --git a/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransitionProtocol.h b/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransitionProtocol.h new file mode 100755 index 0000000..8ff7609 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Utils/XYTransition/XYTransitionProtocol.h @@ -0,0 +1,30 @@ +// +// XYTransitionProtocol.h +// UniversalApp +// +// Created by 徐阳 on 2017/6/30. +// Copyright © 2017年 徐阳. All rights reserved. +// + +#import +#import + +@protocol XYTransitionProtocol +@optional + +/** + 转场动画的目标View 需要转场动画的对象必须实现该方法并返回要做动画的View + + @return view + */ +-(UIView *)targetTransitionView; + + +/** + * 是否是需要实现转场效果,不需要转场动画可不实现,需要必须实现并返回YES + * + * @return 是否 + */ +-(BOOL)isNeedTransition; + +@end diff --git a/XinjiangProject/XinjiangProjectTests/XinjiangProjectTests.m b/XinjiangProject/XinjiangProjectTests/XinjiangProjectTests.m new file mode 100644 index 0000000..869a848 --- /dev/null +++ b/XinjiangProject/XinjiangProjectTests/XinjiangProjectTests.m @@ -0,0 +1,36 @@ +// +// XinjiangProjectTests.m +// XinjiangProjectTests +// +// Created by Apple on 2025/6/23. +// + +#import + +@interface XinjiangProjectTests : XCTestCase + +@end + +@implementation XinjiangProjectTests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/XinjiangProject/XinjiangProjectUITests/XinjiangProjectUITests.m b/XinjiangProject/XinjiangProjectUITests/XinjiangProjectUITests.m new file mode 100644 index 0000000..9a05e24 --- /dev/null +++ b/XinjiangProject/XinjiangProjectUITests/XinjiangProjectUITests.m @@ -0,0 +1,44 @@ +// +// XinjiangProjectUITests.m +// XinjiangProjectUITests +// +// Created by Apple on 2025/6/23. +// + +#import + +@interface XinjiangProjectUITests : XCTestCase + +@end + +@implementation XinjiangProjectUITests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + self.continueAfterFailure = NO; + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // UI tests must launch the application that they test. + XCUIApplication *app = [[XCUIApplication alloc] init]; + [app launch]; + + // Use XCTAssert and related functions to verify your tests produce the correct results. +} + +- (void)testLaunchPerformance { + // This measures how long it takes to launch your application. + [self measureWithMetrics:@[[[XCTApplicationLaunchMetric alloc] init]] block:^{ + [[[XCUIApplication alloc] init] launch]; + }]; +} + +@end diff --git a/XinjiangProject/XinjiangProjectUITests/XinjiangProjectUITestsLaunchTests.m b/XinjiangProject/XinjiangProjectUITests/XinjiangProjectUITestsLaunchTests.m new file mode 100644 index 0000000..4f828a8 --- /dev/null +++ b/XinjiangProject/XinjiangProjectUITests/XinjiangProjectUITestsLaunchTests.m @@ -0,0 +1,37 @@ +// +// XinjiangProjectUITestsLaunchTests.m +// XinjiangProjectUITests +// +// Created by Apple on 2025/6/23. +// + +#import + +@interface XinjiangProjectUITestsLaunchTests : XCTestCase + +@end + +@implementation XinjiangProjectUITestsLaunchTests + ++ (BOOL)runsForEachTargetApplicationUIConfiguration { + return YES; +} + +- (void)setUp { + self.continueAfterFailure = NO; +} + +- (void)testLaunch { + XCUIApplication *app = [[XCUIApplication alloc] init]; + [app launch]; + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + XCTAttachment *attachment = [XCTAttachment attachmentWithScreenshot:XCUIScreen.mainScreen.screenshot]; + attachment.name = @"Launch Screen"; + attachment.lifetime = XCTAttachmentLifetimeKeepAlways; + [self addAttachment:attachment]; +} + +@end