commit 038278d914f097462d78e59098e66d11988d7464 Author: History <2596007731@qq.com> Date: Fri Jul 4 11:20:59 2025 +0800 新疆专家端 diff --git a/DoctorXinjiang/DoctorXinjiang.xcodeproj/project.pbxproj b/DoctorXinjiang/DoctorXinjiang.xcodeproj/project.pbxproj new file mode 100644 index 0000000..bed6de1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang.xcodeproj/project.pbxproj @@ -0,0 +1,714 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 18F67F802E0A81D700F8C4A2 /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = 18F67F7F2E0A81D700F8C4A2 /* Podfile */; }; + 18F6BBB52E0AA4FC00F8C4A2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18F6BBB42E0AA4FC00F8C4A2 /* Security.framework */; }; + 18F6BBB92E0AA53D00F8C4A2 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18F6BBB82E0AA53D00F8C4A2 /* CoreTelephony.framework */; }; + 18F6BBBB2E0AA57F00F8C4A2 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18F6BBBA2E0AA57F00F8C4A2 /* GLKit.framework */; }; + DC560BA5B22ACA1774C7E09B /* libPods-DoctorXinjiang.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CAFC690E14C25C2FF40737B /* libPods-DoctorXinjiang.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1883A98B2E0A4AD40055089B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1883A9672E0A4AD10055089B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1883A96E2E0A4AD10055089B; + remoteInfo = DoctorXinjiang; + }; + 1883A9952E0A4AD40055089B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1883A9672E0A4AD10055089B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1883A96E2E0A4AD10055089B; + remoteInfo = DoctorXinjiang; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1883A96F2E0A4AD10055089B /* DoctorXinjiang.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DoctorXinjiang.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1883A98A2E0A4AD40055089B /* DoctorXinjiangTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DoctorXinjiangTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1883A9942E0A4AD40055089B /* DoctorXinjiangUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DoctorXinjiangUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 18F67F7F2E0A81D700F8C4A2 /* Podfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 18F6BBB42E0AA4FC00F8C4A2 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 18F6BBB62E0AA50A00F8C4A2 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; + 18F6BBB72E0AA51500F8C4A2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 18F6BBB82E0AA53D00F8C4A2 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; + 18F6BBBA2E0AA57F00F8C4A2 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; + 7CAFC690E14C25C2FF40737B /* libPods-DoctorXinjiang.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-DoctorXinjiang.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 89026E00E1DDA04F74446DC0 /* Pods-DoctorXinjiang.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DoctorXinjiang.release.xcconfig"; path = "Target Support Files/Pods-DoctorXinjiang/Pods-DoctorXinjiang.release.xcconfig"; sourceTree = ""; }; + 97D33B21A85118EF4503CDD0 /* Pods-DoctorXinjiang.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DoctorXinjiang.debug.xcconfig"; path = "Target Support Files/Pods-DoctorXinjiang/Pods-DoctorXinjiang.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 1883AEB52E0A6F210055089B /* Exceptions for "DoctorXinjiang" folder in "DoctorXinjiang" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + "Supporting Files/Info.plist", + ); + target = 1883A96E2E0A4AD10055089B /* DoctorXinjiang */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 1883A9712E0A4AD10055089B /* DoctorXinjiang */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 1883AEB52E0A6F210055089B /* Exceptions for "DoctorXinjiang" folder in "DoctorXinjiang" target */, + ); + path = DoctorXinjiang; + sourceTree = ""; + }; + 1883A98D2E0A4AD40055089B /* DoctorXinjiangTests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = DoctorXinjiangTests; + sourceTree = ""; + }; + 1883A9972E0A4AD40055089B /* DoctorXinjiangUITests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = DoctorXinjiangUITests; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1883A96C2E0A4AD10055089B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 18F6BBB52E0AA4FC00F8C4A2 /* Security.framework in Frameworks */, + 18F6BBBB2E0AA57F00F8C4A2 /* GLKit.framework in Frameworks */, + 18F6BBB92E0AA53D00F8C4A2 /* CoreTelephony.framework in Frameworks */, + DC560BA5B22ACA1774C7E09B /* libPods-DoctorXinjiang.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1883A9872E0A4AD40055089B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1883A9912E0A4AD40055089B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1883A9662E0A4AD10055089B = { + isa = PBXGroup; + children = ( + 18F67F7F2E0A81D700F8C4A2 /* Podfile */, + 1883A9712E0A4AD10055089B /* DoctorXinjiang */, + 1883A98D2E0A4AD40055089B /* DoctorXinjiangTests */, + 1883A9972E0A4AD40055089B /* DoctorXinjiangUITests */, + 1883A9702E0A4AD10055089B /* Products */, + 4222692EAAF776967D8AE608 /* Pods */, + 385F686A50CF176A68FD09C9 /* Frameworks */, + ); + sourceTree = ""; + }; + 1883A9702E0A4AD10055089B /* Products */ = { + isa = PBXGroup; + children = ( + 1883A96F2E0A4AD10055089B /* DoctorXinjiang.app */, + 1883A98A2E0A4AD40055089B /* DoctorXinjiangTests.xctest */, + 1883A9942E0A4AD40055089B /* DoctorXinjiangUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 385F686A50CF176A68FD09C9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 18F6BBBA2E0AA57F00F8C4A2 /* GLKit.framework */, + 18F6BBB82E0AA53D00F8C4A2 /* CoreTelephony.framework */, + 18F6BBB72E0AA51500F8C4A2 /* libz.tbd */, + 18F6BBB62E0AA50A00F8C4A2 /* libc++.tbd */, + 18F6BBB42E0AA4FC00F8C4A2 /* Security.framework */, + 7CAFC690E14C25C2FF40737B /* libPods-DoctorXinjiang.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4222692EAAF776967D8AE608 /* Pods */ = { + isa = PBXGroup; + children = ( + 97D33B21A85118EF4503CDD0 /* Pods-DoctorXinjiang.debug.xcconfig */, + 89026E00E1DDA04F74446DC0 /* Pods-DoctorXinjiang.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1883A96E2E0A4AD10055089B /* DoctorXinjiang */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1883A99D2E0A4AD40055089B /* Build configuration list for PBXNativeTarget "DoctorXinjiang" */; + buildPhases = ( + ACAA23BB1AA67269CD6F784B /* [CP] Check Pods Manifest.lock */, + 1883A96B2E0A4AD10055089B /* Sources */, + 1883A96C2E0A4AD10055089B /* Frameworks */, + 1883A96D2E0A4AD10055089B /* Resources */, + CB8DD4E9BE8895D6A39A5E05 /* [CP] Embed Pods Frameworks */, + 8D069A0A4EBD8020808E6454 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 1883A9712E0A4AD10055089B /* DoctorXinjiang */, + ); + name = DoctorXinjiang; + productName = DoctorXinjiang; + productReference = 1883A96F2E0A4AD10055089B /* DoctorXinjiang.app */; + productType = "com.apple.product-type.application"; + }; + 1883A9892E0A4AD40055089B /* DoctorXinjiangTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1883A9A22E0A4AD40055089B /* Build configuration list for PBXNativeTarget "DoctorXinjiangTests" */; + buildPhases = ( + 1883A9862E0A4AD40055089B /* Sources */, + 1883A9872E0A4AD40055089B /* Frameworks */, + 1883A9882E0A4AD40055089B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1883A98C2E0A4AD40055089B /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 1883A98D2E0A4AD40055089B /* DoctorXinjiangTests */, + ); + name = DoctorXinjiangTests; + productName = DoctorXinjiangTests; + productReference = 1883A98A2E0A4AD40055089B /* DoctorXinjiangTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 1883A9932E0A4AD40055089B /* DoctorXinjiangUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1883A9A52E0A4AD40055089B /* Build configuration list for PBXNativeTarget "DoctorXinjiangUITests" */; + buildPhases = ( + 1883A9902E0A4AD40055089B /* Sources */, + 1883A9912E0A4AD40055089B /* Frameworks */, + 1883A9922E0A4AD40055089B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1883A9962E0A4AD40055089B /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 1883A9972E0A4AD40055089B /* DoctorXinjiangUITests */, + ); + name = DoctorXinjiangUITests; + productName = DoctorXinjiangUITests; + productReference = 1883A9942E0A4AD40055089B /* DoctorXinjiangUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1883A9672E0A4AD10055089B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1630; + TargetAttributes = { + 1883A96E2E0A4AD10055089B = { + CreatedOnToolsVersion = 16.3; + }; + 1883A9892E0A4AD40055089B = { + CreatedOnToolsVersion = 16.3; + TestTargetID = 1883A96E2E0A4AD10055089B; + }; + 1883A9932E0A4AD40055089B = { + CreatedOnToolsVersion = 16.3; + TestTargetID = 1883A96E2E0A4AD10055089B; + }; + }; + }; + buildConfigurationList = 1883A96A2E0A4AD10055089B /* Build configuration list for PBXProject "DoctorXinjiang" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 1883A9662E0A4AD10055089B; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 1883A9702E0A4AD10055089B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1883A96E2E0A4AD10055089B /* DoctorXinjiang */, + 1883A9892E0A4AD40055089B /* DoctorXinjiangTests */, + 1883A9932E0A4AD40055089B /* DoctorXinjiangUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1883A96D2E0A4AD10055089B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 18F67F802E0A81D700F8C4A2 /* Podfile in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1883A9882E0A4AD40055089B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1883A9922E0A4AD40055089B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 8D069A0A4EBD8020808E6454 /* [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-DoctorXinjiang/Pods-DoctorXinjiang-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + ACAA23BB1AA67269CD6F784B /* [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-DoctorXinjiang-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; + }; + CB8DD4E9BE8895D6A39A5E05 /* [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-DoctorXinjiang/Pods-DoctorXinjiang-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1883A96B2E0A4AD10055089B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1883A9862E0A4AD40055089B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1883A9902E0A4AD40055089B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1883A98C2E0A4AD40055089B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1883A96E2E0A4AD10055089B /* DoctorXinjiang */; + targetProxy = 1883A98B2E0A4AD40055089B /* PBXContainerItemProxy */; + }; + 1883A9962E0A4AD40055089B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1883A96E2E0A4AD10055089B /* DoctorXinjiang */; + targetProxy = 1883A9952E0A4AD40055089B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1883A99E2E0A4AD40055089B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 97D33B21A85118EF4503CDD0 /* Pods-DoctorXinjiang.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; + EXCLUDED_ARCHS = ""; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/DoctorXinjiang/ThirdParty", + ); + GCC_PREFIX_HEADER = "$(SRCROOT)/DoctorXinjiang/Supporting Files/PrefixHeader.pch"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/DoctorXinjiang/Supporting Files/Info.plist"; + INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; + INFOPLIST_KEY_NSCameraUsageDescription = "专家端需要访问您的相机用来您的头像上传是否同意?"; + INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "始终允许访问位置信息"; + INFOPLIST_KEY_NSLocationUsageDescription = "永不允许访问位置信息"; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "专家端使用期间允许访问位置信息"; + 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 = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.DoctorXinjiang; + 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; + }; + 1883A99F2E0A4AD40055089B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 89026E00E1DDA04F74446DC0 /* Pods-DoctorXinjiang.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; + EXCLUDED_ARCHS = arm64; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/DoctorXinjiang/ThirdParty", + ); + GCC_PREFIX_HEADER = "$(SRCROOT)/DoctorXinjiang/Supporting Files/PrefixHeader.pch"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/DoctorXinjiang/Supporting Files/Info.plist"; + INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; + INFOPLIST_KEY_NSCameraUsageDescription = "专家端需要访问您的相机用来您的头像上传是否同意?"; + INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "始终允许访问位置信息"; + INFOPLIST_KEY_NSLocationUsageDescription = "永不允许访问位置信息"; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "专家端使用期间允许访问位置信息"; + 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 = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.DoctorXinjiang; + 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; + }; + 1883A9A02E0A4AD40055089B /* 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; + }; + 1883A9A12E0A4AD40055089B /* 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; + }; + 1883A9A32E0A4AD40055089B /* 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.DoctorXinjiangTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DoctorXinjiang.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/DoctorXinjiang"; + }; + name = Debug; + }; + 1883A9A42E0A4AD40055089B /* 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.DoctorXinjiangTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DoctorXinjiang.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/DoctorXinjiang"; + }; + name = Release; + }; + 1883A9A62E0A4AD40055089B /* 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.DoctorXinjiangUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = DoctorXinjiang; + }; + name = Debug; + }; + 1883A9A72E0A4AD40055089B /* 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.DoctorXinjiangUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = DoctorXinjiang; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1883A96A2E0A4AD10055089B /* Build configuration list for PBXProject "DoctorXinjiang" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1883A9A02E0A4AD40055089B /* Debug */, + 1883A9A12E0A4AD40055089B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1883A99D2E0A4AD40055089B /* Build configuration list for PBXNativeTarget "DoctorXinjiang" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1883A99E2E0A4AD40055089B /* Debug */, + 1883A99F2E0A4AD40055089B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1883A9A22E0A4AD40055089B /* Build configuration list for PBXNativeTarget "DoctorXinjiangTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1883A9A32E0A4AD40055089B /* Debug */, + 1883A9A42E0A4AD40055089B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1883A9A52E0A4AD40055089B /* Build configuration list for PBXNativeTarget "DoctorXinjiangUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1883A9A62E0A4AD40055089B /* Debug */, + 1883A9A72E0A4AD40055089B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1883A9672E0A4AD10055089B /* Project object */; +} diff --git a/DoctorXinjiang/DoctorXinjiang.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DoctorXinjiang/DoctorXinjiang.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/DoctorXinjiang/DoctorXinjiang.xcworkspace/contents.xcworkspacedata b/DoctorXinjiang/DoctorXinjiang.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..f6d9ebb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Categorys/MQTextField.h b/DoctorXinjiang/DoctorXinjiang/Categorys/MQTextField.h new file mode 100644 index 0000000..43dc6db --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Categorys/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/DoctorXinjiang/DoctorXinjiang/Categorys/MQTextField.m b/DoctorXinjiang/DoctorXinjiang/Categorys/MQTextField.m new file mode 100644 index 0000000..ca4c2d4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Categorys/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/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+Log.h b/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+Log.h new file mode 100644 index 0000000..c65416f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+Log.m b/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+Log.m new file mode 100644 index 0000000..8901e1f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+NilSafe.h b/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+NilSafe.h new file mode 100644 index 0000000..8118376 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+NilSafe.m b/DoctorXinjiang/DoctorXinjiang/Categorys/NSDictionary/NSDictionary+NilSafe.m new file mode 100644 index 0000000..5060b59 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+HXExtension.h b/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+HXExtension.h new file mode 100644 index 0000000..a94783e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+HXExtension.m b/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+HXExtension.m new file mode 100644 index 0000000..15691a5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+NYS.h b/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+NYS.h new file mode 100644 index 0000000..3cc7d33 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+NYS.m b/DoctorXinjiang/DoctorXinjiang/Categorys/UIButton/UIButton+NYS.m new file mode 100644 index 0000000..51b8e48 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UIDevice/UIDevice+model.h b/DoctorXinjiang/DoctorXinjiang/Categorys/UIDevice/UIDevice+model.h new file mode 100644 index 0000000..e481868 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UIDevice/UIDevice+model.m b/DoctorXinjiang/DoctorXinjiang/Categorys/UIDevice/UIDevice+model.m new file mode 100644 index 0000000..487561f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.h b/DoctorXinjiang/DoctorXinjiang/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.h new file mode 100644 index 0000000..dcf3821 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.m b/DoctorXinjiang/DoctorXinjiang/Categorys/UILabel/UILabel+ChangeLineSpaceAndWordSpace.m new file mode 100644 index 0000000..b19a5d1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Define/FontAndColorMacros.h b/DoctorXinjiang/DoctorXinjiang/Define/FontAndColorMacros.h new file mode 100755 index 0000000..7a995b0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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"] + + +#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/DoctorXinjiang/DoctorXinjiang/Define/StatusMacros.h b/DoctorXinjiang/DoctorXinjiang/Define/StatusMacros.h new file mode 100755 index 0000000..5365dc1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Define/StatusMacros.h @@ -0,0 +1,68 @@ +// +// 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" + +//切换tabar +#define KNotificSelectHomePageTabbar @"SlectHomePageTabBar" + +#define KNotificSelectTabbarTwo @"SlectTwoTabBar" + +#define KNotificSelectMineTabbar @"SlectMineTabBar" + +//自动登录成功 +#define KNotificationAutoLoginSuccess @"KNotificationAutoLoginSuccess" + + +//用户信息缓存 名称 +#define KUserCacheName @"KUserCacheName" + + +//用户model缓存 +#define KUserModelCache @"KUserModelCache" + +//是否第一次进入 选用 +#define KUserFirstStar @"FirstStar" + +#define KNotificAgreeMapDelegate @"MAPDELEGATE" + +#define User_ID @"[HQCommonUtils loginID]" +#pragma mark - ——————— 网络状态相关 ———————— + +//网络状态变化 +#define KNotificationNetWorkStateChange @"KNotificationNetWorkStateChange" + + +#pragma mark: 网络前缀 + +#define ResourceAddress [NSString stringWithFormat:@"%@/file/show/",Http] + + +////新增 +//#define Http [[NSUserDefaults standardUserDefaults] objectForKey:@"HTTPS"] ?: @"https://default.url" +//#define H5DevHost [[NSUserDefaults standardUserDefaults] objectForKey:@"H5DevHost"] ?: @"https://api.cqygjk.com" +//#define IntervenH5 [[NSUserDefaults standardUserDefaults] objectForKey:@"H5DevHost"] ?: @"api.cqygjk.com" +//#define Http UserDefaultObjectForKey(@"HTTPS")// +//#define H5DevHost UserDefaultObjectForKey(@"H5DevHost")// +//#define IntervenH5 UserDefaultObjectForKey(@"IntervenH5") + + +#define Http @"https://xjgateway.mcrm.vip:8888"// +#define H5DevHost @"xjgateway.mcrm.vip:8888"// +#define IntervenH5 @"https://xjconsole.mcrm.vip:8888" +//开发环境地址 +//#define Http @"http://cqyt.dev.yg.dt.io"// +//#define H5DevHost @"cqyt.dev.yg.dt.io"// +//#define IntervenH5 @"http://cms.dev.yg.dt.io" + + +#endif /* StatusMacros_h */ diff --git a/DoctorXinjiang/DoctorXinjiang/Define/ThirdMacros.h b/DoctorXinjiang/DoctorXinjiang/Define/ThirdMacros.h new file mode 100755 index 0000000..fe5ce2b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Define/ThirdMacros.h @@ -0,0 +1,41 @@ +// +// 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 easeMobAppKey @"" + +#define easeTenantId @"" + +#define buglyAppid @"" + + + +//高德key +#define AMAPSDKKEY @"6f5c1979535a0bea4965d033306c61a7" + +//友盟appster + +#define UMAppSecret @"" + +#define UMAppkey @"" + +#define UNiversalLink @"" + +#endif /* ThirdMacros_h */ diff --git a/DoctorXinjiang/DoctorXinjiang/Define/YYUtilsMacros.h b/DoctorXinjiang/DoctorXinjiang/Define/YYUtilsMacros.h new file mode 100755 index 0000000..9915c39 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Define/YYUtilsMacros.h @@ -0,0 +1,219 @@ +// +// YYUtilsMacros.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +// + +#ifndef YYUtilsMacros_h +#define YYUtilsMacros_h + + + +//获取系统对象 + +#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);}) + +//-------------------打印日志------------------------- +//DEBUG 模式下打印日志,当前行 +#ifdef DEBUG +#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); +#else +#define DLog(...) +#endif + +/* 宽度*/ +#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 (RGBA(243,244,246,1)) +#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)"] ? 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/DoctorXinjiang/DoctorXinjiang/Manager/AppManager.h b/DoctorXinjiang/DoctorXinjiang/Manager/AppManager.h new file mode 100755 index 0000000..2649cbf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/AppManager.h @@ -0,0 +1,16 @@ +// +// AppManager.h +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// + +#import + +@interface AppManager : NSObject +#pragma mark ————— APP启动接口 ————— ++(void)appStart; + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/AppManager.m b/DoctorXinjiang/DoctorXinjiang/Manager/AppManager.m new file mode 100755 index 0000000..91c2aae --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/AppManager.m @@ -0,0 +1,18 @@ +// +// AppManager.m +// idleBuy +// +// Created by ios on 2018/5/29. +// Copyright © 2018年 ios. All rights reserved. +// + +#import "AppManager.h" + +@implementation AppManager + ++(void)appStart +{ + + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetAPI.h b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetAPI.h new file mode 100755 index 0000000..32ba328 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetAPI.h @@ -0,0 +1,104 @@ +// +// API.h +// XZYNetworking +// +// Created by 仁康信息 on 2022/9/9. +// Copyright © 2022年 仁康信息. All rights reserved. +// + +#import +#import "YXNetworkingWithCache.h" + +@interface YXNetAPI : NSObject + +@property (nonatomic,strong) YXNetworkingWithCache * 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)getHomeData:(NSMutableDictionary *)parmaDic; +- (void)getHomeSmallData:(NSMutableDictionary *)parmaDic; +- (void)getHomeFoundSmallHelpData:(NSMutableDictionary *)parmaDic; + +//接受咨询 +- (void)getAcceptQuestion:(NSMutableDictionary *)parmaDic; + +#pragma mark: -医生排班 + +- (void)PostDoctorWorkTime:(NSMutableDictionary *)parmDic; +- (void)GetDoctorWorkSetting:(NSMutableDictionary *)pamraDic; + +#pragma mark:咨询统计 + +- (void)GetQuestionStatistics:(NSMutableDictionary *)pamraDic; +- (void)GetStatisticsEarnings:(NSMutableDictionary *)pamraDic; +- (void)GetQuestionRecoredList:(NSMutableDictionary *)parmDic; +- (void)GetRecoredQuestionDetail:(NSMutableDictionary *)pamraDic; +- (void)getBodyReportDeatil:(NSMutableDictionary *)parmDic; +- (void)GetCancelReasourData:(NSMutableDictionary *)pamraDic; +- (void)submitCancelreasourData:(NSMutableDictionary *)pamraDic; +- (void)fileDetatilData:(NSMutableDictionary *)pamraDic; +#pragma mark:暂停公告 + +- (void)GetPublishServerMessage:(NSMutableDictionary *)pamraDic; +- (void)GetSPublishServerRecored:(NSMutableDictionary *)pamraDic; +- (void)GetChangePublishServer:(NSMutableDictionary *)pamraDic; +- (void)GetPhyscialSearchAnomalyData:(NSMutableDictionary *)parmDic; + +#pragma mark:发布公告 + +- (void)PostStopPublishServer:(NSMutableDictionary *)pamraDic; + +//查询停诊原因 +- (void)GetPublishServerReason:(NSMutableDictionary *)pamraDic; +//查询当前咨询数量 +- (void)GetCurrentServerNumber:(NSMutableDictionary *)pamraDic; +#pragma mark: im + +- (void)PostEndSoSIMQuestion:(NSMutableDictionary *)pamraDic; +- (void)GetEndPictureEndIMQuestion:(NSMutableDictionary *)pamraDic; +- (void)PostGroupIDArray:(NSMutableDictionary *)parmDic; + +#pragma mark - 我的模块 + +- (void)GetInquireDoctorInfo:(NSMutableDictionary *)pamraDic; + +//查询科室 +- (void)GetInquireDoctorRoomInfo:(NSMutableDictionary *)pamraDic; +//个人简介 +- (void)postUpdateDoctorInfo:(NSMutableDictionary *)pamraDic; +//收益明细 +- (void)GetBillListData:(NSMutableDictionary *)pamraDic; +//提现详情 +- (void)withDrawDetailsData:(NSMutableDictionary *)pamraDic; + +#pragma mark - 登录注册 + +- (void)PostLogin:(NSMutableDictionary *)parmDic; +- (void)GetIMLoginAccount:(NSMutableDictionary *)pamraDic; +- (void)postSetUserPassword:(NSMutableDictionary *)parmDic; +- (void)postImageArrayUpload:(NSArray *)imageArray; +- (void)postResetUserNewPassword:(NSMutableDictionary *)parmDic; +//更新头像 +- (void)updateUserAvatar:(NSMutableDictionary *)parmDic; +//更新密码 +- (void)updateDoctorLoginPassword:(NSMutableDictionary *)pamraDic; +- (void)getUserAgreementPrivacy:(NSMutableDictionary *)parmDic; +- (void)getVesionHideRegis:(NSMutableDictionary *)parmDic; +#pragma mark - IM模块 + +- (void)getAgainSessionReservationDate:(NSMutableDictionary *)parmDic; +- (void)getendVideoReportById:(NSMutableDictionary *)parmDic; +//获取体检语音 +- (void)docotorReportListAudioResource:(NSMutableDictionary *)parmDic; +- (void)docotorReportListHistoryDoctorAudioResource:(NSMutableDictionary *)parmDic; +- (void)GetDoctorPhyscialIDCardSearch:(NSMutableDictionary *)parmDic; +- (void)getHistoryReportById:(NSMutableDictionary *)parmDic; +- (void)getSendVideoStart:(NSMutableDictionary *)pamraDic; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetAPI.m b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetAPI.m new file mode 100755 index 0000000..0fb5c27 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetAPI.m @@ -0,0 +1,333 @@ +// +// API.m +// XZYNetworking +// +// Created by 仁康信息 on 2022/9/9. +// Copyright © 2022年 仁康信息. All rights reserved. +// + +#import "YXNetAPI.h" +#define needToken httpRequest.needToken +#define isLoginFlag httpRequest.isLoginFlag + +@implementation YXNetAPI + +#pragma mark - init方法 +@synthesize httpRequest; + +//无需token +- (instancetype)init:(id)delegate tag:(NSString *)tag +{ + YXUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + return [self init:delegate tag:tag NeedToken:user.token]; +} + +//携带token +- (instancetype)init:(id)delegate tag:(NSString *)tag NeedToken:(NSString *)NeedToken +{ + if (self=[super init]) { + if (![tag isEqualToString:@"LOGINGAPI"] || ![tag isEqualToString:@"CHANGEAPI"] ) { + + YXUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + httpRequest = [[YXNetworkingWithCache alloc] initWithDelegate:delegate bindTag:tag NeedToken:user.token]; + }else{ + httpRequest = [[YXNetworkingWithCache alloc] initWithDelegate:delegate bindTag:tag NeedToken:@""]; + + } + } + return self; +} +#pragma mark - 首页模块 +- (void)getHomeData:(NSMutableDictionary *)parmaDic { + + //GET https://starry.test.icdat.cn/health-consultation/api/consult/conSession/selectSessionProfessorIng HTTP/1.1 + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionProfessorIngNew",Http] params:parmaDic]; + + +} + +- (void)getHomeSmallData:(NSMutableDictionary *)parmaDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertProfessorAndHelperSessionShow",Http] params:parmaDic]; + +} + +- (void)getHomeFoundSmallHelpData:(NSMutableDictionary *)parmaDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertProfessorAndHelperSession",Http] params:parmaDic]; + +} +- (void)getAcceptQuestion:(NSMutableDictionary *)parmaDic { + +// GET https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conSession/sessionConfirm?id=1744619023486275586&startTime=1705287600000&endTime=1705294800000 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessionConfirm",Http] params:parmaDic]; +} +//结束图文咨询 +- (void)GetEndPictureEndIMQuestion:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/finishSession",Http] params:pamraDic]; +// /health-consultation/api/consult/conSession/finishSession +} + +- (void)PostEndSoSIMQuestion:(NSMutableDictionary *)pamraDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/orderOver",Http] params:pamraDic]; + +} + +- (void)GetInquireDoctorInfo:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/queryDoctor",Http] params:pamraDic]; + +} + +#pragma mark: -医生排班 + +- (void)PostDoctorWorkTime:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorScheduling/insertDoctorScheduling",Http] params:parmDic]; + +} + +#pragma mark: -查询医生排班 +- (void)GetDoctorWorkSetting:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorScheduling/selectDoctorScheduling",Http] params:pamraDic]; + +} + +- (void)postUpdateDoctorInfo:(NSMutableDictionary *)pamraDic { + +// POST https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conDoctor/update HTTP/1.1 + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/update",Http] params:pamraDic]; + + +} +#pragma mark:咨询统计 + +- (void)GetQuestionStatistics:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conCostStatistics/groupByTypehList",Http] params:pamraDic]; + +} + +- (void)GetStatisticsEarnings:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conCostStatistics/getStatistics",Http] params:pamraDic]; + +} + +- (void)GetQuestionRecoredList:(NSMutableDictionary *)parmDic { + + //selectSessionListByDoctorId + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByDoctorIdNew",Http] params:parmDic]; +} + +#pragma mark:咨询详情 +- (void)GetRecoredQuestionDetail:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessionDetailDoctorAll",Http] params:pamraDic]; + +} +- (void)getBodyReportDeatil:(NSMutableDictionary *)parmDic { + +// [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@cqyt/middleController/getCheckItemBySfzhNewNew",Http] params:parmDic]; + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/selectNewHealthReport",Http] params:parmDic]; + +} +//拒绝理由 +- (void)GetCancelReasourData:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectRejectReason",Http] params:pamraDic]; + +} +//开始视频 + +- (void)getSendVideoStart:(NSMutableDictionary *)pamraDic { + +// GET https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conSessionVideoInfo/startVideoSession?sessionId=1778696654498156546 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSessionVideoInfo/startVideoSession",Http] params:pamraDic]; + +} +//确认拒绝 +- (void)submitCancelreasourData:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessionReject",Http] params:pamraDic]; + +} +- (void)fileDetatilData:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByIdDoctor",Http] params:pamraDic]; +} + +//提现详情 +- (void)withDrawDetailsData:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conCostStatistics/queryById",Http] params:pamraDic]; +} + +- (void)getAgainSessionReservationDate:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/sessionReservationDate/sessionReservationDate",Http] params:parmDic]; + +} + + +//查询体检信息(整合,带正常异常数量) + +- (void)GetPhyscialSearchAnomalyData:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/cqyt/middleController/getCheckItemBySfzhTotal/",Http] params:parmDic]; + +} + +#pragma mark:暂停公告 + +//暂停公告发布 +- (void)GetPublishServerMessage:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/conDoctor/getServiceByDoctorId",Http] params:pamraDic]; + +} +//暂停公告列表 +- (void)GetSPublishServerRecored:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conService/list",Http] params:pamraDic]; + +} +//编辑公告状态 +- (void)GetChangePublishServer:(NSMutableDictionary *)pamraDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conService/edit",Http] params:pamraDic]; + +} + +//发布公告状态 +- (void)PostStopPublishServer:(NSMutableDictionary *)pamraDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conService/add",Http] params:pamraDic]; + +} +//查询停诊原因 +- (void)GetPublishServerReason:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictList",Http] params:pamraDic]; + +} +//查询当前咨询数量 +- (void)GetCurrentServerNumber:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionVideoExistDoctor",Http] params:pamraDic]; + +} + +//上传图片 +- (void)postImageArrayUpload:(NSArray *)imageArray { + + [httpRequest upLoadDataWithUrlStr:[NSString stringWithFormat:@"%@/sys/upload/uploadFileMany",Http] params:nil withDataArray:imageArray]; +} +//更新头像 +- (void)updateUserAvatar:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/sys/user/updateUserAvatar",Http] params:parmDic]; +} +#pragma mark - 登录注册 +- (void)PostLogin:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/conDoctor/loginDoctor",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=jump_url",Http] params:parmDic]; + + +} +/* + IM登录 + */ +- (void)GetIMLoginAccount:(NSMutableDictionary *)pamraDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-im/wnapp/userSigAndroid",Http] params:pamraDic]; +} + +- (void)PostGroupIDArray:(NSMutableDictionary *)parmDic { + +// POST https://starry.test.icdat.cn/health-consultation/api/consult/conSession/selectSessionByImIdNew HTTP/1.1 + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionByImIdNewNew",Http] params:parmDic]; +} + +#pragma mark:我的 +- (void)GetInquireDoctorRoomInfo:(NSMutableDictionary *)pamraDic { + +// GET https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conSicks/selectSickListByDepartmentIdDoctorSearch?departmentId=1677938163633926145 HTTP/1.1 + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSicks/selectSickListByDepartmentIdDoctorSearch",Http] params:pamraDic]; + +} + +- (void)GetBillListData:(NSMutableDictionary *)pamraDic { + // + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conCostStatistics/findlistpage",Http] params:pamraDic]; +} + +//修改密码 +- (void)updateDoctorLoginPassword:(NSMutableDictionary *)pamraDic { + //T https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conDoctor/updatePassword + [httpRequest httpPUTCacheRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/updatePassword",Http] params:pamraDic]; +} + +- (void)postResetUserNewPassword:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/api/anon/sys/resetUserPwd",Http] params:parmDic]; + +} + +- (void)postSetUserPassword:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/api/anon/sys/checkUser",Http] params:parmDic]; + +} +- (void)getVesionHideRegis:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system/sys/api/notice/selectIosUpdate",Http] params:parmDic]; +} + +//获取体检语音 +- (void)docotorReportListAudioResource:(NSMutableDictionary *)parmDic{ + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getVoiceUrl",Http] params:parmDic]; + +} +- (void)docotorReportListHistoryDoctorAudioResource:(NSMutableDictionary *)parmDic{ + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/convertVoice2",Http] params:parmDic]; + +} +- (void)GetDoctorPhyscialIDCardSearch:(NSMutableDictionary *)parmDic { + + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getHistoryReportByPage",Http] params:parmDic]; + +} +- (void)getHistoryReportById:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getHistoryReportById",Http] params:parmDic]; + +} + +- (void)getendVideoReportById:(NSMutableDictionary *)parmDic { + +// GET https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/sessionReservationDate/endPhone?id=1780071436959469569 HTTP/1.1 + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/sessionReservationDate/endPhone",Http] params:parmDic]; + +} + +//结束咨询 +- (void)getABMUpdate:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:@"https://base.icdat.cn/latest" params:parmDic]; + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetworkingWithCache.h b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetworkingWithCache.h new file mode 100755 index 0000000..01316b9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetworkingWithCache.h @@ -0,0 +1,48 @@ +// +// YXNetworkingWithCache.h +// XZYNetworking +// +// Created by 仁康信息 on 2022/9/9. +// Copyright © 2022年 仁康信息. All rights reserved. +// + +#import +#import +//#import + +@protocol XZYNetworkingWithCacheDelegate + +@optional +- (void)httpSuccess:(id)response bindTag:(NSString *)bindTag; + +- (void)httpError:(NSString *)error bindTag:(NSString *)bindTag; + +@end + +@interface YXNetworkingWithCache : 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 - PUT方法 +- (void)httpPUTCacheRequest:(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; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetworkingWithCache.m b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetworkingWithCache.m new file mode 100755 index 0000000..4e581f7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/YXNetworkingWithCache.m @@ -0,0 +1,463 @@ + +// +// YXNetworkingWithCache.m +// XZYNetworking +// +// Created by 仁康信息 on 2022/9/9. +// Copyright © 2022年 仁康信息. All rights reserved. +// + +#import "YXNetworkingWithCache.h" +#define DYLog(...) NSLog(__VA_ARGS__) //如果不需要打印数据, 注释掉NSLog + + +// 请求方式 +typedef NS_ENUM(NSInteger, RequestType) { + RequestTypeGet, + RequestTypePost, + RequestTypeUpLoad,//单个上传 + RequestTypeMultiUpload,//多个上传 + RequestTypeDownload, + RequestTypePUT, +}; + +@implementation YXNetworkingWithCache +{ + __weak YXNetworkingWithCache *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: -PUT方法 + +- (void)httpPUTCacheRequest:(NSString *)api params:(NSMutableDictionary *)params +{ + [self httpRequestWithUrlStr:api params:params requestType:RequestTypePUT 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]; +} + + +#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",@"没有网络"); + //断网后,根据网址从Cache中取数据进行显示 + + 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]; + + + 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"]; + NSArray * stringUrlOne = [statusCode componentsSeparatedByString:@"("]; +// if (stringUrlOne.count >= 1) +// { + if ([statusCode containsString:@"(401)"]) { + DLog(@"%@",error.userInfo); + [MBProgressHUD showErrorMessage:@"身份验证过期"]; + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + KPostNotification(KNotificationLoginStateChange, @NO); + }else{ + [MBProgressHUD showErrorMessage:@"网络服务错误"]; + } + +// } + + }]; + }else if (requestType == RequestTypePUT) {//put + + [session PUT:url parameters:params headers:@{@"X-Access-Token":self.needToken} 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); + [EasyTextView showErrorText:@"身份验证过期"]; + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + KPostNotification(KNotificationLoginStateChange, @NO); + }else + { + [MBProgressHUD showErrorMessage:@"网络服务错误"]; + } + }]; + + } 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); + [EasyTextView showErrorText:@"身份验证过期"]; + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + KPostNotification(KNotificationLoginStateChange, @NO); + } + else + { + [MBProgressHUD showErrorMessage:@"网络服务错误"]; + } + + }]; + + } 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:@{@"biz":@""} 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:@"上传文件出错"]; + }]; + } + +} + + +- (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) { + 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/DoctorXinjiang/DoctorXinjiang/Manager/TUIManager/ESCTUIManager.h b/DoctorXinjiang/DoctorXinjiang/Manager/TUIManager/ESCTUIManager.h new file mode 100644 index 0000000..26d2daa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Manager/TUIManager/ESCTUIManager.m b/DoctorXinjiang/DoctorXinjiang/Manager/TUIManager/ESCTUIManager.m new file mode 100644 index 0000000..0f33672 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/TUIManager/ESCTUIManager.m @@ -0,0 +1,96 @@ +// +// ESCTUIManager.m +// EscortProject +// +// Created by 仁康信息 on 2023/2/16. +// + +#import "ESCTUIManager.h" +#import "TUIC2CChatViewController.h" +#import "TUICallKit.h" +#import "TUILogin.h" + +@implementation ESCTUIManager + + ++ (BOOL)TUIUserStatus { + + return [TUILogin isUserLogined]; + +} + ++ (void)loginInitTUISDKAppidWith:(int)sdkAppid UserID:(NSString *)userID userSig:(NSString *)userSig{ + + [TUILogin login:sdkAppid userID:userID userSig:userSig succ:^{ + +// KPostNotification(KNotificationLoginIMResult, @YES); + + } fail:^(int code, NSString *msg) { + + [EasyTextView showErrorText:msg]; + + }]; + +} + +/* + 发起聊天 : + 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]; + // 显示翻译按钮 + +} + ++ (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/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXKeychainTool.h b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXKeychainTool.h new file mode 100755 index 0000000..75f93c5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXKeychainTool.h @@ -0,0 +1,36 @@ + +// YXKeychainTool.h +// idleBuy +// +// Created by ios on 2018/5/28. +// Copyright © 2018年 ios. All rights reserved. +#import +#import + +@interface YXKeychainTool : 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/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXKeychainTool.m b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXKeychainTool.m new file mode 100755 index 0000000..07701e3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXKeychainTool.m @@ -0,0 +1,56 @@ + +// NewLottery +// +// Created by 孙号斌 on 2017/2/14. +// Copyright © 2017年 孙号斌. All rights reserved. +// + +#import "YXKeychainTool.h" + +@implementation YXKeychainTool ++ (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/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXUserInfo.h b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXUserInfo.h new file mode 100755 index 0000000..f39086a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXUserInfo.h @@ -0,0 +1,38 @@ +// +// YXUserInfo.h +// idleBuy +// +// Created by ios on 2018/5/30. +// Copyright © 2018年 ios. All rights reserved. +// + +#import + +@interface YXUserInfo : 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 * email; + +@property (nonatomic, copy) NSString * status; +@property (nonatomic, copy) NSString * depart; +@property (nonatomic, copy) NSString * personType_dictText; +@property (nonatomic, copy) NSString * createTime; + +@property (nonatomic, copy) NSString * token; + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXUserInfo.m b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXUserInfo.m new file mode 100755 index 0000000..8ed7a2f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Manager/UserManager/YXUserInfo.m @@ -0,0 +1,73 @@ +// +// YXUserInfo.m +// idleBuy +// +// Created by ios on 2018/5/30. +// Copyright © 2018年 ios. All rights reserved. +// + +#import "YXUserInfo.h" + +@implementation YXUserInfo +- (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.status forKey:@"status"]; + [aCoder encodeObject:self.workNo forKey:@"workNo"]; + [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.token = [aDecoder decodeObjectForKey:@"token"]; + self.status = [aDecoder decodeObjectForKey:@"status"]; + self.workNo = [aDecoder decodeObjectForKey:@"workNo"]; + 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.status = [_userInfo objectForKey:@"status"]; + self.email = [_userInfo objectForKey:@"email"]; + self.idCard = [_userInfo objectForKey:@"idCard"]; + self.workNo = [_userInfo objectForKey:@"workNo"]; + self.sex_dictText = [_userInfo objectForKey:@"sex_dictText"]; +} + + +-(void)setToken:(NSString *)token { + _token = token; + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+AppService.h b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+AppService.h new file mode 100644 index 0000000..fa4f91a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+AppService.h @@ -0,0 +1,41 @@ +// +// AppDelegate+appService.h +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + + +#import +#import "AppDelegate.h" + +@interface AppDelegate (AppService) + +//初始化服务 +-(void)initService; + +//初始化 window +-(void)initWindow; + +-(void)initIQKeyBord; + +//初始化 UMeng +-(void)initUMeng; + +//初始化高德地图 +-(void)configureAPIKey; +//监听网络状态 +- (void)monitorNetworkStatus; + +//单例 ++ (AppDelegate *)shareAppDelegate; +/** + 当前顶层控制器 + */ +-(UIViewController*) getCurrentVC; + +-(UIViewController*) getCurrentUIVC; + +- (void)chageUrlService; +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+AppService.m b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+AppService.m new file mode 100644 index 0000000..373a5eb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+AppService.m @@ -0,0 +1,301 @@ +// +// AppDelegate+appService.m +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import "AppDelegate+AppService.h" +#import "YXBaseTabBarController.h" +#import "YXLoginViewController.h" +#import +#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]; + if ([HQCommonUtils isLogin]) { + //腾讯im + + V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init]; + // 3. 指定 log 输出级别。 + config.logLevel = V2TIM_LOG_INFO; + // 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。 + [[V2TIMManager sharedInstance] addIMSDKListener:self]; + } +} +#pragma mark ————— 初始化window ————— +-(void)initWindow{ + + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + self.window.backgroundColor = KWhiteColor; + //直接进入显示登录页面 + if ([HQCommonUtils isLogin]) { + self.mainTabBar = [YXBaseTabBarController new]; + self.mainTabBar.delegate =self; + self.window.rootViewController = self.mainTabBar; + [self.window makeKeyAndVisible]; + }else { + YXLoginViewController * loginvc = [[YXLoginViewController alloc] init]; + YXBaseNavigationController * nav = [[YXBaseNavigationController 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]; + } +} + +- (void)initIQKeyBord { + + IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager]; // 获取类库的单例变量 + + keyboardManager.enable = YES; // 控制整个功能是否启用 + + keyboardManager.shouldResignOnTouchOutside = YES; // 控制点击背景是否收起键盘 + + keyboardManager.shouldToolbarUsesTextFieldTintColor = YES; // 控制键盘上的工具条文字颜色是否用户自定义 + + keyboardManager.toolbarManageBehaviour = IQAutoToolbarBySubviews; // 有多个输入框时,可以通过点击Toolbar 上的“前一个”“后一个”按钮来实现移动到不同的输入框 + + keyboardManager.enableAutoToolbar = YES; // 控制是否显示键盘上的工具条 + + keyboardManager.shouldShowToolbarPlaceholder = YES; // 是否显示占位文字 + + keyboardManager.placeholderFont = [UIFont boldSystemFontOfSize:17]; // 设置占位文字的字体 + + keyboardManager.keyboardDistanceFromTextField = 10.0f; // 输入框距离键盘的距离 + + +} + +//初始化高德 +- (void)configureAPIKey +{ + +// //判断是否是首次启动 + if(![[NSUserDefaults standardUserDefaults] boolForKey:@"agreeStatus"]){ + //添加隐私合规弹窗 + [self addAlertController]; + //更新App是否显示隐私弹窗的状态,隐私弹窗是否包含高德SDK隐私协议内容的状态. since 8.1.0 + [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; + } + [[AMapServices sharedServices] setEnableHTTPS:YES]; + [AMapServices sharedServices].apiKey = AMAPSDKKEY; +} + +- (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{ + + return YES; +} +#pragma mark ————— 网络状态变化 ————— +- (void)netWorkStateChange:(NSNotification *)notification +{ + BOOL isNetWork = [notification.object boolValue]; + + if (isNetWork) {//有网络 + + + }else {//登陆失败加载登陆页面控制器 + [MBProgressHUD showTopTipMessage:@"网络状态不佳" isWindow:YES]; + } +} + + +- (void)loginStateChange:(NSNotification *)notification { + + BOOL islogin = [notification.object boolValue]; + + if (islogin) {//登录成功 + self.mainTabBar = nil; + self.mainTabBar = [YXBaseTabBarController new]; + self.mainTabBar.delegate =self; + self.window.rootViewController = self.mainTabBar; + [self.window makeKeyAndVisible]; + + }else {//登陆失败加载登陆页面控制器 + [self initWindow]; + } +} + + ++ (AppDelegate *)shareAppDelegate{ + return (AppDelegate *)[[UIApplication sharedApplication] delegate]; +} + + + +- (void)loginImAccount { + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} + +//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +- (void)onKickedOffline { + + + [HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); + + + +} + + +#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:@"health.Employees.tools" forKey:@"pkg"]; + + + [session GET:@"https://base.icdat.cn/v2/url" parameters:parmDic headers:nil 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(KNotificAgreeMapDelegate, 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"]; + KPostNotification(KNotificAgreeMapDelegate, nil); + }]; + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+PushService.h b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+PushService.h new file mode 100644 index 0000000..754482f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+PushService.h @@ -0,0 +1,17 @@ +// +// 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/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+PushService.m b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate+PushService.m new file mode 100644 index 0000000..1969025 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate.h b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate.h new file mode 100644 index 0000000..23276c9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate.h @@ -0,0 +1,27 @@ +// +// AppDelegate.h +// healthQuestion +// +// Created by xulei on 2022/8/9. +// + +#import +#import "YXBaseTabBarController.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 (strong, nonatomic) YXBaseTabBarController * +mainTabBar; + +@property (nonatomic,assign)NSInteger unreadNumber; +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate.m b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate.m new file mode 100644 index 0000000..5979ede --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/AppDelegate/AppDelegate.m @@ -0,0 +1,175 @@ +// +// AppDelegate.m +// healthQuestion +// +// Created by xulei on 2022/8/9. +// + +#import "AppDelegate.h" +#import "SJRotationManager.h" +#import + +#define ARRAY_SIZE(a) sizeof(a)/sizeof(a[0]) + + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + + + //前缀请求 + [self chageUrlService]; + + [self initService]; + + //初始化window + [self initWindow]; + + //初始化IQKeybord + [self initIQKeyBord]; + //初始化高德地图 + [self configureAPIKey]; + + // 监听推送 + [V2TIMManager.sharedInstance setAPNSListener:self]; + // 监听会话的未读数 + [[V2TIMManager sharedInstance] addConversationListener:self]; + + SDImageWebPCoder*webPCoder = [SDImageWebPCoder sharedCoder]; + [[SDImageCodersManager sharedManager] addCoder:webPCoder]; + + 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; +} + + +- (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. + [application setApplicationIconBadgeNumber:0]; + [application cancelAllLocalNotifications]; + [[UIApplication sharedApplication] endReceivingRemoteControlEvents]; +} + +- (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:. +} + +- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { + return [SJRotationManager supportedInterfaceOrientationsForWindow:window]; +} + +#pragma mark - + + +#warning Configuring rotation. 请配置旋转!! + +@end +@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/DoctorXinjiang/DoctorXinjiang/Project/Base/HQBaseTabBarController.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/HQBaseTabBarController.h new file mode 100644 index 0000000..3d9869c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/HQBaseTabBarController.h @@ -0,0 +1,25 @@ +// +// YXBaseTabBarController.h +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBaseTabBarController : 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/DoctorXinjiang/DoctorXinjiang/Project/Base/HQBaseWebViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/HQBaseWebViewController.h new file mode 100644 index 0000000..689fa98 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/HQBaseWebViewController.h @@ -0,0 +1,42 @@ +// +// YXBaseWebViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2024/1/12. +// + +#import "YXBaseViewController.h" + +#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 YXBaseWebViewController : YXBaseViewController + +@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/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/HQTabBar.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/HQTabBar.h new file mode 100755 index 0000000..8f392fb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/HQTabBar.m b/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/HQTabBar.m new file mode 100755 index 0000000..4da3e8c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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 = [UIColor redColor]; + } + + 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/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/UITabBar+CustomBadge.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/UITabBar+CustomBadge.h new file mode 100755 index 0000000..163d6f2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/UITabBar+CustomBadge.m b/DoctorXinjiang/DoctorXinjiang/Project/Base/TabBarView/UITabBar+CustomBadge.m new file mode 100755 index 0000000..8b526b2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseNavigationController.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseNavigationController.h new file mode 100644 index 0000000..e731e88 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseNavigationController.h @@ -0,0 +1,25 @@ +// +// YXBaseNavigationController.h +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBaseNavigationController : UINavigationController + +/*! + * 返回到指定的类视图 + * + * @param ClassName 类名 + * @param animated 是否动画 + */ +-(BOOL)popToAppointViewController:(NSString *)ClassName animated:(BOOL)animated; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseNavigationController.m b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseNavigationController.m new file mode 100644 index 0000000..85e1858 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseNavigationController.m @@ -0,0 +1,305 @@ +// +// YXBaseNavigationController.m +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import "YXBaseNavigationController.h" +#import "XYTransitionProtocol.h" +#import "XYTransition.h" + +@interface YXBaseNavigationController () + +@property (nonatomic, weak) id popDelegate; +@property (nonatomic,strong) UIPercentDrivenInteractiveTransition *interactivePopTransition; +@property (nonatomic,strong) UIScreenEdgePanGestureRecognizer *popRecognizer; +@property(nonatomic,assign) BOOL isSystemSlidBack;//是否开启系统右滑返回 + +@end + +@implementation YXBaseNavigationController + +//APP生命周期中 只会执行一次 ++ (void)initialize +{ + //导航栏主题 title文字属性 + UINavigationBar *navBar = [UINavigationBar appearance]; + //导航栏背景图 + [navBar setBackgroundImage:[UIImage imageNamed:@"navBackImg"] forBarMetrics:UIBarMetricsDefault]; + [navBar setBarTintColor:KWhiteColor]; + [navBar setTintColor:UIColorHex(#21BEBD)]; + [navBar setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName : [UIFont systemFontOfSize:18]}]; + [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]}]; + + [[UINavigationBar appearance]setStandardAppearance:apperance]; + + [[UINavigationBar appearance]setScrollEdgeAppearance:apperance]; + + }else{ + + + + [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName : [UIFont systemFontOfSize:18]}]; + + [[UINavigationBar appearance] setBarTintColor:UIColorHex(#21BEBD)]; + + [[UINavigationBar appearance] setShadowImage:[UIImage new]]; + + + + } + [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:[YXBaseViewController class]]) { + YXBaseViewController * vc = (YXBaseViewController *)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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseTabBarController.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseTabBarController.h new file mode 100644 index 0000000..3d9869c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseTabBarController.h @@ -0,0 +1,25 @@ +// +// YXBaseTabBarController.h +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBaseTabBarController : 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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseTabBarController.m b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseTabBarController.m new file mode 100644 index 0000000..1d7d316 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseTabBarController.m @@ -0,0 +1,185 @@ +// +// YXBaseTabBarController.m +// healthQuestion +// +// Created by xulei on 2022/8/12. +// + +#import "YXBaseTabBarController.h" +#import "HQTabBar.h" +#import "YXHomePageViewController.h" +#import "YXMineViewController.h" + +@interface YXBaseTabBarController () + +@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 YXBaseTabBarController + + +- (void)viewDidLoad { + [super viewDidLoad]; + self.delegate = self; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectedClass) name:KNotificSelectTabbarTwo object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectedHomePage) name:KNotificSelectHomePageTabbar object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectedMine) name:KNotificSelectMineTabbar object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(logoutSeccessAction:) + name:LogoutSeccess + object:nil]; + //初始化tabbar + [self setUpTabBar]; + //添加子控制器 + [self setUpAllChildViewController]; + + // 建议使用网络指示器 + self.indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + self.indicatorView.layer.cornerRadius = 5; + self.indicatorView.layer.masksToBounds = YES; + self.indicatorView.frame = CGRectMake((kScreenHeight-100)/2, (kScreenHeight-100)/2-64, 100, 100); + self.indicatorView.backgroundColor = [UIColor blackColor]; + self.indicatorView.color = [UIColor whiteColor]; + self.indicatorView.alpha = 0.7; + self.isConnecting = NO; + self.isPushed = NO; + [self.view addSubview:self.indicatorView]; +} + +- (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; + + YXHomePageViewController *homeVC = [[YXHomePageViewController alloc]init]; + [self setupChildViewController:homeVC title:@"工作台" imageName:@"homeTabar_nomarl" seleceImageName:@"homeTabar_selected"]; + + + + + YXMineViewController *mineVC = [[YXMineViewController alloc]init]; + [self setupChildViewController:mineVC title:@"我的" imageName:@"mianTabar_nomarl" seleceImageName:@"mianTabar_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:UIColorTitle1,NSFontAttributeName:SYSTEMFONT(12.0f)} forState:UIControlStateNormal]; + //选中字体颜色 + + [controller.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:CNavBgColor,NSFontAttributeName:SYSTEMFONT(12.0f)} forState:UIControlStateSelected]; + self.tabBar.tintColor = CNavBgColor; + //包装导航控制器 + YXBaseNavigationController *nav = [[YXBaseNavigationController alloc]initWithRootViewController:controller]; + + // [self addChildViewController:nav]; + [_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)selectedClass +{ + self.selectedIndex = 1; + +} + +- (void)selectedMine +{ + self.selectedIndex = 1; +} + +- (void)selectedHomePage +{ + self.selectedIndex = 0; +} + +- (void)logoutSeccessAction:(NSNotification *)noti; +{ + self.selectedIndex = 0; +} + + +- (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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseViewController.h new file mode 100644 index 0000000..c41c14c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseViewController.h @@ -0,0 +1,90 @@ +// +// YXBaseViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import +#import "MBProgressHUD.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBaseViewController : 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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseViewController.m new file mode 100644 index 0000000..354eb30 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseViewController.m @@ -0,0 +1,284 @@ +// +// HQBaseViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#import "YXBaseViewController.h" +#import "YXLoginViewController.h" + +@interface YXBaseViewController () + +@end + +@implementation YXBaseViewController + +- (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.isNeedLogin = NO; + //默认导航栏样式:黑字 + self.StatusBarStyle = UIStatusBarStyleLightContent; + self.automaticallyAdjustsScrollViewInsets = NO; +} + +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; +} +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + [[UIApplication sharedApplication].keyWindow endEditing:YES]; +} +-(void)showNoDataImage +{ + +} +-(void)removeNoDataImage{ + +} + +/** + * 是否显示返回按钮 + */ +- (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)setIsNeedLogin:(BOOL)isNeedLogin { + + _isNeedLogin = isNeedLogin; + + if (_isNeedLogin == NO) { //不需要登录,不做处理 + + }else + { + YXLoginViewController *loginVC = [[YXLoginViewController alloc]init]; + UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:loginVC]; + [[kAppDelegate getCurrentVC] presentViewController:nav animated:YES completion:nil]; + } + +} + +- (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, 35, 35); + [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:self.view animated:YES]; + 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 + HUD.label.text = string; + if (haveDelegate) + { + HUD.delegate = self; + } + [HUD hideAnimated:YES afterDelay:2]; +} + +- (void)showMBProgressHUDOnlyWithString:(NSString *)string autoHidden:(BOOL)hidden +{ + MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view 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:self.view 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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseWebViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseWebViewController.h new file mode 100644 index 0000000..689fa98 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseWebViewController.h @@ -0,0 +1,42 @@ +// +// YXBaseWebViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2024/1/12. +// + +#import "YXBaseViewController.h" + +#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 YXBaseWebViewController : YXBaseViewController + +@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/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseWebViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseWebViewController.m new file mode 100644 index 0000000..c10fd80 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Base/YXBaseWebViewController.m @@ -0,0 +1,250 @@ +// +// YXBaseWebViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2024/1/12. +// + +#import "YXBaseWebViewController.h" + + +@interface YXBaseWebViewController () + +@property (nonatomic, strong)NSURL *originalUrl; +@property (nonatomic, copy)NSString *videoUrl; +@property (nonatomic, copy)NSString *messageType; + + +@end + +@implementation YXBaseWebViewController + + +#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/DoctorXinjiang/DoctorXinjiang/Project/HQPopView/HQShowPromptPopView.h b/DoctorXinjiang/DoctorXinjiang/Project/HQPopView/HQShowPromptPopView.h new file mode 100644 index 0000000..232641e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HQPopView/HQShowPromptPopView.h @@ -0,0 +1,16 @@ +// +// HQShowPromptPopView.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQShowPromptPopView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HQPopView/HQShowPromptPopView.m b/DoctorXinjiang/DoctorXinjiang/Project/HQPopView/HQShowPromptPopView.m new file mode 100644 index 0000000..5ceae8b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HQPopView/HQShowPromptPopView.m @@ -0,0 +1,134 @@ +// +// HQShowPromptPopView.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/28. +// + +#import "HQShowPromptPopView.h" + +@implementation HQShowPromptPopView + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + } + + return self; + +} + +- (void)createUI { + + UIView * backView = [[UIView alloc] initWithFrame:self.frame]; + backView.backgroundColor = UIColorBackground; + [self addSubview:backView]; + + UIImageView * popImageView = [[UIImageView alloc] initWithImage:IMAGE_NAMED(@"popCenterImg")]; + popImageView.userInteractionEnabled = true; + [backView addSubview:popImageView]; + + [popImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(kRealValue(260)); + make.width.mas_equalTo(kScreenWidth - 47); + make.centerX.mas_equalTo(self); + }]; + + UILabel * titLabel = [[UILabel alloc] init]; + titLabel.text = @"提示"; + titLabel.textColor = CFontColor1; + titLabel.font = BOLDSYSTEMFONT(16); + titLabel.textAlignment = NSTextAlignmentCenter; + [popImageView addSubview:titLabel]; + + [titLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(kRealValue(107)); + make.width.mas_equalTo(popImageView); + make.centerX.mas_equalTo(self); + }]; + + UILabel * detailLabel = [[UILabel alloc] init]; + detailLabel.text = @"本人郑重承诺,认真履行自主防疫责任,填报相关内容全部属实"; + detailLabel.textColor = CFontColor1; + detailLabel.font = BOLDSYSTEMFONT(16); + detailLabel.numberOfLines = 2; + detailLabel.textAlignment = NSTextAlignmentCenter; + [popImageView addSubview:detailLabel]; + + [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(titLabel.mas_bottom).offset(20); + make.height.mas_equalTo(40); + make.left.mas_equalTo(popImageView.mas_left).offset(50.5); + make.right.mas_equalTo(popImageView.mas_right).offset(-40.5); + }]; + + UIButton * cancalBtn = [[UIButton alloc] init]; + [cancalBtn setTitle:@"取消" forState:UIControlStateNormal]; + [cancalBtn setTitleColor:UIColorHex(#394356) forState:UIControlStateNormal]; + [cancalBtn addTarget:self action:@selector(cancelClick) forControlEvents: UIControlEventTouchUpInside]; + [popImageView addSubview:cancalBtn]; + + [cancalBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(@0); + make.left.mas_equalTo(popImageView.mas_left).offset(35); + make.height.mas_equalTo(50); + make.width.mas_equalTo((popImageView.width-20)/2); + }]; + + + UIButton * sureBtn = [[UIButton alloc] init]; + [sureBtn setTitleColor:UIColorHex(#77849E) forState:UIControlStateNormal]; + sureBtn.titleLabel.font = SYSTEMFONT(17); + [popImageView addSubview:sureBtn]; + + [sureBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(@0); + make.left.mas_equalTo(cancalBtn.mas_right); + make.height.mas_equalTo(50); + make.width.mas_equalTo(cancalBtn); + }]; + + + + + __block int timeout=3; //倒计时时间 + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue); + dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行 + dispatch_source_set_event_handler(_timer, ^{ + if(timeout<=0){ //倒计时结束,关闭 + dispatch_source_cancel(_timer); + dispatch_async(dispatch_get_main_queue(), ^{ + //设置界面的按钮显示 根据自己需求设置 + [sureBtn setTitleColor:UIColorMain forState:UIControlStateNormal]; + [sureBtn setTitle:@"确定" forState:UIControlStateNormal]; + [sureBtn addTarget:self action:@selector(cancelClick) forControlEvents:UIControlEventTouchUpInside]; + sureBtn.userInteractionEnabled = YES; + }); + }else{ + int seconds = timeout; + NSString *strTime = [NSString stringWithFormat:@"%.2d", seconds]; + dispatch_async(dispatch_get_main_queue(), ^{ + //让按钮变为不可点击的灰色 + sureBtn.userInteractionEnabled = NO; + //设置界面的按钮显示 根据自己需求设置 + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:1]; + [sureBtn setTitle:[NSString stringWithFormat:@"%@秒后点击确认",strTime] forState:UIControlStateNormal]; + [UIView commitAnimations]; + }); + timeout--; + } + }); + dispatch_resume(_timer); +} + +- (void)cancelClick { + + [self removeFromSuperview]; +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/FileDataDetail(档案详情)/YXFileDataDetailViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/FileDataDetail(档案详情)/YXFileDataDetailViewController.h new file mode 100644 index 0000000..c08f19d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/FileDataDetail(档案详情)/YXFileDataDetailViewController.h @@ -0,0 +1,18 @@ +// +// YXFileDataDetailViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXFileDataDetailViewController : YXBaseViewController + +@property (nonatomic, copy) NSString * record_id; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/FileDataDetail(档案详情)/YXFileDataDetailViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/FileDataDetail(档案详情)/YXFileDataDetailViewController.m new file mode 100644 index 0000000..77372d3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/FileDataDetail(档案详情)/YXFileDataDetailViewController.m @@ -0,0 +1,682 @@ +// +// YXFileDataDetailViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "YXFileDataDetailViewController.h" +#import "DetailTitleView.h" +#import "DetailUserInfoView.h" +#import "FileDataDeatilCenterView.h" +#import "BasicHealthInfoView.h" +#import "YXRecoredListDetailModel.h" + + +@interface YXFileDataDetailViewController () + +@property (nonatomic, strong) DetailUserInfoView * infoView ; + +@property (nonatomic, strong) FileDataDeatilCenterView * detailView ; + +@property (nonatomic, strong) BasicHealthInfoView * healthView; + +@property (nonatomic, strong) DetailTitleView * titleview; + + +@end + +@implementation YXFileDataDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = UIColorHex(#F3F3F5); + self.isHidenNaviBar = false; + self.navigationItem.title = @"档案详情"; + [self createUI]; + [self createData]; + // 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)]; + self.titleview = titleview; + [mainScrollView addSubview:titleview]; + + //个人信息 + DetailUserInfoView * infoView = [[DetailUserInfoView alloc] initWithFrame:CGRectMake(0, titleview.bottom, kScreenWidth - kRealValue(30), kRealValue(103))]; + self.infoView = infoView; + 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; + 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]; + self.healthView = healthView; + [mainScrollView addSubview:healthView]; + + mainScrollView.contentSize = CGSizeMake(kScreenWidth- kRealValue(30), healthView.bottom + 50); + +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.record_id forKey:@"id"]; + + YXNetAPI * recordApi = [[YXNetAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; + + [recordApi fileDetatilData:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"RECORD"]) { + + NSDictionary * dic = response; + + YXRecoredListDetailModel * model = [YXRecoredListDetailModel modelWithDictionary:dic]; + + //用户信息 + YXReocrdconFamilyMembersDO * infoModel = [YXReocrdconFamilyMembersDO modelWithDictionary:model.conFamilyMembersDO]; + self.infoView.userInfo = infoModel; + //档案详情 + YXRecoredconMedicalRecordsListDO * medicalModel = [YXRecoredconMedicalRecordsListDO modelWithDictionary:model.conMedicalRecordsDO]; + + self.detailView.medicalModel = medicalModel; + self.titleview.createTime = medicalModel.createTime; + self.detailView.height = self.detailView.questionH; + + if (model.answer.count <= 0) { + self.healthView.hidden = YES; + }else + { + self.healthView.hidden = false; + self.healthView.dataArray = model.answer; + self.healthView.top = self.detailView.bottom + kRealValue(15); + self.healthView.height = self.healthView.healthHeight; + } + } +} +/* +#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. +} +*/ + +// +//#import "YXFileDataDetailViewController.h" +//#import "DetailTitleView.h" +//#import "DetailUserInfoView.h" +//#import "FileDataDeatilCenterView.h" +//#import "BasicHealthInfoView.h" +//#import "XLPhotoBrowser.h" +//#import "DoctorReportModel.h" +//@interface YXFileDataDetailViewController () +// +//@property (nonatomic, strong) DetailTitleView * titleview; +// +// +//@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 YXFileDataDetailViewController +// +//- (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.record_id) ) { +// [parmDic setObject:self.record_id forKey:@"id"]; +// } +// +// YXNetAPI * recordApi = [[YXNetAPI alloc] init:self tag:@"RECORD" NeedToken:@""]; +// +// [recordApi fileDetatilData: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:@"RECORD"]) { +// +// 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]; +// 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.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.questionView.height = self.fourAnswerTextView.bottom + kRealValue(5); +// self.fourLabel.top = self.fourBackView.bottom + kRealValue(16); +// self.fourAnswerTextView.top = self.fourLabel.bottom + kRealValue(16); +// 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的样式为系统样式,默认是弹性动画的样式 +//} +// +//@end +// + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/HistoryRecord(历史记录)/YXHistoricalRecordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/HistoryRecord(历史记录)/YXHistoricalRecordViewController.h new file mode 100644 index 0000000..606b353 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/HistoryRecord(历史记录)/YXHistoricalRecordViewController.h @@ -0,0 +1,16 @@ +// +// YXHistoricalRecordViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXHistoricalRecordViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/HistoryRecord(历史记录)/YXHistoricalRecordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/HistoryRecord(历史记录)/YXHistoricalRecordViewController.m new file mode 100644 index 0000000..c5af293 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/HistoryRecord(历史记录)/YXHistoricalRecordViewController.m @@ -0,0 +1,66 @@ +// +// YXHistoricalRecordViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "YXHistoricalRecordViewController.h" +#import "HQSearchView.h" +#import "HistoryRecordTable.h" + +@interface YXHistoricalRecordViewController () + +@property (nonatomic, strong) HistoryRecordTable * homeTable; + +@end + +@implementation YXHistoricalRecordViewController + +- (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, 49)]; + topView.backgroundColor = KWhiteColor; + [self.view addSubview:topView]; + + HQSearchView * seacrhView = [[HQSearchView alloc] initWithFrame:CGRectMake(0, 8, kScreenWidth, 35)]; + seacrhView.backgroundColor = KWhiteColor; + seacrhView.searchPlacehold = @"输入关键字搜索"; + seacrhView.searchBlock = ^(NSString * _Nonnull fieldtext) { + + }; + [topView addSubview:seacrhView]; + + self.homeTable = [[HistoryRecordTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.bottom.mas_offset(0); + make.top.mas_offset(49); + }]; +} + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXCQAudioPlayManager.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXCQAudioPlayManager.h new file mode 100644 index 0000000..2b03347 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXCQAudioPlayManager.h @@ -0,0 +1,25 @@ +// +// YXCQAudioPlayManager.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/5. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXCQAudioPlayManager : NSObject + ++ (AVPlayer *)initWhithUrl:(NSURL *)avUrl; + +//开始播放 ++ (void)avPlayIngAction:(AVPlayer *)avPlay; + +//暂停播放 ++ (void)avPauseAction:(AVPlayer *)avPlay; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXCQAudioPlayManager.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXCQAudioPlayManager.m new file mode 100644 index 0000000..cd6fa0f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXCQAudioPlayManager.m @@ -0,0 +1,34 @@ +// +// YXCQAudioPlayManager.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/5. +// + +#import "YXCQAudioPlayManager.h" + +@implementation YXCQAudioPlayManager + ++ (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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXDownToolsManager.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXDownToolsManager.h new file mode 100644 index 0000000..c01cbca --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXDownToolsManager.h @@ -0,0 +1,20 @@ +// +// YXDownToolsManager.h +// EscortProject +// +// Created by 仁康信息 on 2023/12/1. +// + +#import +#import "ReaderViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXDownToolsManager : NSObject + ++ (void)downLoadReportWithURL:(NSString *)PDFURL withFileName:(NSString *)fileName; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXDownToolsManager.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXDownToolsManager.m new file mode 100644 index 0000000..4a65b9c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXDownToolsManager.m @@ -0,0 +1,103 @@ +// +// YXDownToolsManager.m +// EscortProject +// +// Created by 仁康信息 on 2023/12/1. +// + +#import "YXDownToolsManager.h" +@implementation YXDownToolsManager + ++ (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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXHealthPhyReportModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXHealthPhyReportModel.h new file mode 100644 index 0000000..09ed59e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXHealthPhyReportModel.h @@ -0,0 +1,99 @@ +// +// YXHealthPhyReportModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +//新增影像报告 + + +@interface YXThirdResultResModel : 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 YXImageItemListModel : 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 YXSenResultResModel : NSObject +@property (nonatomic, copy) NSString * uniItemClassId; +@property (nonatomic, copy) NSString * uniItemClassName; +@property (nonatomic, strong) NSArray * thirdResultRes; + +@end + +@interface YXResultItemResListModel : 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 YXHealthPhyReportModel : 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXHealthPhyReportModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXHealthPhyReportModel.m new file mode 100644 index 0000000..83e0f03 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXHealthPhyReportModel.m @@ -0,0 +1,80 @@ +// +// YXHealthPhyReportModel.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/28. +// + +#import "YXHealthPhyReportModel.h" + +@implementation YXThirdResultResModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"third_tId" :@"id"}; + return dic; +} + + +@end + +@implementation YXImageItemListModel + + + +@end + +@implementation YXSenResultResModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + + @"thirdResultRes":[YXThirdResultResModel class] + }; +} + + + +@end + + +@implementation YXResultItemResListModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"senResultRes":[YXSenResultResModel class], + @"allResultArray":[YXThirdResultResModel class] + }; + +} + + + +@end + +@implementation YXHealthPhyReportModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"report_id" :@"id"}; + return dic; +} + + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + return @{ + @"resultItemResList":[YXResultItemResListModel class], + @"imageItemList":[YXImageItemListModel class] + }; +} + + + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXLookReportImageViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXLookReportImageViewController.h new file mode 100644 index 0000000..ffc7438 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXLookReportImageViewController.h @@ -0,0 +1,22 @@ +// +// YXLookReportImageViewController.h +// EscortProject +// +// Created by Apple on 2024/2/26. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXLookReportImageViewController : YXBaseViewController + +@property (nonatomic, strong) NSString * webTitle; + +@property (nonatomic, strong) NSString * webUrl; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXLookReportImageViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXLookReportImageViewController.m new file mode 100644 index 0000000..e9f2b09 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXLookReportImageViewController.m @@ -0,0 +1,173 @@ +// +// YXLookReportImageViewController.m +// EscortProject +// +// Created by Apple on 2024/2/26. +// + +#import "YXLookReportImageViewController.h" + +@interface YXLookReportImageViewController () + +@property (nonatomic, strong)NSURL *originalUrl; +@property (nonatomic, copy)NSString *videoUrl; +@property (nonatomic, copy)NSString *messageType; +@property (nonatomic, strong) WKWebView * wkWebView; + +@end + +@implementation YXLookReportImageViewController + + +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXQuestionDetailViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXQuestionDetailViewController.h new file mode 100644 index 0000000..a6117cf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXQuestionDetailViewController.h @@ -0,0 +1,18 @@ +// +// YXQuestionDetailViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionDetailViewController : YXBaseViewController + +@property (nonatomic, copy) NSString * question_id; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXQuestionDetailViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXQuestionDetailViewController.m new file mode 100644 index 0000000..1968cbd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXQuestionDetailViewController.m @@ -0,0 +1,744 @@ +// +// YXQuestionDetailViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import "YXQuestionDetailViewController.h" +#import "DetailUserInfoView.h" +#import "DetailTitleView.h" +#import "QuestionAppointmentTimeView.h" +#import "QuestionFileDataView.h" +#import "QuestionHealthInfoView.h" +#import "QuestionReportView.h" +#import "YXRecoredListDetailModel.h" +#import "YXQuestionBodyReportModel.h" +#import "RefuseQuestionPopView.h" +#import "YXCancelReasonModel.h" +#import "YXFileDataDetailViewController.h" +#import "YXDTTestView.h" +#import "TUIConversationListBaseDataProvider.h" + +#import +#import +#import +#import +#import "TUIConversationCellData.h" +@interface YXQuestionDetailViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) DetailTitleView * titleview; + +@property (nonatomic, strong) DetailUserInfoView * infoView; + +@property (nonatomic, strong) QuestionAppointmentTimeView * timeView; + +@property (nonatomic, strong) QuestionFileDataView * fileView; + +@property (nonatomic, strong) QuestionReportView * reportView; + +@property (nonatomic, strong) QuestionHealthInfoView * healthView; + +@property (nonatomic, strong) UIView * questionStartView; + +@property (nonatomic, strong) UIButton * cancelBtn; + +@property (nonatomic, strong) UIButton * acceptBtn; + +@property (nonatomic, strong) UIButton * sendVideBtn; + +@property (nonatomic, strong) RefuseQuestionPopView * popView; + +@property (nonatomic, copy) NSString * conSession_id; + +@property (nonatomic, copy) NSString * record_id; + +@property (nonatomic, copy) NSString * idNo; + +@property (nonatomic, copy) NSString * starTimeString; + +@property (nonatomic, copy) NSString * endTimeString; + +@property (nonatomic, strong) UILabel * questionStartLabel; + +@property (nonatomic, copy) NSString * imId; + + +@property (nonatomic, copy) NSString * endPhoneID; + +@property (nonatomic, strong) YXRecoredDetailConsessionModel * timeModel; + +@end + +@implementation YXQuestionDetailViewController + +- (RefuseQuestionPopView *)popView { + + if (!_popView) { + MJWeakSelf + _popView = [[RefuseQuestionPopView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + _popView.upBlock = ^{ + + }; + + _popView.popBlock = ^(NSString * _Nonnull beizhuString, NSString * _Nonnull reasourString) { + //拒绝提交 + [weakSelf cancelReasourSubmit:beizhuString withReasonType:reasourString]; + + }; + _popView.alpha = 0; + + } + return _popView; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"视频咨询"; + self.view.backgroundColor = UIColorHex(#E0E0E0); + // Do any additional setup after loading the view. + [self createUI]; + [self createData]; + [self getCancelReasourData]; +} + +- (void)createUI { + + UIImageView * topImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)]; + topImage.image = [UIImage imageNamed:@"questionDetailBack"]; + [self.view addSubview:topImage]; + + + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, kScreenWidth - kRealValue(30), kScreenHeight - kTopHeight - SafetyAreaHeight)]; + self.mainScrollView.showsVerticalScrollIndicator = false; + self.mainScrollView.showsHorizontalScrollIndicator = false; + self.mainScrollView.layer.cornerRadius = 8.0; + self.mainScrollView.layer.masksToBounds = true; + self.mainScrollView.backgroundColor = KClearColor; + [self.view addSubview:self.mainScrollView]; + + DetailTitleView * titleview = [[DetailTitleView alloc] initWithFrame:CGRectMake(0, 0, self.mainScrollView.width, 33)]; + self.titleview = titleview; + [self.mainScrollView addSubview:titleview]; + + //个人信息 + DetailUserInfoView * infoView = [[DetailUserInfoView alloc] initWithFrame:CGRectMake(0, titleview.bottom, kScreenWidth - kRealValue(30), kRealValue(103))]; + infoView.backgroundColor = KWhiteColor; + self.infoView = infoView; + [self.mainScrollView addSubview:infoView]; + + //预约时间 + QuestionAppointmentTimeView * timeView = [[QuestionAppointmentTimeView alloc] initWithFrame:CGRectMake(0, infoView.bottom + 1, kScreenWidth - kRealValue(30), kRealValue(64))]; + timeView.backgroundColor = KWhiteColor; + self.timeView = timeView; + [self.mainScrollView addSubview:timeView]; + //档案 + QuestionFileDataView * fileView = [[QuestionFileDataView alloc] initWithFrame:CGRectMake(0, timeView.bottom, kScreenWidth - kRealValue(30), kRealValue(64))]; + fileView.backgroundColor = KWhiteColor; + fileView.height = fileView.fileHeight; + self.fileView = fileView; + fileView.fileBlock = ^{ + [self lookFileDetail]; + }; + [self.mainScrollView addSubview:fileView]; + //基本健康信息 + QuestionHealthInfoView * healthView = [[QuestionHealthInfoView alloc] initWithFrame:CGRectMake(0, fileView.bottom +1, kScreenWidth - kRealValue(30), kRealValue(1))]; + healthView.backgroundColor = KWhiteColor; + self.healthView = healthView; + self.questionStartView.layer.cornerRadius = 10.0; + [self.mainScrollView addSubview:healthView]; + //体检报告 + QuestionReportView * reportView = [[QuestionReportView alloc] initWithFrame:CGRectMake(0, healthView.bottom +1, kScreenWidth - kRealValue(30), kRealValue(100))]; + reportView.backgroundColor = KWhiteColor; + self.reportView = reportView; + self.reportView.layer.cornerRadius = 10.0; + self.reportView.layer.masksToBounds = true; +// reportView.baogaoBlock = ^(YXPhyscialReportListModel * _Nonnull reportModel) { +// +// YXPhyReportDetailViewController * yearVC = [[YXPhyReportDetailViewController alloc] init]; +// yearVC.navTitle = reportModel.medicalYear; +// yearVC.yearString = reportModel.report_id; +// [self.navigationController pushViewController:yearVC animated:YES]; +// +// }; + [self.mainScrollView addSubview:reportView]; + + //咨询开始时间 + self.questionStartView = [[UIView alloc] initWithFrame:CGRectMake(0, reportView.bottom, kScreenWidth - kRealValue(30), 1)]; + self.questionStartView.backgroundColor = KWhiteColor; + self.questionStartView.layer.cornerRadius = 10.0; + self.questionStartView.layer.masksToBounds = true; + self.questionStartView.hidden = true; + [self.mainScrollView addSubview:self.questionStartView]; +// + UILabel * startLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(22), 100, 14)]; + startLabel.text = @"咨询开始时间"; + startLabel.font = BOLDSYSTEMFONT(13); + startLabel.textAlignment = NSTextAlignmentLeft; + [self.questionStartView addSubview:startLabel]; + + self.questionStartLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), startLabel.bottom + kRealValue(17), self.questionStartView.width - kRealValue(36), 13)]; + self.questionStartLabel.text = @""; + self.questionStartLabel.font = BOLDSYSTEMFONT(13); + self.questionStartLabel.textAlignment = NSTextAlignmentLeft; + [self.questionStartView addSubview:self.questionStartLabel]; + + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), reportView.bottom + kTopHeight); + + UIButton * cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake( self.mainScrollView.width/2 - kRealValue(155) , kScreenHeight - kTopHeight - 60 - SafetyAreaHeight , kRealValue(150), 40)]; + [cancelBtn setTitle:@"拒绝" forState:UIControlStateNormal]; + [cancelBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + cancelBtn.titleLabel.font = SYSTEMFONT(18); + cancelBtn.backgroundColor = KWhiteColor; + cancelBtn.layer.cornerRadius = 18; + cancelBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + [cancelBtn addTarget:self action:@selector(cancelQuestionAction) forControlEvents:UIControlEventTouchUpInside]; + cancelBtn.layer.masksToBounds = true; + self.cancelBtn = cancelBtn; + self.cancelBtn.hidden = YES; + [self.mainScrollView addSubview:cancelBtn]; + + UIButton * acceptBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.mainScrollView.width/2 + kRealValue(5), cancelBtn.top , kRealValue(150), 40)]; + [acceptBtn setTitle:@"接受" forState:UIControlStateNormal]; + [acceptBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [acceptBtn addTarget:self action:@selector(waitAcceptAction) forControlEvents:UIControlEventTouchUpInside]; + acceptBtn.titleLabel.font = SYSTEMFONT(18); + acceptBtn.backgroundColor = UIColorHex(#21BEBD); + acceptBtn.layer.cornerRadius = 18; + acceptBtn.layer.masksToBounds = true; + self.acceptBtn = acceptBtn; + self.acceptBtn.hidden = YES; + [self.mainScrollView addSubview:acceptBtn]; + + // + UIButton * videoBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 + kRealValue(5), kScreenHeight - kTopHeight - 40 - SafetyAreaHeight , kRealValue(150), 40)]; + [videoBtn setTitle:@"视频通话" forState:UIControlStateNormal]; + [videoBtn setImage:[UIImage imageNamed:@"sendVideo_icon"] forState:UIControlStateNormal]; + [videoBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + videoBtn.titleLabel.font = SYSTEMFONT(18); + videoBtn.backgroundColor = KWhiteColor; + videoBtn.layer.cornerRadius = 18; + videoBtn.layer.masksToBounds = true; + videoBtn.centerX = self.mainScrollView.centerX; + self.sendVideBtn = videoBtn; + [self.sendVideBtn addTarget:self action:@selector(sendVideoAction) forControlEvents:UIControlEventTouchUpInside]; + self.sendVideBtn.hidden = YES; + [self.mainScrollView addSubview:videoBtn]; + + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), reportView.bottom + 35); +} + +- (void) createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.question_id forKey:@"id"]; + + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"DeatilAPI" NeedToken:@""]; + + [detailApi GetRecoredQuestionDetail:parmDic]; +} + +- (void)getCancelReasourData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"REASOURAPI" NeedToken:@""]; + + [detailApi GetCancelReasourData:parmDic]; + + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"DeatilAPI"]) { + + [self hiddenAllMBProgressHUD]; + NSDictionary * dic = response; + + YXRecoredListDetailModel * model = [YXRecoredListDetailModel modelWithDictionary:dic]; + + YXReocrdconFamilyMembersDO * infoModel = [YXReocrdconFamilyMembersDO modelWithDictionary:model.conFamilyMembersDO]; + + YXRecoredDetailConsessionModel * timeModel = [YXRecoredDetailConsessionModel modelWithDictionary:model.conSession]; + self.timeModel = timeModel; + YXRecoredconMedicalRecordsListDO * medicalModel = [YXRecoredconMedicalRecordsListDO modelWithDictionary:model.conMedicalRecordsListDO]; + //总的ID + self.conSession_id = timeModel.consession_id; + self.record_id = medicalModel.dangan_id; + self.imId = infoModel.groupId; + //个人信息 + self.infoView.userInfo = infoModel; + //顶部时间 + self.titleview.createTime = timeModel.createTime; + //预约时间 + self.timeView.model = model; + //顶部时间高度 + self.timeView.height = self.timeView.doctorinfoHeight; + //档案 + self.fileView.model = medicalModel; + self.fileView.top = self.timeView.bottom; + + //健康信息 + if (model.answer.count <= 0) { + + self.healthView.hidden = YES; + self.healthView.height = 1; + + UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:self.fileView.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)]; + + CAShapeLayer * maskLayer = [[CAShapeLayer alloc]init]; + + maskLayer.frame = self.fileView.bounds; + + maskLayer.path = maskPath.CGPath; + + self.fileView.layer.mask = maskLayer; + + + }else + { + self.healthView.hidden = false; + self.healthView.questionArray = model.answer; + self.healthView.height = self.healthView.healthHeight; + + UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:self.healthView.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)]; + + CAShapeLayer * maskLayer = [[CAShapeLayer alloc]init]; + + maskLayer.frame = self.healthView.bounds; + + maskLayer.path = maskPath.CGPath; + + self.healthView.layer.mask = maskLayer; + + } + + // self.endTimeString = info + self.idNo = model.idNo; + + //是否体检报告 + if ([medicalModel.tfPermission integerValue] == 1) { //有体检报告 +// self.reportView.hidden = false; + [self getBodyInfoReport:timeModel.fromAccount]; +// self.reportView.height = self.reportView.reportHeight; +// self.reportView.top = self.healthView.bottom - 10; + + }else + { + self.reportView.hidden = YES; + self.reportView.height = 1; + [self updateUI]; + + } +// [self updateUI]; + + + } + if ([tag isEqualToString:@"BodyApi"]) { + + // NSArray * dataArray = response; + // + // self.reportView.dataArray = dataArray; + // self.reportView.top= self.healthView.bottom; + // self.reportView.height = self.reportView.reportHeight; + // self.mainScrollView.height = self.reportView.bottom + 35; + // self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.reportView.bottom + 35); + [self hiddenAllMBProgressHUD]; + NSDictionary * dic = response; + + if (ValidDict(dic)) { + +// YXPhyscialReportListModel * model = [YXPhyscialReportListModel modelWithDictionary:dic]; +// self.reportView.bodyModel =model; + self.reportView.height = self.reportView.reportHeight; + self.questionStartView.top = self.reportView.bottom + kRealValue(15); +// [self updateFocusIfNeeded]; +// if (self.cancelBtn.hidden == false) { +// self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.cancelBtn.bottom + 35); +// } +// if (self.sendVideBtn.hidden == false) { +// self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.sendVideBtn.bottom + 35); +// } +// if (self.questionStartView.hidden == false) { +// self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.questionStartView.bottom + 35); +// } + [self updateUI]; + }else + { + self.reportView.height = 1; + self.reportView.hidden = true; + [self updateUI]; + } + + + } + if ([tag isEqualToString:@"REASOURAPI"]) { + [self hiddenAllMBProgressHUD]; + NSArray * array = response; + + NSMutableArray * dataArray = [[NSMutableArray alloc] init]; + + for (NSDictionary * reasourDic in array) { + + YXCancelReasonModel * model = [YXCancelReasonModel modelWithDictionary:reasourDic]; + + [dataArray addObject:model]; + + } + self.popView.dataArray = dataArray; + + } + if ([tag isEqualToString:@"SUBMITREASOUR"]) { + + [self.popView removeFromSuperview]; + [self hiddenAllMBProgressHUD]; + [self createData]; + } + if([tag isEqualToString:@"ACCEPTQUESTION"]) { + [self hiddenAllMBProgressHUD]; + [self createData]; + + } + if ([tag isEqualToString:@"ENDPICTUREAPI"]) { + + [self createData]; + } + if ([tag isEqualToString:@"AgainQuestion"]) { + + [self createData]; + [self hiddenAllMBProgressHUD]; + } + 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 的事件,这个步骤可以忽略。 + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + [[TUICallEngine createInstance] init:[model.sdkAppId intValue] userId:model.userId userSig:model.userSig succ:^{ + + } fail:^(int code, NSString * _Nullable errMsg) { + + }]; + + } + if ([tag isEqualToString:@"STARSENDVIDE"]) { + + [self hiddenAllMBProgressHUD]; + NSDictionary * dic = response; + + NSString * groupId ; + + if ([dic.allKeys containsObject:@"groupId"]) { + + NSArray * memberArray = [dic objectForKey:@"member"]; + + [[TUICallEngine createInstance] addObserver:self]; + + [[TUICallKit createInstance] groupCall:[dic objectForKey:@"groupId"] userIdList:memberArray callMediaType:TUICallMediaTypeVideo]; + + [self hiddenAllMBProgressHUD]; + } + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + }else + { + + } + } + + if ([tag isEqualToString:@"ENDVideo"]) { + [self createData]; + + } + + if ([tag isEqualToString:@"beginVideo"]) { + + self.endPhoneID = [NSString stringWithFormat:@"%@",response]; + [self createData]; + } +} + +- (void)updateUI { + + //健康信息布局 + self.healthView.top = self.fileView.bottom; + // 体检信息布局 + self.reportView.top = self.healthView.bottom - 10; + //开始视图布局 + self.questionStartView.top = self.healthView.bottom + kRealValue(15); + //底部按钮布局 + self.cancelBtn.top = self.reportView.bottom + kRealValue(30); + self.acceptBtn.top = self.reportView.bottom + kRealValue(30); + self.sendVideBtn.top = self.reportView.bottom + kRealValue(30); + + // 预约状态 1待确认 2待开始 3已开始 4待评价 5已完成 + // 6 拒绝 7取消 8 超时 + + + if ([self.timeModel.contentStatus intValue] == 1) { + self.acceptBtn.hidden = false; + self.cancelBtn.hidden = false; + self.sendVideBtn.hidden = YES; + self.questionStartView.hidden = true; //视图开始时间隐藏 + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.cancelBtn.bottom + 60); + + } + if ([self.timeModel.contentStatus intValue] == 2 || [self.timeModel.contentStatus intValue] == 3) { + self.acceptBtn.hidden = YES; + self.cancelBtn.hidden = YES; + self.sendVideBtn.hidden = false; + self.questionStartView.hidden = false; + NSTimeInterval starTimeInterval = [self.timeModel.doctorStartTimeLong longLongValue]; + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:@"yyyy年MM月dd HH:mm"]; + NSDate *date = [NSDate dateWithTimeIntervalSince1970:starTimeInterval/1000]; + NSString *timeString = [formatter stringFromDate:date]; + + NSTimeInterval endTimeInterval = [self.timeModel.doctorEndTimeLong longLongValue]; + NSDateFormatter * endformatter = [[NSDateFormatter alloc] init]; + [endformatter setDateFormat:@"HH:mm"]; + NSDate * enddate = [NSDate dateWithTimeIntervalSince1970:endTimeInterval/1000]; + NSString * endTimeString = [endformatter stringFromDate:enddate]; + self.questionStartView.height = kRealValue(100); + self.questionStartLabel.text = [NSString stringWithFormat:@"%@~%@",timeString,endTimeString]; + self.questionStartView.top = self.reportView.bottom + kRealValue(15); + self.sendVideBtn.top = self.questionStartView.bottom + kRealValue(30); + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.sendVideBtn.bottom + 35); + + + } + if ([self.timeModel.contentStatus intValue] >= 4 ) { //待评价 已完成 + self.acceptBtn.hidden = true; + self.cancelBtn.hidden = true; + self.sendVideBtn.hidden = true; + NSTimeInterval starTimeInterval = [self.timeModel.doctorStartTimeLong longLongValue]; + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:@"yyyy年MM月dd HH:mm"]; + NSDate *date = [NSDate dateWithTimeIntervalSince1970:starTimeInterval/1000]; + NSString *timeString = [formatter stringFromDate:date]; + + NSTimeInterval endTimeInterval = [self.timeModel.doctorEndTimeLong longLongValue]; + NSDateFormatter * endformatter = [[NSDateFormatter alloc] init]; + [endformatter setDateFormat:@"HH:mm"]; + NSDate * enddate = [NSDate dateWithTimeIntervalSince1970:endTimeInterval/1000]; + NSString * endTimeString = [endformatter stringFromDate:enddate]; + + self.questionStartLabel.text = [NSString stringWithFormat:@"%@~%@",timeString,endTimeString]; + self.questionStartView.top = self.reportView.bottom + kRealValue(15); + self.questionStartView.height = CGFLOAT_MIN; + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth - kRealValue(30), self.questionStartView.bottom + 60); + + } + +} +- (void)loginImAccount { + + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + + + +} + +//请求体检信息 +- (void)getBodyInfoReport:(NSString *)byID { + + +// NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; +// +// [parmDic setObject:byID forKey:@"sfzh"]; +// + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:byID forKey:@"userId"]; + + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"BodyApi" NeedToken:@""]; + + [detailApi getBodyReportDeatil:parmDic]; + + +} + +//拒绝 +- (void)cancelQuestionAction { + + + [kApplication.keyWindow addSubview:self.popView]; + + [UIView animateWithDuration:0.5 + animations:^{ + self.popView.alpha = 1; + }]; +} +//发起视频通话 +- (void)sendVideoAction { + + [self showMBProgressHUDWithString:@"视频通话请求中..." autoHidden:NO]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.question_id forKey:@"sessionId"]; + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"STARSENDVIDE" NeedToken:@""]; + [detailApi getSendVideoStart:parmDic]; +} + + +//提交拒绝原因 +- (void)cancelReasourSubmit:(NSString *)rejectReason withReasonType:(NSString *)reasonType { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject: self.conSession_id forKey:@"id"]; + [parmDic setObject:rejectReason forKey:@"rejectReason"]; + [parmDic setObject:reasonType forKey:@"reasonType"]; + + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"SUBMITREASOUR" NeedToken:@""]; + + [detailApi submitCancelreasourData:parmDic]; + +} + +//接受请求 +- (void)waitAcceptAction { + YXDTTestView *vi = [[YXDTTestView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + [kAppWindow addSubview:vi]; + vi.returnBlock = ^(NSString *startTime, NSString *endTime) { + NSLog(@"开始时间 = %@", startTime); + NSLog(@"结束时间 = %@", endTime); + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject: self.conSession_id forKey:@"id"]; + [parmDic setObject:startTime forKey:@"startTime"]; + [parmDic setObject:endTime forKey:@"endTime"]; + + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"ACCEPTQUESTION" NeedToken:@""]; + + [detailApi getAcceptQuestion:parmDic]; + + }; +} + +//点否 下次预约 +-(void)againSendVideoTime { + + YXDTTestView *vi = [[YXDTTestView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + [kAppWindow addSubview:vi]; + vi.returnBlock = ^(NSString *startTime, NSString *endTime) { + NSLog(@"开始时间 = %@", startTime); + NSLog(@"结束时间 = %@", endTime); + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject: self.conSession_id forKey:@"id"]; + [parmDic setObject:startTime forKey:@"startTime"]; + [parmDic setObject:endTime forKey:@"endTime"]; + [parmDic setObject:@(1) forKey:@"type"]; + [self showMBProgressHUDWithString:@"重新预约中" autoHidden:false]; + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"AgainQuestion" NeedToken:@""]; + [detailApi getAgainSessionReservationDate:parmDic]; + + }; + +} + +//查看详情 +- (void)lookFileDetail { + + YXFileDataDetailViewController * detalVC = [[YXFileDataDetailViewController alloc] init]; + detalVC.record_id = self.record_id; + [self.navigationController pushViewController:detalVC animated:YES]; + +} + +//开始通话 +- (void)onCallBegin:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject: self.conSession_id forKey:@"id"]; + [parmDic setObject:@"" forKey:@"startTime"]; + [parmDic setObject:@"" forKey:@"endTime"]; + [parmDic setObject:@(2) forKey:@"type"]; + YXNetAPI * detailApi = [[YXNetAPI alloc] init:self tag:@"beginVideo" NeedToken:@""]; + [detailApi getAgainSessionReservationDate:parmDic]; + +} + +//结束通话 +- (void)onCallEnd:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole totalTime:(float)totalTime { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.endPhoneID forKey:@"id"]; + YXNetAPI * endApi = [[YXNetAPI alloc] init:self tag:@"ENDVideo" NeedToken:@""]; + [endApi getendVideoReportById:parmDic]; + + + + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"本次咨询是否已完成?" preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"否" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + [self againSendVideoTime]; + + }]; + UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"完成" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + + [self endQuestionSelected]; + + }]; + [alertController addAction:cancelAction]; + [alertController addAction:sureAction]; + // 确保在主线程上显示 UIAlertController + dispatch_async(dispatch_get_main_queue(), ^{ + [self presentViewController:alertController animated:YES completion:nil]; + }); + +} + +//结束本次咨询 +- (void)endQuestionSelected { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.question_id forKey:@"id"]; + YXNetAPI * endApi = [[YXNetAPI alloc] init:self tag:@"ENDPICTUREAPI" NeedToken:@""]; + [endApi GetEndPictureEndIMQuestion: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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameSubTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameSubTableViewCell.h new file mode 100644 index 0000000..0bd3747 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameSubTableViewCell.h @@ -0,0 +1,19 @@ +// +// YXSickNameSubTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import +#import "YXHealthPhyReportModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSickNameSubTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXThirdResultResModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameSubTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameSubTableViewCell.m new file mode 100644 index 0000000..0e64b29 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameSubTableViewCell.m @@ -0,0 +1,221 @@ +// +// YXSickNameSubTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import "YXSickNameSubTableViewCell.h" + + +@interface YXSickNameSubTableViewCell () + +@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 YXSickNameSubTableViewCell + +- (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:(YXThirdResultResModel *)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 AndLeftisTrue:true 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameTopTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameTopTableViewCell.h new file mode 100644 index 0000000..942a64e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameTopTableViewCell.h @@ -0,0 +1,23 @@ +// +// YXSickNameTopTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import +#import "YXHealthPhyReportModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^onekeyQuestionBlock)(NSString * itemID); + +@interface YXSickNameTopTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXThirdResultResModel * model; +@property (nonatomic, copy) onekeyQuestionBlock itemBlock; +@property (nonatomic, copy) NSString * uniItemClassId; +@property (nonatomic, assign) NSInteger questionType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameTopTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameTopTableViewCell.m new file mode 100644 index 0000000..9151bb9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXSickNameTopTableViewCell.m @@ -0,0 +1,134 @@ +// +// SickNameTopTableViewCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/8/29. +// + +#import "YXSickNameTopTableViewCell.h" + +@interface YXSickNameTopTableViewCell () + +@property (nonatomic, strong ) UILabel * sickNameLabel; +@property (nonatomic, strong ) YYLabel * oneKeyLabel; + +@end + +@implementation YXSickNameTopTableViewCell + +- (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:(YXThirdResultResModel *)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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXimageReportTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXimageReportTableViewCell.h new file mode 100644 index 0000000..c58e4a8 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXimageReportTableViewCell.h @@ -0,0 +1,22 @@ +// +// YXimageReportTableViewCell.h +// EscortProject +// +// Created by Apple on 2024/2/23. +// + +#import +#import "YXHealthPhyReportModel.h" +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookUserReport)(NSString * lookUrl); + +@interface YXimageReportTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXImageItemListModel * model; + +@property (nonatomic, copy) lookUserReport lookBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXimageReportTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXimageReportTableViewCell.m new file mode 100644 index 0000000..0eac50a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionDetail(咨询详情)/YXimageReportTableViewCell.m @@ -0,0 +1,235 @@ +// +// imageReportTableViewCell.m +// EscortProject +// +// Created by Apple on 2024/2/23. +// + +#import "YXimageReportTableViewCell.h" + +@interface YXimageReportTableViewCell () + +@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 YXimageReportTableViewCell + +- (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:(YXImageItemListModel *)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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXAudioVideoRecordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXAudioVideoRecordViewController.h new file mode 100644 index 0000000..864b59b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXAudioVideoRecordViewController.h @@ -0,0 +1,19 @@ +// +// YXAudioVideoRecordViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXAudioVideoRecordViewController : YXBaseViewController + +@property (nonatomic, assign) NSInteger questionType; +@property (nonatomic, assign) NSInteger questionStatus; //待回复10 进行中20 已完成30 (时间充裕可优化枚举类型) + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXAudioVideoRecordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXAudioVideoRecordViewController.m new file mode 100644 index 0000000..73cdc21 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXAudioVideoRecordViewController.m @@ -0,0 +1,286 @@ +// +// YXAudioVideoRecordViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "YXAudioVideoRecordViewController.h" +#import "QuestionRecoredTable.h" +#import "YXQuestionDetailViewController.h" +#import "LYEmptyView.h" +#import "LYEmptyViewHeader.h" +@interface YXAudioVideoRecordViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * status; + +@end + +@implementation YXAudioVideoRecordViewController + +- (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.navigationItem.title = @"视频咨询"; + [self createUI]; + [self createData]; +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:NO]; + YXNetAPI * listApi = [[YXNetAPI alloc] init:self tag:@"LIST" NeedToken:@""]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"2" forKey:@"type"]; + [parmDic setObject:self.status forKey:@"status"]; + [listApi GetQuestionRecoredList:parmDic]; + +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + [self.homeTable.mj_header beginRefreshing]; + + +} +- (void)createUI { + + NSArray * array = @[@"待确认",@"进行中",@"已完成"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(66); + 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; + [self.view addSubview:listBtn]; + listBtn.tag = 100 + index; + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - kRealValue(15) + 27 - SafetyAreaHeight - kRealValue(48)) style:UITableViewStyleGrouped]; + MJWeakSelf + self.homeTable.videoBlock = ^(YXRecordIMListDateModel * _Nonnull model) { + + YXQuestionDetailViewController * detailVC = [[YXQuestionDetailViewController alloc] init]; + detailVC.question_id = model.Record_id; + [weakSelf.navigationController pushViewController:detailVC animated:YES]; + + }; + [self.view addSubview:self.homeTable]; + + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + [self createData]; + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [self createData]; + + }]; + + //初始化一个emptyView + + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImage:[UIImage imageNamed:@"nodataPicture"] titleStr:@"暂无数据" detailStr:@""]; + +// LYEmptyView *emptyView = [LYEmptyView emptyActionViewWithImageStr:@"nodataPicture" +// titleStr:@"无数据" +// detailStr:@"请稍后再试!" +// btnTitleStr:@"重新加载" +// btnClickBlock:^{ +// [self createData]; +// }]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = UIColorHex(#666666); + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:16]; + //按钮背景色 + emptyView.imageSize = CGSizeMake(kRealValue(210), kRealValue(183)); + emptyView.contentViewY = kRealValue(160); + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; +} + +-(void)setQuestionStatus:(NSInteger)questionStatus { + + _questionStatus = questionStatus; + + + + switch (_questionStatus) { + case 10: + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 100) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + self.status = @"1"; + [self createData]; + break; + case 20: + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 101) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + self.status = @"2"; + [self createData]; + break; + case 30: + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 102) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + self.status = @"3"; + [self createData]; + break; + + default: + break; + } +} + +- (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:@"LIST"]) { + [self hiddenAllMBProgressHUD]; + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + YXRecordIMListDateModel * model = [YXRecordIMListDateModel modelWithDictionary:dic]; + + [self.dataArray addObject:model]; + } + self.homeTable.dataArray = self.dataArray; + + } + +} + + +- (void)statusChange:(UIButton *)statusBtn { + [self.dataArray removeAllObjects]; + if (statusBtn.tag == 100) { + self.status = @"1"; + } + if (statusBtn.tag == 101) { + self.status = @"2"; + + } + if (statusBtn.tag == 102) { + self.status = @"3"; + + } + [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); + } + + } +} + + + + + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXPictureRecordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXPictureRecordViewController.h new file mode 100644 index 0000000..04b6125 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXPictureRecordViewController.h @@ -0,0 +1,19 @@ +// +// YXPictureRecordViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXPictureRecordViewController : YXBaseViewController + +@property (nonatomic, assign) NSInteger questionType; +@property (nonatomic, assign) NSInteger questionStatus; //待回复10 进行中20 已完成30 (时间充裕可优化枚举类型) + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXPictureRecordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXPictureRecordViewController.m new file mode 100644 index 0000000..af6ab53 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXPictureRecordViewController.m @@ -0,0 +1,588 @@ +// +// YXPictureRecordViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "YXPictureRecordViewController.h" +#import "QuestionRecoredTable.h" +#import "YXQuestionRecordModel.h" +#import "YXRecordIMListDateModel.h" +#import "ChatViewController.h" + +#import "TUIConversationListBaseDataProvider.h" + +#import +#import +#import +#import +#import "TUIConversationCellData.h" +#import "LYEmptyView.h" +#import "LYEmptyViewHeader.h" +@interface YXPictureRecordViewController () + +@property (nonatomic, strong) QuestionRecoredTable * homeTable; + +@property (nonatomic, strong) NSMutableArray * buttonArray; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) NSMutableArray * IMDataArray; + + +@property (nonatomic, strong) NSMutableArray * groupIDArray; + +@property (nonatomic, strong) NSMutableArray * jingxingArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, copy) NSString * status; + +@property (nonatomic, assign) NSInteger tfReply; + + +@end + +@implementation YXPictureRecordViewController + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + + } + return _buttonArray; +} + +- (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 *)IMDataArray { + + if (!_IMDataArray) { + _IMDataArray = [[NSMutableArray alloc] init]; + } + return _IMDataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"图文咨询"; + self.pageNo = 1; + [self loginImAccount]; + [self createUI]; + // self 为 id 类型 + [[V2TIMManager sharedInstance] addConversationListener:self]; +} + +- (void)createUI { + + NSArray * array = @[@"待回复",@"进行中",@"已完成"]; + [self.buttonArray removeAllObjects]; + CGFloat w = kRealValue(66); + 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 = 100 + index; + [self.view addSubview:listBtn]; + [self.buttonArray addObject:listBtn]; + + } + + + + self.homeTable = [[QuestionRecoredTable alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, kScreenHeight - kTopHeight - kRealValue(15) + 27 - SafetyAreaHeight - kRealValue(48)) style:UITableViewStyleGrouped]; + self.homeTable.recordBlock = ^(YXRecordIMListDateModel * _Nonnull model) { + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = model.imId; + chatVC.isVideo = false; + chatVC.eableSendReport = YES; + chatVC.eableMapTools = false; + chatVC.eableMapTools = false; + chatVC.navTitle = model.memberName; + chatVC.eablehaveHelathData = YES; + chatVC.pictureEnd_id = model.Record_id; + chatVC.questionType = 2; + chatVC.memberSex = model.memberSex; + if ([model.contentStatus intValue] >= 4) + { + chatVC.isHideKeyBord = true; + } + [self.navigationController pushViewController:chatVC animated:YES]; + + + + }; + [self.view addSubview:self.homeTable]; + + + + __weak __typeof(self) weakSelf = self; + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + if ([self.status intValue] == 0) { + [self waitReplayTUIList]; + } + if ([self.status intValue] == 1) { + [self getChatList]; + } + if ([self.status intValue] == 2) { + [self createData]; + } + + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + if ([self.status intValue] == 0) { + [self waitReplayTUIList]; + } + if ([self.status intValue] == 1) { + [self getChatList]; + } + if ([self.status intValue] == 2) { + [self createData]; + } + + }]; + + //初始化一个emptyView + + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImage:[UIImage imageNamed:@"nodataPicture"] titleStr:@"暂无数据" detailStr:@""]; + +// LYEmptyView *emptyView = [LYEmptyView emptyActionViewWithImageStr:@"nodataPicture" +// titleStr:@"无数据" +// detailStr:@"请稍后再试!" +// btnTitleStr:@"重新加载" +// btnClickBlock:^{ +// [self createData]; +// }]; + //元素竖直方向的间距 + emptyView.subViewMargin = 20.f; + //标题颜色 + emptyView.titleLabTextColor = UIColorHex(#666666); + //描述字体 + emptyView.detailLabFont = [UIFont systemFontOfSize:16]; + //按钮背景色 + emptyView.imageSize = CGSizeMake(kRealValue(210), kRealValue(183)); + emptyView.contentViewY = kRealValue(160); + //设置空内容占位图 + self.homeTable.ly_emptyView = emptyView; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + [self.homeTable.mj_header beginRefreshing]; + + +} + +- (void)createData { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + YXNetAPI * listApi = [[YXNetAPI alloc] init:self tag:@"LIST" NeedToken:@""]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"1" forKey:@"type"]; + [parmDic setObject:self.status forKey:@"status"]; + [listApi GetQuestionRecoredList:parmDic]; + +} + +//待回复 +- (void)waitReplayTUIList { + + V2TIMConversationListFilter *filter = [[V2TIMConversationListFilter alloc] init]; + filter.hasUnreadCount = NO; + [[V2TIMManager sharedInstance] getConversationListByFilter:filter nextSeq:self.pageNo - 1 count:100 succ:^(NSArray *list, uint64_t nextSeq, BOOL isFinished) { + // 获取会话列表成功,list 为会话列表 + [self.groupIDArray removeAllObjects]; + [self.IMDataArray removeAllObjects]; + for (V2TIMConversation * v2Model in list) { + if ( !ValidStr(v2Model.groupID)) { + [self.groupIDArray addObject: v2Model.groupID]; + } + [self.IMDataArray addObject:v2Model]; + + } + [self postGroupArray:self.groupIDArray]; + } fail:^(int code, NSString *desc) { + // 获取会话列表失败 + [self loginImAccount]; + }]; + +} + +//获取腾讯im会话列表 +- (void)getChatList { + + + V2TIMConversationListFilter *filter = [[V2TIMConversationListFilter alloc] init]; +// filter.type = V2TIM_C2C; //拉取单聊会话 + filter.type = V2TIM_GROUP; //拉取群聊会话 + [[V2TIMManager sharedInstance] getConversationListByFilter:filter nextSeq:self.pageNo - 1 count:50 succ:^(NSArray *list, uint64_t nextSeq, BOOL isFinished) { + // 获取会话列表成功,list 为会话列表 + [self.groupIDArray removeAllObjects]; + [self.IMDataArray removeAllObjects]; + DLog(@"%@",list); + for (V2TIMConversation * v2Model in list) { + [self.groupIDArray addObject: [NSString stringWithFormat:@"%@",v2Model.groupID] ]; + [self.IMDataArray addObject:v2Model]; + } + [self postIngGroupArray:self.groupIDArray]; + } fail:^(int code, NSString *desc) { + // 获取会话列表失败 + [self loginImAccount]; + }]; + + +} + +#pragma mark:上传id数组 +- (void)postGroupArray:(NSArray *)array { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + //tfReply : 待回复0 进行中1 + [parmDic setObject:array forKey:@"imIds"]; + [parmDic setObject:@"0" forKey:@"tfReply"]; + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + YXNetAPI * recordApi = [[YXNetAPI alloc] init:self tag:@"GROUPID" NeedToken:@""]; + [recordApi PostGroupIDArray:parmDic]; +} + + +- (void)postIngGroupArray:(NSArray *)array { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + //tfReply : 待回复0 进行中1 + [parmDic setObject:array forKey:@"imIds"]; + [parmDic setObject:@"1" forKey:@"tfReply"]; + + [self showMBProgressHUDWithString:@"数据加载中,请稍候..." autoHidden:false]; + YXNetAPI * recordApi = [[YXNetAPI alloc] init:self tag:@"GROUPIDING" NeedToken:@""]; + [recordApi PostGroupIDArray:parmDic]; +} + + +-(void)setQuestionStatus:(NSInteger)questionStatus { + + _questionStatus = questionStatus; + + + + switch (_questionStatus) { + case 10: + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 100) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + self.status = @"0"; + [self waitReplayTUIList]; + break; + case 20: + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 101) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + + } + self.status = @"1"; + [self getChatList]; + break; + case 30: + for (UIButton * seleBtn in self.buttonArray) { + if (seleBtn.tag == 102) { + seleBtn.selected = YES; + seleBtn.backgroundColor = UIColorHex(#21BEBD); + }else + { + seleBtn.backgroundColor = UIColorHex(#DDDDDD); + } + } + self.status = @"2"; + [self createData]; + break; + + default: + break; + } +} + +- (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:@"LIST"]) { + [self hiddenAllMBProgressHUD]; + if (self.pageNo == 1) { + [self.dataArray removeAllObjects]; + } + NSArray * array = response ; + + for (NSDictionary * dic in array) { + + YXRecordIMListDateModel * model = [YXRecordIMListDateModel 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 的事件,这个步骤可以忽略。 + // 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。 + [[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config]; + [ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig]; + if ([self.status intValue] == 0) { + [self waitReplayTUIList]; + } + if ([self.status intValue] == 1) { + [self getChatList]; + } + + + + } + if ([tag isEqualToString:@"GROUPID"]) { + [self hiddenAllMBProgressHUD]; + + NSArray * array = response; + [self.jingxingArray removeAllObjects]; +// for ( V2TIMConversation * v2Model in self.IMDataArray) { + + for (NSDictionary * parmDic in array) { + + YXRecordIMListDateModel * model = [ YXRecordIMListDateModel modelWithDictionary:parmDic]; + for ( V2TIMConversation * v2Model in self.IMDataArray) { + if ([model.imId isEqualToString:v2Model.groupID]) { + DLog(@"------------%d",v2Model.unreadCount); + model.unRedMessage = [NSString stringWithFormat:@"%d",v2Model.unreadCount]; + } + } + [self.jingxingArray addObject:model]; + } +// } + + self.homeTable.dataArray = self.jingxingArray; + } + if ([tag isEqualToString:@"GROUPIDING"]) { + [self hiddenAllMBProgressHUD]; + + NSArray * array = response; + [self.jingxingArray removeAllObjects]; +// for ( V2TIMConversation * v2Model in self.IMDataArray) { + + for (NSDictionary * parmDic in array) { + + YXRecordIMListDateModel * model = [ YXRecordIMListDateModel modelWithDictionary:parmDic]; + for ( V2TIMConversation * v2Model in self.IMDataArray) { + if ([model.imId isEqualToString:v2Model.groupID]) { + DLog(@"------------%d",v2Model.unreadCount); + model.unRedMessage = [NSString stringWithFormat:@"%d",v2Model.unreadCount]; + } + } + [self.jingxingArray addObject:model]; + } +// } + + self.homeTable.dataArray = self.jingxingArray; + } + +} + + +- (void)statusChange:(UIButton *)statusBtn { + + if (statusBtn.tag == 100) { + self.status = @"0"; + self.tfReply = 0; + [self waitReplayTUIList]; + } + if (statusBtn.tag == 101) { + self.status = @"1"; + self.tfReply = 1; + [self getChatList]; + + } + if (statusBtn.tag == 102) { + self.status = @"2"; + [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)loginImAccount { + + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + + + +} + +- (void)onNewConversation:(NSArray *)conversationList { + // 收到会话新增通知,conversationList 为新增的会话 + [self updateConversation:conversationList]; +} + + +- (void)onConversationChanged:(NSArray *)conversationList { + // 收到会话变更通知,conversationList 中为变更后的会话对象 + [self updateConversation:conversationList]; +} + + + + +- (void)onConversationDeleted:(NSArray *)conversationIDList { + // 会话被删除 +} + + +- (void)onTotalUnreadMessageCountChanged:(UInt64) totalUnreadCount { + // 会话未读总数变化 +} + + + + +- (void)onUnreadMessageCountChangedByFilter:(V2TIMConversationListFilter *)filter totalUnreadCount:(UInt64)totalUnreadCount { + // 过滤条件下的会话未读总数变化 +} + + +- (void)updateConversation:(NSArray *)convList { + // 更新 UI 会话列表,如果 UI 会话列表已经存在该新增/变更的会话,就替换之;如果没有,就新增一个会话对象 + [self.homeTable.mj_header beginRefreshing]; +} + + + +//- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView +//{ +// return -self.homeTable.frame.size.height; +//} +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXQustionRecordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXQustionRecordViewController.h new file mode 100644 index 0000000..48e989d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXQustionRecordViewController.h @@ -0,0 +1,20 @@ +// +// YXQustionRecordViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + + +@interface YXQustionRecordViewController : YXBaseViewController + +@property (nonatomic, assign) NSInteger questionType; +@property (nonatomic, assign) NSInteger questionStatus; //待回复10 进行中20 已完成30 (时间充裕可优化枚举类型) + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXQustionRecordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXQustionRecordViewController.m new file mode 100644 index 0000000..875ee43 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionRecord(咨询记录)/YXQustionRecordViewController.m @@ -0,0 +1,255 @@ +// +// QustionRecordViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "YXQustionRecordViewController.h" +#import "YXAudioVideoRecordViewController.h" +#import "YXPictureRecordViewController.h" + +@interface YXQustionRecordViewController () + +/** 顶部控件*/ +@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 YXQustionRecordViewController + +#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 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 { + //questionStatus //待回复10 进行中20 已完成30 (时间充裕可优化枚举类型) + YXPictureRecordViewController * pictureVc = [[YXPictureRecordViewController alloc] init]; + pictureVc.view.backgroundColor = UIColorBackground; + pictureVc.navigationItem.title = @"图文咨询"; + pictureVc.questionStatus = self.questionStatus; + [self addChildViewController:pictureVc]; + + // + YXAudioVideoRecordViewController * videoVc = [[YXAudioVideoRecordViewController alloc] init]; + videoVc.view.backgroundColor = UIColorBackground; + videoVc.navigationItem.title = @"视频咨询"; + videoVc.questionStatus = self.questionStatus; + [self addChildViewController:videoVc]; +} + +#pragma mark - 设置导航条内容 +- (void)setupNavgationBar { + UIScrollView *topView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 1, kScreenHeight, 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 = [UIFont systemFontOfSize:15]; + + btnX = i * btnW; + + titleButton.frame = CGRectMake(btnX, 0, btnW, btnH); + + // 监听按钮点击 + [titleButton addTarget:self action:@selector(titleClick:) forControlEvents:UIControlEventTouchUpInside]; + + [_topView addSubview:titleButton]; + if (i == self.questionType - 1) { + // 添加下划线 + // 下划线宽度 = 按钮文字宽度 + // 下划线中心点x = 按钮中心点x + CGFloat h = 3; + CGFloat y = kRealValue(46) ; + UIView *lineView =[[UIView alloc] init]; + // 位置和尺寸 + lineView.height = h; + // 先计算文字尺寸,在给label去赋值 + [titleButton.titleLabel sizeToFit]; + lineView.width = kScreenWidth/2 - 30; + 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionStatistics(咨询统计)/YXQuestionStatisticsViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionStatistics(咨询统计)/YXQuestionStatisticsViewController.h new file mode 100644 index 0000000..b295510 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionStatistics(咨询统计)/YXQuestionStatisticsViewController.h @@ -0,0 +1,16 @@ +// +// YXQuestionStatisticsViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/26. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionStatisticsViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionStatistics(咨询统计)/YXQuestionStatisticsViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionStatistics(咨询统计)/YXQuestionStatisticsViewController.m new file mode 100644 index 0000000..10c46b4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/QuestionStatistics(咨询统计)/YXQuestionStatisticsViewController.m @@ -0,0 +1,514 @@ +// +// YXQuestionStatisticsViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/26. +// + +#import "YXQuestionStatisticsViewController.h" +#import "AAOptions.h" +#import "AAChartView.h" +#import "NSDate+Calendar.h" +#import "BRDatePickerView.h" +#import "YXQuestionStaticsModel.h" +#import "YXBillViewController.h" +@interface YXQuestionStatisticsViewController () + +@property (nonatomic, strong) AAChartView * aaChartView; + +@property (nonatomic, strong) UILabel * moneyLabel; + +@property (nonatomic, strong) UILabel * leftMoneyLabel; + +@property (nonatomic, strong) UILabel * rightMoneyLabel; + +@property (nonatomic, strong) YYLabel * monthLabel; + +@property (nonatomic, copy) NSString * quesDate; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation YXQuestionStatisticsViewController + +- (NSMutableArray *)dataArray { + if(!_dataArray) { + + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; + +} + +//- (AAChartModel *)configurePieChart { +// return AAChartModel.new +// .chartTypeSet(AAChartTypePie) +// .marginSet(@[@0,@0,@0,@60]) +// .colorsThemeSet(@[@"#407FFF",@"#A682E6"]) +// .dataLabelsEnabledSet(true)//是否直接显示扇形图数据 +// .seriesSet(@[ +// AASeriesElement.new +// .innerSizeSet(@"60%")//内部圆环半径大小占比 +// .sizeSet(@150)//尺寸大小 +// .nameSet(@"人数") +// .borderWidthSet(@0)//描边的宽度 +// .allowPointSelectSet(true)//是否允许在点击数据点标记(扇形图点击选中的块发生位移) +// .statesSet(AAStates.new +// .hoverSet(AAHover.new +// .enabledSet(false)//禁用点击区块之后出现的半透明遮罩层 +// ) +// +// +// ) +// .dataSet(@[ +// @[@"图文咨询", @50], +// @{@"sliced": @true, +// @"selected": @true, +// @"name": @"音视频咨询", +// @"y": @50, }, +// +//// @[@"Safari", @88.5], +//// @[@"Opera", @46.0], +//// @[@"Others", @223.0], +// ])]); +//} +- (AAOptions *)adjustPieChartTitleAndDataLabelFontStyle { + AAOptions *aaOptions = AAOptions.new + .chartSet(AAChart.new.typeSet(AAChartTypePie)) + .titleSet(AATitle.new + .useHTMLSet(true) + .textSet(@" 170
\ + 咨询方式 ")//标题文本内容 + .alignSet(AAChartAlignTypeCenter)//标题水平居中 + .verticalAlignSet(AAChartVerticalAlignTypeMiddle)//标题垂直居中 + .ySet(@0)//标题相对于垂直对齐的偏移量,取值范围:图表的上边距(chart.spacingTop )到图表的下边距(chart.spacingBottom),可以是负值,单位是px。默认值和字体大小有关。 + ) + .colorsSet(@[@"#407FFF",@"#A682E6"])//设置颜色主题 + .seriesSet(@[ + AASeriesElement.new + .nameSet(@"人数") + .sizeSet(@150)//环形图的半径大小 + .innerSizeSet(@"60%")//内部圆环半径大小占比 + .allowPointSelectSet(false)//是否允许在点击数据点标记(扇形图点击选中的块发生位移) + .dataLabelsSet(AADataLabels.new + .enabledSet(true) + .useHTMLSet(true) + .distanceSet(@20)//扇形图百分比线的长度 + .formatSet(@"{point.name} {point.y}") + ) + + .dataSet(@[ + @[@"图文咨询", @110], + @[@"视频咨询", @10], + ]), + ]); + return aaOptions; +} + + +- (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]; + [self createData]; + [self createEarmingsData]; + +} + + +- (void)createUI { + + UIScrollView * mainScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + mainScrollview.backgroundColor = UIColorHex(#EEEEEE); + [self.view addSubview:mainScrollview]; + //顶部背景收益 + UIImageView * moneyImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10), kScreenWidth - kRealValue(30), kRealValue(150))]; + moneyImg.userInteractionEnabled = YES; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; + [moneyImg addGestureRecognizer:tap]; + moneyImg.image = [UIImage imageNamed:@"statusticBackImg"]; + [mainScrollview addSubview:moneyImg]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(12), 300, 12)]; + titleLabel.text = @"未结算收益"; + titleLabel.textColor = KWhiteColor; + titleLabel.textAlignment = NSTextAlignmentLeft; + titleLabel.font = MEDIUMFONT(12); + [moneyImg addSubview:titleLabel]; + + self.moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,titleLabel.bottom + kRealValue(23), moneyImg.width, 18)]; + self.moneyLabel.text = @"¥7900"; + self.moneyLabel.textColor = KWhiteColor; + self.moneyLabel.textAlignment = NSTextAlignmentCenter; + self.moneyLabel.font = MEDIUMFONT(23); + [moneyImg addSubview:self.moneyLabel]; + + UIView * linView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(22),self.moneyLabel.bottom + kRealValue(24), moneyImg.width - kRealValue(44), 1)]; + linView.backgroundColor = KWhiteColor; + [moneyImg addSubview:linView]; + + UILabel * leijiLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(22),linView.bottom + kRealValue(10), moneyImg.width/2, 11)]; + leijiLabel.text = @"累计总收益(税前)"; + leijiLabel.textColor = KWhiteColor; + leijiLabel.textAlignment = NSTextAlignmentLeft; + leijiLabel.font = MEDIUMFONT(11); + [moneyImg addSubview:leijiLabel]; + + self.leftMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(22),leijiLabel.bottom + kRealValue(10), moneyImg.width/2, 11)]; + self.leftMoneyLabel.text = @"¥--"; + self.leftMoneyLabel.textColor = KWhiteColor; + self.leftMoneyLabel.textAlignment = NSTextAlignmentLeft; + self.leftMoneyLabel.font = BOLDSYSTEMFONT(16); + [moneyImg addSubview:self.leftMoneyLabel]; + + + UILabel * leijiRightLabel = [[UILabel alloc] initWithFrame:CGRectMake(moneyImg.width/2 ,linView.bottom + kRealValue(10), moneyImg.width/2 - kRealValue(40) , 11)]; + leijiRightLabel.text = @"已结算(税前)"; + leijiRightLabel.textColor = KWhiteColor; + leijiRightLabel.textAlignment = NSTextAlignmentRight; + leijiRightLabel.font = MEDIUMFONT(11); + [moneyImg addSubview:leijiRightLabel]; + + self.rightMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(moneyImg.width/2,leijiLabel.bottom + kRealValue(10), moneyImg.width/2 - kRealValue(40), 16)]; + self.rightMoneyLabel.text = @"¥--0"; + self.rightMoneyLabel.textColor = KWhiteColor; + self.rightMoneyLabel.textAlignment = NSTextAlignmentRight; + self.rightMoneyLabel.font = BOLDSYSTEMFONT(16); + [moneyImg addSubview:self.rightMoneyLabel]; + + //月份选择 + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), moneyImg.bottom + kRealValue(15), kScreenWidth - kRealValue(30), kRealValue(44))]; + topView.backgroundColor = KWhiteColor; + topView.layer.cornerRadius = 10.0f; + topView.layer.masksToBounds = true; + [mainScrollview addSubview:topView]; + + UIImageView * sattisImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(17), kRealValue(15), kRealValue(14), kRealValue(14))]; + sattisImg.image = IMAGE_NAMED(@"smallStatis_icon"); + [topView addSubview:sattisImg]; + + UILabel * monthsLabel = [[UILabel alloc] initWithFrame:CGRectMake(sattisImg.right + kRealValue(9),0, moneyImg.width/2, kRealValue(44))]; + monthsLabel.text = @"月度统计"; + monthsLabel.textColor = CFontColor1; + monthsLabel.textAlignment = NSTextAlignmentLeft; + monthsLabel.font = BOLDSYSTEMFONT(15); + [topView addSubview:monthsLabel]; + + NSDate * currentDate = [NSDate date]; + YYLabel * monthLabel = [[YYLabel alloc]initWithFrame:CGRectMake(topView.width - 190, 0, 160, kRealValue(44))]; + self.quesDate = [NSString stringWithFormat:@"%ld-%02ld",currentDate.year,currentDate.month]; + monthLabel.text = [NSString stringWithFormat:@"%ld年%ld月 ",currentDate.year,currentDate.month]; + monthLabel.textColor = UIColorHex(#999999); + self.monthLabel = monthLabel; + [topView addSubview:monthLabel]; + + UIImage * image = [UIImage imageNamed:@"garyDown"]; + + NSMutableAttributedString * roomAttri = [[NSMutableAttributedString alloc] initWithString:monthLabel.text]; + + NSMutableAttributedString * roomAttachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(10, 10) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [roomAttri appendAttributedString:roomAttachText]; + + monthLabel.attributedText = roomAttri; + + monthLabel.textAlignment = NSTextAlignmentRight; + + [monthLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + + [self selectedMonth]; + }]; + + //统计图 + UIView * chatView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), topView.bottom + kRealValue(8), kScreenWidth - kRealValue(30), kRealValue(300))]; + chatView.backgroundColor = KWhiteColor; + chatView.layer.cornerRadius = 10; + chatView.layer.masksToBounds = true; + [mainScrollview addSubview:chatView]; + + UILabel * chatTopLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),kRealValue(16), 200, kRealValue(15))]; + chatTopLabel.text = @"分类统计"; + chatTopLabel.textColor = CFontColor1; + chatTopLabel.textAlignment = NSTextAlignmentLeft; + chatTopLabel.font = BOLDSYSTEMFONT(15); + [chatView addSubview:chatTopLabel]; + + self.aaChartView = [[AAChartView alloc]init]; + self.aaChartView.delegate = self; + self.aaChartView.frame = CGRectMake(0, chatTopLabel.bottom, chatView.width, chatView.height - kRealValue(30)); + ////禁用 AAChartView 滚动效果(默认不禁用) + self.aaChartView.scrollEnabled = NO; + [chatView addSubview:self.aaChartView]; +// [_aaChartView aa_drawChartWithOptions:self.adjustPieChartTitleAndDataLabelFontStyle]; + //列表统计 + //统计图 + UIView * bottomView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), chatView.bottom + kRealValue(8), kScreenWidth - kRealValue(30), kRealValue(175))]; + bottomView.backgroundColor = KWhiteColor; + bottomView.layer.cornerRadius = 10; + bottomView.layer.masksToBounds = true; + [mainScrollview addSubview:bottomView]; + + UILabel * bottomLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),0, moneyImg.width/2, kRealValue(44))]; + bottomLabel.text = @"分类统计"; + bottomLabel.textColor = CFontColor1; + bottomLabel.textAlignment = NSTextAlignmentLeft; + bottomLabel.font = BOLDSYSTEMFONT(15); + [bottomView addSubview:bottomLabel]; + +// YYLabel * lookLabel = [[YYLabel alloc]initWithFrame:CGRectMake(topView.width - 170, 0, 160, kRealValue(44))]; +// lookLabel.text = @"查看明细 >"; +// lookLabel.textColor = UIColorHex(#3390FF); +// lookLabel.font = MEDIUMFONT(11); +// lookLabel.textAlignment = NSTextAlignmentRight; +// [bottomView addSubview:lookLabel]; +// +// [lookLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { +// +// [self selectedMonth]; +// }]; + UIView * conView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(17), bottomLabel.bottom + kRealValue(15), bottomView.width - kRealValue(34), 90)]; + conView.layer.borderWidth = 1.0; + conView.layer.borderColor = UIColorHex(#E0E0E0).CGColor; + [bottomView addSubview:conView]; + + UIView * tabTitleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, bottomView.width - kRealValue(34), 30)]; + tabTitleView.backgroundColor = UIColorHex(#EFEFEF); + [conView addSubview:tabTitleView]; + + NSArray * array = @[@"类别",@"进行中",@"已完成",@"合计"]; + for (int i = 0; i < 4; i ++) { + + UILabel * conteLabel = [[UILabel alloc] init]; + conteLabel.frame = CGRectMake( tabTitleView.width/4 * i, 0 , tabTitleView.width/4,tabTitleView.height); + conteLabel.text = array[i]; + conteLabel.textColor = CFontColor1; + conteLabel.textAlignment = NSTextAlignmentCenter; + conteLabel.font = SYSTEMFONT(10); + [tabTitleView addSubview:conteLabel]; + } + + UIView * tabLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 60, conView.width, 1)]; + tabLineView.backgroundColor = UIColorHex(#E0E0E0); + [conView addSubview:tabLineView]; + + NSArray * dataArray =@[@[@"图文咨询",@"2",@"8",@"10"],@[@"视频咨询",@"2",@"5",@"7"]]; + + for (int i = 0; i < dataArray.count; i ++) { + + UIView * tab = [self createTabconteWithFrame:CGRectMake(0, tabTitleView.bottom + i * 30, tabTitleView.width, 30) withArray:dataArray[i] withTag:100 + i * 10]; + [conView addSubview:tab]; + + } + mainScrollview.contentSize = CGSizeMake(kScreenWidth , bottomView.bottom + 100); +} + + +- (void)selectedMonth { + + BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; + // 2.设置属性 + datePickerView.pickerMode = BRDatePickerModeYM; + 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.quesDate = [NSString stringWithFormat:@"%ld-%02ld",selectDate.year,selectDate.month]; + self.monthLabel.text = [NSString stringWithFormat:@"%@ ",selectValue]; + UIImage * image = [UIImage imageNamed:@"garyDown"]; + NSMutableAttributedString * roomAttri = [[NSMutableAttributedString alloc] initWithString:self.monthLabel.text]; + + NSMutableAttributedString * roomAttachText = [NSMutableAttributedString attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(10, 10) alignToFont:[UIFont boldSystemFontOfSize:13] alignment:YYTextVerticalAlignmentCenter]; //content:内容  size:图片尺寸 alignToFont:字符串内字体的格式 + [roomAttri appendAttributedString:roomAttachText]; + + self.monthLabel.attributedText = roomAttri; + + self.monthLabel.textAlignment = NSTextAlignmentRight; + [self createData]; + }; + + datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithThemeColor:UIColorHex(#21BEBD)]; + // 3.显示 + [datePickerView show]; + + +} + +- (UIView *)createTabconteWithFrame:(CGRect)frame + withArray:(NSArray *)conteArray + withTag:(NSInteger)labTag +{ + + UIView * connteView = [[UIView alloc] initWithFrame:frame]; + + for (int i = 0 ; i < conteArray.count; i ++) { + //100 110 + UILabel * conteLabel = [[UILabel alloc] init]; + conteLabel.frame = CGRectMake(connteView.width/4 * i, 0,connteView.width/4 , connteView.height); + conteLabel.text = conteArray[i]; + conteLabel.textColor = CFontColor1; + conteLabel.font = SYSTEMFONT(12); + conteLabel.textAlignment = NSTextAlignmentCenter; + conteLabel.tag = labTag + 10 + i ; + DLog(@"------------%@----------%ld",conteLabel.text, conteLabel.tag); + [connteView addSubview:conteLabel]; + + } + + + + + return connteView; + +} + +- (void)aaChartView:(AAChartView *)aaChartView moveOverEventWithMessage:(AAMoveOverEventMessageModel *)message { + + NSDictionary *messageDic = @{ + @"category":message.category, + @"index":@(message.index), + @"name":message.name, + @"offset":message.offset, + @"x":message.x, + @"y":message.y + }; + + NSNumber *plotX = message.offset[@"plotX"]; + +// self.tipLab.hidden = NO; +// self.tipLab.text = [NSString stringWithFormat:@"%f",[message.y floatValue]]; +// self.tipLab.centerX = [plotX floatValue]+6+50; +// + NSLog(@"mes:%@", messageDic); + } + + +- (void)createData { + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"QUSTIONAPI" NeedToken:@""]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject: self.quesDate forKey:@"date"]; + [workApi GetQuestionStatistics:parmDic]; + +} + +- (void)createEarmingsData { + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"EARNINGAPI" NeedToken:@""]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [workApi GetStatisticsEarnings:parmDic]; + +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + if ([tag isEqualToString:@"QUSTIONAPI"]) { + + NSArray * array = response; + [self.dataArray removeAllObjects]; + for (NSDictionary * dic in array) { + + YXQuestionStaticsModel * model = [YXQuestionStaticsModel modelWithDictionary:dic]; + [self.dataArray addObject:model]; + } + NSInteger pictureNum; + NSInteger videoNum; + NSInteger allNumber; + YXQuestionStaticsModel * picmodel; + YXQuestionStaticsModel * videomodel; + if (self.dataArray.count>=2) { + picmodel = self.dataArray[0]; + pictureNum = [picmodel.total integerValue]; + videomodel = self.dataArray[1]; + videoNum = [videomodel.total integerValue]; + } + + NSString *str2 = @" 咨询方式 "; + AAOptions *aaOptions = AAOptions.new + .chartSet(AAChart.new.typeSet(AAChartTypePie)) + .titleSet(AATitle.new + .useHTMLSet(true) + .textSet(str2)//标题文本内容 + .alignSet(AAChartAlignTypeCenter)//标题水平居中 + .verticalAlignSet(AAChartVerticalAlignTypeMiddle)//标题垂直居中 + .ySet(@0)//标题相对于垂直对齐的偏移量,取值范围:图表的上边距(chart.spacingTop )到图表的下边距(chart.spacingBottom),可以是负值,单位是px。默认值和字体大小有关。 + ) + .colorsSet(@[@"#407FFF",@"#A682E6"])//设置颜色主题 + .seriesSet(@[ + AASeriesElement.new + .nameSet(@"人数") + .sizeSet(@150)//环形图的半径大小 + .innerSizeSet(@"60%")//内部圆环半径大小占比 + .allowPointSelectSet(false)//是否允许在点击数据点标记(扇形图点击选中的块发生位移) + .dataLabelsSet(AADataLabels.new + .enabledSet(true) + .useHTMLSet(true) + .distanceSet(@20)//扇形图百分比线的长度 + .formatSet(@"{point.name} {point.y}") + ) + + .dataSet(@[ + @[@"图文咨询", @(pictureNum)], + @[@"视频咨询", @(videoNum)], + ]), + ]); + [self.aaChartView aa_drawChartWithOptions:aaOptions]; +// / 110 111 112 113 114 + +// 120 121 122 123 124 + UILabel * videoLabel = [self.view viewWithTag:111]; + videoLabel.text = [NSString stringWithFormat:@"%@",picmodel.inProgress]; + UILabel * videoReplyLabel = [self.view viewWithTag:112]; + videoReplyLabel.text = [NSString stringWithFormat:@"%@",picmodel.completed]; + UILabel * videoComplLabel = [self.view viewWithTag:113]; + videoComplLabel.text = [NSString stringWithFormat:@"%@",picmodel.total]; + + UILabel * picLabel = [self.view viewWithTag:121]; + picLabel.text = [NSString stringWithFormat:@"%@",videomodel.inProgress]; + UILabel * picReplyLabel = [self.view viewWithTag:122]; + picReplyLabel.text = [NSString stringWithFormat:@"%@",videomodel.completed]; + UILabel * pciCompLabel = [self.view viewWithTag:123]; + pciCompLabel.text = [NSString stringWithFormat:@"%@",videomodel.total]; + } + if ([tag isEqualToString:@"EARNINGAPI"]) { + NSDictionary * responDic = response; + + self.moneyLabel.text = [NSString stringWithFormat:@"¥%.2f",[[responDic objectForKey:@"unsettled"] floatValue]]; + self.leftMoneyLabel.text = [NSString stringWithFormat:@"¥%.2f",[[responDic objectForKey:@"sumIncome"] floatValue]]; + self.rightMoneyLabel.text = [NSString stringWithFormat:@"¥%.2f",[[responDic objectForKey:@"sumPaymentMoney"] floatValue]]; + + } +} +//咨询收益 +- (void)handleTapGesture:(id)sender { + + YXBillViewController * billVC = [[YXBillViewController alloc] init]; + + [self.navigationController pushViewController:billVC 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/StopAnnouncementViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/StopAnnouncementViewController.h new file mode 100644 index 0000000..cadf9ef --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/StopAnnouncementViewController.h @@ -0,0 +1,16 @@ +// +// YXStopAnnouncementViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "HQBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopAnnouncementViewController : HQBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopAnnouncementViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopAnnouncementViewController.h new file mode 100644 index 0000000..facb2f8 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopAnnouncementViewController.h @@ -0,0 +1,15 @@ +// +// YXStopAnnouncementViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopAnnouncementViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopAnnouncementViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopAnnouncementViewController.m new file mode 100644 index 0000000..15ac734 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopAnnouncementViewController.m @@ -0,0 +1,387 @@ +// +// YXStopAnnouncementViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "YXStopAnnouncementViewController.h" +#import "ZHTagListView.h" +#import "BRDatePickerView.h" +#import "NSDate+Calendar.h" +#import "UIPlaceHolderTextView.h" +#import "YXStopReasonModel.h" +#import "StopQuestionPopView.h" + +@interface YXStopAnnouncementViewController () + +@property (nonatomic, strong) UIView * announceView; + +@property (nonatomic, strong) YYLabel * starLabel; + +@property (nonatomic, strong) YYLabel * endLabel; + +@property (nonatomic, strong) UIPlaceHolderTextView * textView; + +@property (nonatomic, strong) ZHTagListView *tagList; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * centerLabel; + +@property (nonatomic, strong) UILabel * gonggaoLabel; + +@property (nonatomic, copy) NSString * reasonString; + +@property (nonatomic, strong) NSDate * starDate; +@property (nonatomic, strong) NSDate * endDate; + +@property (nonatomic, strong) NSMutableArray * reasonArray; + +@end + +@implementation YXStopAnnouncementViewController + +- (NSMutableArray *)reasonArray { + + if (!_reasonArray) { + _reasonArray = [[NSMutableArray alloc] init]; + } + return _reasonArray; +} + +- (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 getReasonData]; +} + +- (void)createUI { + + UIView * announceView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(10), kScreenWidth - kRealValue(30), kRealValue(388))]; + announceView.layer.cornerRadius = 10; + announceView.backgroundColor = KWhiteColor; + announceView.layer.masksToBounds = true; + self.announceView = announceView; + [self.view addSubview:announceView]; + + UILabel * resouLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(20), 60, 13)]; + resouLabel.textColor = CFontColor1; + resouLabel.font = MEDIUMFONT(14); + resouLabel.text = @"暂停原因"; + [announceView addSubview:resouLabel]; + + + 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(resouLabel.right, 0, announceView.width - resouLabel.right - kRealValue(10), 0) configuration:config tagTexts:_dataSource]; + tagList.backgroundColor = KWhiteColor; + [announceView addSubview:tagList]; + self.tagList = tagList; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { +// [obj setBackgroundColor:KRedColor]; + + }]; + [tagList setTagClickHandler:^(ZHTagListView *tagListView, NSString *tagText, NSUInteger index) { + UIButton * btn = tagListView.tagButtonList[index]; + self.reasonString = tagText; + for (UIButton * selectBtn in tagListView.tagButtonList) { + if (selectBtn == btn ) { + selectBtn.backgroundColor = UIColorHex(#21BEBD); + [selectBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + }else + { + selectBtn.backgroundColor = KClearColor; + [selectBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + } + } + }]; + + UILabel * timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),tagList.bottom + kRealValue(15), 60, 13)]; + timeLabel.textColor = CFontColor1; + timeLabel.font = MEDIUMFONT(14); + timeLabel.text = @"暂停时间"; + self.timeLabel = timeLabel; + [announceView addSubview:timeLabel]; + + NSDateFormatter *formater = [[ NSDateFormatter alloc] init]; + [formater setDateFormat:@"yyyy-MM-dd"];// 时间格式 + NSDate *currentDate = [NSDate date];//获取当前日期 + NSString *currentDateStr = [formater stringFromDate:currentDate]; + self.starDate = currentDate; + self.endDate = currentDate; + self.starLabel = [[YYLabel alloc] initWithFrame:CGRectMake(timeLabel.right + kRealValue(15),tagList.bottom + kRealValue(12), 102, 30)]; + self.starLabel.textColor = CFontColor1; + self.starLabel.font = MEDIUMFONT(14); + self.starLabel.text = currentDateStr; + self.starLabel.layer.cornerRadius = 5; + self.starLabel.layer.borderWidth = 1.0f; + self.starLabel.layer.borderColor = UIColorHex(#CCCCCC).CGColor; + self.starLabel.textAlignment = NSTextAlignmentCenter; + MJWeakSelf + [self.starLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [weakSelf selectStarOnclick]; + }]; + [announceView addSubview:self.starLabel]; + + UILabel * centerLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.starLabel.right ,tagList.bottom + kRealValue(12), 44, 30)]; + centerLabel.textColor = CFontColor1; + centerLabel.font = MEDIUMFONT(14); + centerLabel.text = @"至"; + self.centerLabel = centerLabel; + centerLabel.textAlignment = NSTextAlignmentCenter; + [announceView addSubview:centerLabel]; + + self.endLabel = [[YYLabel alloc] initWithFrame:CGRectMake(centerLabel.right,tagList.bottom + kRealValue(12), self.starLabel.width, self.starLabel.height)]; + self.endLabel.textColor = CFontColor1; + self.endLabel.font = MEDIUMFONT(14); + self.endLabel.text = currentDateStr; + self.endLabel.layer.cornerRadius = 5; + self.endLabel.layer.borderWidth = 1.0f; + self.endLabel.layer.borderColor = UIColorHex(#CCCCCC).CGColor; + self.endLabel.textAlignment = NSTextAlignmentCenter; + + [self.endLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [weakSelf selectEndOnclick]; + }]; + [announceView addSubview:self.endLabel]; + + UILabel * gonggaoLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),self.endLabel.bottom + kRealValue(23), 60, 13)]; + gonggaoLabel.textColor = CFontColor1; + gonggaoLabel.font = MEDIUMFONT(14); + gonggaoLabel.text = @"暂停公告"; + self.gonggaoLabel = gonggaoLabel; + [announceView addSubview:gonggaoLabel]; + + self.textView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(15), gonggaoLabel.bottom + kRealValue(15), announceView.width - kRealValue(30), kRealValue(179))]; + self.textView.placeholder = @"请输入暂停公告"; + self.textView.font = SYSTEMFONT(14); + self.textView.layer.cornerRadius = 5; + self.textView.layer.masksToBounds = true; + self.textView.backgroundColor = UIColorHex(#EFEFEF); + [announceView addSubview:self.textView]; + + UIButton * publishBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(111), kScreenHeight - kTopHeight - SafetyAreaHeight - kRealValue(56), kScreenWidth - kRealValue(222), kRealValue(35))]; + [publishBtn setTitle:@"发布" forState:UIControlStateNormal]; + [publishBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + publishBtn.titleLabel.font = SYSTEMFONT(14); + publishBtn.layer.cornerRadius = 18; + publishBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + publishBtn.layer.borderWidth = 1.0; + publishBtn.layer.masksToBounds = true; + publishBtn.backgroundColor = KWhiteColor; + [publishBtn addTarget:self action:@selector(publishAction) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:publishBtn]; +} + +- (void)getReasonData { + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"ReasonAPI" NeedToken:@""]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@"doctor_stop_reason_type" forKey:@"dictKey"]; + [workApi GetPublishServerReason:parmDic]; + +} + +- (void)selectStarOnclick { + self.starLabel.layer.borderColor = UIColorHex(#21BEBD).CGColor; + // 1.创建日期选择器 + BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; + // 2.设置属性 + datePickerView.pickerMode = BRDatePickerModeYMD; + datePickerView.title = @"选择暂停日期"; + // datePickerView.selectValue = @"2019-10-30"; + datePickerView.minDate = [NSDate br_setYear:2003 month:3 day:12]; + datePickerView.maxDate = [NSDate br_setYear:2050 month:3 day:12]; + datePickerView.isAutoSelect = YES; + datePickerView.showUnitType = BRShowUnitTypeOnlyCenter; + datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) { + NSLog(@"选择的值:%@", selectValue); + self.starDate = selectDate; + self.starLabel.text = selectValue; + }; + + datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithThemeColor:UIColorHex(#21BEBD)]; + // 3.显示 + [datePickerView show]; +} + +- (void)selectEndOnclick { + self.endLabel.layer.borderColor = UIColorHex(#21BEBD).CGColor; + + // 1.创建日期选择器 + BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; + // 2.设置属性 + datePickerView.pickerMode = BRDatePickerModeYMD; + datePickerView.title = @"选择暂停日期"; + // datePickerView.selectValue = @"2019-10-30"; + datePickerView.minDate = [NSDate br_setYear:2003 month:3 day:12]; + datePickerView.maxDate = [NSDate br_setYear:2050 month:3 day:12]; + datePickerView.isAutoSelect = YES; + datePickerView.showUnitType = BRShowUnitTypeOnlyCenter; + datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) { + NSLog(@"选择的值:%@", selectValue); + self.endDate = selectDate; + self.endLabel.text = selectValue; + }; + + datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithThemeColor:UIColorHex(#21BEBD)]; + // 3.显示 + [datePickerView show]; +} + +#pragma mark:发布 + +- (void)publishAction { + if (ValidStr(self.reasonString)) { + + [MBProgressHUD showErrorMessage:@"请选择暂停原因"]; + return; + } + if (ValidStr(self.textView.text)) { + + [MBProgressHUD showErrorMessage:@"请输入公告"]; + return; + } + + //查询当前咨询 + [self showMBProgressHUDWithString:@"发布中,请稍候..." autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + NSTimeInterval starLong =[self.starDate timeIntervalSince1970]*1000; // *1000 是精确到毫秒,不乘就是精确到秒 + NSString * starString = [NSString stringWithFormat:@"%.0f", starLong]; //转为字符型 + + NSTimeInterval endLong =[self.endDate timeIntervalSince1970]*1000; // *1000 是精确到毫秒,不乘就是精确到秒 + NSString * endString = [NSString stringWithFormat:@"%.0f", endLong]; //转为字符型 + + [parmDic setObject:starString forKey:@"startTime"]; + [parmDic setObject:endString forKey:@"endTime"]; + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"CURRENTAPI" NeedToken:@""]; + [workApi GetCurrentServerNumber:parmDic]; +// + + +} + +- (void)addPublishDate { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + NSTimeInterval starLong =[self.starDate timeIntervalSince1970]*1000; // *1000 是精确到毫秒,不乘就是精确到秒 + NSString * startDayLong = [NSString stringWithFormat:@"%.0f", starLong]; //转为字符型 + + NSTimeInterval endLong =[self.endDate timeIntervalSince1970]*1000; // *1000 是精确到毫秒,不乘就是精确到秒 + NSString * endDayLong = [NSString stringWithFormat:@"%.0f", endLong]; //转为字符型 + + NSDateFormatter *formater = [[ NSDateFormatter alloc] init]; + [formater setDateFormat:@"yyyy-MM-dd"];// 时间格式 + + if (endLong < starLong) { + + [EasyTextView showErrorText:@"结束时间小于开始时间,请重新选择"]; + return; + } + + NSString *starDateStr = [formater stringFromDate:self.starDate]; + NSString *endDateStr = [formater stringFromDate:self.endDate]; + + [parmDic setObject:self.reasonString forKey:@"stopReason"]; + [parmDic setObject:startDayLong forKey:@"startDayLong"]; + [parmDic setObject:endDayLong forKey:@"endDayLong"]; + [parmDic setObject:self.textView.text forKey:@"notice"]; + [parmDic setObject:@"" forKey:@"doctorId"]; + [parmDic setObject:endDateStr forKey:@"endDay"]; + [parmDic setObject:starDateStr forKey:@"startDay"]; + + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"ADDAPI" NeedToken:@""]; + [workApi PostStopPublishServer:parmDic]; + + + +} +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [EasyTextView showErrorText:message]; + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + if ([tag isEqualToString:@"ReasonAPI"]) { + NSArray * resArray = response; + NSMutableArray * textArray = [[NSMutableArray alloc] init]; + for (NSDictionary * resDic in resArray) { + + YXStopReasonModel * model = [YXStopReasonModel modelWithDictionary:resDic]; + [textArray addObject:model.text]; + [self.reasonArray addObject:model]; + } + self.tagList.tags = textArray; + //布局 + self.starLabel.top = self.tagList.bottom + kRealValue(12); + self.centerLabel.top = self.starLabel.top; + self.endLabel.top = self.starLabel.top; + self.gonggaoLabel.top = self.endLabel.bottom + kRealValue(23); + self.textView.top = self.gonggaoLabel.bottom + kRealValue(15); + self.announceView.bottom = self.textView.bottom + kRealValue(20); + self.announceView.top = kRealValue(15); + self.timeLabel.top = self.tagList.bottom + kRealValue(15); + + } + if ([tag isEqualToString:@"CURRENTAPI"]) { + [self addPublishDate]; + //转换为时间戳 +// NSString * resString = response; +// +// if ([resString integerValue] == 0 ) { +// [self addPublishDate]; +// +// }else +// { +// +// StopQuestionPopView * popview = [[StopQuestionPopView alloc] initWithFrame:[UIScreen mainScreen].bounds]; +// popview.questionNumber = resString; +// popview.publisBlock = ^{ +// [self addPublishDate]; +// }; +// [[UIApplication sharedApplication].keyWindow addSubview:popview]; +// popview.alpha = 0; +// [UIView animateWithDuration:0.5 animations:^{ +// popview.alpha = 1; +// } completion:^(BOOL finished) { +// }]; +// } + } + if ([tag isEqualToString:@"ADDAPI"]) { + [self hiddenAllMBProgressHUD]; + [self.navigationController popViewControllerAnimated: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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionCauseViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionCauseViewController.h new file mode 100644 index 0000000..ca2afd0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionCauseViewController.h @@ -0,0 +1,16 @@ +// +// YXStopQuestionCauseViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/30. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopQuestionCauseViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionCauseViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionCauseViewController.m new file mode 100644 index 0000000..91eb401 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionCauseViewController.m @@ -0,0 +1,40 @@ +// +// YXStopQuestionCauseViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/30. +// + +#import "YXStopQuestionCauseViewController.h" + +@interface YXStopQuestionCauseViewController () + +@end + +@implementation YXStopQuestionCauseViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"暂停服务"; + [self createUI]; + +} + +- (void)createUI { + + + +} +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionSettingVC.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionSettingVC.h new file mode 100644 index 0000000..171aaac --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionSettingVC.h @@ -0,0 +1,16 @@ +// +// YXStopQuestionSettingVC.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/29. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopQuestionSettingVC : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionSettingVC.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionSettingVC.m new file mode 100644 index 0000000..6457bce --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/StopQuestionSetting(停诊设置)/YXStopQuestionSettingVC.m @@ -0,0 +1,185 @@ +// +// YXStopQuestionSettingVC.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/29. +// + +#import "YXStopQuestionSettingVC.h" +#import "StopQuestionTableView.h" +#import "StopQuestionPopView.h" +#import "YXStopServiceModel.h" +#import "YXStopAnnouncementViewController.h" +@interface YXStopQuestionSettingVC () + +@property (nonatomic, strong) StopQuestionTableView * homeTable; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, assign) NSInteger pageSize; + +@end + +@implementation YXStopQuestionSettingVC + + +- (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 = UIColorHex(#EFEFEF); + self.navigationItem.title = @"暂停服务"; + self.pageNo = 0; + self.pageSize = 10; + [self createUI]; + [self createData]; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated] ; + + [self.homeTable.mj_header beginRefreshing]; + +} +- (void)createUI { + + + UIButton * stopPublish = [[UIButton alloc] init]; + [stopPublish setTitle:@"发布暂停公告" forState:UIControlStateNormal]; + [stopPublish setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [stopPublish addTarget:self action:@selector(publishAction) forControlEvents:UIControlEventTouchUpInside]; + stopPublish.layer.borderColor = UIColorHex(#21BEBD).CGColor; + stopPublish.layer.borderWidth = 1.0; + stopPublish.layer.cornerRadius = 17; + [self.view addSubview:stopPublish]; + + [stopPublish mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_offset(150); + make.bottom.mas_offset(-30); + make.height.mas_offset(36); + make.centerX.mas_equalTo(self.view); + }]; + + self.homeTable = [[StopQuestionTableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + self.homeTable.changeBlock = ^(NSString * _Nullable record_id) { + DLog(@"%@",record_id); + [self chageServiceStatus:record_id]; + }; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.left.right.mas_offset(0); + make.bottom.mas_equalTo(stopPublish.mas_top).offset(-10); + }]; + + __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)publishAction { + + + + YXStopAnnouncementViewController * publishVC = [[YXStopAnnouncementViewController alloc] init]; + + [self.navigationController pushViewController:publishVC animated:YES]; +} + +- (void)createData { + + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(self.pageSize) forKey:@"pageSize"]; + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"RECORDAPI" NeedToken:@""]; + + [workApi GetSPublishServerRecored:parmDic]; + +} + + +- (void)chageServiceStatus:(NSString *)recordID { + [self showMBProgressHUDWithString:@"恢复中,请稍候" autoHidden:false]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:recordID forKey:@"id"]; + [parmDic setObject:@"1" forKey:@"serviceStatus"]; + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"CHAGEAPI" NeedToken:@""]; + [workApi GetChangePublishServer: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:@"RECORDAPI"]) { + NSDictionary * resDic = response; + if (self.pageNo == 1) { + + [self.dataArray removeAllObjects]; + } + YXStopServiceModel * model = [YXStopServiceModel modelWithDictionary:resDic]; + + for (YXStopServiceListModel * listModel in model.records ) { + + [self.dataArray addObject:listModel]; + } + self.homeTable.dataArray = self.dataArray; + } + if ([tag isEqualToString:@"CHAGEAPI"]) { + [self hiddenAllMBProgressHUD]; + [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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXBasicHealthInfoViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXBasicHealthInfoViewController.h new file mode 100644 index 0000000..6a27952 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXBasicHealthInfoViewController.h @@ -0,0 +1,16 @@ +// +// BasicHealthInfoViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBasicHealthInfoViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXBasicHealthInfoViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXBasicHealthInfoViewController.m new file mode 100644 index 0000000..58b861a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXBasicHealthInfoViewController.m @@ -0,0 +1,48 @@ +// +// BasicHealthInfoViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "YXBasicHealthInfoViewController.h" +#import "BasicHealthInfoView.h" + + +@interface YXBasicHealthInfoViewController () + + + +@end + +@implementation YXBasicHealthInfoViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.title = @"基本健康信息"; + self.view.backgroundColor = UIColorHex(#EEEEEE); + [self createUI]; + // Do any additional setup after loading the view. +} + +- (void)createUI { + + BasicHealthInfoView * infoView = [[BasicHealthInfoView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(15), kScreenWidth - kRealValue(30), kRealValue(286))]; + infoView.backgroundColor = [UIColor whiteColor]; + infoView.layer.cornerRadius = 10.0; + infoView.layer.masksToBounds = true; + [self.view addSubview:infoView]; +} + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXHomePageViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXHomePageViewController.h new file mode 100644 index 0000000..07ed7e0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXHomePageViewController.h @@ -0,0 +1,18 @@ +// +// YXHomePageViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXHomePageViewController : YXBaseViewController + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXHomePageViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXHomePageViewController.m new file mode 100644 index 0000000..523c784 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/YXHomePageViewController.m @@ -0,0 +1,774 @@ +// +// YXHomePageViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "YXHomePageViewController.h" +#import "YXQuestionDetailViewController.h" +#import "YXHomePageModel.h" +#import "ChatViewController.h" +#import "MJRefresh.h" +#import "HQShowPromptPopView.h" +#import "YXQuestionStatisticsViewController.h" +#import "YXQustionRecordViewController.h" +#import "YXStopQuestionSettingVC.h" +#import "YXBasicHealthInfoViewController.h" +#import "RefuseQuestionPopView.h" +#import "YXHistoricalRecordViewController.h" +#import "YXFileDataDetailViewController.h" +#import "YXStopAnnouncementViewController.h" +#import "YXBillDetailViewController.h" +#import "TUIC2CChatViewController.h" +#import "YXDoctorInfoModel.h" +#import "PSAppInfo.h" +#import "PSCheckVersion.h" +@interface YXHomePageViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * workLabel; + +@property (nonatomic, strong) UILabel * hospatilLabel; + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) UILabel * messageLabel; +@property (nonatomic, copy) NSString * smallGroup; + +@end + +@implementation YXHomePageViewController + +- (void)viewDidLoad { + + [super viewDidLoad]; + [self createUI]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(updateHomeDate) + name:KNotificAgreeMapDelegate + object:nil]; + + //前缀请求 + [self chageUrlService]; + [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; + [[TUICallEngine createInstance] addObserver:self]; + + self.isHidenNaviBar = false; + self.StatusBarStyle = UIStatusBarStyleDefault; + self.view.backgroundColor = CViewBgColor; + self.navigationItem.title = @"健康专家库"; + + [self docotrUserInfo]; + [self creatSmallHelpNumber]; + [PSCheckVersion checkVersionCompulsoryUpdate]; + +} + +- (void)updateHomeDate { + + [self docotrUserInfo]; + [self creatSmallHelpNumber]; + +} + +#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:@"health.Employees.tools" forKey:@"pkg"]; + + + [session GET:@"https://base.icdat.cn/v2/url" parameters:parmDic headers:nil 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]; + } + 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]; + } + } + } + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"]; + + }]; +} + + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + [self.mainScrollView.mj_header beginRefreshing]; + +} +- (void)createUI { + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight)]; + [self.view addSubview:self.mainScrollView]; + + UIView * linV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 0.5)]; + [self.mainScrollView addSubview:linV]; + + YXUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + UIView * topBack = [[UIView alloc] initWithFrame:CGRectMake(0, linV.bottom, kScreenWidth, kRealValue(130))]; + topBack.backgroundColor = UIColorHex(#21BEBD); + [self.mainScrollView addSubview:topBack]; + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(19), 100, 20)]; + self.nameLabel.textColor = KWhiteColor; + self.nameLabel.font = SYSTEMFONT(21); + self.nameLabel.text = user.realname; + CGFloat w = [HQCommonUtils getLengthFromText:self.nameLabel.text andFontSize:21]; + self.nameLabel.width = w; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [topBack addSubview:self.nameLabel]; + + self.workLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameLabel.right + kRealValue(12), kRealValue(25), 100, 13)]; + self.workLabel.textColor = KWhiteColor; + self.workLabel.font = SYSTEMFONT(13); + self.workLabel.textAlignment = NSTextAlignmentLeft; + [topBack addSubview:self.workLabel]; + + self.hospatilLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), self.nameLabel.bottom + kRealValue(17), kScreenWidth - kRealValue(65), 20)]; + self.hospatilLabel.textColor = KWhiteColor; + self.hospatilLabel.font = SYSTEMFONT(13); +// self.hospatilLabel.text = [NSString stringWithFormat:@"%@ %@",user.phone,user.sex_dictText]; + self.hospatilLabel.textAlignment = NSTextAlignmentLeft; + [topBack addSubview:self.hospatilLabel]; + + self.heardImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(24) - 60, kRealValue(10), 60, 60)]; + self.heardImage.backgroundColor = KWhiteColor; + self.heardImage.layer.cornerRadius = 30.0; + self.heardImage.layer.masksToBounds = true; + [topBack addSubview:self.heardImage]; + + + +// UIView * questionView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.heardImage.bottom + kRealValue(23), kScreenWidth - kRealValue(30), kRealValue(132) * 2 + kRealValue(10))]; +// questionView.backgroundColor = KRedColor; +// questionView.layer.cornerRadius = 10.0; +//// [HQCommonUtils addShadowToView:questionView]; +// [self.view addSubview:questionView]; + + NSArray * array = @[@[@"图文咨询",@"通过图片、文字的形式进行咨询"],@[@"视频咨询",@"通过语音视频电话的形式进行咨询"]]; + NSArray * timearray = @[@[@"0",@"0"],@[@"0",@"0"]]; + NSArray * TagArray = @[@"100",@"200"]; + UIView * lastView; + for (int i = 0; i < 2 ; i ++) { + + UIView * listView = [self createQuestionFrame:CGRectMake(kRealValue(15) , self.heardImage.bottom + kRealValue(23) + 10 * i + kRealValue(132) * i, kScreenWidth - kRealValue(30), kRealValue(132)) Image:@"" withTitle:array[i][0] withDesTitle:array[i][1] withTime:timearray[i][0] numberCount:timearray[i][1] withTag:[TagArray[i] intValue]]; + listView.backgroundColor = KWhiteColor; + if (i == 1) { + lastView = listView; + } + + UIButton * topBackbtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, listView.width, listView.height - 46)]; + topBackbtn.tag = 1000 + i; + [topBackbtn addTarget:self action:@selector(topAction:) forControlEvents:UIControlEventTouchUpInside]; + [listView addSubview:topBackbtn]; + [self.mainScrollView addSubview:listView]; + } + + UIView * smallView= [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), lastView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), kRealValue(80))]; + smallView.backgroundColor = KWhiteColor; + smallView.layer.cornerRadius = 10.0; + smallView.layer.masksToBounds = YES; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; + [smallView addGestureRecognizer:tap]; + [self.mainScrollView addSubview:smallView]; + + UIImageView * leftImg = [[UIImageView alloc] initWithFrame:CGRectMake(24, 24, 40, 40)]; + leftImg.layer.cornerRadius = 20.0f; + leftImg.layer.masksToBounds = true; + leftImg.image = [UIImage imageNamed:@"home_small"] ; + [smallView addSubview:leftImg]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftImg.right + kRealValue(15), kRealValue(28), kScreenWidth - kRealValue(65), 14)]; + titleLabel.textColor = UIColorHex(#333333); + titleLabel.font = BOLDSYSTEMFONT(14); + titleLabel.text = @"小助手"; + titleLabel.textAlignment = NSTextAlignmentLeft; + [smallView addSubview:titleLabel]; + + UILabel * desLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftImg.right + kRealValue(15), titleLabel.bottom + kRealValue(10), kScreenWidth - kRealValue(65), 11)]; + desLabel.textColor = UIColorHex(#666666); + desLabel.font = SYSTEMFONT(11); + desLabel.text = @"联系小助手获取相关帮助和支持"; + desLabel.textAlignment = NSTextAlignmentLeft; + [smallView addSubview:desLabel]; + + UILabel * dayLabel = [[UILabel alloc] initWithFrame:CGRectMake(smallView.width - kRealValue(11) - 100, kRealValue(23), 100, 11)]; + dayLabel.textColor = UIColorHex(#999999); + dayLabel.font = SYSTEMFONT(11); + dayLabel.text = @""; + dayLabel.textAlignment = NSTextAlignmentRight; + self.messageLabel = dayLabel; + [smallView addSubview:dayLabel]; + +// UILabel * messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(smallView.width - kRealValue(20) - 12 ,dayLabel.bottom + kRealValue(12) ,14, 14)]; +// messageLabel.textColor = KWhiteColor; +// messageLabel.font = SYSTEMFONT(10); +// messageLabel.text = @"-"; +// messageLabel.textAlignment = NSTextAlignmentCenter; +// messageLabel.layer.cornerRadius = 7; +// messageLabel.layer.masksToBounds = true; +// messageLabel.backgroundColor = UIColorHex(#21BEBD); + +// [smallView addSubview:messageLabel]; + MJWeakSelf + self.mainScrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + // 进入刷新状态后会自动调用这个block + [weakSelf createMessageNumber]; + [weakSelf creatSmallHelpNumber]; + + }]; + + // 马上进入刷新状态 + // 拉取群聊历史消息 + // 首次拉取,lastMsg 设置为 null + // 再次拉取时,lastMsg 可以使用返回的消息列表中的最后一条消息 + + +} + +- (void)createMessageNumber { + + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"HOMEAPI" NeedToken:@""]; + + [homeApi getHomeData:nil]; + +} + +- (void)docotrUserInfo { + + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"DoctorINFO" NeedToken:@""]; + + [homeApi GetInquireDoctorInfo:nil]; + +} + +- (void)handleTapGesture:(id)sender { + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + } + [self showMBProgressHUDWithString:@"加载中..." autoHidden:false]; + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"FOUNDSMALLAPI" NeedToken:@""]; + + [homeApi getHomeFoundSmallHelpData:nil]; + +} + +- (void)creatSmallHelpNumber { + + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"SMALLAPI" NeedToken:@""]; + + [homeApi getHomeSmallData:nil]; + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + [self.mainScrollView.mj_header endRefreshing]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + + if ([tag isEqualToString:@"HOMEAPI"]) { + [self.mainScrollView.mj_header endRefreshing]; + NSDictionary * dic = response ; + +// 图文咨询:pictureUnReply 待回复 pictureIng进行中 pictureFinish已完成 视频咨询: videoUnReply待确认 videoIng进行中 videoFinish已完成 + + UILabel * pictur_wait = [self.view viewWithTag:100]; + if ([dic.allKeys containsObject:@"pictureUnReply"]) { + if ([[dic objectForKey:@"pictureUnReply"] intValue] == 0) { + pictur_wait.hidden = YES; + }else + { + pictur_wait.hidden = false; + pictur_wait.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"pictureUnReply"]]; + } + + } + + UILabel * pictur_ing = [self.view viewWithTag:110]; + + if ([dic.allKeys containsObject:@"pictureIng"]) { + if ([[dic objectForKey:@"pictureIng"] intValue] == 0) { + pictur_ing.hidden = YES; + }else + { + pictur_ing.hidden = false; + pictur_ing.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"pictureIng"]]; + } + + } + + UILabel * pictur_end = [self.view viewWithTag:120]; + + if ([dic.allKeys containsObject:@"pictureFinish"]) { + if ([[dic objectForKey:@"pictureFinish"] intValue] == 0) { + pictur_end.hidden = YES; + }else + { + pictur_end.hidden = false; + pictur_end.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"pictureFinish"]]; + } + + } + + UILabel * video_wait = [self.view viewWithTag:200]; + if ([dic.allKeys containsObject:@"videoUnReply"]) { + if ([[dic objectForKey:@"videoUnReply"] intValue] == 0) { + video_wait.hidden = YES; + }else + { + video_wait.hidden = false; + video_wait.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"videoUnReply"]]; + } + + } + + UILabel * video_ing = [self.view viewWithTag:210]; + + if ([dic.allKeys containsObject:@"videoIng"]) { + if ([[dic objectForKey:@"videoIng"] intValue] == 0) { + video_ing.hidden = YES; + }else + { + video_ing.hidden = false; + video_ing.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"videoIng"]]; + } + + } + + UILabel * video_end = [self.view viewWithTag:220]; + + if ([dic.allKeys containsObject:@"videoFinish"]) { + if ([[dic objectForKey:@"videoFinish"] intValue] == 0) { + video_end.hidden = YES; + }else + { + video_end.hidden = false; + video_end.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"videoFinish"]]; + } + + } + + } + if ([tag isEqualToString:@"SMALLAPI"]) { + [self.mainScrollView.mj_header endRefreshing]; + NSString * result = response; + if (!ValidStr(result)) { + self.smallGroup = result; + [self loginImAccount]; + + } + + } + if ([tag isEqualToString:@"FOUNDSMALLAPI"]) { + + NSDictionary * responDic = response; + + YXZJSmallHelpModel * helpModel = [YXZJSmallHelpModel modelWithDictionary:responDic]; + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = false; + chatVC.chatID = helpModel.groupId; + chatVC.smallHelp_id = helpModel.help_Id; + chatVC.member = helpModel.member; + chatVC.isVideo = false; + chatVC.eableSendReport = YES; + chatVC.eableMapTools = false; + chatVC.navTitle = @"小助手"; + chatVC.eablehaveHelathData = YES; + chatVC.questionType = 1; + chatVC.memberSex = @"2"; + [self hiddenAllMBProgressHUD]; + [self.navigationController pushViewController:chatVC 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]; + + // 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]; + + [V2TIMManager.sharedInstance getGroupHistoryMessageList:[NSString stringWithFormat:@"%@",self.smallGroup] count:20 lastMsg:nil succ:^(NSArray *msgs) { + // 记录下次拉取的 lastMsg,用于下次拉取 + V2TIMMessage *lastMsg = msgs.lastObject; + NSLog(@"success, %@", msgs); + + NSDateFormatter *date = [[NSDateFormatter alloc]init]; + [date setDateFormat:@"HH:mm:ss"]; + NSString *dateString = [date stringFromDate:lastMsg.timestamp]; + + if (!ValidStr(dateString)) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.messageLabel.text = [NSString stringWithFormat:@"%@",dateString]; + }); + }else + { + dispatch_async(dispatch_get_main_queue(), ^{ + self.messageLabel.text = @""; + }); + + } + + } fail:^(int code, NSString *desc) { + NSLog(@"fail, %d, %@", code, desc); + }]; + } + + if ([tag isEqualToString:@"DoctorINFO"]) { + + NSDictionary * parDic = response; + + YXDoctorInfoModel * model = [YXDoctorInfoModel modelWithDictionary:parDic]; + self.nameLabel.text = model.doctorName; + self.workLabel.text = [NSString stringWithFormat:@"%@",model.doctorTitle] ; + CGFloat workW = [HQCommonUtils getLengthFromText:self.workLabel.text andFontSize:13]; + self.workLabel.width = workW; + self.hospatilLabel.text = [NSString stringWithFormat:@"%@ %@",model.resourceName,model.departmentName]; + + 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:[UIImage imageNamed:@"doctorNoImage"]]; + } + + +} + +- (void)topAction:(UIButton *)btn { + + + YXQustionRecordViewController * recoredVC = [[YXQustionRecordViewController alloc] init]; + //图文待回复 + if (btn.tag == 1000) { + + recoredVC.questionType = 1; + + } + //视频待确认 + if (btn.tag == 1001) { + + recoredVC.questionType = 2; + + } + recoredVC.questionStatus = 10; + [self.navigationController pushViewController:recoredVC animated:YES]; +} +- (void)loginImAccount { + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + +} + + +- (UIView *)createQuestionFrame:(CGRect)frame + Image:(NSString *)imageName + withTitle:(NSString *)title + withDesTitle:(NSString *)desTitle + withTime:(NSString *)time + numberCount:(NSString *)number + withTag:(NSInteger)NumberTag{ + + UIView * view = [[UIView alloc] initWithFrame:frame]; + view.layer.cornerRadius = 10.0; + view.backgroundColor = KWhiteColor; + view.layer.masksToBounds = YES; + + UIImageView * leftImg = [[UIImageView alloc] initWithFrame:CGRectMake(24, 24, 40, 40)]; + leftImg.layer.cornerRadius = 20.0f; + leftImg.layer.masksToBounds = true; + if ([title isEqualToString:@"图文咨询"]) { + leftImg.image = [UIImage imageNamed:@"home_PictureQustion"]; + } + if ([title isEqualToString:@"视频咨询"]) { + leftImg.image = [UIImage imageNamed:@"home_VideoQustion"]; + } + if ([title isEqualToString:@"小助手"]) { + leftImg.image = [UIImage imageNamed:@"home_small"]; + } + leftImg.backgroundColor = [UIColor greenColor]; + [view addSubview:leftImg]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftImg.right + kRealValue(15), kRealValue(28), kScreenWidth - kRealValue(65), 14)]; + titleLabel.textColor = UIColorHex(#333333); + titleLabel.font = BOLDSYSTEMFONT(14); + titleLabel.text = title; + titleLabel.textAlignment = NSTextAlignmentLeft; + [view addSubview:titleLabel]; + + UILabel * desLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftImg.right + kRealValue(15), titleLabel.bottom + kRealValue(10), kScreenWidth - kRealValue(65), 11)]; + desLabel.textColor = UIColorHex(#666666); + desLabel.font = SYSTEMFONT(11); + desLabel.text = desTitle; + desLabel.textAlignment = NSTextAlignmentLeft; + [view addSubview:desLabel]; + + UIView * linView = [[UIView alloc] initWithFrame:CGRectMake(0, desLabel.bottom + kRealValue(26), view.width, 1)]; + linView.backgroundColor = UIColorHex(#E0E0E0); + [view addSubview:linView]; + + UIView * cowView = [[UIView alloc] initWithFrame:CGRectMake(view.width/3, linView.bottom + kRealValue(8), 1, 28)]; + cowView.backgroundColor = UIColorHex(#E0E0E0); + [view addSubview:cowView]; + + UIView * cowTwoView = [[UIView alloc] initWithFrame:CGRectMake(view.width/3 * 2, linView.bottom + kRealValue(8), 1, 28)]; + cowTwoView.backgroundColor = UIColorHex(#E0E0E0); + [view addSubview:cowTwoView]; + + //待回复 + UIButton * replayBtn = [[UIButton alloc] initWithFrame:CGRectMake(0 , linView.bottom ,view.width/3 , 45)]; + + if ([title isEqualToString:@"图文咨询"]) { + [replayBtn setTitle:@"待回复" forState:UIControlStateNormal]; + + } + if ([title isEqualToString:@"视频咨询"]) { + [replayBtn setTitle:@"待确认" forState:UIControlStateNormal]; + + } + [replayBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + replayBtn.titleLabel.font = SYSTEMFONT(13); + replayBtn.tag = NumberTag + 1000; + [replayBtn addTarget:self action:@selector(daihuifuAction:) forControlEvents:UIControlEventTouchUpInside]; + [view addSubview:replayBtn]; + + + + UILabel * numLabel = [[UILabel alloc] initWithFrame:CGRectMake(replayBtn.width - kRealValue(22) - 12 ,kRealValue(15) ,12, 12)]; + numLabel.textColor = KWhiteColor; + numLabel.font = SYSTEMFONT(10); + numLabel.text = number; + numLabel.textAlignment = NSTextAlignmentCenter; + numLabel.layer.cornerRadius = 6; + numLabel.layer.masksToBounds = true; + numLabel.backgroundColor = UIColorHex(#21BEBD); + numLabel.tag = NumberTag; + [replayBtn addSubview:numLabel]; + //进行中 + UIButton * qustionBtn = [[UIButton alloc] initWithFrame:CGRectMake(view.width/3 , linView.bottom ,view.width/3 , 45)]; + [qustionBtn setTitle:@"进行中" forState:UIControlStateNormal]; + [qustionBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + qustionBtn.titleLabel.font = SYSTEMFONT(13); + qustionBtn.tag = NumberTag + 1001; + [qustionBtn addTarget:self action:@selector(jingxingAction:) forControlEvents:UIControlEventTouchUpInside]; + + [view addSubview:qustionBtn]; + + UILabel * jingxingLabel = [[UILabel alloc] initWithFrame:CGRectMake(qustionBtn.width - kRealValue(22) - 12 ,kRealValue(15) ,12, 12)]; + jingxingLabel.textColor = KWhiteColor; + jingxingLabel.font = SYSTEMFONT(10); + jingxingLabel.text = number; + jingxingLabel.textAlignment = NSTextAlignmentCenter; + jingxingLabel.layer.cornerRadius = 6; + jingxingLabel.layer.masksToBounds = true; + jingxingLabel.backgroundColor = UIColorHex(#21BEBD); + jingxingLabel.tag = NumberTag + 10; + [qustionBtn addSubview:jingxingLabel]; + + //完成 + UIButton * wanchengBtn = [[UIButton alloc] initWithFrame:CGRectMake(view.width/3 * 2 , linView.bottom ,view.width/3 , 45)]; + [wanchengBtn setTitle:@"已完成" forState:UIControlStateNormal]; + [wanchengBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + wanchengBtn.titleLabel.font = SYSTEMFONT(13); + wanchengBtn.tag = NumberTag + 1002; + [wanchengBtn addTarget:self action:@selector(wanchengAction:) forControlEvents:UIControlEventTouchUpInside]; + [view addSubview:wanchengBtn]; + + UILabel * wanchengLabel = [[UILabel alloc] initWithFrame:CGRectMake(qustionBtn.width - kRealValue(22) - 12 ,kRealValue(15) ,14, 14)]; + wanchengLabel.textColor = KWhiteColor; + wanchengLabel.font = SYSTEMFONT(10); + wanchengLabel.text = number; + wanchengLabel.textAlignment = NSTextAlignmentCenter; + wanchengLabel.layer.cornerRadius = 7; + wanchengLabel.layer.masksToBounds = true; + wanchengLabel.backgroundColor = UIColorHex(#21BEBD); + wanchengLabel.tag = NumberTag + 20; + [wanchengBtn addSubview:wanchengLabel]; + + return view; +} + +#pragma mark:待回复 +- (void)daihuifuAction:(UIButton *)daihuifuBtn { + YXQustionRecordViewController * recoredVC = [[YXQustionRecordViewController alloc] init]; + //图文待回复 + if (daihuifuBtn.tag == 1100) { + + recoredVC.questionType = 1; + + } + //音视频待回复 + if (daihuifuBtn.tag == 1200) { + + recoredVC.questionType = 2; + } + recoredVC.questionStatus = 10; + [self.navigationController pushViewController:recoredVC animated:YES]; +} +#pragma mark:进行中 +- (void)jingxingAction:(UIButton *)jingxingBtn { + YXQustionRecordViewController * recoredVC = [[YXQustionRecordViewController alloc] init]; + //图文待回复 + if (jingxingBtn.tag == 1101) { + + recoredVC.questionType = 1; + + } + //视频待确认 + if (jingxingBtn.tag == 1201) { + + recoredVC.questionType = 2; + + } + recoredVC.questionStatus = 20; + [self.navigationController pushViewController:recoredVC animated:YES]; +} +#pragma mark:已完成 +- (void)wanchengAction:(UIButton *)wancgengBtn { + + YXQustionRecordViewController * recoredVC = [[YXQustionRecordViewController alloc] init]; + //图文待回复 + if (wancgengBtn.tag == 1102) { + + recoredVC.questionType = 1; + + } + //音视频待回复 + if (wancgengBtn.tag == 1202) { + + recoredVC.questionType = 2; + } + recoredVC.questionStatus = 30; + [self.navigationController pushViewController:recoredVC animated:YES]; +} + +- (void)pictureQuestionAction { + + YXStopQuestionSettingVC * detailVC = [[YXStopQuestionSettingVC alloc] init]; + + [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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillDetailViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillDetailViewController.h new file mode 100644 index 0000000..7edd745 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillDetailViewController.h @@ -0,0 +1,19 @@ +// +// YXBillDetailViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBillDetailViewController : YXBaseViewController + +@property (nonatomic, strong) NSString * timeString; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillDetailViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillDetailViewController.m new file mode 100644 index 0000000..75e3629 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillDetailViewController.m @@ -0,0 +1,130 @@ +// +// YXBillDetailViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "YXBillDetailViewController.h" +#import "BRDatePickerView.h" +#import "BillListTable.h" +#import "YXBillListModel.h" + +@interface YXBillDetailViewController () + +@property (nonatomic, strong) BillListTable * homeTable; + +@property (nonatomic, assign) NSInteger pageNo; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation YXBillDetailViewController + +- (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.pageNo = 1; + self.isHidenNaviBar = false; + [self setupUI]; + [self createData]; +} + + +- (void)setupUI { + + self.homeTable = [[BillListTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + MJWeakSelf + + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.bottom.mas_offset(0); + }]; + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + [self createData]; + + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [self createData]; + + }]; +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"3" forKey:@"type"]; + [parmDic setObject:self.timeString forKey:@"date"]; + + YXNetAPI * billAPI = [[YXNetAPI alloc] init:self tag:@"BillAPI" NeedToken:@""]; + + [billAPI GetBillListData: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 hiddenAllMBProgressHUD]; + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"BillAPI"]) { + + NSDictionary * dic = response; + + YXBillListModel * model = [YXBillListModel modelWithDictionary:dic]; + + self.homeTable.dataArray = model.records; + } + + + +} + +- (void)setTimeString:(NSString *)timeString { + + _timeString = timeString; + [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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillListViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillListViewController.h new file mode 100644 index 0000000..5c6a928 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillListViewController.h @@ -0,0 +1,18 @@ +// +// YXBillListViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBillListViewController : YXBaseViewController + +@property (nonatomic, strong) NSString * timeString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillListViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillListViewController.m new file mode 100644 index 0000000..b37f029 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillListViewController.m @@ -0,0 +1,132 @@ +// +// YXBillListViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "YXBillListViewController.h" +#import "BillListTable.h" +#import "YXWithdrawCashDetailViewController.h" +#import "YXBillListModel.h" + +@interface YXBillListViewController () + +@property (nonatomic, strong) BillListTable * homeTable; +@property (nonatomic, assign) NSInteger pageNo; +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation YXBillListViewController + +- (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.pageNo = 1; + self.isHidenNaviBar = false; + [self setupUI]; + [self createData];; +} + +- (void)setupUI { + + self.homeTable = [[BillListTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + MJWeakSelf + self.homeTable.detailBlock = ^(NSString * _Nonnull billString) { + + YXWithdrawCashDetailViewController * detailVC = [[YXWithdrawCashDetailViewController alloc] init]; + + [weakSelf.navigationController pushViewController:detailVC animated:YES]; + }; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.bottom.mas_offset(0); + }]; + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + [self createData]; + + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [self createData]; + + }]; +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"1" forKey:@"type"]; + + YXNetAPI * billAPI = [[YXNetAPI alloc] init:self tag:@"BillAPI" NeedToken:@""]; + + [billAPI GetBillListData: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 hiddenAllMBProgressHUD]; + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"BillAPI"]) { + + NSDictionary * dic = response; + + YXBillListModel * model = [YXBillListModel modelWithDictionary:dic]; + + self.homeTable.dataArray = model.records; + } + + + + +} + +- (void)setTimeString:(NSString *)timeString { + + _timeString = timeString; + [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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillViewController.h new file mode 100644 index 0000000..bb2a9c0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillViewController.h @@ -0,0 +1,16 @@ +// +// YXBillViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBillViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillViewController.m new file mode 100644 index 0000000..3158097 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillViewController.m @@ -0,0 +1,315 @@ +// +// YXBillViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import "YXBillViewController.h" +#import "YXBillListViewController.h" +#import "YXBillWithDrawViewController.h" +#import "YXBillDetailViewController.h" +#import "BRDatePickerView.h" + +@interface YXBillViewController () + +/** 顶部控件*/ +@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; + +@property (nonatomic, strong) NSString * timeString; + +@property (nonatomic, assign) NSInteger selectedOnes; + +@property (nonatomic, strong) YXBillDetailViewController * allVC; + +@property (nonatomic, strong) YXBillListViewController * listVc ; + +@property (nonatomic, strong) YXBillWithDrawViewController * drawVc; + +@end + +@implementation YXBillViewController + +#pragma mark - 懒加载 +- (NSMutableArray *)titleButtons { + if (_titleButtons==nil) { + _titleButtons = [NSMutableArray array]; + } + return _titleButtons; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + self.navigationItem.title = @"账单明细"; + + self.timeString = @""; + [self addNavigationItemWithTitles:@[@"选择日期"] isLeft:false target:self action:@selector(selectedTime:) tags:@[@"100"]]; + [self createUI]; + +} + +- (void)selectedTime:(UIButton *)timeBtn { + + // 1.创建日期选择器 + BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; + // 2.设置属性 + datePickerView.pickerMode = BRDatePickerModeYM; + datePickerView.title = @"选择日期"; + // datePickerView.selectValue = @"2019-10-30"; + datePickerView.minDate = [NSDate br_setYear:2003 month:3 day:12]; + datePickerView.maxDate = [NSDate date]; + datePickerView.isAutoSelect = false; + datePickerView.showUnitType = BRShowUnitTypeOnlyCenter;\ + MJWeakSelf + datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) { + NSLog(@"选择的值:%@", selectValue); + weakSelf.timeString = [NSString stringWithFormat:@"%ld-%02d",selectDate.year,selectDate.month]; + + if (weakSelf.selectedOnes == 0) { + + self.allVC.timeString = weakSelf.timeString; + } + if (weakSelf.selectedOnes == 1) { + + self.listVc.timeString = weakSelf.timeString; + } + if (weakSelf.selectedOnes == 2) { + + self.drawVc.timeString = weakSelf.timeString; + } + [timeBtn setTitle:[NSString stringWithFormat:@"%@",weakSelf.timeString] forState:UIControlStateNormal]; + }; + + datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithThemeColor:UIColorHex(#21BEBD)]; + // 3.显示 + [datePickerView show]; +} + +#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 { + + YXBillDetailViewController * allVC = [[YXBillDetailViewController alloc] init]; + allVC.view.backgroundColor = UIColorBackground; + allVC.navigationItem.title = @"全部"; + allVC.timeString = self.timeString; + self.allVC = allVC; + [self addChildViewController:allVC]; + + // + YXBillListViewController * listVc = [[YXBillListViewController alloc] init]; + listVc.view.backgroundColor = UIColorBackground; + listVc.navigationItem.title = @"收益记录"; + listVc.timeString = self.timeString; + self.listVc = listVc; + [self addChildViewController:listVc]; + + YXBillWithDrawViewController * drawVc = [[YXBillWithDrawViewController alloc] init]; + drawVc.view.backgroundColor = UIColorBackground; + drawVc.navigationItem.title = @"提现记录"; + drawVc.timeString = self.timeString; + self.drawVc = drawVc; + [self addChildViewController:drawVc]; +} + +#pragma mark - 设置导航条内容 +- (void)setupNavgationBar { + UIScrollView *topView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 1, kScreenHeight, 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 = [UIFont systemFontOfSize:15]; + + 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 = 3; + CGFloat y = kRealValue(46) ; + UIView *lineView =[[UIView alloc] init]; + // 位置和尺寸 + lineView.height = h; + // 先计算文字尺寸,在给label去赋值 + [titleButton.titleLabel sizeToFit]; + lineView.width = kRealValue(35); + 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.selectedOnes = 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillWithDrawViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillWithDrawViewController.h new file mode 100644 index 0000000..134143f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillWithDrawViewController.h @@ -0,0 +1,18 @@ +// +// YXBillWithDrawViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBillWithDrawViewController : YXBaseViewController + +@property (nonatomic, strong) NSString * timeString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillWithDrawViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillWithDrawViewController.m new file mode 100644 index 0000000..273ae6d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXBillWithDrawViewController.m @@ -0,0 +1,134 @@ +// +// YXBillWithDrawViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import "YXBillWithDrawViewController.h" +#import "BillListTable.h" +#import "YXBillListModel.h" +#import "YXWithdrawCashDetailViewController.h" + +@interface YXBillWithDrawViewController () +@property (nonatomic, strong) BillListTable * homeTable; +@property (nonatomic, assign) NSInteger pageNo; +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation YXBillWithDrawViewController + +- (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.pageNo = 1; + self.isHidenNaviBar = false; + [self setupUI]; + [self createData]; +} + + +- (void)setupUI { + + self.homeTable = [[BillListTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + MJWeakSelf + self.homeTable.detailBlock = ^(NSString * _Nonnull billString) { + + YXWithdrawCashDetailViewController * detailVC = [[YXWithdrawCashDetailViewController alloc] init]; + detailVC.bill_id = billString; + [weakSelf.navigationController pushViewController:detailVC animated:YES]; + }; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.top.bottom.mas_offset(0); + }]; + + self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.pageNo = 1; + [self createData]; + + + + }]; + self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.pageNo ++; + [self createData]; + + }]; +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(self.pageNo) forKey:@"pageNo"]; + [parmDic setObject:@(10) forKey:@"pageSize"]; + [parmDic setObject:@"2" forKey:@"type"]; + + YXNetAPI * billAPI = [[YXNetAPI alloc] init:self tag:@"BillAPI" NeedToken:@""]; + + [billAPI GetBillListData: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 hiddenAllMBProgressHUD]; + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"BillAPI"]) { + + NSDictionary * dic = response; + + YXBillListModel * model = [YXBillListModel modelWithDictionary:dic]; + + self.homeTable.dataArray = model.records; + } + + + +} + +- (void)setTimeString:(NSString *)timeString { + + _timeString = timeString; + [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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXWithdrawCashDetailViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXWithdrawCashDetailViewController.h new file mode 100644 index 0000000..9681bb7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXWithdrawCashDetailViewController.h @@ -0,0 +1,17 @@ +// +// YXWithdrawCashDetailViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + + +NS_ASSUME_NONNULL_BEGIN + +@interface YXWithdrawCashDetailViewController : YXBaseViewController + +@property (nonatomic, strong) NSString * bill_id; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXWithdrawCashDetailViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXWithdrawCashDetailViewController.m new file mode 100644 index 0000000..9c27090 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/billDetail(账单明细)/YXWithdrawCashDetailViewController.m @@ -0,0 +1,119 @@ +// +// YXWithdrawCashDetailViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "YXWithdrawCashDetailViewController.h" +#import "BillDtailTable.h" +#import "YXwithDrawDetailModel.h" +@interface YXWithdrawCashDetailViewController () + +@property (nonatomic, strong) UILabel * moneyLabel; +@property (nonatomic, strong) UILabel * aroundLabel; +@property (nonatomic, strong) BillDtailTable * homeTable; + +@end + +@implementation YXWithdrawCashDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.navigationItem.title = @"提现详情"; + self.view.backgroundColor = UIColorHex(#EEEEEE); + [self createUI]; + // Do any additional setup after loading the view. + [self createData]; +} + +- (void)createUI { + + UIView * backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(200))]; + backView.backgroundColor = UIColorHex(#21BEBD); + [self.view addSubview:backView]; + + self.moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(40), kScreenWidth, 23)]; + self.moneyLabel.textColor = KWhiteColor; + self.moneyLabel.font = BOLDSYSTEMFONT(30); + self.moneyLabel.text = @""; + self.moneyLabel.textColor = KWhiteColor; + self.moneyLabel.textAlignment = NSTextAlignmentCenter; + [self.view addSubview:self.moneyLabel]; + + self.aroundLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,self.moneyLabel.bottom + kRealValue(17), kScreenWidth, 14)]; + self.aroundLabel.textColor = KWhiteColor; + self.aroundLabel.font = BOLDSYSTEMFONT(14); + self.aroundLabel.text = @"到账:"; + self.aroundLabel.textColor = KWhiteColor; + self.aroundLabel.textAlignment = NSTextAlignmentCenter; + [self.view addSubview:self.aroundLabel]; + + UILabel * tishiLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,self.aroundLabel.bottom + kRealValue(25), kScreenWidth, 13)]; + tishiLabel.textColor = KWhiteColor; + tishiLabel.font = MEDIUMFONT(12); + tishiLabel.text = @"您的提现金额将会在3-5个工作日到账,请耐心等待"; + tishiLabel.textColor = KWhiteColor; + tishiLabel.textAlignment = NSTextAlignmentCenter; + [self.view addSubview:tishiLabel]; + + + + self.homeTable = [[BillDtailTable alloc] initWithFrame:CGRectMake(kRealValue(15), tishiLabel.bottom + kRealValue(22), kScreenWidth - kRealValue(30), kScreenHeight - tishiLabel.bottom - kRealValue(68) - kTopHeight) style:UITableViewStyleGrouped]; + self.homeTable.layer.cornerRadius = 10; + self.homeTable.layer.masksToBounds = true; + [self.view addSubview:self.homeTable]; + +} + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.bill_id forKey:@"id"]; + + YXNetAPI * deatilApi = [[YXNetAPI alloc] init:self tag:@"DETAILAPI" NeedToken:@""]; + [deatilApi withDrawDetailsData: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 hiddenAllMBProgressHUD]; + [self.homeTable.mj_footer endRefreshing]; + [self.homeTable.mj_header endRefreshing]; + + if ([tag isEqualToString:@"BillAPI"]) { + + NSDictionary * dic = response; + + YXwithDrawDetailModel * model = [YXwithDrawDetailModel modelWithDictionary:dic]; + + self.moneyLabel.text =[NSString stringWithFormat:@"%@",model.paymentMoney] ; + self.aroundLabel.text = [NSString stringWithFormat:@"到账:%@",model.realityMoney] ; + } + + + +} + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/workSetting(排班设置)/YXworkSetingViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/workSetting(排班设置)/YXworkSetingViewController.h new file mode 100644 index 0000000..10a328c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/workSetting(排班设置)/YXworkSetingViewController.h @@ -0,0 +1,16 @@ +// +// YXworkSetingViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/6. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXworkSetingViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/workSetting(排班设置)/YXworkSetingViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/workSetting(排班设置)/YXworkSetingViewController.m new file mode 100644 index 0000000..91d06d5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/workSetting(排班设置)/YXworkSetingViewController.m @@ -0,0 +1,490 @@ +// +// YXworkSetingViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/6. +// + +#import "YXworkSetingViewController.h" +#import "YXWorkSettingModel.h" +#import "YXCustomSchedulingViewController.h" + + +@interface YXworkSetingViewController () + +@property (nonatomic, strong) UIScrollView * mainScrollview; + +@property (nonatomic, strong) UISwitch * rightSlider; + +@property (nonatomic, strong) UIView * workView; + +@property (nonatomic, strong) UIView * jumpView; + +@property (nonatomic, strong) UISwitch * jumpSwithch; + +@property (nonatomic, strong) UIButton * submitBtn; + +@property (nonatomic, strong) UIButton * customBtn; + + +@property (nonatomic, assign) BOOL isVideo; + +@property (nonatomic, assign) BOOL isJump; + +//7个id +@property (nonatomic, copy) NSString * oneID; +@property (nonatomic, copy) NSString * twoID; +@property (nonatomic, copy) NSString * threeID; +@property (nonatomic, copy) NSString * fourID; +@property (nonatomic, copy) NSString * fiveID; +@property (nonatomic, copy) NSString * sixID; +@property (nonatomic, copy) NSString * sevenID; +@property (nonatomic, copy) NSArray * peopleArray; + + +@end + +@implementation YXworkSetingViewController + +#pragma mark:懒加载 + + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; + self.navigationItem.title = @"视频排班"; + [self createUI]; + [self createData]; +} + +- (void)createUI { + + self.mainScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + self.mainScrollview.backgroundColor = CViewBgColor; + [self.view addSubview:self.mainScrollview]; + + UIView * workView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(12), kScreenWidth - kRealValue(30), kRealValue(382))]; + workView.layer.cornerRadius = 10; + workView.layer.masksToBounds = YES; + self.workView = workView; + workView.backgroundColor = KWhiteColor; + [self.mainScrollview addSubview:workView]; + + + NSArray * array = @[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周天"]; + + CGFloat viewW = self.workView.width - kRealValue(30); + + for (int i = 0; i < array.count; i++) { + + UIView * weekView = [self createWorkView:CGRectMake(kRealValue(15), kRealValue(40) + 15 + kRealValue(45) * i, viewW, kRealValue(35)) withWeek:array[i] withAmTag:100 +i withPmTag:200 + i]; + [self.workView addSubview:weekView]; + + } + + UILabel * questionTitle = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(18),200, 15)]; + questionTitle.textAlignment = NSTextAlignmentLeft; + questionTitle.textColor = UIColorHex(#333333); + questionTitle.font = BOLDSYSTEMFONT(15); + questionTitle.text = @"视频咨询"; + [workView addSubview:questionTitle]; + + + self.rightSlider = [[UISwitch alloc] initWithFrame:CGRectMake(workView.width - kRealValue(52), kRealValue(11), kRealValue(40), 30)]; + [self.rightSlider setOn:NO animated:YES]; + [self.rightSlider setOnTintColor: UIColorHex(#59D5D4)]; + self.rightSlider.transform = CGAffineTransformMakeScale(0.6, 0.6); + self.isVideo = false; + [self.rightSlider addTarget:self action:@selector(switchChange:) forControlEvents:UIControlEventValueChanged]; + [workView addSubview:self.rightSlider]; + + + + + UIView * jumpView = [[UIView alloc] initWithFrame:CGRectMake(workView.left, workView.bottom + kRealValue(10), workView.width, kRealValue(44))]; + jumpView.layer.cornerRadius = 10.0; + jumpView.layer.masksToBounds = YES; + jumpView.backgroundColor = KWhiteColor; + self.jumpView = jumpView; + [self.mainScrollview addSubview:jumpView]; + + + UILabel * jumpLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 0, 200, kRealValue(44))]; + jumpLabel.textColor = CFontColor1; + jumpLabel.text = @"自动跳过法定节假日?"; + jumpLabel.font = MEDIUMFONT(14); + jumpLabel.textAlignment = NSTextAlignmentLeft; + [jumpView addSubview:jumpLabel]; + + + + self.jumpSwithch = [[UISwitch alloc] initWithFrame:CGRectMake(jumpView.width - kRealValue(52), kRealValue(9), kRealValue(40), 30)]; + [self.jumpSwithch setOn:NO animated:YES]; + [self.jumpSwithch setOnTintColor: UIColorHex(#59D5D4)]; + self.jumpSwithch.transform = CGAffineTransformMakeScale(0.6, 0.6); + self.isJump = false; + [self.jumpSwithch addTarget:self action:@selector(jumpChange:) forControlEvents:UIControlEventValueChanged]; + [jumpView addSubview:self.jumpSwithch]; + + UIButton * submitBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, jumpView.bottom + kRealValue(98), 160, 35)]; + submitBtn.backgroundColor = KWhiteColor; + submitBtn.layer.cornerRadius = 20; + submitBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + submitBtn.layer.borderWidth = 1.0f; + [submitBtn setTitle:@"生成排班" forState:UIControlStateNormal]; + [submitBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + submitBtn.centerX = self.view.centerX; + [submitBtn addTarget:self action:@selector(submitTimeAction) forControlEvents:UIControlEventTouchUpInside]; + submitBtn.titleLabel.font = SYSTEMFONT(14); + self.submitBtn = submitBtn; + [self.mainScrollview addSubview:submitBtn]; + +// UIButton * customBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, submitBtn.bottom + kRealValue(10), 160, 35)]; +// customBtn.centerX = self.view.centerX; +// customBtn.titleLabel.font = SYSTEMFONT(14); +// customBtn.backgroundColor = KClearColor; +// [customBtn setTitle:@"自定义排班" forState:UIControlStateNormal]; +// [customBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; +// [customBtn addTarget:self action:@selector(customAction) forControlEvents:UIControlEventTouchUpInside]; +// [self.view addSubview:customBtn]; +// self.customBtn = customBtn; +// [self.mainScrollview addSubview:submitBtn]; + + self.mainScrollview.contentSize = CGSizeMake(kScreenWidth, submitBtn.bottom + kRealValue(22)); +} + + +- (void)createData { + + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"WEEKAPI" NeedToken:@""]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [workApi GetDoctorWorkSetting:parmDic]; + + +} + +- (UIView *)createWorkView:(CGRect)frame withWeek:(NSString *)week withAmTag:(NSInteger)amTag withPmTag:(NSInteger)pmTag { + + UIView * view = [[UIView alloc] initWithFrame:frame]; + view.layer.cornerRadius = 18; + view.backgroundColor = UIColorHex(#E0E0E0); + view.layer.masksToBounds = YES; + + UILabel * weekLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(26), 0, kRealValue(63), view.height)]; + weekLabel.textAlignment = NSTextAlignmentLeft; + weekLabel.textColor = UIColorHex(#333333); + weekLabel.font = SYSTEMFONT(13); + weekLabel.text = week; + [view addSubview:weekLabel]; + CGFloat amWidth = [HQCommonUtils getLengthFromText:@"上午" andFontSize:13]; + UILabel * amLabel = [[UILabel alloc] initWithFrame:CGRectMake(weekLabel.right, 0, amWidth, view.height)]; + amLabel.text = @"上午"; + amLabel.textAlignment = NSTextAlignmentLeft; + amLabel.textColor = UIColorHex(#333333); + amLabel.font = SYSTEMFONT(13); + [view addSubview:amLabel]; + + UITextField * pepleField = [[UITextField alloc] initWithFrame:CGRectMake(amLabel.right +5 , 5, 38, view.height - 10)]; + pepleField.backgroundColor = KWhiteColor; + pepleField.layer.cornerRadius = 5.0; + pepleField.layer.masksToBounds = YES; + pepleField.textAlignment = NSTextAlignmentCenter; + pepleField.font = SYSTEMFONT(13); + pepleField.keyboardType = UIKeyboardTypeNumberPad; + pepleField.tag = amTag; + [view addSubview:pepleField]; + + CGFloat peoWidth = [HQCommonUtils getLengthFromText:@"人" andFontSize:13]; + UILabel * peoLabel = [[UILabel alloc] initWithFrame:CGRectMake(pepleField.right + 5, 0, peoWidth, view.height)]; + peoLabel.text = @"人"; + peoLabel.textAlignment = NSTextAlignmentLeft; + peoLabel.textColor = UIColorHex(#333333); + peoLabel.font = SYSTEMFONT(13); + [view addSubview:peoLabel]; + + UILabel * rightPeoLabel = [[UILabel alloc] initWithFrame:CGRectMake(view.width - kRealValue(23) - peoWidth, 0, peoWidth, view.height)]; + rightPeoLabel.text = @"人"; + rightPeoLabel.textAlignment = NSTextAlignmentLeft; + rightPeoLabel.textColor = UIColorHex(#333333); + rightPeoLabel.font = SYSTEMFONT(13); + + [view addSubview:rightPeoLabel]; + + UITextField * pmField = [[UITextField alloc] initWithFrame:CGRectMake(rightPeoLabel.left - 5 - 38 , 5, 38, view.height - 10)]; + pmField.backgroundColor = KWhiteColor; + pmField.layer.cornerRadius = 5.0; + pmField.textAlignment = NSTextAlignmentCenter; + pmField.font = SYSTEMFONT(13); + pmField.layer.masksToBounds = YES; + pmField.tag = pmTag; + pmField.keyboardType = UIKeyboardTypeNumberPad; + [view addSubview:pmField]; + + UILabel * pmLabel = [[UILabel alloc] initWithFrame:CGRectMake(pmField.left - amWidth - 5, 0, amWidth, view.height)]; + pmLabel.text = @"下午"; + pmLabel.textAlignment = NSTextAlignmentLeft; + pmLabel.textColor = UIColorHex(#333333); + pmLabel.font = SYSTEMFONT(13); + [view addSubview:pmLabel]; + + return view; +} + +- (void) switchChange:(UISwitch*)sw { + + self.isVideo = sw.on; + + +} + +- (void)jumpChange:(UISwitch*)sw { + + self.isJump = sw.on; +} + + +- (void)submitTimeAction { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + NSMutableArray * dataArray = [[NSMutableArray alloc] init]; + + if (self.isVideo == true) { + //有时间用模型吧 + + //周一 + UITextField * oneAmField = [self.view viewWithTag:100]; + UITextField * onePmField = [self.view viewWithTag:200]; + if ([oneAmField.text integerValue] > 0 ||[onePmField.text integerValue] > 0 ) { + NSString * oneDic = [self createSubmitData:oneAmField.text PMtext:onePmField.text Withweek:@"1" withWeekID:self.oneID]; + [dataArray addObject:oneDic]; + } + //周二 + UITextField * twoAmField = [self.view viewWithTag:101]; + UITextField * twoPmField = [self.view viewWithTag:201]; + if ([twoAmField.text integerValue] > 0 ||[twoPmField.text integerValue] > 0 ) { + NSString * twoDic = [self createSubmitData:twoAmField.text PMtext:twoPmField.text Withweek:@"2" withWeekID:self.twoID]; + [dataArray addObject:twoDic]; + } + //周三 + UITextField * threeAmField = [self.view viewWithTag:102]; + UITextField * threePmField = [self.view viewWithTag:202]; + if ([threeAmField.text integerValue] > 0 ||[threePmField.text integerValue] > 0 ) { + NSString * threeDic = [self createSubmitData:threeAmField.text PMtext:threePmField.text Withweek:@"3" withWeekID:self.threeID]; + [dataArray addObject:threeDic]; + } + //周四 + UITextField * fourAmField = [self.view viewWithTag:103]; + UITextField * fourPmField = [self.view viewWithTag:203]; + if ([fourAmField.text integerValue] > 0 ||[fourPmField.text integerValue] > 0 ) { + NSString * fourDic = [self createSubmitData:fourAmField.text PMtext:fourPmField.text Withweek:@"4" withWeekID:self.fourID]; + [dataArray addObject:fourDic]; + } + //周五 + UITextField * fiveAmField = [self.view viewWithTag:104]; + UITextField * fivePmField = [self.view viewWithTag:204]; + if ([fiveAmField.text integerValue] > 0 ||[fivePmField.text integerValue] > 0 ) { + NSString * fiveDic = [self createSubmitData:fiveAmField.text PMtext:fivePmField.text Withweek:@"5" withWeekID:self.fiveID]; + [dataArray addObject:fiveDic]; + } + //周六 + UITextField * sixAmField = [self.view viewWithTag:105]; + UITextField * sixPmField = [self.view viewWithTag:205]; + if ([sixAmField.text integerValue] > 0 ||[sixPmField.text integerValue] > 0 ) { + NSString * sixDic = [self createSubmitData:sixAmField.text PMtext:sixPmField.text Withweek:@"6" withWeekID:self.sixID]; + [dataArray addObject:sixDic]; + } + //周天 + UITextField * sevenAmField = [self.view viewWithTag:106]; + UITextField * sevenPmField = [self.view viewWithTag:206]; + if ([sevenAmField.text integerValue] > 0 ||[sevenPmField.text integerValue] > 0 ) { + NSString * sevenDic = [self createSubmitData:sevenAmField.text PMtext:sevenPmField.text Withweek:@"7" withWeekID:self.sevenID]; + [dataArray addObject:sevenDic]; + } + + if (dataArray.count == 0) { + [EasyTextView showErrorText:@"请输入就诊人数"]; + return; + } + // 创建一个包含对象的数组 + [parmDic setObject:dataArray forKey:@"list"]; + + } + else + { + NSArray * array = [NSArray modelArrayWithClass:[YXWorkTimeModel class] json:self.peopleArray]; + + for (YXWorkTimeModel * model in self.peopleArray) { + NSString * jsonString = [model modelToJSONObject]; + [dataArray addObject:jsonString]; + } + [parmDic setObject:dataArray forKey:@"list"]; + } +// //是否开启音视频 +// self.isVideo; +// //是否自动跳过节假日 +// self.isJump; +// tfDefault 自排班已去掉 + [parmDic setObject:@(1) forKey:@"audioStatus"]; + + if (self.isVideo == true) { + [parmDic setObject:@(1) forKey:@"audioStatus"]; + + }else if (self.isVideo == false) { + [parmDic setObject:@(0) forKey:@"audioStatus"]; + } + + + if (self.isJump == true) { + [parmDic setObject:@(1) forKey:@"tfJumpHoliday"]; + + }else if (self.isJump == false) { + [parmDic setObject:@(0) forKey:@"tfJumpHoliday"]; + } + + [parmDic setObject:@(0) forKey:@"tfDefault"]; + + [self showMBProgressHUDWithString:@"正在设置" autoHidden:false]; + YXNetAPI * workApi = [[YXNetAPI alloc] init:self tag:@"WorkAPI" NeedToken:@""]; + + + + [workApi PostDoctorWorkTime:parmDic]; + + +} + +- (NSString *)createSubmitData:(NSString *)amText + PMtext:(NSString *)pmText + Withweek:(NSString *)week + withWeekID:(NSString *)weekID{ + + NSMutableDictionary * dic = [[NSMutableDictionary alloc] init]; + NSInteger type = 0; + if ([amText integerValue] > 0 || [pmText intValue] > 0) { + + if ([amText integerValue] > 0) { + [dic setObject:[NSString stringWithFormat:@"%@",amText] forKey:@"amNum"]; + type = 0; + } + if ([pmText integerValue] > 0) { + [dic setObject:[NSString stringWithFormat:@"%@",pmText] forKey:@"pmNum"]; + type = 1; + } + if ([amText integerValue] > 0 && [pmText intValue] > 0) { + type = 2; + } + [dic setObject:[NSString stringWithFormat:@"%@",weekID] forKey:@"id"]; + [dic setObject:@(type) forKey:@"type"]; + [dic setObject:week forKey:@"week"]; + [dic setObject:@(self.isJump) forKey:@"tfJumpHoliday"]; + [dic setObject:@(self.isVideo) forKey:@"audioStatus"]; + + } + YXWorkTimeModel * model = [YXWorkTimeModel modelWithDictionary:dic]; + NSString * jsonString = [model modelToJSONObject]; + return jsonString; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + if ([tag isEqualToString:@"WorkAPI"]) { + [self hiddenAllMBProgressHUD]; + [self showMBProgressHUDOnlyWithString:response]; + } + if ([tag isEqualToString:@"WEEKAPI"]) { + + NSDictionary * resDic = response; + + YXWorkSettingModel * model = [YXWorkSettingModel modelWithDictionary:resDic]; + + [self.jumpSwithch setOn:[model.tfJumpHoliday boolValue] animated:YES]; + [self.rightSlider setOn:[model.audioStatus boolValue] animated:YES]; + + [self switchChange:self.rightSlider]; + self.peopleArray = model.list; + for (YXWorkTimeModel * timeModel in model.list) { + + //周一 + [self haveDoctorWorkTime:timeModel]; + + } + } + + +} + +- (void)haveDoctorWorkTime:(YXWorkTimeModel *)timeModel { + + if ([timeModel.week intValue] == 1) { + self.oneID = timeModel.work_id; + UITextField * oneAmField = [self.view viewWithTag:100]; + UITextField * onePmField = [self.view viewWithTag:200]; + oneAmField.text = timeModel.amNum; + onePmField.text = timeModel.pmNum; + } + if ([timeModel.week intValue] == 2) { + self.twoID = timeModel.work_id; + UITextField * twoAmField = [self.view viewWithTag:101]; + UITextField * twoPmField = [self.view viewWithTag:201]; + twoAmField.text = timeModel.amNum; + twoPmField.text = timeModel.pmNum; + } + if ([timeModel.week intValue] == 3) { + self.threeID = timeModel.work_id; + UITextField * threeAmField = [self.view viewWithTag:102]; + UITextField * threePmField = [self.view viewWithTag:202]; + threeAmField.text = timeModel.amNum; + threePmField.text = timeModel.pmNum; + } + if ([timeModel.week intValue] == 4) { + self.fourID = timeModel.work_id; + UITextField * fourAmField = [self.view viewWithTag:103]; + UITextField * fourPmField = [self.view viewWithTag:203]; + fourAmField.text = timeModel.amNum; + fourPmField.text = timeModel.pmNum; + } + if ([timeModel.week intValue] == 5) { + self.fiveID = timeModel.work_id; + UITextField * fiveAmField = [self.view viewWithTag:104]; + UITextField * fivePmField = [self.view viewWithTag:204]; + fiveAmField.text = timeModel.amNum; + fivePmField.text = timeModel.pmNum; + } + if ([timeModel.week intValue] == 6) { + self.sixID = timeModel.work_id; + UITextField * sixAmField = [self.view viewWithTag:105]; + UITextField * sixPmField = [self.view viewWithTag:205]; + sixAmField.text = timeModel.amNum; + sixPmField.text = timeModel.pmNum; + } + if ([timeModel.week intValue] == 7) { + self.sevenID = timeModel.work_id; + UITextField * sevenAmField = [self.view viewWithTag:106]; + UITextField * sevenPmField = [self.view viewWithTag:206]; + sevenAmField.text = timeModel.amNum; + sevenPmField.text = timeModel.pmNum; + } + + +} + +- (void)customAction { + + YXCustomSchedulingViewController * customvc = [[YXCustomSchedulingViewController alloc] init]; + + [self.navigationController pushViewController:customvc animated:YES]; + +} + + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/DoctorInfoModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/DoctorInfoModel.h new file mode 100644 index 0000000..c858182 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/DoctorInfoModel.h @@ -0,0 +1,74 @@ +// +// YXDoctorInfoModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + + +@interface YXDoctorGoodSicknessModel : NSObject + +@property (nonatomic, copy) NSString * sicks_id; + +@property (nonatomic, copy) NSString * sicksName; + +@end + + +@interface YXDoctorInfoModel : NSObject + +@property (nonatomic, copy) NSString * doctor_Id; + +@property (nonatomic, copy) NSString * sex; + +@property (nonatomic, strong) NSArray * goodAtSicknessName; + +@property (nonatomic, copy) NSString * doctorJob_dictText; + +@property (nonatomic, copy) NSString * doctorName; + +@property (nonatomic, copy) NSString * photo; + +@property (nonatomic, copy) NSString * doctorTitle; + +@property (nonatomic, copy) NSString * doctorStatus_dictText; + +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, copy) NSString * goodAtSymptom; + +@property (nonatomic, copy) NSString * departmentName; + +@property (nonatomic, copy) NSString * introduction; + +@property (nonatomic, copy) NSString * goodAt; + +@property (nonatomic, copy) NSString * userScore; + +@property (nonatomic, copy) NSString * replyNum; + +@property (nonatomic, copy) NSString * tfShowFire; + +@property (nonatomic, copy) NSString * audioVideo; + +@property (nonatomic, copy) NSString * audioStatus; + +@property (nonatomic, copy) NSString * status; + +@property (nonatomic, copy) NSString * resourceId; + +@property (nonatomic, copy) NSString * experience; + +@property (nonatomic, copy) NSString * doctorStatus; + +@property (nonatomic, copy) NSString * departmentId; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/HQHomePageModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/HQHomePageModel.h new file mode 100644 index 0000000..4eb17db --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/HQHomePageModel.h @@ -0,0 +1,49 @@ +// +// YXHomePageModel.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/9. +// + +#import +NS_ASSUME_NONNULL_BEGIN + +@interface YXHomePageModel : NSObject + +@property (nonatomic, copy) NSString * imageName; + +@property (nonatomic, copy) NSString * projectName; + +@end + + +@interface HQProjectModel : NSObject + +@property (nonatomic, copy) NSString * imageName; + +@property (nonatomic, copy) NSString * projectName; + +@property (nonatomic, copy) NSString * price; + +@property (nonatomic, assign) BOOL isSelected; + +@end + + +@interface HQSmallHelpModel : NSObject + +@property (nonatomic, copy) NSString * groupId; + +@property (nonatomic, strong) NSArray * member; + +@property (nonatomic, copy) NSString * userId; + +@property (nonatomic, copy) NSString * tfNew; + +@property (nonatomic, copy) NSString * help_Id; + +@end + + + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionBodyReportModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionBodyReportModel.h new file mode 100644 index 0000000..1261807 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionBodyReportModel.h @@ -0,0 +1,21 @@ +// +// YXQuestionBodyReportModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionBodyReportModel : 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionRecordModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionRecordModel.h new file mode 100644 index 0000000..34d7327 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionRecordModel.h @@ -0,0 +1,42 @@ +// +// YXQuestionRecordModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionRecordModel : 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionStaticsModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionStaticsModel.h new file mode 100644 index 0000000..c827962 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/QuestionStaticsModel.h @@ -0,0 +1,22 @@ +// +// YXQuestionStaticsModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionStaticsModel : NSObject + + +@property (nonatomic, copy) NSString * total; +@property (nonatomic, copy) NSString * content_type; +@property (nonatomic, copy) NSString * inProgress; +@property (nonatomic, copy) NSString * completed; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/StopServiceModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/StopServiceModel.h new file mode 100644 index 0000000..6247a36 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/StopServiceModel.h @@ -0,0 +1,53 @@ +// +// YXStopServiceModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopServiceListModel : NSObject + +@property (nonatomic, copy) NSString * record_id; + +@property (nonatomic, copy) NSString * notice; + +@property (nonatomic, assign) NSInteger delFlag; + + +@property (nonatomic, copy) NSString * createBy; + +@property (nonatomic, copy) NSString * startDay; + +@property (nonatomic, copy) NSString * endDay; + +@property (nonatomic, copy) NSString * stopReason; + +@property (nonatomic, copy) NSString * doctorId; + +@property (nonatomic, copy) NSString * createTime; + +@property (nonatomic, assign) NSInteger serviceStatus; + +@property (nonatomic, assign) NSInteger status; + +@end + +@interface YXStopServiceModel : NSObject + +@property (nonatomic, strong) NSArray * orders; + +@property (nonatomic, assign) NSInteger pages; + +@property (nonatomic, assign) NSInteger current; + +@property (nonatomic, assign) NSInteger total; + +@property (nonatomic, strong) NSArray * records; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXCancelReasonModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXCancelReasonModel.h new file mode 100644 index 0000000..ae04411 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXCancelReasonModel.h @@ -0,0 +1,21 @@ +// +// YXCancelReasonModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXCancelReasonModel : NSObject + +@property (nonatomic, strong) NSString * value; +@property (nonatomic, strong) NSString * text; +@property (nonatomic, strong) NSString * label; +@property (nonatomic, strong) NSString * title; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXCancelReasonModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXCancelReasonModel.m new file mode 100644 index 0000000..8213e4c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXCancelReasonModel.m @@ -0,0 +1,12 @@ +// +// YXCancelReasonModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import "YXCancelReasonModel.h" + +@implementation YXCancelReasonModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXDoctorInfoModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXDoctorInfoModel.h new file mode 100644 index 0000000..c858182 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXDoctorInfoModel.h @@ -0,0 +1,74 @@ +// +// YXDoctorInfoModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + + +@interface YXDoctorGoodSicknessModel : NSObject + +@property (nonatomic, copy) NSString * sicks_id; + +@property (nonatomic, copy) NSString * sicksName; + +@end + + +@interface YXDoctorInfoModel : NSObject + +@property (nonatomic, copy) NSString * doctor_Id; + +@property (nonatomic, copy) NSString * sex; + +@property (nonatomic, strong) NSArray * goodAtSicknessName; + +@property (nonatomic, copy) NSString * doctorJob_dictText; + +@property (nonatomic, copy) NSString * doctorName; + +@property (nonatomic, copy) NSString * photo; + +@property (nonatomic, copy) NSString * doctorTitle; + +@property (nonatomic, copy) NSString * doctorStatus_dictText; + +@property (nonatomic, copy) NSString * resourceName; + +@property (nonatomic, copy) NSString * goodAtSymptom; + +@property (nonatomic, copy) NSString * departmentName; + +@property (nonatomic, copy) NSString * introduction; + +@property (nonatomic, copy) NSString * goodAt; + +@property (nonatomic, copy) NSString * userScore; + +@property (nonatomic, copy) NSString * replyNum; + +@property (nonatomic, copy) NSString * tfShowFire; + +@property (nonatomic, copy) NSString * audioVideo; + +@property (nonatomic, copy) NSString * audioStatus; + +@property (nonatomic, copy) NSString * status; + +@property (nonatomic, copy) NSString * resourceId; + +@property (nonatomic, copy) NSString * experience; + +@property (nonatomic, copy) NSString * doctorStatus; + +@property (nonatomic, copy) NSString * departmentId; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXDoctorInfoModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXDoctorInfoModel.m new file mode 100644 index 0000000..7200dce --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXDoctorInfoModel.m @@ -0,0 +1,42 @@ +// +// YXDoctorInfoModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/4. +// + +#import "YXDoctorInfoModel.h" + + +@implementation YXDoctorGoodSicknessModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"sicks_id" :@"id"}; + return dic; +} + + +@end + +@implementation YXDoctorInfoModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"doctor_Id" :@"id"}; + return dic; +} + + + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"goodAtSicknessName":[YXDoctorGoodSicknessModel class], + }; + +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHomePageModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHomePageModel.h new file mode 100644 index 0000000..63ccae6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHomePageModel.h @@ -0,0 +1,49 @@ +// +// YXHomePageModel.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/9. +// + +#import +NS_ASSUME_NONNULL_BEGIN + +@interface YXHomePageModel : NSObject + +@property (nonatomic, copy) NSString * imageName; + +@property (nonatomic, copy) NSString * projectName; + +@end + + +@interface YXProjectModel : NSObject + +@property (nonatomic, copy) NSString * imageName; + +@property (nonatomic, copy) NSString * projectName; + +@property (nonatomic, copy) NSString * price; + +@property (nonatomic, assign) BOOL isSelected; + +@end + + +@interface YXZJSmallHelpModel : NSObject + +@property (nonatomic, copy) NSString * groupId; + +@property (nonatomic, strong) NSArray * member; + +@property (nonatomic, copy) NSString * userId; + +@property (nonatomic, copy) NSString * tfNew; + +@property (nonatomic, copy) NSString * help_Id; + +@end + + + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHomePageModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHomePageModel.m new file mode 100644 index 0000000..d52734d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHomePageModel.m @@ -0,0 +1,32 @@ +// +// YXHomePageModel.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/9. +// + +#import "YXHomePageModel.h" + +@implementation YXHomePageModel + +@end + + + +@implementation YXProjectModel + +@end + + +@implementation YXZJSmallHelpModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"help_Id" :@"id"}; + return dic; +} + +@end + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHospitalModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHospitalModel.h new file mode 100644 index 0000000..5fde1d7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHospitalModel.h @@ -0,0 +1,25 @@ +// +// YXHospitalModel.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/19. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXHospitalModel : NSObject + +@property (nonatomic, copy) NSString * hospitalName; + +@property (nonatomic, copy) NSString * hospitalImage; + +@property (nonatomic, copy) NSString * hospitalId; + +@property (nonatomic, assign) BOOL isChoose; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHospitalModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHospitalModel.m new file mode 100644 index 0000000..f7c8207 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXHospitalModel.m @@ -0,0 +1,18 @@ +// +// YXHospitalModel.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/19. +// + +#import "YXHospitalModel.h" + +@implementation YXHospitalModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"hospitalId" :@"id"}; + return dic; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXProjectListModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXProjectListModel.h new file mode 100644 index 0000000..2053776 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXProjectListModel.h @@ -0,0 +1,33 @@ +// +// YXProjectListModel.h +// healthQuestion +// +// Created by 仁康信息 on 2022/10/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSubProjectListModel : NSObject + +@property (nonatomic, copy) NSString * imageName; + +@property (nonatomic, copy) NSString * projectName; + +@end + +@interface YXProjectListModel : NSObject + +@property (nonatomic, assign) BOOL isShow; + +@property (nonatomic, assign) BOOL isSelected; + +@property (nonatomic, copy) NSString * projectName; + +@property (nonatomic, strong) NSArray* subData; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXProjectListModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXProjectListModel.m new file mode 100644 index 0000000..a5f17ec --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXProjectListModel.m @@ -0,0 +1,27 @@ +// +// YXProjectListModel.m +// healthQuestion +// +// Created by 仁康信息 on 2022/10/12. +// + +#import "YXProjectListModel.h" + +@implementation YXSubProjectListModel + +@end + + + +@implementation YXProjectListModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"subData":[YXSubProjectListModel class], + }; + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionBodyReportModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionBodyReportModel.h new file mode 100644 index 0000000..1261807 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionBodyReportModel.h @@ -0,0 +1,21 @@ +// +// YXQuestionBodyReportModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionBodyReportModel : 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionBodyReportModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionBodyReportModel.m new file mode 100644 index 0000000..d1a06ff --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionBodyReportModel.m @@ -0,0 +1,12 @@ +// +// YXQuestionBodyReportModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/16. +// + +#import "YXQuestionBodyReportModel.h" + +@implementation YXQuestionBodyReportModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionRecordModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionRecordModel.h new file mode 100644 index 0000000..34d7327 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionRecordModel.h @@ -0,0 +1,42 @@ +// +// YXQuestionRecordModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionRecordModel : 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/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionRecordModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionRecordModel.m new file mode 100644 index 0000000..8fcc0b6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionRecordModel.m @@ -0,0 +1,19 @@ +// +// YXQuestionRecordModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import "YXQuestionRecordModel.h" + +@implementation YXQuestionRecordModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"record_id" :@"id"}; + return dic; +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionStaticsModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionStaticsModel.h new file mode 100644 index 0000000..c827962 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionStaticsModel.h @@ -0,0 +1,22 @@ +// +// YXQuestionStaticsModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXQuestionStaticsModel : NSObject + + +@property (nonatomic, copy) NSString * total; +@property (nonatomic, copy) NSString * content_type; +@property (nonatomic, copy) NSString * inProgress; +@property (nonatomic, copy) NSString * completed; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionStaticsModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionStaticsModel.m new file mode 100644 index 0000000..c02ef60 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXQuestionStaticsModel.m @@ -0,0 +1,12 @@ +// +// YXQuestionStaticsModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/8. +// + +#import "YXQuestionStaticsModel.h" + +@implementation YXQuestionStaticsModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecordIMListDateModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecordIMListDateModel.h new file mode 100644 index 0000000..53ed1d1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecordIMListDateModel.h @@ -0,0 +1,50 @@ +// +// RecordIMListDateModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXRecordIMListDateModel : NSObject +@property (nonatomic, strong) NSString * Record_id; +@property (nonatomic, strong) NSString * rejectReason; +@property (nonatomic, strong) NSString * fromAccount; +@property (nonatomic, strong) NSString * memberName; +@property (nonatomic, strong) NSString * hospitalLevel; +@property (nonatomic, strong) NSString * contentStatus; +@property (nonatomic, strong) NSString * schedulingDateId; +@property (nonatomic, strong) NSString * amPm; +@property (nonatomic, strong) NSString * toAccountName; +@property (nonatomic, strong) NSString * memberSex; +@property (nonatomic, strong) NSString * contentType; +@property (nonatomic, strong) NSString * reasonType; + +@property (nonatomic, strong) NSString * week; +@property (nonatomic, strong) NSString * toAccount; +@property (nonatomic, strong) NSString * sessionType; +@property (nonatomic, strong) NSString * medicalRecordsId; +@property (nonatomic, strong) NSString * toAccountHead; +@property (nonatomic, strong) NSString * toAccountTitle; +@property (nonatomic, strong) NSString * createTimeLong; +@property (nonatomic, strong) NSString * tfOwn; +@property (nonatomic, strong) NSString * memberId; + +@property (nonatomic, strong) NSString * doctorStartTime; +@property (nonatomic, strong) NSString * departmentName; +@property (nonatomic, strong) NSString * tfReply; +@property (nonatomic, strong) NSString * doctorEndTimeLong; +@property (nonatomic, strong) NSString * sessionDate; +@property (nonatomic, strong) NSString * imId; +@property (nonatomic, strong) NSString * createTime; +@property (nonatomic, strong) NSString * memberAge; +@property (nonatomic, strong) NSString * resourceName; + +@property (nonatomic, strong) NSString * unRedMessage; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecordIMListDateModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecordIMListDateModel.m new file mode 100644 index 0000000..a4a1677 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecordIMListDateModel.m @@ -0,0 +1,19 @@ +// +// YXRecordIMListDateModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import "YXRecordIMListDateModel.h" + +@implementation YXRecordIMListDateModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"Record_id" :@"id"}; + return dic; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecoredListDetailModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecoredListDetailModel.h new file mode 100644 index 0000000..e62e7ab --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecoredListDetailModel.h @@ -0,0 +1,142 @@ +// +// YXRecoredListDetailModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXRecoredDetailConsessionModel : NSObject + +@property (nonatomic, copy) NSString * consession_id; + +@property (nonatomic, copy) NSString * memberId; + +@property (nonatomic, copy) NSString * toAccount; + +@property (nonatomic, copy) NSString * fromAccount; + +@property (nonatomic, copy) NSString * memberName; + +@property (nonatomic, copy) NSString * memberSex; + +@property (nonatomic, copy) NSString * memberAge; + +@property (nonatomic, copy) NSString * createTime; + +@property (nonatomic, copy) NSString * sessionDate; + +@property (nonatomic, copy) NSString * week; + +@property (nonatomic, copy) NSString * amPm; + +@property (nonatomic, copy) NSString * sessionType; + +@property (nonatomic, copy) NSString * weight; + +@property (nonatomic, copy) NSString * contentStatus; + +@property (nonatomic, copy) NSString * reasonType; + +@property (nonatomic, copy) NSString * rejectReason; + +@property (nonatomic, copy) NSString * imId; + +@property (nonatomic, copy) NSString * doctorStartTimeLong; + +@property (nonatomic, copy) NSString * doctorEndTimeLong; +@property (nonatomic, copy) NSString * sessionDateLong; +@property (nonatomic, copy) NSString * contentType; +@property (nonatomic, copy) NSString * doctorStartTime; + +@end + + +@interface YXRecoredconMedicalRecordsListDO : NSObject + +@property (nonatomic, copy) NSString * dangan_id; +@property (nonatomic, copy) NSString * recordsName; +@property (nonatomic, copy) NSString * medicalDescribe; +@property (nonatomic, copy) NSString * tfPermission; +@property (nonatomic, copy) NSString * image; +@property (nonatomic, copy) NSString * createTime; +@property (nonatomic, copy) NSString * haveTimeValue; +@property (nonatomic, copy) NSString * tfLookValue; +@property (nonatomic, copy) NSString * tfLook; +@property (nonatomic, copy) NSString * desire; +@property (nonatomic, copy) NSString * lookOffice; +@property (nonatomic, copy) NSString * lookMedicalName; + +@end + +@interface YXRecoredDetailHealthModel : NSObject + +@property (nonatomic, strong) NSString * answerValue; +@property (nonatomic, strong) NSString * answerKey; + +@end + + +@interface YXRecoredDetailIMListModel : NSObject + + +@property (nonatomic, copy) NSString * endTime; + +@property (nonatomic, copy) NSString * startTime; + +@property (nonatomic, copy) NSString * endTimeLong; + +@property (nonatomic, copy) NSString * startTimLong; + +@property (nonatomic, copy) NSString * type; // 1约定时间 2通话时长 + + +@end + +@interface YXRecoredListDetailModel : NSObject + +@property (nonatomic, strong) NSArray * imList; + +@property (nonatomic, strong) NSArray * answer; + +@property (nonatomic, strong) NSDictionary * conSession; + +@property (nonatomic, strong) NSDictionary * conFamilyMembersDO; + +@property (nonatomic, strong) NSDictionary * conMedicalRecordsListDO; + +@property (nonatomic, strong) NSDictionary * conMedicalRecordsDO; + +@property (nonatomic, copy) NSString * idNo; + +@property (nonatomic, copy) NSString * conEvaluateDO; + +@property (nonatomic, copy) NSString * createTime; + +@end + + +@interface YXReocrdconFamilyMembersDO : NSObject + +@property (nonatomic, copy) NSString * name; + +@property (nonatomic, copy) NSString * gender; + +@property (nonatomic, copy) NSString * height; + +@property (nonatomic, copy) NSString * weight; + +@property (nonatomic, copy) NSString * familyRelation; + +@property (nonatomic, copy) NSString * groupId; + +@property (nonatomic, copy) NSString * age; + +@property (nonatomic, copy) NSString * family_id; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecoredListDetailModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecoredListDetailModel.m new file mode 100644 index 0000000..09a6c48 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXRecoredListDetailModel.m @@ -0,0 +1,86 @@ +// +// YXRecoredListDetailModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/16. +// + +#import "YXRecoredListDetailModel.h" + +@implementation YXRecoredDetailConsessionModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"consession_id" :@"id"}; + return dic; +} + +@end +// +@implementation YXRecoredconMedicalRecordsListDO + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"dangan_id" :@"id"}; + return dic; +} + + +@end + + +@implementation YXRecoredDetailHealthModel + +//+ (NSDictionary *)modelContainerPropertyGenericClass +//{ +// +// return @{ +// @"childList":[QuestionOptionChildListModel class], +// +// }; +//} +// +//+ (NSDictionary *)modelCustomPropertyMapper +//{ +// NSDictionary * dic =@{@"option_id" :@"id"}; +// return dic; +//} + +@end + + +@implementation YXRecoredDetailIMListModel + + + +@end + + +@implementation YXRecoredListDetailModel + + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"imList":[YXRecoredDetailIMListModel class], + @"answer":[YXRecoredDetailHealthModel class], + }; + +} +@end + +@implementation YXReocrdconFamilyMembersDO + + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"family_id" :@"id"}; + return dic; +} + + +@end + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopReasonModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopReasonModel.h new file mode 100644 index 0000000..eb1f092 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopReasonModel.h @@ -0,0 +1,25 @@ +// +// YXStopReasonModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopReasonModel : NSObject + +@property (nonatomic, copy) NSString * value; + +@property (nonatomic, copy) NSString * label; + +@property (nonatomic, copy) NSString * title; + +@property (nonatomic, copy) NSString * text; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopReasonModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopReasonModel.m new file mode 100644 index 0000000..c3c785d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopReasonModel.m @@ -0,0 +1,12 @@ +// +// YXStopReasonModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/9. +// + +#import "YXStopReasonModel.h" + +@implementation YXStopReasonModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopServiceModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopServiceModel.h new file mode 100644 index 0000000..6247a36 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopServiceModel.h @@ -0,0 +1,53 @@ +// +// YXStopServiceModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXStopServiceListModel : NSObject + +@property (nonatomic, copy) NSString * record_id; + +@property (nonatomic, copy) NSString * notice; + +@property (nonatomic, assign) NSInteger delFlag; + + +@property (nonatomic, copy) NSString * createBy; + +@property (nonatomic, copy) NSString * startDay; + +@property (nonatomic, copy) NSString * endDay; + +@property (nonatomic, copy) NSString * stopReason; + +@property (nonatomic, copy) NSString * doctorId; + +@property (nonatomic, copy) NSString * createTime; + +@property (nonatomic, assign) NSInteger serviceStatus; + +@property (nonatomic, assign) NSInteger status; + +@end + +@interface YXStopServiceModel : NSObject + +@property (nonatomic, strong) NSArray * orders; + +@property (nonatomic, assign) NSInteger pages; + +@property (nonatomic, assign) NSInteger current; + +@property (nonatomic, assign) NSInteger total; + +@property (nonatomic, strong) NSArray * records; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopServiceModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopServiceModel.m new file mode 100644 index 0000000..887daba --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXStopServiceModel.m @@ -0,0 +1,33 @@ +// +// YXStopServiceModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/9. +// + +#import "YXStopServiceModel.h" + +@implementation YXStopServiceListModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"record_id" :@"id"}; + return dic; +} + + +@end + +@implementation YXStopServiceModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"records":[YXStopServiceListModel class], + }; + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXToolsModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXToolsModel.h new file mode 100644 index 0000000..0ae7652 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXToolsModel.h @@ -0,0 +1,21 @@ +// +// YXToolsModel.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXToolsModel : NSObject + +/** + * 标题 + */ +@property (nonatomic, copy) NSString *title; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXToolsModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXToolsModel.m new file mode 100644 index 0000000..3ad9500 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXToolsModel.m @@ -0,0 +1,13 @@ +// +// YXToolsModel.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/28. +// + +#import "YXToolsModel.h" + +@implementation YXToolsModel + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXWorkSettingModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXWorkSettingModel.h new file mode 100644 index 0000000..5ca3635 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXWorkSettingModel.h @@ -0,0 +1,50 @@ +// +// YXWorkSettingModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/7. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXWorkTimeModel : NSObject + +@property (nonatomic, copy) NSString * amNum; + +@property (nonatomic, copy) NSString * pmNum; + +@property (nonatomic, copy) NSString * week; + +@property (nonatomic, copy) NSString * checked; + +@property (nonatomic, copy) NSString * consultSwitchOn; + +@property (nonatomic, copy) NSString * itemType; + +@property (nonatomic, copy) NSString * tfDefault; + +@property (nonatomic, copy) NSString * tfJumpHoliday; + +@property (nonatomic, copy) NSString * type; + +@property (nonatomic, copy) NSString * timePeriod; + +@property (nonatomic, copy) NSString * work_id; + +@end + +@interface YXWorkSettingModel : NSObject + +@property (nonatomic, copy) NSString * tfDefault; + +@property (nonatomic, copy) NSString * audioStatus; + +@property (nonatomic, copy) NSString * tfJumpHoliday; + +@property (nonatomic, strong) NSArray * list; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXWorkSettingModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXWorkSettingModel.m new file mode 100644 index 0000000..d8df593 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXWorkSettingModel.m @@ -0,0 +1,35 @@ +// +// YXWorkSettingModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/7. +// + +#import "YXWorkSettingModel.h" + + +@implementation YXWorkTimeModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"work_id" :@"id"}; + return dic; +} + + +@end + +@implementation YXWorkSettingModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"list":[YXWorkTimeModel class], + }; + +} + + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXwithDrawDetailModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXwithDrawDetailModel.h new file mode 100644 index 0000000..7652421 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXwithDrawDetailModel.h @@ -0,0 +1,47 @@ +// +// withDrawDetailModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXwithDrawDetailModel : NSObject + +@property (nonatomic, copy) NSString * wraw_Id; +@property (nonatomic, copy) NSString * sessionId; +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * userName; +@property (nonatomic, copy) NSString * operateType;//操作类型1图文咨询2视频咨询3电话咨询4通讯费5提现 操作类型0收益1图文咨询2视频咨询3电话咨询4通讯费5提现 +@property (nonatomic, copy) NSString * operateId; +@property (nonatomic, copy) NSString * operateName; +@property (nonatomic, copy) NSString * incomeTime; +@property (nonatomic, copy) NSString * withdrawalName; +@property (nonatomic, copy) NSString * remarks; +@property (nonatomic, copy) NSString * withdraw; +@property (nonatomic, copy) NSString * paymentAccount; +@property (nonatomic, copy) NSString * paymentName; +@property (nonatomic, copy) NSString * paymentMoney; +@property (nonatomic, copy) NSString * realityMoney; +@property (nonatomic, copy) NSString * accountMoney; +@property (nonatomic, copy) NSString * paymentTime; +@property (nonatomic, copy) NSString * charDate; +@property (nonatomic, assign) NSInteger status;//状态(1-正常,2-冻结) +@property (nonatomic, assign) NSInteger 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 * income;//操作类型1图文咨询2视频咨询3电话咨询4通讯费5提现 操作类型0收益1图文咨询2视频咨询3电话咨询4通讯费5提现 +@property (nonatomic, copy) NSString * sumIncome; +@property (nonatomic, copy) NSString * sumPaymentMoney; +@property (nonatomic, copy) NSString * waterType; +@property (nonatomic, copy) NSString * operateTypeName; +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXwithDrawDetailModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXwithDrawDetailModel.m new file mode 100644 index 0000000..2bd1dad --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/YXwithDrawDetailModel.m @@ -0,0 +1,19 @@ +// +// withDrawDetailModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/18. +// + +#import "YXwithDrawDetailModel.h" + +@implementation YXwithDrawDetailModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"wraw_Id" :@"id"}; + return dic; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/withDrawDetailModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/withDrawDetailModel.h new file mode 100644 index 0000000..7652421 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/withDrawDetailModel.h @@ -0,0 +1,47 @@ +// +// withDrawDetailModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXwithDrawDetailModel : NSObject + +@property (nonatomic, copy) NSString * wraw_Id; +@property (nonatomic, copy) NSString * sessionId; +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * userName; +@property (nonatomic, copy) NSString * operateType;//操作类型1图文咨询2视频咨询3电话咨询4通讯费5提现 操作类型0收益1图文咨询2视频咨询3电话咨询4通讯费5提现 +@property (nonatomic, copy) NSString * operateId; +@property (nonatomic, copy) NSString * operateName; +@property (nonatomic, copy) NSString * incomeTime; +@property (nonatomic, copy) NSString * withdrawalName; +@property (nonatomic, copy) NSString * remarks; +@property (nonatomic, copy) NSString * withdraw; +@property (nonatomic, copy) NSString * paymentAccount; +@property (nonatomic, copy) NSString * paymentName; +@property (nonatomic, copy) NSString * paymentMoney; +@property (nonatomic, copy) NSString * realityMoney; +@property (nonatomic, copy) NSString * accountMoney; +@property (nonatomic, copy) NSString * paymentTime; +@property (nonatomic, copy) NSString * charDate; +@property (nonatomic, assign) NSInteger status;//状态(1-正常,2-冻结) +@property (nonatomic, assign) NSInteger 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 * income;//操作类型1图文咨询2视频咨询3电话咨询4通讯费5提现 操作类型0收益1图文咨询2视频咨询3电话咨询4通讯费5提现 +@property (nonatomic, copy) NSString * sumIncome; +@property (nonatomic, copy) NSString * sumPaymentMoney; +@property (nonatomic, copy) NSString * waterType; +@property (nonatomic, copy) NSString * operateTypeName; +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BasicHealthInfo(基本健康信息)/BasicHealthInfoView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BasicHealthInfo(基本健康信息)/BasicHealthInfoView.h new file mode 100644 index 0000000..f6ffb4e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BasicHealthInfo(基本健康信息)/BasicHealthInfoView.h @@ -0,0 +1,20 @@ +// +// BasicHealthInfoView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BasicHealthInfoView : UIView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, assign) CGFloat healthHeight; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BasicHealthInfo(基本健康信息)/BasicHealthInfoView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BasicHealthInfo(基本健康信息)/BasicHealthInfoView.m new file mode 100644 index 0000000..c29bde9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BasicHealthInfo(基本健康信息)/BasicHealthInfoView.m @@ -0,0 +1,135 @@ +// +// BasicHealthInfoView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "BasicHealthInfoView.h" +#import "YXRecoredListDetailModel.h" + +@interface BasicHealthInfoView () + +@property (nonatomic, strong) NSMutableArray * leftArray; + +@property (nonatomic, strong) NSMutableArray * rightArray; + +@property (nonatomic, strong) UILabel * lastLabel; + +@end + +@implementation BasicHealthInfoView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (NSMutableArray *)leftArray { + + if (!_leftArray) { + _leftArray = [[NSMutableArray alloc] init]; + } + return _leftArray; +} + +- (NSMutableArray *)rightArray { + + if (!_rightArray) { + + _rightArray = [[NSMutableArray alloc] init]; + } + return _rightArray; +} + + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + self.backgroundColor = KWhiteColor; + [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]; + [self.leftArray addObject: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]; + + [self.rightArray addObject:rightLabel]; + + } + + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + for (UILabel * leftLabel in self.leftArray) { + [leftLabel removeFromSuperview]; + } + for (UILabel * rightLabel in self.rightArray) { + [rightLabel removeFromSuperview]; + } + [self.leftArray removeAllObjects]; + [self.rightArray removeAllObjects]; + + for (int i = 0; i < _dataArray.count; i ++) { + + YXRecoredDetailHealthModel * model = _dataArray[i]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(20) + 14 + 30 * i, 100, 13)]; + leftLabel.text = model.answerKey; + leftLabel.font = MEDIUMFONT(13); + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.textColor = UIColorHex(#666666); + [self addSubview:leftLabel]; + + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftLabel.right, leftLabel.top, self.width - leftLabel.right, 13)]; + rightLabel.text = model.answerValue; + rightLabel.font = MEDIUMFONT(13); + rightLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:rightLabel]; + [self.leftArray addObject:leftLabel]; + [self.rightArray addObject:rightLabel]; + + if (i == _dataArray.count - 1) { + self.lastLabel = rightLabel; + } + } + self.healthHeight = self.lastLabel.bottom + kRealValue(20); + +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDetailTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDetailTableViewCell.h new file mode 100644 index 0000000..8b1b26f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDetailTableViewCell.h @@ -0,0 +1,21 @@ +// +// BillDetailTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BillDetailTableViewCell : UITableViewCell + +@property (nonatomic, copy) NSString * leftString; + +@property (nonatomic, copy) NSString * rightString; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDetailTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDetailTableViewCell.m new file mode 100644 index 0000000..12ec7a6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDetailTableViewCell.m @@ -0,0 +1,90 @@ +// +// BillDetailTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "BillDetailTableViewCell.h" + +@interface BillDetailTableViewCell () + +@property (nonatomic, strong) UILabel * leftLabel; + +@property (nonatomic, strong) UILabel * rightLabel; + +@end + +@implementation BillDetailTableViewCell + +- (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] init]; + self.leftLabel.textColor = UIColorHex(#666666); + self.leftLabel.font = BOLDSYSTEMFONT(14); + self.leftLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.leftLabel]; + + [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.mas_offset(kRealValue(30)); + make.height.mas_offset(13); + }]; + [self.leftLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.rightLabel = [[UILabel alloc] init]; + self.rightLabel.textColor = UIColorHex(#333333); + self.rightLabel.font = BOLDSYSTEMFONT(13); + self.rightLabel.numberOfLines = 0; + self.rightLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.rightLabel]; + + [self layoutIfNeeded]; + [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-18); + make.left.mas_equalTo(self.leftLabel.mas_right).offset(8); + make.top.mas_equalTo(self.leftLabel); + make.bottom.mas_offset(-5); + }]; + [self.rightLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + +} + +- (void)setLeftString:(NSString *)leftString { + _leftString = leftString; + + self.leftLabel.text = _leftString; + +} + +- (void)setRightString:(NSString *)rightString { + + _rightString = rightString; + + self.rightLabel.text = rightString; + +} + +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDtailTable.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDtailTable.h new file mode 100644 index 0000000..f93a57a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDtailTable.h @@ -0,0 +1,21 @@ +// +// BillDtailTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import +#import "YXwithDrawDetailModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface BillDtailTable : UITableView + +@property (nonatomic, strong) NSDictionary * dic; + +@property (nonatomic, strong) YXwithDrawDetailModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDtailTable.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDtailTable.m new file mode 100644 index 0000000..e390412 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillDtailTable.m @@ -0,0 +1,126 @@ +// +// BillDtailTable.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "BillDtailTable.h" +#import "BillDetailTableViewCell.h" + +@interface BillDtailTable () + +@end + +@implementation BillDtailTable + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + self.delegate = self; + self.dataSource = self; + self.backgroundColor = UIColor.whiteColor; + self.showsVerticalScrollIndicator = false; + self.showsHorizontalScrollIndicator = false; + self.separatorStyle = UITableViewCellSeparatorStyleNone; + self.estimatedRowHeight = 60; + self.rowHeight = UITableViewAutomaticDimension; + + + +} + +- (void)setModel:(YXwithDrawDetailModel *)model { + + _model = model; + [self reloadData]; + +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 9; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSArray * array; + + + BillDetailTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"BILLCELL"]; + + if (!cell) { + + cell = [[BillDetailTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BILLCELL"]; + } + if (self.model) { + array = @[@[@"流水号:",[NSString stringWithFormat:@"%@",self.model.wraw_Id] ],@[@"提现方:",self.model.withdrawalName],@[@"提现方式:",self.model.withdraw],@[@"收款账号:",self.model.paymentAccount],@[@"提现金额:",[NSString stringWithFormat:@"%@",self.model.paymentMoney]],@[@"实际到账金额:",[NSString stringWithFormat:@"%@",self.model.realityMoney]],@[@"提现说明:",self.model.remarks],@[@"账户金额:",[NSString stringWithFormat:@"%@",self.model.accountMoney]],@[@"提现时间",[NSString stringWithFormat:@"%@",self.model.paymentTime]]]; + cell.leftString= array[indexPath.row][0]; + cell.rightString= array[indexPath.row][1]; + } + + cell.backgroundColor = KWhiteColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + +- (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 { + + + + UIView * videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + + return videoView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + + +} + + +@end + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTable.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTable.h new file mode 100644 index 0000000..5b200f9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTable.h @@ -0,0 +1,22 @@ +// +// BillListTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookBillDetail)(NSString * billString); + +@interface BillListTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) lookBillDetail detailBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTable.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTable.m new file mode 100644 index 0000000..36e6aa7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTable.m @@ -0,0 +1,125 @@ +// +// BillListTable.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "BillListTable.h" +#import "BillListTableViewCell.h" + + +@interface BillListTable () + +@end + +@implementation BillListTable + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + 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 +{ + + BillListTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"BILLCELL"]; + + if (!cell) { + + cell = [[BillListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BILLCELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.layer.cornerRadius = 10.0; + cell.layer.masksToBounds = true; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.model = self.dataArray[indexPath.section]; + return cell; + +} + +- (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 * videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(10))]; + + return videoView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + YXBillListDetailModel * model = self.dataArray[indexPath.section]; + + if (self.detailBlock) { + + self.detailBlock(model.bill_id); + } + +} + + +@end + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTableViewCell.h new file mode 100644 index 0000000..88a0dae --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTableViewCell.h @@ -0,0 +1,18 @@ +// +// BillListTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import +#import "YXBillListModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface BillListTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXBillListDetailModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTableViewCell.m new file mode 100644 index 0000000..ab3b6b9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/BillListTableViewCell.m @@ -0,0 +1,115 @@ +// +// BillListTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/5. +// + +#import "BillListTableViewCell.h" + +@interface BillListTableViewCell () + +@property (nonatomic, strong) UILabel * typeLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * moneyLabel; + +@property (nonatomic, strong) UILabel * billLabel; + +@end + +@implementation BillListTableViewCell + +- (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.typeLabel = [[UILabel alloc] init]; + self.typeLabel.text = @""; + self.typeLabel.textColor = CFontColor1; + self.typeLabel.font = BOLDSYSTEMFONT(14); + self.typeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.typeLabel]; + + [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(18); + make.top.mas_offset(15); + make.height.mas_offset(14); + make.width.mas_offset(90); + }]; + + self.moneyLabel = [[UILabel alloc] init]; + self.moneyLabel.text = @""; + self.moneyLabel.textColor = UIColorHex(#21BEBD); + self.moneyLabel.font = BOLDSYSTEMFONT(16); + self.moneyLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.moneyLabel]; + + [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-18); + make.top.mas_offset(19); + make.height.mas_offset(13); + make.width.mas_offset(200); + }]; + + self.timeLabel = [[UILabel alloc] init]; + + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.font = BOLDSYSTEMFONT(12); + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(18); + make.top.mas_equalTo(self.typeLabel.mas_bottom).offset(10); + make.height.mas_offset(13); + make.bottom.mas_offset(-16); + }]; + [self.timeLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.billLabel = [[UILabel alloc] init]; + + self.billLabel.textColor = UIColorHex(#333333); + self.billLabel.font = MEDIUMFONT(12); + self.billLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.billLabel]; + + [self.billLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-18); + make.top.mas_equalTo(self.typeLabel.mas_bottom).offset(10); + make.height.mas_offset(13); + make.bottom.mas_offset(-16); + }]; + [self.billLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; +} + +- (void)setModel:(YXBillListDetailModel *)model { + + _model = model; + self.typeLabel.text = _model.operateType_dictText; + self.moneyLabel.text = [NSString stringWithFormat:@"%.2f",[_model.income floatValue]]; + self.timeLabel.text = _model.createTime; + self.billLabel.text = [NSString stringWithFormat:@"余额:%.2f",[_model.accountMoney floatValue]]; +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.h new file mode 100644 index 0000000..af26fcf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/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 * createTime; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.m new file mode 100644 index 0000000..1541542 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.m @@ -0,0 +1,66 @@ +// +// 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)setCreateTime:(NSString *)createTime { + _createTime = createTime; + self.timeLabel.text = [NSString stringWithFormat:@"生成时间:%@",_createTime]; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailUserInfoView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailUserInfoView.h new file mode 100644 index 0000000..642bf23 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailUserInfoView.h @@ -0,0 +1,19 @@ +// +// DetailUserInfoView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import +#import "YXRecoredListDetailModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface DetailUserInfoView : UIView + +@property (nonatomic, strong) YXReocrdconFamilyMembersDO * userInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailUserInfoView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailUserInfoView.m new file mode 100644 index 0000000..973ac5a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailUserInfoView.m @@ -0,0 +1,114 @@ +// +// 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 { + + + //一行的列数 + NSInteger cols = 3; + //label大小 + CGFloat labW = (self.width - kRealValue(46) ) / 3 ; + CGFloat labH = 13; + CGFloat pading = 0; + //每一行的间距 + CGFloat rowMargin = kRealValue(20); + for (int i = 0; i < 5; 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(18) + shopX,kRealValue(23) + shopY, labW, labH); + nameLabel.textAlignment = NSTextAlignmentLeft; + nameLabel.text = @""; + 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)setUserInfo:(YXReocrdconFamilyMembersDO *)userInfo { + + _userInfo = userInfo; + + UILabel * nameLabel = [self viewWithTag:100]; + + nameLabel.text = [NSString stringWithFormat:@"姓名:%@",_userInfo.name]; + + NSString * sexString = [_userInfo.gender integerValue] == 1 ? @"女":@"男"; + + UILabel * sexLabel = [self viewWithTag:101]; + + sexLabel.text = [NSString stringWithFormat:@"性别:%@",sexString]; + + UILabel * ageLabel = [self viewWithTag:102]; + + ageLabel.text = [NSString stringWithFormat:@"年龄:%@",_userInfo.age]; + + + UILabel * shengaoLabel = [self viewWithTag:103]; + + NSString * heightString ; + if (ValidStr(_userInfo.height)) { + heightString = @"--"; + } + else + { + heightString = _userInfo.height; + } + shengaoLabel.text = [NSString stringWithFormat:@"身高:%@cm",heightString]; + + NSString * weightString ; + if (ValidStr(_userInfo.height)) { + weightString = @"--"; + } + else + { + weightString = _userInfo.weight; + } + UILabel * weightLabel = [self viewWithTag:104]; + + weightLabel.text = [NSString stringWithFormat:@"体重:%@kg",weightString]; + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionAppointmentTimeView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionAppointmentTimeView.h new file mode 100644 index 0000000..2f135db --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionAppointmentTimeView.h @@ -0,0 +1,33 @@ +// +// QuestionAppointmentTimeView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import +#import "YXRecoredListDetailModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionAppointmentTimeView : UIView + +//@property (nonatomic, assign) BOOL ishide; +// +//@property (nonatomic, strong) YXRecoredListDetailModel * model; +// +//@property (nonatomic, strong) NSArray * imList; +// +//@property (nonatomic, assign) CGFloat timeHeight; +//@property (nonatomic, strong) DoctorReportDoctorInfoModel * doctorModel; +//@property (nonatomic, strong) DoctorReportConSessionModel * sessionModel; +@property (nonatomic, strong) YXRecoredListDetailModel * model; + +@property (nonatomic, assign) CGFloat doctorinfoHeight; + +@property (nonatomic, assign) bool isJujue; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionAppointmentTimeView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionAppointmentTimeView.m new file mode 100644 index 0000000..c30adc5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionAppointmentTimeView.m @@ -0,0 +1,401 @@ +// +// QuestionAppointmentTimeView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/27. +// + +#import "QuestionAppointmentTimeView.h" +#import "NSDate+BRPickerView.h" +@interface QuestionAppointmentTimeView () + +@property (nonatomic, strong) NSMutableArray * labsArray; + +@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 * cancelTimeLabel ; //取消时间 +@property (nonatomic, strong) UILabel * recordStarLabel ; //取消时间 + +@end + +@implementation QuestionAppointmentTimeView + +/* +// 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 { + + + UIView * lineV = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, self.width - kRealValue(30), 0.1)]; + lineV.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:lineV]; + + UILabel * leftTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15),lineV.bottom + kRealValue(20), 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(20), 300, 14)]; + self.timeLabel.text = @""; + self.timeLabel.font = [UIFont systemFontOfSize:13]; + self.timeLabel.textColor = CFontColor1; + self.timeLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:self.timeLabel]; + + + //从这里开始不一样 + + UIView * starTimeView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.timeLabel.bottom + kRealValue(20), self.width- kRealValue(30) , 30)]; + self.starTimeView = starTimeView; + starTimeView.hidden = YES; + [self addSubview:starTimeView]; + + UILabel * starLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(14), 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 , kRealValue(14), 300, 14)]; + self.starTimeLabel.text = @""; + self.starTimeLabel.font = [UIFont systemFontOfSize: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.timeLabel.bottom + kRealValue(20), self.width - kRealValue(30), 30)]; + self.jujueView = jujueView; + jujueView.hidden = true; + [self addSubview:jujueView]; + + UILabel * jujueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 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 - 100 -15 , 15)]; + jujueyuanyinLab.text = @""; + jujueyuanyinLab.font = [UIFont systemFontOfSize: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(20), 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, jujueLabel.bottom + kRealValue(20), jujueView.width - 15 - jujueLabel.width, 22)]; + self.jujueBeizhuLab.text = @""; + self.jujueBeizhuLab.font = [UIFont systemFontOfSize: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.timeLabel.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,kRealValue(14), 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, kRealValue(14), 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]; + + + UILabel * recordStarLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(14), 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:(YXRecoredListDetailModel *)model { + _model = model; + + + YXRecoredDetailConsessionModel * sessionModel = [YXRecoredDetailConsessionModel modelWithDictionary:_model.conSession]; + + + //状态数据 + 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]; + + + + //预约状态 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 AndLeftisTrue:false withStr:self.jujueyuanyinLab.text withFont:[UIFont systemFontOfSize:14] withWidth: self.jujueyuanyinLab.width withLineSpacing:2]; + + CGFloat beizhulabH = [HQCommonUtils getSpaceLabelHeight: self.jujueBeizhuLab AndLeftisTrue:false withStr:self.jujueBeizhuLab.text withFont:[UIFont systemFontOfSize:14] withWidth: self.jujueyuanyinLab.width withLineSpacing:2]; + + //布局 + self.questionRecordView.height = 0; + self.jujueView.top = self.timeLabel.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.questionRecordView.top = self.jujueView.bottom; + 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.timeLabel.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.timeLabel.bottom + kRealValue(20); + } + if ( [sessionModel.contentStatus integerValue] == 7) { //取消 + + self.jujueView.hidden = YES; + self.starTimeView.hidden = YES; + self.cancelQuestionView.hidden = false; + self.questionRecordView.hidden = YES; + self.jujueyuanyinLab.text = sessionModel.reasonType; + CGFloat labH = [HQCommonUtils getSpaceLabelHeight: self.jujueyuanyinLab AndLeftisTrue:true 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.timeLabel.bottom + kRealValue(20); + } + 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; + self.questionRecordView.hidden = false; + 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 ++) { + + YXRecoredDetailIMListModel * imModel = recordArray[i]; + + + UILabel * recordLabel = [[UILabel alloc] initWithFrame:CGRectMake(14, 45 + 25 * i, self.questionRecordView.width -14, 20)]; + recordLabel.textAlignment = NSTextAlignmentLeft; + recordLabel.font = SYSTEMFONT(15); + 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 = kRealValue(14) + height; + } + [self.questionRecordView addSubview:recordLabel]; + [self.labsArray addObject:recordLabel]; + } + + + self.doctorinfoHeight = self.questionRecordView.bottom + kRealValue(10); + } + + +} + + +-(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; +} + + +///将时间戳转为日期时间 + +/// @param timestamp 时间戳 + +/// @param dateFormat 日期样式 YYYY-MM-dd HH:mm:ss + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionFileDataView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionFileDataView.h new file mode 100644 index 0000000..6149610 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionFileDataView.h @@ -0,0 +1,25 @@ +// +// QuestionFileDataView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import +#import "YXRecoredListDetailModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^lookDetailBlock)(); + +@interface QuestionFileDataView : UIView + +@property (nonatomic, assign) CGFloat fileHeight; + +@property (nonatomic, copy) lookDetailBlock fileBlock; + +@property (nonatomic, strong) YXRecoredconMedicalRecordsListDO * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionFileDataView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionFileDataView.m new file mode 100644 index 0000000..50cdd10 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionFileDataView.m @@ -0,0 +1,103 @@ +// +// QuestionFileDataView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "QuestionFileDataView.h" + +@interface QuestionFileDataView () + +@property (nonatomic, strong) UILabel * timeLabel; +@property (nonatomic, strong) UILabel * fileLabel; +@end + +@implementation QuestionFileDataView + +/* +// 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 * timelineV = [[UIView alloc] initWithFrame:CGRectMake(0, 1, self.width , 1)]; + timelineV.backgroundColor = UIColorHex(#E0E0E0); + [self addSubview:timelineV]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(15), 100, 14)]; + titleLabel.text = @"档案"; + titleLabel.font = BOLDSYSTEMFONT(13); + titleLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:titleLabel]; + + UILabel * timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(15), self.width - kRealValue(33), 14)]; + self.timeLabel = timeLabel; + timeLabel.text = @"生成时间:2020年05月05日 周四 上午"; + timeLabel.font = MEDIUMFONT(11); + timeLabel.textColor = UIColorHex(#999999); + timeLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:timeLabel]; + + UILabel * fileLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18),titleLabel.bottom+ kRealValue(25), self.width - kRealValue(36), 34)]; + fileLabel.text = @""; + fileLabel.numberOfLines = 2; + fileLabel.font = MEDIUMFONT(13); + fileLabel.textColor = UIColorHex(#333333); + fileLabel.textAlignment = NSTextAlignmentLeft; + self.fileLabel = fileLabel; + [self addSubview:fileLabel]; + +// CGFloat fileHeight = [HQCommonUtils getSpaceLabelHeight:fileLabel withStr:fileLabel.text withFont:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] withWidth:fileLabel.width withLineSpacing:5]; +// fileLabel.height = fileHeight; + + YYLabel * detailLabel = [[YYLabel alloc] initWithFrame:CGRectMake(self.width - 100 - kRealValue(18), fileLabel.bottom + kRealValue(11), 100, 12)]; + detailLabel.text = @"查看详情 >"; + detailLabel.textColor = UIColorHex(#3390FF); + detailLabel.font = MEDIUMFONT(11); + detailLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:detailLabel]; + + [detailLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [self lookMDetail]; + }]; + + UIView * lineV = [[UIView alloc] initWithFrame:CGRectMake(0, detailLabel.bottom, kScreenWidth - kRealValue(30), 14)]; + lineV.backgroundColor = KWhiteColor; + [self addSubview:lineV]; + + self.fileHeight = lineV.bottom; +} + +- (void)lookMDetail { + + if (self.fileBlock) { + + self.fileBlock(); + } + +} + +- (void)setModel:(YXRecoredconMedicalRecordsListDO *)model { + + _model = model; + + self.fileLabel.text = [NSString stringWithFormat:@"问题描述:%@",_model.medicalDescribe] ; + self.timeLabel.text = [NSString stringWithFormat:@"更新时间:%@",_model.createTime]; + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionHealthInfoView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionHealthInfoView.h new file mode 100644 index 0000000..12d8d9c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionHealthInfoView.h @@ -0,0 +1,19 @@ +// +// QuestionHealthInfoView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionHealthInfoView : UIView + +@property (nonatomic, strong) NSArray * questionArray; + +@property (nonatomic, assign) CGFloat healthHeight; +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionHealthInfoView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionHealthInfoView.m new file mode 100644 index 0000000..c8933fd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionHealthInfoView.m @@ -0,0 +1,140 @@ +// +// QuestionHealthInfoView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "QuestionHealthInfoView.h" +#import "YXRecoredListDetailModel.h" +@interface QuestionHealthInfoView () + +@property (nonatomic, strong) NSMutableArray * leftArray; + +@property (nonatomic, strong) NSMutableArray * rightArray; + +@property (nonatomic, strong) UILabel * lastLabel; + +@end + +@implementation QuestionHealthInfoView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +- (NSMutableArray *)leftArray { + + if (!_leftArray) { + _leftArray = [[NSMutableArray alloc] init]; + } + return _leftArray; +} + +- (NSMutableArray *)rightArray { + + if (!_rightArray) { + + _rightArray = [[NSMutableArray alloc] init]; + } + return _rightArray; +} + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + [self createUI]; + + } + + return self; +} + + +- (void)createUI { + + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(22), 100, 14)]; + titleLabel.text = @"基本健康信息"; + titleLabel.font = BOLDSYSTEMFONT(13); + titleLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:titleLabel]; + + NSArray * leftArray = @[@"饮食习惯:",@"烟酒习惯:",@"既往史:",@"家族史:",@"过敏史:",@"用药史:"]; + NSArray * rightArray = @[@"",@"",@"",@"",@"",@""]; + + for (int i = 0; i < leftArray.count; i ++) { + + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), titleLabel.bottom + kRealValue(20) + 30 * i, 100, 13)]; + leftLabel.text =leftArray[i]; + leftLabel.font = MEDIUMFONT(13); + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.textColor = UIColorHex(#666666); + CGFloat w = [HQCommonUtils getLengthFromText:titleLabel.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; + [self addSubview:rightLabel]; + + [self.leftArray addObject:leftLabel]; + [self.rightArray addObject:rightLabel]; + + } + + +} + +- (void)setQuestionArray:(NSArray *)questionArray { + _questionArray = questionArray; + + + for (UILabel * leftLabel in self.leftArray) { + [leftLabel removeFromSuperview]; + } + for (UILabel * rightLabel in self.rightArray) { + [rightLabel removeFromSuperview]; + } + [self.leftArray removeAllObjects]; + [self.rightArray removeAllObjects]; + + for (int i = 0; i < _questionArray.count; i ++) { + +// NSDictionary * dic = _questionArray[i]; + YXRecoredDetailHealthModel * model = _questionArray[i]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(42) + 14 + 30 * i, 100, 13)]; + leftLabel.text = [NSString stringWithFormat:@"%@:",model.answerKey] ; + leftLabel.font = MEDIUMFONT(13); + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.textColor = UIColorHex(#666666); + CGFloat w = [HQCommonUtils getLengthFromText:leftLabel.text andFontSize:13]; + [self addSubview:leftLabel]; + + + UILabel * rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftLabel.right + kRealValue(25), leftLabel.top, self.width - leftLabel.right - kRealValue(25), 13)]; + rightLabel.text = model.answerValue; + rightLabel.font = MEDIUMFONT(13); + rightLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:rightLabel]; + + [self.leftArray addObject:leftLabel]; + [self.rightArray addObject:rightLabel]; + + if (i == _questionArray.count - 1) { + self.lastLabel = rightLabel; + } + } + self.healthHeight = self.lastLabel.bottom + kRealValue(30); + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionReportView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionReportView.h new file mode 100644 index 0000000..417ca28 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionReportView.h @@ -0,0 +1,22 @@ +// +// QuestionReportView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +@interface QuestionReportView : UIView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, assign) CGFloat reportHeight; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionReportView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionReportView.m new file mode 100644 index 0000000..860df35 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/QuestionReportView.m @@ -0,0 +1,91 @@ +// +// QuestionReportView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "QuestionReportView.h" + +@interface QuestionReportView () + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * hospatilLabel; + + +@end + +@implementation QuestionReportView + +/* +// 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 * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(24), 100, 14)]; + titleLabel.text = @"体检报告"; + titleLabel.font = BOLDSYSTEMFONT(13); + titleLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:titleLabel]; + + UILabel * timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), kRealValue(25), self.width - kRealValue(33), 14)]; + self.timeLabel = timeLabel; + timeLabel.text = @"生成时间:--"; + timeLabel.font = MEDIUMFONT(10); + timeLabel.textColor = UIColorHex(#999999); + timeLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:timeLabel]; + + self.hospatilLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(18), titleLabel.bottom + kRealValue(17), self.width - kRealValue(36), 13)]; + self.hospatilLabel.text = @""; + self.hospatilLabel.font = BOLDSYSTEMFONT(13); + self.hospatilLabel.textAlignment = NSTextAlignmentLeft; + [self addSubview:self.hospatilLabel]; +// + YYLabel * detailLabel = [[YYLabel alloc] initWithFrame:CGRectMake(self.width - 100 - kRealValue(18), titleLabel.bottom + kRealValue(17), 100, 12)]; + detailLabel.text = @"查看详情 >"; + detailLabel.textColor = UIColorHex(#3390FF); + detailLabel.font = MEDIUMFONT(11); + detailLabel.textAlignment = NSTextAlignmentRight; + [self addSubview:detailLabel]; + + [detailLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { +// [self lookMDetail]; + }]; + +} + +//- (void)lookMDetail{ +// +// if (self.baogaoBlock) { +// self.baogaoBlock(self.bodyModel); +// } +//} +// +// +//- (void)setBodyModel:(YXPhyscialReportListModel *)bodyModel { +// +// _bodyModel = bodyModel; +// +// self.timeLabel.text = [NSString stringWithFormat:@"上传时间:%@年",_bodyModel.medicalYear]; +// self.hospatilLabel.text = [NSString stringWithFormat:@"%@ %@",_bodyModel.medicalYear,_bodyModel.hospitalName]; +// self.reportHeight = self.hospatilLabel.bottom + kRealValue(20); +//} +// + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/FileDataDetailView(档案详情)/FileDataDeatilCenterView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/FileDataDetailView(档案详情)/FileDataDeatilCenterView.h new file mode 100644 index 0000000..ef830bc --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/FileDataDetailView(档案详情)/FileDataDeatilCenterView.h @@ -0,0 +1,21 @@ +// +// FileDataDeatilCenterView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import +#import "YXRecoredListDetailModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FileDataDeatilCenterView : UIView + +@property (nonatomic, assign) CGFloat questionH; + +@property (nonatomic, strong) YXRecoredconMedicalRecordsListDO * medicalModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/FileDataDetailView(档案详情)/FileDataDeatilCenterView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/FileDataDetailView(档案详情)/FileDataDeatilCenterView.m new file mode 100644 index 0000000..b1fa8d7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/FileDataDetailView(档案详情)/FileDataDeatilCenterView.m @@ -0,0 +1,318 @@ +// +// FileDataDeatilCenterView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "FileDataDeatilCenterView.h" +#import "XLPhotoBrowser.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) UILabel * thirdQuestionTitleLabel; + +@property (nonatomic, strong) UIView * hospatilView; + +@property (nonatomic, strong) UILabel * roomLabel; + +@property (nonatomic, strong) UILabel * disNameLabel; + +@property (nonatomic, strong) UIView * pictureView; + +@property (nonatomic, strong) UIView * twoView; + +@property (nonatomic, strong) UIView * thirdView; + +@property (nonatomic, strong) UIView * fourView; + +@property (nonatomic, strong) UILabel * numberLabel; + +@property (nonatomic, strong) UIScrollView * pictScrollView; + +@property (nonatomic, strong) NSMutableArray * pictureArray; + +@end + + +@implementation FileDataDeatilCenterView + +- (NSMutableArray *)pictureArray { + + if (!_pictureArray) { + _pictureArray = [[NSMutableArray alloc] init]; + } + return _pictureArray; +} + +- (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(18), 0, self.width - kRealValue(48), 35)]; + self.firstAnswerLabel.text = @"--"; + 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; + self.twoView = twoView; + twoView.layer.masksToBounds = true; + [self addSubview:twoView]; + + self.secendAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 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 AndLeftisTrue:true withStr:self.secendAnswerLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth:twoView.width - kRealValue(50) withLineSpacing:5]; + [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 = @"-/8"; + numberLabel.font = MEDIUMFONT(11); + numberLabel.textAlignment = NSTextAlignmentRight; + numberLabel.textColor = UIColorHex(#333333); + self.numberLabel = numberLabel; + [self.pictureView addSubview:numberLabel]; + + UIScrollView * pictScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(pictureLabel.left, pictureLabel.bottom, self.width - kRealValue(20), 62)]; + self.pictScrollView = pictScrollView; + [self.pictureView addSubview:pictScrollView]; + + //第三个问题 + self.thirdQuestionTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(20),self.pictureView.bottom + kRealValue(10), self.width - kRealValue(30), 14)]; + self.thirdQuestionTitleLabel.text = @"3.咨询人是否去医院就诊过?"; + self.thirdQuestionTitleLabel.font = BOLDSYSTEMFONT(14); + self.thirdQuestionTitleLabel.textAlignment = NSTextAlignmentLeft; + self.thirdQuestionTitleLabel.textColor = UIColorHex(#333333); + [self addSubview:self.thirdQuestionTitleLabel]; + + UIView * thirdView = [[UIView alloc] initWithFrame:CGRectMake(0, self.thirdQuestionTitleLabel.bottom + kRealValue(15), self.width, 35)]; + thirdView.backgroundColor = UIColorHex(#EFEFEF); + self.thirdView = thirdView; + [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(18), 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(16), kRealValue(12), self.hospatilView.width - kRealValue(20), 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(16), self.roomLabel.bottom + kRealValue(17) , self.hospatilView.width - kRealValue(20), 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.fourView = fourView; + [self addSubview:fourView]; + + self.fourthAnswerLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), 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.fourthAnswerLabel AndLeftisTrue:true withStr:self.fourthAnswerLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth:twoView.width - kRealValue(50) withLineSpacing:5]; + [fourView addSubview:self.fourthAnswerLabel]; + + self.questionH = fourView.bottom + kRealValue(20); +} + + +- (void)setMedicalModel:(YXRecoredconMedicalRecordsListDO *)medicalModel { + + _medicalModel = medicalModel; + [self.pictureArray removeAllObjects]; + self.firstAnswerLabel.text = _medicalModel.haveTimeValue; + self.secendAnswerLabel.text = _medicalModel.medicalDescribe; + self.secendAnswerLabel.height = [HQCommonUtils getSpaceLabelHeight:self.secendAnswerLabel AndLeftisTrue:true withStr:self.secendAnswerLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth: self.width - kRealValue(20) - kRealValue(50) withLineSpacing:5]; + self.twoView.height = self.secendAnswerLabel.bottom + kRealValue(25); + if (!ValidStr(_medicalModel.image)) { + NSArray * array = [_medicalModel.image componentsSeparatedByString:@","]; + self.numberLabel.text = [NSString stringWithFormat:@"%d/9",array.count]; + for (int i = 0 ; i < array.count; i ++) { + + self.pictureView.top = self.twoView.bottom + kRealValue(15); + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,array[i]]; + + NSString * str1 = @"\\"; + + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [self.pictureArray addObject:encodedString3]; + + UIImageView * picView = [[UIImageView alloc] initWithFrame:CGRectMake(66 * i, 0 , 60, 60)]; + picView.backgroundColor = [UIColor grayColor]; + picView.layer.cornerRadius = 5.0; + picView.layer.masksToBounds = true; + picView.userInteractionEnabled = true; + [picView sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:PLACEHOLD_IMG]; + + UIButton * imgbtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, picView.width, picView.height)]; + [imgbtn addTarget:self action:@selector(lookPicture:) forControlEvents:UIControlEventTouchUpInside]; + imgbtn.tag = 100 + i; + [picView addSubview:imgbtn]; + [self.pictScrollView addSubview:picView]; + + + } + + }else + { + self.pictureView.hidden = YES; + self.thirdQuestionTitleLabel.top = self.twoView.bottom + kRealValue(10); + self.thirdView.top = self.thirdQuestionTitleLabel.bottom + kRealValue(15); + } + + self.thirdQuestionLabel.text = _medicalModel.tfLookValue; + + if ([_medicalModel.tfLook integerValue] == 0) { + self.hospatilView.hidden = YES; + self.fourthQuestionLabel.top = self.thirdView.bottom + kRealValue(16); + self.fourView.top = self.fourthQuestionLabel.bottom + kRealValue(15); + + } + if ([_medicalModel.tfLook integerValue] == 1) { + self.hospatilView.hidden = false; + self.roomLabel.text = [NSString stringWithFormat:@"就诊医院及科室:%@",_medicalModel.lookOffice] ; + self.disNameLabel.text = [NSString stringWithFormat:@"诊断结果:%@",_medicalModel.lookMedicalName]; + self.fourthQuestionLabel.top = self.hospatilView.bottom + kRealValue(16); + self.fourView.top = self.fourthQuestionLabel.bottom + kRealValue(15); + + } + + self.fourthAnswerLabel.text = _medicalModel.desire; + + self.fourthAnswerLabel.height = [HQCommonUtils getSpaceLabelHeight:self.fourthAnswerLabel AndLeftisTrue:true withStr:self.fourthAnswerLabel.text withFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium] withWidth: self.width - kRealValue(20) - kRealValue(50) withLineSpacing:5]; + self.fourView.height = self.fourthAnswerLabel.bottom + kRealValue(25); + self.questionH = self.fourView.bottom + kRealValue(20); + + +} + +- (void)lookPicture:(UIButton *)indexBtn { + + XLPhotoBrowser *browser = [XLPhotoBrowser showPhotoBrowserWithImages:self.pictureArray currentImageIndex:indexBtn.tag - 100]; + + browser.browserStyle = XLPhotoBrowserStyleSimple; // 微博样式 + + // 自定义pageControl的一些属性 + browser.pageDotColor = [UIColor purpleColor]; ///< 此属性针对动画样式的pagecontrol无效 + browser.currentPageDotColor = [UIColor greenColor]; + browser.pageControlStyle = XLPhotoBrowserPageControlStyleClassic;///< 修改底部pagecontrol的样式为系统样式,默认是弹性动画的样式 + + +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HQSearchView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HQSearchView.h new file mode 100644 index 0000000..1ee5115 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HQSearchView.h @@ -0,0 +1,24 @@ +// +// HQSearchView.h +// EscortProject +// +// Created by 仁康信息 on 2023/4/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^searchOnclick)(NSString * fieldtext); + +@interface HQSearchView : UIView + +@property (nonatomic, strong) NSString * searchPlacehold; + +@property (nonatomic, strong) UITextField * searchField; + +@property (nonatomic, copy) searchOnclick searchBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HQSearchView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HQSearchView.m new file mode 100644 index 0000000..8950e84 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HQSearchView.m @@ -0,0 +1,97 @@ +// +// 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.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; +} + +- (void)searchAction { + + if (self.searchBlock) { + + self.searchBlock(self.searchField.text); + } +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTable.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTable.h new file mode 100644 index 0000000..ee33ee4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTable.h @@ -0,0 +1,18 @@ +// +// HistoryRecordTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HistoryRecordTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTable.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTable.m new file mode 100644 index 0000000..6a05e6d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTable.m @@ -0,0 +1,118 @@ +// +// HistoryRecordTable.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "HistoryRecordTable.h" +#import "HistoryRecordTableViewCell.h" + +@interface HistoryRecordTable () + +@end + +@implementation HistoryRecordTable + + +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { + + if (self = [super initWithFrame:frame style:style]) { + + [self createUI]; + } + + return self; +} + +- (void)createUI { + + 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 10; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 1; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + HistoryRecordTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"VIDEOCELL"]; + + if (!cell) { + + cell = [[HistoryRecordTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"VIDEOCELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.layer.cornerRadius = 10.0; + + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(12); +} + +- (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 * videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(12))]; + + return videoView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + + +@end + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTableViewCell.h new file mode 100644 index 0000000..3c043bc --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTableViewCell.h @@ -0,0 +1,16 @@ +// +// HistoryRecordTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HistoryRecordTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTableViewCell.m new file mode 100644 index 0000000..86e893d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HistoryRecordView(历史记录)/HistoryRecordTableViewCell.m @@ -0,0 +1,153 @@ +// +// HistoryRecordTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "HistoryRecordTableViewCell.h" + + +@interface HistoryRecordTableViewCell () + + +@property (nonatomic, strong) UILabel * typeLabel; +@property (nonatomic, strong) UILabel * statusLabel; +@property (nonatomic, strong) UILabel * nameLabel; +@property (nonatomic, strong) UILabel * ageLabel; +@property (nonatomic, strong) UILabel * timeLabel; +@property (nonatomic, strong) UILabel * cardLabel; +@property (nonatomic, strong) UILabel * canisLabel; + +@end + + +@implementation HistoryRecordTableViewCell + +- (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.typeLabel = [[UILabel alloc] init]; + self.typeLabel.text = @" 视频咨询 "; + self.typeLabel.layer.cornerRadius = 5.0; + self.typeLabel.layer.masksToBounds = true; + self.typeLabel.layer.borderColor = UIColorHex(#21BEBD).CGColor; + self.typeLabel.layer.borderWidth = 1.0f; + self.typeLabel.textColor = UIColorHex(#21BEBD); + self.typeLabel.font = SYSTEMFONT(11); + [self.contentView addSubview:self.typeLabel]; + + [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(10); + make.top.mas_offset(12); + make.height.mas_offset(21); + }]; + [self.typeLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.text = @"张三"; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = BOLDSYSTEMFONT(14); + [self.contentView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.typeLabel.mas_right).offset(5); + make.top.mas_offset(16); + make.height.mas_offset(14); + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.ageLabel = [[UILabel alloc] init]; + self.ageLabel.text = @"(男/38岁)"; + self.ageLabel.textColor = CFontColor2; + self.ageLabel.font = BOLDSYSTEMFONT(14); + [self.contentView addSubview:self.ageLabel]; + + [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel.mas_right); + make.top.mas_offset(16); + make.height.mas_offset(14); + }]; + [self.ageLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.text = @"2023-01-05 14:23:56"; + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.font = BOLDSYSTEMFONT(14); + self.timeLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-15); + make.top.mas_offset(12); + make.height.mas_offset(11); + }]; + [self.timeLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.cardLabel = [[UILabel alloc] init]; + self.cardLabel.text = @"610456198905167894"; + self.cardLabel.textColor = UIColorHex(#999999); + self.cardLabel.font = MEDIUMFONT(13); + [self.contentView addSubview:self.cardLabel]; + + [self.cardLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@15); + make.top.mas_equalTo(self.typeLabel.mas_bottom).offset(12); + make.height.mas_offset(11); + }]; + [self.cardLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.statusLabel = [[UILabel alloc] init]; + self.statusLabel.text = @"已完成"; + self.statusLabel.textColor = UIColorHex(#16C716); + self.statusLabel.font = BOLDSYSTEMFONT(14); + self.statusLabel.textAlignment = NSTextAlignmentRight; + [self.contentView addSubview:self.statusLabel]; + + [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-15); + make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(24); + make.height.mas_offset(14); + make.width.mas_offset(90); + }]; + + self.canisLabel = [[UILabel alloc] init]; + self.canisLabel.text = @"症状:高血压、糖尿病 肾结石"; + self.canisLabel.textColor = CFontColor1; + self.canisLabel.font = MEDIUMFONT(14); + self.canisLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.canisLabel]; + + [self.canisLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@14); + make.top.mas_equalTo(self.cardLabel.mas_bottom).offset(10); + make.height.mas_offset (18); + make.bottom.mas_offset(-18); + make.right.mas_offset(-15); + + }]; + + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedTableViewCell.h new file mode 100644 index 0000000..00ec822 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedTableViewCell.h @@ -0,0 +1,19 @@ +// +// HospitalSelectedTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/19. +// + +#import +#import "YXHospitalModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HospitalSelectedTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXHospitalModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedTableViewCell.m new file mode 100644 index 0000000..9d80ca7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedTableViewCell.m @@ -0,0 +1,97 @@ +// +// HospitalSelectedTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/19. +// + +#import "HospitalSelectedTableViewCell.h" + +@interface HospitalSelectedTableViewCell ( ) + +@property (nonatomic, strong) UIImageView * hospitalImage; + +@property (nonatomic, strong) UILabel * hospitalName; + +@property (nonatomic, strong) UIButton * sureButton; + +@end + +@implementation HospitalSelectedTableViewCell + +- (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.hospitalImage = [[UIImageView alloc] init]; + self.hospitalImage.backgroundColor = [UIColor orangeColor]; + [self.contentView addSubview:self.hospitalImage]; + + self.hospitalName = [[UILabel alloc] init]; + self.hospitalName.textAlignment = NSTextAlignmentLeft; + self.hospitalName.font = SYSTEMFONT(15); + self.hospitalName.textColor = CFontColor1; + [self.contentView addSubview:self.hospitalName]; + + self.sureButton = [[UIButton alloc] init]; + [self.sureButton setImage:IMAGE_NAMED(@"chooseCircle") forState:UIControlStateNormal]; + [self.sureButton setImage:IMAGE_NAMED(@"closeImage") forState:UIControlStateSelected]; + [self.sureButton addTarget:self action:@selector(hospitalChoose) forControlEvents:UIControlEventTouchUpInside]; + self.sureButton.selected = true; + self.sureButton.userInteractionEnabled = true; + [self.contentView addSubview:self.sureButton]; + + + [self.hospitalImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(@20); + make.top.mas_equalTo(@0); + make.width.height.mas_equalTo(44); + }]; + + [self.sureButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(@-17); + make.width.height.mas_equalTo(@25); + make.centerY.mas_equalTo(self.hospitalImage); + }]; + + [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.hospitalImage.mas_right).offset(12); + make.right.mas_equalTo(self.sureButton.mas_left).offset(-10); + make.top.mas_equalTo(@15); + make.height.mas_equalTo(@16); + }]; + + +} + + +- (void)hospitalChoose { + + + +} + +- (void)setModel:(YXHospitalModel *)model { + _model = model; + self.hospitalName.text = [NSString stringWithFormat:@"%@",_model.hospitalName]; + self.sureButton.selected = model.isChoose; +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedView.h new file mode 100644 index 0000000..14e2ba9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedView.h @@ -0,0 +1,23 @@ +// +// HospitalSelectedView.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/19. +// + +#import +#import "HospitalSelectedTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^hospotalSelectBlock)(NSString * hospalalName); + +@interface HospitalSelectedView : UIView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) hospotalSelectBlock hospatlBlcok; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedView.m new file mode 100644 index 0000000..1db5b5c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/HospitalSelectedView.m @@ -0,0 +1,206 @@ +// +// HospitalSelectedView.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/19. +// + +#import "HospitalSelectedView.h" + +@interface HospitalSelectedView () + +@property (nonatomic,strong)UITableView * tableView; + +@end + +@implementation HospitalSelectedView + + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + + self.backgroundColor = RGBA(51, 59, 66,0.7); + [self createUI]; + } + + return self; +} + +- (void)createUI { + + UIView * centerView = [[UIView alloc] init]; + centerView.layer.masksToBounds = true; + centerView.layer.cornerRadius = 4; + centerView.backgroundColor = [UIColor whiteColor]; + [self addSubview:centerView]; + + UIView * headView = [[UIView alloc] init]; + headView.backgroundColor = KWhiteColor; + [centerView addSubview:headView]; + + UILabel * headLabel = [[UILabel alloc] init]; + headLabel.text = @"选择医院"; + headLabel.textColor = CFontColor1; + headLabel.font = BOLDSYSTEMFONT(16); + headLabel.textAlignment = NSTextAlignmentCenter; + [headView addSubview:headLabel]; + + + self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.backgroundColor = KWhiteColor; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + [centerView addSubview:self.tableView]; + + UIButton * bottomBtn = [[UIButton alloc] init]; + [bottomBtn setBackgroundColor:UIColorHex(#BD130B)]; + [bottomBtn setTitle:@"确定" forState:UIControlStateNormal]; + [bottomBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [centerView addSubview:bottomBtn]; + + UIButton * closeBtn = [[UIButton alloc] init]; + [closeBtn setImage:IMAGE_NAMED(@"closeImage") forState:UIControlStateNormal]; + [closeBtn addTarget:self action:@selector(closePopView) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:closeBtn]; + + [centerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(kScreenWidth -30); + make.centerX.mas_equalTo(self); + make.height.mas_equalTo(@376); + make.top.mas_equalTo(@172); + }]; + + [headView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(@50); + make.width.top.mas_equalTo(centerView); + }]; + + [headLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(0); + make.top.mas_equalTo(@17); + make.height.mas_equalTo(@16); + }]; + + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(0); + make.top.mas_equalTo(headView.mas_bottom).offset(18); + make.bottom.mas_equalTo(bottomBtn.mas_top).offset(-20); + }]; + + [bottomBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(@290); + make.centerX.mas_equalTo(centerView); + make.bottom.mas_equalTo(@-20); + }]; + + [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(centerView.mas_bottom).offset(26); + make.height.width.mas_equalTo(@32); + }]; + + + +} + +- (void)setDataArray:(NSArray *)dataArray { + _dataArray = dataArray; + [self.tableView 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 +{ + + HospitalSelectedTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"HospitalCELL"]; + if (!cell) { + + cell = [[HospitalSelectedTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HospitalCELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.model = self.dataArray[indexPath.row]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + +} +//每行高度 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + + return kRealValue(55); +} + +- (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 +{ + + YXHospitalModel * model = self.dataArray[indexPath.row]; + + for (YXHospitalModel * subModel in self.dataArray) { + + if (subModel == model) { + subModel.isChoose = true; + }else + { + subModel.isChoose = false; + } + } + [self.tableView reloadData]; + if (self.hospatlBlcok) { + + self.hospatlBlcok(@"西安市中医院"); + } + +} + +- (void)closePopView { + + [self removeFromSuperview]; +} + +@end + + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLIfeManagerFooterView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLIfeManagerFooterView.h new file mode 100644 index 0000000..c3a7912 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLIfeManagerFooterView.h @@ -0,0 +1,13 @@ +// +// SYLIfeManagerFooterView.h +// shan +// +// Created by aDu on 2016/12/7. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import + +@interface SYLIfeManagerFooterView : UICollectionReusableView + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLIfeManagerFooterView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLIfeManagerFooterView.m new file mode 100644 index 0000000..1ab398d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLIfeManagerFooterView.m @@ -0,0 +1,22 @@ +// +// SYLIfeManagerFooterView.m +// shan +// +// Created by aDu on 2016/12/7. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import "SYLIfeManagerFooterView.h" + +@implementation SYLIfeManagerFooterView + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor grayColor]; + } + return self; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.h new file mode 100644 index 0000000..1fdca8e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.h @@ -0,0 +1,28 @@ +// +// SYLifeManagerCell.h +// shan +// +// Created by aDu on 2016/12/5. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import +#import "YXToolsModel.h" + +@interface SYLifeManagerCell : UICollectionViewCell + +@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UIButton *button; +@property (nonatomic, strong) YXToolsModel *model; + +@property (nonatomic, assign) BOOL inEditState; //是否处于编辑状态 + +- (void)setModel:(YXToolsModel *)model indexPaht:(NSIndexPath *)indexPath exist:(BOOL)exist; + +- (void)setDataAry:(NSMutableArray *)dataAry groupAry:(NSMutableArray *)groupAry indexPath:(NSIndexPath *)indexPath; + +@property (nonatomic, strong) UILabel *messageLabel; + +- (void)addMeaageLabel; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.m new file mode 100644 index 0000000..9d83456 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.m @@ -0,0 +1,157 @@ +// +// SYLifeManagerCell.m +// shan +// +// Created by aDu on 2016/12/5. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import "SYLifeManagerCell.h" +#import "Masonry.h" + +@interface SYLifeManagerCell () + +@property (nonatomic, strong) UIImageView *imageView; + +@end + +@implementation SYLifeManagerCell + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor whiteColor]; + + [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(10, 15, 15, 15)); + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.imageView.mas_bottom); + make.bottom.equalTo(self.mas_bottom); + make.left.and.right.equalTo(self); + }]; + + [self.button mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.mas_top); + make.right.equalTo(self.mas_right); + make.height.equalTo(@15); + make.width.equalTo(@15); + }]; + self.button.hidden = YES; + } + return self; +} + +- (void)addMeaageLabel +{ + [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self).insets(UIEdgeInsetsMake(0, 0, 0, 0)); + }]; +} + +- (void)setModel:(YXToolsModel *)model indexPaht:(NSIndexPath *)indexPath exist:(BOOL)exist +{ + if (_model != model) { + self.titleLabel.text = model.title; + if (indexPath.section == 0) { + [self.button setBackgroundImage:[UIImage imageNamed:@"life_reduce"] forState:UIControlStateNormal]; + self.button.userInteractionEnabled = YES; + } else { + if (exist) { + [self.button setBackgroundImage:[UIImage imageNamed:@"life_exist"] forState:UIControlStateNormal]; + self.button.userInteractionEnabled = NO; + } else { + [self.button setBackgroundImage:[UIImage imageNamed:@"life_add"] forState:UIControlStateNormal]; + self.button.userInteractionEnabled = YES; + } + } + } + _model = model; +} + +- (void)setDataAry:(NSMutableArray *)dataAry groupAry:(NSMutableArray *)groupAry indexPath:(NSIndexPath *)indexPath +{ + YXToolsModel *model; + if (indexPath.section == 0) { + model = dataAry[indexPath.row]; + } else { + model = groupAry[indexPath.row]; + } + self.titleLabel.text = model.title; + if (indexPath.section == 0) { + self.button.userInteractionEnabled = YES; + [self.button setBackgroundImage:[UIImage imageNamed:@"life_reduce"] forState:UIControlStateNormal]; + } else { + if ([dataAry containsObject:model]) { + self.button.userInteractionEnabled = NO; + [self.button setBackgroundImage:[UIImage imageNamed:@"life_exist"] forState:UIControlStateNormal]; + } else { + self.button.userInteractionEnabled = YES; + [self.button setBackgroundImage:[UIImage imageNamed:@"life_add"] forState:UIControlStateNormal]; + } + } +} + +#pragma mark - 是否处于编辑状态 + +- (void)setInEditState:(BOOL)inEditState +{ + if (inEditState && _inEditState != inEditState) { + self.layer.borderWidth = 0.5; + self.layer.borderColor = [UIColor grayColor].CGColor; + self.button.hidden = NO; + } else { + self.layer.borderColor = [UIColor clearColor].CGColor; + self.button.hidden = YES; + } +} + +#pragma mark - init + +- (UIImageView *)imageView +{ + if (!_imageView) { + _imageView = [[UIImageView alloc] init]; + _imageView.image = [UIImage imageNamed:@"wallet_payChange"]; + [self addSubview:_imageView]; + } + return _imageView; +} + +- (UILabel *)titleLabel +{ + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.font = [UIFont systemFontOfSize:14]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + [self addSubview:_titleLabel]; + } + return _titleLabel; +} + +- (UILabel *)messageLabel +{ + if (!_messageLabel) { + _messageLabel = [[UILabel alloc] init]; + _messageLabel.font = [UIFont systemFontOfSize:12]; + _messageLabel.textColor = [UIColor grayColor]; + _messageLabel.textAlignment = NSTextAlignmentCenter; + _messageLabel.text = @"您还未添加任何应用\n长按下面的应用可以添加"; + [self addSubview:_messageLabel]; + } + return _messageLabel; +} + +- (UIButton *)button +{ + if (!_button) { + _button = [UIButton buttonWithType:UIButtonTypeCustom]; + _button.layer.cornerRadius = 7.5; + [self addSubview:_button]; + } + return _button; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerHeaderView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerHeaderView.h new file mode 100644 index 0000000..312a157 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerHeaderView.h @@ -0,0 +1,15 @@ +// +// SYLifeManagerHeaderView.h +// shan +// +// Created by aDu on 2016/12/7. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import + +@interface SYLifeManagerHeaderView : UICollectionReusableView + +@property (nonatomic, strong) UILabel *headLabel; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerHeaderView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerHeaderView.m new file mode 100644 index 0000000..3997f40 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerHeaderView.m @@ -0,0 +1,32 @@ +// +// SYLifeManagerHeaderView.m +// shan +// +// Created by aDu on 2016/12/7. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import "SYLifeManagerHeaderView.h" + +@implementation SYLifeManagerHeaderView + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self addSubview:self.headLabel]; + } + return self; +} + +- (UILabel *)headLabel +{ + if (!_headLabel) { + _headLabel = [UILabel new]; + _headLabel.font = [UIFont systemFontOfSize:16]; + _headLabel.frame = CGRectMake(16, 0, 150, 20); + } + return _headLabel; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerLayout.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerLayout.h new file mode 100644 index 0000000..c93cdab --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerLayout.h @@ -0,0 +1,30 @@ +// +// SYLifeManagerLayout.h +// shan +// +// Created by aDu on 2016/12/6. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import + +@protocol SYLifeManagerDelegate + +/** + * 更新数据源 + */ +- (void)moveItemAtIndexPath:(NSIndexPath *)formPath toIndexPath:(NSIndexPath *)toPath; + +/** + * 改变编辑状态 + */ +- (void)didChangeEditState:(BOOL)inEditState; + +@end + +@interface SYLifeManagerLayout : UICollectionViewFlowLayout + +@property (nonatomic, assign) BOOL inEditState; //检测是否处于编辑状态 +@property (nonatomic, weak) id delegate; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerLayout.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerLayout.m new file mode 100644 index 0000000..4bbff62 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerLayout.m @@ -0,0 +1,156 @@ +// +// SYLifeManagerLayout.m +// shan +// +// Created by aDu on 2016/12/6. +// Copyright © 2016年 DuKaiShun. All rights reserved. +// + +#import "SYLifeManagerLayout.h" +#import "SYLifeManagerCell.h" +#import "YXToolsModel.h" + +@interface SYLifeManagerLayout () + +@property (nonatomic, strong) UILongPressGestureRecognizer *longGesture; +@property (nonatomic, strong) NSIndexPath *currentIndexPath; //当前indexPath +@property (nonatomic, assign) CGPoint movePoint; //移动的中心点 +@property (nonatomic, strong) UIView *moveView; //移动的视图 + +@end + +@implementation SYLifeManagerLayout + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + self = [super initWithCoder:aDecoder]; + if (self) { + [self configureObserver]; + } + return self; +} + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self configureObserver]; + } + return self; +} + +#pragma mark - 添加观察者 + +- (void)configureObserver +{ + [self addObserver:self forKeyPath:@"collectionView" options:NSKeyValueObservingOptionNew context:nil]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if ([keyPath isEqualToString:@"collectionView"]) { + [self setUpGestureRecognizers]; + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +#pragma mark - 长按手势 + +- (void)setUpGestureRecognizers +{ + if (self.collectionView == nil) { + return; + } + _longGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longGesture:)]; + _longGesture.minimumPressDuration = 0.3f; //时间长短 + _longGesture.delegate = self; + [self.collectionView addGestureRecognizer:_longGesture]; +} + +#pragma mark - 手势动画 + +- (void)longGesture:(UILongPressGestureRecognizer *)gesture +{ + if (!self.inEditState) { + [self setInEditState:YES]; + } + switch (gesture.state) { + case UIGestureRecognizerStateBegan: { //手势开始 + CGPoint location = [gesture locationInView:self.collectionView]; + //找到当前点击的cell的位置 + NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:location]; + //判断哪个分区可以被点击并且移动 + if (indexPath == nil || indexPath.section != 0) return; + self.currentIndexPath = indexPath; + UICollectionViewCell *targetCell = [self.collectionView cellForItemAtIndexPath:self.currentIndexPath]; + //得到当前cell的映射(截图) + self.moveView = [targetCell snapshotViewAfterScreenUpdates:YES]; + //隐藏被点击的cell + targetCell.hidden = YES; + //给截图添加上边框,如果不添加的话,截图有一部分是没有边框的,具体原因也没有找到 + self.moveView.layer.borderWidth = 0.5; + self.moveView.layer.borderColor = [UIColor grayColor].CGColor; + [self.collectionView addSubview:self.moveView]; + //放大截图 + self.moveView.transform = CGAffineTransformMakeScale(1.1, 1.1); + self.moveView.center = targetCell.center; + } + break; + case UIGestureRecognizerStateChanged: { //手势在变化 + CGPoint point = [gesture locationInView:self.collectionView]; + //更新cell的位置 + self.moveView.center = point; + NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:point]; + if (indexPath == nil) return; + if (indexPath.section == self.currentIndexPath.section && indexPath.section == 0) { + //通过代理去改变数据源 + if ([self.delegate respondsToSelector:@selector(moveItemAtIndexPath:toIndexPath:)]) { + [self.delegate moveItemAtIndexPath:self.currentIndexPath toIndexPath:indexPath]; + } + //移动的方法 + [self.collectionView moveItemAtIndexPath:self.currentIndexPath toIndexPath:indexPath]; + self.currentIndexPath = indexPath; + } + } + break; + case UIGestureRecognizerStateEnded: { //手势结束 + UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:self.currentIndexPath]; + //手势结束后,把截图隐藏,显示出原先的cell + [UIView animateWithDuration:0.25 animations:^{ + self.moveView.center = cell.center; + } completion:^(BOOL finished) { + [self.moveView removeFromSuperview]; + cell.hidden = NO; + self.moveView = nil; + self.currentIndexPath = nil; + [self.collectionView reloadData]; + }]; + } + break; + default: + break; + } +} + +#pragma mark - 处于编辑状态 + +- (void)setInEditState:(BOOL)inEditState +{ + if (_inEditState != inEditState) { + //通过代理方法改变处于编辑状态的cell + if (_delegate && [_delegate respondsToSelector:@selector(didChangeEditState:)]) { + [_delegate didChangeEditState:inEditState]; + } + } + _inEditState = inEditState; +} + +#pragma mark - 移除观察者 + +- (void)dealloc +{ + [self removeObserver:self forKeyPath:@"collectionView"]; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecordTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecordTableViewCell.h new file mode 100644 index 0000000..7e44b2f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecordTableViewCell.h @@ -0,0 +1,20 @@ +// +// QuestionRecordTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import +#import "YXQuestionRecordModel.h" +#import "YXRecordIMListDateModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface QuestionRecordTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXRecordIMListDateModel * IMModel; +//@property (nonatomic, strong) YXQuestionRecordModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecordTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecordTableViewCell.m new file mode 100644 index 0000000..bf05ad6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecordTableViewCell.m @@ -0,0 +1,171 @@ +// +// QuestionRecordTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import "QuestionRecordTableViewCell.h" + +@interface QuestionRecordTableViewCell () + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * ageLabel; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * diseaseLabel; + +@property (nonatomic, strong) UILabel * numberLabel; + + +@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(-5); + }]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.text = @"--"; + self.nameLabel.font = SYSTEMFONT(14); + self.nameLabel.textAlignment = NSTextAlignmentLeft; + self.nameLabel.textColor = CFontColor1; + [backView addSubview:self.nameLabel]; + + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.mas_offset(15); + make.height.mas_offset(13); + }]; + [self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.ageLabel = [[UILabel alloc] init]; + self.ageLabel.text = @"(--)"; + self.ageLabel.font = SYSTEMFONT(13); + self.ageLabel.textColor = UIColorHex(#999999); + self.ageLabel.textAlignment = NSTextAlignmentLeft; + [backView addSubview:self.ageLabel]; + + [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(15); + make.left.mas_equalTo(self.nameLabel.mas_right).offset(2); + make.height.mas_offset(13); + }]; + [self.ageLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.timeLabel = [[UILabel alloc] init]; + + self.timeLabel.font = SYSTEMFONT(13); + self.timeLabel.textColor = UIColorHex(#999999); + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [backView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(15); + make.left.mas_equalTo(self.nameLabel); + make.right.mas_offset(-15); + make.height.mas_offset(13); + make.bottom.mas_offset(-10); + }]; + + self.numberLabel = [[UILabel alloc] init]; + self.numberLabel.text = @"5"; + self.numberLabel.font = MEDIUMFONT(13); + self.numberLabel.textColor =KWhiteColor; + self.numberLabel.textAlignment = NSTextAlignmentCenter; + self.numberLabel.backgroundColor = UIColorHex(#21BEBD); + self.numberLabel.layer.cornerRadius = 8; + self.numberLabel.layer.masksToBounds = true; + [backView addSubview:self.numberLabel]; + + [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(5); + make.right.mas_equalTo(@-15); + make.height.width.mas_offset(15); + }]; + +// self.diseaseLabel = [[UILabel alloc] init]; +// self.diseaseLabel.text = @"症状:高血压、糖尿病症状:高血压、糖尿病症状:高血压、糖尿病症状:高血压、糖尿病症状:高血压、糖尿病症状:高血压、糖尿病"; +// self.diseaseLabel.font = MEDIUMFONT(13); +// self.diseaseLabel.numberOfLines = 0; +// self.diseaseLabel.textColor = UIColorHex(#333333); +// self.diseaseLabel.textAlignment = NSTextAlignmentLeft; +// [backView addSubview:self.diseaseLabel]; +// +// [self.diseaseLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(16); +// make.left.mas_equalTo(@15); +// make.right.mas_equalTo(self.numberLabel.mas_left).offset(-8); +// make.bottom.mas_offset(-20); +// }]; +// +// [self.diseaseLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + +} + +//- (void)setModel:(YXQuestionRecordModel *)model { +// +// _model = model; +// +// self.nameLabel.text = model.memberName; +// NSString * sexString = [_model.memberSex intValue] == 1 ? @"女":@"男"; +// self.ageLabel.text = [NSString stringWithFormat:@"(%@%@)",_model.memberAge,sexString]; +// self.timeLabel.text = _model.createTime; +//// self.numberLabel.text = [NSString stringWithFormat:@"%@",_model.] +//} + +- (void)setIMModel:(YXRecordIMListDateModel *)IMModel { + + _IMModel = IMModel; + + self.nameLabel.text = _IMModel.memberName; + NSString * sexString = [_IMModel.memberSex intValue] == 1 ? @"女":@"男"; + self.ageLabel.text = [NSString stringWithFormat:@"(%@/%@岁)",sexString,_IMModel.memberAge]; + self.timeLabel.text = _IMModel.createTime; + if ([_IMModel.unRedMessage integerValue] != 0) { + self.numberLabel.hidden = NO; + self.numberLabel.text = [NSString stringWithFormat:@"%@",_IMModel.unRedMessage]; + }else + { + self.numberLabel.hidden = YES; + } + +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecoredTable.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecoredTable.h new file mode 100644 index 0000000..e1c025d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecoredTable.h @@ -0,0 +1,25 @@ +// +// QuestionRecoredTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/28. +// + +#import +#import "YXRecordIMListDateModel.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^RecoredQuestionListClick)(YXRecordIMListDateModel * _Nonnull model ); +typedef void(^VideoRecoredQuestionListClick)(YXRecordIMListDateModel * _Nonnull model ); + +@interface QuestionRecoredTable : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) RecoredQuestionListClick recordBlock; +@property (nonatomic, copy) VideoRecoredQuestionListClick videoBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecoredTable.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecoredTable.m new file mode 100644 index 0000000..3a0942a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/QuestionRecordView/QuestionRecoredTable.m @@ -0,0 +1,141 @@ +// +// QuestionRecoredTable.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/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 (@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 +{ + + QuestionRecordTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[QuestionRecordTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.backgroundColor = KClearColor; + + cell.IMModel = self.dataArray[indexPath.section]; + 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 +{ + YXRecordIMListDateModel * IMModel = self.dataArray[indexPath.section]; + + if (self.recordBlock) { + + self.recordBlock(IMModel); + } + if (self.videoBlock) { + + self.videoBlock(IMModel); + } + +} + + +@end + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionPopView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionPopView.h new file mode 100644 index 0000000..5727d1a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionPopView.h @@ -0,0 +1,22 @@ +// +// StopQuestionPopView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/30. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^surePublishBlock)(); + +@interface StopQuestionPopView : UIView + +@property (nonatomic, copy) NSString * questionNumber; + +@property (nonatomic, copy) surePublishBlock publisBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionPopView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionPopView.m new file mode 100644 index 0000000..c2c1ba5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionPopView.m @@ -0,0 +1,148 @@ +// +// StopQuestionPopView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/30. +// + +#import "StopQuestionPopView.h" + +@interface StopQuestionPopView () + +@property (nonatomic, strong) UILabel * questionLabel ; +@property (nonatomic, strong) UILabel * publishLabel ; + +@end + +@implementation StopQuestionPopView + +/* +// 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); + + UIView * popView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(56), kRealValue(176), kScreenWidth - kRealValue(112), kRealValue(253))]; + + popView.backgroundColor = KWhiteColor; + + popView.layer.cornerRadius = 10.0f; + + popView.layer.masksToBounds = true; + + [self addSubview:popView]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(20), popView.width, 14)]; + titleLabel.text = @"系统提示"; + titleLabel.font = SYSTEMFONT(14); + titleLabel.textAlignment = NSTextAlignmentCenter; + titleLabel.textColor = CFontColor1; + [popView addSubview:titleLabel]; + + UILabel * stopLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), titleLabel.bottom + kRealValue(17), popView.width - kRealValue(32), 34)]; + stopLabel.text = @"您当前设置的暂停时间段有正在进行中的咨询:"; + stopLabel.font = SYSTEMFONT(13); + stopLabel.numberOfLines = 2; + stopLabel.textAlignment = NSTextAlignmentLeft; + stopLabel.textColor = UIColorHex(#666666); + [popView addSubview:stopLabel]; + + UIView * questionView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(14),stopLabel.bottom + kRealValue(9), popView.width - kRealValue(28), kRealValue(44))]; + + questionView.backgroundColor = RGBA(33, 190, 189, 0.3); + + questionView.layer.cornerRadius = 10.0f; + + questionView.layer.masksToBounds = true; + + [popView addSubview:questionView]; + + UIImageView * iconImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(32), kRealValue(17), 10, 10)]; + iconImg.image = [UIImage imageNamed:@"stopPopIcon"]; + [questionView addSubview:iconImg]; + + UILabel * questionLabel = [[UILabel alloc] initWithFrame:CGRectMake(iconImg.right + kRealValue(5),0, popView.width - 50, questionView.height)]; + questionLabel.text = @"视频咨询:1"; + questionLabel.font = SYSTEMFONT(13); + questionLabel.textAlignment = NSTextAlignmentLeft; + questionLabel.textColor = CFontColor1; + self.questionLabel = questionLabel; + [questionView addSubview:questionLabel]; + + + + UILabel * publishLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16),questionView.bottom + kRealValue(11), popView.width - kRealValue(32), 34)]; + publishLabel.text = @"发布后,这2个咨询将被系统自动取消,确认是否发布?"; + self.publishLabel = publishLabel; + publishLabel.font = SYSTEMFONT(13); + publishLabel.textAlignment = NSTextAlignmentLeft; + publishLabel.numberOfLines = 0; + publishLabel.textColor = CFontColor1; + [popView addSubview:publishLabel]; + + UIView * rowLin = [[UIView alloc] initWithFrame:CGRectMake(0, popView.height - kRealValue(49), popView.width, 1)]; + rowLin.backgroundColor = UIColorHex(#E0E0E0); + [popView addSubview:rowLin]; + + + + UIButton * cancelbtn = [[UIButton alloc] initWithFrame:CGRectMake(0, rowLin.bottom , popView.width/2, 48)]; + + [cancelbtn setTitle:@"取消" forState:UIControlStateNormal]; + cancelbtn.titleLabel.font = SYSTEMFONT(13); + [cancelbtn setTitleColor:UIColorHex(#666666) forState:UIControlStateNormal]; + [cancelbtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside]; + [popView addSubview:cancelbtn]; + + UIButton * pubbtn = [[UIButton alloc] initWithFrame:CGRectMake(popView.width/2, rowLin.bottom , popView.width/2, 48)]; + [pubbtn setTitle:@"发布" forState:UIControlStateNormal]; + [pubbtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [pubbtn addTarget:self action:@selector(publishSureAction) forControlEvents:UIControlEventTouchUpInside]; + pubbtn.titleLabel.font = SYSTEMFONT(13); + + [popView addSubview:pubbtn]; + + + UIView * cowLin = [[UIView alloc] initWithFrame:CGRectMake(popView.width/2 - 1, popView.height - kRealValue(49), 1, kRealValue(49))]; + cowLin.backgroundColor = UIColorHex(#E0E0E0); + [popView addSubview:cowLin]; +} + +-(void)cancelAction { + + [self removeFromSuperview]; +} + +- (void)publishSureAction { + + if (self.publisBlock) { + self.publisBlock(); + } + +} +- (void)setQuestionNumber:(NSString *)questionNumber { + + _questionNumber = questionNumber; + + self.questionLabel.text = [NSString stringWithFormat:@"视频咨询:%@",_questionNumber]; + self.publishLabel.text = [NSString stringWithFormat:@"发布后,这%@个咨询将被系统自动取消,确认是否发布?", _questionNumber]; +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableView.h new file mode 100644 index 0000000..e00d8d6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableView.h @@ -0,0 +1,21 @@ +// +// StopQuestionView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/29. +// + +#import +#import "StopQuestionTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface StopQuestionTableView : UITableView + +@property (nonatomic, strong) NSArray * dataArray; + +@property (nonatomic, copy) chageServiceStatus changeBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableView.m new file mode 100644 index 0000000..c6add84 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableView.m @@ -0,0 +1,135 @@ +// +// StopQuestionView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/29. +// + +#import "StopQuestionTableView.h" +#import "BRPickerView.h" + +@interface StopQuestionTableView () + + +@end + + +@implementation StopQuestionTableView + + +- (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 +{ + + StopQuestionTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[StopQuestionTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.backgroundColor = KClearColor; + cell.model = self.dataArray[indexPath.section]; + cell.changeBlock = ^(NSString * _Nullable record_id) { + self.changeBlock(record_id); + }; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; +} +//每行高度 +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +//{ +// return kRealValue(77); +//} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return kRealValue(32); +} + +- (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 { + + + YXStopServiceListModel * model = self.dataArray[section]; + UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(32))]; + + UILabel * timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, kScreenWidth, kRealValue(32))]; + NSDate * starDate = [NSDate br_dateFromString:model.startDay dateFormat:@"yyyy-MM-dd"]; + timeLabel.text = [NSString stringWithFormat:@"%ld年%ld月",starDate.year,starDate.month]; + + timeLabel.textAlignment = NSTextAlignmentLeft; + timeLabel.font = SYSTEMFONT(15); + [footerView addSubview:timeLabel]; + + return footerView; + +} +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableViewCell.h new file mode 100644 index 0000000..db36435 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableViewCell.h @@ -0,0 +1,23 @@ +// +// StopQuestionTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/4/29. +// + +#import +#import "YXStopServiceModel.h" + +typedef void(^chageServiceStatus)(NSString * _Nullable record_id); + +NS_ASSUME_NONNULL_BEGIN + +@interface StopQuestionTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXStopServiceListModel * model; + +@property (nonatomic, copy) chageServiceStatus changeBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableViewCell.m new file mode 100644 index 0000000..37f8827 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/StopQuestion(停止咨询)/StopQuestionTableViewCell.m @@ -0,0 +1,205 @@ +// +// StopQuestionTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/4/29. +// + +#import "StopQuestionTableViewCell.h" + +@interface StopQuestionTableViewCell () + +@property (nonatomic, strong) UIImageView * linImg; + +@property (nonatomic, strong) UIView * backView; + +@property (nonatomic, strong) UIButton * statusBtn; + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UILabel * resourLabel; + +@property (nonatomic, strong) UILabel * gonggaoLabel; + +@property (nonatomic, strong) UILabel * statusLabel; + + +@end + +@implementation StopQuestionTableViewCell + +- (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 { + + UIImageView * linv = [[UIImageView alloc] init]; +// [linv setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"xuxian"]]]; + linv.image = [UIImage imageNamed:@"xuxian"]; + linv.contentMode = UIViewContentModeScaleToFill; + linv.clipsToBounds = YES; + self.linImg = linv; + [self.contentView addSubview:linv]; + + [self.linImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(27); + make.top.mas_offset(-15); + make.width.mas_offset(1); + make.bottom.mas_offset(15); + }]; + + self.backView = [[UIView alloc] init]; + self.backView.backgroundColor = KWhiteColor; + self.backView.layer.cornerRadius = 10; + [HQCommonUtils addShadowToView:self.backView]; + [self.contentView addSubview:self.backView]; + + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(40); + make.top.mas_offset(0); + make.right.mas_offset(-15); + make.bottom.mas_offset(-10); + }]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.text = @"暂停时间:2023-02-10 ~ 03-29"; + self.timeLabel.font = SYSTEMFONT(13);; + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [self.backView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.mas_offset(15); + make.height.mas_offset(13); + }]; + [self.timeLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + UILabel * stopTitleLabel = [[UILabel alloc] init]; + stopTitleLabel.text = @"暂停原因:"; + stopTitleLabel.font = SYSTEMFONT(13); + stopTitleLabel.textAlignment = NSTextAlignmentRight; + [self.backView addSubview:stopTitleLabel]; + + [stopTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(13); + make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(20); + make.height.mas_equalTo(@13); + }]; + + [stopTitleLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + + self.resourLabel = [[UILabel alloc] init]; + + self.resourLabel.font = SYSTEMFONT(13); + self.resourLabel.textAlignment = NSTextAlignmentCenter; + [self.backView addSubview:self.resourLabel]; + + [self.resourLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(stopTitleLabel.mas_right).offset(8); + make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(12); + make.height.mas_equalTo(@27); + }]; + [self.resourLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + + UILabel * gonggaoTitleLabel = [[UILabel alloc] init]; + gonggaoTitleLabel.font = SYSTEMFONT(13); + gonggaoTitleLabel.textAlignment = NSTextAlignmentLeft; + gonggaoTitleLabel.numberOfLines = 0; + self.gonggaoLabel = gonggaoTitleLabel; + [self.backView addSubview:gonggaoTitleLabel]; + + [gonggaoTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(13); + make.right.mas_offset(-24); + make.bottom.mas_equalTo(@-30); + make.top.mas_equalTo(self.resourLabel.mas_bottom).offset(14); + }]; + + [gonggaoTitleLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.statusBtn = [[UIButton alloc] init]; + [self.statusBtn setTitle:@"开启咨询" forState:UIControlStateNormal]; + [self.statusBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.statusBtn.titleLabel.font = SYSTEMFONT(13); + self.statusBtn.layer.cornerRadius = 5.0; + self.statusBtn.layer.masksToBounds = YES; + self.statusBtn.backgroundColor = UIColorHex(#21BEBD); + [self.statusBtn addTarget:self action:@selector(statusChange) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.statusBtn]; + + [self.statusBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_offset(-5); + make.right.mas_offset(-10); + make.width.mas_offset(70); + make.height.mas_offset(25); + }]; + +} + +- (void)setModel:(YXStopServiceListModel *)model { + + _model = model; + self.timeLabel.text = [NSString stringWithFormat:@"暂停时间:%@~%@",_model.startDay,model.endDay]; + self.resourLabel.text = [NSString stringWithFormat:@"%@",_model.stopReason]; + + NSString * gonggaoString = [NSString stringWithFormat:@"暂停公告:%@",_model.notice]; + NSMutableAttributedString *attriString = + [[NSMutableAttributedString alloc] initWithString:gonggaoString]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:10]; + //设置距离 + [attriString addAttribute:NSParagraphStyleAttributeName + value:paragraphStyle + range:NSMakeRange(0, [gonggaoString length])]; + self.gonggaoLabel.attributedText = attriString; + if (_model.serviceStatus == 1) { + + [self.statusBtn setTitle:@"已结束" forState:UIControlStateNormal]; + [self.statusBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + self.statusBtn.backgroundColor =KClearColor; + self.statusBtn.userInteractionEnabled = NO; + + } + if (_model.serviceStatus == 0) { + [self.statusBtn setTitle:@"恢复服务" forState:UIControlStateNormal]; + [self.statusBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + self.statusBtn.backgroundColor = UIColorHex(#21BEBD); + self.statusBtn.userInteractionEnabled = YES; + + + } +} + +- (void)statusChange { + + if (self.changeBlock) { + self.changeBlock(self.model.record_id); + } + +} + + + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/YXDTTestView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/YXDTTestView.h new file mode 100644 index 0000000..1dbd18c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/YXDTTestView.h @@ -0,0 +1,13 @@ +// +// YXDTTestView.h +// DTPaperTeacher +// +// Created by syyy on 2023/5/6. +// + +#import + +@interface YXDTTestView : UIView +@property (nonatomic ,copy) void(^returnBlock)(NSString *startTime, NSString *endTime); +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/YXDTTestView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/YXDTTestView.m new file mode 100644 index 0000000..3b06c5c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/YXDTTestView.m @@ -0,0 +1,329 @@ +// +// YXDTTestView.m +// DTPaperTeacher +// +// Created by syyy on 2023/5/6. +// + +#import "YXDTTestView.h" + +@interface YXDTTestView (){ + int _type;//0开始 1结束 +} +@property (nonatomic, strong) UIView *backView; +@property (nonatomic, strong) YYLabel *titleLab; +@property (nonatomic, strong) UILabel *centerLab; +@property (nonatomic, strong) UIButton *closeBtn; +@property (nonatomic, strong) UIButton *startBtn; +@property (nonatomic, strong) UIButton *endBtn; +@property (nonatomic, strong) UILabel * showTimeLabel; + +@property (nonatomic, strong) NSMutableArray *monthAndDayArr; +@property (nonatomic, strong) NSMutableArray *hourArr; +@property (nonatomic, strong) NSMutableArray *minArr; +@property (nonatomic, strong) UIPickerView *pickerView; + +@property (nonatomic, copy) NSString *monthStr; +@property (nonatomic, copy) NSString *hourStr; +@property (nonatomic, copy) NSString *minStr; + +@property (nonatomic, copy) NSString *startTime; +@property (nonatomic, copy) NSString *endTime; + +@end + +@implementation YXDTTestView + +-(NSMutableArray *)monthAndDayArr{ + if (_monthAndDayArr == nil) { + _monthAndDayArr = [NSMutableArray arrayWithCapacity:0]; + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"MM月dd日 EEEE"]; + for (int i = 0; i < 7; i++) { + NSDate *Day = [NSDate dateWithTimeInterval:24*60*60*i sinceDate:[NSDate date]]; + NSString *DateStr = [dateFormatter stringFromDate:Day]; + + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Saturday" withString:@"星期六"]; + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Sunday" withString:@"星期日"]; + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Monday" withString:@"星期一"]; + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Tuesday" withString:@"星期二"]; + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Wednesday" withString:@"星期三"]; + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Thursday" withString:@"星期四"]; + DateStr = [DateStr stringByReplacingOccurrencesOfString:@"Friday" withString:@"星期五"]; + + [_monthAndDayArr addObject:DateStr]; + } + } + return _monthAndDayArr; +} + +-(NSMutableArray *)hourArr{ + if (_hourArr == nil) { + _hourArr = [NSMutableArray arrayWithCapacity:0]; + for (int i = 0; i < 24; i++) { + if (i<10) { + [_hourArr addObject:[NSString stringWithFormat:@"0%d", i]]; + }else{ + [_hourArr addObject:[NSString stringWithFormat:@"%d", i]]; + } + } + } + return _hourArr; +} + +-(NSMutableArray *)minArr{ + if (_minArr == nil) { + _minArr = [NSMutableArray arrayWithCapacity:0]; + for (int i = 0; i < 60; i++) { + if (i<10) { + [_minArr addObject:[NSString stringWithFormat:@"0%d", i]]; + }else{ + [_minArr addObject:[NSString stringWithFormat:@"%d", i]]; + } + } + } + return _minArr; +} + +-(instancetype)initWithFrame:(CGRect)frame{ + if (self = [super initWithFrame:frame]) { + + [self configUI]; + + [self configData]; + } + return self; +} + +-(void)configUI{ + self.backgroundColor = RGBA(0, 0, 0, 0.5); + + self.backView = [[UIView alloc]initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 300, [UIScreen mainScreen].bounds.size.width, 300)]; + self.backView.backgroundColor = UIColor.whiteColor; + [self addSubview:self.backView]; + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(12, 12)]; + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = self.backView.bounds; + maskLayer.path = maskPath.CGPath; + self.backView.layer.mask = maskLayer; + + self.titleLab = [[YYLabel alloc]initWithFrame:CGRectMake(20, 10, 200, 20)]; + self.titleLab.text = @"取消"; + self.titleLab.textColor = CFontColor1; + self.titleLab.font = BOLDSYSTEMFONT(13); + [self.backView addSubview:self.titleLab]; + [self.titleLab setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [self removeFromSuperview]; + } ]; + + self.closeBtn = [[UIButton alloc]initWithFrame:CGRectMake(self.backView.frame.size.width - 75, 10, 55, 20)]; +// [self.closeBtn setImage:[UIImage imageNamed:@"close_Icon"] forState:UIControlStateNormal]; + [self.closeBtn setTitle:@"确定" forState:UIControlStateNormal]; + [self.closeBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + self.closeBtn.titleLabel.font = BOLDSYSTEMFONT(13); + [self.closeBtn addTarget:self action:@selector(closeAct) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.closeBtn]; + + + self.startBtn = [[UIButton alloc]initWithFrame:CGRectMake(20, self.titleLab.bottom + 25, self.backView.frame.size.width/2 - 35, 33)]; + [self.startBtn setTitleColor:UIColor.blackColor forState:UIControlStateNormal]; + self.startBtn.layer.cornerRadius = 5; + self.startBtn.layer.masksToBounds = YES; + self.startBtn.layer.borderWidth = 1; + self.startBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + [self.startBtn setTitle:@"开始时间" forState:UIControlStateNormal]; + self.startBtn.titleLabel.font = SYSTEMFONT(13); + [self.startBtn addTarget:self action:@selector(startBtnAct) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.startBtn]; + +// UIImageView * time1imge = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(10), 9, 15, 15)]; +// time1imge.image = [UIImage imageNamed:@"smallTime"]; +// [self.startBtn addSubview:time1imge]; + + self.endBtn = [[UIButton alloc]initWithFrame:CGRectMake(self.backView.frame.size.width/2 + 15, self.startBtn.top, self.startBtn.width, self.startBtn.height)]; + [self.endBtn setTitleColor:UIColor.blackColor forState:UIControlStateNormal]; + self.endBtn.layer.cornerRadius = 6; + self.endBtn.layer.masksToBounds = YES; + self.endBtn.layer.borderWidth = 1; + self.endBtn.layer.borderColor = UIColorHex(#999999).CGColor; + self.endBtn.titleLabel.font = SYSTEMFONT(13); + [self.endBtn setTitle:@"结束时间" forState:UIControlStateNormal]; + [self.endBtn addTarget:self action:@selector(endBtnAct) forControlEvents:UIControlEventTouchUpInside]; + [self.backView addSubview:self.endBtn]; + +// UIImageView * time2imge = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(10), 9, 15, 15)]; +// time2imge.image = [UIImage imageNamed:@"smallTime"]; +// [self.endBtn addSubview:time2imge]; + + self.centerLab = [[UILabel alloc]initWithFrame:CGRectMake(self.backView.frame.size.width/2 - 7.5, 60, 15, 25)]; + self.centerLab.text = @"至"; + self.centerLab.textAlignment = NSTextAlignmentCenter; + self.centerLab.font = SYSTEMFONT(13); + [self.backView addSubview:self.centerLab]; + + self.showTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 12, 100, 25)]; + self.showTimeLabel.text = @"预计开始时间"; + self.showTimeLabel.textAlignment = NSTextAlignmentCenter; + self.showTimeLabel.font = SYSTEMFONT(16); + self.showTimeLabel.centerX = self.backView.centerX; + [self.backView addSubview:self.showTimeLabel]; + + self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 80, [UIScreen mainScreen].bounds.size.width, 200)]; + self.pickerView.delegate = self; + self.pickerView.dataSource = self; + [self.backView addSubview:self.pickerView]; + + UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 10, 50)]; + lab.center = CGPointMake(self.pickerView.center.x + 115, self.pickerView.frame.size.height/2 -1); + lab.text = @":"; + [self.pickerView addSubview:lab]; +} + +-(void)configData{ + + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"HH-mm"]; + NSDate *currentdate = [NSDate date]; + NSString *DateStr = [dateFormatter stringFromDate:currentdate]; + NSArray *timearr = [DateStr componentsSeparatedByString:@"-"]; + [self.pickerView selectRow:[timearr[0] integerValue] inComponent:1 animated:NO ]; + [self.pickerView selectRow:[timearr[1] integerValue] inComponent:2 animated:NO ]; + self.monthStr = self.monthAndDayArr[0]; + self.hourStr = timearr[0]; + self.minStr = timearr[1]; +// [self setStartAndEndData]; +} + +-(void)setStartAndEndData{ + NSDate *currentdate = [NSDate date]; + if (_type == 0) { + NSString * startTime = [NSString stringWithFormat:@"%ld年%@%@%@",(long)currentdate.year, [self.monthStr substringToIndex:6],self.hourStr,self.minStr]; + self.startTime = [NSString stringWithFormat:@"%ld",(long)[self timeSwitchTimestamp:startTime]] ; + [self.startBtn setTitle:[NSString stringWithFormat:@"%@ %@:%@", self.monthStr,self.hourStr,self.minStr] forState:UIControlStateNormal]; + + }else{ + NSString * currEndTime = [NSString stringWithFormat:@"%ld年%@%@%@",(long)currentdate.year, [self.monthStr substringToIndex:6],self.hourStr,self.minStr]; + self.endTime = [NSString stringWithFormat:@"%ld",(long)[self timeSwitchTimestamp:currEndTime]] ; + [self.endBtn setTitle:[NSString stringWithFormat:@"%@ %@:%@", self.monthStr,self.hourStr,self.minStr] forState:UIControlStateNormal]; + + } +} + +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ + return 3; +} + +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ + if (component == 0) return self.monthAndDayArr.count; + if (component == 1) return self.hourArr.count; + if (component == 2) return self.minArr.count; + return 0; +} + +-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ + if (component == 0) return [self.monthAndDayArr objectAtIndex:row]; + if (component == 1) return [self.hourArr objectAtIndex:row]; + if (component == 2) return [self.minArr objectAtIndex:row]; + return @""; +} + +-(CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component{ + return 50; +} + +-(CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component{ + if (component == 0) + { + return 220; + } + else + { + return 50; + } +} + +-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{ + if (component == 0) { + self.monthStr = self.monthAndDayArr[row]; + }else if (component == 1){ + self.hourStr = self.hourArr[row]; + }else if (component == 2){ + self.minStr = self.minArr[row]; + } + [self setStartAndEndData]; +} + +-(void)startBtnAct{ + _type = 0; + self.showTimeLabel.text = @"预计开始时间"; + self.startBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + self.endBtn.layer.borderColor = UIColorHex(#999999).CGColor; +} + +-(void)endBtnAct{ + _type = 1; + self.showTimeLabel.text = @"预计结束时间"; + self.startBtn.layer.borderColor = UIColorHex(#999999).CGColor; + self.endBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + +} + +-(void)closeAct{ + + if (_type == 0 ){ + + self.startBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + self.endBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + _type = 1; + }else + { + _type = 0; + if (self.startBtn.currentTitle.length == 4 ) { + [EasyTextView showErrorText:@"请选择开始时间"]; + return; + } + if ([self.startTime doubleValue] < [self.endTime doubleValue]) { + + } else if ([self.startTime doubleValue] > [self.endTime doubleValue]) { + [EasyTextView showErrorText:@"结束时间不能小于开始时间"]; + return; + } else if ([self.startTime doubleValue] == [self.endTime doubleValue]) { + + } + if (self.returnBlock) { + self.returnBlock(self.startTime, self.endTime); + } + [self removeFromSuperview]; + + } + + + + +} + +- (NSInteger)timeSwitchTimestamp:(NSString *)formatTime{ + + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + + [formatter setDateStyle:NSDateFormatterMediumStyle]; + + [formatter setTimeStyle:NSDateFormatterShortStyle]; + + [formatter setDateFormat:@"yyyy年MM月dd日HHmm"]; //(@"YYYY-MM-dd hh:mm:ss") ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制 + + NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"]; + + [formatter setTimeZone:timeZone]; + + NSDate* date = [formatter dateFromString:formatTime]; //------------将字符串按formatter转成nsdate + + //时间转时间戳的方法: + NSInteger timeSp = [[NSNumber numberWithDouble:[date timeIntervalSince1970]*1000] integerValue]; + + NSLog(@"将某个时间转化成 时间戳timeSp:%ld",(long)timeSp); //时间戳的值 + + return timeSp; + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/refuseQuestion(拒绝咨询)/RefuseQuestionPopView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/refuseQuestion(拒绝咨询)/RefuseQuestionPopView.h new file mode 100644 index 0000000..b2ab9a4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/refuseQuestion(拒绝咨询)/RefuseQuestionPopView.h @@ -0,0 +1,26 @@ +// +// RefuseQuestionPopView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^refuseQuestionBlock)(NSString * beizhuString,NSString * reasourString); + +typedef void(^cancelReasonBlock)(); + + +@interface RefuseQuestionPopView : UIView + +@property (nonatomic, copy) refuseQuestionBlock popBlock; +@property (nonatomic, copy) cancelReasonBlock upBlock; + +@property (nonatomic, strong) NSArray * dataArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/refuseQuestion(拒绝咨询)/RefuseQuestionPopView.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/refuseQuestion(拒绝咨询)/RefuseQuestionPopView.m new file mode 100644 index 0000000..0e6960f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/refuseQuestion(拒绝咨询)/RefuseQuestionPopView.m @@ -0,0 +1,271 @@ +// +// RefuseQuestionPopView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/4. +// + +#import "RefuseQuestionPopView.h" +#import "UIPlaceHolderTextView.h" +#import "YXCancelReasonModel.h" +@interface RefuseQuestionPopView () + +@property (nonatomic, strong) UIPlaceHolderTextView * beizhuTextView; + +@property (nonatomic, strong) YYLabel * questionLabel; +@property (nonatomic, strong) UITableView * reasourTable; + +@property (nonatomic, copy) NSString * reasour_id; +@property (nonatomic, copy) NSString * reasour_text; + +@end + +@implementation RefuseQuestionPopView + +/* +// 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); + + UIView * popView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(47), kRealValue(176), kScreenWidth - kRealValue(94), kRealValue(323))]; + + popView.backgroundColor = KWhiteColor; + + popView.layer.cornerRadius = 10.0f; + + popView.layer.masksToBounds = true; + +// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; +// [popView addGestureRecognizer:tap]; + + [self addSubview:popView]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(20), popView.width, 14)]; + titleLabel.text = @"拒绝原因"; + titleLabel.font = SYSTEMFONT(14); + titleLabel.textAlignment = NSTextAlignmentCenter; + titleLabel.textColor = CFontColor1; + [popView addSubview:titleLabel]; + + UILabel * stopLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(27), titleLabel.bottom + kRealValue(28), 40, 13)]; + stopLabel.text = @"原因:"; + stopLabel.font = MEDIUMFONT(13); + stopLabel.textAlignment = NSTextAlignmentRight; + stopLabel.textColor = UIColorHex(#666666); + [popView addSubview:stopLabel]; + + + UIView * questionView = [[UIView alloc] initWithFrame:CGRectMake(stopLabel.right + kRealValue(9),titleLabel.bottom + kRealValue(18), popView.width - stopLabel.right - kRealValue(35), kRealValue(30))]; + questionView.backgroundColor = KWhiteColor; + questionView.layer.cornerRadius = 10.0f; + questionView.layer.borderColor = UIColorHex(#CCCCCC).CGColor; + questionView.layer.borderWidth = 1.0; + questionView.layer.masksToBounds = true; + [popView addSubview:questionView]; + + UIButton * pubbtn = [[UIButton alloc] initWithFrame:CGRectMake(questionView.width - kRealValue(9) - 13, kRealValue(11), 13, 8)]; + [pubbtn setImage:[UIImage imageNamed:@"garyDown"] forState:UIControlStateNormal]; + [pubbtn addTarget:self action:@selector(cancelReasonAction) forControlEvents:UIControlEventTouchUpInside]; + [questionView addSubview:pubbtn]; + + YYLabel * questionLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kRealValue(13),0, popView.width - kRealValue(22) - 13, questionView.height)]; + questionLabel.text = @"时间不合适"; + self.questionLabel = questionLabel; + questionLabel.font = SYSTEMFONT(13); + questionLabel.textAlignment = NSTextAlignmentLeft; + questionLabel.textColor = CFontColor1; + [questionLabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + [self cancelReasonAction]; + }]; + [questionView addSubview:questionLabel]; + + + + + + UILabel * beizhuLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(27), questionView.bottom + kRealValue(27), 40, 13)]; + beizhuLabel.text = @"备注:"; + beizhuLabel.font = MEDIUMFONT(13); + beizhuLabel.textAlignment = NSTextAlignmentRight; + beizhuLabel.textColor = UIColorHex(#666666); + [popView addSubview:beizhuLabel]; + + self.beizhuTextView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(stopLabel.right + kRealValue(9),questionView.bottom + kRealValue(19), questionView.width, 132)]; + self.beizhuTextView.layer.cornerRadius = 5.0f; + self.beizhuTextView.layer.masksToBounds = true; + self.beizhuTextView.layer.borderColor = UIColorHex(#CCCCCC).CGColor; + self.beizhuTextView.layer.borderWidth = 1.0; + self.beizhuTextView.placeholder = @"请输入拒绝原因详细说明"; + self.beizhuTextView.placeholderColor = UIColorHex(#999999); + self.beizhuTextView.font = SYSTEMFONT(13); + [popView addSubview: self.beizhuTextView]; + + + + + UIButton * cancelbtn = [[UIButton alloc] initWithFrame:CGRectMake(popView.width - kRealValue(15) - 15 , kRealValue(15) , 15, 15)]; + [cancelbtn setImage:[UIImage imageNamed:@"close_Icon"] forState:UIControlStateNormal]; + [cancelbtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside]; + [popView addSubview:cancelbtn]; + + UIButton * submit = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(65), self.beizhuTextView.bottom + kRealValue(30) , popView.width - kRealValue(130), 35)]; + [submit setTitle:@"提交" forState:UIControlStateNormal]; + [submit setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [submit setBackgroundColor:UIColorHex(#21BEBD)]; + submit.layer.cornerRadius =17.5; + submit.layer.masksToBounds = true; + submit.titleLabel.font = SYSTEMFONT(14); + [submit addTarget:self action:@selector(subitAction) forControlEvents:UIControlEventTouchUpInside]; + [popView addSubview:submit]; + + + self.reasourTable = [[UITableView alloc] initWithFrame:CGRectMake(questionView.left + kRealValue(5), questionView.bottom, questionView.width - kRealValue(10), kRealValue(90)) style:UITableViewStyleGrouped]; + self.reasourTable.delegate = self; + self.reasourTable.dataSource = self; + self.reasourTable.backgroundColor = KWhiteColor; + self.reasourTable.hidden = YES; + [popView addSubview:self.reasourTable]; + + self.reasourTable.layer.shadowColor = RGBA(0, 0, 0, 0.3).CGColor; + + self.reasourTable.layer.shadowOffset = CGSizeMake(0, 0); + + self.reasourTable.layer.shadowOpacity = 1; + + self.reasourTable.clipsToBounds = false; + + +} + +- (void)subitAction { + + if (self.popBlock) { + + self.popBlock(self.beizhuTextView.text, self.reasour_id); + } +} + + +-(void)cancelAction { + + [self removeFromSuperview]; + +} + +- (void)handleTapGesture:(id)sender { + + self.reasourTable.hidden = true; +} + +- (void)cancelReasonAction { + + self.reasourTable.hidden = false; + +} + +- (void)setDataArray:(NSArray *)dataArray { + + _dataArray = dataArray; + if (_dataArray.count > 0) { + YXCancelReasonModel * model = _dataArray[0]; + self.reasour_id = model.value; + self.questionLabel.text = model.text; + } + + [self.reasourTable 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 +{ + YXCancelReasonModel * model = self.dataArray[indexPath.row]; + UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"STATUSCELL"]; + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"STATUSCELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.textLabel.text = model.text; + cell.textLabel.font = SYSTEMFONT(13); + return cell; + + + +} +//每行高度 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return kRealValue(30); +} + +- (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 +{ + + YXCancelReasonModel * model = self.dataArray[indexPath.row]; + self.reasour_id = model.value; + self.questionLabel.text = model.text; + self.reasourTable.hidden = YES; +} + + +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/IMUserInfoModel.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/IMUserInfoModel.h new file mode 100644 index 0000000..dbdc967 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/IMUserInfoModel.h @@ -0,0 +1,29 @@ +// +// 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; + +@property (nonatomic, copy) NSString * value; +@property (nonatomic, copy) NSString * text; +@property (nonatomic, copy) NSString * title; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/IMUserInfoModel.m b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/IMUserInfoModel.m new file mode 100644 index 0000000..0df806a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/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/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/HQRegisterViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/HQRegisterViewController.h new file mode 100644 index 0000000..77ccc8b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/HQRegisterViewController.h @@ -0,0 +1,16 @@ +// +// YXRegisterViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2024/1/26. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXRegisterViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginFoundPasswordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginFoundPasswordViewController.h new file mode 100644 index 0000000..3aa2783 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginFoundPasswordViewController.h @@ -0,0 +1,17 @@ +// +// YXLoginFoundPasswordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXLoginFoundPasswordViewController : YXBaseViewController + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginFoundPasswordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginFoundPasswordViewController.m new file mode 100644 index 0000000..72e5a6c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginFoundPasswordViewController.m @@ -0,0 +1,209 @@ +// +// YXLoginFoundPasswordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "YXLoginFoundPasswordViewController.h" +#import "YXLoginSetPasswordViewController.h" +#import "LVKeyboard.h" +#import "MQTextField.h" + +@interface YXLoginFoundPasswordViewController () + +@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 YXLoginFoundPasswordViewController + +- (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"]; + + YXNetAPI * chageApi = [[YXNetAPI 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; + + YXLoginSetPasswordViewController * password = [[YXLoginSetPasswordViewController 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/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginProtocolWebViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginProtocolWebViewController.h new file mode 100644 index 0000000..fd1e2bb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginProtocolWebViewController.h @@ -0,0 +1,16 @@ +// +// YXLoginProtocolWebViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2024/1/12. +// + +#import "YXBaseWebViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXLoginProtocolWebViewController : YXBaseWebViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginProtocolWebViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginProtocolWebViewController.m new file mode 100644 index 0000000..251f73b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginProtocolWebViewController.m @@ -0,0 +1,32 @@ +// +// YXLoginProtocolWebViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2024/1/12. +// + +#import "YXLoginProtocolWebViewController.h" + +@interface YXLoginProtocolWebViewController () + +@end + +@implementation YXLoginProtocolWebViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.isHidenNaviBar = false; +} + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginSetPasswordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginSetPasswordViewController.h new file mode 100644 index 0000000..fd14c5a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginSetPasswordViewController.h @@ -0,0 +1,18 @@ +// +// LoginSetPasswordViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXLoginSetPasswordViewController : YXBaseViewController + +@property (nonatomic, copy) NSString * result; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginSetPasswordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginSetPasswordViewController.m new file mode 100644 index 0000000..5fcba60 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXLoginSetPasswordViewController.m @@ -0,0 +1,178 @@ +// +// LoginSetPasswordViewController.m +// EscortProject +// +// Created by 仁康信息 on 2023/5/22. +// + +#import "YXLoginSetPasswordViewController.h" +#import "RSAObjC.h" + +@interface YXLoginSetPasswordViewController () + +@property (nonatomic, strong) UITextField * phoneTextFild; +@property (nonatomic, strong) UITextField * codeTextFild; + + +@end + + +@implementation YXLoginSetPasswordViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + 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]; + + 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]; + + + 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]; + [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 { + + + + if (ValidStr(self.phoneTextFild.text) || ValidStr(self.codeTextFild.text)) { + [EasyTextView showErrorText:@"请输入新密码"]; + return; + } + if ([self 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"]; + + YXNetAPI * chageApi = [[YXNetAPI 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]; + } + +} +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXRegisterViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXRegisterViewController.h new file mode 100644 index 0000000..77ccc8b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXRegisterViewController.h @@ -0,0 +1,16 @@ +// +// YXRegisterViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2024/1/26. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXRegisterViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXRegisterViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXRegisterViewController.m new file mode 100644 index 0000000..0aab0d2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/Login/YXRegisterViewController.m @@ -0,0 +1,262 @@ +// +// YXRegisterViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2024/1/26. +// + +#import "YXRegisterViewController.h" +#import "YXLoginProtocolWebViewController.h" +@interface YXRegisterViewController () + +@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 YXRegisterViewController + +- (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 { + + YXNetAPI * agreeAPI = [[YXNetAPI alloc] init:self tag:@"AGREEAPI" NeedToken:@""]; + + [agreeAPI getUserAgreementPrivacy:nil]; +} + +// 跳转用户协议 +- (void)tap +{ + + YXLoginProtocolWebViewController * webVC= [[YXLoginProtocolWebViewController 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) { + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:parmDic]; + if ([model.value integerValue] == 1) { + self.protocolString = model.text; + } + [dataArray addObject:model]; + + } + + } +} + + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [MBProgressHUD showInfoMessage: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/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/HQLoginViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/HQLoginViewController.h new file mode 100644 index 0000000..8c7d580 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/HQLoginViewController.h @@ -0,0 +1,16 @@ +// +// HQLoginViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXLoginViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/HQRegisterViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/HQRegisterViewController.h new file mode 100644 index 0000000..02eb0ff --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/HQRegisterViewController.h @@ -0,0 +1,16 @@ +// +// YXRegisterViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXRegisterViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/YXLoginViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/YXLoginViewController.h new file mode 100644 index 0000000..8c7d580 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/YXLoginViewController.h @@ -0,0 +1,16 @@ +// +// HQLoginViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXLoginViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/YXLoginViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/YXLoginViewController.m new file mode 100644 index 0000000..87faadd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Login_Register/register/YXLoginViewController.m @@ -0,0 +1,498 @@ +// +// HQLoginViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "YXLoginViewController.h" +#import "TUIC2CChatViewController.h" +#import "YXLoginFoundPasswordViewController.h" +#import "IMUserInfoModel.h" +#import "YXLoginProtocolWebViewController.h" +#import "RSAObjC.h" +#import "YXRegisterViewController.h" +#import "UIDevice+model.h" +#import "LVKeyboard.h" +#import "YXModifyPasswordViewController.h" + +@interface YXLoginViewController () + +@property (nonatomic, strong) UITextField * userNameField; + +@property (nonatomic, strong) UITextField * passwordField; + +@property (nonatomic, strong) UIButton * logoBtn; + +@property (nonatomic, strong) UIView * loginView; + +@property (nonatomic, strong) UIButton * privacyPolicyBtn; + +@property (nonatomic, strong) UIButton * agreenBtn; + +@property (nonatomic, strong) UIButton * regisBtn; + +@property (nonatomic, strong) IMUserInfoModel * model ; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@property (nonatomic, strong) LVKeyboard *keyboard; + +@property (nonatomic, strong) UIButton *toggleButton; + +@end + +@implementation YXLoginViewController + +- (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(@"loginTitle_Img"); + [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"); + [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 ]; +// +// + UITextField *passwordField = [[UITextField 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), kScreenWidth - 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), kScreenWidth - 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 * 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]; + [self.view addSubview:self.agreenBtn]; + if ([agree intValue] == 1) { + self.agreenBtn.selected = true; + }else + { + self.agreenBtn.selected = false; + } + //隐私 + YYLabel * yslabel = [[YYLabel alloc] initWithFrame:CGRectMake(self.agreenBtn.right + kRealValue(5) ,self.agreenBtn.top , kScreenWidth - self.agreenBtn.right - kRealValue(47), 40)]; + [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:UIColor.blueColor]; + [attributed setTextHighlight:protocolHightlight range:[string rangeOfString:@"《用户协议》"]]; + + YYTextHighlight * layHightlight = [[YYTextHighlight alloc] init]; + layHightlight.userInfo = @{@"隐私":@"《隐私政策》"}; + [layHightlight setColor:UIColor.blueColor]; + [attributed setTextHighlight:layHightlight range:[string rangeOfString:@"《隐私政策》"]]; + + + YYTextHighlight * shuoHightlight = [[YYTextHighlight alloc] init]; + shuoHightlight.userInfo = @{@"说明":@"《相关法律说明》"}; + [shuoHightlight setColor:UIColor.blueColor]; + [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) { + NSLog(@"%@, %@, %@, %@", containerView, text.string, NSStringFromRange(range), NSStringFromCGRect(rect)); + NSString *string = [text.string substringWithRange:range]; + NSLog(@"\n %@", string); + if ([string containsString:@"用户协议"]){ + for (IMUserInfoModel * model in self.dataArray) { + + if ([model.value integerValue] == 1) { + + YXLoginProtocolWebViewController * webVC= [[YXLoginProtocolWebViewController alloc] init]; + webVC.webTitle = @"用户协议"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + + } + if ([string containsString:@"隐私政策"]){ + for (IMUserInfoModel * model in self.dataArray) { + if ([model.value integerValue] == 2) { + + YXLoginProtocolWebViewController * webVC= [[YXLoginProtocolWebViewController alloc] init]; + webVC.webTitle = @"隐私政策"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + } + } + if ([string containsString:@"相关法律说明"]){ + for (IMUserInfoModel * model in self.dataArray) { + if ([model.value integerValue] == 3) { + + YXLoginProtocolWebViewController * webVC= [[YXLoginProtocolWebViewController alloc] init]; + webVC.webTitle = @"相关法律说明"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + } + } + }; + +} + +- (void)togglePasswordVisibility { + self.passwordField.secureTextEntry = !self.passwordField.secureTextEntry; + self.toggleButton.selected = !self.toggleButton.selected; +} + +#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) { + + YXLoginFoundPasswordViewController * modifVC = [[YXLoginFoundPasswordViewController alloc] init]; + [self.navigationController pushViewController:modifVC animated:YES]; + + }]; + [alertController addAction:cancelAction]; + [alertController addAction:sureAction]; + + [self presentViewController:alertController animated:YES completion:nil]; + + + 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]; + NSLog(@"加密后:%@", encryptStr); + + [self showMBProgressHUDWithString:@"登录中" autoHidden:YES]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.userNameField.text forKey:@"username"]; + [parmDic setObject:encryptStr forKey:@"password"]; + + //新增 + UIDevice *currentDevice = [UIDevice currentDevice]; + NSString * phone = [currentDevice getCurrentDeviceModel]; +// NSString * system = [NSString stringWithFormat:@"%.1f",CurrentSystemVersion] ; + [parmDic setObject:phone forKey:@"deviceType"]; + [parmDic setObject:@(CurrentSystemVersion) forKey:@"deviceSystem"]; + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"LOGINGAPI" NeedToken:nil]; + [proctocolApi PostLogin:parmDic]; + + + +} + +- (void)createData { + + YXNetAPI * agreeAPI = [[YXNetAPI alloc] init:self tag:@"AGREEAPI" NeedToken:@""]; + + [agreeAPI getUserAgreementPrivacy:nil]; + +} + +- (void)ishiderRegisData { + + + YXNetAPI * versionAPI = [[YXNetAPI alloc] init:self tag:@"VERSIONAPI" NeedToken:@""]; + + [versionAPI getVesionHideRegis:@{@"type":@"app_update_doctor_ios"}]; + + +} + +#pragma mark -网络请求处理 +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + + [self hiddenAllMBProgressHUD]; + [EasyTextView showErrorText:message]; +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + if ([tag isEqualToString:@"LOGINGAPI"]) { + + NSDictionary * dic = response; + YXUserInfo * user = [[YXUserInfo 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]; + 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]; + + TUICallEngine * engin = [TUICallEngine createInstance]; + + [engin init:[model.sdkAppId intValue] userId:model.userId userSig:model.userSig succ:^{ + [engin addObserver:self]; + } fail:^(int code, NSString * _Nullable errMsg) { + + }]; + + + } + if ([tag isEqualToString:@"AGREEAPI"]) { + + NSArray * array = response; + + for (NSDictionary * parmDic in array) { + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:parmDic]; + + [self.dataArray addObject:model]; + + } + + } + + if ([tag isEqualToString:@"VERSIONAPI"]) { + + NSString * version = response; + + NSBundle *mainBundle = [NSBundle mainBundle]; + if (mainBundle) { + NSString *version = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; + + if([version floatValue] < [version floatValue]) { + self.regisBtn.hidden = true; + }else + { + self.regisBtn.hidden = false; + } + } + } +} + +- (void)loginImAccount { + + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"IMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount:nil]; + + + +} + + +- (void)agreeProtocolAction:(UIButton *)agreeBtn { + + agreeBtn.selected = !agreeBtn.selected; + + +} +#pragma mark:找回密码 +- (void)foundUserPasswordAction { + + YXLoginFoundPasswordViewController * foundVC = [[YXLoginFoundPasswordViewController alloc] init]; + + [self.navigationController pushViewController:foundVC animated:YES]; +} + +#pragma mark:注册 +- (void)regisAction { + + YXRegisterViewController * forgetVc = [[YXRegisterViewController 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]; +} +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXAboutUsViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXAboutUsViewController.h new file mode 100644 index 0000000..474a03c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXAboutUsViewController.h @@ -0,0 +1,16 @@ +// +// YXAboutUsViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2024/1/15. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXAboutUsViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXAboutUsViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXAboutUsViewController.m new file mode 100644 index 0000000..15e6566 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXAboutUsViewController.m @@ -0,0 +1,236 @@ +// +// YXAboutUsViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2024/1/15. +// + +#import "YXAboutUsViewController.h" +#import "YXLoginProtocolWebViewController.h" + +@interface YXAboutUsViewController () + +@property (nonatomic, strong) UITableView * homeTableView; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation YXAboutUsViewController + +- (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 { + + YXNetAPI * agreeAPI = [[YXNetAPI 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) { + + IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:parmDic]; + + [self.dataArray addObject:model]; + + } + + } +} + + +#pragma mark - DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + if (section == 0) { + return 2; + } + 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) { + + for (IMUserInfoModel * model in self.dataArray) { + + if ([model.value integerValue] == 1) { + + YXLoginProtocolWebViewController * webVC= [[YXLoginProtocolWebViewController alloc] init]; + webVC.webTitle = @"用户协议"; + webVC.webUrl = [NSString stringWithFormat:@"%@%@",IntervenH5,model.text]; + [self.navigationController pushViewController:webVC animated:YES]; + } + + } + } + if (indexPath.row == 1) { + + for (IMUserInfoModel * model in self.dataArray) { + + if ([model.value integerValue] == 2) { + + YXLoginProtocolWebViewController * webVC= [[YXLoginProtocolWebViewController 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/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXGoodAtSicksViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXGoodAtSicksViewController.h new file mode 100644 index 0000000..58acff4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXGoodAtSicksViewController.h @@ -0,0 +1,24 @@ +// +// YXGoodAtSicksViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/10. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^SelectedSickBlock)(NSArray * sicksArray); + +@interface YXGoodAtSicksViewController : YXBaseViewController + +@property (nonatomic, copy) NSString * departmentId; + +@property (nonatomic, strong) NSMutableArray * sicksArray; + +@property (nonatomic, copy) SelectedSickBlock sicksBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXGoodAtSicksViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXGoodAtSicksViewController.m new file mode 100644 index 0000000..a29f390 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXGoodAtSicksViewController.m @@ -0,0 +1,251 @@ +// +// YXGoodAtSicksViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/10. +// + +#import "YXGoodAtSicksViewController.h" +#import "YXcustomDelectedView.h" +#import "YXDoctorInfoModel.h" +#import "ZHTagListView.h" + +@interface YXGoodAtSicksViewController () + +@property (nonatomic, strong) NSMutableArray * customArray; + +@property (nonatomic, strong) NSMutableArray * customDataArray; + +@property (nonatomic, strong) NSMutableArray * needArray; + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) ZHTagListView *tagList; + +@property (nonatomic, copy) NSString * reasonString; + +@property (nonatomic, strong) NSArray * buttonArray; + +@end + + +@implementation YXGoodAtSicksViewController + +- (NSMutableArray *)customArray { + + if(!_customArray) { + _customArray = [[NSMutableArray alloc] init]; + } + return _customArray; +} + + +- (NSMutableArray *)needArray { + + if(!_needArray) { + _needArray = [[NSMutableArray alloc] init]; + } + return _needArray; +} + + +- (NSMutableArray *)customDataArray { + + if (!_customDataArray) { + + _customDataArray = [[NSMutableArray alloc] init]; + } + + return _customDataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KWhiteColor; + self.isHidenNaviBar = false; + self.navigationItem.title = @"擅长病种"; + [self addNavigationItemWithTitles:@[@"确认"] isLeft:false target:self action:@selector(sureAction) tags:@[@"1111"]]; + [self createUI]; + [self createData]; +} + +- (void)sureAction { + +// NSMutableArray * needArray = [[NSMutableArray alloc] init]; + //如果不点击 + + + for (YXDoctorGoodSicknessModel * model in self.customDataArray) { + + for (NSString * sickName in self.sicksArray) { + + if ([sickName isEqualToString:model.sicksName]) { + + [self.needArray addObject:model]; + } + + } + } + self.sicksBlock(self.needArray); + //如果点击 + [self.navigationController popViewControllerAnimated:YES]; + + +} + + +- (void)createUI { + + self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + [self.view addSubview:self.mainScrollView]; + + NSMutableArray *_dataSource = @[@" ",@" ",@" ",@" "].mutableCopy; + + ZHTagListConfiguration *config = [ZHTagListConfiguration defaultConfiguration]; +// config.tagTextColor = UIColorHex(#21BEBD); + config.tagTextMargin = 11; + config.tagHeight = 27; + config.tagTextFont = SYSTEMFONT(14); + config.tagMaxWidth = kScreenWidth - kRealValue(30); + config.tagListViewInset = UIEdgeInsetsMake(15, 15, 15, 10); + + + ZHTagListView *tagList = [[ZHTagListView alloc] initWithFrame:CGRectMake(kRealValue(15), 0, self.mainScrollView.width - kRealValue(30), 0) configuration:config tagTexts:_dataSource]; + tagList.backgroundColor = KWhiteColor; + [self.mainScrollView addSubview:tagList]; + self.tagList = tagList; + [tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { +// [obj setBackgroundColor:KRedColor]; + + }]; + + +} + + + +- (void)createData { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:self.departmentId forKey:@"departmentId"]; + + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"ROOMINFO" NeedToken:@""]; + + [homeApi GetInquireDoctorRoomInfo:parmDic]; + +} +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + + if ([tag isEqualToString:@"ROOMINFO"]) { + + NSArray * resArray = response; + + NSMutableArray * dataArray = [[NSMutableArray alloc] init]; + + for (NSDictionary * dic in resArray) { + YXDoctorGoodSicknessModel * sickModel = [YXDoctorGoodSicknessModel modelWithDictionary:dic]; + [self.customDataArray addObject:sickModel]; + [dataArray addObject:sickModel.sicksName]; + } + //一样的数据 + NSMutableArray * samArray = [[NSMutableArray alloc] init]; + NSMutableArray * difArray = [[NSMutableArray alloc] init]; + + for ( NSString * allName in dataArray) { + + for (NSString * samString in self.sicksArray) { + + if ([allName isEqualToString:samString]) + { + [samArray addObject:allName]; + }else + { + [difArray addObject:allName]; + } + } + } + + + self.tagList.tags = dataArray; + + [self.tagList.tagButtonList enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + for (NSString * samString in samArray) { + + if ([obj.currentTitle isEqualToString:samString]) + { + [obj setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + obj.selected = true; + obj.layer.borderColor = UIColorHex(#21BEBD).CGColor; + break; + }else + { + [obj setTitleColor:CFontColor1 forState:UIControlStateNormal]; + obj.selected = false; + obj.layer.borderColor = UIColorHex(#666666).CGColor; + } + + } + + + + }]; + + + NSMutableArray * clickArray = [[NSMutableArray alloc] initWithArray:self.sicksArray]; + + [self.tagList setTagClickHandler:^(ZHTagListView *tagListView, NSString *tagText, NSUInteger index) { + UIButton * btn = tagListView.tagButtonList[index]; + self.reasonString = tagText; + btn.selected = !btn.selected; + if (btn.selected == true) { + [btn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + btn.selected = true; + btn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + }else + { + [btn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + btn.selected = false; + btn.layer.borderColor = UIColorHex(#666666).CGColor; + } + [clickArray removeAllObjects]; + for (UIButton * seleBtn in tagListView.tagButtonList) { + + if (seleBtn.selected == true) { + + [clickArray addObject:seleBtn.currentTitle]; + + } + + } + self.sicksArray = clickArray; + }]; + } + + +} + + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXMineViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXMineViewController.h new file mode 100644 index 0000000..b143eb2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXMineViewController.h @@ -0,0 +1,16 @@ +// +// YXMineViewController.h +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXMineViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXMineViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXMineViewController.m new file mode 100644 index 0000000..cabdd78 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXMineViewController.m @@ -0,0 +1,411 @@ +// +// YXMineViewController.m +// healthQuestion +// +// Created by xulei on 2022/8/17. +// + +#import "YXMineViewController.h" +#import "GraphView.h" +#import "AAChartKit.h" +#import "YXQuestionStatisticsViewController.h" +#import "YXStopAnnouncementViewController.h" +#import "YXUserCenterInfoViewController.h" +#import "YXModifyPasswordViewController.h" +#import "YXSchedulingSettingViewController.h" +#import "YXDoctorInfoModel.h" +#import "YXworkSetingViewController.h" +#import "YXStopQuestionSettingVC.h" +#import "YXHomePageModel.h" +#import "ChatViewController.h" +#import "TUIC2CChatViewController.h" +#import "YXAboutUsViewController.h" +@interface YXMineViewController () + +@property (strong, nonatomic) AAChartView * aaChartView; + +@property (strong, nonatomic) AAChartModel * configureAreaChartThreshold; + +@property (nonatomic, strong) UILabel * nameLabel; + +@property (nonatomic, strong) UILabel * workLabel; + +@property (nonatomic, strong) UILabel * hospatilLabel; + +@property (nonatomic, strong) UIImageView * heardImage; + +@property (nonatomic, strong) NSMutableArray * dataArray; + +@end + +@implementation YXMineViewController + +#pragma mark:懒加载 + +- (NSMutableArray *)dataArray { + + if (!_dataArray) { + _dataArray = [[NSMutableArray alloc] init]; + } + return _dataArray; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = false; + self.view.backgroundColor = UIColorHex(#EFEFEF); + self.navigationItem.title = @"我的"; + [self createUI]; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + [self docotrUserInfo]; + + +} + +- (void)docotrUserInfo { + + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"DoctorINFO" NeedToken:@""]; + + [homeApi GetInquireDoctorInfo:nil]; + +} + + +- (void) createUI{ + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(19), 100, 20)]; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = SYSTEMFONT(21); + self.nameLabel.text = @""; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + [self.view addSubview:self.nameLabel]; + + self.workLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameLabel.right + kRealValue(12), kRealValue(25), 100, 13)]; + self.workLabel.textColor = CFontColor1; + self.workLabel.font = SYSTEMFONT(13); + self.workLabel.text = @""; + CGFloat workW = [HQCommonUtils getLengthFromText:self.workLabel.text andFontSize:13]; + self.workLabel.width = workW; + self.workLabel.textAlignment = NSTextAlignmentLeft; + [self.view addSubview:self.workLabel]; + + self.hospatilLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), self.nameLabel.bottom + kRealValue(17), kScreenWidth - kRealValue(65), 20)]; + self.hospatilLabel.textColor = CFontColor1; + self.hospatilLabel.font = SYSTEMFONT(13); + self.hospatilLabel.text = @""; + self.hospatilLabel.textAlignment = NSTextAlignmentLeft; + [self.view addSubview:self.hospatilLabel]; + + self.heardImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(24) - 60, kRealValue(10), 60, 60)]; + self.heardImage.layer.cornerRadius = 30.0; + self.heardImage.layer.masksToBounds = true; + [self.view addSubview:self.heardImage]; + + UIView * toolsView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.heardImage.bottom + kRealValue(22), kScreenWidth - kRealValue(30), kRealValue(104))]; + toolsView.backgroundColor = KWhiteColor; + toolsView.layer.cornerRadius = 10; + toolsView.layer.masksToBounds = true; + [self.view addSubview:toolsView]; + [HQCommonUtils addShadowToView:toolsView]; + + CGFloat mager = (toolsView.width - kRealValue(28) - kRealValue(47) * 4)/3; + + NSArray * array = @[@[@"小助手",@"smallHelp_icon"],@[@"咨询统计",@"questionStatistics_icon"],@[@"排班设置",@"schedulingSeting_icon"],@[@"暂停服务",@"stopHelp_icon"]]; + for (int i = 0; i < array.count; i ++) { + + UIImageView * toolsImg = [[UIImageView alloc] initWithFrame:CGRectMake(kRealValue(14) + (kRealValue(47) + mager) * i , kRealValue(17), kRealValue(47), kRealValue(47))]; + toolsImg.image = [UIImage imageNamed:array[i][1]]; + [toolsView addSubview:toolsImg]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(toolsImg.left-kRealValue(10), toolsImg.bottom + kRealValue(10), toolsImg.width + kRealValue(20), 13)]; + titleLabel.text = array[i][0]; + titleLabel.font = SYSTEMFONT(13); + titleLabel.textColor = CFontColor1; + titleLabel.textAlignment = NSTextAlignmentCenter; + [toolsView addSubview:titleLabel]; + + UIButton * clickBtn = [[UIButton alloc] initWithFrame:CGRectMake(toolsImg.left, kRealValue(17), toolsImg.width, kRealValue(80))]; + clickBtn.tag = 500+ i; + [clickBtn addTarget:self action:@selector(toolsAction:) forControlEvents:UIControlEventTouchUpInside]; + [toolsView addSubview:clickBtn]; + } + + UIView * infoView = [[UIView alloc] initWithFrame:CGRectMake(toolsView.left, toolsView.bottom + kRealValue(10), toolsView.width, kRealValue(150))]; + infoView.backgroundColor = KWhiteColor; + infoView.layer.cornerRadius = 5; + infoView.layer.masksToBounds = true; + [self.view addSubview:infoView]; + [HQCommonUtils addShadowToView:infoView]; + + UITableView * table = [[UITableView alloc] initWithFrame:CGRectMake(toolsView.left, toolsView.bottom + kRealValue(10), toolsView.width, kRealValue(150))]; + table.delegate = self; + table.dataSource = self; + table.backgroundColor = KWhiteColor; + table.showsVerticalScrollIndicator = false; + table.showsHorizontalScrollIndicator = false; + table.layer.cornerRadius = 5; + table.layer.masksToBounds = true; + table.scrollEnabled = false; + table.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + [self.view addSubview:table]; + [HQCommonUtils addShadowToView:table]; + + + UIButton * outLoginBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(48), kScreenHeight - kTabBarHeight - kTopHeight -kRealValue(100) , kScreenWidth - kRealValue(96), kRealValue(40))]; + outLoginBtn.backgroundColor = KWhiteColor; + [outLoginBtn setTitle:@"退出登录" forState:UIControlStateNormal]; + [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 addTarget:self action:@selector(outLoginUserinfo) forControlEvents:UIControlEventTouchUpInside]; + outLoginBtn.layer.borderWidth = 1.0f; + [self.view addSubview:outLoginBtn]; + +} + +- (void)toolsAction:(UIButton *)toolsBtn { + + switch (toolsBtn.tag) { + case 500: + { + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"FOUNDSMALLAPI" NeedToken:@""]; + [homeApi getHomeFoundSmallHelpData:nil]; + //小助手 + } + break; + case 501: + { + //咨询统计 + YXQuestionStatisticsViewController * statisVc = [[YXQuestionStatisticsViewController alloc] init]; + + [self.navigationController pushViewController:statisVc animated:YES]; + + } + break; + case 502: + { + //时间 +// SchedulingSettingViewController * timeVc = [[SchedulingSettingViewController alloc] init]; +// +// [self.navigationController pushViewController:timeVc animated:YES]; + YXworkSetingViewController * statisVc = [[YXworkSetingViewController alloc] init]; + + [self.navigationController pushViewController:statisVc animated:YES]; + + } + break; + case 503: + { + //暂停服务 + YXStopQuestionSettingVC * stopVC = [[YXStopQuestionSettingVC alloc] init]; + + [self.navigationController pushViewController:stopVC animated:YES]; + } + break; + + default: + break; + } + +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 3; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + return kRealValue(50); + +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + NSArray * array = @[@[@"个人信息设置",@"mainHeard_icon"],@[@"账号安全设置(修改密码)",@"AccountSafety_icon"],@[@"关于我们",@"aboutUS_Icon"]]; + + UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"BILLCELL"]; + + if (!cell) { + + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BILLCELL"]; + } + cell.backgroundColor = KWhiteColor; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.imageView.image = [UIImage imageNamed:array[indexPath.row][1]]; + cell.textLabel.text = array[indexPath.row][0]; + cell.textLabel.font = SYSTEMFONT(14); + return cell; + +} + + +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (indexPath.row == 0) { + + YXUserCenterInfoViewController * infoVC = [[YXUserCenterInfoViewController alloc] init]; + + [self.navigationController pushViewController:infoVC animated:YES]; + } + if (indexPath.row == 1) { + + YXModifyPasswordViewController * modifVC = [[YXModifyPasswordViewController alloc] init]; + + [self.navigationController pushViewController:modifVC animated:YES]; + + } + if (indexPath.row == 2) { + + YXAboutUsViewController * aboutVC = [[YXAboutUsViewController alloc] init]; + + [self.navigationController pushViewController:aboutVC animated:YES]; + } + +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + + if ([tag isEqualToString:@"DoctorINFO"]) { + + NSDictionary * parDic = response; + + YXDoctorInfoModel * model = [YXDoctorInfoModel modelWithDictionary:parDic]; + self.nameLabel.text = model.doctorName; + CGFloat w = [HQCommonUtils getLengthFromText:self.nameLabel.text andFontSize:21]; + self.nameLabel.width = w; + self.workLabel.text = [NSString stringWithFormat:@"%@",model.doctorTitle] ; + self.workLabel.left = self.nameLabel.right + kRealValue(10); + CGFloat workW = [HQCommonUtils getLengthFromText:self.workLabel.text andFontSize:13]; + self.workLabel.width = workW; + self.hospatilLabel.text = [NSString stringWithFormat:@"%@ %@",model.resourceName,model.departmentName]; + + 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:[UIImage imageNamed:@"doctorNoImage"]]; + } + if ([tag isEqualToString:@"FOUNDSMALLAPI"]) { + + NSDictionary * responDic = response; + + YXZJSmallHelpModel * helpModel = [YXZJSmallHelpModel modelWithDictionary:responDic]; + + if ([ESCTUIManager TUIUserStatus] == false) { + + + [self loginImAccount]; + return; + } + + ChatViewController * chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.chatID = helpModel.groupId; + chatVC.smallHelp_id = helpModel.help_Id; + chatVC.member = helpModel.member; + chatVC.isVideo = YES; + chatVC.eableSendReport = YES; + chatVC.eableMapTools = false; + chatVC.isVideo = false; + chatVC.navTitle = @"小助手"; + chatVC.eablehaveHelathData = YES; + chatVC.memberSex = @"2"; + [self.navigationController pushViewController:chatVC 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]; + + // 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]; + + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"FOUNDSMALLAPI" NeedToken:@""]; + + [homeApi getHomeFoundSmallHelpData:nil]; + } + + +} + +- (void)loginImAccount { + + YXNetAPI * proctocolApi = [[YXNetAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [proctocolApi GetIMLoginAccount: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]; + + [self presentViewController:alertController animated:YES completion:nil]; +} + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXUserCenterInfoViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXUserCenterInfoViewController.h new file mode 100644 index 0000000..7f3ac37 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXUserCenterInfoViewController.h @@ -0,0 +1,16 @@ +// +// YXUserCenterInfoViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXUserCenterInfoViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXUserCenterInfoViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXUserCenterInfoViewController.m new file mode 100644 index 0000000..ae9ba04 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/YXUserCenterInfoViewController.m @@ -0,0 +1,631 @@ +// +// YXUserCenterInfoViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import "YXUserCenterInfoViewController.h" +#import "YXcustomDelectedView.h" +#import "UIPlaceHolderTextView.h" +#import "YXuserAddGoodPopView.h" +#import "YXDoctorInfoModel.h" +#import "YXGoodAtSicksViewController.h" + +@interface YXUserCenterInfoViewController () + +@property (nonatomic, strong) NSMutableArray * customArray; + +@property (nonatomic, strong) NSMutableArray * customDataArray; + +@property (nonatomic, strong) NSMutableArray * sicksArray; + + +@property (nonatomic, copy) NSString *departmentId; +@property (nonatomic, copy) NSString *doctor_Id; + + +@property (nonatomic, strong) UIScrollView * mainScrollView; + +@property (nonatomic, strong) UIPlaceHolderTextView * shanchangTextView; + +@property (nonatomic, strong) UIPlaceHolderTextView * jianjieTextView; + +@property (nonatomic, strong) UIImageView * headImg; + +@property(nonatomic,strong) UIAlertController *sheetVC;//选择框 + +@property (nonatomic, strong) UIView * bingView;//擅长病种 + +@property (nonatomic, strong) UIView * shangView;//个人擅长 + +@property (nonatomic, strong) UILabel * sinceLabel ; + +@property (nonatomic, assign) CGFloat sinceW ; + + +@end + +@implementation YXUserCenterInfoViewController + + +-(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:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { + }]; + + + + if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) + { + [_sheetVC addAction:takePhoto]; + } + [_sheetVC addAction:chosePhoto]; + [_sheetVC addAction:cancel]; + } + return _sheetVC; + +} + +- (NSMutableArray *)customArray { + + if (!_customArray) { + + _customArray = [[NSMutableArray alloc] init]; + } + + return _customArray; +} + +- (NSMutableArray *)customDataArray { + + if (!_customDataArray) { + + _customDataArray = [[NSMutableArray alloc] init]; + } + + return _customDataArray; +} + +- (NSMutableArray *)sicksArray { + + if (!_sicksArray) { + + _sicksArray = [[NSMutableArray alloc] init]; + } + + return _sicksArray; + +} +- (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 docotrUserInfo]; + +} + +- (void)docotrUserInfo { + + [self showMBProgressHUDWithString:@"数据加载中,请稍候" autoHidden:false]; + YXNetAPI * homeApi = [[YXNetAPI alloc] init:self tag:@"DoctorINFO" NeedToken:@""]; + + [homeApi GetInquireDoctorInfo:nil]; + +} + +- (void)createUI { + + UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth,kScreenHeight - kTopHeight - SafetyAreaHeight - 50)]; + self.mainScrollView = mainScrollView; + [self.view addSubview:mainScrollView]; + + UIView * topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 260)]; + topView.backgroundColor = KWhiteColor; + [mainScrollView addSubview:topView]; + + UILabel * headLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(24), 100, 14)]; + headLabel.text = @"头像"; + headLabel.textColor = CFontColor1; + headLabel.font = SYSTEMFONT(14); + headLabel.textAlignment = NSTextAlignmentLeft; + [topView addSubview:headLabel]; + + UIImageView * accowImg = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(15) - 12, kRealValue(25), 16, 22)]; + accowImg.image = [UIImage imageNamed:@"garyRight"]; + [topView addSubview:accowImg]; + + UIImageView * headImg = [[UIImageView alloc] initWithFrame:CGRectMake(accowImg.left - 57 , kRealValue(8), 45, 45)]; + self.headImg = headImg; + headImg.userInteractionEnabled = true; + [topView addSubview:headImg]; + + UIButton * changeBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - 77, 0, 77, headImg.height)]; + [changeBtn addTarget:self action:@selector(chageUserHeard) forControlEvents:UIControlEventTouchUpInside]; + [topView addSubview:changeBtn]; + + NSArray * titleArray = @[@[@"姓名",@"请输入姓名"],@[@"医院",@"请输入医院名称"],@[@"科室",@"请输入科室"],@[@"职称",@"请输入职称"]]; + for (int i = 0 ; i < titleArray.count; i ++) { + + UIView * lineView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(14), headImg.bottom + 9 + i * kRealValue(45), kScreenWidth - kRealValue(28), 1)]; + lineView.backgroundColor = UIColorHex(#E0E0E0); + [topView addSubview:lineView]; + + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(headLabel.left, lineView.bottom + kRealValue(15), 100, 14)]; + leftLabel.text = titleArray[i][0] ; + leftLabel.textColor = CFontColor1; + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.font = MEDIUMFONT(14); + [topView addSubview:leftLabel]; + + UITextField * inputField = [[UITextField alloc] initWithFrame:CGRectMake(topView.width - kRealValue(17) - 200, leftLabel.top, 200, 15)]; + inputField.placeholder = titleArray[i][1] ; + inputField.font = SYSTEMFONT(14); + inputField.textAlignment = NSTextAlignmentRight; + inputField.tag = 10 + i; + [topView addSubview:inputField]; + } + //擅长病种 + UIView * bingView = [[UIView alloc] initWithFrame:CGRectMake(0, topView.bottom + kRealValue(10), kScreenWidth, kRealValue(200))]; + bingView.backgroundColor = KWhiteColor; + self.bingView = bingView; + [mainScrollView addSubview:bingView]; + + UILabel * sinceLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), kRealValue(24), 55, 14)]; + sinceLabel.text = @"擅长病种"; + sinceLabel.textColor = CFontColor1; + sinceLabel.font = SYSTEMFONT(14); + sinceLabel.textAlignment = NSTextAlignmentLeft; + self.sinceLabel = sinceLabel; + CGFloat sinceW = [HQCommonUtils getLengthFromText:sinceLabel.text andFontSize:14]; + self.sinceW = sinceW; + sinceLabel.width = sinceW + 10; + [bingView addSubview:sinceLabel]; + + UIButton * addTagBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - kRealValue(10) - kRealValue(50), kRealValue(15), kRealValue(49), kRealValue(27))]; + [addTagBtn setTitle:@"添加" forState:UIControlStateNormal]; + [addTagBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [addTagBtn setBackgroundColor:KWhiteColor]; + [addTagBtn addTarget:self action:@selector(addUserInfo) forControlEvents:UIControlEventTouchUpInside]; + addTagBtn.layer.borderWidth = 1.0; + addTagBtn.layer.masksToBounds = YES; + addTagBtn.titleLabel.font = SYSTEMFONT(14); + addTagBtn.layer.cornerRadius = 13; + addTagBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + [bingView addSubview:addTagBtn]; + + + CGFloat pointX = sinceLabel.right; + CGFloat pointY = 10; + CGFloat allWidth = kScreenWidth-sinceW- 20; + UIFont *titleFont = [UIFont systemFontOfSize:14]; + for(int i = 0; i < self.customDataArray.count; i++) { + +// CGRect rect = [array[i] boundingRectWithSize:CGSizeMake(MAXFLOAT, 25) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : titleFont} context:nil]; + CGFloat width = 22; + + if (pointX + width > allWidth) {//换行 + pointX = sinceLabel.right;//X从新开始 + pointY += 40;//换行后Y+ + } + YXcustomDelectedView * custView = [[YXcustomDelectedView alloc] initWithFrame:CGRectMake(pointX, pointY, width, 25)]; + custView.delectBlock = ^(NSInteger btnTag) { + [self reloadCustomView:btnTag]; + }; + custView.btntag = 100 + i; + pointX += (width + 10);//每次X都加上宽和间距5 + + [bingView addSubview:custView]; + [self.customArray addObject:custView]; + } + UIView * lastView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), sinceLabel.bottom + kRealValue(10), 100, 13)]; + if (self.customArray.count > 0) { + + lastView = [self.customArray lastObject]; + } + bingView.height = lastView.bottom + 20; + + //个人擅长页面 + UIView * shangView = [[UIView alloc] initWithFrame:CGRectMake(0, bingView.bottom, kScreenWidth, kRealValue(500))]; + shangView.backgroundColor = KWhiteColor; + self.shangView = shangView; + [mainScrollView addSubview:shangView]; + + UILabel * gerenLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), 0, sinceLabel.width, 14)]; + gerenLabel.text = @"个人擅长"; + gerenLabel.textColor = CFontColor1; + gerenLabel.font = SYSTEMFONT(14); + gerenLabel.textAlignment = NSTextAlignmentLeft; + [shangView addSubview:gerenLabel]; + + self.shanchangTextView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(14), gerenLabel.bottom + kRealValue(15), kScreenWidth - kRealValue(28), 179)]; + self.shanchangTextView.placeholder = @"请输入个人擅长方向"; + self.shanchangTextView.font = SYSTEMFONT(14); + self.shanchangTextView.backgroundColor = UIColorHex(#EFEFEF); + self.shanchangTextView.layer.cornerRadius = 5; + self.shanchangTextView.layer.masksToBounds = true; + [shangView addSubview:self.shanchangTextView]; + + UILabel * jianjieLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), self.shanchangTextView.bottom + kRealValue(23), sinceLabel.width, 14)]; + jianjieLabel.text = @"个人简介"; + jianjieLabel.textColor = CFontColor1; + jianjieLabel.font = MEDIUMFONT(14); + jianjieLabel.textAlignment = NSTextAlignmentLeft; + [shangView addSubview:jianjieLabel]; + + self.jianjieTextView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(14), jianjieLabel.bottom + kRealValue(15), kScreenWidth - kRealValue(28), 179)]; + self.jianjieTextView.placeholder = @"请输入个人简介"; + self.jianjieTextView.font = SYSTEMFONT(14); + self.jianjieTextView.backgroundColor = UIColorHex(#EFEFEF); + self.jianjieTextView.layer.cornerRadius = 5; + self.jianjieTextView.layer.masksToBounds = true; + [shangView addSubview:self.jianjieTextView]; + + shangView.height = self.jianjieTextView.bottom + kRealValue(33); + + + + + UIButton * saveBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(47), kScreenHeight - SafetyAreaHeight - kTopHeight - 40, kScreenWidth - kRealValue(94), 40)]; + saveBtn.backgroundColor = KWhiteColor; + saveBtn.layer.cornerRadius = 20.0f; + saveBtn.layer.masksToBounds = true; + [saveBtn setTitle:@"保存" forState:UIControlStateNormal]; + [saveBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + saveBtn.titleLabel.font = SYSTEMFONT(14); + saveBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + saveBtn.layer.borderWidth = 1.0f; + [saveBtn addTarget:self action:@selector(saveUserInfo) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:saveBtn]; + mainScrollView.contentSize = CGSizeMake(kScreenWidth, shangView.bottom + SafetyAreaHeight + kRealValue(50)); + +} + +#pragma mark:删除病种 + +- (void)reloadCustomView:(NSInteger)btnTag { + + [self.customDataArray removeObjectAtIndex:btnTag]; + [self.sicksArray removeObjectAtIndex:btnTag]; + [self reloadCenterView:self.customDataArray]; +} + +#pragma marr:更新中间视图 + +- (void)reloadCenterView:(NSMutableArray *)customArray { + + for (YXcustomDelectedView * cusView in self.customArray) { + + [cusView removeFromSuperview]; + } + + CGFloat pointX = self.sinceLabel.right; + CGFloat pointY = 10; + CGFloat allWidth = kScreenWidth-self.sinceW- 20; + UIFont *titleFont = [UIFont systemFontOfSize:14]; + for(int i = 0; i < customArray.count; i++) { + + CGRect rect = [customArray[i] boundingRectWithSize:CGSizeMake(MAXFLOAT, 25) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : titleFont} context:nil]; + CGFloat width = rect.size.width +22; + + if (pointX + width > allWidth) {//换行 + pointX = self.sinceLabel.right;//X从新开始 + pointY += 40;//换行后Y+ + } + YXcustomDelectedView * custView = [[YXcustomDelectedView alloc] initWithFrame:CGRectMake(pointX, pointY, width, 25)]; + custView.delectBlock = ^(NSInteger btnTag) { + [self reloadCustomView:btnTag]; + }; + custView.btntag = 100 + i; + custView.titleString = customArray[i]; + pointX += (width + 10);//每次X都加上宽和间距5 + + [self.bingView addSubview:custView]; + [self.customArray addObject:custView]; + } + UIView * lastView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), self.sinceLabel.bottom + kRealValue(10), 100, 13)]; + if (self.customArray.count > 0) { + + lastView = [self.customArray lastObject]; + } + self.bingView.height = lastView.bottom + 30; + self.shangView.frame = CGRectMake(0, self.bingView.bottom, kScreenWidth, kRealValue(500)); + self.shangView.height = self.jianjieTextView.bottom + kRealValue(33); + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth, self.shangView.bottom + SafetyAreaHeight + kRealValue(50)); + +} + +#pragma mark:添加擅长病种 +- (void)addUserInfo { + +// userAddGoodPopView * popView = [[userAddGoodPopView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; +// MJWeakSelf +// popView.popBlock = ^(NSString * _Nonnull inputString) +// { +// +// [weakSelf.customDataArray addObject:inputString]; +// [weakSelf reloadCenterView:weakSelf.customDataArray]; +// }; +// popView.alpha = 0; +// +// [kAppWindow addSubview:popView]; +// +// [UIView animateWithDuration:0.5 animations:^{ +// popView.alpha = 1; +// }]; + YXGoodAtSicksViewController * goodVC = [[YXGoodAtSicksViewController alloc] init]; + goodVC.departmentId = self.departmentId; + goodVC.sicksArray = self.customDataArray; + goodVC.sicksBlock = ^(NSArray * _Nonnull sicksArray) { + [self.customDataArray removeAllObjects]; + [self.sicksArray removeAllObjects]; + + self.sicksArray = sicksArray.mutableCopy; + + for (YXDoctorGoodSicknessModel * sickModel in sicksArray) { + + [self.customDataArray addObject:sickModel.sicksName]; + [self reloadCenterView:self.customDataArray]; + + } + }; + [self.navigationController pushViewController:goodVC animated:YES]; +} + +#pragma mark:更新头像 +- (void)chageUserHeard { + + [self presentViewController:self.sheetVC animated:YES completion:nil]; + +} + +- (void)pushImagePickerController +{ + UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; + imagePickerController.delegate = self; + imagePickerController.allowsEditing = YES; + imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; + [self presentViewController:imagePickerController animated:YES completion:^{}]; +} + +- (void)takePhoto +{ + // 跳转到相机或相册页面 + UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; + imagePickerController.delegate = self; + imagePickerController.allowsEditing = YES; + imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; + [self presentViewController:imagePickerController animated:YES completion:^{}]; +} + +#pragma mark - image picker delegte +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + [picker dismissViewControllerAnimated:YES completion:^{}]; + //先把图片转成NSData + NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; + //当选择的类型是图片 + if ([type isEqualToString:@"public.image"]) + { + //先把图片转成NSData + UIImage* image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; + + NSData *data; + if (UIImagePNGRepresentation(image) == nil) + { + data = UIImageJPEGRepresentation(image, 1.0); + } + else + { + data = UIImagePNGRepresentation(image); + } + self.headImg.image=image; + + //上传图片 + [self upHeardPhoto]; + + //图片保存的路径 + //这里将图片放在沙盒的documents文件夹中 + NSString * DocumentsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; + + //文件管理器 + NSFileManager *fileManager = [NSFileManager defaultManager]; + + //把刚刚图片转换的data对象拷贝至沙盒中 并保存为image.png + [fileManager createDirectoryAtPath:DocumentsPath withIntermediateDirectories:YES attributes:nil error:nil]; + [fileManager createFileAtPath:[DocumentsPath stringByAppendingString:@"/image.png"] contents:data attributes:nil]; + [picker dismissViewControllerAnimated:YES completion:nil ]; + } + + +} +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker +{ + [self dismissViewControllerAnimated:YES completion:^{}]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + [self hiddenAllMBProgressHUD]; + + + if ([tag isEqualToString:@"DoctorINFO"]) { + + NSDictionary * parDic = response; + + YXDoctorInfoModel * model = [YXDoctorInfoModel modelWithDictionary:parDic]; + self.doctor_Id = model.doctor_Id; + //姓名 + UITextField * nameField = [self.view viewWithTag:10]; + nameField.text = model.doctorName; + //医院 + UITextField * hospitalField = [self.view viewWithTag:11]; + hospitalField.text = model.resourceName; + //科室 + UITextField * roomField = [self.view viewWithTag:12]; + roomField.text = model.departmentName; + //职称 + UITextField * workField = [self.view viewWithTag:13]; + workField.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.headImg sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:PLACEHOLD_IMG]; + // + [self.customArray removeAllObjects]; + self.sicksArray = model.goodAtSicknessName; + for (YXDoctorGoodSicknessModel * sickModel in model.goodAtSicknessName) { + [self.customDataArray addObject:sickModel.sicksName]; + [self reloadCenterView:self.customDataArray]; + + } + //个人擅长 + self.shanchangTextView.text = model.goodAt; + //个人简介 + self.jianjieTextView.text = model.introduction; + self.departmentId = model.departmentId; + + } + if ([tag isEqualToString:@"UPLOADAPI"]) + { + NSMutableArray * imageUrlArray = [[NSMutableArray alloc] init]; + + NSArray * array = response; + + [imageUrlArray addObjectsFromArray:array]; + + NSString * headImg ; + for (NSString * imageString in imageUrlArray) { + + headImg = imageString; + } + [self updateUserHeard:headImg]; + } + if ([tag isEqualToString:@"DOCTORINFO"]) { + + [self.navigationController popViewControllerAnimated:YES]; + } + +} + +#pragma mark:上传图片 + +- (void)upHeardPhoto { + + [self showMBProgressHUDWithString:@"上传中" autoHidden:NO]; + + NSMutableArray * photoArray = [[NSMutableArray alloc] init]; + + [photoArray addObject:self.headImg.image]; + + YXNetAPI * upApi = [[YXNetAPI alloc] init:self tag:@"UPLOADAPI" NeedToken:@""]; + + [upApi postImageArrayUpload:photoArray]; +} + +#pragma mark:更新头像 + +- (void)updateUserHeard:(NSString *)heardImg { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + [parmDic setObject:heardImg forKey:@"avatar"]; + + YXNetAPI * upApi = [[YXNetAPI alloc] init:self tag:@"AVATAR" NeedToken:@""]; + + [upApi updateUserAvatar:parmDic]; + +} + +#pragma mark:保存 +- (void)saveUserInfo { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + + //姓名 + UITextField * nameField = [self.view viewWithTag:10]; + [parmDic setObject:nameField.text forKey:@"doctorName"]; + //医院 + UITextField * hospitalField = [self.view viewWithTag:11]; + [parmDic setObject:hospitalField.text forKey:@"resourceName"]; + //科室 + UITextField * roomField = [self.view viewWithTag:12]; + [parmDic setObject:roomField.text forKey:@"departmentName"]; + //职称 + UITextField * workField = [self.view viewWithTag:13]; + [parmDic setObject:workField.text forKey:@"doctorTitle"]; + //擅长病重 +// for (DoctorGoodSicknessModel * sickModel in self.sicksArray) { +// [self.customDataArray addObject:sickModel.sicksName]; +// [self reloadCenterView:self.customDataArray]; +// } + NSMutableArray * array = [[NSMutableArray alloc] init]; + NSMutableString *resultString = [[NSMutableString alloc] init]; + + for (YXDoctorGoodSicknessModel * sickMode in self.sicksArray) { + NSMutableDictionary * sickDic = [[NSMutableDictionary alloc] init]; + [sickDic setObject:sickMode.sicks_id forKey:@"id"]; + [sickDic setObject:sickMode.sicksName forKey:@"sicksName"]; + [array addObject:sickDic]; + [resultString appendString:sickMode.sicks_id]; + [resultString appendString:@","]; + // 移除末尾的拼接字符 + + } + //去掉最后符合 + if ([resultString length] > 0) { + [resultString deleteCharactersInRange:NSMakeRange([resultString length] - 1, 1)]; + } + [parmDic setObject:array forKey:@"goodAtSicknessName"]; + //个人简介 + + [parmDic setObject:resultString forKey:@"goodAtSickness"]; + + [parmDic setObject:self.shanchangTextView.text forKey:@"goodAt"]; + + [parmDic setObject:self.jianjieTextView.text forKey:@"introduction"]; + [parmDic setObject:self.departmentId forKey:@"departmentId"]; + [parmDic setObject:self.doctor_Id forKey:@"id"]; + YXNetAPI * infoApi = [[YXNetAPI alloc] init:self tag:@"DOCTORINFO" NeedToken:@""]; + + [infoApi postUpdateDoctorInfo: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/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/modifyPassword(修改密码)/YXModifyPasswordViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/modifyPassword(修改密码)/YXModifyPasswordViewController.h new file mode 100644 index 0000000..3f1f33d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/modifyPassword(修改密码)/YXModifyPasswordViewController.h @@ -0,0 +1,18 @@ +// +// YXModifyPasswordViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXModifyPasswordViewController : YXBaseViewController + +@property (nonatomic, copy) NSString * result; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/modifyPassword(修改密码)/YXModifyPasswordViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/modifyPassword(修改密码)/YXModifyPasswordViewController.m new file mode 100644 index 0000000..ccf6ea3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/modifyPassword(修改密码)/YXModifyPasswordViewController.m @@ -0,0 +1,214 @@ +// +// YXModifyPasswordViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXModifyPasswordViewController.h" + +#import "LineTextField.h" +#import "RSAObjC.h" +#import "LVKeyboard.h" + +@interface YXModifyPasswordViewController () + +@property (nonatomic, strong) LineTextField * oldPasswordField; + +@property (nonatomic, strong) LineTextField * nowPasswordField; + +@property (nonatomic, strong) LineTextField * againPasswordField; + +@end + +@implementation YXModifyPasswordViewController + +- (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, 156)]; + topview.backgroundColor = KWhiteColor; + [self.view addSubview:topview]; + + self.oldPasswordField = [self createTextFieldWithFrame:CGRectMake(kRealValue(16), 0, kScreenWidth - kRealValue(32), 52) withLeftText:@"原密码" isShow:false]; + self.oldPasswordField.placeholder = @"请输入原密码"; + self.oldPasswordField.backgroundColor = KWhiteColor; + self.oldPasswordField.delegate = self; +// [self.oldPasswordField becomeFirstResponder]; + [topview addSubview:self.oldPasswordField]; + + self.nowPasswordField = [self createTextFieldWithFrame:CGRectMake(kRealValue(16), self.oldPasswordField.bottom, kScreenWidth - kRealValue(32), 52) withLeftText:@"新密码" isShow:YES]; + self.nowPasswordField.backgroundColor = KWhiteColor; + self.nowPasswordField.placeholder = @"请输入新密码"; + self.nowPasswordField.delegate = self; + [topview addSubview:self.nowPasswordField]; + + self.againPasswordField = [self createTextFieldWithFrame:CGRectMake(kRealValue(16), self.nowPasswordField.bottom, kScreenWidth - kRealValue(32), 52) withLeftText:@"确认密码" isShow:YES]; + self.againPasswordField.backgroundColor = KWhiteColor; + self.againPasswordField.placeholder = @"再次输入新密码"; + self.againPasswordField.delegate = self; + [topview addSubview:self.againPasswordField]; + + UILabel * showLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(16), topview.bottom + kRealValue(14), kScreenWidth - kRealValue(32), 40)]; + showLabel.text = @"温馨提示:密码需要为12-32位(包含数字、大写、小写字母、特殊字符)"; + showLabel.textColor = UIColorHex(#999999); + showLabel.font = SYSTEMFONT(13); + showLabel.numberOfLines = 2; + showLabel.textAlignment = NSTextAlignmentLeft; + [self.view addSubview:showLabel]; + + + UIButton * submitBtn = [[UIButton alloc] init]; + submitBtn.backgroundColor = KWhiteColor; + submitBtn.layer.cornerRadius = 20; + submitBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + submitBtn.layer.borderWidth = 1.0f; + [submitBtn setTitle:@"提交" forState:UIControlStateNormal]; + [submitBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [submitBtn addTarget:self action:@selector(submitPasswordAction) forControlEvents:UIControlEventTouchUpInside]; + submitBtn.titleLabel.font = SYSTEMFONT(14); + [self.view addSubview:submitBtn]; + + [submitBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_offset(40); + make.left.mas_equalTo(@47); + make.right.mas_offset(-47); + make.top.mas_equalTo(showLabel.mas_bottom).offset(60); + }]; +} + +- (LineTextField *)createTextFieldWithFrame:(CGRect)frame + withLeftText:(NSString *)leftString + isShow:(BOOL)isShow{ + + LineTextField * textField = [[LineTextField alloc] initWithFrame:frame]; + + UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 90, 52)]; + UILabel * leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(15), leftView.width, 13)]; + leftLabel.centerY = leftView.centerY; + leftLabel.textColor = CFontColor2; + leftLabel.text = leftString; + leftLabel.textAlignment = NSTextAlignmentLeft; + leftLabel.font = MEDIUMFONT(13); + [leftView addSubview:leftLabel]; + textField.leftView = leftView; + textField.leftViewMode = UITextFieldViewModeAlways; + textField.secureTextEntry = isShow; + + return textField; + +} + +- (void)submitPasswordAction { + + if ( (self.nowPasswordField.text.length >= 33 && self.oldPasswordField.text.length < 12) || (self.againPasswordField.text.length >= 33 && self.againPasswordField.text.length < 12)) { + + [MBProgressHUD showErrorMessage:@"请输入12-32位的密码"]; + return; + + } + + if (!isValidPassword(self.nowPasswordField.text) || !isValidPassword(self.againPasswordField.text)) { + [EasyTextView showErrorText:@"请按照密码规则,请重新输入"]; + return; + } + + if (![self.nowPasswordField.text isEqualToString:self.againPasswordField.text]) { + + [MBProgressHUD showErrorMessage:@"两次输入不一致,请重新输入"]; + return; + } + //username 登录账号 oldpassword 老密码 password 新密码 confirmpassword 二次确认的密码 + YXUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + + NSString * publish_key = @" MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmZfR/bA9X3vp86y1aEpvwzXJYKRRF1fLau2+05/ZtaITLpV8bhkmSf3neSy/Q9gAdvG75Fr73E+GWE+K5b0BpvIS1jDGo319+PpZR39SaZTKZ27XFXrosmJTZutN79t819HS1VseleunHAFgMVufE9U5jP6LGzl/wbkSy01GhzwIDAQAB"; + + // 原始数据,要加密的字符串 + NSString * oldString = self.oldPasswordField.text; + + // RSA 加密,使用字符串格式的公钥私钥加密解密, RSAPublickKey 为公钥字符串(NSString 格式) + NSString * oldEncryptStr = [RSAObjC encrypt:oldString PublicKey:publish_key]; + NSLog(@"加密后:%@", oldEncryptStr); + + + + NSString * password = self.nowPasswordField.text; + NSString * passwordEncryptStr = [RSAObjC encrypt:password PublicKey:publish_key]; + + NSString * confirmpassword = self.againPasswordField.text; + NSString * confirmEncryptStr = [RSAObjC encrypt:confirmpassword PublicKey:publish_key]; + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:user.username forKey:@"username"]; + [parmDic setObject:oldEncryptStr forKey:@"oldpassword"]; + [parmDic setObject:passwordEncryptStr forKey:@"password"]; + [parmDic setObject:confirmEncryptStr forKey:@"confirmpassword"]; + YXNetAPI * passwordApi = [[YXNetAPI alloc] init:self tag:@"PASSWORDAPI" NeedToken:@""]; + [passwordApi updateDoctorLoginPassword:parmDic]; +} + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + [EasyTextView showErrorText:message]; + +} + + +- (void)Sucess:(id)response tag:(NSString*)tag +{ + + + if ([tag isEqualToString:@"PASSWORDAPI"]) { + NSString * message = response; + + [EasyTextView showSuccessText:message]; + + + + double delayInSeconds = 2.0; + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ + [self.navigationController popToRootViewControllerAnimated:YES]; + }); + + } +} +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]; +} + +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + if ([string isEqualToString:@"!"]) { // 检测是否是中文感叹号 + NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:@"!"]; // 将其替换为英文感叹号 + textField.text = newString; + return NO; + } + return 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/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXCustomSchedulingViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXCustomSchedulingViewController.h new file mode 100644 index 0000000..a6a37c5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXCustomSchedulingViewController.h @@ -0,0 +1,16 @@ +// +// YXCustomSchedulingViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXCustomSchedulingViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXCustomSchedulingViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXCustomSchedulingViewController.m new file mode 100644 index 0000000..84cdae0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXCustomSchedulingViewController.m @@ -0,0 +1,73 @@ +// +// YXCustomSchedulingViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "YXCustomSchedulingViewController.h" +#import "YXCustomSchedulingTable.h" +#import "YXAddSchedulingTimeTableViewCell.h" + +@interface YXCustomSchedulingViewController () + +@property (nonatomic, strong) YXCustomSchedulingTable * homeTable; + +@end + +@implementation YXCustomSchedulingViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = UIColorHex(#EFEFEF); + self.isHidenNaviBar = false; + self.navigationItem.title = @"排班设置"; + [self createUI]; + // Do any additional setup after loading the view. +} + +- (void)createUI { + + UIButton * submitBtn = [[UIButton alloc] init]; + submitBtn.backgroundColor = KWhiteColor; + submitBtn.layer.cornerRadius = 20; + submitBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + submitBtn.layer.borderWidth = 1.0f; + [submitBtn setTitle:@"生成排班" forState:UIControlStateNormal]; + [submitBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [submitBtn addTarget:self action:@selector(submitTimeAction) forControlEvents:UIControlEventTouchUpInside]; + submitBtn.titleLabel.font = SYSTEMFONT(14); + [self.view addSubview:submitBtn]; + + [submitBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(@150); + make.height.mas_offset(34); + make.centerX.mas_equalTo(self.view); + make.bottom.mas_equalTo(@-10); + }]; + + self.homeTable = [[YXCustomSchedulingTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + self.homeTable.backgroundColor = UIColorHex(#EFEFEF); + self.homeTable.addDelegate = self; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.mas_offset(15); + make.right.mas_offset(-15); + make.bottom.mas_equalTo(submitBtn.mas_top).offset(-15); + }]; + + +} + +/* +#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/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXSchedulingSettingViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXSchedulingSettingViewController.h new file mode 100644 index 0000000..d1b748d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXSchedulingSettingViewController.h @@ -0,0 +1,16 @@ +// +// YXSchedulingSettingViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSchedulingSettingViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXSchedulingSettingViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXSchedulingSettingViewController.m new file mode 100644 index 0000000..a4db6c2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/controller/schedulingSetting(排班设置)/YXSchedulingSettingViewController.m @@ -0,0 +1,133 @@ +// +// YXSchedulingSettingViewController.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXSchedulingSettingViewController.h" +#import "YXSchedulingSetingTable.h" +#import "YXSchedulingSettingModel.h" +#import "YXAddSchedulingTimeTableViewCell.h" +#import "YXDTTestView.h" +#import "YXCustomSchedulingViewController.h" + +@interface YXSchedulingSettingViewController () + +@property (nonatomic, strong) YXSchedulingSetingTable * homeTable; + +@end + +@implementation YXSchedulingSettingViewController + +- (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]; + [self createData]; +} + +- (void)createUI { + + UIButton * customBtn = [[UIButton alloc] init]; + customBtn.backgroundColor = KClearColor; + [customBtn setTitle:@"自定义排班" forState:UIControlStateNormal]; + [customBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [customBtn addTarget:self action:@selector(customAction) forControlEvents:UIControlEventTouchUpInside]; + customBtn.titleLabel.font = SYSTEMFONT(14); + [self.view addSubview:customBtn]; + + [customBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_offset(40); + make.left.mas_equalTo(@113); + make.right.mas_offset(-133); + make.bottom.mas_equalTo(-20); + }]; + + + UIButton * submitBtn = [[UIButton alloc] init]; + submitBtn.backgroundColor = KWhiteColor; + submitBtn.layer.cornerRadius = 20; + submitBtn.layer.borderColor = UIColorHex(#21BEBD).CGColor; + submitBtn.layer.borderWidth = 1.0f; + [submitBtn setTitle:@"生成排班" forState:UIControlStateNormal]; + [submitBtn setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + [submitBtn addTarget:self action:@selector(submitTimeAction) forControlEvents:UIControlEventTouchUpInside]; + submitBtn.titleLabel.font = SYSTEMFONT(14); + [self.view addSubview:submitBtn]; + + [submitBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.width.left.right.mas_equalTo(customBtn); + make.bottom.mas_equalTo(customBtn.mas_top).offset(-10); + }]; + + + + self.homeTable = [[YXSchedulingSetingTable alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + self.homeTable.backgroundColor = UIColorHex(#EFEFEF); + self.homeTable.addDelegate = self; + [self.view addSubview:self.homeTable]; + + [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.mas_offset(15); + make.right.mas_offset(-15); + make.bottom.mas_equalTo(submitBtn.mas_top).offset(-15); + }]; + + + +} + +- (void)createData { + + NSArray * dataArray = @[@{@"time":@"08:00-12:00",@"isSelected":@NO},@{@"time":@"08:00-12:00",@"isSelected":@YES},@{@"time":@"08:00-12:00",@"isSelected":@NO}]; + + NSMutableArray * timeArray = [[NSMutableArray alloc] init]; + + for (NSDictionary * parDic in dataArray) { + + YXSchedulingSettingModel * model = [YXSchedulingSettingModel modelWithDictionary:parDic]; + + [timeArray addObject:model]; + } +// [timeArray removeAllObjects]; + self.homeTable.timeArray = timeArray; +} +#pragma mark:新增时间段 +- (void)addSchedulingTime { + + YXDTTestView *vi = [[YXDTTestView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; + [kAppWindow addSubview:vi]; + vi.returnBlock = ^(NSString *startTime, NSString *endTime) { + NSLog(@"开始时间 = %@", startTime); + NSLog(@"结束时间 = %@", endTime); + + }; + +} + +- (void)submitTimeAction { + + +} + +- (void)customAction { + + YXCustomSchedulingViewController * customvc = [[YXCustomSchedulingViewController alloc] init]; + + [self.navigationController pushViewController:customvc 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/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/HQMineModel.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/HQMineModel.h new file mode 100644 index 0000000..a05da04 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/HQMineModel.h @@ -0,0 +1,17 @@ +// +// HQMineModel.h +// healthQuestion +// +// Created by 仁康信息 on 2022/9/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HQMineModel : NSObject + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/HQMineModel.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/HQMineModel.m new file mode 100644 index 0000000..6850ec1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/HQMineModel.m @@ -0,0 +1,12 @@ +// +// HQMineModel.m +// healthQuestion +// +// Created by 仁康信息 on 2022/9/9. +// + +#import "HQMineModel.h" + +@implementation HQMineModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXBillListModel.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXBillListModel.h new file mode 100644 index 0000000..246a087 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXBillListModel.h @@ -0,0 +1,40 @@ +// +// YXBillListModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXBillListDetailModel : NSObject + +@property (nonatomic, copy) NSString * bill_id; +@property (nonatomic, copy) NSString * sessionId; +@property (nonatomic, copy) NSString * userId; +@property (nonatomic, copy) NSString * userName; +@property (nonatomic, copy) NSString * operateType; +@property (nonatomic, copy) NSString * operateType_dictText; +@property (nonatomic, copy) NSString * incomeTime; +@property (nonatomic, copy) NSString * accountMoney; +@property (nonatomic, copy) NSString * income; +@property (nonatomic, copy) NSString * waterType; +@property (nonatomic, copy) NSString * operateTypeName; +@property (nonatomic, copy) NSString * createTime; + +@end + + +@interface YXBillListModel : NSObject + +@property (nonatomic, copy) NSArray * records; +@property (nonatomic, copy) NSString * optimizeCountSql; +@property (nonatomic, copy) NSString * searchCount; +@property (nonatomic, copy) NSString * total; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXBillListModel.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXBillListModel.m new file mode 100644 index 0000000..5e31de1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXBillListModel.m @@ -0,0 +1,32 @@ +// +// YXBillListModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/17. +// + +#import "YXBillListModel.h" + +@implementation YXBillListDetailModel + + ++ (NSDictionary *)modelCustomPropertyMapper +{ + NSDictionary * dic =@{@"bill_id" :@"id"}; + return dic; +} + +@end + +@implementation YXBillListModel + ++ (NSDictionary *)modelContainerPropertyGenericClass +{ + + + return @{@"records":[YXBillListDetailModel class], + }; + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXSchedulingSettingModel.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXSchedulingSettingModel.h new file mode 100644 index 0000000..cf8a8f1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXSchedulingSettingModel.h @@ -0,0 +1,20 @@ +// +// YXSchedulingSettingModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSchedulingSettingModel : NSObject + +@property (nonatomic, copy) NSString * time; + +@property (nonatomic, assign) BOOL isSelected; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXSchedulingSettingModel.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXSchedulingSettingModel.m new file mode 100644 index 0000000..6b6cfe1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/model/YXSchedulingSettingModel.m @@ -0,0 +1,12 @@ +// +// YXSchedulingSettingModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXSchedulingSettingModel.h" + +@implementation YXSchedulingSettingModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/AddSchedulingTimeTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/AddSchedulingTimeTableViewCell.h new file mode 100644 index 0000000..8b79015 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/AddSchedulingTimeTableViewCell.h @@ -0,0 +1,24 @@ +// +// YXAddSchedulingTimeTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol schedulingTimeAddProtocol + +- (void)addSchedulingTime; + +@end + +@interface YXAddSchedulingTimeTableViewCell : UITableViewCell + +@property (nonatomic, weak)id addDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/CustomSchedulingTable.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/CustomSchedulingTable.h new file mode 100644 index 0000000..11155ad --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/CustomSchedulingTable.h @@ -0,0 +1,28 @@ +// +// YXCustomSchedulingTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import +#import "YXSectionOneTableViewCell.h" +#import "YXTimeDisanceTableViewCell.h" +#import "YXAddSchedulingTimeTableViewCell.h" +#import "YXVideoAudioTableViewCell.h" +#import "YXSchedulingDateTableViewCell.h" +#import "YXJumpHolidayTableViewCell.h" +#import "WeakTitleTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXCustomSchedulingTable : UITableView + +@property (nonatomic, strong) NSArray * timeArray; + +@property (nonatomic, weak)id addDelegate; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/WeakTitleTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/WeakTitleTableViewCell.h new file mode 100644 index 0000000..57da7d9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/WeakTitleTableViewCell.h @@ -0,0 +1,16 @@ +// +// YXWeakTitleTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXWeakTitleTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXCustomSchedulingTable.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXCustomSchedulingTable.h new file mode 100644 index 0000000..bdc0025 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXCustomSchedulingTable.h @@ -0,0 +1,28 @@ +// +// YXCustomSchedulingTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import +#import "YXSectionOneTableViewCell.h" +#import "YXTimeDisanceTableViewCell.h" +#import "YXAddSchedulingTimeTableViewCell.h" +#import "YXVideoAudioTableViewCell.h" +#import "YXSchedulingDateTableViewCell.h" +#import "YXJumpHolidayTableViewCell.h" +#import "YXWeakTitleTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXCustomSchedulingTable : UITableView + +@property (nonatomic, strong) NSArray * timeArray; + +@property (nonatomic, weak)id addDelegate; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXCustomSchedulingTable.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXCustomSchedulingTable.m new file mode 100644 index 0000000..685121c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXCustomSchedulingTable.m @@ -0,0 +1,305 @@ +// +// YXCustomSchedulingTable.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "YXCustomSchedulingTable.h" + + +@interface YXCustomSchedulingTable () + + +@end + + +@implementation YXCustomSchedulingTable + + +- (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 setSeparatorColor:KWhiteColor]; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (void)setTimeArray:(NSArray *)timeArray { + + _timeArray = timeArray; + + [self reloadData]; + +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 3; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + if (section == 0 ) { + + return self.timeArray.count + 4; + } + if (section == 1) { + + return 3; + } + + return 1; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + if (indexPath.section == 0) { + + if (indexPath.row == 0) { + YXSectionOneTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"SECTIONONE"]; + if (!cell) { + + cell = [[YXSectionOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SECTIONONE"]; + } + cell.backgroundColor = KWhiteColor; + cell.sectionTitle = @"选择时间"; + cell.isShow = true; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + } + if (indexPath.row == 1) { + + YXWeakTitleTableViewCell * weekCell = [self dequeueReusableCellWithIdentifier:@"WEEKEDCELL"]; + if (!weekCell) { + + weekCell = [[YXWeakTitleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"WEEKEDCELL"]; + } + weekCell.backgroundColor = KWhiteColor; + weekCell.selectionStyle = UITableViewCellSelectionStyleNone; + return weekCell; + + } + if (indexPath.row == 2) { + + YXSectionOneTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"SECTIONONE"]; + if (!cell) { + + cell = [[YXSectionOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SECTIONONE"]; + } + cell.backgroundColor = KWhiteColor; + cell.sectionTitle = @"在线时间"; + cell.isShow = true; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + } + else if ( indexPath.row >2 && indexPath.row <= self.timeArray.count ) { + + YXTimeDisanceTableViewCell * timeCell = [self dequeueReusableCellWithIdentifier:@"TIMECELL"]; + if (!timeCell) { + + timeCell = [[YXTimeDisanceTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TIMECELL"]; + } + timeCell.model = self.timeArray[indexPath.row - 1]; + timeCell.backgroundColor = KWhiteColor; + timeCell.selectionStyle = UITableViewCellSelectionStyleNone; + return timeCell; + + }else { + YXAddSchedulingTimeTableViewCell * addCell = [self dequeueReusableCellWithIdentifier:@"ADDCELL"]; + if (!addCell) { + + addCell = [[YXAddSchedulingTimeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ADDCELL"]; + } + addCell.addDelegate = self.addDelegate; + addCell.backgroundColor = KWhiteColor; + addCell.selectionStyle = UITableViewCellSelectionStyleNone; + return addCell; + + } + + } + if (indexPath.section == 1) { + + if (indexPath.row == 0) { + YXSectionOneTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"SECTIIONTWO"]; + if (!cell) { + + cell = [[YXSectionOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SECTIIONTWO"]; + } + cell.sectionTitle = @"视频咨询"; + cell.isShow = false; + cell.backgroundColor = KWhiteColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + }else { + + YXVideoAudioTableViewCell * videoCell = [self dequeueReusableCellWithIdentifier:@"VIDEOCELL"]; + if (!videoCell) { + + videoCell = [[YXVideoAudioTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"VIDEOCELL"]; + } + videoCell.backgroundColor = KWhiteColor; + if (indexPath.row == 1) { videoCell.leftString = @"上午"; } + if (indexPath.row == 2) { videoCell.leftString = @"下午"; } + videoCell.selectionStyle = UITableViewCellSelectionStyleNone; + return videoCell; + } + } + + if (indexPath.section == 2) { + + YXJumpHolidayTableViewCell * jumpcell = [self dequeueReusableCellWithIdentifier:@"JUMPCELL"]; + if (!jumpcell) { + + jumpcell = [[YXJumpHolidayTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"JUMPCELL"]; + } + jumpcell.backgroundColor = KWhiteColor; + jumpcell.selectionStyle = UITableViewCellSelectionStyleNone; + return jumpcell; + } + + return UITableViewCell.new; + + +} +//每行高度 +//- (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; +} + + +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +-(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/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXWeakTitleTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXWeakTitleTableViewCell.h new file mode 100644 index 0000000..57da7d9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXWeakTitleTableViewCell.h @@ -0,0 +1,16 @@ +// +// YXWeakTitleTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXWeakTitleTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXWeakTitleTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXWeakTitleTableViewCell.m new file mode 100644 index 0000000..8962531 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/CustomScheduling(自定义排班)/YXWeakTitleTableViewCell.m @@ -0,0 +1,65 @@ +// +// YXWeakTitleTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/9. +// + +#import "YXWeakTitleTableViewCell.h" + +@implementation YXWeakTitleTableViewCell + +- (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 * weekedArray = @[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周天"]; + + CGFloat w = (kScreenWidth - 46 )/ 7; + + UIButton * lastBtn; + for (int i = 0; i < weekedArray.count; i ++) { + + UIButton * weekendBtn = [[UIButton alloc] init]; + [weekendBtn setTitle:weekedArray[i] forState:UIControlStateNormal]; + weekendBtn.titleLabel.font = MEDIUMFONT(13); + [weekendBtn setTitleColor:KWhiteColor forState:UIControlStateSelected]; + [weekendBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + + [self.contentView addSubview:weekendBtn]; + + [weekendBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_offset(w); + make.height.mas_offset(45); + make.top.mas_offset(2); + make.left.equalTo (lastBtn ? lastBtn.mas_right: @17); + make.bottom.equalTo (@-10); + }]; + lastBtn = weekendBtn; + if (i == 0) { + + weekendBtn.selected = true; + } + + } + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/JumpHolidayTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/JumpHolidayTableViewCell.h new file mode 100644 index 0000000..c443768 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/JumpHolidayTableViewCell.h @@ -0,0 +1,16 @@ +// +// YXJumpHolidayTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXJumpHolidayTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXAddSchedulingTimeTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXAddSchedulingTimeTableViewCell.h new file mode 100644 index 0000000..8b79015 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXAddSchedulingTimeTableViewCell.h @@ -0,0 +1,24 @@ +// +// YXAddSchedulingTimeTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol schedulingTimeAddProtocol + +- (void)addSchedulingTime; + +@end + +@interface YXAddSchedulingTimeTableViewCell : UITableViewCell + +@property (nonatomic, weak)id addDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXAddSchedulingTimeTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXAddSchedulingTimeTableViewCell.m new file mode 100644 index 0000000..b459fd9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXAddSchedulingTimeTableViewCell.m @@ -0,0 +1,64 @@ +// +// YXAddSchedulingTimeTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXAddSchedulingTimeTableViewCell.h" + +@implementation YXAddSchedulingTimeTableViewCell + +- (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 setTitleColor:UIColorHex(#21BEBD) forState:UIControlStateNormal]; + addBtn.titleLabel.font = SYSTEMFONT(14); + [addBtn setImage:[UIImage imageNamed:@"addQuestionPeople"] forState:UIControlStateNormal]; + [addBtn addTarget:self action:@selector(addQuestionTime) forControlEvents:UIControlEventTouchUpInside]; + [self.contentView addSubview:addBtn]; + + [addBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_offset(0); + make.top.mas_offset(10); + make.height.mas_offset(30); + make.bottom.mas_offset(-10); + }]; +} + +- (void)addQuestionTime { + + if ([self.addDelegate respondsToSelector:@selector(addSchedulingTime)]) { + + [self.addDelegate addSchedulingTime]; + } + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXJumpHolidayTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXJumpHolidayTableViewCell.h new file mode 100644 index 0000000..c443768 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXJumpHolidayTableViewCell.h @@ -0,0 +1,16 @@ +// +// YXJumpHolidayTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXJumpHolidayTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXJumpHolidayTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXJumpHolidayTableViewCell.m new file mode 100644 index 0000000..44bb011 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXJumpHolidayTableViewCell.m @@ -0,0 +1,82 @@ +// +// YXJumpHolidayTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXJumpHolidayTableViewCell.h" + + +@interface YXJumpHolidayTableViewCell () + +@property (nonatomic, strong) UILabel * sectionLabel; + +@property (nonatomic, strong) UISwitch * rightSlider; + +@end + + +@implementation YXJumpHolidayTableViewCell + +- (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.sectionLabel = [[UILabel alloc] init]; + self.sectionLabel.textColor = CFontColor1; + self.sectionLabel.text = @"自动跳过法定节假日?"; + self.sectionLabel.font = MEDIUMFONT(14); + self.sectionLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.sectionLabel]; + + [self.sectionLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.height.mas_offset(15); + make.width.mas_offset(200); + make.bottom.mas_offset(-20); + }]; + + self.rightSlider = [[UISwitch alloc] init]; + [self.rightSlider setOn:YES animated:YES]; + [self.rightSlider setOnTintColor: UIColorHex(#59D5D4)]; + self.rightSlider.transform = CGAffineTransformMakeScale(0.6, 0.6); + [self.rightSlider addTarget:self action:@selector(switchChange:) forControlEvents:UIControlEventValueChanged]; + [self.contentView addSubview:self.rightSlider]; + + [self.rightSlider mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(15); + make.height.mas_offset(17); + make.bottom.mas_offset(-20); + }]; +} + +- (void) switchChange:(UISwitch*)sw { + if(sw.on == YES) { + NSLog(@"开关切换为开"); + } else if(sw.on == NO) { + NSLog(@"开关切换为关"); + } +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingDateTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingDateTableViewCell.h new file mode 100644 index 0000000..6979243 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingDateTableViewCell.h @@ -0,0 +1,17 @@ +// +// YXSchedulingDateTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSchedulingDateTableViewCell : UITableViewCell + +@property (nonatomic, copy) NSString * weekString; +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingDateTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingDateTableViewCell.m new file mode 100644 index 0000000..05dae08 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingDateTableViewCell.m @@ -0,0 +1,150 @@ +// +// YXSchedulingDateTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXSchedulingDateTableViewCell.h" + +@interface YXSchedulingDateTableViewCell () + +@property (nonatomic, strong) UIButton * leftBtn; + +@property (nonatomic, strong) UIButton * centerBtn; + +@property (nonatomic, strong) UIButton * rightBtn; + +@property (nonatomic, strong) NSMutableArray * buttonArray; +@end + +@implementation YXSchedulingDateTableViewCell + +- (NSMutableArray *)buttonArray { + + if (!_buttonArray) { + + _buttonArray = [[NSMutableArray alloc] init]; + } + return _buttonArray; +} + +- (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 = UIColorHex(#E0E0E0); + backView.layer.cornerRadius = 18; + backView.layer.masksToBounds = true; + [self.contentView addSubview:backView]; + + [backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.right.mas_offset(-15); + make.height.mas_offset(35); + make.top.mas_offset(0); + make.bottom.mas_offset(-10); + }]; + + self.leftBtn = [[UIButton alloc] init]; + [self.leftBtn setTitle:@"周一" forState:UIControlStateNormal]; + [self.leftBtn setImage:[UIImage imageNamed:@"square_nomal"] forState:UIControlStateNormal]; + [self.leftBtn setImage:[UIImage imageNamed:@"square_selected"] forState:UIControlStateSelected]; + [self.leftBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + self.leftBtn.titleLabel.font = SYSTEMFONT(13); + [self.leftBtn addTarget:self action:@selector(weakButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + [backView addSubview:self.leftBtn]; + + [self.leftBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_offset(0); + make.width.mas_offset(100); + make.height.mas_equalTo(backView); + }]; + + self.centerBtn = [[UIButton alloc] init]; + [self.centerBtn setTitle:@" 上午" forState:UIControlStateNormal]; + [self.centerBtn setImage:[UIImage imageNamed:@"square_nomal"] forState:UIControlStateNormal]; + [self.centerBtn setImage:[UIImage imageNamed:@"square_selected"] forState:UIControlStateSelected]; + [self.centerBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + self.centerBtn.titleLabel.font = SYSTEMFONT(13); + [self.centerBtn addTarget:self action:@selector(morningButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + + [backView addSubview:self.centerBtn]; + + [self.centerBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_offset(0); + make.width.mas_offset(100); + make.centerX.mas_equalTo(backView); + }]; + + self.rightBtn = [[UIButton alloc] init]; + [self.rightBtn setTitle:@" 下午" forState:UIControlStateNormal]; + [self.rightBtn setImage:[UIImage imageNamed:@"square_nomal"] forState:UIControlStateNormal]; + [self.rightBtn setImage:[UIImage imageNamed:@"square_selected"] forState:UIControlStateSelected]; + [self.rightBtn setTitleColor:CFontColor1 forState:UIControlStateNormal]; + self.rightBtn.titleLabel.font = SYSTEMFONT(13); + [self.rightBtn addTarget:self action:@selector(afternoonButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + [backView addSubview:self.rightBtn]; + + [self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_offset(0); + make.width.mas_offset(100); + make.right.mas_offset(-10); + }]; + + +} + +- (void)setWeekString:(NSString *)weekString { + + _weekString = weekString; + + + [self.leftBtn setTitle:_weekString forState:UIControlStateNormal]; + +} + +- (void)weakButtonAction:(UIButton *)weakBtn { + + weakBtn.selected = !weakBtn.selected; + + self.centerBtn.selected = weakBtn.selected; + self.rightBtn.selected = weakBtn.selected; +} + +- (void)morningButtonAction:(UIButton *)morningBtn { + + morningBtn.selected = !morningBtn.selected; + if (morningBtn.selected) { + self.leftBtn.selected = YES; + } +} + +- (void)afternoonButtonAction:(UIButton *)afterBtn { + + afterBtn.selected = !afterBtn.selected; + if (afterBtn.selected) { + self.leftBtn.selected = YES; + } +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingSetingTable.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingSetingTable.h new file mode 100644 index 0000000..313e51c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingSetingTable.h @@ -0,0 +1,27 @@ +// +// YXSchedulingSetingTable.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import +#import "YXSectionOneTableViewCell.h" +#import "YXTimeDisanceTableViewCell.h" +#import "YXAddSchedulingTimeTableViewCell.h" +#import "YXVideoAudioTableViewCell.h" +#import "YXSchedulingDateTableViewCell.h" +#import "YXJumpHolidayTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSchedulingSetingTable : UITableView + +@property (nonatomic, strong) NSArray * timeArray; + +@property (nonatomic, weak)id addDelegate; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingSetingTable.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingSetingTable.m new file mode 100644 index 0000000..1b2a517 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSchedulingSetingTable.m @@ -0,0 +1,308 @@ +// +// YXSchedulingSetingTable.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXSchedulingSetingTable.h" + + +@interface YXSchedulingSetingTable () + + +@end + + +@implementation YXSchedulingSetingTable + + +- (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 setSeparatorColor:KWhiteColor]; + self.rowHeight = UITableViewAutomaticDimension; + +} + +- (void)setTimeArray:(NSArray *)timeArray { + + _timeArray = timeArray; + + [self reloadData]; + +} + +#pragma mark - tableview的代理方法 +//组数 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 4; +} +//每组多少行 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + if (section == 0 ) { + + return self.timeArray.count + 2; + } + if (section == 1) { + + return 3; + } + if (section == 2) { + + return 8; + } + return 1; +} +//注册cell +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + if (indexPath.section == 0) { + + if (indexPath.row == 0) { + YXSectionOneTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"SECTIONONE"]; + if (!cell) { + + cell = [[YXSectionOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SECTIONONE"]; + } + cell.backgroundColor = KWhiteColor; + cell.sectionTitle = @"在线时间"; + cell.isShow = true; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + }else if ( indexPath.row > 0 && indexPath.row <= self.timeArray.count ) { + + YXTimeDisanceTableViewCell * timeCell = [self dequeueReusableCellWithIdentifier:@"TIMECELL"]; + if (!timeCell) { + + timeCell = [[YXTimeDisanceTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TIMECELL"]; + } + timeCell.model = self.timeArray[indexPath.row - 1]; + timeCell.backgroundColor = KWhiteColor; + timeCell.selectionStyle = UITableViewCellSelectionStyleNone; + return timeCell; + + }else { + YXAddSchedulingTimeTableViewCell * addCell = [self dequeueReusableCellWithIdentifier:@"ADDCELL"]; + if (!addCell) { + + addCell = [[YXAddSchedulingTimeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ADDCELL"]; + } + addCell.addDelegate = self.addDelegate; + addCell.backgroundColor = KWhiteColor; + addCell.selectionStyle = UITableViewCellSelectionStyleNone; + return addCell; + + } + + } + if (indexPath.section == 1) { + + if (indexPath.row == 0) { + YXSectionOneTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"SECTIIONTWO"]; + if (!cell) { + + cell = [[YXSectionOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SECTIIONTWO"]; + } + cell.sectionTitle = @"视频咨询"; + cell.isShow = false; + cell.backgroundColor = KWhiteColor; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + }else { + + YXVideoAudioTableViewCell * videoCell = [self dequeueReusableCellWithIdentifier:@"VIDEOCELL"]; + if (!videoCell) { + + videoCell = [[YXVideoAudioTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"VIDEOCELL"]; + } + videoCell.backgroundColor = KWhiteColor; + if (indexPath.row == 1) { videoCell.leftString = @"上午"; } + if (indexPath.row == 2) { videoCell.leftString = @"下午"; } + videoCell.selectionStyle = UITableViewCellSelectionStyleNone; + return videoCell; + } + } + if (indexPath.section == 2) { + + if (indexPath.row == 0) { + YXSectionOneTableViewCell * cell = [self dequeueReusableCellWithIdentifier:@"SECTIIONTHREE"]; + if (!cell) { + + cell = [[YXSectionOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SECTIIONTHREE"]; + } + cell.backgroundColor = KWhiteColor; + cell.sectionTitle = @"日期"; + cell.isShow = true; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + }else + { + NSArray * array = @[@" 周一",@" 周二",@" 周三",@" 周四",@" 周五",@" 周六",@" 周天"]; + YXSchedulingDateTableViewCell * dateCell = [self dequeueReusableCellWithIdentifier:@"DATACELL"]; + if (!dateCell) { + + dateCell = [[YXSchedulingDateTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DATACELL"]; + } + dateCell.weekString = array[indexPath.row - 1]; + dateCell.backgroundColor = KWhiteColor; + dateCell.selectionStyle = UITableViewCellSelectionStyleNone; + return dateCell; + } + } + if (indexPath.section == 3) { + + YXJumpHolidayTableViewCell * jumpcell = [self dequeueReusableCellWithIdentifier:@"JUMPCELL"]; + if (!jumpcell) { + + jumpcell = [[YXJumpHolidayTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"JUMPCELL"]; + } + jumpcell.backgroundColor = KWhiteColor; + jumpcell.selectionStyle = UITableViewCellSelectionStyleNone; + return jumpcell; + } + + return UITableViewCell.new; + + +} +//每行高度 +//- (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; +} + + +////cell点击事件 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +-(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/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSectionOneTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSectionOneTableViewCell.h new file mode 100644 index 0000000..452cce8 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSectionOneTableViewCell.h @@ -0,0 +1,20 @@ +// +// YXSectionOneTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXSectionOneTableViewCell : UITableViewCell + +@property (nonatomic, copy) NSString * sectionTitle; + +@property (nonatomic, assign) BOOL isShow; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSectionOneTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSectionOneTableViewCell.m new file mode 100644 index 0000000..3dbd2be --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXSectionOneTableViewCell.m @@ -0,0 +1,93 @@ +// +// YXSectionOneTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXSectionOneTableViewCell.h" + + +@interface YXSectionOneTableViewCell () + +@property (nonatomic, strong) UILabel * sectionLabel; + +@property (nonatomic, strong) UISwitch * rightSlider; + +@end + + +@implementation YXSectionOneTableViewCell + +- (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.sectionLabel = [[UILabel alloc] init]; + self.sectionLabel.textColor = CFontColor1; + self.sectionLabel.font = BOLDSYSTEMFONT(15); + self.sectionLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.sectionLabel]; + + [self.sectionLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.height.mas_offset(15); + make.width.mas_offset(100); + make.bottom.mas_offset(-20); + }]; + + self.rightSlider = [[UISwitch alloc] init]; + [self.rightSlider setOn:YES animated:YES]; + [self.rightSlider setOnTintColor: UIColorHex(#59D5D4)]; + self.rightSlider.transform = CGAffineTransformMakeScale(0.6, 0.6); + [self.rightSlider addTarget:self action:@selector(switchChange:) forControlEvents:UIControlEventValueChanged]; + [self.contentView addSubview:self.rightSlider]; + + [self.rightSlider mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(15); + make.height.mas_offset(17); + make.bottom.mas_offset(-20); + }]; +} + +- (void) switchChange:(UISwitch*)sw { + if(sw.on == YES) { + NSLog(@"开关切换为开"); + } else if(sw.on == NO) { + NSLog(@"开关切换为关"); + } +} + +- (void)setSectionTitle:(NSString *)sectionTitle { + + _sectionTitle = sectionTitle; + + self.sectionLabel.text = _sectionTitle; +} + +- (void)setIsShow:(BOOL)isShow { + + _isShow = isShow; + + self.rightSlider.hidden = _isShow; +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXTimeDisanceTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXTimeDisanceTableViewCell.h new file mode 100644 index 0000000..67d48d7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXTimeDisanceTableViewCell.h @@ -0,0 +1,19 @@ +// +// YXTimeDisanceTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import +#import "YXSchedulingSettingModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface YXTimeDisanceTableViewCell : UITableViewCell + +@property (nonatomic, strong) YXSchedulingSettingModel * model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXTimeDisanceTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXTimeDisanceTableViewCell.m new file mode 100644 index 0000000..9df9651 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXTimeDisanceTableViewCell.m @@ -0,0 +1,100 @@ +// +// YXTimeDisanceTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXTimeDisanceTableViewCell.h" + +@interface YXTimeDisanceTableViewCell () + +@property (nonatomic, strong) UILabel * timeLabel; + +@property (nonatomic, strong) UISwitch * rightSlider; + + +@end + +@implementation YXTimeDisanceTableViewCell + +- (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.timeLabel = [[UILabel alloc] init]; + self.timeLabel.textColor = UIColorHex(#333333); + self.timeLabel.font = MEDIUMFONT(13); + self.timeLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.timeLabel]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(15); + make.top.height.mas_offset(15); + make.width.mas_offset(200); + make.bottom.mas_offset(-20); + }]; + + self.rightSlider = [[UISwitch alloc] init]; + [self.rightSlider setOn:YES animated:YES]; + [self.rightSlider setOnTintColor: UIColorHex(#59D5D4)]; + self.rightSlider.transform = CGAffineTransformMakeScale(0.6, 0.6); + [self.rightSlider addTarget:self action:@selector(switchChange:) forControlEvents:UIControlEventValueChanged]; + [self.contentView addSubview:self.rightSlider]; + + [self.rightSlider mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_offset(-15); + make.top.mas_offset(15); + make.height.mas_offset(17); + make.bottom.mas_offset(-20); + }]; + + UIView * lineV = [[UIView alloc] init]; + lineV.backgroundColor = UIColorHex(#E0E0E0); + [self.contentView addSubview:lineV]; + + [lineV mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_offset(0); + make.height.mas_offset(1); + make.bottom.mas_offset(0); + }]; + +} + +- (void) switchChange:(UISwitch*)sw { + if(sw.on == YES) { + NSLog(@"开关切换为开"); + } else if(sw.on == NO) { + NSLog(@"开关切换为关"); + } +} + +- (void)setModel:(YXSchedulingSettingModel *)model { + + _model = model; + + self.timeLabel.text = _model.time; + + [self.rightSlider setOn:_model.isSelected]; + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXVideoAudioTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXVideoAudioTableViewCell.h new file mode 100644 index 0000000..99875d5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXVideoAudioTableViewCell.h @@ -0,0 +1,18 @@ +// +// YXVideoAudioTableViewCell.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YXVideoAudioTableViewCell : UITableViewCell + +@property (nonatomic, copy) NSString * leftString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXVideoAudioTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXVideoAudioTableViewCell.m new file mode 100644 index 0000000..f632867 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/SchedulingSettingView(排班设置)/YXVideoAudioTableViewCell.m @@ -0,0 +1,110 @@ +// +// YXVideoAudioTableViewCell.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/8. +// + +#import "YXVideoAudioTableViewCell.h" + +@interface YXVideoAudioTableViewCell () + +@property (nonatomic, strong) UILabel * leftLabel; + +@property (nonatomic, strong) UITextField * numberField; + +@end + +@implementation YXVideoAudioTableViewCell + +- (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] init]; + self.leftLabel.textColor = UIColorHex(#333333); + self.leftLabel.font = BOLDSYSTEMFONT(13); + self.leftLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:self.leftLabel]; + + [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_offset(28); + make.top.height.mas_offset(20); + make.width.mas_offset(40); + make.bottom.mas_offset(-20); + }]; + + UILabel * maxLabel = [[UILabel alloc] init]; + maxLabel.textColor = UIColorHex(#333333); + maxLabel.font = MEDIUMFONT(14); + maxLabel.text = @"最大可预约"; + maxLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:maxLabel]; + + [maxLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.leftLabel.mas_right).offset(20); + make.top.height.mas_offset(20); + make.bottom.mas_offset(-20); + }]; + [maxLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + self.numberField = [[UITextField alloc] init]; + self.numberField.layer.cornerRadius = 5.0; + self.numberField.layer.masksToBounds = true; + self.numberField.layer.borderColor = UIColorHex(#CCCCCC).CGColor; + self.numberField.layer.borderWidth = 1.0f; + self.numberField.keyboardType = UIKeyboardTypeNumberPad; + [self.contentView addSubview:self.numberField]; + + [self.numberField mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(maxLabel.mas_right).offset(11); + make.height.mas_offset(30); + make.width.mas_offset(58); + make.bottom.mas_offset(-15); + }]; + + UILabel * peopleLabel = [[UILabel alloc] init]; + peopleLabel.textColor = UIColorHex(#333333); + peopleLabel.font = MEDIUMFONT(14); + peopleLabel.text = @"人"; + peopleLabel.textAlignment = NSTextAlignmentLeft; + [self.contentView addSubview:peopleLabel]; + + [peopleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.numberField.mas_right).offset(10); + make.top.height.mas_offset(20); + make.bottom.mas_offset(-20); + make.width.mas_offset(35); + }]; +} + +- (void)setLeftString:(NSString *)leftString { + + _leftString = leftString; + + self.leftLabel.text = _leftString; + + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXcustomDelectedView.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXcustomDelectedView.h new file mode 100644 index 0000000..59ff2cd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXcustomDelectedView.h @@ -0,0 +1,24 @@ +// +// YXcustomDelectedView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^delectOneBlock)(NSInteger btnTag); + +@interface YXcustomDelectedView : UIView + +@property (nonatomic, copy) NSString * titleString; + +@property (nonatomic, assign) NSInteger btntag; + +@property (nonatomic, copy) delectOneBlock delectBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXcustomDelectedView.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXcustomDelectedView.m new file mode 100644 index 0000000..0353670 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXcustomDelectedView.m @@ -0,0 +1,79 @@ +// +// YXcustomDelectedView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import "YXcustomDelectedView.h" + +@interface YXcustomDelectedView () + +@property (nonatomic, strong) UILabel * nameLabel; +@property (nonatomic, strong) UIButton * cancelBtn ; + +@end + +@implementation YXcustomDelectedView + +/* +// 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 { + + UIButton * cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width - 18, 0, 18, 18)]; + [cancelBtn setImage:[UIImage imageNamed:@"delected_Icon"] forState:UIControlStateNormal]; + self.cancelBtn = cancelBtn; + [cancelBtn addTarget:self action:@selector(delectedAction:) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:cancelBtn]; + + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 7, self.width-10, 27)]; + self.nameLabel.textAlignment = NSTextAlignmentCenter; + self.nameLabel.textColor = CFontColor1; + self.nameLabel.font = SYSTEMFONT(13); + self.nameLabel.layer.borderColor = UIColorHex(#BBBBBB).CGColor; + self.nameLabel.layer.cornerRadius = 5.0; + self.nameLabel.layer.masksToBounds = true; + self.nameLabel.layer.borderWidth = 1.0f; + [self addSubview:self.nameLabel]; +} + +- (void)setBtntag:(NSInteger)btntag { + + _btntag = btntag; + self.cancelBtn.tag = _btntag; + + + +} + +- (void)setTitleString:(NSString *)titleString { + _titleString = titleString; + self.nameLabel.text = _titleString; +} + +- (void)delectedAction:(UIButton *)btn { + + if (self.delectBlock) { + + self.delectBlock(btn.tag - 100); + + } + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXuserAddGoodPopView.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXuserAddGoodPopView.h new file mode 100644 index 0000000..6b077eb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXuserAddGoodPopView.h @@ -0,0 +1,20 @@ +// +// YXuserAddGoodPopView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^addBlcok)(NSString *inputString); + +@interface YXuserAddGoodPopView : UIView + +@property (nonatomic, copy) addBlcok popBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXuserAddGoodPopView.m b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXuserAddGoodPopView.m new file mode 100644 index 0000000..4ffdbed --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/YXuserAddGoodPopView.m @@ -0,0 +1,108 @@ +// +// YXuserAddGoodPopView.m +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import "YXuserAddGoodPopView.h" +#import "UIPlaceHolderTextView.h" + +@interface YXuserAddGoodPopView () + +@property (nonatomic, strong) UIPlaceHolderTextView * addTextView; + +@end + +@implementation YXuserAddGoodPopView + +/* +// 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); + + UIView * popView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight - kRealValue(254), kScreenWidth, kRealValue(254))]; + popView.backgroundColor = KWhiteColor; + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:popView.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(10, 10)]; + CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init]; + maskLayer.frame = popView.bounds; + maskLayer.path = maskPath.CGPath; + popView.layer.mask = maskLayer; + [self addSubview:popView]; + + UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(26), popView.width, 14)]; + titleLabel.text = @"擅长病种"; + titleLabel.font = MEDIUMFONT(14); + titleLabel.textAlignment = NSTextAlignmentCenter; + titleLabel.textColor = CFontColor1; + [popView addSubview:titleLabel]; + + + UIPlaceHolderTextView * textView = [[UIPlaceHolderTextView alloc] initWithFrame:CGRectMake(kRealValue(16), titleLabel.bottom + kRealValue(32), kScreenWidth - kRealValue(32), kRealValue(90))]; + textView.backgroundColor = UIColorHex(#EFEFEF); + self.addTextView = textView; + textView.font = SYSTEMFONT(13); + textView.placeholder = @"请输入您擅长的病种"; + textView.layer.cornerRadius = 10; + textView.layer.masksToBounds = true; + [popView addSubview:textView]; + + UIButton * cancelbtn = [[UIButton alloc] initWithFrame:CGRectMake(popView.width - kRealValue(15) - 9 , kRealValue(15) , 9, 9)]; + [cancelbtn setImage:[UIImage imageNamed:@"close_Icon"] forState:UIControlStateNormal]; + [cancelbtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside]; + [popView addSubview:cancelbtn]; + + UIButton * sureBtn = [[UIButton alloc] initWithFrame:CGRectMake(kRealValue(47) ,textView.bottom + kRealValue(31) , popView.width - kRealValue(94), 40)]; + sureBtn.backgroundColor = UIColorHex(#21BEBD); + sureBtn.layer.cornerRadius = 20; + [sureBtn setTitle:@"确定" forState:UIControlStateNormal]; + [sureBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + sureBtn.titleLabel.font = MEDIUMFONT(14); + [sureBtn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside]; + [popView addSubview:sureBtn]; + + + + + +} + +-(void)cancelAction { + + [self removeFromSuperview]; + +} + +- (void)sureAction { + + if (ValidStr(self.addTextView.text)) { + + [MBProgressHUD showErrorMessage:@"请输入内容"]; + return; + } + + if(self.popBlock) { + + self.popBlock(self.addTextView.text); + } + [self removeFromSuperview]; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/userAddGoodPopView.h b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/userAddGoodPopView.h new file mode 100644 index 0000000..6b077eb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/Mine/view/userAddGoodPopView.h @@ -0,0 +1,20 @@ +// +// YXuserAddGoodPopView.h +// healthQuestion +// +// Created by 仁康信息 on 2023/5/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^addBlcok)(NSString *inputString); + +@interface YXuserAddGoodPopView : UIView + +@property (nonatomic, copy) addBlcok popBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatList/ChatListViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatList/ChatListViewController.h new file mode 100644 index 0000000..cdfc75b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatList/ChatListViewController.h @@ -0,0 +1,16 @@ +// +// ChatListViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ChatListViewController : YXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatList/ChatListViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatList/ChatListViewController.m new file mode 100644 index 0000000..9826250 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h new file mode 100644 index 0000000..9e7b0ff --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h @@ -0,0 +1,59 @@ +// +// ChatViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/2/13. +// + +#import "YXBaseViewController.h" +#import "QuestionDiseaseInfoModel.h" + +#import "healthDataCustomCell.h" +//#import "TUIBaseChatViewController.h" +NS_ASSUME_NONNULL_BEGIN + +@interface ChatViewController : YXBaseViewController + +@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) BOOL isHideKeyBord; + +//咨询人男女 +@property (nonatomic, copy) NSString * memberSex; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m new file mode 100644 index 0000000..dc00828 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m @@ -0,0 +1,537 @@ +// +// 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 "TUIChatConfig.h" +#import "EndSystemSoSCell.h" +#import "YXFileDataDetailViewController.h" +#import "DoctorIDCardMessageCell.h" +#import "CurrentLocationViewController.h" +#import +#import +#import "TUIGroupChatViewController.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, assign) CGFloat starNumber; +@property (nonatomic, strong) NSString * evlationConnte; + +@end + +@implementation ChatViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.title = self.navTitle; + // self 为 id + self.view.backgroundColor = KWhiteColor; + + [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; + [[TUICallEngine createInstance] addObserver:self]; +// IMUserInfoModel * model = [HQCommonUtils keyedUnarchiverWithKey:IMLoginUserInfo]; +// [[TUICallEngine createInstance] init:[model.sdkAppId intValue] userId:model.userId userSig:model.userSig succ:^{ +// +// } fail:^(int code, NSString * _Nullable errMsg) { +// +// }]; + + [[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]; + + +// [ESCTUIManager createUITUIChatViewControllerisGroup:self.isGroupID chatConnetID:self.chatID isAudio:false isVideo:false]; + YXUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + + TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init]; + //显示对方正在输入状态 + data.otherSideTyping = true; + // 显示翻译按钮 +// TUIChatConfig.defaultConfig.enableTextTranslation = YES; + //不显示视频和语音 + [TUIChatConfig defaultConfig].enableVideoCall = self.isVideo; // YES:开启,NO:关闭 + [TUIChatConfig defaultConfig].enableAudioCall = self.isVideo; // YES:开启,NO:关闭 + [TUIChatConfig defaultConfig].backgroudColor = UIColorHex(#EEEEEE); + [TUIConfig defaultConfig].defaultAvatarImage = [UIImage imageNamed:@"heard_man"]; + [TUIConfig defaultConfig].avatarType = TAvatarTypeRounded; + + //是否显示发送报告 + [TUIChatConfig defaultConfig].enableSendReportCall = self.eableSendReport; + [TUIChatConfig defaultConfig].enableSendHealthDataCall = self.eablehaveHelathData; + [TUIChatConfig defaultConfig].enableMapCall = self.eableMapTools; + 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"]; + } + // 设置发送文字消息的字体和颜色 +// [TUITextMessageCellData setOutgoingTextFont:[UIFont systemFontOfSize:20]]; +// [TUITextMessageCellData setOutgoingTextColor:[UIColor blueColor]]; +// // 设置接收文字消息的字体和颜色 +// [TUITextMessageCellData setIncommingTextFont:[UIFont systemFontOfSize:20]]; +// [TUITextMessageCellData setIncommingTextColor:[UIColor purpleColor]]; + // 设置发送气泡,包括普通状态和选中状态 + [TUIBubbleMessageCellData setOutgoingBubble:[UIImage imageWithColor:KWhiteColor]]; + [TUIBubbleMessageCellData setOutgoingHighlightedBubble:[UIImage imageWithColor:KWhiteColor]]; + // 设置接收气泡,包括普通状态和选中状态 + [TUIBubbleMessageCellData setIncommingBubble:[UIImage imageWithColor:KWhiteColor]]; + + if( self.isGroupID == false) { + data.groupID = 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.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.customDelegate = self; + } + // TUIC2CChatViewController + + //发送 + + + + // 把 TUIC2CChatViewController 添加到自己的 ViewController + + if ([self.tfNew integerValue] == 1) { + + [ESCTUIManager sendGroupVideo:self.chatID withUserIdList:self.member]; + } + //主动发送一条消息 + //如果点击跳过进入 不操作 非跳过 发送健康档案 2=非跳过 + if (self.JumpType == 2 && self.questionType == 2) { + + [self sendQuestionInfoMessage]; + } + +// [self ChatsendReview]; + //调整聊天界面 + if (self.isHideKeyBord == true) { + if( self.isGroupID == false) { + + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + } +} + + +#pragma mark:跳转到地图选择页 +- (void)jumpChatMapView { + + 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]; +} + +#pragma mark:结束咨询 + +- (void)sendChatEndQuestionAction { + +// NSDictionary * parmdic = @{BussinessID:BussinessID_CustomReview}; +// NSData * messagedata = [NSJSONSerialization dataWithJSONObject:parmdic options:0 error:nil]; +// V2TIMMessage * message = [[V2TIMManager sharedInstance] createCustomMessage:messagedata]; +// [self.vc sendMessage:message]; + ////1 应急 2 图文咨询 3 音视频咨询 smallHelp_id小助手 + if (self.questionType == 1) { + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.sosEnd_id forKey:@"id"]; + YXNetAPI * endApi = [[YXNetAPI alloc] init:self tag:@"ENDSOSAPI" NeedToken:@""]; + [endApi PostEndSoSIMQuestion:parmDic]; + } + if (self.questionType == 2) { + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.pictureEnd_id forKey:@"id"]; + YXNetAPI * endApi = [[YXNetAPI alloc] init:self tag:@"ENDPICTUREAPI" NeedToken:@""]; + [endApi GetEndPictureEndIMQuestion:parmDic]; + } + if (!ValidStr(self.smallHelp_id)) { + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:self.smallHelp_id forKey:@"id"]; + YXNetAPI * endApi = [[YXNetAPI alloc] init:self tag:@"ENDPICTUREAPI" NeedToken:@""]; + [endApi GetEndPictureEndIMQuestion:parmDic]; + } +} + +#pragma mark:发送健康档案 + +//主动发一条消息:健康档案 带联系人数据 +- (void)sendQuestionInfoMessage { + if (self.disModel) { + //性别 + NSString * sexString = [self.disModel.gender integerValue] == 1 ?@"女":@"男"; + //年龄 + NSString * ageString = [NSString stringWithFormat:@"%@",self.disModel.age]; + //姓名 + NSString * nameString = [NSString stringWithFormat:@"%@",self.disModel.name]; + //id + NSString * memberId = [NSString stringWithFormat:@"%@",self.dangan_id]; + + //症状描述 + NSString * siksDesString = @""; + //图片数组 + + NSMutableArray * imageArray = [[NSMutableArray alloc] init]; + for ( diseaseModel * listMode in self.disModel.list) { + + if (listMode.isSelected == true) { + NSArray * listImageArray = [listMode.image componentsSeparatedByString:@","]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + for (NSString * imageString in listImageArray) { + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,imageString]; + + NSString * str1 = @"\\"; + + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [parmDic setObject:encodedString3 forKey:@"bigImageUrl"]; + [parmDic setObject:encodedString3 forKey:@"thumbnailUrl"]; + + [imageArray addObject:parmDic]; + } + siksDesString = listMode.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]; + } + } + +} + + + +- (void)questionChatSendHealthData { + + + + +} + + + +- (void)onCallEnd:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole totalTime:(float)totalTime { + +} + + + +#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]; + + NSLog(@"onRecvGroupCustomMessage, msgID: %@, info: %@, customData: %@", msgID, info, myResult); +} + +- (void)onRecvGroupCustomMessage:(NSString *)msgID groupID:(NSString *)groupID sender:(V2TIMGroupMemberInfo *)info customData:(NSData *)data { + + id myResult = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; + + NSLog(@"onRecvGroupCustomMessage, msgID: %@, info: %@, customData: %@", msgID, info, myResult); + +} +/// 收到 C2C 文本消息 +- (void)onRecvC2CTextMessage:(NSString *)msgID sender:(V2TIMUserInfo *)info text:(NSString *)text{ + + + NSLog(@"onRecvGroupCustomMessage, msgID: %@, info: %@", msgID, info); + +} +#pragma mark:发起评价 +- (void)chatevlationDoctorStarView:(TUIMessageCell *)cell{ + // DLog(@"-----------%@",@"我是评价"); + + if ([cell isKindOfClass:EndSystemSoSCell.class]) { + + + } + + if ([cell isKindOfClass:DoctorIDCardMessageCell.class]) { + + + + } + + if ([cell isKindOfClass:healthDataCustomCell.class]) { + healthDataCustomCell * healthCell = cell; + YXFileDataDetailViewController * experVC= [[YXFileDataDetailViewController alloc] init]; + experVC.record_id = healthCell.fileId; + [self.navigationController pushViewController:experVC 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)Failed:(NSString*)message tag:(NSString*)tag +{ + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; + +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"ENDSOSAPI"]) + { + NSDictionary * parmDic = response; + if( self.isGroupID == false) { + + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + + + } + + if ([tag isEqualToString:@"ENDPICTUREAPI"]) { + + if( self.isGroupID == false) { + + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + + } + if ([tag isEqualToString:@"DoctorSource"]) { + + } +} + +- (void)doctorSourceWithStarNumaber:(CGFloat)starNumer withContext:(NSString *)connet isKnow:(NSString *)isNiming{ + +// 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"]; +// +// XMAPI * endApi = [[XMAPI 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]; + + NSArray * listImageArray = [model.image componentsSeparatedByString:@","]; + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + for (NSString * imageString in listImageArray) { + + NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,imageString]; + + NSString * str1 = @"\\"; + + photo = [photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + [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:^{ + }]; +} + +/** + * 键盘即将弹出 + */ +- (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); +// } + + }]; +} + + +- (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. + } + */ + + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/ChatMapViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/ChatMapViewController.h new file mode 100644 index 0000000..7ae2216 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/ChatMapViewController.h @@ -0,0 +1,20 @@ +// +// ChatMapViewController.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/5. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^sendUserSoSLocation)(CLLocationCoordinate2D coordinate); + +@interface ChatMapViewController : YXBaseViewController + +@property (nonatomic, copy) sendUserSoSLocation mapBlcok; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/ChatMapViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/ChatMapViewController.m new file mode 100644 index 0000000..3a09971 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/ChatMapViewController.m @@ -0,0 +1,157 @@ +// +// 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.userFirstLoca == NO) { + [self showMBProgressHUDOnlyWithString:@"正在获取您的位置,请稍候"]; + } + 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]; + coordinate = CLLocationCoordinate2DMake(moveCoor.latitude , 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点 + coordinate = CLLocationCoordinate2DMake(poi.location.latitude, poi.location.longitude); + [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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/CurrentLocationViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/CurrentLocationViewController.h new file mode 100644 index 0000000..2fb2fb6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/CurrentLocationViewController.h @@ -0,0 +1,21 @@ +// +// CurrentLocationViewController.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/15. +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface CurrentLocationViewController : YXBaseViewController + +@property (nonatomic, assign) double longitude; + +@property (nonatomic, assign) double latitude; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/CurrentLocationViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Controller/CurrentLocationViewController.m new file mode 100644 index 0000000..2097fd0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.h new file mode 100644 index 0000000..709beb9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.h @@ -0,0 +1,23 @@ +// +// 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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctiorIDCardCellData.m new file mode 100644 index 0000000..b1b5008 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.h new file mode 100644 index 0000000..273e996 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.h @@ -0,0 +1,27 @@ +// +// 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; + +- (void)fillWithData:(DoctiorIDCardCellData *)data; // 绘制 UI + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.m new file mode 100644 index 0000000..61c8d55 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/DoctorCardCell/DoctorIDCardMessageCell.m @@ -0,0 +1,97 @@ +// +// 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.hospatilLabel.text = [NSString stringWithFormat:@"%@ - %@",data.organization,data.departmentName]; + self.bottomLabel.text = @"个人名片"; + self.cardId = data.cardId; + [self.doctorImg sd_setImageWithURL:[NSURL URLWithString:data.doctorHeadImg] placeholderImage:PLACEHOLD_IMG]; +} + + +- (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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.h new file mode 100644 index 0000000..6d9ae6a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.m new file mode 100644 index 0000000..a27c1bd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemCellData.m @@ -0,0 +1,60 @@ +// +// 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]; + + + NSString * photo = message.faceURL; + + NSString * str1 = @"\\"; + + photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"]; + + NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8)); + + + cellData.avatarUrl = [NSURL URLWithString:encodedString3]; + 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 AndLeftisTrue:true withStr:self.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2]; + CGFloat textMaxWidth = 245.f; + CGFloat textMaxHeight = h+10; + +// if (self.type == 1) { + textMaxHeight = h+80; +// } +// else +// { +// textMaxHeight = h+100; +// } + CGSize size = CGSizeMake(textMaxWidth, textMaxHeight); + return size; +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.h new file mode 100644 index 0000000..d5a6d0b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.h @@ -0,0 +1,30 @@ +// +// 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; + +- (void)fillWithData:(EndSystemCellData *)data; // 绘制 UI + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.m new file mode 100644 index 0000000..6dc2f74 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/EndSystemCell/EndSystemSoSCell.m @@ -0,0 +1,108 @@ +// +// 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 = YES; + [self.reviewBtn addTarget:self action:@selector(evlationDoctor) forControlEvents:UIControlEventTouchUpInside]; + [self.container addSubview:self.reviewBtn]; +} + + +- (void)fillWithData:(EndSystemCellData *)data { + + [super fillWithData:data]; +// if (data.type == 1) { +// self.reviewBtn.hidden = true; +// }else +// { +// self.reviewBtn.hidden = false; +// } + if ([data.avatarUrl.absoluteString isEqualToString:@""] || data.avatarUrl == nil ) { + [self.avatarView setImage:[UIImage imageNamed:@"heard_man"]]; + } + else + { + [self.avatarView sd_setImageWithURL:data.avatarUrl placeholderImage:DefaultAvatarImage]; + + } + + self.reviewBtn.hidden = true; + self.systemTitleLabel.text = data.title;; + self.commantLabel.text = data.content; +} + + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat h = [HQCommonUtils getSpaceLabelHeight:self.commantLabel AndLeftisTrue:true 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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.h new file mode 100644 index 0000000..151d9ee --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/chatPictureCollectionViewCell.m new file mode 100644 index 0000000..9151f11 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.h new file mode 100644 index 0000000..0afe563 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.h @@ -0,0 +1,27 @@ +// +// 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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.m new file mode 100644 index 0000000..027453c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCell.m @@ -0,0 +1,210 @@ +// +// 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(14); + 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(13); + self.illnessLabel.textColor = CFontColor1; + self.illnessLabel.numberOfLines = 0; + [self.container addSubview:self.illnessLabel]; + //图片 + UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc]init]; + layout.scrollDirection = UICollectionViewScrollDirectionVertical; +// layout.minimumInteritemSpacing =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((260 -30) /2,(260 - 30) /2); + +} + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath +{ + + +} + +- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { + + return UIEdgeInsetsMake(0, 10, 0, 10); +} +//赋值 + +- (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]; + NSMutableAttributedString * attString = [[NSMutableAttributedString alloc] initWithString:self.illnessLabel.text]; + [attString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13 weight:UIFontWeightBold] range:NSMakeRange(0,5)]; + self.illnessLabel.attributedText = attString; + + 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(21).mm_left(10).mm_width([HQCommonUtils getLengthFromText:self.questionNameLab.text andFontSize:15]).mm_height(16); + + self.sexLabel.mm_top(21).mm_left(self.questionNameLab.mm_w + 10 + 9).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 = 245.f;; + + //w 245, h 200 + if (self.imageDataArray.count == 0) { + + self.pictureView.hidden = true; + pictureH = CGFLOAT_MIN; + + } + if (self.imageDataArray.count == 1) { + + pictureH = 215 + 20; + } + if (self.imageDataArray.count == 2) { + + pictureH = (245 - 10 )/2 + 15; + } + if (self.imageDataArray.count > 2) { + + pictureH = 235; + } + + + self.pictureView.mm_top(self.illnessLabel.mm_y + self.illnessLabel.mm_h + 20).mm_width(260).mm_height(pictureH); + + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.h new file mode 100644 index 0000000..c5b5e18 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.m new file mode 100644 index 0000000..e548352 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/HealthDataCustom/healthDataCustomCellData.m @@ -0,0 +1,74 @@ +// +// 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.fileId = param[@"archivesId"]; + 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[@"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 = 215 +20; + } + + if (self.imageList.count == 2) { + + pictureH = (245 - 10 )/2 +25; + } + if (self.imageList.count > 2) { + + pictureH = 245; + } + 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, 73 + rect.size.height + pictureH ); + + + return size; +} + + +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.h new file mode 100644 index 0000000..ffbe4f2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.m new file mode 100644 index 0000000..b9cef40 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCell.m @@ -0,0 +1,81 @@ +// +// 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 AndLeftisTrue:true 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 { + + +} +@end + diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.h new file mode 100644 index 0000000..5aa1f5d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/SendPhysicalModel/sendPhysicalCustomCellData.m new file mode 100644 index 0000000..a895575 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.h new file mode 100644 index 0000000..aa89cee --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCellData.m new file mode 100644 index 0000000..451fc2b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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 AndLeftisTrue:true withStr:self.reviewConnet withFont:[UIFont systemFontOfSize:13] withWidth: 245 - 30 withLineSpacing:5]; + CGSize size = CGSizeMake(245,h + 80); + return size; + + +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.h new file mode 100644 index 0000000..31792c2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/StarMarkCustom/StarMarkCustomCell.m new file mode 100644 index 0000000..33df994 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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 = KWhiteColor; + 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 AndLeftisTrue:true 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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.h new file mode 100644 index 0000000..46094da --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoCellData.m new file mode 100644 index 0000000..b922b12 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.h new file mode 100644 index 0000000..74b20f6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/CustomChatCell/userCustom/userDataInfoChatCell.m new file mode 100644 index 0000000..a4498a3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/DoctorReportModel.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/DoctorReportModel.h new file mode 100644 index 0000000..ceece23 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/DoctorReportModel.h @@ -0,0 +1,140 @@ +// +// DoctorReportModel.h +// healthQuestion +// +// Created by Apple on 2024/5/14. +// + +#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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/DoctorReportModel.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/DoctorReportModel.m new file mode 100644 index 0000000..8aa2b6a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/DoctorReportModel.m @@ -0,0 +1,80 @@ +// +// DoctorReportModel.m +// healthQuestion +// +// Created by Apple on 2024/5/14. +// + +#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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/QuestionDiseaseInfoModel.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/QuestionDiseaseInfoModel.h new file mode 100644 index 0000000..e5b5f3b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/QuestionDiseaseInfoModel.h @@ -0,0 +1,62 @@ +// +// QuestionDiseaseInfoModel.h +// healthQuestion +// +// Created by 仁康信息 on 2023/8/4. +// + +#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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/QuestionDiseaseInfoModel.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/QuestionDiseaseInfoModel.m new file mode 100644 index 0000000..4cc6209 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/QuestionDiseaseInfoModel.m @@ -0,0 +1,40 @@ +// +// QuestionDiseaseInfoModel.m +// healthQuestion +// +// Created by 仁康信息 on 2023/8/4. +// + +#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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/SendReportModel.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/SendReportModel.h new file mode 100644 index 0000000..2926079 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/SendReportModel.h @@ -0,0 +1,16 @@ +// +// SendReportModel.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SendReportModel : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/SendReportModel.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/SendReportModel.m new file mode 100644 index 0000000..969b1dc --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/sendHealthModel.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/sendHealthModel.h new file mode 100644 index 0000000..0ce64af --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/sendHealthModel.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/Model/sendHealthModel.m new file mode 100644 index 0000000..8bd8c00 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTable.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTable.h new file mode 100644 index 0000000..26f1d8b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTable.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTable.m new file mode 100644 index 0000000..de1cd04 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTableViewCell.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTableViewCell.h new file mode 100644 index 0000000..1a95f60 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTableViewCell.h @@ -0,0 +1,23 @@ +// +// SendHealthDataTableViewCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/27. +// + +#import +#import "sendHealthModel.h" +#import "QuestionDiseaseInfoModel.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/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTableViewCell.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/View/SendHealthDataTableViewCell.m new file mode 100644 index 0000000..e957cf5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon.png new file mode 100644 index 0000000..60b2151 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon@2x.png new file mode 100644 index 0000000..beffaff Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon@3x.png new file mode 100644 index 0000000..e26b26d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/AccountSafety_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/Contents.json new file mode 100644 index 0000000..b74e2d0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AccountSafety_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AccountSafety_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AccountSafety_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AccountSafety_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon 1.appiconset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon 1.appiconset/Contents.json new file mode 100644 index 0000000..df54288 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon 1.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "questionIcon.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon 1.appiconset/questionIcon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon 1.appiconset/questionIcon.png new file mode 100644 index 0000000..66b06c0 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon 1.appiconset/questionIcon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/Contents.json new file mode 100644 index 0000000..c54e646 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "loginBtn_img.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "loginBtn_img@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/loginBtn_img.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/loginBtn_img.png new file mode 100644 index 0000000..c9688a3 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/loginBtn_img.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/loginBtn_img@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/loginBtn_img@2x.png new file mode 100644 index 0000000..024b129 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginBtn_img.imageset/loginBtn_img@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/Contents.json new file mode 100644 index 0000000..93d983d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "loginTopBimg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "loginTopBimg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "loginTopBimg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg.png new file mode 100644 index 0000000..9876e5d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg@2x.png new file mode 100644 index 0000000..50f6fa7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg@3x.png new file mode 100644 index 0000000..65d7baf Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/loginTopBimg.imageset/loginTopBimg@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/Contents.json new file mode 100644 index 0000000..dbb1e13 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "login_nomalProtocol.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_nomalProtocol@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "login_nomalProtocol@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol.png new file mode 100644 index 0000000..db26201 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol@2x.png new file mode 100644 index 0000000..a5bfdf8 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol@3x.png new file mode 100644 index 0000000..ef76142 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_nomalProtocol.imageset/login_nomalProtocol@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/Contents.json new file mode 100644 index 0000000..e31b498 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "login_selectProtocol.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_selectProtocol@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "login_selectProtocol@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol.png new file mode 100644 index 0000000..1534e52 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol@2x.png new file mode 100644 index 0000000..d9d0447 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol@3x.png new file mode 100644 index 0000000..f0861e6 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Login_Regis/login_selectProtocol.imageset/login_selectProtocol@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/Contents.json new file mode 100644 index 0000000..0c8c859 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "nodataPicture.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "nodataPicture@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "nodataPicture@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture.png new file mode 100644 index 0000000..4802e82 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture@2x.png new file mode 100644 index 0000000..8cca1bd Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture@3x.png new file mode 100644 index 0000000..d958264 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/nodataPicture.imageset/nodataPicture@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/Contents.json new file mode 100644 index 0000000..2c42b12 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "smallTime@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "smallTime.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/smallTime.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/smallTime.png new file mode 100644 index 0000000..6520ae4 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/smallTime.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/smallTime@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/smallTime@2x.png new file mode 100644 index 0000000..e6636ac Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/smallTime.imageset/smallTime@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/Contents.json new file mode 100644 index 0000000..96de731 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "stopPopIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "stopPopIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "stopPopIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon.png new file mode 100644 index 0000000..94cef9f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon@2x.png new file mode 100644 index 0000000..ec7eb26 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon@3x.png new file mode 100644 index 0000000..1daa7b9 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/stopPopIcon.imageset/stopPopIcon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian.imageset/Contents.json new file mode 100644 index 0000000..c0021b5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "xuxian-4.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian.imageset/xuxian-4.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian.imageset/xuxian-4.png new file mode 100644 index 0000000..8f74388 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian.imageset/xuxian-4.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian111.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian111.imageset/Contents.json new file mode 100644 index 0000000..e154393 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian111.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "xuxian.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian111.imageset/xuxian.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian111.imageset/xuxian.png new file mode 100644 index 0000000..4722f19 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/POPImage/xuxian111.imageset/xuxian.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/Contents.json new file mode 100644 index 0000000..c499f2b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople.png new file mode 100644 index 0000000..ab08475 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople@2x.png new file mode 100644 index 0000000..cba68a7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople@3x.png new file mode 100644 index 0000000..4f7a68b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/addQuestionPeople.imageset/addQuestionPeople@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/Contents.json new file mode 100644 index 0000000..44437aa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "chooseCircle.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "chooseCircle@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "chooseCircle@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle.png new file mode 100644 index 0000000..a548db3 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle@2x.png new file mode 100644 index 0000000..59c4e02 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle@3x.png new file mode 100644 index 0000000..f350b36 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/chooseCircle.imageset/chooseCircle@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/Contents.json new file mode 100644 index 0000000..c855965 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "closeImage.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "closeImage@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "closeImage@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage.png new file mode 100644 index 0000000..f95849a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage@2x.png new file mode 100644 index 0000000..a4a7f86 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage@3x.png new file mode 100644 index 0000000..4db2b04 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/closeImage.imageset/closeImage@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/Contents.json new file mode 100644 index 0000000..cdcf570 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "close_Icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "close_Icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "close_Icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon.png new file mode 100644 index 0000000..d660f84 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon@2x.png new file mode 100644 index 0000000..f3bb89c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon@3x.png new file mode 100644 index 0000000..c11094e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/close_Icon.imageset/close_Icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/Contents.json new file mode 100644 index 0000000..12adf32 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "delected_Icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "delected_Icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "delected_Icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon.png new file mode 100644 index 0000000..103ca9f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon@2x.png new file mode 100644 index 0000000..53823ee Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon@3x.png new file mode 100644 index 0000000..d22317c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/delected_Icon.imageset/delected_Icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/Contents.json new file mode 100644 index 0000000..3b400dc --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "garyDown.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "garyDown@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "garyDown@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown.png new file mode 100644 index 0000000..dc499d1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown@2x.png new file mode 100644 index 0000000..462650f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown@3x.png new file mode 100644 index 0000000..3d5f72d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyDown.imageset/garyDown@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/Contents.json new file mode 100644 index 0000000..0a8fff7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight.png new file mode 100644 index 0000000..7ae571b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight@2x.png new file mode 100644 index 0000000..50f8ae4 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight@3x.png new file mode 100644 index 0000000..2cbe786 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/garyRight.imageset/garyRight@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_add.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_add.imageset/Contents.json new file mode 100644 index 0000000..0f20551 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_add.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "life_add.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_add.imageset/life_add.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_add.imageset/life_add.png new file mode 100644 index 0000000..9431fdf Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_add.imageset/life_add.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_exist.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_exist.imageset/Contents.json new file mode 100644 index 0000000..61b9d76 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_exist.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "life_exist.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_exist.imageset/life_exist.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_exist.imageset/life_exist.png new file mode 100644 index 0000000..bad6064 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_exist.imageset/life_exist.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_reduce.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_reduce.imageset/Contents.json new file mode 100644 index 0000000..fb33bfa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_reduce.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "life_reduce.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_reduce.imageset/life_reduce.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_reduce.imageset/life_reduce.png new file mode 100644 index 0000000..8407509 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/life_reduce.imageset/life_reduce.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/Contents.json new file mode 100644 index 0000000..e260645 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "lookDetailRight.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "lookDetailRight@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "lookDetailRight@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight.png new file mode 100644 index 0000000..7e46ef9 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight@2x.png new file mode 100644 index 0000000..9a3da9c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight@3x.png new file mode 100644 index 0000000..9288642 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/lookDetailRight.imageset/lookDetailRight@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/Contents.json new file mode 100644 index 0000000..39e898f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "searchLeftIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "searchLeftIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "searchLeftIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon.png new file mode 100644 index 0000000..3aa8b34 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon@2x.png new file mode 100644 index 0000000..5668126 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon@3x.png new file mode 100644 index 0000000..105084d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/searchLeftIcon.imageset/searchLeftIcon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/Contents.json new file mode 100644 index 0000000..d334639 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "smallStatis_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "smallStatis_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "smallStatis_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon.png new file mode 100644 index 0000000..9996491 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon@2x.png new file mode 100644 index 0000000..ec4c401 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon@3x.png new file mode 100644 index 0000000..d2ec8cb Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/smallStatis_icon.imageset/smallStatis_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/Contents.json new file mode 100644 index 0000000..52cbfc6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "square_nomal.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "square_nomal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "square_nomal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal.png new file mode 100644 index 0000000..1112c38 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal@2x.png new file mode 100644 index 0000000..20c5a93 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal@3x.png new file mode 100644 index 0000000..6f9ecc6 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_nomal.imageset/square_nomal@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/Contents.json new file mode 100644 index 0000000..0d71b31 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "square_selected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "square_selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "square_selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected.png new file mode 100644 index 0000000..df3dce3 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected@2x.png new file mode 100644 index 0000000..75fe2a7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected@3x.png new file mode 100644 index 0000000..8ec4da3 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/square_selected.imageset/square_selected@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/Contents.json new file mode 100644 index 0000000..9e7fd4b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "statusticBackImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "statusticBackImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "statusticBackImg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg.png new file mode 100644 index 0000000..8565c87 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg@2x.png new file mode 100644 index 0000000..fb2d2f6 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg@3x.png new file mode 100644 index 0000000..f513e45 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/statusticBackImg.imageset/statusticBackImg@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/Contents.json new file mode 100644 index 0000000..c6bdb12 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "userinfoTitleImg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "userinfoTitleImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "userinfoTitleImg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg.png new file mode 100644 index 0000000..2022113 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg@2x.png new file mode 100644 index 0000000..5329191 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg@3x.png new file mode 100644 index 0000000..82c25c1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/userinfoTitleImg.imageset/userinfoTitleImg@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/Contents.json new file mode 100644 index 0000000..88b6088 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon.png new file mode 100644 index 0000000..212fc79 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon@2x.png new file mode 100644 index 0000000..79f2a20 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon@3x.png new file mode 100644 index 0000000..6b842dc Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ToolsImg/whiteBack_icon.imageset/whiteBack_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/Contents.json new file mode 100644 index 0000000..9ccb953 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "aboutUS_Icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "aboutUS_Icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "aboutUS_Icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon.png new file mode 100644 index 0000000..5764a55 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon@2x.png new file mode 100644 index 0000000..31d4f0b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon@3x.png new file mode 100644 index 0000000..f926375 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/aboutUS_Icon.imageset/aboutUS_Icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..5adc5fe --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/c_chaKeyboardButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/c_chaKeyboardButton.png new file mode 100644 index 0000000..2a40475 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/c_chaKeyboardButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/c_chaKeyboardButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/c_chaKeyboardButton@2x.png new file mode 100644 index 0000000..0848386 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButton.imageset/c_chaKeyboardButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..286649e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel.png new file mode 100644 index 0000000..a309280 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel@2x.png new file mode 100644 index 0000000..b5b044f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardButtonSel.imageset/c_chaKeyboardButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/Contents.json new file mode 100644 index 0000000..085a4a0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton.png new file mode 100644 index 0000000..035c844 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton@2x.png new file mode 100644 index 0000000..2af7e60 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButton.imageset/c_chaKeyboardShiftButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/Contents.json new file mode 100644 index 0000000..455dea7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel.png new file mode 100644 index 0000000..ebe15db Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel@2x.png new file mode 100644 index 0000000..0d7ae24 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chaKeyboardShiftButtonSel.imageset/c_chaKeyboardShiftButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..88710e0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/c_charKeyboardButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/c_charKeyboardButton.png new file mode 100644 index 0000000..2a40475 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/c_charKeyboardButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/c_charKeyboardButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/c_charKeyboardButton@2x.png new file mode 100644 index 0000000..0848386 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButton.imageset/c_charKeyboardButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..64826cf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButtonSel.imageset/c_charKeyboardButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButtonSel.imageset/c_charKeyboardButtonSel@2x.png new file mode 100644 index 0000000..b5b044f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardButtonSel.imageset/c_charKeyboardButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/Contents.json new file mode 100644 index 0000000..200e41b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton.png new file mode 100644 index 0000000..035c844 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton@2x.png new file mode 100644 index 0000000..2af7e60 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButton.imageset/c_charKeyboardShiftButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/Contents.json new file mode 100644 index 0000000..75a1c11 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel.png new file mode 100644 index 0000000..ebe15db Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel@2x.png new file mode 100644 index 0000000..0d7ae24 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_charKeyboardShiftButtonSel.imageset/c_charKeyboardShiftButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/Contents.json new file mode 100644 index 0000000..a33732d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton.png new file mode 100644 index 0000000..3be4240 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton@2x.png new file mode 100644 index 0000000..9d9778f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButton.imageset/c_character_keyboardDeleteButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/Contents.json new file mode 100644 index 0000000..cb84c4e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel.png new file mode 100644 index 0000000..3fec22b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel@2x.png new file mode 100644 index 0000000..f36ead2 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardDeleteButtonSel.imageset/c_character_keyboardDeleteButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..3f24f3a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton.png new file mode 100644 index 0000000..c7657ec Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..fcb3e69 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButton.imageset/c_character_keyboardSwitchButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..8a7395a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..bb30ac1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..6f47c0e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_character_keyboardSwitchButtonSel.imageset/c_character_keyboardSwitchButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chraKeyboardButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chraKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..afe3143 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chraKeyboardButtonSel.imageset/c_chraKeyboardButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chraKeyboardButtonSel.imageset/c_chraKeyboardButtonSel.png new file mode 100644 index 0000000..a309280 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_chraKeyboardButtonSel.imageset/c_chraKeyboardButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/Contents.json new file mode 100644 index 0000000..027a110 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/c_keyboardBackground.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/c_keyboardBackground.png new file mode 100644 index 0000000..da5038b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/c_keyboardBackground.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/c_keyboardBackground@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/c_keyboardBackground@2x.png new file mode 100644 index 0000000..be32fda Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_keyboardBackground.imageset/c_keyboardBackground@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..ae5e4ce --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/c_numKeyboardButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/c_numKeyboardButton.png new file mode 100644 index 0000000..d9710bb Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/c_numKeyboardButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/c_numKeyboardButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/c_numKeyboardButton@2x.png new file mode 100644 index 0000000..2b622f7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButton.imageset/c_numKeyboardButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..04721bb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel.png new file mode 100644 index 0000000..6a065b0 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel@2x.png new file mode 100644 index 0000000..5a587d7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_numKeyboardButtonSel.imageset/c_numKeyboardButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/Contents.json new file mode 100644 index 0000000..2a50881 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton.png new file mode 100644 index 0000000..dbc39d0 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton@2x.png new file mode 100644 index 0000000..4374932 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButton.imageset/c_number_keyboardDeleteButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/Contents.json new file mode 100644 index 0000000..618999c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel.png new file mode 100644 index 0000000..ebe0742 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel@2x.png new file mode 100644 index 0000000..3ef2251 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardDeleteButtonSel.imageset/c_number_keyboardDeleteButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..1c24fbb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton.png new file mode 100644 index 0000000..4ec929a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..ba96b34 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButton.imageset/c_number_keyboardSwitchButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..421bb36 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..6a14610 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..272e958 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_number_keyboardSwitchButtonSel.imageset/c_number_keyboardSwitchButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/Contents.json new file mode 100644 index 0000000..90911f5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton.png new file mode 100644 index 0000000..2a40475 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton@2x.png new file mode 100644 index 0000000..0848386 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButton.imageset/c_symbolKeyboardButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/Contents.json new file mode 100644 index 0000000..49e68f8 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel.png new file mode 100644 index 0000000..a309280 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel@2x.png new file mode 100644 index 0000000..b5b044f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbolKeyboardButtonSel.imageset/c_symbolKeyboardButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/Contents.json new file mode 100644 index 0000000..1a4e14b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton.png new file mode 100644 index 0000000..cb86c50 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton@2x.png new file mode 100644 index 0000000..2c72c1c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButton.imageset/c_symbol_keyboardDeleteButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/Contents.json new file mode 100644 index 0000000..27eaadd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel.png new file mode 100644 index 0000000..4481b08 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel@2x.png new file mode 100644 index 0000000..8c87729 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardDeleteButtonSel.imageset/c_symbol_keyboardDeleteButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/Contents.json new file mode 100644 index 0000000..c1ad3c2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton.png new file mode 100644 index 0000000..d8cbf0e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton@2x.png new file mode 100644 index 0000000..00b3d73 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButton.imageset/c_symbol_keyboardSwitchButton@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/Contents.json new file mode 100644 index 0000000..62eddfe --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel.png new file mode 100644 index 0000000..7a7a8e0 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel@2x.png new file mode 100644 index 0000000..a7ebf3a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/c_symbol_keyboardSwitchButtonSel.imageset/c_symbol_keyboardSwitchButtonSel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/doctorNoImage.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/doctorNoImage.imageset/Contents.json new file mode 100644 index 0000000..42fdf9d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/doctorNoImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "doctorNoImage.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/doctorNoImage.imageset/doctorNoImage.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/doctorNoImage.imageset/doctorNoImage.png new file mode 100644 index 0000000..62ee9cc Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/doctorNoImage.imageset/doctorNoImage.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/Contents.json new file mode 100644 index 0000000..f4cfc78 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem.png new file mode 100644 index 0000000..6082e54 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem@2x.png new file mode 100644 index 0000000..dd5b3a6 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem@3x.png new file mode 100644 index 0000000..34afa38 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/endQuestionItem.imageset/endQuestionItem@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.imageset/Contents.json new file mode 100644 index 0000000..fbd3d74 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "eye.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.imageset/eye.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.imageset/eye.png new file mode 100644 index 0000000..2d22fbb Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.imageset/eye.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.slash.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.slash.imageset/Contents.json new file mode 100644 index 0000000..a28350a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.slash.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "eye.slash.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.slash.imageset/eye.slash.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.slash.imageset/eye.slash.png new file mode 100644 index 0000000..ed4d56b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/eye.slash.imageset/eye.slash.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/Contents.json new file mode 100644 index 0000000..8d2a6c1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man.png new file mode 100644 index 0000000..4ac9c77 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man@2x.png new file mode 100644 index 0000000..1846f5f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man@3x.png new file mode 100644 index 0000000..ae465fe Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_man.imageset/heard_man@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/Contents.json new file mode 100644 index 0000000..43ad165 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman.png new file mode 100644 index 0000000..dd92f57 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman@2x.png new file mode 100644 index 0000000..f0b74c9 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman@3x.png new file mode 100644 index 0000000..2b03312 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/heard_woman.imageset/heard_woman@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/Contents.json new file mode 100644 index 0000000..a30e588 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "home_PictureQustion.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_PictureQustion@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "home_PictureQustion@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion.png new file mode 100644 index 0000000..b45bcf5 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion@2x.png new file mode 100644 index 0000000..6f669ba Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion@3x.png new file mode 100644 index 0000000..4fc856c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_PictureQustion.imageset/home_PictureQustion@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/Contents.json new file mode 100644 index 0000000..224a41b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "home_VideoQustion.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_VideoQustion@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "home_VideoQustion@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion.png new file mode 100644 index 0000000..063d6dd Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion@2x.png new file mode 100644 index 0000000..744e47c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion@3x.png new file mode 100644 index 0000000..278f9f8 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_VideoQustion.imageset/home_VideoQustion@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/Contents.json new file mode 100644 index 0000000..a6e685b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "home_small.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_small@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/home_small.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/home_small.png new file mode 100644 index 0000000..093c129 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/home_small.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/home_small@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/home_small@2x.png new file mode 100644 index 0000000..f67a0a7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_small.imageset/home_small@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ic_more_location.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ic_more_location.imageset/Contents.json new file mode 100644 index 0000000..17eb02c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ic_more_location.imageset/ic_more_location.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ic_more_location.imageset/ic_more_location.png new file mode 100644 index 0000000..9600b12 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/ic_more_location.imageset/ic_more_location.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/Contents.json new file mode 100644 index 0000000..0ae8f17 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "loginTitle.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "loginTitle@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "loginTitle@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle.png new file mode 100644 index 0000000..147608d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle@2x.png new file mode 100644 index 0000000..e378da1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle@3x.png new file mode 100644 index 0000000..d025037 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle.imageset/loginTitle@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/Contents.json new file mode 100644 index 0000000..d8a85d6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "loginTitle_Img.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "loginTitle_Img@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "loginTitle_Img@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img.png new file mode 100644 index 0000000..63196ee Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img@2x.png new file mode 100644 index 0000000..cadf065 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img@3x.png new file mode 100644 index 0000000..40327cf Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginTitle_Img.imageset/loginTitle_Img@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/Contents.json new file mode 100644 index 0000000..96cc44e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "login_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "login_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon.png new file mode 100644 index 0000000..4997501 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon@2x.png new file mode 100644 index 0000000..53628a8 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon@3x.png new file mode 100644 index 0000000..e87a31a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/login_icon.imageset/login_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/Contents.json new file mode 100644 index 0000000..31ab085 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "mainHeard_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "mainHeard_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "mainHeard_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon.png new file mode 100644 index 0000000..7e66d19 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon@2x.png new file mode 100644 index 0000000..71c469d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon@3x.png new file mode 100644 index 0000000..1c4300b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/mainHeard_icon.imageset/mainHeard_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/merchatAddImg.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/merchatAddImg.imageset/Contents.json new file mode 100644 index 0000000..a8da059 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/merchatAddImg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "merchatAddImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/merchatAddImg.imageset/merchatAddImg@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/merchatAddImg.imageset/merchatAddImg@2x.png new file mode 100644 index 0000000..012ac42 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/merchatAddImg.imageset/merchatAddImg@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/navBackImg.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/navBackImg.imageset/Contents.json new file mode 100644 index 0000000..2480592 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/navBackImg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "navBackImg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/navBackImg.imageset/navBackImg@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/navBackImg.imageset/navBackImg@2x.png new file mode 100644 index 0000000..5ebaddd Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/navBackImg.imageset/navBackImg@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/Contents.json new file mode 100644 index 0000000..c272944 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "noDataBox.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "noDataBox@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "noDataBox@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox.png new file mode 100644 index 0000000..c1e73db Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox@2x.png new file mode 100644 index 0000000..71f7dd0 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox@3x.png new file mode 100644 index 0000000..874e155 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/noDataBox.imageset/noDataBox@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/pin.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/pin.imageset/Contents.json new file mode 100644 index 0000000..bf11042 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/pin.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "pin.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/pin.imageset/pin.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/pin.imageset/pin.png new file mode 100644 index 0000000..903297a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/pin.imageset/pin.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/placeholdIMG.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/placeholdIMG.imageset/Contents.json new file mode 100644 index 0000000..c7967d4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/placeholdIMG.imageset/placeholdIMG.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/placeholdIMG.imageset/placeholdIMG.png new file mode 100644 index 0000000..641a563 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/placeholdIMG.imageset/placeholdIMG.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/Contents.json new file mode 100644 index 0000000..15d0d53 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "db_play_big@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "db_play_big@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/db_play_big@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/db_play_big@2x.png new file mode 100644 index 0000000..4e85350 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/db_play_big@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/db_play_big@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/db_play_big@3x.png new file mode 100644 index 0000000..26e3591 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/play.imageset/db_play_big@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/Contents.json new file mode 100644 index 0000000..a080fd0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack.png new file mode 100644 index 0000000..84ccda7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack@2x.png new file mode 100644 index 0000000..a30a513 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack@3x.png new file mode 100644 index 0000000..d921dd2 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionDetailBack.imageset/questionDetailBack@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/Contents.json new file mode 100644 index 0000000..111cb94 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon.png new file mode 100644 index 0000000..7fd6343 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon@2x.png new file mode 100644 index 0000000..c884a0d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon@3x.png new file mode 100644 index 0000000..82f0ffe Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionLeft_icon.imageset/questionLeft_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/Contents.json new file mode 100644 index 0000000..df558e0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "questionStatistics_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "questionStatistics_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "questionStatistics_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon.png new file mode 100644 index 0000000..13bd497 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon@2x.png new file mode 100644 index 0000000..b36d2df Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon@3x.png new file mode 100644 index 0000000..14210c1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/questionStatistics_icon.imageset/questionStatistics_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/Contents.json new file mode 100644 index 0000000..3d22844 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg.png new file mode 100644 index 0000000..eeda23b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg@2x.png new file mode 100644 index 0000000..b8bce1c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg@3x.png new file mode 100644 index 0000000..3da5d8b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/reportBackImg.imageset/reportBackImg@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/Contents.json new file mode 100644 index 0000000..095ad70 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "schedulingSeting_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "schedulingSeting_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "schedulingSeting_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon.png new file mode 100644 index 0000000..9e249f1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon@2x.png new file mode 100644 index 0000000..f6b9e34 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon@3x.png new file mode 100644 index 0000000..8566d00 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/schedulingSeting_icon.imageset/schedulingSeting_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/Contents.json new file mode 100644 index 0000000..c8f8644 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/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/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal.png new file mode 100644 index 0000000..1bb6d1b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal@2x.png new file mode 100644 index 0000000..a7cbc1e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal@3x.png new file mode 100644 index 0000000..88dd93c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/selectedNomal.imageset/selectedNomal@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/Contents.json new file mode 100644 index 0000000..6cf71e4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "sendVideo_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "sendVideo_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "sendVideo_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon.png new file mode 100644 index 0000000..79ff83f Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon@2x.png new file mode 100644 index 0000000..ccd44ff Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon@3x.png new file mode 100644 index 0000000..7b2fd4c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/sendVideo_icon.imageset/sendVideo_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/Contents.json new file mode 100644 index 0000000..e4666b5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "smallHelp_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "smallHelp_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "smallHelp_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon.png new file mode 100644 index 0000000..6eb9a10 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon@2x.png new file mode 100644 index 0000000..1905a65 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon@3x.png new file mode 100644 index 0000000..0ae524e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/smallHelp_icon.imageset/smallHelp_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/Contents.json new file mode 100644 index 0000000..67dd680 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "stopHelp_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "stopHelp_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "stopHelp_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon.png new file mode 100644 index 0000000..4ae5890 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon@2x.png new file mode 100644 index 0000000..5c4e8a1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon@3x.png new file mode 100644 index 0000000..1762a07 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopHelp_icon.imageset/stopHelp_icon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/Contents.json new file mode 100644 index 0000000..af9c094 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "stopQuestionIcon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "stopQuestionIcon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "stopQuestionIcon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon.png new file mode 100644 index 0000000..7b4fe7b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon@2x.png new file mode 100644 index 0000000..c3aeabb Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon@3x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon@3x.png new file mode 100644 index 0000000..9d12b74 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/stopQuestionIcon.imageset/stopQuestionIcon@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Base.lproj/LaunchScreen.storyboard b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/HQConst.h b/DoctorXinjiang/DoctorXinjiang/Supporting Files/HQConst.h new file mode 100644 index 0000000..7d6d617 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/HQConst.h @@ -0,0 +1,18 @@ +// +// 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; diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/HQConst.m b/DoctorXinjiang/DoctorXinjiang/Supporting Files/HQConst.m new file mode 100644 index 0000000..8170dd4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/HQConst.m @@ -0,0 +1,17 @@ +// +// 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"; diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Info.plist b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Info.plist new file mode 100644 index 0000000..e306f19 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleLocalizations + + zh + + Localization native development region + China + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + + + diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/PrefixHeader.pch b/DoctorXinjiang/DoctorXinjiang/Supporting Files/PrefixHeader.pch new file mode 100644 index 0000000..300c554 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/PrefixHeader.pch @@ -0,0 +1,80 @@ +// +// PrefixHeader.pch +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch +#ifdef __OBJC__ +//全局宏 +#import "YYUtilsMacros.h" +#import "FontAndColorMacros.h" +#import "ThirdMacros.h" +#import "StatusMacros.h" +#import "HQConst.h" +#import "HQCommonUtils.h" +#import "YXUserInfo.h" +#import "YXNetAPI.h" +//基础类 +#import "AppDelegate.h" +#import "AppDelegate+AppService.h" +#import "YXBaseViewController.h" +#import "YXBaseNavigationController.h" +#import "YXBaseTabBarController.h" +#import "MBProgressHUD+XY.h" +#import "AppManager.h" +#import "IMUserInfoModel.h" +#import "ESCTUIManager.h" +//分类 +#import "UIButton+NYS.h" +#import "UILabel+ChangeLineSpaceAndWordSpace.h" +#import "UIImage+GIF.h" +#import "UIImageView+WebCache.h" + +//第三方 +#import +#import +#import +#import "MJRefresh.h" +#import "Masonry.h" +//#import "ErrorInfoUtility.h" +#import +#import +#import +#import "EasyShowView.h" +#import "TUICallKit.h" +#import "LYEmptyView.h" +#import "LYEmptyViewHeader.h" +//工具类 +#import "MCalendarShortView.h" +#import "MCalendarTitleView.h" +#import "MCalendarView.h" +#import "NSDate+Calendar.h" +#import "CalendarConfig.h" +#import "JX_GCDTimerManager.h" +#import "CalendarConfig.h" + + +static NSString * PingFangSC_Med = @"PingFangSC-Medium"; +static NSString * PingFangSC_Reg = @"PingFangSC-Regular"; +static NSString * PingFangSC_Lig = @"PingFangSC-Light"; +static NSString * PingFangTC_Sem = @"PingFangTC-Semibold"; + +#endif +#ifdef DEBUG + + +#else + +#define NSLog(FORMAT, ...) nil + +#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/DoctorXinjiang/DoctorXinjiang/Supporting Files/main.m b/DoctorXinjiang/DoctorXinjiang/Supporting Files/main.m new file mode 100644 index 0000000..5577728 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/main.m @@ -0,0 +1,18 @@ +// +// main.m +// healthQuestion +// +// Created by xulei on 2022/8/11. +// + +#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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.h new file mode 100755 index 0000000..94521bc --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressModel.m new file mode 100755 index 0000000..b84bc2c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.bundle/BRCity.json b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.bundle/BRCity.json new file mode 100755 index 0000000..d67fc79 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.h new file mode 100755 index 0000000..aab271b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/AddressPickerView/BRAddressPickerView.m new file mode 100755 index 0000000..f9da612 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/BRPickerView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/BRPickerView.h new file mode 100755 index 0000000..118f605 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRBaseView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRBaseView.h new file mode 100644 index 0000000..6c47162 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRBaseView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRBaseView.m new file mode 100644 index 0000000..732e26c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRBaseView.m @@ -0,0 +1,405 @@ +// +// 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 *backgroundMaskView; +// 标题栏背景视图 +@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]; + if (self.backgroundMaskView && self.backgroundMaskView != self) { + if (self.backgroundMaskView.superview) { + [self.backgroundMaskView removeFromSuperview]; + } + [self addSubview:self.backgroundMaskView]; + } + } + + [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 *)backgroundMaskView { + if (!_backgroundMaskView) { + _backgroundMaskView = [[UIView alloc]initWithFrame:self.keyView.bounds]; + _backgroundMaskView.backgroundColor = self.pickerStyle.maskColor; + // 设置子视图的大小随着父视图变化 + _backgroundMaskView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + _backgroundMaskView.userInteractionEnabled = YES; + UITapGestureRecognizer *myTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(didTapMaskView:)]; + [_backgroundMaskView addGestureRecognizer:myTap]; + } + //_maskView + return _backgroundMaskView; +} + +#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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerStyle.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerStyle.h new file mode 100644 index 0000000..c57bb3d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerStyle.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerStyle.m new file mode 100644 index 0000000..fa8600c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerView.bundle/en.lproj/Localizable.strings b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerView.bundle/en.lproj/Localizable.strings new file mode 100644 index 0000000..ad98740 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings new file mode 100644 index 0000000..002110f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings new file mode 100644 index 0000000..9c3521b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerViewMacro.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/BRPickerViewMacro.h new file mode 100644 index 0000000..717480e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.h new file mode 100644 index 0000000..a0b7d5f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/Base/NSBundle+BRPickerView.m new file mode 100644 index 0000000..898f05e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.h new file mode 100644 index 0000000..44e2c4d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView+BR.m new file mode 100644 index 0000000..61e777c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.h new file mode 100755 index 0000000..db1635d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/BRDatePickerView.m new file mode 100755 index 0000000..645ffcb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.h new file mode 100644 index 0000000..66820eb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/DatePickerView/NSDate+BRPickerView.m new file mode 100644 index 0000000..00b4da2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRResultModel.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRResultModel.h new file mode 100644 index 0000000..26b04f4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRResultModel.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRResultModel.m new file mode 100644 index 0000000..6a34748 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.h new file mode 100755 index 0000000..7dd5e0f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/BRPickerView/StringPickerView/BRStringPickerView.m new file mode 100755 index 0000000..2cc26aa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/Root.plist b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/Root.plist new file mode 100644 index 0000000..b1b6fea --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/Root.plist @@ -0,0 +1,61 @@ + + + + + StringsTable + Root + PreferenceSpecifiers + + + Type + PSGroupSpecifier + Title + Group + + + Type + PSTextFieldSpecifier + Title + Name + Key + name_preference + DefaultValue + + IsSecure + + KeyboardType + Alphabet + AutocapitalizationType + None + AutocorrectionType + No + + + Type + PSToggleSwitchSpecifier + Title + Enabled + Key + enabled_preference + DefaultValue + + + + Type + PSSliderSpecifier + Key + slider_preference + DefaultValue + 0.5 + MinimumValue + 0 + MaximumValue + 1 + MinimumValueImage + + MaximumValueImage + + + + + diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/en.lproj/Root.strings b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/en.lproj/Root.strings new file mode 100644 index 0000000..8cd87b9 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/en.lproj/Root.strings differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/left_normal@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/left_normal@2x.png new file mode 100644 index 0000000..9eb0b2e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/left_normal@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/left_normal@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/left_normal@3x.png new file mode 100644 index 0000000..2cb416a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/left_normal@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/right_normal@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/right_normal@2x.png new file mode 100644 index 0000000..670ece1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/right_normal@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/right_normal@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/right_normal@3x.png new file mode 100644 index 0000000..b3160f8 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/right_normal@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/up@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/up@2x.png new file mode 100644 index 0000000..1e5ce7c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/up@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/up@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/up@3x.png new file mode 100644 index 0000000..dea9a93 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/Calendar.bundle/up@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/CalendarConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/CalendarConfig.h new file mode 100644 index 0000000..08e3ec3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/CalendarConfig.h @@ -0,0 +1,32 @@ +// +// CalendarConfig.h +// GoldCalendarFramework +// +// Created by Micker on 16/3/2. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import +#import + +@interface CalendarConfig : NSObject + +@property (nonatomic, strong) UIColor *textColor; +@property (nonatomic, strong) UIColor *selectTextColor; +@property (nonatomic, strong) UIColor *backgroundColor; +@property (nonatomic, strong) UIColor *selectBackgroundColor; + +@property (nonatomic, strong) UIColor *todayTextColor; +@property (nonatomic, strong) UIColor *todaySelectedTextColor; +@property (nonatomic, strong) UIColor *todayBackgroundColor; +@property (nonatomic, strong) UIColor *todaySelectBackgroundColor; + +@property (nonatomic, strong) UIColor *outMonthTextColor; +@property (nonatomic, strong) UIColor *outMonthSelectedTextColor; +@property (nonatomic, strong) UIColor *outBackgroundColor; +@property (nonatomic, strong) UIColor *outSelectBackgroundColor; + + ++ (instancetype) sharedInstance; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/CalendarConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/CalendarConfig.m new file mode 100644 index 0000000..e66b176 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/CalendarConfig.m @@ -0,0 +1,86 @@ +// +// CalendarConfig.m +// GoldCalendarFramework +// +// Created by Micker on 16/3/2. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "CalendarConfig.h" + +@implementation CalendarConfig + ++ (instancetype) sharedInstance { + static CalendarConfig *instance; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [[CalendarConfig alloc] init]; + }); + return instance; +} + +- (UIColor *) textColor { + if (!_textColor) { + return [UIColor blackColor]; + } + return _textColor; +} + +- (UIColor *) selectTextColor { + if (!_selectTextColor) { + return [UIColor blackColor]; + } + return _selectTextColor; +} + +- (UIColor *) backgroundColor { + if (!_backgroundColor) { + return [UIColor whiteColor]; + } + return _backgroundColor; +} + +- (UIColor *) todayTextColor { + if (!_todayTextColor) { + return [UIColor redColor]; + } + return _todayTextColor; +} + +- (UIColor *) todaySelectedTextColor { + if (!_todaySelectedTextColor) { + return [UIColor blackColor]; + } + return _todaySelectedTextColor; +} + +- (UIColor *) todayBackgroundColor { + if (!_todayBackgroundColor) { + return [UIColor whiteColor]; + } + return _todayBackgroundColor; +} + + +- (UIColor *) outMonthtextColor { + if (!_outMonthTextColor) { + return [UIColor lightGrayColor]; + } + return _outMonthTextColor; +} + +- (UIColor *) outMonthSelectedTextColor { + if (!_outMonthSelectedTextColor) { + return [UIColor lightGrayColor]; + } + return _outMonthSelectedTextColor; +} + +- (UIColor *) outBackgroundColor { + if (!_outBackgroundColor) { + return [UIColor clearColor]; + } + return _outBackgroundColor; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarCollectionCell.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarCollectionCell.h new file mode 100644 index 0000000..04b0221 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarCollectionCell.h @@ -0,0 +1,16 @@ +// +// MCalendarCollectionCell.h +// GoldCalendarFramework +// +// Created by Micker on 16/5/5. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import +#import "MCalendarItem.h" + +@interface MCalendarCollectionCell : UICollectionViewCell + +- (void) doSetContentData:(id) content; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarCollectionCell.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarCollectionCell.m new file mode 100644 index 0000000..87c4b80 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarCollectionCell.m @@ -0,0 +1,86 @@ +// +// MCalendarCollectionCell.m +// GoldCalendarFramework +// +// Created by Micker on 16/5/5. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "MCalendarCollectionCell.h" +#import "CalendarConfig.h" + +@interface MCalendarCollectionCell() +@property (nonatomic, strong) UILabel *label; +@property (nonatomic, assign) UIColor *normalColor; +@property (nonatomic, strong) MCalendarItem *item; + +@end + +@implementation MCalendarCollectionCell + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self addSubview:self.label]; + } + return self; +} + +- (UILabel *) label { + if (!_label) { + _label = [[UILabel alloc] initWithFrame:self.bounds]; + _label.text = @""; + _label.textAlignment = NSTextAlignmentCenter; + _label.font = [UIFont systemFontOfSize:14.0f]; + _label.numberOfLines = 2; + _label.layer.cornerRadius = 5.0; + _label.layer.masksToBounds = true; + _label.backgroundColor = [UIColor clearColor]; + } + return _label; +} + +- (void) doSetContentData:(id) content { + self.item = (MCalendarItem *) content; + if(_item.inMonth) { + if (_item.isToday) { + NSString *day = [NSString stringWithFormat:@"%@",@([_item.date day])]; + NSString *result = [NSString stringWithFormat:@"%@\n(今天)", day]; + NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:result]; + [attributeString addAttribute:NSFontAttributeName + value:[UIFont systemFontOfSize:12.0f] + range:NSMakeRange(day.length, result.length - day.length)]; + + _label.attributedText = attributeString; + _label.textColor = self.isSelected ? [CalendarConfig sharedInstance].todaySelectedTextColor : [CalendarConfig sharedInstance].todayTextColor; + _label.backgroundColor = [CalendarConfig sharedInstance].todayBackgroundColor; + } + else { + if (_item.isAppointment) { + _label.text = [NSString stringWithFormat:@"%@\n%@", @([_item.date day]),@"可约"]; + + }else + { + _label.text = [NSString stringWithFormat:@"%@\n%@", @([_item.date day]),@"不可约"]; + + } +// _label.text = [NSString stringWithFormat:@"%@", @([_item.date day]),@"可约"]; + _label.textColor = self.isSelected ? [CalendarConfig sharedInstance].selectTextColor : [CalendarConfig sharedInstance].textColor; + _label.backgroundColor = [CalendarConfig sharedInstance].backgroundColor; + } + + if (self.isSelected && [_label.text length] > 0) { + _label.backgroundColor = [CalendarConfig sharedInstance].selectBackgroundColor; + + } + } else { + _label.text = @""; + _label.textColor = [CalendarConfig sharedInstance].outMonthTextColor; + _label.backgroundColor = [CalendarConfig sharedInstance].outBackgroundColor; + + } + +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarItem.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarItem.h new file mode 100644 index 0000000..37e817c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarItem.h @@ -0,0 +1,35 @@ +// +// MCalendarItem.h +// GoldCalendarFramework +// +// Created by Micker on 16/4/6. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import +#import +#import "NSDate+Calendar.h" + +@interface MCalendarItem : NSObject + +@property (nonatomic, strong) NSDate *date; + +@property (nonatomic, assign) BOOL isToday; + +@property (nonatomic, assign) BOOL inMonth; + +@property (nonatomic, assign) BOOL isAppointment; + + +- (id) initWitDate:(NSDate *) date inMonth:(BOOL) inMonth; + +@end + + + +@interface CalendarManager : NSObject + +@property (nonatomic, strong) NSDate *date; +@property (nonatomic, strong, readonly) NSMutableArray *allDates; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarItem.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarItem.m new file mode 100644 index 0000000..6df53be --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarItem.m @@ -0,0 +1,61 @@ +// +// MCalendarItem.m +// GoldCalendarFramework +// +// Created by Micker on 16/4/6. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "MCalendarItem.h" + +@implementation MCalendarItem + +- (id) initWitDate:(NSDate *) date inMonth:(BOOL) inMonth { + self = [super init]; + if (self) { + self.inMonth = inMonth; + self.date = date; + } + return self; +} + +@end + +@interface CalendarManager() +@property (nonatomic, strong) NSMutableArray *allDates; + +@end + +@implementation CalendarManager + +- (void) setDate:(NSDate *)date { + if (_date != date) { + _date = date; + [self computeData]; + } +} + +- (void) computeData { + self.allDates = [NSMutableArray array]; + + NSDate *startDate = [_date firstDateInThisMonth]; + + for (int i = 1 ,total = [_date firstWeekdayInThisMonth]; i < total; i++) { + startDate = [startDate preDay]; + [_allDates insertObject:[[MCalendarItem alloc] initWitDate:startDate inMonth:NO] atIndex:0]; + } + + startDate = [_date firstDateInThisMonth]; + + for (int i = 0 ,total = [_date totalDaysInThisMonth]; i < total; i++) { + [_allDates addObject:[[MCalendarItem alloc] initWitDate:startDate inMonth:YES]]; + startDate = [startDate nextDay]; + } + + for (int i = [startDate weekday] ,total = 7; 1 != i && i <= total; i++) { + [_allDates addObject:[[MCalendarItem alloc] initWitDate:startDate inMonth:NO]]; + startDate = [startDate nextDay]; + } +} + +@end \ No newline at end of file diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarShortView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarShortView.h new file mode 100644 index 0000000..d4f1538 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarShortView.h @@ -0,0 +1,20 @@ +// +// MCalendarShortView.h +// GoldCalendarFramework +// +// Created by Micker on 16/4/6. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import + +@interface MCalendarShortView : UIView + +@property (nonatomic, strong, readonly) UIButton *preButton; +@property (nonatomic, strong, readonly) UIButton *nextButton; + +@property (nonatomic, strong) NSDate *date; + +@property (nonatomic, copy) void (^block)(NSDate *date); + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarShortView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarShortView.m new file mode 100644 index 0000000..2a77ca6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarShortView.m @@ -0,0 +1,118 @@ +// +// MCalendarShortView.m +// GoldCalendarFramework +// +// Created by Micker on 16/4/6. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "MCalendarShortView.h" +#import "NSDate+Calendar.h" + +@interface MCalendarShortView () + +@property (nonatomic, strong) UIButton *preButton; +@property (nonatomic, strong) UIButton *nextButton; +@property (nonatomic, strong) UILabel *dayLabel; +@property (nonatomic, strong) UILabel *weekLabel; +@property (nonatomic, strong) UILabel *monthLabel; + +@end + +@implementation MCalendarShortView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self addSubview:self.preButton]; + [self addSubview:self.nextButton]; + [self addSubview:self.dayLabel]; + [self addSubview:self.weekLabel]; + [self addSubview:self.monthLabel]; + } + return self; +} + + +#pragma mark -- Getter && Setter + +- (UIButton *) preButton { + if (!_preButton) { + _preButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_preButton setImage:[UIImage imageNamed:@"Calendar.bundle/left_normal"] forState:UIControlStateNormal]; + [_preButton setImage:[UIImage imageNamed:@"Calendar.bundle/left_select"] forState:UIControlStateSelected]; + [_preButton setImage:[UIImage imageNamed:@"Calendar.bundle/left_select"] forState:UIControlStateHighlighted]; + _preButton.frame = CGRectMake(0, 0, 40, 40); + [_preButton addTarget:self action:@selector(preAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _preButton; +} + +- (UIButton *) nextButton { + if (!_nextButton) { + _nextButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_nextButton setImage:[UIImage imageNamed:@"Calendar.bundle/right_normal"] forState:UIControlStateNormal]; + [_nextButton setImage:[UIImage imageNamed:@"Calendar.bundle/right_select"] forState:UIControlStateSelected]; + [_nextButton setImage:[UIImage imageNamed:@"Calendar.bundle/right_select"] forState:UIControlStateHighlighted]; + _nextButton.frame = CGRectMake(155, 0, 40, 40); + [_nextButton addTarget:self action:@selector(nextAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _nextButton; +} + +- (UILabel *) dayLabel { + if (!_dayLabel) { + _dayLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 40, 40)]; + _dayLabel.text = @"-"; + _dayLabel.font = [UIFont systemFontOfSize:24]; + _dayLabel.textColor = [UIColor whiteColor]; + _dayLabel.textAlignment = NSTextAlignmentCenter; + _dayLabel.backgroundColor = [UIColor clearColor]; + } + return _dayLabel; +} + +- (UILabel *) weekLabel { + if (!_weekLabel) { + _weekLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 4, 80,20)]; + _weekLabel.text = @"-"; + _weekLabel.font = [UIFont systemFontOfSize:14]; + _weekLabel.textColor = [UIColor whiteColor]; + _weekLabel.backgroundColor = [UIColor clearColor]; + } + return _weekLabel; +} + +- (UILabel *) monthLabel { + if (!_monthLabel) { + _monthLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 20, 80, 20)]; + _monthLabel.text = @"-"; + _monthLabel.font = [UIFont systemFontOfSize:14]; + _monthLabel.textColor = [UIColor whiteColor]; + _monthLabel.backgroundColor = [UIColor clearColor]; + } + return _monthLabel; +} + +- (void) setDate:(NSDate *)date { + _date = date; + self.dayLabel.text = [NSString stringWithFormat:@"%@", @([date day])]; + self.weekLabel.text = [NSString stringWithFormat:@"星期%@", [date weekday] < 7 ? [date weekdayString] : @"日"]; + self.monthLabel.text = [NSString stringWithFormat:@"%@年%@月", @([date year]), @([date month])]; + if (self.block) { + self.block(self.date); + } +} + +- (IBAction)preAction:(id)sender { + self.date = [self.date preDay]; + +} + +- (IBAction)nextAction:(id)sender { + self.date = [self.date nextDay]; +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarTitleView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarTitleView.h new file mode 100644 index 0000000..7b404fd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarTitleView.h @@ -0,0 +1,31 @@ +// +// MCalendarTitleView.h +// GoldCalendarFramework +// +// Created by Micker on 16/5/26. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import +#import "MImageTitleButton.h" + +@protocol MCalendarTitleViewDelegate + +- (void) preDay:(NSDate *) date; + +- (void) nextDay:(NSDate *) date; + +@end + +@interface MCalendarTitleView : UIView + +@property (nonatomic, strong, readonly) MImageTitleButton *preButton; +@property (nonatomic, strong, readonly) MImageTitleButton *nextButton; +@property (nonatomic, strong, readonly) MImageTitleButton *middleButton; +@property (nonatomic, weak) id delegate; + +@property (nonatomic, copy) NSDate *date; + +@property (nonatomic, copy) void (^block)(NSDate *date); + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarTitleView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarTitleView.m new file mode 100644 index 0000000..7a16114 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarTitleView.m @@ -0,0 +1,102 @@ +// +// MCalendarTitleView.m +// GoldCalendarFramework +// +// Created by Micker on 16/5/26. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "MCalendarTitleView.h" +#import "NSDate+Calendar.h" +#import "MImageTitleButton.h" + +@interface MCalendarTitleView () + +@property (nonatomic, strong) MImageTitleButton *preButton; +@property (nonatomic, strong) MImageTitleButton *nextButton; +@property (nonatomic, strong) MImageTitleButton *middleButton; + +@end + +@implementation MCalendarTitleView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self addSubview:self.preButton]; + [self addSubview:self.middleButton]; + [self addSubview:self.nextButton]; + } + return self; +} + + +#pragma mark -- Getter && Setter + +- (MImageTitleButton *) preButton { + if (!_preButton) { + _preButton = [MImageTitleButton buttonWithType:UIButtonTypeCustom]; + [_preButton setTitle:@"< 前一天" forState:UIControlStateNormal]; + _preButton.titleLabel.font = [UIFont systemFontOfSize:12.0f]; + _preButton.frame = CGRectMake(14, 0, 60, CGRectGetHeight(self.bounds)); + _preButton.direction = ImageTitleDirectionLeft; + [_preButton addTarget:self action:@selector(preAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _preButton; +} + +- (MImageTitleButton *) middleButton { + if (!_middleButton) { + _middleButton = [MImageTitleButton buttonWithType:UIButtonTypeCustom]; + [_middleButton setTitle:@"" forState:UIControlStateNormal]; + _middleButton.titleLabel.font = [UIFont systemFontOfSize:12.0f]; + _middleButton.direction = ImageTitleDirectionRight; + _middleButton.frame = CGRectMake(CGRectGetWidth(self.bounds)/4, 0, CGRectGetWidth(self.bounds)/2, CGRectGetHeight(self.bounds)); + [_middleButton addTarget:self action:@selector(middleAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _middleButton; +} + +- (MImageTitleButton *) nextButton { + if (!_nextButton) { + _nextButton = [MImageTitleButton buttonWithType:UIButtonTypeCustom]; + [_nextButton setTitle:@"后一天 >" forState:UIControlStateNormal]; + _nextButton.titleLabel.font = [UIFont systemFontOfSize:12.0f]; + _nextButton.direction = ImageTitleDirectionRight; + _nextButton.frame = CGRectMake(CGRectGetWidth(self.bounds) - 74, 0, 60, CGRectGetHeight(self.bounds)); + [_nextButton addTarget:self action:@selector(nextAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _nextButton; +} + +- (void) setDate:(NSDate *)date { + _date = date; + NSString *dateString = [NSString stringWithFormat:@"%@ 周%@ ", [date stringWithFormat:@"YYYY年MM月dd日"],[date weekdayString]]; + [self.middleButton setTitle:dateString forState:UIControlStateNormal]; + if (self.block) { + self.block(self.date); + } +} + +- (IBAction)preAction:(id)sender { + self.date = [self.date preDay]; + if (self.delegate && [self.delegate respondsToSelector:@selector(preDay:)]) { + [self.delegate preDay:self.date]; + } +} + +- (IBAction)nextAction:(id)sender { + self.date = [self.date nextDay]; + if (self.delegate && [self.delegate respondsToSelector:@selector(nextDay:)]) { + [self.delegate nextDay:self.date]; + } +} + +- (IBAction)middleAction:(id)sender { + if (self.block) { + self.block(nil); + } +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarView.h new file mode 100644 index 0000000..8ef0032 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarView.h @@ -0,0 +1,36 @@ +// +// MCalendarView.h +// GoldCalendarFramework +// +// Created by Micker on 16/5/5. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import + +@protocol MCalendarViewDelegate + +- (void) preMonth:(NSDate *) date; + +- (void) nextMonth:(NSDate *) date; + +- (void) today:(NSDate *) date; + +@end + +@interface MCalendarView : UIView +@property (nonatomic, assign) BOOL enableAutoDismiss; +@property (nonatomic, strong) NSDate *startDate; +@property (nonatomic, strong) NSDate *selectedDate; + +@property (nonatomic, copy) NSString *selectedWeek; + +@property (nonatomic, weak) id delegate; +@property (nonatomic, copy) void (^hideBlock)(); +@property (nonatomic, copy) void (^block)(NSDate *date); + +- (void) hideCalendar; + +- (void) configGustures; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarView.m new file mode 100644 index 0000000..ec536d4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MCalendarView.m @@ -0,0 +1,384 @@ +// +// MCalendarView.m +// GoldCalendarFramework +// +// Created by Micker on 16/5/5. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "MCalendarView.h" +#import "MCalendarCollectionCell.h" +#import "MCalendarItem.h" + + +@interface MCalendarView () +@property (nonatomic, strong) UICollectionView *collectionView; +@property (nonatomic, strong) UIView *headerView; +@property (nonatomic, strong) UILabel *montLabel; +@property (nonatomic, strong) UIButton *preButton; +@property (nonatomic, strong) UIButton *nextButton; +@property (nonatomic, strong) UIButton *todayButton; +@property (nonatomic, strong) UICollectionViewFlowLayout *flowLayout; +@property (nonatomic, strong) CalendarManager *dateManger; +@property (nonatomic, strong) NSMutableArray * labelArray; + + +@property (nonatomic, strong) UIView *backgroundView; + +@end + +@implementation MCalendarView + +- (NSMutableArray *)labelArray { + if (!_labelArray) { + _labelArray = [[NSMutableArray alloc] init]; + } + return _labelArray; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.enableAutoDismiss = YES; + [self addSubview:self.preButton]; + [self addSubview:self.montLabel]; + [self addSubview:self.todayButton]; + [self addSubview:self.nextButton]; + [self addSubview:self.headerView]; + [self addSubview:self.collectionView]; + } + return self; +} + +- (void) layoutSubviews { + [super layoutSubviews]; + self.backgroundView.frame = CGRectMake(0, + CGRectGetMaxY(self.frame), + CGRectGetWidth(self.superview.frame), + CGRectGetHeight(self.superview.frame) - CGRectGetMaxY(self.frame)); +} + +- (void)didMoveToSuperview { + if (self.superview) { + [self.superview insertSubview:self.backgroundView belowSubview:self]; + } else { + [self.backgroundView removeFromSuperview]; + } +} + +#pragma mark -- Getter && Stter + +- (CalendarManager *) dateManger { + if (!_dateManger) { + _dateManger = [[CalendarManager alloc] init]; + } + return _dateManger; +} + + +- (UIView *) backgroundView { + if (!_backgroundView) { + _backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; + _backgroundView.backgroundColor = [UIColor clearColor]; + _backgroundView.clipsToBounds = YES; + [_backgroundView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideCalendarView:)]]; + } + return _backgroundView; +} + +- (UILabel *) montLabel { + if (!_montLabel) { + _montLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.bounds)/2-70, 7, 140, 30)]; + _montLabel.textAlignment = NSTextAlignmentCenter; + _montLabel.textColor = [UIColor colorWithRed:220.0f/255.0f green:220.0f/255.0f blue:220.0f/255.0f alpha:1]; + _montLabel.font = [UIFont boldSystemFontOfSize:15.0f]; + } + return _montLabel; +} + +- (UIButton *) preButton { + if (!_preButton) { + _preButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _preButton.frame = CGRectMake(CGRectGetWidth(self.bounds)/2 -104, 2, 44, 40); + [_preButton setImage:[UIImage imageNamed:@"Calendar.bundle/left_normal"] forState:UIControlStateNormal]; + [_preButton setImage:[UIImage imageNamed:@"Calendar.bundle/left_select"] forState:UIControlStateSelected]; + [_preButton setImage:[UIImage imageNamed:@"Calendar.bundle/left_select"] forState:UIControlStateHighlighted]; + _preButton.imageEdgeInsets = UIEdgeInsetsMake(8, 12, 8, 12); + [_preButton addTarget:self action:@selector(preMonthAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _preButton; +} + +- (UIButton *) todayButton { + if (!_todayButton) { + _todayButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _todayButton.frame = CGRectMake(CGRectGetWidth(self.bounds) - 64, 10, 50, 20); + [_todayButton addTarget:self action:@selector(todayAction:) forControlEvents:UIControlEventTouchUpInside]; + _todayButton.backgroundColor = [UIColor clearColor]; + _todayButton.layer.borderColor = [[UIColor colorWithRed:250.0/255.0 green:200./255.0 blue:20./255. alpha:1] CGColor]; + _todayButton.layer.cornerRadius = 2.0f; + _todayButton.layer.borderWidth = .5f; + _todayButton.titleLabel.font = [UIFont systemFontOfSize:11.0f]; + [_todayButton setTitle:@"返回今天" forState:UIControlStateNormal]; + [_todayButton setTitleColor:[UIColor colorWithRed:250.0/255.0 green:200./255.0 blue:20./255. alpha:1] forState:UIControlStateNormal]; + } + return _todayButton; +} + +- (UIButton *) nextButton { + if (!_nextButton) { + _nextButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _nextButton.frame = CGRectMake(CGRectGetWidth(self.bounds)/2 + 60, 2, 44, 40); + [_nextButton setImage:[UIImage imageNamed:@"Calendar.bundle/right_normal"] forState:UIControlStateNormal]; + [_nextButton setImage:[UIImage imageNamed:@"Calendar.bundle/right_select"] forState:UIControlStateSelected]; + [_nextButton setImage:[UIImage imageNamed:@"Calendar.bundle/right_select"] forState:UIControlStateHighlighted]; + _nextButton.imageEdgeInsets = UIEdgeInsetsMake(8, 12, 8, 12); + [_nextButton addTarget:self action:@selector(nextMonthAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _nextButton; +} + +- (UIView *) headerView { + if (!_headerView) { + _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.nextButton.frame), CGRectGetWidth(self.bounds), 30)]; + _headerView.backgroundColor = [UIColor clearColor]; + int uwidht = (int)(CGRectGetWidth(self.bounds)/7); + NSArray *titles = @[@"周日",@"周一",@"周二",@"周三",@"周四",@"周五",@"周六"]; + for (int i = 0 ; i < 7; i++) { + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(uwidht * i , 0, uwidht, CGRectGetHeight(_headerView.bounds))]; + label.textAlignment = NSTextAlignmentCenter; + label.backgroundColor = [UIColor clearColor]; + label.font = [UIFont systemFontOfSize:12.0f]; + label.text = titles[i]; + label.textColor = [UIColor colorWithRed:102./255. green:102./255. blue:102./255. alpha:1]; + [_headerView addSubview:label]; + [self.labelArray addObject:label]; + } + } + return _headerView; +} + +- (UICollectionView *) collectionView { + if (!_collectionView) { + int uwidht = (int)(CGRectGetWidth(self.bounds)/7); + CGRect frame = self.bounds; + frame.origin.y = CGRectGetMaxY(_headerView.frame); + _collectionView = [[UICollectionView alloc] initWithFrame:frame collectionViewLayout:self.flowLayout]; + _collectionView.delegate = self; + _collectionView.dataSource = self; + _collectionView.scrollEnabled = NO; + [_collectionView registerClass:[MCalendarCollectionCell class] forCellWithReuseIdentifier:NSStringFromClass([MCalendarCollectionCell class])]; + } + return _collectionView; +} + +- (UICollectionViewFlowLayout *) flowLayout { + if (!_flowLayout) { + _flowLayout = [[UICollectionViewFlowLayout alloc] init]; + _flowLayout.minimumLineSpacing = 6.f; + _flowLayout.minimumInteritemSpacing = 6.0f; + int uwidht = (int)((CGRectGetWidth(self.bounds)-48)/7); + int space = (int)CGRectGetWidth(self.bounds) - uwidht * 7; + float space1 = .5f; + + _flowLayout.sectionInset = UIEdgeInsetsMake(space1*2, space1, space1, space1); + _flowLayout.itemSize = CGSizeMake(uwidht, uwidht); + _flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical; + } + return _flowLayout; +} + +- (void)setStartDate:(NSDate *)startDate { + _startDate = startDate; + + self.dateManger.date = startDate; + + NSString * string = [startDate weekdayStringEx]; + + for (UILabel * label in self.labelArray) { + + NSString * labString = label.text; + + if ([labString containsString:string] ) { + + label.textColor = [UIColor redColor]; + } + else + { + label.textColor = [UIColor colorWithRed:102./255. green:102./255. blue:102./255. alpha:1]; + } + } + [self.collectionView reloadData]; + + self.montLabel.text = [NSString stringWithFormat:@"%@ 月 %@", [startDate monthString],@([startDate year])]; + CGRect rect = [self.collectionView frame]; + rect.size.height = [self.dateManger.allDates count] / 7 * (CGRectGetWidth(self.bounds)/7); + float y = rect.origin.y; + [self.collectionView setFrame:rect]; + rect.origin.y = self.frame.origin.y; + rect.size.height += CGRectGetMaxY(_headerView.frame); + [self setFrame:rect]; +} + + + +#pragma mark -- UICollectionViewDelegate + +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { + return 1; +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return [self.dateManger.allDates count]; +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + + MCalendarCollectionCell *cell = (MCalendarCollectionCell *) [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MCalendarCollectionCell class]) + forIndexPath:indexPath]; + MCalendarItem *item = [self.dateManger.allDates objectAtIndex:indexPath.item]; + NSString * appString = @"2022-10-26"; + if ([item.date isEqualToDate:[self stringToDate:appString withDateFormat:@"YYYY-MM-dd"]]) { + + item.isAppointment = true; + } + else + { + item.isAppointment = NO; + } + item.isToday = [item.date isSameDayAsDate:[NSDate date]]; + cell.selected = [item.date isSameDayAsDate:self.selectedDate]; + [cell doSetContentData:item]; + return cell; +} + +//字符串转日期格式 +- (NSDate *)stringToDate:(NSString *)dateString withDateFormat:(NSString *)format +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:format]; + + NSDate *date = [dateFormatter dateFromString:dateString]; + return [self worldTimeToChinaTime:date]; +} + +//将世界时间转化为中国区时间 +- (NSDate *)worldTimeToChinaTime:(NSDate *)date +{ + NSTimeZone *timeZone = [NSTimeZone systemTimeZone]; + NSInteger interval = [timeZone secondsFromGMTForDate:date]; + NSDate *localeDate = [date dateByAddingTimeInterval:interval]; + return localeDate; +} + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + + + MCalendarItem *item = [self.dateManger.allDates objectAtIndex:indexPath.item]; + self.selectedDate = item.date; + NSString * string = [item.date weekdayStringEx]; + NSLog(@"----当前点击%@",string); + + if (!item.inMonth) { + return;; + } + + for (UILabel * label in self.labelArray) { + + NSString * labString = label.text; + + if ([labString containsString:string] && item.inMonth) { + + label.textColor = [UIColor redColor]; + } + else + { + label.textColor = [UIColor colorWithRed:102./255. green:102./255. blue:102./255. alpha:1]; + + } +// NSLog(@"---匹配周末%@",labString); + + + + } + if (self.block && item.inMonth) { + [collectionView reloadData]; + self.block(item.date); + } + +} + +#pragma mark -- Section Action + +- (IBAction) preMonthAction:(id)sender { + [self setStartDate: [self.startDate preMonth]]; + + if (self.delegate && [self.delegate respondsToSelector:@selector(preMonth:)]) { + [self.delegate preMonth:self.startDate]; + } +} + +- (IBAction) nextMonthAction:(id)sender { + [self setStartDate: [self.startDate nextMonth]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(nextMonth:)]) { + [self.delegate nextMonth:self.startDate]; + } +} + +- (IBAction)todayAction:(id)sender { + self.selectedDate = [NSDate date]; + [self setStartDate:[NSDate date]]; + if (self.block) { + self.block(self.startDate); + } + if (self.delegate && [self.delegate respondsToSelector:@selector(today:)]) { + [self.delegate today:self.startDate]; + } +} + +#pragma mark --Action + +- (void) hideCalendar { + [self hideCalendarView:nil]; +} + +- (void) hideCalendarView:(UIGestureRecognizer *) recognizer { + if (!self.enableAutoDismiss) { + return; + } + CGRect rect = self.frame; + self.frame = rect; + rect.origin.y = -rect.size.height; + __weak typeof(self) weakSelf = self; + [UIView animateWithDuration:0.2f animations:^{ + weakSelf.frame = rect; + if (weakSelf.hideBlock) { + weakSelf.hideBlock(); + } + } completion:^(BOOL finished) { + [weakSelf removeFromSuperview]; + }]; +} + +#pragma mark --Gesturer + +- (void) configGestures { + + UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swapGestureRecognizer:)]; + recognizer.direction = UISwipeGestureRecognizerDirectionLeft; + [self addGestureRecognizer:recognizer]; + recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swapGestureRecognizer:)]; + recognizer.direction = UISwipeGestureRecognizerDirectionRight; + [self addGestureRecognizer:recognizer]; +} + +- (void) swapGestureRecognizer:(UISwipeGestureRecognizer *) recognizer { + if (recognizer.direction == UISwipeGestureRecognizerDirectionRight) { + [self preMonthAction:nil]; + } else { + [self nextMonthAction:nil]; + } +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MImageTitleButton.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MImageTitleButton.h new file mode 100644 index 0000000..f78c6ae --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MImageTitleButton.h @@ -0,0 +1,22 @@ +// +// MImageTitleButton.h +// GoldCalendarFramework +// +// Created by Micker on 16/5/26. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import + +typedef NS_ENUM(NSInteger, ImageTitleDirection) { + ImageTitleDirectionNone,//默认从0开始 + ImageTitleDirectionLeft, + ImageTitleDirectionRight, + ImageTitleDirectionUp, + ImageTitleDirectionDown, +}; + +@interface MImageTitleButton : UIButton +@property (nonatomic, assign) ImageTitleDirection direction; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MImageTitleButton.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MImageTitleButton.m new file mode 100644 index 0000000..418e7d7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/MImageTitleButton.m @@ -0,0 +1,65 @@ +// +// MImageTitleButton.m +// GoldCalendarFramework +// +// Created by Micker on 16/5/26. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "MImageTitleButton.h" + +@implementation MImageTitleButton + + +- (CGRect)titleRectForContentRect:(CGRect)contentRect { + CGRect frame = [super titleRectForContentRect:contentRect]; + switch (self.direction) { + case ImageTitleDirectionNone: + + break; + case ImageTitleDirectionLeft: + frame.origin.x = CGRectGetMinX(frame) + CGRectGetWidth([self imageRectForContentRect:contentRect]); + break; + case ImageTitleDirectionRight: + frame.origin.x = CGRectGetMinX(frame) - CGRectGetWidth([self imageRectForContentRect:contentRect]); + break; + case ImageTitleDirectionUp: + + break; + case ImageTitleDirectionDown: + + break; + + default: + break; + } + return frame; +} + +- (CGRect)imageRectForContentRect:(CGRect)contentRect { + CGRect frame = [super imageRectForContentRect:contentRect]; + + switch (self.direction) { + case ImageTitleDirectionNone: + + break; + case ImageTitleDirectionLeft: + frame.origin.x = CGRectGetMaxX(contentRect) - CGRectGetWidth(frame) + self.imageEdgeInsets.right - self.imageEdgeInsets.left; + break; + case ImageTitleDirectionRight: + frame.origin.x = CGRectGetMaxX(contentRect) - CGRectGetWidth(frame) - self.imageEdgeInsets.right + self.imageEdgeInsets.left; + break; + case ImageTitleDirectionUp: + + break; + case ImageTitleDirectionDown: + + break; + + default: + break; + } + return frame; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/NSDate+Calendar.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/NSDate+Calendar.h new file mode 100644 index 0000000..49a27ae --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/NSDate+Calendar.h @@ -0,0 +1,61 @@ +// +// NSDate+Calendar.h +// GoldCalendarFramework +// +// Created by Micker on 16/4/6. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import + +@interface NSString (NSDate) + +- (NSDate *) dateWithFormat:(NSString *)format; +@end + +@interface NSDate (Calendar) + +- (NSInteger) year; + +- (NSInteger) month; + +- (NSString *) monthString; + +- (NSInteger) day; + +- (NSInteger) hour; + +- (NSInteger) minute; + +- (NSInteger) second; + +- (NSInteger) weekday; + +- (NSString *) weekdayString; + +- (NSString *) weekdayStringEx; + +- (NSInteger) firstWeekdayInThisMonth; + +- (NSInteger) totalDaysInThisMonth; + +- (NSDate *) firstDateInThisMonth; + +- (BOOL)isSameDayAsDate:(NSDate *)otherDate; + +- (NSDate *) preDay; + +- (NSDate *) nextDay; + +- (NSDate *) preMonth; + +- (NSDate *) nextMonth; + +- (NSString *) dateString; + +- (NSString *) stringWithFormat:(NSString *)format; + +- (NSString *)relativeDateString; + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/NSDate+Calendar.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/NSDate+Calendar.m new file mode 100644 index 0000000..04dee11 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Calendar/NSDate+Calendar.m @@ -0,0 +1,213 @@ +// +// NSDate+Calendar.m +// GoldCalendarFramework +// +// Created by Micker on 16/4/6. +// Copyright © 2016年 micker.cn. All rights reserved. +// + +#import "NSDate+Calendar.h" +#import + +@implementation NSString (NSDate) + +- (NSDate *) dateWithFormat:(NSString *)format { + + NSDateFormatter*formatter=[[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + NSDate *date = [formatter dateFromString:self]; + return date; +} + +@end + +@implementation NSDate (Calendar) + +- (NSCalendar *) __calendar { + if ([NSCalendar respondsToSelector:@selector(calendarWithIdentifier:)]) { + return [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]; + } + return [NSCalendar currentCalendar]; +} + +- (NSInteger) year { + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitYear) fromDate:self]; + return [components year]; +} + +- (NSInteger) month { + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitMonth) fromDate:self]; + return [components month]; +} + +- (NSString *) monthString { + NSArray *titles = [NSArray arrayWithObjects:@"一", @"二", @"三", @"四", @"五", @"六", @"七", @"八", @"九", @"十", @"十一", @"十二",nil]; + return [titles objectAtIndex:self.month-1]; +} +- (NSInteger) day { + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitDay) fromDate:self]; + return [components day]; +} + +- (NSInteger) hour { + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitHour) fromDate:self]; + return [components hour]; +} + +- (NSInteger) minute { + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitMinute) fromDate:self]; + return [components minute]; +} + +- (NSInteger) second { + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitSecond) fromDate:self]; + return [components second]; +} + +- (NSInteger) weekday { + NSCalendar *calendar = [self __calendar]; + [calendar setFirstWeekday:1];//1.Sun. 2.Mon. 3.Thes. 4.Wed. 5.Thur. 6.Fri. 7.Sat. + NSDateComponents *components = [[self __calendar] components:(NSCalendarUnitWeekday) fromDate:self]; + NSInteger result = ([components weekday]); + return result > 0 ? result : result + 7; +} + +- (NSString *) weekdayString { + NSArray *titles = [NSArray arrayWithObjects:@"一", @"二", @"三", @"四", @"五", @"六", @"日",nil]; + return [titles objectAtIndex:(self.weekday+5)%7]; +} + +- (NSString *) weekdayStringEx { + NSArray *titles = [NSArray arrayWithObjects:@"一", @"二", @"三", @"四", @"五", @"六", @"日",nil]; + return [titles objectAtIndex:(self.weekday+5)%7]; +} + +- (NSInteger) firstWeekdayInThisMonth { + return [[self firstDateInThisMonth] weekday]; +} + +- (NSInteger) totalDaysInThisMonth { + NSRange totaldaysInMonth = [[self __calendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:self]; + return totaldaysInMonth.length; +} + +- (NSDate *) firstDateInThisMonth { + NSDateFormatter*formatter=[[NSDateFormatter alloc] init]; + [formatter setDateFormat:@"YYYY-MM-dd"]; + [formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; + NSDate *date = [formatter dateFromString:[NSString stringWithFormat:@"%d-%2d-01", self.year, self.month]]; + return date; +} + +- (BOOL)isSameDayAsDate:(NSDate *)otherDate { + if (!otherDate) { + return NO; + } + NSCalendar *calendar = [self __calendar]; + static int flag = -1; + if (-1 == flag) { + flag = [calendar respondsToSelector:@selector(isDate:equalToDate:toUnitGranularity:)] ? 1 : 0 ; + } + if (1 == flag) { + return [calendar isDate:self equalToDate:otherDate toUnitGranularity:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay)]; + } + NSDateComponents *componentsSelf = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:self]; + NSDateComponents *componentsOther = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:otherDate]; + + return ( + componentsSelf.year == componentsOther.year && + componentsSelf.month == componentsOther.month && + componentsSelf.day == componentsOther.day); +} + +- (NSDate *) preDay { + + NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; + dateComponents.day = -1; + NSDate *newDate = [[self __calendar] dateByAddingComponents:dateComponents toDate:self options:0]; + return newDate; +} + +- (NSDate *) nextDay { + NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; + dateComponents.day = +1; + NSDate *newDate = [[self __calendar] dateByAddingComponents:dateComponents toDate:self options:0]; + return newDate; +} + +- (NSDate *) preMonth { + NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; + dateComponents.month = -1; + NSDate *newDate = [[self __calendar] dateByAddingComponents:dateComponents toDate:self options:0]; + return newDate; +} + +- (NSDate *) nextMonth { + NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; + dateComponents.month = +1; + NSDate *newDate = [[self __calendar] dateByAddingComponents:dateComponents toDate:self options:0]; + return newDate; +} + +- (NSString *) dateString +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; + NSString *currentDateStr = [dateFormatter stringFromDate:self]; + return currentDateStr; +} + +- (NSString *)relativeDateString +{ + const int SECOND = 1; + const int MINUTE = 60 * SECOND; + const int HOUR = 60 * MINUTE; + const int DAY = 24 * HOUR; + const int MONTH = 30 * DAY; + + NSDate *now = [NSDate date]; + NSTimeInterval delta = [self timeIntervalSinceDate:now] * -1.0; + + NSCalendar *calendar = [self __calendar]; + NSUInteger units = (NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit); + NSDateComponents *components = [calendar components:units fromDate:self toDate:now options:0]; + + NSString *relativeString; + + if (delta < 0) { + relativeString = @""; + + } else if (delta < 1 * MINUTE) { + relativeString = (components.second == 1) ? @"1秒钟前" : [NSString stringWithFormat:@"%zi秒钟前",components.second]; + + } else if (delta < 2 * MINUTE) { + relativeString = @"1分钟前"; + + } else if (delta < 45 * MINUTE) { + relativeString = [NSString stringWithFormat:@"%zi分钟前",components.minute]; + + } else if (delta < 90 * MINUTE) { + relativeString = @"1小时前"; + + } else if (delta < 24 * HOUR) { + relativeString = [NSString stringWithFormat:@"%zi小时前",components.hour]; + + } else if (delta < 48 * HOUR) { + relativeString = @"昨天"; + + } else if (delta < 7 * DAY) { + relativeString = [NSString stringWithFormat:@"%zi天前",components.day]; + } + else { + return [self stringWithFormat:@"YYYY-MM-dd"]; + } + + return relativeString; +} +- (NSString *) stringWithFormat:(NSString *)format { + NSDateFormatter*formatter=[[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + NSString *currentDateStr = [formatter stringFromDate:self]; + return currentDateStr; +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertConfig.h new file mode 100644 index 0000000..9d01930 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertConfig.m new file mode 100644 index 0000000..0d50990 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertGlobalConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertGlobalConfig.h new file mode 100644 index 0000000..9414aea --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertGlobalConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertGlobalConfig.m new file mode 100644 index 0000000..30b1216 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertItem.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertItem.h new file mode 100644 index 0000000..8bfccc0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertItem.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertItem.m new file mode 100644 index 0000000..4096550 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertPart.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertPart.h new file mode 100644 index 0000000..adb09d0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertPart.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertPart.m new file mode 100644 index 0000000..349124f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertTypes.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertTypes.h new file mode 100644 index 0000000..c70ad30 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertTypes.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertTypes.m new file mode 100644 index 0000000..b6b1bee --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertView.h new file mode 100644 index 0000000..94b14d0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyAlertView.m new file mode 100644 index 0000000..747268d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyConfig.h new file mode 100644 index 0000000..185cb46 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyConfig.m new file mode 100644 index 0000000..645d4a6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.h new file mode 100644 index 0000000..9dd3cfe --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyGlobalConfig.m new file mode 100644 index 0000000..904fed9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyPart.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyPart.h new file mode 100644 index 0000000..684147b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyPart.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyPart.m new file mode 100644 index 0000000..9f060b6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyTypes.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyTypes.h new file mode 100644 index 0000000..3e7fea4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyTypes.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyTypes.m new file mode 100644 index 0000000..a004f82 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyView.h new file mode 100644 index 0000000..9ac805d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyEmptyView.m new file mode 100644 index 0000000..7c12a92 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingConfig.h new file mode 100644 index 0000000..cd9a721 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingConfig.m new file mode 100644 index 0000000..282d5ca --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.h new file mode 100644 index 0000000..87d0081 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingGlobalConfig.m new file mode 100644 index 0000000..3a065c8 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingTypes.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingTypes.h new file mode 100644 index 0000000..85fbc2a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingTypes.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingTypes.m new file mode 100644 index 0000000..0df8568 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingView.h new file mode 100644 index 0000000..fba6ad3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyLoadingView.m new file mode 100644 index 0000000..368f857 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowLabel.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowLabel.h new file mode 100644 index 0000000..ff3ab35 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowLabel.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowLabel.m new file mode 100644 index 0000000..2f399ee --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowUtils.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowUtils.h new file mode 100644 index 0000000..24a5ddd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowUtils.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowUtils.m new file mode 100644 index 0000000..111b25c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyShowView.h new file mode 100644 index 0000000..9472781 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextBgView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextBgView.h new file mode 100644 index 0000000..1d578a5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextBgView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextBgView.m new file mode 100644 index 0000000..7440cc0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextConfig.h new file mode 100644 index 0000000..6ef1d9f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextConfig.m new file mode 100644 index 0000000..d095012 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextGlobalConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextGlobalConfig.h new file mode 100644 index 0000000..af6bddb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextGlobalConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextGlobalConfig.m new file mode 100644 index 0000000..a2b43c3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextTypes.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextTypes.h new file mode 100644 index 0000000..c770779 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextTypes.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextTypes.m new file mode 100644 index 0000000..c4e8a0b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextView.h new file mode 100644 index 0000000..eaa018d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/EasyTextView.m new file mode 100644 index 0000000..0df9d8e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/UIView+EasyShowExt.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/UIView+EasyShowExt.h new file mode 100644 index 0000000..167943d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/UIView+EasyShowExt.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/EasyShowView/UIView+EasyShowExt.m new file mode 100644 index 0000000..851d28b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/GCDTimer/JX_GCDTimerManager.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/GCDTimer/JX_GCDTimerManager.h new file mode 100755 index 0000000..ed19ac8 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/GCDTimer/JX_GCDTimerManager.h @@ -0,0 +1,49 @@ +// +// JX_GCDTimer.h +// TimerComparison +// +// Created by Joeyxu on 6/12/15. +// Copyright (c) 2015 com.tencent. All rights reserved. +// + +#import + +typedef enum : NSUInteger { + AbandonPreviousAction, // 废除之前的任务 + MergePreviousAction // 将之前的任务合并到新的任务中 +} ActionOption; + +@interface JX_GCDTimerManager : NSObject + ++ (JX_GCDTimerManager *)sharedInstance; + +/** + 启动一个timer,默认精度为0.1秒 + + @param timerName timer的名称,作为唯一标识 + @param interval 执行的时间间隔 + @param queue timer将被放入的队列,也就是最终action执行的队列。传入nil将自动放到一个子线程队列中 + @param repeats timer是否循环调用 + @param actionOption 多次schedule同一个timer时的操作选项(目前提供将之前的任务废除或合并的选项) + @param action 时间间隔到点时执行的block + */ +- (void)scheduledDispatchTimerWithName:(NSString *)timerName + timeInterval:(double)interval + queue:(dispatch_queue_t)queue + repeats:(BOOL)repeats + actionOption:(ActionOption)option + action:(dispatch_block_t)action; + +/** + 撤销某个timer + + @param timerName timer的名称,作为唯一标识 + */ +- (void)cancelTimerWithName:(NSString *)timerName; + +/** + 撤销所有的timer + */ +- (void)cancelAllTimer; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/GCDTimer/JX_GCDTimerManager.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/GCDTimer/JX_GCDTimerManager.m new file mode 100755 index 0000000..6f03c7c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/GCDTimer/JX_GCDTimerManager.m @@ -0,0 +1,159 @@ +// +// JX_GCDTimer.m +// TimerComparison +// +// Created by Joeyxu on 6/12/15. +// Copyright (c) 2015 com.tencent. All rights reserved. +// + +#import "JX_GCDTimerManager.h" + +@interface JX_GCDTimerManager() +@property (nonatomic, strong) NSMutableDictionary *timerContainer; +@property (nonatomic, strong) NSMutableDictionary *actionBlockCache; +@end + +@implementation JX_GCDTimerManager + +#pragma mark - Public Method + ++ (JX_GCDTimerManager *)sharedInstance +{ + static JX_GCDTimerManager *_gcdTimerManager = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken,^{ + _gcdTimerManager = [[JX_GCDTimerManager alloc] init]; + }); + + return _gcdTimerManager; +} + +- (void)scheduledDispatchTimerWithName:(NSString *)timerName + timeInterval:(double)interval + queue:(dispatch_queue_t)queue + repeats:(BOOL)repeats + actionOption:(ActionOption)option + action:(dispatch_block_t)action +{ + if (nil == timerName) + return; + + if (nil == queue) + queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + dispatch_source_t timer = [self.timerContainer objectForKey:timerName]; + if (!timer) { + timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + dispatch_resume(timer); + [self.timerContainer setObject:timer forKey:timerName]; + } + + /* timer精度为0.1秒 */ + dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, interval * NSEC_PER_SEC), interval * NSEC_PER_SEC, 0.1 * NSEC_PER_SEC); + + __weak typeof(self) weakSelf = self; + + switch (option) { + + case AbandonPreviousAction: + { + /* 移除之前的action */ + [weakSelf removeActionCacheForTimer:timerName]; + + dispatch_source_set_event_handler(timer, ^{ + action(); + + if (!repeats) { + [weakSelf cancelTimerWithName:timerName]; + } + }); + } + break; + + case MergePreviousAction: + { + /* cache本次的action */ + [self cacheAction:action forTimer:timerName]; + + dispatch_source_set_event_handler(timer, ^{ + NSMutableArray *actionArray = [self.actionBlockCache objectForKey:timerName]; + [actionArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + dispatch_block_t actionBlock = obj; + actionBlock(); + }]; + [weakSelf removeActionCacheForTimer:timerName]; + + if (!repeats) { + [weakSelf cancelTimerWithName:timerName]; + } + }); + } + break; + } +} + +- (void)cancelTimerWithName:(NSString *)timerName +{ + dispatch_source_t timer = [self.timerContainer objectForKey:timerName]; + + if (!timer) { + return; + } + + [self.timerContainer removeObjectForKey:timerName]; + dispatch_source_cancel(timer); + + [self.actionBlockCache removeObjectForKey:timerName]; +} + +- (void)cancelAllTimer +{ + // Fast Enumeration + [self.timerContainer enumerateKeysAndObjectsUsingBlock:^(NSString *timerName, dispatch_source_t timer, BOOL *stop) { + [self.timerContainer removeObjectForKey:timerName]; + dispatch_source_cancel(timer); + }]; +} + +#pragma mark - Property + +- (NSMutableDictionary *)timerContainer +{ + if (!_timerContainer) { + _timerContainer = [[NSMutableDictionary alloc] init]; + } + return _timerContainer; +} + +- (NSMutableDictionary *)actionBlockCache +{ + if (!_actionBlockCache) { + _actionBlockCache = [[NSMutableDictionary alloc] init]; + } + return _actionBlockCache; +} + +#pragma mark - Private Method + +- (void)cacheAction:(dispatch_block_t)action forTimer:(NSString *)timerName +{ + id actionArray = [self.actionBlockCache objectForKey:timerName]; + + if (actionArray && [actionArray isKindOfClass:[NSMutableArray class]]) { + [(NSMutableArray *)actionArray addObject:action]; + }else { + NSMutableArray *array = [NSMutableArray arrayWithObject:action]; + [self.actionBlockCache setObject:array forKey:timerName]; + } +} + +- (void)removeActionCacheForTimer:(NSString *)timerName +{ + if (![self.actionBlockCache objectForKey:timerName]) + return; + + [self.actionBlockCache removeObjectForKey:timerName]; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboard.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboard.h new file mode 100644 index 0000000..f2c9a48 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboard.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboard.m new file mode 100644 index 0000000..b1680d1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboardTool.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboardTool.h new file mode 100644 index 0000000..1a47cc6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboardTool.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVKeyboardTool.m new file mode 100644 index 0000000..2831521 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVLetterKeyboard.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVLetterKeyboard.h new file mode 100644 index 0000000..7140f61 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVLetterKeyboard.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVLetterKeyboard.m new file mode 100644 index 0000000..5b4308a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVNumberKeyboard.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVNumberKeyboard.h new file mode 100644 index 0000000..edc6b1b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVNumberKeyboard.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVNumberKeyboard.m new file mode 100644 index 0000000..245280a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVSymbolKeyboard.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVSymbolKeyboard.h new file mode 100644 index 0000000..3817789 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVSymbolKeyboard.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/LVSymbolKeyboard.m new file mode 100644 index 0000000..59220e7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/UIView+LVExtension.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/UIView+LVExtension.h new file mode 100755 index 0000000..4acf4b2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/UIView+LVExtension.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LVKeyboard/UIView+LVExtension.m new file mode 100755 index 0000000..19c8b8f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXScrollContentView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXScrollContentView.h new file mode 100644 index 0000000..c433ec5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXScrollContentView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXScrollContentView.m new file mode 100644 index 0000000..20f758a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.h new file mode 100644 index 0000000..60bd402 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LXScrollContentViewLib/LXSegmentTitleView.m new file mode 100644 index 0000000..6b3bcdd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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; + } + + CGFloat lastX = 21; + for (UIButton *btn in self.itemButtons) { + [btn sizeToFit]; + btn.frame = CGRectMake(lastX, 10, btn.frame.size.width+10, 14); + 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.frame.size.height - 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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyBaseView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyBaseView.h new file mode 100644 index 0000000..e2b273d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyBaseView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyBaseView.m new file mode 100644 index 0000000..a5898aa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyView.h new file mode 100755 index 0000000..a6c2a92 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyView.m new file mode 100755 index 0000000..92913f2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyViewHeader.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/LYEmptyViewHeader.h new file mode 100644 index 0000000..e99b96f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+Empty.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+Empty.h new file mode 100644 index 0000000..2ac8e07 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+Empty.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+Empty.m new file mode 100644 index 0000000..5cc2332 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+LYExtension.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+LYExtension.h new file mode 100644 index 0000000..44fabf0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+LYExtension.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/LYEmptyView/UIView+LYExtension.m new file mode 100644 index 0000000..a1ab06e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSAppInfo.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSAppInfo.h new file mode 100755 index 0000000..d9b097a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSAppInfo.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSAppInfo.m new file mode 100755 index 0000000..56a2dda --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersion.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersion.h new file mode 100755 index 0000000..66136bf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersion.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersion.m new file mode 100755 index 0000000..a8bb05f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersion.m @@ -0,0 +1,198 @@ +// +// 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 + NSLog(@"PSCheckVersion检测失败,%@", error.localizedDescription); + #endif + if (completeBlock) { + completeBlock(nil, error); + } + }]; +} + +- (void)debugLog { +#ifdef DEBUG + NSLog(@"\n**********************************\nPSCheckVersion检测更新完成!\nAppstore最新版本:\n%@\n更新信息:\n%@\n**********************************",self.appInfo.releaseVersion,self.appInfo.releaseLog); +#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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionRequest.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionRequest.h new file mode 100755 index 0000000..09be4d6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionRequest.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionRequest.m new file mode 100755 index 0000000..b9ee9c1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionView.h new file mode 100755 index 0000000..275d1c2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/PSCheckVersion/PSCheckVersionView.m new file mode 100755 index 0000000..336069e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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 = kRGBColor(119, 119, 119); + 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/DoctorXinjiang/DoctorXinjiang/ThirdParty/RSAObjC.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/RSAObjC.h new file mode 100644 index 0000000..d422a66 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/RSAObjC.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/RSAObjC.m new file mode 100644 index 0000000..4fb17e1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-076.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-076.png new file mode 100755 index 0000000..5fc65c5 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-076.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-120.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-120.png new file mode 100755 index 0000000..d15d8f5 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-120.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-152.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-152.png new file mode 100755 index 0000000..1cc539d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-152.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-167.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-167.png new file mode 100755 index 0000000..17f3912 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-167.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-180.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-180.png new file mode 100755 index 0000000..4ef0e53 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/AppIcon-180.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H.png new file mode 100755 index 0000000..855fe7c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H@2x.png new file mode 100755 index 0000000..0d212b6 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H@3x.png new file mode 100755 index 0000000..1cea49a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-H@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N.png new file mode 100755 index 0000000..cc85f4d Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N@2x.png new file mode 100755 index 0000000..915771c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N@3x.png new file mode 100755 index 0000000..199b2f6 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Button-N@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email.png new file mode 100755 index 0000000..7588c1b Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email@2x.png new file mode 100755 index 0000000..8b9005e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email@3x.png new file mode 100755 index 0000000..f35fe79 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Email@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export.png new file mode 100755 index 0000000..1f646b3 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export@2x.png new file mode 100755 index 0000000..febfd21 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export@3x.png new file mode 100755 index 0000000..ade21f1 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Export@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N.png new file mode 100755 index 0000000..398e780 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N@2x.png new file mode 100755 index 0000000..7460298 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N@3x.png new file mode 100755 index 0000000..502a830 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-N@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y.png new file mode 100755 index 0000000..fbdc11a Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y@2x.png new file mode 100755 index 0000000..413e0f4 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y@3x.png new file mode 100755 index 0000000..5253515 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Mark-Y@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print.png new file mode 100755 index 0000000..0b3eeed Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print@2x.png new file mode 100755 index 0000000..4f5781c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print@3x.png new file mode 100755 index 0000000..29c11ca Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Print@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs.png new file mode 100755 index 0000000..929ceb2 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs@2x.png new file mode 100755 index 0000000..a512341 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs@3x.png new file mode 100755 index 0000000..5459e7e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Graphics/Reader-Thumbs@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/CGPDFDocument.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/CGPDFDocument.h new file mode 100755 index 0000000..8c6ad80 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/CGPDFDocument.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/CGPDFDocument.m new file mode 100755 index 0000000..20c6b63 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderConstants.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderConstants.h new file mode 100755 index 0000000..917b579 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderConstants.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderConstants.m new file mode 100755 index 0000000..ae538d9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentPage.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentPage.h new file mode 100755 index 0000000..92f5408 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentPage.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentPage.m new file mode 100755 index 0000000..e6902c1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentTile.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentTile.h new file mode 100755 index 0000000..6c8ba80 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentTile.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentTile.m new file mode 100755 index 0000000..b801323 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentView.h new file mode 100755 index 0000000..1738309 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderContentView.m new file mode 100755 index 0000000..d34cb00 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocument.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocument.h new file mode 100755 index 0000000..bb9230f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocument.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocument.m new file mode 100755 index 0000000..5c52a41 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocumentOutline.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocumentOutline.h new file mode 100755 index 0000000..7fecc39 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocumentOutline.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderDocumentOutline.m new file mode 100755 index 0000000..2c94ff1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainPagebar.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainPagebar.h new file mode 100755 index 0000000..0c8a135 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainPagebar.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainPagebar.m new file mode 100755 index 0000000..5a59345 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainToolbar.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainToolbar.h new file mode 100755 index 0000000..caf5438 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainToolbar.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderMainToolbar.m new file mode 100755 index 0000000..3484ccc --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbCache.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbCache.h new file mode 100755 index 0000000..948022d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbCache.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbCache.m new file mode 100755 index 0000000..273d6e4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbFetch.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbFetch.h new file mode 100755 index 0000000..39f0770 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbFetch.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbFetch.m new file mode 100755 index 0000000..1710be5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbQueue.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbQueue.h new file mode 100755 index 0000000..9532813 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbQueue.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbQueue.m new file mode 100755 index 0000000..dc256ab --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRender.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRender.h new file mode 100755 index 0000000..953b93c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRender.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRender.m new file mode 100755 index 0000000..fa01461 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRequest.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRequest.h new file mode 100755 index 0000000..f4846d0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRequest.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbRequest.m new file mode 100755 index 0000000..93ed9ad --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbView.h new file mode 100755 index 0000000..4235681 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbView.m new file mode 100755 index 0000000..10c5c91 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbsView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbsView.h new file mode 100755 index 0000000..6268770 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbsView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderThumbsView.m new file mode 100755 index 0000000..f2a59d5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderViewController.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderViewController.h new file mode 100755 index 0000000..7b11322 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderViewController.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ReaderViewController.m new file mode 100755 index 0000000..bcfb653 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsMainToolbar.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsMainToolbar.h new file mode 100755 index 0000000..8b3a528 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsMainToolbar.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsMainToolbar.m new file mode 100755 index 0000000..ee21ce2 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsViewController.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsViewController.h new file mode 100755 index 0000000..db36a87 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsViewController.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/ThumbsViewController.m new file mode 100755 index 0000000..27bef8b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/UIXToolbarView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/UIXToolbarView.h new file mode 100755 index 0000000..5ca89bf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/UIXToolbarView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/Reader/Sources/UIXToolbarView.m new file mode 100755 index 0000000..44829db --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDBrowserImageView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDBrowserImageView.h new file mode 100755 index 0000000..e5d88e5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDBrowserImageView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDBrowserImageView.m new file mode 100755 index 0000000..ec566d6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.h new file mode 100755 index 0000000..f00d647 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.m new file mode 100755 index 0000000..46208ee --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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(kScreenWidth-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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDPhotoBrowserConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDPhotoBrowserConfig.h new file mode 100755 index 0000000..443b558 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDWaitingView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDWaitingView.h new file mode 100755 index 0000000..d688e1e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDWaitingView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/SDPhotoBrowser/SDWaitingView.m new file mode 100755 index 0000000..ca8ae36 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.h new file mode 100644 index 0000000..de88d4d --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.m new file mode 100644 index 0000000..6c11f0e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIPlaceHolderTextView/UIPlaceHolderTextView.m @@ -0,0 +1,118 @@ +// +// 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+5,insets.top,self.bounds.size.width - (insets.left +insets.right+10),1.0)]; + _placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping; + _placeHolderLabel.font = self.font; + _placeHolderLabel.backgroundColor = [UIColor clearColor]; + _placeHolderLabel.textColor = self.placeholderColor; + _placeHolderLabel.alpha = 0; + _placeHolderLabel.tag = 999; + [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/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIViewAdditions.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIViewAdditions.h new file mode 100755 index 0000000..d610b15 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIViewAdditions.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/UIViewAdditions.m new file mode 100755 index 0000000..842ce86 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.h new file mode 100644 index 0000000..f9a63ce --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIImage+XLExtension.m new file mode 100644 index 0000000..9fb16d0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.h new file mode 100644 index 0000000..512b12a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/UIView+XLExtension.m new file mode 100644 index 0000000..53f7415 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.h new file mode 100755 index 0000000..74e0576 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheet.m new file mode 100755 index 0000000..0d2a05a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.h new file mode 100755 index 0000000..3fedab5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetCell.m new file mode 100755 index 0000000..1b564bf --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.h new file mode 100755 index 0000000..693ce72 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetConfig.m new file mode 100755 index 0000000..44f204f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.h new file mode 100755 index 0000000..9e9e3a6 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetItem.m new file mode 100755 index 0000000..3a0d5c1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@2x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@2x.png new file mode 100755 index 0000000..f0c3617 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@3x.png b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@3x.png new file mode 100755 index 0000000..6f45e2c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/Vender/FSActionSheet/FSActionSheetResources/FSActionSheet_cancel@3x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.h new file mode 100644 index 0000000..5ec48ee --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowser.m new file mode 100644 index 0000000..ab267ab --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserConfig.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserConfig.h new file mode 100644 index 0000000..26b51f1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserTypeDefine.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLPhotoBrowserTypeDefine.h new file mode 100644 index 0000000..b7ded20 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.h new file mode 100644 index 0000000..c5a247f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLProgressView.m new file mode 100644 index 0000000..7d132bb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.h b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.h new file mode 100644 index 0000000..5c47276 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.m b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.m new file mode 100644 index 0000000..ac4cb42 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/ThirdParty/XLPhotoBrowser+CoderXL/XLZoomingScrollView.m @@ -0,0 +1,332 @@ +// +// 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 ; +// NSLog(@"targetURL %@ , strongSelf %@ , strongSelf.imageURL = %@ , progress = %f",targetURL , strongSelf , strongSelf.imageURL,strongSelf.progress); + } + }); + } 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/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCode.h b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCode.h new file mode 100755 index 0000000..da02b89 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCode.h @@ -0,0 +1,18 @@ +// +// SWQRCode.h +// SWQRCode_Objc +// +// Created by zhuku on 2018/4/4. +// Copyright © 2018年 selwyn. All rights reserved. +// + +#ifndef SWQRCode_h +#define SWQRCode_h + +#import "SWQRCodeConfig.h" +#import "SWQRCodeManager.h" +#import +#import + + +#endif /* SWQRCode_h */ diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeConfig.h b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeConfig.h new file mode 100755 index 0000000..78c9d1b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeConfig.h @@ -0,0 +1,56 @@ +// +// SWQRCodeConfig.h +// SWQRCode_Objc +// +// Created by zhuku on 2018/4/4. +// Copyright © 2018年 selwyn. All rights reserved. +// + +/*** + + 扫一扫基础配置文件 + +***/ + + +#import + +/** + 扫描器类型 + + - SWScannerTypeQRCode: 仅支持二维码 + - SWScannerTypeBarCode: 仅支持条码 + - SWScannerTypeBoth: 支持二维码以及条码 + */ +typedef NS_ENUM(NSInteger, SWScannerType) { + SWScannerTypeQRCode, + SWScannerTypeBarCode, + SWScannerTypeBoth, +}; + + +/** + 扫描区域 + + - SWScannerAreaDefault: 扫描框以内 + - SWScannerAreaFullScreen: 全屏 + */ +typedef NS_ENUM(NSInteger, SWScannerArea) { + SWScannerAreaDefault, + SWScannerAreaFullScreen, +}; + +@interface SWQRCodeConfig : NSObject + +/** 类型 */ +@property (nonatomic, assign) SWScannerType scannerType; +/** 扫描区域 */ +@property (nonatomic, assign) SWScannerArea scannerArea; +/** 棱角颜色 */ +@property (nonatomic, strong) UIColor *scannerCornerColor; +/** 边框颜色 */ +@property (nonatomic, strong) UIColor *scannerBorderColor; +/** 指示器风格 */ +@property (nonatomic, assign) UIActivityIndicatorViewStyle indicatorViewStyle; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeConfig.m b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeConfig.m new file mode 100755 index 0000000..2f09091 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeConfig.m @@ -0,0 +1,23 @@ +// +// SWQRCodeConfig.m +// SWQRCode_Objc +// +// Created by zhuku on 2018/4/4. +// Copyright © 2018年 selwyn. All rights reserved. +// + +#import "SWQRCodeConfig.h" + +@implementation SWQRCodeConfig + +- (instancetype)init { + self = [super init]; + if (self) { + self.scannerCornerColor = [UIColor colorWithRed:63/255.0 green:187/255.0 blue:54/255.0 alpha:1.0]; + self.scannerBorderColor = [UIColor whiteColor]; + self.indicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + } + return self; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeManager.h b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeManager.h new file mode 100755 index 0000000..3ca13e0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeManager.h @@ -0,0 +1,45 @@ +// +// SWQRCodeManager.h +// SWQRCode_Objc +// +// Created by zhuku on 2018/4/4. +// Copyright © 2018年 selwyn. All rights reserved. +// + +#import +#import "SWQRCode.h" + +@interface SWQRCodeManager : NSObject + +/** + 校验是否有相机权限 + + @param permissionGranted 获取相机权限回调 + */ ++ (void)sw_checkCameraAuthorizationStatusWithGrand:(void(^)(BOOL granted))permissionGranted; + +/** + 校验是否有相册权限 + + @param permissionGranted 获取相机权限回调 + */ ++ (void)sw_checkAlbumAuthorizationStatusWithGrand:(void(^)(BOOL granted))permissionGranted; + +/** + 根据扫描器类型配置支持编码格式 + + @param scannerType 扫描器类型 + @return 编码格式组成的数组 + */ ++ (NSArray *)sw_metadataObjectTypesWithType:(SWScannerType)scannerType; + +/** 根据扫描器类型配置导航栏标题 */ ++ (NSString *)sw_navigationItemTitleWithType:(SWScannerType)scannerType; + +/** + 手电筒开关 + @param on YES:打开 NO:关闭 + */ ++ (void)sw_FlashlightOn:(BOOL)on; + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeManager.m b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeManager.m new file mode 100755 index 0000000..4006c50 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/Config/SWQRCodeManager.m @@ -0,0 +1,162 @@ +// +// SWQRCodeManager.m +// SWQRCode_Objc +// +// Created by zhuku on 2018/4/4. +// Copyright © 2018年 selwyn. All rights reserved. +// + +#import "SWQRCodeManager.h" +#import + +@implementation SWQRCodeManager + +/** 校验是否有相机权限 */ ++ (void)sw_checkCameraAuthorizationStatusWithGrand:(void(^)(BOOL granted))permissionGranted +{ + AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; + + switch (videoAuthStatus) { + // 已授权 + case AVAuthorizationStatusAuthorized: + { + permissionGranted(YES); + } + break; + // 未询问用户是否授权 + case AVAuthorizationStatusNotDetermined: + { + // 提示用户授权 + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { + permissionGranted(granted); + }]; + } + break; + // 用户拒绝授权或权限受限 + case AVAuthorizationStatusRestricted: + case AVAuthorizationStatusDenied: + { + UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"请在”设置-隐私-相机”选项中,允许访问你的相机" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; + [alert show]; + permissionGranted(NO); + } + break; + default: + break; + } +} + +/** 校验是否有相册权限 */ ++ (void)sw_checkAlbumAuthorizationStatusWithGrand:(void(^)(BOOL granted))permissionGranted { + + PHAuthorizationStatus photoAuthStatus = [PHPhotoLibrary authorizationStatus]; + switch (photoAuthStatus) { + // 已授权 + case PHAuthorizationStatusAuthorized: + { + permissionGranted(YES); + } + break; + // 未询问用户是否授权 + case PHAuthorizationStatusNotDetermined: + { + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { + permissionGranted(status == PHAuthorizationStatusAuthorized); + }]; + } + break; + // 用户拒绝授权或权限受限 + case PHAuthorizationStatusRestricted: + case PHAuthorizationStatusDenied: + { + UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"请在”设置-隐私-相片”选项中,允许访问你的相册" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; + [alert show]; + permissionGranted(NO); + } + break; + default: + break; + } + +} + +/** 根据扫描器类型配置支持编码格式 */ ++ (NSArray *)sw_metadataObjectTypesWithType:(SWScannerType)scannerType { + switch (scannerType) { + case SWScannerTypeQRCode: + { + return @[AVMetadataObjectTypeQRCode]; + } + break; + case SWScannerTypeBarCode: + { + return @[AVMetadataObjectTypeEAN13Code, + AVMetadataObjectTypeEAN8Code, + AVMetadataObjectTypeUPCECode, + AVMetadataObjectTypeCode39Code, + AVMetadataObjectTypeCode39Mod43Code, + AVMetadataObjectTypeCode93Code, + AVMetadataObjectTypeCode128Code, + AVMetadataObjectTypePDF417Code]; + } + break; + case SWScannerTypeBoth: + { + return @[AVMetadataObjectTypeQRCode, + AVMetadataObjectTypeEAN13Code, + AVMetadataObjectTypeEAN8Code, + AVMetadataObjectTypeUPCECode, + AVMetadataObjectTypeCode39Code, + AVMetadataObjectTypeCode39Mod43Code, + AVMetadataObjectTypeCode93Code, + AVMetadataObjectTypeCode128Code, + AVMetadataObjectTypePDF417Code]; + } + break; + default: + break; + } +} + +/** 根据扫描器类型配置导航栏标题 */ ++ (NSString *)sw_navigationItemTitleWithType:(SWScannerType)scannerType { + switch (scannerType) { + case SWScannerTypeQRCode: + { + return @"二维码"; + } + break; + case SWScannerTypeBarCode: + { + return @"条码"; + } + break; + case SWScannerTypeBoth: + { + return @"二维码/条码"; + } + break; + default: + break; + } +} + +/** 手电筒开关 */ ++ (void)sw_FlashlightOn:(BOOL)on { + AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + if ([captureDevice hasTorch] && [captureDevice hasFlash]) { + [captureDevice lockForConfiguration:nil]; + if (on) { + [captureDevice setTorchMode:AVCaptureTorchModeOn]; + [captureDevice setFlashMode:AVCaptureFlashModeOn]; + }else + { + [captureDevice setTorchMode:AVCaptureTorchModeOff]; + [captureDevice setFlashMode:AVCaptureFlashModeOff]; + } + [captureDevice unlockForConfiguration]; + } +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/DashesLineView.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/DashesLineView.h new file mode 100644 index 0000000..6c765df --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/DashesLineView.m b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/DashesLineView.m new file mode 100644 index 0000000..d502089 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphBar.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphBar.h new file mode 100644 index 0000000..9bf52dd --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphBar.m b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphBar.m new file mode 100644 index 0000000..9436ff9 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphConstants.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphConstants.h new file mode 100644 index 0000000..0daa07b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphDot.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphDot.h new file mode 100644 index 0000000..ddcb420 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphDot.m b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphDot.m new file mode 100644 index 0000000..0072b05 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphLine.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphLine.h new file mode 100644 index 0000000..41afa3f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphLine.m b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphLine.m new file mode 100644 index 0000000..9fcee24 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphPopView.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphPopView.h new file mode 100644 index 0000000..a7b00d3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphPopView.m b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphPopView.m new file mode 100644 index 0000000..44a48ba --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphView.h b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphView.h new file mode 100644 index 0000000..4a32853 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphView.m b/DoctorXinjiang/DoctorXinjiang/Utils/CustomGraph/GraphView.m new file mode 100644 index 0000000..eabeef1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/HQCommonUtils.h b/DoctorXinjiang/DoctorXinjiang/Utils/HQCommonUtils.h new file mode 100644 index 0000000..c0801b7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/HQCommonUtils.h @@ -0,0 +1,95 @@ +// +// 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 *)SFZHID; + + ++ (NSString *)loginID; + +//判断密码是否满足 8位 包含大小写数字 ++ (BOOL )isOrNoPasswordStyle:(NSString *)passWordName; + +//归档和解归档 ++ (void)keyedArchiverWithData:(nullable id)responseObject key:(NSString *)key; ++ (nullable id)keyedUnarchiverWithKey:(NSString *)key; +//编码问题 ++(NSString*)DataTOjsonString:(id)object; + + +//计算UILabel的高度(带有行间距的情况) ++(CGFloat)getSpaceLabelHeight:(UILabel *)label + AndLeftisTrue:(BOOL)isLeft + 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; + ++(BOOL)isMobileNumber:(NSString *)mobileNum; + + +///将时间戳转为日期时间 + +/// @param timestamp 时间戳 + +/// @param dateFormat 日期样式 YYYY-MM-dd HH:mm:ss + ++ (NSString *)getTimeFromTimestamp:(NSInteger )timestamp andDateFormat:(NSString *)dateFormat; + +///将日期时间转为时间戳 ++ (NSString *)getTimestampFromTime:(NSString *)CurrentTime; + +/* + 获取当前控制器 + */ + ++ (UIViewController *)getCurrentVC; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/HQCommonUtils.m b/DoctorXinjiang/DoctorXinjiang/Utils/HQCommonUtils.m new file mode 100644 index 0000000..cece443 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/HQCommonUtils.m @@ -0,0 +1,435 @@ +// +// HQCommonUtils.m +// healthQuestion +// +// Created by xulei on 2022/8/16. +// + +#import "HQCommonUtils.h" +#import "YXUserInfo.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]) + { + YXUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.user_id]; + } + else + { + string = @"0"; + } + + + return string; +} + ++ (NSString *)SFZHID +{ + NSString *string = nil; + if ([self isLogin]) + { + YXUserInfo *userInfo = [self keyedUnarchiverWithKey:LoginUserInfo]; + string = [NSString stringWithFormat:@"%@",userInfo.idCard]; + } + 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; +} + + ++ (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 + AndLeftisTrue:(BOOL)isLeft + withStr:(NSString*)str + withFont:(UIFont*)font + withWidth:(CGFloat)width + withLineSpacing:(CGFloat)linespace{ + NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init]; + paraStyle.lineBreakMode = NSLineBreakByCharWrapping; + if(isLeft == true) { + paraStyle.alignment = NSTextAlignmentLeft; + }else + { + paraStyle.alignment = NSTextAlignmentRight; + } + //设置行间距 + 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]; + label.attributedText = attributeStr; + 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 boldSystemFontOfSize: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 = [UIColor blackColor].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; + +} + + ++ (BOOL)isOrNoPasswordStyle:(NSString *)passWordName + +{ + bool isAlow = true; + + if (passWordName.length >= 33) + + { + + isAlow = false; + + } + + else if ([self JudgeTheillegalCharacter:passWordName]) + + { + + isAlow = false; + + } + + else if (![self judgePassWordLegal:passWordName]) + + { + + isAlow = false; + + } + + return isAlow; + +} + ++ (BOOL)JudgeTheillegalCharacter:(NSString *)content{ + + //提示标签不能输入特殊字符 + + NSString *str =@"^[A-Za-z0-9\\u4e00-\u9fa5]+$"; + + NSPredicate* emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", str]; + + if (![emailTest evaluateWithObject:content]) { + + return YES; + + } + + return NO; + +} + ++ (BOOL)judgePassWordLegal:(NSString *)pass{ + + BOOL result ; + + // 判断长度大于6位后再接着判断是否同时包含数字和大小写字母 + + NSString * regex =@"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$"; + + NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; + + result = [pred evaluateWithObject:pass]; + + + return result; + +} + ++(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]; + +} + +///将时间戳转为日期时间 + +/// @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]; +} + ++ (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; + } +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/JGNavigationService/JGNavigationService.h b/DoctorXinjiang/DoctorXinjiang/Utils/JGNavigationService/JGNavigationService.h new file mode 100755 index 0000000..f2722eb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/JGNavigationService/JGNavigationService.h @@ -0,0 +1,19 @@ +// +// JGNavigationService.h +// JGNavgitionDemo +// +// Created by coderZG on 16/10/21. +// Copyright © 2016年 coderZG. All rights reserved. +// + +#import +#import +#import + +@interface JGNavigationService : NSObject + +/** + 打开第三方地图导航 + */ ++(void)navWithViewController:(UIViewController *)viewController WithEndLocation:(CLLocationCoordinate2D)endLocation andAddress:(NSString *)address; +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/JGNavigationService/JGNavigationService.m b/DoctorXinjiang/DoctorXinjiang/Utils/JGNavigationService/JGNavigationService.m new file mode 100755 index 0000000..e949106 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/JGNavigationService/JGNavigationService.m @@ -0,0 +1,128 @@ +// +// JGNavigationService.m +// JGNavgitionDemo +// +// Created by coderZG on 16/10/21. +// Copyright © 2016年 coderZG. All rights reserved. +// + +#import "JGNavigationService.h" +#import "AppDelegate.h" +#import "JZLocationConverter.h" +#import + +static NSString *applicationName = @"JGNavgitionDemo"; +static NSString *applicationScheme = @"JGNavgitionDemo"; +@implementation JGNavigationService + + ++(void)navWithViewController:(UIViewController *)viewController WithEndLocation:(CLLocationCoordinate2D)endLocation andAddress:(NSString *)address{ + NSArray *maps = [self getInstalledMapAppWithEndLocation:endLocation withAddress:address]; + UIAlertController *sheet = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:@"导航到%@",address] message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + for (int i = 0 ;i +#import +@interface JZLocationConverter : NSObject + +/** + * @brief 世界标准地理坐标(WGS-84) 转换成 中国国测局地理坐标(GCJ-02)<火星坐标> + * + * ####只在中国大陆的范围的坐标有效,以外直接返回世界标准坐标 + * + * @param location 世界标准地理坐标(WGS-84) + * + * @return 中国国测局地理坐标(GCJ-02)<火星坐标> + */ ++ (CLLocationCoordinate2D)wgs84ToGcj02:(CLLocationCoordinate2D)location; + + +/** + * @brief 中国国测局地理坐标(GCJ-02) 转换成 世界标准地理坐标(WGS-84) + * + * ####此接口有1-2米左右的误差,需要精确定位情景慎用 + * + * @param location 中国国测局地理坐标(GCJ-02) + * + * @return 世界标准地理坐标(WGS-84) + */ ++ (CLLocationCoordinate2D)gcj02ToWgs84:(CLLocationCoordinate2D)location; + + +/** + * @brief 世界标准地理坐标(WGS-84) 转换成 百度地理坐标(BD-09) + * + * @param location 世界标准地理坐标(WGS-84) + * + * @return 百度地理坐标(BD-09) + */ ++ (CLLocationCoordinate2D)wgs84ToBd09:(CLLocationCoordinate2D)location; + + +/** + * @brief 中国国测局地理坐标(GCJ-02)<火星坐标> 转换成 百度地理坐标(BD-09) + * + * @param location 中国国测局地理坐标(GCJ-02)<火星坐标> + * + * @return 百度地理坐标(BD-09) + */ ++ (CLLocationCoordinate2D)gcj02ToBd09:(CLLocationCoordinate2D)location; + + +/** + * @brief 百度地理坐标(BD-09) 转换成 中国国测局地理坐标(GCJ-02)<火星坐标> + * + * @param location 百度地理坐标(BD-09) + * + * @return 中国国测局地理坐标(GCJ-02)<火星坐标> + */ ++ (CLLocationCoordinate2D)bd09ToGcj02:(CLLocationCoordinate2D)location; + + +/** + * @brief 百度地理坐标(BD-09) 转换成 世界标准地理坐标(WGS-84) + * + * ####此接口有1-2米左右的误差,需要精确定位情景慎用 + * + * @param location 百度地理坐标(BD-09) + * + * @return 世界标准地理坐标(WGS-84) + */ ++ (CLLocationCoordinate2D)bd09ToWgs84:(CLLocationCoordinate2D)location; + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/JZLocationConverter/JZLocationConverter.m b/DoctorXinjiang/DoctorXinjiang/Utils/JZLocationConverter/JZLocationConverter.m new file mode 100755 index 0000000..435083f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/JZLocationConverter/JZLocationConverter.m @@ -0,0 +1,155 @@ +// +// JZLocationConverter.m +// JZCLLocationMangerDome +// +// Created by jack zhou on 13-8-22. +// Copyright (c) 2013年 JZ. All rights reserved. +// + +#import "JZLocationConverter.h" +#import +#define LAT_OFFSET_0(x,y) -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * sqrt(fabs(x)) +#define LAT_OFFSET_1 (20.0 * sin(6.0 * x * M_PI) + 20.0 * sin(2.0 * x * M_PI)) * 2.0 / 3.0 +#define LAT_OFFSET_2 (20.0 * sin(y * M_PI) + 40.0 * sin(y / 3.0 * M_PI)) * 2.0 / 3.0 +#define LAT_OFFSET_3 (160.0 * sin(y / 12.0 * M_PI) + 320 * sin(y * M_PI / 30.0)) * 2.0 / 3.0 + +#define LON_OFFSET_0(x,y) 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(fabs(x)) +#define LON_OFFSET_1 (20.0 * sin(6.0 * x * M_PI) + 20.0 * sin(2.0 * x * M_PI)) * 2.0 / 3.0 +#define LON_OFFSET_2 (20.0 * sin(x * M_PI) + 40.0 * sin(x / 3.0 * M_PI)) * 2.0 / 3.0 +#define LON_OFFSET_3 (150.0 * sin(x / 12.0 * M_PI) + 300.0 * sin(x / 30.0 * M_PI)) * 2.0 / 3.0 + +#define RANGE_LON_MAX 137.8347 +#define RANGE_LON_MIN 72.004 +#define RANGE_LAT_MAX 55.8271 +#define RANGE_LAT_MIN 0.8293 +// jzA = 6378245.0, 1/f = 298.3 +// b = a * (1 - f) +// ee = (a^2 - b^2) / a^2; +#define jzA 6378245.0 +#define jzEE 0.00669342162296594323 + + + +@implementation JZLocationConverter + ++ (double)transformLat:(double)x bdLon:(double)y +{ + double ret = LAT_OFFSET_0(x, y); + ret += LAT_OFFSET_1; + ret += LAT_OFFSET_2; + ret += LAT_OFFSET_3; + return ret; +} + ++ (double)transformLon:(double)x bdLon:(double)y +{ + double ret = LON_OFFSET_0(x, y); + ret += LON_OFFSET_1; + ret += LON_OFFSET_2; + ret += LON_OFFSET_3; + return ret; +} + ++ (BOOL)outOfChina:(double)lat bdLon:(double)lon +{ + if (lon < RANGE_LON_MIN || lon > RANGE_LON_MAX) + return true; + if (lat < RANGE_LAT_MIN || lat > RANGE_LAT_MAX) + return true; + return false; +} + ++ (CLLocationCoordinate2D)gcj02Encrypt:(double)ggLat bdLon:(double)ggLon +{ + CLLocationCoordinate2D resPoint; + double mgLat; + double mgLon; + if ([self outOfChina:ggLat bdLon:ggLon]) { + resPoint.latitude = ggLat; + resPoint.longitude = ggLon; + return resPoint; + } + double dLat = [self transformLat:(ggLon - 105.0)bdLon:(ggLat - 35.0)]; + double dLon = [self transformLon:(ggLon - 105.0) bdLon:(ggLat - 35.0)]; + double radLat = ggLat / 180.0 * M_PI; + double magic = sin(radLat); + magic = 1 - jzEE * magic * magic; + double sqrtMagic = sqrt(magic); + dLat = (dLat * 180.0) / ((jzA * (1 - jzEE)) / (magic * sqrtMagic) * M_PI); + dLon = (dLon * 180.0) / (jzA / sqrtMagic * cos(radLat) * M_PI); + mgLat = ggLat + dLat; + mgLon = ggLon + dLon; + + resPoint.latitude = mgLat; + resPoint.longitude = mgLon; + return resPoint; +} + ++ (CLLocationCoordinate2D)gcj02Decrypt:(double)gjLat gjLon:(double)gjLon { + CLLocationCoordinate2D gPt = [self gcj02Encrypt:gjLat bdLon:gjLon]; + double dLon = gPt.longitude - gjLon; + double dLat = gPt.latitude - gjLat; + CLLocationCoordinate2D pt; + pt.latitude = gjLat - dLat; + pt.longitude = gjLon - dLon; + return pt; +} + ++ (CLLocationCoordinate2D)bd09Decrypt:(double)bdLat bdLon:(double)bdLon +{ + CLLocationCoordinate2D gcjPt; + double x = bdLon - 0.0065, y = bdLat - 0.006; + double z = sqrt(x * x + y * y) - 0.00002 * sin(y * M_PI); + double theta = atan2(y, x) - 0.000003 * cos(x * M_PI); + gcjPt.longitude = z * cos(theta); + gcjPt.latitude = z * sin(theta); + return gcjPt; +} + ++(CLLocationCoordinate2D)bd09Encrypt:(double)ggLat bdLon:(double)ggLon +{ + CLLocationCoordinate2D bdPt; + double x = ggLon, y = ggLat; + double z = sqrt(x * x + y * y) + 0.00002 * sin(y * M_PI); + double theta = atan2(y, x) + 0.000003 * cos(x * M_PI); + bdPt.longitude = z * cos(theta) + 0.0065; + bdPt.latitude = z * sin(theta) + 0.006; + return bdPt; +} + + ++ (CLLocationCoordinate2D)wgs84ToGcj02:(CLLocationCoordinate2D)location +{ + return [self gcj02Encrypt:location.latitude bdLon:location.longitude]; +} + ++ (CLLocationCoordinate2D)gcj02ToWgs84:(CLLocationCoordinate2D)location +{ + return [self gcj02Decrypt:location.latitude gjLon:location.longitude]; +} + + ++ (CLLocationCoordinate2D)wgs84ToBd09:(CLLocationCoordinate2D)location +{ + CLLocationCoordinate2D gcj02Pt = [self gcj02Encrypt:location.latitude + bdLon:location.longitude]; + return [self bd09Encrypt:gcj02Pt.latitude bdLon:gcj02Pt.longitude] ; +} + ++ (CLLocationCoordinate2D)gcj02ToBd09:(CLLocationCoordinate2D)location +{ + return [self bd09Encrypt:location.latitude bdLon:location.longitude]; +} + ++ (CLLocationCoordinate2D)bd09ToGcj02:(CLLocationCoordinate2D)location +{ + return [self bd09Decrypt:location.latitude bdLon:location.longitude]; +} + ++ (CLLocationCoordinate2D)bd09ToWgs84:(CLLocationCoordinate2D)location +{ + CLLocationCoordinate2D gcj02 = [self bd09ToGcj02:location]; + return [self gcj02Decrypt:gcj02.latitude gjLon:gcj02.longitude]; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/LineTextField.h b/DoctorXinjiang/DoctorXinjiang/Utils/LineTextField.h new file mode 100644 index 0000000..ce8dba7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/LineTextField.m b/DoctorXinjiang/DoctorXinjiang/Utils/LineTextField.m new file mode 100644 index 0000000..cd361c0 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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(0, CGRectGetHeight(self.frame) - 0.5, CGRectGetWidth(self.frame), 0.5)); +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/MBProgressHUD/MBProgressHUD+XY.h b/DoctorXinjiang/DoctorXinjiang/Utils/MBProgressHUD/MBProgressHUD+XY.h new file mode 100755 index 0000000..ef9e90e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/MBProgressHUD/MBProgressHUD+XY.h @@ -0,0 +1,44 @@ +// +// MBProgressHUD+XY.h +// MiAiApp +// +// Created by 徐阳 on 2017/5/19. +// Copyright © 2017年 徐阳. All rights reserved. +// + +#import + +/** + MBProgressHUD 的二次封装 + */ +@interface MBProgressHUD (XY) + + ++ (void)showTipMessageInWindow:(NSString*)message; ++ (void)showTipMessageInView:(NSString*)message; ++ (void)showTipMessageInWindow:(NSString*)message timer:(float)aTimer; ++ (void)showTipMessageInView:(NSString*)message timer:(float)aTimer; + + ++ (void)showActivityMessageInWindow:(NSString*)message; ++ (void)showActivityMessageInView:(NSString*)message; ++ (void)showActivityMessageInWindow:(NSString*)message timer:(float)aTimer; ++ (void)showActivityMessageInView:(NSString*)message timer:(float)aTimer; + + ++ (void)showSuccessMessage:(NSString *)Message; ++ (void)showErrorMessage:(NSString *)Message; ++ (void)showInfoMessage:(NSString *)Message; ++ (void)showWarnMessage:(NSString *)Message; + + ++ (void)showCustomIconInWindow:(NSString *)iconName message:(NSString *)message; ++ (void)showCustomIconInView:(NSString *)iconName message:(NSString *)message; + + ++ (void)hideHUD; + +//顶部弹出提示 ++ (void)showTopTipMessage:(NSString *)msg; ++ (void)showTopTipMessage:(NSString *)msg isWindow:(BOOL) isWindow; +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/MBProgressHUD/MBProgressHUD+XY.m b/DoctorXinjiang/DoctorXinjiang/Utils/MBProgressHUD/MBProgressHUD+XY.m new file mode 100755 index 0000000..fbe3c23 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/MBProgressHUD/MBProgressHUD+XY.m @@ -0,0 +1,177 @@ +// +// MBProgressHUD+XY.m +// MiAiApp +// +// Created by 徐阳 on 2017/5/19. +// Copyright © 2017年 徐阳. All rights reserved. +// + +#import "MBProgressHUD+XY.h" +const NSInteger hideTime = 1; + +@implementation MBProgressHUD (XY) + ++ (MBProgressHUD*)createMBProgressHUDviewWithMessage:(NSString*)message isWindiw:(BOOL)isWindow +{ + UIView *view = isWindow? (UIView*)[UIApplication sharedApplication].delegate.window:[kAppDelegate getCurrentUIVC].view; + MBProgressHUD * hud = [MBProgressHUD HUDForView:view]; + if (!hud) { + hud =[MBProgressHUD showHUDAddedTo:view animated:YES]; + }else{ + [hud showAnimated:YES]; + } + hud.minSize = CGSizeMake(100, 100); + hud.label.text=message?message:@"加载中..."; + hud.label.font=[UIFont systemFontOfSize:15]; + hud.label.textColor= KWhiteColor; + hud.label.numberOfLines = 0; + hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor; + hud.bezelView.color = [UIColor colorWithWhite:0 alpha:0.9]; + hud.removeFromSuperViewOnHide = YES; + [hud setContentColor:KWhiteColor]; +// hud.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor; +// hud.backgroundView.color = [UIColor colorWithWhite:0.f alpha:0.1f]; + return hud; +} +#pragma mark-------------------- show Tip---------------------------- + ++ (void)showTipMessageInWindow:(NSString*)message +{ + [self showTipMessage:message isWindow:true timer:hideTime]; +} ++ (void)showTipMessageInView:(NSString*)message +{ + [self showTipMessage:message isWindow:false timer:hideTime]; +} ++ (void)showTipMessageInWindow:(NSString*)message timer:(float)aTimer +{ + [self showTipMessage:message isWindow:true timer:aTimer]; +} ++ (void)showTipMessageInView:(NSString*)message timer:(float)aTimer +{ + [self showTipMessage:message isWindow:false timer:aTimer]; +} ++ (void)showTipMessage:(NSString*)message isWindow:(BOOL)isWindow timer:(int)aTimer +{ + MBProgressHUD *hud = [self createMBProgressHUDviewWithMessage:message isWindiw:isWindow]; + hud.mode = MBProgressHUDModeText; + [hud hideAnimated:YES afterDelay:hideTime]; +} +#pragma mark-------------------- show Activity---------------------------- + ++ (void)showActivityMessageInWindow:(NSString*)message +{ + [self showActivityMessage:message isWindow:true timer:0]; +} ++ (void)showActivityMessageInView:(NSString*)message +{ + [self showActivityMessage:message isWindow:false timer:0]; +} ++ (void)showActivityMessageInWindow:(NSString*)message timer:(float)aTimer +{ + [self showActivityMessage:message isWindow:true timer:aTimer]; +} ++ (void)showActivityMessageInView:(NSString*)message timer:(float)aTimer +{ + [self showActivityMessage:message isWindow:false timer:aTimer]; +} ++ (void)showActivityMessage:(NSString*)message isWindow:(BOOL)isWindow timer:(int)aTimer +{ + MBProgressHUD *hud = [self createMBProgressHUDviewWithMessage:message isWindiw:isWindow]; + hud.mode = MBProgressHUDModeIndeterminate; + if (aTimer>0) { + [hud hideAnimated:YES afterDelay:aTimer]; + } +} +#pragma mark-------------------- show Image---------------------------- + ++ (void)showSuccessMessage:(NSString *)Message +{ + [self showCustomIconInWindow:@"MBHUD_Success" message:Message]; +} ++ (void)showErrorMessage:(NSString *)Message +{ + [self showCustomIconInWindow:@"MBHUD_Error" message:Message]; +} ++ (void)showInfoMessage:(NSString *)Message +{ + [self showCustomIconInWindow:@"MBHUD_Info" message:Message]; +} ++ (void)showWarnMessage:(NSString *)Message +{ + [self showCustomIconInWindow:@"MBHUD_Warn" message:Message]; +} ++ (void)showCustomIconInWindow:(NSString *)iconName message:(NSString *)message +{ + [self showCustomIcon:iconName message:message isWindow:true]; + +} ++ (void)showCustomIconInView:(NSString *)iconName message:(NSString *)message +{ + [self showCustomIcon:iconName message:message isWindow:false]; +} ++ (void)showCustomIcon:(NSString *)iconName message:(NSString *)message isWindow:(BOOL)isWindow +{ + MBProgressHUD *hud = [self createMBProgressHUDviewWithMessage:message isWindiw:isWindow]; + hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:iconName]]; + hud.mode = MBProgressHUDModeCustomView; + [hud hideAnimated:YES afterDelay:hideTime]; +} ++ (void)hideHUD +{ + UIView *winView =(UIView*)[UIApplication sharedApplication].delegate.window; + + [self hideHUDForView:winView animated:YES]; + +} + +#pragma mark ————— 顶部tip ————— ++ (void)showTopTipMessage:(NSString *)msg { + [self showTopTipMessage:msg isWindow:NO]; +} ++ (void)showTopTipMessage:(NSString *)msg isWindow:(BOOL) isWindow{ + CGFloat padding = 10; + + YYLabel *label = [YYLabel new]; + label.text = msg; + label.font = [UIFont systemFontOfSize:16]; + label.textAlignment = NSTextAlignmentCenter; + label.textColor = [UIColor whiteColor]; + label.backgroundColor = [UIColor colorWithRed:0.033 green:0.685 blue:0.978 alpha:0.8]; + label.width = kScreenWidth; + label.textContainerInset = UIEdgeInsetsMake(padding+padding, padding, 0, padding); + + if (isWindow) { + label.height = kTopHeight; + label.bottom = 0; + [kAppWindow addSubview:label]; + + [UIView animateWithDuration:0.3 animations:^{ + label.top = 0; + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.2 delay:2 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + label.bottom = 0; + } completion:^(BOOL finished) { + [label removeFromSuperview]; + }]; + }]; + + }else{ + label.height = [msg heightForFont:label.font width:label.width] + 2 * padding; + label.bottom = (kiOS7Later ? 64 : 0); + [[kAppDelegate getCurrentUIVC].view addSubview:label]; + + [UIView animateWithDuration:0.3 animations:^{ + label.top = (kiOS7Later ? 64 : 0); + } completion:^(BOOL finished) { + [UIView animateWithDuration:0.2 delay:2 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + label.bottom = (kiOS7Later ? 64 : 0); + } completion:^(BOOL finished) { + [label removeFromSuperview]; + }]; + }]; + + } + +} +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/SignInApple.h b/DoctorXinjiang/DoctorXinjiang/Utils/SignInApple.h new file mode 100644 index 0000000..830a137 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/SignInApple.h @@ -0,0 +1,23 @@ +// +// SignInApple.h +// SignInAppleDemo +// +// Created by Yostar on 2019/11/25. +// Copyright © 2019 Yostar. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SignInApple : NSObject + +// 处理授权 +- (void)handleAuthorizationAppleIDButtonPress; + +// 如果存在iCloud Keychain 凭证或者AppleID 凭证提示用户 +- (void)perfomExistingAccountSetupFlows; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/SignInApple.m b/DoctorXinjiang/DoctorXinjiang/Utils/SignInApple.m new file mode 100644 index 0000000..4e1a809 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/SignInApple.m @@ -0,0 +1,154 @@ +// +// SignInApple.m +// SignInAppleDemo +// +// Created by Yostar on 2019/11/25. +// Copyright © 2019 Yostar. All rights reserved. +// + +#import "SignInApple.h" +#import + + +#define KEYCHAIN_IDENTIFIER(a) ([NSString stringWithFormat:@"%@_%@",[[NSBundle mainBundle] bundleIdentifier],a]) + +@interface SignInApple () + +@end + +@implementation SignInApple + +// 处理授权 +- (void)handleAuthorizationAppleIDButtonPress{ + NSLog(@"////////"); + + if (@available(iOS 13.0, *)) { + // 基于用户的Apple ID授权用户,生成用户授权请求的一种机制 + ASAuthorizationAppleIDProvider *appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init]; + // 创建新的AppleID 授权请求 + ASAuthorizationAppleIDRequest *appleIDRequest = [appleIDProvider createRequest]; + // 在用户授权期间请求的联系信息 + appleIDRequest.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail]; + // 由ASAuthorizationAppleIDProvider创建的授权请求 管理授权请求的控制器 + ASAuthorizationController *authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[appleIDRequest]]; + // 设置授权控制器通知授权请求的成功与失败的代理 + authorizationController.delegate = self; + // 设置提供 展示上下文的代理,在这个上下文中 系统可以展示授权界面给用户 + authorizationController.presentationContextProvider = self; + // 在控制器初始化期间启动授权流 + [authorizationController performRequests]; + }else{ + // 处理不支持系统版本 + NSLog(@"该系统版本不可用Apple登录"); + } +} + +// 如果存在iCloud Keychain 凭证或者AppleID 凭证提示用户 +- (void)perfomExistingAccountSetupFlows{ + NSLog(@"///已经认证过了/////"); + + if (@available(iOS 13.0, *)) { + // 基于用户的Apple ID授权用户,生成用户授权请求的一种机制 + ASAuthorizationAppleIDProvider *appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init]; + // 授权请求AppleID + ASAuthorizationAppleIDRequest *appleIDRequest = [appleIDProvider createRequest]; + // 为了执行钥匙串凭证分享生成请求的一种机制 + ASAuthorizationPasswordProvider *passwordProvider = [[ASAuthorizationPasswordProvider alloc] init]; + ASAuthorizationPasswordRequest *passwordRequest = [passwordProvider createRequest]; + // 由ASAuthorizationAppleIDProvider创建的授权请求 管理授权请求的控制器 + ASAuthorizationController *authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[appleIDRequest, passwordRequest]]; + // 设置授权控制器通知授权请求的成功与失败的代理 + authorizationController.delegate = self; + // 设置提供 展示上下文的代理,在这个上下文中 系统可以展示授权界面给用户 + authorizationController.presentationContextProvider = self; + // 在控制器初始化期间启动授权流 + [authorizationController performRequests]; + }else{ + // 处理不支持系统版本 + NSLog(@"该系统版本不可用Apple登录"); + } +} + +#pragma mark - delegate +//@optional 授权成功地回调 +- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)){ + NSLog(@"授权完成:::%@", authorization.credential); + NSLog(@"%s", __FUNCTION__); + NSLog(@"%@", controller); + NSLog(@"%@", authorization); + + if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) { + // 用户登录使用ASAuthorizationAppleIDCredential + ASAuthorizationAppleIDCredential *appleIDCredential = authorization.credential; + NSString *user = appleIDCredential.user; + // 使用过授权的,可能获取不到以下三个参数 + NSString *familyName = appleIDCredential.fullName.familyName; + NSString *givenName = appleIDCredential.fullName.givenName; + NSString *email = appleIDCredential.email; + + NSData *identityToken = appleIDCredential.identityToken; + NSData *authorizationCode = appleIDCredential.authorizationCode; + + // 服务器验证需要使用的参数 + NSString *identityTokenStr = [[NSString alloc] initWithData:identityToken encoding:NSUTF8StringEncoding]; + NSString *authorizationCodeStr = [[NSString alloc] initWithData:authorizationCode encoding:NSUTF8StringEncoding]; + NSLog(@"%@\n\n%@", identityTokenStr, authorizationCodeStr); + + // Create an account in your system. + // For the purpose of this demo app, store the userIdentifier in the keychain. + // 需要使用钥匙串的方式保存用户的唯一信息 +// [YostarKeychain save:KEYCHAIN_IDENTIFIER(@"userIdentifier") data:user]; + + }else if ([authorization.credential isKindOfClass:[ASPasswordCredential class]]){ + // 这个获取的是iCloud记录的账号密码,需要输入框支持iOS 12 记录账号密码的新特性,如果不支持,可以忽略 + // Sign in using an existing iCloud Keychain credential. + // 用户登录使用现有的密码凭证 + ASPasswordCredential *passwordCredential = authorization.credential; + // 密码凭证对象的用户标识 用户的唯一标识 + NSString *user = passwordCredential.user; + // 密码凭证对象的密码 + NSString *password = passwordCredential.password; + + }else{ + NSLog(@"授权信息均不符"); + + } +} + +// 授权失败的回调 +- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0)){ + // Handle error. + NSLog(@"Handle error:%@", error); + NSString *errorMsg = nil; + switch (error.code) { + case ASAuthorizationErrorCanceled: + errorMsg = @"用户取消了授权请求"; + break; + case ASAuthorizationErrorFailed: + errorMsg = @"授权请求失败"; + break; + case ASAuthorizationErrorInvalidResponse: + errorMsg = @"授权请求响应无效"; + break; + case ASAuthorizationErrorNotHandled: + errorMsg = @"未能处理授权请求"; + break; + case ASAuthorizationErrorUnknown: + errorMsg = @"授权请求失败未知原因"; + break; + + default: + break; + } + + NSLog(@"%@", errorMsg); +} + +// 告诉代理应该在哪个window 展示内容给用户 +- (ASPresentationAnchor)presentationAnchorForAuthorizationController:(ASAuthorizationController *)controller API_AVAILABLE(ios(13.0)){ + NSLog(@"88888888888"); + // 返回window + return [UIApplication sharedApplication].windows.lastObject; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/Star/FSXBStarRateView.h b/DoctorXinjiang/DoctorXinjiang/Utils/Star/FSXBStarRateView.h new file mode 100755 index 0000000..318640c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/Star/FSXBStarRateView.m b/DoctorXinjiang/DoctorXinjiang/Utils/Star/FSXBStarRateView.m new file mode 100755 index 0000000..eb31c2e --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/TagsView/ZHTagListView.h b/DoctorXinjiang/DoctorXinjiang/Utils/TagsView/ZHTagListView.h new file mode 100644 index 0000000..ebefa0c --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/TagsView/ZHTagListView.h @@ -0,0 +1,44 @@ +// +// 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; + +@end + + +@interface ZHTagListView : UIView +///frame高度根据内容和边距确定 +- (instancetype)initWithFrame:(CGRect)frame configuration:(ZHTagListConfiguration *)configuration tagTexts:(NSArray *)tagTexts; + +@property (nonatomic, copy) NSArray *tagTexts; +@property (nonatomic, copy) NSArray *tagButtonList; +@property (nonatomic, copy) NSArray *tags; + +@property (nonatomic, copy) void (^tagClickHandler)(ZHTagListView *tagListView, NSString *tagText, NSUInteger index); +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/TagsView/ZHTagListView.m b/DoctorXinjiang/DoctorXinjiang/Utils/TagsView/ZHTagListView.m new file mode 100644 index 0000000..43c599a --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/TagsView/ZHTagListView.m @@ -0,0 +1,124 @@ +// +// 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; + +@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)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]; + //设置按钮的样式 + tagBtn.layer.borderColor = UIColorHex(#DEDEDE).CGColor; + tagBtn.layer.borderWidth = 0.5; + tagBtn.layer.cornerRadius = 4; + [tagBtn setTitleColor:self.configuration.tagTextColor forState:UIControlStateNormal]; + tagBtn.titleLabel.font = self.configuration.tagTextFont; + 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], @"..."]; + } + [tagBtn setTitle:tag 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)setTags:(NSArray *)tags { + _tags = tags; + [self setupTagListView]; +} + +-(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/DoctorXinjiang/DoctorXinjiang/Utils/UUKeyboardInputView.h b/DoctorXinjiang/DoctorXinjiang/Utils/UUKeyboardInputView.h new file mode 100755 index 0000000..2994933 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/UUKeyboardInputView.h @@ -0,0 +1,54 @@ +// +// inputAccessoryView.h +// InputAccessoryView-WindowLayer +// +// Created by shake on 14/11/14. +// Copyright (c) 2014年 uyiuyao. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class UUInputConfiger; + +typedef void(^UUInputViewResultBlock) (NSString * _Nullable contentStr); + +typedef void(^UUInputAccessoryConfige) (UUInputConfiger *configer); + + +@interface UUKeyboardInputView : NSObject + ++ (void)dimiss; + ++ (void)showBlock:(UUInputViewResultBlock)block; + ++ (void)showKeyboardType:(UIKeyboardType)type + block:(UUInputViewResultBlock)block; + ++ (void)showKeyboardType:(UIKeyboardType)type + content:(nullable NSString *)content + block:(UUInputViewResultBlock)block; + +// more flexible config ++ (void)showKeyboardConfige:(nullable UUInputAccessoryConfige)confige + block:(UUInputViewResultBlock)block; + +@end + + +@interface UUInputConfiger : NSObject + +// default UIKeyboardTypeDefault +@property (nonatomic) UIKeyboardType keyboardType; +// default nil +@property (copy, nonatomic, nullable) NSString *content; +// default YES +@property (nonatomic) BOOL backgroundUserInterface; +// default clearColor +@property (strong, nonatomic, nullable) UIColor *backgroundColor; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/UUKeyboardInputView.m b/DoctorXinjiang/DoctorXinjiang/Utils/UUKeyboardInputView.m new file mode 100755 index 0000000..9035ca4 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Utils/UUKeyboardInputView.m @@ -0,0 +1,249 @@ +// +// inputAccessoryView.m +// InputAccessoryView-WindowLayer +// +// Created by shake on 14/11/14. +// Copyright (c) 2014年 uyiuyao. All rights reserved. +// + +#import "UUKeyboardInputView.h" + +#define UUIAV_SCREEN_WIDTH CGRectGetWidth([UIScreen mainScreen].bounds) +#define UUIAV_SCREEN_HEIGHT CGRectGetHeight([UIScreen mainScreen].bounds) + +@interface UUKeyboardInputView () + +@property (nonatomic, copy) UUInputViewResultBlock finishBlock; + +@property (nonatomic, strong) UITextView *inputView; +@property (nonatomic, strong) UIButton *btnSave; +@property (nonatomic, strong) UIView *toolbar; + +@property (nonatomic, strong) UIButton *assistDismissButton; +@property (nonatomic, strong) UITextField *assistInputView; + +@end + +@implementation UUKeyboardInputView + ++ (UUKeyboardInputView*)sharedView { + + static dispatch_once_t once; + + static UUKeyboardInputView *sharedView; + + dispatch_once(&once, ^ { + sharedView = [[UUKeyboardInputView alloc] init]; + }); + return sharedView; +} + ++ (void)dimiss +{ + [[UUKeyboardInputView sharedView] dismiss]; +} + ++ (void)showBlock:(UUInputViewResultBlock)block +{ + [[UUKeyboardInputView sharedView] configer:[UUInputConfiger new] show:block]; +} + ++ (void)showKeyboardType:(UIKeyboardType)type block:(UUInputViewResultBlock)block +{ + UUInputConfiger *configer = [UUInputConfiger new]; + configer.keyboardType = type; + [[UUKeyboardInputView sharedView] configer:configer show:block]; +} + ++ (void)showKeyboardType:(UIKeyboardType)type content:(NSString *)content block:(UUInputViewResultBlock)block +{ + UUInputConfiger *configer = [UUInputConfiger new]; + configer.keyboardType = type; + configer.content = content; + [[UUKeyboardInputView sharedView] configer:configer show:block]; +} + ++ (void)showKeyboardConfige:(UUInputAccessoryConfige)confige block:(UUInputViewResultBlock)block +{ + UUInputConfiger *configer = [UUInputConfiger new]; + !confige?:confige(configer); + [[UUKeyboardInputView sharedView] configer:configer show:block]; +} + +- (void)configer:(UUInputConfiger *_Nullable)configer show:(UUInputViewResultBlock)block +{ + [self initBaseElements]; + + UIWindow *window = [UIApplication sharedApplication].delegate.window; + self.assistDismissButton.frame = window.bounds; + self.assistDismissButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [window addSubview:self.assistDismissButton]; + + [self updateLayoutAtBegin:YES]; + + self.finishBlock = block; + self.inputView.text = configer.content; + self.assistInputView.text = configer.content; + self.inputView.keyboardType = configer.keyboardType; + self.assistInputView.keyboardType = configer.keyboardType; + self.btnSave.selected = configer.content.length==0; + self.assistDismissButton.userInteractionEnabled = configer.backgroundUserInterface; + self.assistDismissButton.backgroundColor = configer.backgroundColor ?: [UIColor clearColor]; + + self.assistInputView.inputAccessoryView = _toolbar; + [self.assistInputView becomeFirstResponder]; + + [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardDidShowNotification + object:nil + queue:nil + usingBlock:^(NSNotification * _Nonnull note) { + if (self.assistDismissButton.window && self.assistInputView.isFirstResponder) { + [self.inputView becomeFirstResponder]; + [self.inputView scrollRangeToVisible:NSMakeRange(self.inputView.text.length, 1)]; +// [self updateLayoutAtBegin:NO]; + } + }]; + + //note: scroll to dismiss keyboard + [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardDidHideNotification + object:nil + queue:nil + usingBlock:^(NSNotification * _Nonnull note) { + [self cleanBaseElements]; + }]; + + //note: scroll to dismiss keyboard + [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillHideNotification + object:nil + queue:nil + usingBlock:^(NSNotification * _Nonnull note) { + if (self.inputView.isFirstResponder) { + [self dismiss]; + } + }]; + +} + +- (void)updateLayoutAtBegin:(BOOL)atBeigin +{ + CGFloat const saveButtonWidth = 60; + CGFloat const edge = 4; + + CGFloat height = MAX(40, _inputView.contentSize.height); + height = MIN(height, 80); +// height = atBeigin ? 40:height; + [UIView animateWithDuration:atBeigin ? 0:0.2 animations:^{ + _btnSave.frame = CGRectMake(UUIAV_SCREEN_WIDTH-saveButtonWidth, (height-40)/2.0, saveButtonWidth, 40); + _toolbar.frame = CGRectMake(0, 40-height, UUIAV_SCREEN_WIDTH, height); + _inputView.frame = CGRectMake(edge, edge, UUIAV_SCREEN_WIDTH-saveButtonWidth-edge, height-edge*2); + }]; +} + +- (void)saveButtonAction +{ + [self.inputView resignFirstResponder]; + if (!self.btnSave.selected) { + !self.finishBlock ?: self.finishBlock(self.inputView.text ?: @""); + } + [self dismiss]; +} + +- (void)dismiss +{ + if ([self.inputView.text isEqualToString:@""]) + { + !self.finishBlock ?: self.finishBlock(@""); + } + [self.inputView resignFirstResponder]; + [self.assistDismissButton removeFromSuperview]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +// textView's delegate +- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text +{ + if ([text isEqualToString:@"\n"]) { + [self saveButtonAction]; + return NO; + } + return YES; +} + +- (void)textViewDidChange:(UITextView *)textView +{ + [self updateLayoutAtBegin:NO]; + self.btnSave.selected = textView.text.length==0; +} + +- (void)initBaseElements +{ + UIButton *backgroundBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + [backgroundBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; + + UIView *toolbar = [[UIView alloc] init]; + toolbar.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1]; + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1000, 0.5)]; + line.backgroundColor = [UIColor lightGrayColor]; + [toolbar addSubview:line]; + + UITextView *textView = [[UITextView alloc] init]; + textView.returnKeyType = UIReturnKeyDone; + textView.enablesReturnKeyAutomatically = YES; + textView.delegate = self; + textView.font = [UIFont systemFontOfSize:15]; + textView.layer.cornerRadius = 5; + textView.layer.borderColor = [UIColor lightGrayColor].CGColor; + textView.layer.borderWidth = 1/[UIScreen mainScreen].scale; + [toolbar addSubview:textView]; + + UITextField *assistTxf = [UITextField new]; + assistTxf.returnKeyType = UIReturnKeyDone; + assistTxf.enablesReturnKeyAutomatically = YES; + [backgroundBtn addSubview:assistTxf]; + + UIButton *saveBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + saveBtn.backgroundColor = [UIColor clearColor]; + [saveBtn setTitle:@"确定" forState:UIControlStateNormal]; + [saveBtn setTitle:@"取消" forState:UIControlStateSelected]; + [saveBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; + [saveBtn setTitleColor:[UIColor redColor] forState:UIControlStateSelected]; + [saveBtn addTarget:self action:@selector(saveButtonAction) forControlEvents:UIControlEventTouchUpInside]; + [toolbar addSubview:saveBtn]; + + self.toolbar = toolbar; + self.assistDismissButton = backgroundBtn; + self.inputView = textView; + self.assistInputView = assistTxf; + self.btnSave = saveBtn; +} + +- (void)cleanBaseElements +{ + [self.toolbar removeFromSuperview]; + [self.assistDismissButton removeFromSuperview]; + [self.inputView removeFromSuperview]; + [self.assistInputView removeFromSuperview]; + [self.btnSave removeFromSuperview]; + _toolbar = nil; + _assistDismissButton = nil; + _inputView = nil; + _assistInputView = nil; + _btnSave = nil; + _finishBlock = nil; +} + +@end + + + +@implementation UUInputConfiger + +- (instancetype)init +{ + if (self = [super init]) { + self.backgroundUserInterface = YES; + } + return self; +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Utils/XYTransition/XYTransition.h b/DoctorXinjiang/DoctorXinjiang/Utils/XYTransition/XYTransition.h new file mode 100755 index 0000000..5beac61 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/XYTransition/XYTransition.m b/DoctorXinjiang/DoctorXinjiang/Utils/XYTransition/XYTransition.m new file mode 100755 index 0000000..61fd091 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiang/Utils/XYTransition/XYTransitionProtocol.h b/DoctorXinjiang/DoctorXinjiang/Utils/XYTransition/XYTransitionProtocol.h new file mode 100755 index 0000000..8ff7609 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/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/DoctorXinjiang/DoctorXinjiangTests/DoctorXinjiangTests.m b/DoctorXinjiang/DoctorXinjiangTests/DoctorXinjiangTests.m new file mode 100644 index 0000000..97cd6af --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiangTests/DoctorXinjiangTests.m @@ -0,0 +1,36 @@ +// +// DoctorXinjiangTests.m +// DoctorXinjiangTests +// +// Created by Apple on 2025/6/24. +// + +#import + +@interface DoctorXinjiangTests : XCTestCase + +@end + +@implementation DoctorXinjiangTests + +- (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/DoctorXinjiang/DoctorXinjiangUITests/DoctorXinjiangUITests.m b/DoctorXinjiang/DoctorXinjiangUITests/DoctorXinjiangUITests.m new file mode 100644 index 0000000..1622172 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiangUITests/DoctorXinjiangUITests.m @@ -0,0 +1,44 @@ +// +// DoctorXinjiangUITests.m +// DoctorXinjiangUITests +// +// Created by Apple on 2025/6/24. +// + +#import + +@interface DoctorXinjiangUITests : XCTestCase + +@end + +@implementation DoctorXinjiangUITests + +- (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/DoctorXinjiang/DoctorXinjiangUITests/DoctorXinjiangUITestsLaunchTests.m b/DoctorXinjiang/DoctorXinjiangUITests/DoctorXinjiangUITestsLaunchTests.m new file mode 100644 index 0000000..26bcd10 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiangUITests/DoctorXinjiangUITestsLaunchTests.m @@ -0,0 +1,37 @@ +// +// DoctorXinjiangUITestsLaunchTests.m +// DoctorXinjiangUITests +// +// Created by Apple on 2025/6/24. +// + +#import + +@interface DoctorXinjiangUITestsLaunchTests : XCTestCase + +@end + +@implementation DoctorXinjiangUITestsLaunchTests + ++ (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 diff --git a/DoctorXinjiang/Podfile b/DoctorXinjiang/Podfile new file mode 100644 index 0000000..61711f3 --- /dev/null +++ b/DoctorXinjiang/Podfile @@ -0,0 +1,48 @@ +platform :ios, '10.0' +# 忽略引入库的所有警告 +inhibit_all_warnings! + +# 防止 TUIKit 组件里的 *.xcassets 与您项目里面冲突。 +install! 'cocoapods', :disable_input_output_paths => true +# 通过指定use_frameworks!要求生成的是framework而不是静态库。 +target 'DoctorXinjiang' do + + pod 'MJRefresh' + pod 'MBProgressHUD' + pod 'Masonry' + pod 'YYKit' + pod 'IQKeyboardManager' #iOS8 and later + 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 'AAChartKit', :git => 'https://github.com/AAChartModel/AAChartKit.git' + pod 'AFNetworking' + pod 'SDWebImageWebPCoder' + pod 'SDWebImage' + pod 'SDCycleScrollView' + pod 'AMap3DMap','~>10.0.600' + pod 'AMapSearch','~>9.5.0' + pod 'AMapLocation','~>2.9.0' +end + diff --git a/DoctorXinjiang/Podfile.lock b/DoctorXinjiang/Podfile.lock new file mode 100644 index 0000000..24bcff9 --- /dev/null +++ b/DoctorXinjiang/Podfile.lock @@ -0,0 +1,509 @@ +PODS: + - AAChartKit (9.2.0) + - 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) + - IQKeyboardManager (6.5.11) + - 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.6) + - ReactiveObjC (3.1.1) + - SDCycleScrollView (1.82): + - SDWebImage (>= 5.0.0) + - SDWebImage (5.21.1): + - SDWebImage/Core (= 5.21.1) + - SDWebImage/Core (5.21.1) + - SDWebImageWebPCoder (0.14.6): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.17) + - SJBaseVideoPlayer (3.7.6): + - Masonry + - SJBaseVideoPlayer/AVPlayer (= 3.7.6) + - SJBaseVideoPlayer/Common (= 3.7.6) + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJBaseVideoPlayer/AVPlayer (3.7.6): + - Masonry + - SJBaseVideoPlayer/Common + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJBaseVideoPlayer/Common (3.7.6): + - Masonry + - SJBaseVideoPlayer/ResourceLoader + - SJUIKit/AttributesFactory (>= 0.0.0.38) + - SJUIKit/ObserverHelper + - SJUIKit/Queues + - SJUIKit/SQLite3 + - SJBaseVideoPlayer/ResourceLoader (3.7.6): + - 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) + - 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.9): + - TZImagePickerController/Basic (= 3.8.9) + - TZImagePickerController/Location (= 3.8.9) + - TZImagePickerController/Basic (3.8.9) + - TZImagePickerController/Location (3.8.9) + - YYKit (1.0.9): + - YYKit/no-arc (= 1.0.9) + - YYKit/no-arc (1.0.9) + - YYModel (1.0.4) + +DEPENDENCIES: + - AAChartKit (from `https://github.com/AAChartModel/AAChartKit.git`) + - AFNetworking + - AMap3DMap (~> 10.0.600) + - AMapLocation (~> 2.9.0) + - AMapSearch (~> 9.5.0) + - 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 + - IQKeyboardManager + - libwebp + - Masonry + - MBProgressHUD + - MJRefresh + - ReactiveObjC + - SDCycleScrollView + - SDWebImage + - SDWebImageWebPCoder + - SJBaseVideoPlayer + - SJUIKit + - SJVideoPlayer + - TIMCommon + - TUICallEngine + - TUICallKit + - TUIChat + - TUIContact + - TUIConversation + - TUICore + - TUIGroup + - TUIOfflinePush + - TUISearch + - TXIMSDK_Plus_iOS + - TXLiteAVSDK_TRTC + - TZImagePickerController + - YYKit + - YYModel + +EXTERNAL SOURCES: + AAChartKit: + :git: https://github.com/AAChartModel/AAChartKit.git + +CHECKOUT OPTIONS: + AAChartKit: + :commit: a0e79474d7428e2617e16310a0ad4584f561f081 + :git: https://github.com/AAChartModel/AAChartKit.git + +SPEC CHECKSUMS: + AAChartKit: e3384633481b9e9727a10859649bef7782467ec2 + AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58 + AMap3DMap: 2896b8d63034aaf79720a402573362ca2fef0dec + AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec + AMapLocation: f5eb11e11c62f0f599f80b578eec8a1f70deb985 + AMapSearch: e0c81206b8ac1d27ef349095a96ea6398e3a0da3 + IQKeyboardManager: ef43ce1ba1e5aaf4adf222c0a46f39761f246879 + libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8 + Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 + MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 + MJRefresh: 2fe7fb43a5167ceda20bb7e63f130c04fd1814a5 + ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040 + SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf + SDWebImage: f29024626962457f3470184232766516dee8dfea + SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 + SJBaseVideoPlayer: f15debaa8c1e27b63bdefc8caeec515e9c71d079 + SJUIKit: a40111941e408cc17d4c1c23495aa92999e814b0 + SJVideoPlayer: 4f09814f58522e0975cb2dccfda925f6c8643467 + 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: 456f470b5dea97b37226ec7a694994a8663340b2 + YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7 + YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30 + +PODFILE CHECKSUM: a41711abf96968815ef32d28a0e955ea37ea1b85 + +COCOAPODS: 1.16.2