新疆专家端

This commit is contained in:
History
2025-07-04 11:20:59 +08:00
commit 038278d914
883 changed files with 77350 additions and 0 deletions
@@ -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 = "<group>"; 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 = "<group>"; };
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 = "<group>"; };
/* 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 = "<group>";
};
1883A98D2E0A4AD40055089B /* DoctorXinjiangTests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = DoctorXinjiangTests;
sourceTree = "<group>";
};
1883A9972E0A4AD40055089B /* DoctorXinjiangUITests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = DoctorXinjiangUITests;
sourceTree = "<group>";
};
/* 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 = "<group>";
};
1883A9702E0A4AD10055089B /* Products */ = {
isa = PBXGroup;
children = (
1883A96F2E0A4AD10055089B /* DoctorXinjiang.app */,
1883A98A2E0A4AD40055089B /* DoctorXinjiangTests.xctest */,
1883A9942E0A4AD40055089B /* DoctorXinjiangUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
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 = "<group>";
};
4222692EAAF776967D8AE608 /* Pods */ = {
isa = PBXGroup;
children = (
97D33B21A85118EF4503CDD0 /* Pods-DoctorXinjiang.debug.xcconfig */,
89026E00E1DDA04F74446DC0 /* Pods-DoctorXinjiang.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* 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 */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:DoctorXinjiang.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,16 @@
//
// MQTextField.h
// EscortProject
//
// Created by Apple on 2024/5/7.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MQTextField : UITextField
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -0,0 +1,20 @@
//
// NSDictionary+Log.h
// wbiaoServer
//
// Created by boai on 2020/4/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSDictionary (Log)
@end
@interface NSArray (Log)
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -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 <Foundation/Foundation.h>
@interface NSDictionary (NilSafe)
@end
@interface NSMutableDictionary (NilSafe)
@end
@@ -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 <objc/runtime.h>
#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<NSCopying> [])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<NSCopying> [])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<NSCopying>)aKey {
if (!aKey || !anObject) {
return;
}
[self gl_setObject:anObject forKey:aKey];
}
- (void)gl_setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key {
if (!key || !obj) {
return;
}
[self gl_setObject:obj forKeyedSubscript:key];
}
@end
@@ -0,0 +1,14 @@
//
// UIButton+HXExtension.h
// HXPhotoPickerExample
//
// Created by Silence on 17/2/16.
// Copyright © 2017年 Silence. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButton (HXExtension)
/** 扩大buuton点击范围 */
- (void)hx_setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left;
@end
@@ -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 <objc/runtime.h>
@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
@@ -0,0 +1,41 @@
//
// UIButton+NYS.h
// NewAnju_IOS
//
// Created by 倪永胜 on 2020/5/26.
// Copyright © 2020 NiYongsheng. All rights reserved.
//
#import <UIKit/UIKit.h>
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
@@ -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 <objc/runtime.h>
@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
@@ -0,0 +1,18 @@
//
// UIDevice+model.h
// EscortProject
//
// Created by Apple on 2024/3/29.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIDevice (model)
- (NSString *)getCurrentDeviceModel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,115 @@
//
// UIDevice+model.m
// EscortProject
//
// Created by Apple on 2024/3/29.
//
#import "UIDevice+model.h"
#import <sys/utsname.h>
//有新的产品上线,我没有更新,可以自行去查阅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
@@ -0,0 +1,31 @@
//
// UILabel+ChangeLineSpaceAndWordSpace.h
// healthQuestion
//
// Created by 仁康信息 on 2022/10/11.
//
#import <UIKit/UIKit.h>
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
@@ -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
+58
View File
@@ -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 */
+68
View File
@@ -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 */
+41
View File
@@ -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 */
+219
View File
@@ -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 */
+16
View File
@@ -0,0 +1,16 @@
//
// AppManager.h
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface AppManager : NSObject
#pragma mark ————— APP启动接口 —————
+(void)appStart;
@end
+18
View File
@@ -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
@@ -0,0 +1,104 @@
//
// API.h
// XZYNetworking
//
// Created by 仁康信息 on 2022/9/9.
// Copyright © 2022年 仁康信息. All rights reserved.
//
#import <Foundation/Foundation.h>
#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
@@ -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
@@ -0,0 +1,48 @@
//
// YXNetworkingWithCache.h
// XZYNetworking
//
// Created by 仁康信息 on 2022/9/9.
// Copyright © 2022年 仁康信息. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
//#import <YYCache/YYCache.h>
@protocol XZYNetworkingWithCacheDelegate <NSObject>
@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
@@ -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<AFMultipartFormData> _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<AFMultipartFormData> _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
@@ -0,0 +1,68 @@
//
// ESCTUIManager.h
// EscortProject
//
// Created by 仁康信息 on 2023/2/16.
//
#import <Foundation/Foundation.h>
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
@@ -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
@@ -0,0 +1,36 @@
// YXKeychainTool.h
// idleBuy
//
// Created by ios on 2018/5/28.
// Copyright © 2018年 ios. All rights reserved.
#import <Foundation/Foundation.h>
#import <Security/Security.h>
@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
@@ -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
@@ -0,0 +1,38 @@
//
// YXUserInfo.h
// idleBuy
//
// Created by ios on 2018/5/30.
// Copyright © 2018年 ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@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
@@ -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
@@ -0,0 +1,41 @@
//
// AppDelegate+appService.h
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import <UIKit/UIKit.h>
#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
@@ -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 <IQKeyboardManager/IQKeyboardManager.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapFoundationKit/AMapServices.h>
#import <MAMapKit/MAMapView.h>
@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<V2TIMSDKListener> 的实现类,如果您不需要监听 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
@@ -0,0 +1,17 @@
//
// AppDelegate+pushService.h
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface AppDelegate (PushService)
- (void)initWithJPush:(NSDictionary *)launchOptions;
@end
@@ -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<UNNotificationCategory *> *categories for iOS10 or later
// NSSet<UIUserNotificationCategory *> *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
@@ -0,0 +1,27 @@
//
// AppDelegate.h
// healthQuestion
//
// Created by xulei on 2022/8/9.
//
#import <UIKit/UIKit.h>
#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 <UIApplicationDelegate,UITabBarControllerDelegate,V2TIMConversationListener, TUILoginListener,V2TIMSDKListener, TUICallObserver,V2TIMAPNSListener>
@property (strong, nonatomic) UIWindow * window;
@property (strong, nonatomic) YXBaseTabBarController *
mainTabBar;
@property (nonatomic,assign)NSInteger unreadNumber;
@end
@@ -0,0 +1,175 @@
//
// AppDelegate.m
// healthQuestion
//
// Created by xulei on 2022/8/9.
//
#import "AppDelegate.h"
#import "SJRotationManager.h"
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#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<id<UIUserActivityRestoring>> * __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
@@ -0,0 +1,25 @@
//
// YXBaseTabBarController.h
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import <UIKit/UIKit.h>
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
@@ -0,0 +1,42 @@
//
// YXBaseWebViewController.h
// healthQuestion
//
// Created by 仁康信息 on 2024/1/12.
//
#import "YXBaseViewController.h"
#import <WebKit/WebKit.h>
#import <JavaScriptCore/JavaScriptCore.h>
NS_ASSUME_NONNULL_BEGIN
typedef enum {
WkJSMessageTypeDefault = 0,
WkJSMessageTypeBack = 1,
}WkJSMessageType;
typedef enum {
RightDefaultType = 0,
RightCompleteType = 1,
}RightNavType;
@protocol WebJSExport <JSExport>
- (void)startFunction;
@end
@interface YXBaseWebViewController : YXBaseViewController<UIAlertViewDelegate,WKNavigationDelegate, WKUIDelegate, WebJSExport, WKScriptMessageHandler>
@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
@@ -0,0 +1,13 @@
//
// HQTabBar.h
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HQTabBar : UITabBar
@end
@@ -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
@@ -0,0 +1,32 @@
//
// UITabBar+CustomBadge.h
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import <UIKit/UIKit.h>
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
@@ -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 <objc/runtime.h>
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
@@ -0,0 +1,25 @@
//
// YXBaseNavigationController.h
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface YXBaseNavigationController : UINavigationController
/*!
* 返回到指定的类视图
*
* @param ClassName 类名
* @param animated 是否动画
*/
-(BOOL)popToAppointViewController:(NSString *)ClassName animated:(BOOL)animated;
@end
NS_ASSUME_NONNULL_END
@@ -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 ()<UINavigationControllerDelegate,UIGestureRecognizerDelegate>
@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<UIViewControllerAnimatedTransitioning>)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<XYTransitionProtocol> *)fromVC :(UIViewController<XYTransitionProtocol> *)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<XYTransitionProtocol> *)toVC
{
BOOL b = NO;
if ([toVC respondsToSelector:@selector(isNeedTransition)] && [toVC isNeedTransition]) {
b = YES;
}
return b;
}
#pragma mark -- NavitionContollerDelegate
- (id<UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)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
@@ -0,0 +1,25 @@
//
// YXBaseTabBarController.h
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import <UIKit/UIKit.h>
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
@@ -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 ()<UITabBarControllerDelegate>
@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
@@ -0,0 +1,90 @@
//
// YXBaseViewController.h
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import <UIKit/UIKit.h>
#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
@@ -0,0 +1,284 @@
//
// HQBaseViewController.m
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import "YXBaseViewController.h"
#import "YXLoginViewController.h"
@interface YXBaseViewController ()<MBProgressHUDDelegate>
@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<UIButton *> *)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
@@ -0,0 +1,42 @@
//
// YXBaseWebViewController.h
// healthQuestion
//
// Created by 仁康信息 on 2024/1/12.
//
#import "YXBaseViewController.h"
#import <WebKit/WebKit.h>
#import <JavaScriptCore/JavaScriptCore.h>
NS_ASSUME_NONNULL_BEGIN
typedef enum {
WkJSMessageTypeDefault = 0,
WkJSMessageTypeBack = 1,
}WkJSMessageType;
typedef enum {
RightDefaultType = 0,
RightCompleteType = 1,
}RightNavType;
@protocol WebJSExport <JSExport>
- (void)startFunction;
@end
@interface YXBaseWebViewController : YXBaseViewController<UIAlertViewDelegate,WKNavigationDelegate, WKUIDelegate, WebJSExport, WKScriptMessageHandler>
@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
@@ -0,0 +1,250 @@
//
// YXBaseWebViewController.m
// healthQuestion
//
// Created by 仁康信息 on 2024/1/12.
//
#import "YXBaseWebViewController.h"
@interface YXBaseWebViewController ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@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
@@ -0,0 +1,16 @@
//
// HQShowPromptPopView.h
// healthQuestion
//
// Created by 仁康信息 on 2022/9/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HQShowPromptPopView : UIView
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,25 @@
//
// YXCQAudioPlayManager.h
// EscortProject
//
// Created by 仁康信息 on 2023/12/5.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface YXCQAudioPlayManager : NSObject
+ (AVPlayer *)initWhithUrl:(NSURL *)avUrl;
//开始播放
+ (void)avPlayIngAction:(AVPlayer *)avPlay;
//暂停播放
+ (void)avPauseAction:(AVPlayer *)avPlay;
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -0,0 +1,20 @@
//
// YXDownToolsManager.h
// EscortProject
//
// Created by 仁康信息 on 2023/12/1.
//
#import <Foundation/Foundation.h>
#import "ReaderViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface YXDownToolsManager : NSObject <ReaderViewControllerDelegate>
+ (void)downLoadReportWithURL:(NSString *)PDFURL withFileName:(NSString *)fileName;
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -0,0 +1,99 @@
//
// YXHealthPhyReportModel.h
// EscortProject
//
// Created by 仁康信息 on 2023/8/28.
//
#import <Foundation/Foundation.h>
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<YXThirdResultResModel *> * 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<YXSenResultResModel *> * senResultRes;
@property (nonatomic, strong) NSArray<YXThirdResultResModel *> * 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<YXResultItemResListModel *> * resultItemResList;
@property (nonatomic, strong) NSArray<YXImageItemListModel *> * imageItemList;
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -0,0 +1,22 @@
//
// YXLookReportImageViewController.h
// EscortProject
//
// Created by Apple on 2024/2/26.
//
#import <WebKit/WebKit.h>
#import <JavaScriptCore/JavaScriptCore.h>
NS_ASSUME_NONNULL_BEGIN
@interface YXLookReportImageViewController : YXBaseViewController
@property (nonatomic, strong) NSString * webTitle;
@property (nonatomic, strong) NSString * webUrl;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,173 @@
//
// YXLookReportImageViewController.m
// EscortProject
//
// Created by Apple on 2024/2/26.
//
#import "YXLookReportImageViewController.h"
@interface YXLookReportImageViewController ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@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
@@ -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
@@ -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 <ImSDK_Plus/ImSDK_Plus.h>
#import <TIMCommon/TIMDefine.h>
#import <TUICore/TUICore.h>
#import <TUICore/TUILogin.h>
#import "TUIConversationCellData.h"
@interface YXQuestionDetailViewController ()<TUICallObserver>
@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<V2TIMSDKListener> 的实现类,如果您不需要监听 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
@@ -0,0 +1,19 @@
//
// YXSickNameSubTableViewCell.h
// EscortProject
//
// Created by 仁康信息 on 2023/8/29.
//
#import <UIKit/UIKit.h>
#import "YXHealthPhyReportModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface YXSickNameSubTableViewCell : UITableViewCell
@property (nonatomic, strong) YXThirdResultResModel * model;
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -0,0 +1,23 @@
//
// YXSickNameTopTableViewCell.h
// EscortProject
//
// Created by 仁康信息 on 2023/8/29.
//
#import <UIKit/UIKit.h>
#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
@@ -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
@@ -0,0 +1,22 @@
//
// YXimageReportTableViewCell.h
// EscortProject
//
// Created by Apple on 2024/2/23.
//
#import <UIKit/UIKit.h>
#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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 <ImSDK_Plus/ImSDK_Plus.h>
#import <TIMCommon/TIMDefine.h>
#import <TUICore/TUICore.h>
#import <TUICore/TUILogin.h>
#import "TUIConversationCellData.h"
#import "LYEmptyView.h"
#import "LYEmptyViewHeader.h"
@interface YXPictureRecordViewController ()<V2TIMSDKListener,V2TIMConversationListener>
@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<V2TIMConversationListener> 类型
[[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<V2TIMConversation *> *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<V2TIMConversation *> *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<V2TIMSDKListener> 的实现类,如果您不需要监听 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<V2TIMConversation*> *)conversationList {
// 收到会话新增通知,conversationList 为新增的会话
[self updateConversation:conversationList];
}
- (void)onConversationChanged:(NSArray<V2TIMConversation*> *)conversationList {
// 收到会话变更通知,conversationList 中为变更后的会话对象
[self updateConversation:conversationList];
}
- (void)onConversationDeleted:(NSArray<NSString *> *)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
@@ -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
@@ -0,0 +1,255 @@
//
// QustionRecordViewController.m
// healthQuestion
//
// Created by 仁康信息 on 2023/4/28.
//
#import "YXQustionRecordViewController.h"
#import "YXAudioVideoRecordViewController.h"
#import "YXPictureRecordViewController.h"
@interface YXQustionRecordViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>
/** 顶部控件*/
@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
@@ -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
@@ -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 ()<AAChartViewEventDelegate>
@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(@"<span style=""color:#1E90FF;font-weight:thin;font-size:15px""> 170 </span> <br>\
<span style=""color:#A9A9A9;font-weight:thin;font-size:10px""> 咨询方式 </span>")//标题文本内容
.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(@"<b>{point.name}&nbsp{point.y}</b>")
)
.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 = @"</span> <span style=""color:#333333;text-align:center;font-weight:normal;font-size:15px""> 咨询方式 </span>";
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(@"<b>{point.name}&nbsp{point.y}</b>")
)
.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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 ()<V2TIMSimpleMsgListener,V2TIMSDKListener,TUIMessageCellDelegate,TUIBaseMessageControllerDelegate,TUICallObserver>
@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<V2TIMSDKListener> 的实现类,如果您不需要监听 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<V2TIMMessage *> *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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 ()<UICollectionViewDataSource,UICollectionViewDelegate>
/** 顶部控件*/
@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

Some files were not shown because too many files have changed in this diff Show More