Commit 3f9212f3 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '90aaf9f4' into xiezhaolin

parents 1e1945ae 90aaf9f4
...@@ -630,6 +630,7 @@ ...@@ -630,6 +630,7 @@
04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebViewViewController.swift; sourceTree = "<group>"; }; 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebViewViewController.swift; sourceTree = "<group>"; };
04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; }; 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; };
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; }; 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; };
19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.testenv.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.testenv.xcconfig"; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; }; 58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
...@@ -1553,6 +1554,7 @@ ...@@ -1553,6 +1554,7 @@
children = ( children = (
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */, 58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */,
B6BB01E4C5DB87B66F0ECE84 /* Pods-galaxy.release.xcconfig */, B6BB01E4C5DB87B66F0ECE84 /* Pods-galaxy.release.xcconfig */,
19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */,
); );
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2602,6 +2604,143 @@ ...@@ -2602,6 +2604,143 @@
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
A53B61132BB19B840010B573 /* TestEnv */ = {
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";
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 = 13.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = TestEnv;
};
A53B61142BB19B840010B573 /* TestEnv */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/galaxy/Res/Frameworks",
);
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = galaxy/Res/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "智慧银河";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.business";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "Launch Screen.storyboard";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.2.7;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev.intelligenceGalaxy.profile;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = TESTENV;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = TestEnv;
};
A53B61152BB19B840010B573 /* TestEnv */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.galaxy.cn.galaxyTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/galaxy.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/galaxy";
};
name = TestEnv;
};
A53B61162BB19B840010B573 /* TestEnv */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.galaxy.cn.galaxyUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = galaxy;
};
name = TestEnv;
};
A5573EF62B317C0100D98EC0 /* Debug */ = { A5573EF62B317C0100D98EC0 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
...@@ -2731,7 +2870,7 @@ ...@@ -2731,7 +2870,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -2773,7 +2912,7 @@ ...@@ -2773,7 +2912,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -2889,6 +3028,7 @@ ...@@ -2889,6 +3028,7 @@
buildConfigurations = ( buildConfigurations = (
A5573EF62B317C0100D98EC0 /* Debug */, A5573EF62B317C0100D98EC0 /* Debug */,
A5573EF72B317C0100D98EC0 /* Release */, A5573EF72B317C0100D98EC0 /* Release */,
A53B61132BB19B840010B573 /* TestEnv */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
...@@ -2898,6 +3038,7 @@ ...@@ -2898,6 +3038,7 @@
buildConfigurations = ( buildConfigurations = (
A5573EF92B317C0100D98EC0 /* Debug */, A5573EF92B317C0100D98EC0 /* Debug */,
A5573EFA2B317C0100D98EC0 /* Release */, A5573EFA2B317C0100D98EC0 /* Release */,
A53B61142BB19B840010B573 /* TestEnv */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
...@@ -2907,6 +3048,7 @@ ...@@ -2907,6 +3048,7 @@
buildConfigurations = ( buildConfigurations = (
A5573EFC2B317C0100D98EC0 /* Debug */, A5573EFC2B317C0100D98EC0 /* Debug */,
A5573EFD2B317C0100D98EC0 /* Release */, A5573EFD2B317C0100D98EC0 /* Release */,
A53B61152BB19B840010B573 /* TestEnv */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
...@@ -2916,6 +3058,7 @@ ...@@ -2916,6 +3058,7 @@
buildConfigurations = ( buildConfigurations = (
A5573EFF2B317C0100D98EC0 /* Debug */, A5573EFF2B317C0100D98EC0 /* Debug */,
A5573F002B317C0100D98EC0 /* Release */, A5573F002B317C0100D98EC0 /* Release */,
A53B61162BB19B840010B573 /* TestEnv */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573EE32B317C0100D98EC0"
BuildableName = "galaxyTests.xctest"
BlueprintName = "galaxyTests"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573EED2B317C0100D98EC0"
BuildableName = "galaxyUITests.xctest"
BlueprintName = "galaxyUITests"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "TestEnv"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
...@@ -22,10 +22,10 @@ class YHContactMainItemStatusModel { ...@@ -22,10 +22,10 @@ class YHContactMainItemStatusModel {
iconName = "service_center_sfsq_wdpf_icon" iconName = "service_center_sfsq_wdpf_icon"
itemName = "我的评分" itemName = "我的评分"
} else if type == 4 { } else if type == 4 {
iconName = "service_center_sfsq_wdpf_icon" iconName = "service_center_sfsq_wdws_icon"
itemName = "我的文书" itemName = "我的文书"
} else if type == 5 { } else if type == 5 {
iconName = "service_center_sfsq_wdpf_icon" iconName = "service_center_sfsq_wdqz_icon"
itemName = "我的签字" itemName = "我的签字"
} else if type == 6 { } else if type == 6 {
iconName = "service_center_sfsq_wdpf_icon" iconName = "service_center_sfsq_wdpf_icon"
......
...@@ -115,7 +115,7 @@ extension YHCertificateListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -115,7 +115,7 @@ extension YHCertificateListVC: UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
if let url = path?.url, !url.isEmpty { if let url = path?.url, !url.isEmpty {
print(url) print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url) self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName:"预览")
} }
} }
view.show() view.show()
...@@ -229,16 +229,13 @@ extension YHCertificateListVC { ...@@ -229,16 +229,13 @@ extension YHCertificateListVC {
} }
} }
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo, successBlock:(()->())?) { func uploadImage(_ img: UIImage, imageName:String, supplementInfo:YHSupplementInfo, callBack:((Bool)->())?) {
// 先OSS上传得到URL // 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) { self.viewModel.uploadImage(img) {
[weak self] url, error in [weak self] url, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty { if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg" var suffix = "jpg"
let suffixName = url.pathExtension.lowercased() let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty { if !suffixName.isEmpty {
...@@ -247,24 +244,18 @@ extension YHCertificateListVC { ...@@ -247,24 +244,18 @@ extension YHCertificateListVC {
// 再调用业务接口 // 再调用业务接口
let model = YHContentUrl() let model = YHContentUrl()
model.name = imgName model.name = imageName
model.url = url model.url = url
model.suffix = suffix model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
self.requestList(status: self.status) self.requestList(status: self.status)
if success { callBack?(success)
successBlock?()
}
} }
return return
} }
// callBack?(false)
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
} }
} }
...@@ -274,10 +265,13 @@ extension YHCertificateListVC { ...@@ -274,10 +265,13 @@ extension YHCertificateListVC {
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0)) let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)") print("\(size)")
// 先OSS上传得到URL // 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) { self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in [weak self] successUrl, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口 // 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty { if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent let fileName = successUrl.lastPathComponent
...@@ -286,9 +280,20 @@ extension YHCertificateListVC { ...@@ -286,9 +280,20 @@ extension YHCertificateListVC {
model.name = fileName model.name = fileName
model.url = successUrl model.url = successUrl
model.suffix = suffixName model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") { YHHUD.show(.progress(message: "上传中..."))
success in self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
YHHUD.hide()
self.requestList(status:self.status) self.requestList(status:self.status)
if success {
YHHUD.flash(message: "上传成功")
} else {
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
if success { if success {
successBlock?() successBlock?()
} }
...@@ -310,13 +315,14 @@ extension YHCertificateListVC { ...@@ -310,13 +315,14 @@ extension YHCertificateListVC {
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) { func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = { sheetView.clickTemplateBlock = {
[weak self] path in [weak self] path in
if let url = path?.url, !url.isEmpty { if let url = path?.url, !url.isEmpty {
guard let self = self else { return } guard let self = self else { return }
print(url) print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url) self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
} }
} }
sheetView.uploadFilesBlock = { sheetView.uploadFilesBlock = {
...@@ -324,7 +330,7 @@ extension YHCertificateListVC { ...@@ -324,7 +330,7 @@ extension YHCertificateListVC {
guard let self = self else { return } guard let self = self else { return }
print(fileUrl) print(fileUrl)
uploadFile(fileUrl, supplementInfo: supplementInfo) { uploadFile(fileUrl, supplementInfo: supplementInfo) {
// 待上传的进入详情 // 待上传的进入详情
DispatchQueue.main.async { DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC() let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId vc.orderId = self.orderId
...@@ -335,11 +341,40 @@ extension YHCertificateListVC { ...@@ -335,11 +341,40 @@ extension YHCertificateListVC {
} }
} }
sheetView.uploadImageBlock = { sheetView.uploadImageBlock = {
[weak self] image in [weak self] imgArr in
guard let self = self else { return } guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo) { var successArr:[YHSelectImageItem] = []
// 非待上传的进入详情 var failArr:[YHSelectImageItem] = []
DispatchQueue.main.async { let group = DispatchGroup()
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name, supplementInfo: supplementInfo) {
success in
if success {
successArr.append(item)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
YHHUD.hide()
// 所有任务完成,回到主线程继续执行
print("所有任务完成")
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
if successArr.count > 0 {
let vc = YHCertificateUploadContentListVC() let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo vc.categoryInfo = self.categoryInfo
......
...@@ -153,7 +153,7 @@ extension YHCertificateSearchViewController: UITableViewDelegate, UITableViewDat ...@@ -153,7 +153,7 @@ extension YHCertificateSearchViewController: UITableViewDelegate, UITableViewDat
guard let self = self else { return } guard let self = self else { return }
if let url = path?.url, !url.isEmpty { if let url = path?.url, !url.isEmpty {
print(url) print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url) self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
} }
} }
view.show() view.show()
...@@ -245,16 +245,13 @@ extension YHCertificateSearchViewController { ...@@ -245,16 +245,13 @@ extension YHCertificateSearchViewController {
} }
} }
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo) { func uploadImage(_ img: UIImage, imageName:String, supplementInfo:YHSupplementInfo, callBack:((Bool)->())?) {
// 先OSS上传得到URL // 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) { self.viewModel.uploadImage(img) {
[weak self] url, error in [weak self] url, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty { if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg" var suffix = "jpg"
let suffixName = url.pathExtension.lowercased() let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty { if !suffixName.isEmpty {
...@@ -263,34 +260,32 @@ extension YHCertificateSearchViewController { ...@@ -263,34 +260,32 @@ extension YHCertificateSearchViewController {
// 再调用业务接口 // 再调用业务接口
let model = YHContentUrl() let model = YHContentUrl()
model.name = imgName model.name = imageName
model.url = url model.url = url
model.suffix = suffix model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") { self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in success, error in
self.requestList(keyWord: self.searchBar.textField.text) self.requestList(keyWord: self.searchBar.textField.text)
callBack?(success)
} }
return return
} }
// callBack?(false)
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
} }
} }
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo) { func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo, successBlock:(()->())?) {
if let fileData = try? Data(contentsOf: fileUrl) { if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器 // 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0)) let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)") print("\(size)")
// 先OSS上传得到URL // 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) { self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in [weak self] successUrl, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口 // 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty { if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent let fileName = successUrl.lastPathComponent
...@@ -299,9 +294,23 @@ extension YHCertificateSearchViewController { ...@@ -299,9 +294,23 @@ extension YHCertificateSearchViewController {
model.name = fileName model.name = fileName
model.url = successUrl model.url = successUrl
model.suffix = suffixName model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") { YHHUD.show(.progress(message: "上传中..."))
success in self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "上传成功")
} else {
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestList(keyWord: self.searchBar.textField.text) self.requestList(keyWord: self.searchBar.textField.text)
if success {
successBlock?()
}
} }
return return
} }
...@@ -317,30 +326,78 @@ extension YHCertificateSearchViewController { ...@@ -317,30 +326,78 @@ extension YHCertificateSearchViewController {
} }
} }
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) { func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = { sheetView.clickTemplateBlock = {
[weak self] path in [weak self] path in
if let url = path?.url, !url.isEmpty { if let url = path?.url, !url.isEmpty {
guard let self = self else { return } guard let self = self else { return }
print(url) print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url) self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
} }
} }
sheetView.uploadFilesBlock = { sheetView.uploadFilesBlock = {
[weak self] fileUrl in [weak self] fileUrl in
guard let self = self else { return } guard let self = self else { return }
print(fileUrl) print(fileUrl)
uploadFile(fileUrl, supplementInfo: supplementInfo) uploadFile(fileUrl, supplementInfo: supplementInfo) {
// 待上传的进入详情
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
vc.supplementInfo = supplementInfo
self.navigationController?.pushViewController(vc)
}
}
} }
sheetView.uploadImageBlock = { sheetView.uploadImageBlock = {
[weak self] image in [weak self] imgArr in
guard let self = self else { return } guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo) var successArr:[YHSelectImageItem] = []
var failArr:[YHSelectImageItem] = []
let group = DispatchGroup()
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name, supplementInfo: supplementInfo) {
success in
if success {
successArr.append(item)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
// 所有任务完成,回到主线程继续执行
print("所有任务完成")
YHHUD.hide()
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
if successArr.count > 0 {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
vc.supplementInfo = supplementInfo
self.navigationController?.pushViewController(vc)
}
}
} }
sheetView.show() sheetView.show()
} }
......
...@@ -18,10 +18,14 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -18,10 +18,14 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
templateArr.removeAll() templateArr.removeAll()
if let uploadInfo = supplementInfo { if let uploadInfo = supplementInfo {
if uploadInfo.templateInfo.materialPath.count > 0 { if uploadInfo.templateInfo.materialPath.count > 0 {
templateArr.append(uploadInfo.templateInfo.materialPath[0]) let template = uploadInfo.templateInfo.materialPath[0]
template.type = 0
templateArr.append(template)
} }
if uploadInfo.templateInfo.guideFilePath.count > 0 { if uploadInfo.templateInfo.guideFilePath.count > 0 {
templateArr.append(uploadInfo.templateInfo.guideFilePath[0]) let guide = uploadInfo.templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
} }
} }
self.tableView.reloadData() self.tableView.reloadData()
...@@ -101,9 +105,21 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -101,9 +105,21 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
[weak self] text in [weak self] text in
guard let self = self else { return } guard let self = self else { return }
if let selectEditItem = selectEditItem, var text = text { if let selectEditItem = selectEditItem, var text = text {
// 重命名
text = text + "." + selectEditItem.getFileSuffixName() text = text + "." + selectEditItem.getFileSuffixName()
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:selectEditItem, operation: "rename", rename: text) { YHHUD.show(.progress(message: "重命名中..."))
success in self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:selectEditItem, operation: "rename", rename: text) {
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "重命名成功")
} else {
var msg = "重命名失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestList() self.requestList()
} }
} }
...@@ -116,11 +132,13 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -116,11 +132,13 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
@objc func didClickUploadBtn() { @objc func didClickUploadBtn() {
if items.count >= 100 { if items.count >= 99 {
YHHUD.flash(message: "最多上传100张图片或文件") YHHUD.flash(message: "已达上限\n最多上传99张图片或文件")
return return
} }
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 99-items.count
sheetView.templateInfo = supplementInfo.templateInfo sheetView.templateInfo = supplementInfo.templateInfo
sheetView.uploadFilesBlock = { sheetView.uploadFilesBlock = {
[weak self] fileUrl in [weak self] fileUrl in
...@@ -129,9 +147,40 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -129,9 +147,40 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
uploadFile(fileUrl) uploadFile(fileUrl)
} }
sheetView.uploadImageBlock = { sheetView.uploadImageBlock = {
[weak self] image in [weak self] imgArr in
guard let self = self else { return } guard let self = self else { return }
uploadImage(image) let group = DispatchGroup()
var successArr:[YHSelectImageItem] = []
var failArr:[YHSelectImageItem] = []
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name) {
success in
if success {
successArr.append(item)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
// 所有任务完成,回到主线程继续执行
print("所有任务完成")
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
YHHUD.hide()
}
} }
sheetView.show() sheetView.show()
} }
...@@ -217,7 +266,12 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -217,7 +266,12 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
if editType == .rename { // 重命名 if editType == .rename { // 重命名
IQKeyboardManager.shared.enable = false IQKeyboardManager.shared.enable = false
renameInputView.textField.text = contentItem.getFileNameWithoutSuffix()
var name = contentItem.getFileNameWithoutSuffix()
if name.count > 30 {
name = name[safe: ..<30]!
}
renameInputView.textField.text = name
renameInputView.textField.becomeFirstResponder() renameInputView.textField.becomeFirstResponder()
} else if editType == .delete { // 删除 } else if editType == .delete { // 删除
...@@ -225,8 +279,20 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -225,8 +279,20 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
let msg = "您确定要删除文档\(contentItem.name)吗" let msg = "您确定要删除文档\(contentItem.name)吗"
YHTwoOptionAlertView.showAlertView(message:msg) { sure in YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return } if !sure { return }
self.viewModel.updateCertificateItem(supplementId:self.supplementInfo.id, urlModel:contentItem, operation: "del", rename:"") { // 删除
success in YHHUD.show(.progress(message: "删除中..."))
self.viewModel.updateCertificateItem(supplementsId:self.supplementInfo.id, urlModel:contentItem, operation: "del", rename:"") {
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "删除成功")
} else {
var msg = "删除失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestList() self.requestList()
} }
} }
...@@ -235,7 +301,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -235,7 +301,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
print(contentItem.url) print(contentItem.url)
self.viewModel.getPublicImageUrl(contentItem.url) { success, error in self.viewModel.getPublicImageUrl(contentItem.url) { success, error in
if let success = success { if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success) self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:contentItem.name)
} }
} }
} }
...@@ -292,7 +358,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -292,7 +358,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
tipsLabel.font = UIFont.PFSC_R(ofSize:14) tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.numberOfLines = 0 tipsLabel.numberOfLines = 0
if !supplementInfo.templateInfo.description.isEmpty { if !supplementInfo.templateInfo.description.isEmpty {
tipsLabel.text = supplementInfo.templateInfo.description tipsLabel.text = "注意事项:\n\(supplementInfo.templateInfo.description)"
} }
view.addSubview(tipsLabel) view.addSubview(tipsLabel)
...@@ -352,7 +418,11 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -352,7 +418,11 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
tipsLabel.font = UIFont.PFSC_R(ofSize:12) tipsLabel.font = UIFont.PFSC_R(ofSize:12)
tipsLabel.textAlignment = .left tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0 tipsLabel.numberOfLines = 0
tipsLabel.text = supplementInfo.auditContent if !supplementInfo.auditContent.isEmpty {
tipsLabel.text = "被驳回原因: \(supplementInfo.auditContent)"
} else {
tipsLabel.text = ""
}
view.addSubview(tipsLabel) view.addSubview(tipsLabel)
titlelabel.snp.makeConstraints { make in titlelabel.snp.makeConstraints { make in
...@@ -407,7 +477,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -407,7 +477,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
let path = templateArr[indexPath.row] let path = templateArr[indexPath.row]
print(path.url) print(path.url)
if !path.url.isEmpty { if !path.url.isEmpty {
self.previewFileTool.openXLSXRemoteFile(urlString:path.url) self.previewFileTool.openXLSXRemoteFile(urlString:path.url, fileName:"预览")
} }
} }
...@@ -491,7 +561,13 @@ extension YHCertificateUploadContentListVC { ...@@ -491,7 +561,13 @@ extension YHCertificateUploadContentListVC {
} }
} }
self.uploadBtn.alpha = (items.count >= 100 ? 0.5 : 1.0) if categoryInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
self.uploadBtn.isHidden = true
} else {
self.uploadBtn.isHidden = false
self.uploadBtn.alpha = (items.count >= 99 ? 0.5 : 1.0)
}
self.tableView.reloadData() self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 { if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
...@@ -502,16 +578,13 @@ extension YHCertificateUploadContentListVC { ...@@ -502,16 +578,13 @@ extension YHCertificateUploadContentListVC {
func uploadImage(_ img: UIImage) { func uploadImage(_ img: UIImage, imageName:String, callBack:((Bool)->())?) {
// 先OSS上传得到URL // 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) { self.viewModel.uploadImage(img) {
[weak self] url, error in [weak self] url, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty { if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg" var suffix = "jpg"
let suffixName = url.pathExtension.lowercased() let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty { if !suffixName.isEmpty {
...@@ -520,21 +593,18 @@ extension YHCertificateUploadContentListVC { ...@@ -520,21 +593,18 @@ extension YHCertificateUploadContentListVC {
// 再调用业务接口 // 再调用业务接口
let model = YHContentUrl() let model = YHContentUrl()
model.name = imgName model.name = imageName
model.url = url model.url = url
model.suffix = suffix model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") { self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in success, error in
callBack?(success)
self.requestList() self.requestList()
} }
return return
} }
// callBack?(false)
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
} }
} }
...@@ -544,20 +614,35 @@ extension YHCertificateUploadContentListVC { ...@@ -544,20 +614,35 @@ extension YHCertificateUploadContentListVC {
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0)) let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)") print("\(size)")
// 先OSS上传得到URL // 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) { self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in [weak self] successUrl, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口 // 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty { if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent var fileName = fileUrl.lastPathComponent
if fileName.isEmpty {
fileName = successUrl.lastPathComponent
}
let suffixName = successUrl.pathExtension.lowercased() let suffixName = successUrl.pathExtension.lowercased()
let model = YHContentUrl() let model = YHContentUrl()
model.name = fileName model.name = fileName
model.url = successUrl model.url = successUrl
model.suffix = suffixName model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") { YHHUD.show(.progress(message: "上传中..."))
success in self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "上传成功")
} else {
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestList() self.requestList()
} }
return return
...@@ -567,7 +652,6 @@ extension YHCertificateUploadContentListVC { ...@@ -567,7 +652,6 @@ extension YHCertificateUploadContentListVC {
msg = errorMsg msg = errorMsg
} }
YHHUD.flash(message: msg) YHHUD.flash(message: msg)
YHCertificateUploadFailTipsView.tipsView().show()
} }
} else { } else {
......
...@@ -250,6 +250,8 @@ class YHTemplateInfo: SmartCodable { ...@@ -250,6 +250,8 @@ class YHTemplateInfo: SmartCodable {
class YHMaterialPath: SmartCodable { class YHMaterialPath: SmartCodable {
var name: String = "" var name: String = ""
var url: String = "" var url: String = ""
// 自定义类型 0:模版 1:指引
var type: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case name = "name" case name = "name"
...@@ -260,7 +262,8 @@ class YHMaterialPath: SmartCodable { ...@@ -260,7 +262,8 @@ class YHMaterialPath: SmartCodable {
} }
init(name: String = "", url: String = "") { init(type:Int, name: String = "", url: String = "") {
self.type = type
self.name = name self.name = name
self.url = url self.url = url
} }
......
...@@ -46,7 +46,7 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -46,7 +46,7 @@ class YHCertificateInfoCell: UITableViewCell {
titleColor = .failColor titleColor = .failColor
title = "已驳回".local title = "已驳回".local
case .review: case .review:
titleColor = .labelTextColor2 titleColor = .warnColor
title = "审核中".local title = "审核中".local
case .finish: case .finish:
titleColor = .labelTextColor2 titleColor = .labelTextColor2
...@@ -63,8 +63,8 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -63,8 +63,8 @@ class YHCertificateInfoCell: UITableViewCell {
if !model.typeName.isEmpty { if !model.typeName.isEmpty {
typeStr = model.typeName typeStr = model.typeName
} }
if !model.nameExtra.userName.isEmpty { if !model.nameExtra.applicant.isEmpty {
ownerStr = model.nameExtra.userName ownerStr = model.nameExtra.applicant
} }
infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)" infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)"
...@@ -124,6 +124,7 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -124,6 +124,7 @@ class YHCertificateInfoCell: UITableViewCell {
templateButton.clipsToBounds = true templateButton.clipsToBounds = true
templateButton.backgroundColor = .brandMainColor8 templateButton.backgroundColor = .brandMainColor8
templateButton.addTarget(self, action: #selector(didTemplateBtnClicked), for: .touchUpInside) templateButton.addTarget(self, action: #selector(didTemplateBtnClicked), for: .touchUpInside)
templateButton.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
nameTextView.attributed.text = """ nameTextView.attributed.text = """
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateButton, .original(.center)))) \("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateButton, .original(.center))))
......
...@@ -37,7 +37,7 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -37,7 +37,7 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.text = model.name nameLabel.text = model.name
timeLabel.text = "上传于\(model.updatedAt)" timeLabel.text = "上传于\(model.updatedAt)"
var suffix = model.getFileSuffixName() let suffix = model.getFileSuffixName()
var iconImgName = "" var iconImgName = ""
if suffix == "jpeg" { if suffix == "jpeg" {
...@@ -77,7 +77,7 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -77,7 +77,7 @@ class YHCertificateNameCell: UITableViewCell {
whiteView = UIView() whiteView = UIView()
contentView.addSubview(whiteView) contentView.addSubview(whiteView)
iconImgV = UIImageView(image:UIImage(named:"my_cer_type_pdf")) iconImgV = UIImageView(image:UIImage(named:"my_cer_type_jpg"))
whiteView.addSubview(iconImgV) whiteView.addSubview(iconImgV)
nameLabel = UILabel() nameLabel = UILabel()
...@@ -85,14 +85,12 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -85,14 +85,12 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.textAlignment = .left nameLabel.textAlignment = .left
nameLabel.numberOfLines = 0 nameLabel.numberOfLines = 0
nameLabel.font = UIFont.PFSC_M(ofSize:14) nameLabel.font = UIFont.PFSC_M(ofSize:14)
nameLabel.text = "文档名称.doc"
whiteView.addSubview(nameLabel) whiteView.addSubview(nameLabel)
timeLabel = UILabel() timeLabel = UILabel()
timeLabel.textColor = UIColor.labelTextColor2 timeLabel.textColor = UIColor.labelTextColor2
timeLabel.textAlignment = .left timeLabel.textAlignment = .left
timeLabel.font = UIFont.PFSC_R(ofSize:11) timeLabel.font = UIFont.PFSC_R(ofSize:11)
timeLabel.text = "上传于2024.01.01"
whiteView.addSubview(timeLabel) whiteView.addSubview(timeLabel)
editBtn = UIButton() editBtn = UIButton()
...@@ -103,7 +101,7 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -103,7 +101,7 @@ class YHCertificateNameCell: UITableViewCell {
whiteView.snp.makeConstraints { make in whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview()
make.top.equalToSuperview().offset(15) make.top.equalToSuperview().offset(15)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
...@@ -130,7 +128,7 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -130,7 +128,7 @@ class YHCertificateNameCell: UITableViewCell {
editBtn.snp.makeConstraints { make in editBtn.snp.makeConstraints { make in
make.width.height.equalTo(16) make.width.height.equalTo(16)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-6) make.right.equalToSuperview().offset(-20-6)
} }
} }
} }
...@@ -12,6 +12,7 @@ class YHCertificateSearchBar: UIView { ...@@ -12,6 +12,7 @@ class YHCertificateSearchBar: UIView {
static let height = 40.0 static let height = 40.0
static let cancelBtnHeight = height-8.0 static let cancelBtnHeight = height-8.0
static let maxWordsCount = 50
var textChange:((String?)->Void)? var textChange:((String?)->Void)?
var searchBlock:((String?)->Void)? var searchBlock:((String?)->Void)?
...@@ -33,12 +34,13 @@ class YHCertificateSearchBar: UIView { ...@@ -33,12 +34,13 @@ class YHCertificateSearchBar: UIView {
lazy var textField:UITextField = { lazy var textField:UITextField = {
let textField = UITextField() let textField = UITextField()
textField.backgroundColor = .clear textField.backgroundColor = .clear
textField.attributedPlaceholder = NSAttributedString(string: "请输入", attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor]) textField.attributedPlaceholder = NSAttributedString(string: "请输出资料名称搜索".local, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
textField.font = UIFont.PFSC_M(ofSize: 12) textField.font = UIFont.PFSC_M(ofSize: 12)
textField.tintColor = UIColor(hexString: "#3D88F8") textField.tintColor = UIColor(hexString: "#3D88F8")
textField.textColor = UIColor.mainTextColor textField.textColor = UIColor.mainTextColor
textField.clearButtonMode = .whileEditing textField.clearButtonMode = .whileEditing
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged) textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.delegate = self
return textField return textField
}() }()
...@@ -115,3 +117,20 @@ class YHCertificateSearchBar: UIView { ...@@ -115,3 +117,20 @@ class YHCertificateSearchBar: UIView {
} }
} }
} }
extension YHCertificateSearchBar: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { // 点击删除
return true
}
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > Self.maxWordsCount {
YHHUD.flash(message: "搜索限制最多\(Self.maxWordsCount)个字符")
return false
}
return true
}
}
...@@ -72,7 +72,18 @@ class YHCertificateSampleTemplateView: UIView { ...@@ -72,7 +72,18 @@ class YHCertificateSampleTemplateView: UIView {
class YHCertificateTemplateCell: UITableViewCell { class YHCertificateTemplateCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateTemplateCell" static let cellReuseIdentifier = "YHCertificateTemplateCell"
var templatePath: YHMaterialPath? var templatePath: YHMaterialPath? {
didSet {
if let path = templatePath {
var title = "查看证件示例模版"
if path.type == 1 { // 指引
title = "查看证件操作指引"
}
templateView.titleLabel.text = title
}
}
}
lazy var templateView: YHCertificateSampleTemplateView = { lazy var templateView: YHCertificateSampleTemplateView = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero) let view = YHCertificateSampleTemplateView(frame:CGRectZero)
......
...@@ -142,10 +142,14 @@ class YHCertificateTemplateSheetView: UIView { ...@@ -142,10 +142,14 @@ class YHCertificateTemplateSheetView: UIView {
templateArr.removeAll() templateArr.removeAll()
if model.materialPath.count > 0 { if model.materialPath.count > 0 {
templateArr.append(model.materialPath[0]) let template = model.materialPath[0]
template.type = 0
templateArr.append(template)
} }
if model.guideFilePath.count > 0 { if model.guideFilePath.count > 0 {
templateArr.append(model.guideFilePath[0]) let guide = model.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
} }
self.tableView.reloadData() self.tableView.reloadData()
...@@ -263,7 +267,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo ...@@ -263,7 +267,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14) label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0 label.numberOfLines = 0
label.text = desc label.text = "注意事项:\n\(desc)"
view.addSubview(label) view.addSubview(label)
label.snp.makeConstraints { make in label.snp.makeConstraints { make in
......
...@@ -18,6 +18,17 @@ ...@@ -18,6 +18,17 @@
import UIKit import UIKit
import Photos import Photos
import PhotosUI
class YHSelectImageItem {
var name: String
var data: UIImage?
init(name: String = "", data: UIImage? = nil) {
self.name = name
self.data = data
}
}
enum YHCertificateUploadType: Int { enum YHCertificateUploadType: Int {
...@@ -31,32 +42,17 @@ enum YHCertificateUploadType: Int { ...@@ -31,32 +42,17 @@ enum YHCertificateUploadType: Int {
class YHCertificateUploadSheetView: UIView { class YHCertificateUploadSheetView: UIView {
static func sheetView() -> YHCertificateUploadSheetView { private var _maxSelectCount: Int = 9
let view = YHCertificateUploadSheetView(frame:UIScreen.main.bounds) var maxSelectCount = 9 {
return view didSet {
if maxSelectCount >= 9 {
_maxSelectCount = 9
} else if 0 < maxSelectCount && maxSelectCount < 9 {
_maxSelectCount = maxSelectCount
} else {
_maxSelectCount = 0
} }
func calculateHeight() -> CGFloat {
guard let templateInfo = templateInfo else { return 0.0}
// 注意事项文字高度
var descHeight = templateInfo.description.boundingRect(with: CGSize(width:KScreenWidth-40.0 , height:.greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: [.font : UIFont.PFSC_R(ofSize:14)],
context: nil).size.height
descHeight = ceil(descHeight)+20
// 所有模版高度之和
let templatesHeight = 82.0 * Double(templateArr.count)
// 底部四个操作行高度之和
let actionsHeight = 52.0 * 4.0
let tableViewHeight = descHeight+templatesHeight+actionsHeight
// 白色View总高度
var totalHeight = 53.0+20.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight {
totalHeight = 458
} }
return totalHeight
} }
var templateInfo: YHTemplateInfo? { var templateInfo: YHTemplateInfo? {
...@@ -64,10 +60,14 @@ class YHCertificateUploadSheetView: UIView { ...@@ -64,10 +60,14 @@ class YHCertificateUploadSheetView: UIView {
templateArr.removeAll() templateArr.removeAll()
if let templateInfo = templateInfo { if let templateInfo = templateInfo {
if templateInfo.materialPath.count > 0 { if templateInfo.materialPath.count > 0 {
templateArr.append(templateInfo.materialPath[0]) let template = templateInfo.materialPath[0]
template.type = 0
templateArr.append(template)
} }
if templateInfo.guideFilePath.count > 0 { if templateInfo.guideFilePath.count > 0 {
templateArr.append(templateInfo.guideFilePath[0]) let guide = templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
} }
} }
let totalHeight = calculateHeight() let totalHeight = calculateHeight()
...@@ -89,7 +89,7 @@ class YHCertificateUploadSheetView: UIView { ...@@ -89,7 +89,7 @@ class YHCertificateUploadSheetView: UIView {
// 上传文件 // 上传文件
var uploadFilesBlock:((URL)->())? var uploadFilesBlock:((URL)->())?
// 上传图片 // 上传图片
var uploadImageBlock:((UIImage)->())? var uploadImageBlock:(([YHSelectImageItem])->())?
// 点击模版 // 点击模版
var clickTemplateBlock:((YHMaterialPath?)->())? var clickTemplateBlock:((YHMaterialPath?)->())?
...@@ -207,6 +207,12 @@ class YHCertificateUploadSheetView: UIView { ...@@ -207,6 +207,12 @@ class YHCertificateUploadSheetView: UIView {
createUI() createUI()
} }
static func sheetView() -> YHCertificateUploadSheetView {
let view = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
return view
}
func createUI() { func createUI() {
self.addSubview(blackMaskView) self.addSubview(blackMaskView)
...@@ -239,6 +245,29 @@ class YHCertificateUploadSheetView: UIView { ...@@ -239,6 +245,29 @@ class YHCertificateUploadSheetView: UIView {
} }
} }
func calculateHeight() -> CGFloat {
guard let templateInfo = templateInfo else { return 0.0}
// 注意事项文字高度
var descHeight = templateInfo.description.boundingRect(with: CGSize(width:KScreenWidth-40.0 , height:.greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: [.font : UIFont.PFSC_R(ofSize:14)],
context: nil).size.height
descHeight = ceil(descHeight)+20
// 所有模版高度之和
let templatesHeight = 82.0 * Double(templateArr.count)
// 底部四个操作行高度之和
let actionsHeight = 52.0 * 4.0
let tableViewHeight = descHeight+templatesHeight+actionsHeight
// 白色View总高度
var totalHeight = 53.0+20.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight {
totalHeight = 458
}
return totalHeight
}
} }
extension YHCertificateUploadSheetView { extension YHCertificateUploadSheetView {
...@@ -300,6 +329,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour ...@@ -300,6 +329,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
dismiss() dismiss()
} else if operationItem.type == .photo { } else if operationItem.type == .photo {
selectPhoto() selectPhoto()
} else if operationItem.type == .camera { } else if operationItem.type == .camera {
...@@ -342,7 +372,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour ...@@ -342,7 +372,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14) label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0 label.numberOfLines = 0
label.text = desc label.text = "注意事项:\n\(desc)"
view.addSubview(label) view.addSubview(label)
label.snp.makeConstraints { make in label.snp.makeConstraints { make in
...@@ -430,11 +460,23 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav ...@@ -430,11 +460,23 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
} }
if !authorization { if !authorization {
YHHUD.flash(message: "请在设置中打开相册权限") YHHUD.flash(message: "请在设置中打开相册权限")
return return
} }
if #available(iOS 14.0, *) { // iOS14以上可多选
var configuration = PHPickerConfiguration()
// 设置最大选择数量
configuration.selectionLimit = _maxSelectCount
// 设置选择器的过滤条件 只显示图片
configuration.filter = .images
let picker = PHPickerViewController(configuration: configuration)
picker.delegate = self
UIViewController.current?.present(picker, animated: true, completion: nil)
} else { // iOS14以下只能单选
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){ if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController() let imagePicker = UIImagePickerController()
imagePicker.delegate = self imagePicker.delegate = self
...@@ -443,12 +485,26 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav ...@@ -443,12 +485,26 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
UIViewController.current?.present(imagePicker,animated: true) UIViewController.current?.present(imagePicker,animated: true)
} }
} }
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
uploadImageBlock?(image) var imageName = ""
// 获取照片的名称
if let imageUrl = info[.imageURL] as? URL {
let lastComponent = imageUrl.lastPathComponent
imageName = lastComponent
}
if imageName.isEmpty {
let timestamp = Date().timeIntervalSince1970
imageName = "\(timestamp).jpg"
}
let item = YHSelectImageItem(name: imageName, data: image)
uploadImageBlock?([item])
self.dismiss() self.dismiss()
} else { } else {
...@@ -464,6 +520,62 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav ...@@ -464,6 +520,62 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
} }
} }
extension YHCertificateUploadSheetView: PHPickerViewControllerDelegate {
func getImageFromURL(url: URL) -> UIImage? {
if let imageData = try? Data(contentsOf: url) {
return UIImage(data: imageData)
}
return nil
}
@available(iOS 14.0, *)
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
picker.dismiss(animated: true, completion: nil)
self.dismiss()
if results.count <= 0 { // 取消的时候会调用到此处
return
}
let group = DispatchGroup()
let queue = DispatchQueue.global()
var imageArr:[YHSelectImageItem] = []
YHHUD.show(.progress(message:"加载中..."))
for result in results {
group.enter()
// 此方法是异步操作
result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.image.identifier) { url, error in
if let error = error {
print("Error loading image: \(error.localizedDescription)")
} else if let url = url {
print(url)
if let image = self.getImageFromURL(url: url) {
var imgName = url.lastPathComponent
if imgName.isEmpty {
let timestamp = Date().timeIntervalSince1970
imgName = "\(timestamp).jpg"
}
let item = YHSelectImageItem(name: imgName, data: image)
imageArr.append(item)
}
}
group.leave()
}
}
// 等待所有任务完成
group.notify(queue: .main) {
// 所有任务完成,回到主线程继续执行
YHHUD.hide()
print("所有任务完成")
self.uploadImageBlock?(imageArr)
}
}
}
extension YHCertificateUploadSheetView: UIDocumentPickerDelegate { extension YHCertificateUploadSheetView: UIDocumentPickerDelegate {
......
...@@ -18,6 +18,7 @@ import UIKit ...@@ -18,6 +18,7 @@ import UIKit
class YHFileRenameInputView: UIView { class YHFileRenameInputView: UIView {
static let height = 217.0 static let height = 217.0
static let maxWordsCount = 30
var editBlock:((String?)->Void)? var editBlock:((String?)->Void)?
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds) let view = UIView(frame:UIScreen.main.bounds)
...@@ -72,6 +73,8 @@ class YHFileRenameInputView: UIView { ...@@ -72,6 +73,8 @@ class YHFileRenameInputView: UIView {
textField.font = UIFont.PFSC_M(ofSize: 16) textField.font = UIFont.PFSC_M(ofSize: 16)
textField.tintColor = UIColor.brandMainColor textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor textField.textColor = UIColor.mainTextColor
textField.delegate = self
textField.clearButtonMode = .whileEditing
return textField return textField
}() }()
...@@ -203,4 +206,21 @@ extension YHFileRenameInputView { ...@@ -203,4 +206,21 @@ extension YHFileRenameInputView {
} }
} }
extension YHFileRenameInputView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { // 点击删除
return true
}
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > Self.maxWordsCount {
YHHUD.flash(message: "重命名限制最多30个字符")
return false
}
return true
}
}
...@@ -169,9 +169,11 @@ class YHCertificateViewModel: YHBaseViewModel { ...@@ -169,9 +169,11 @@ class YHCertificateViewModel: YHBaseViewModel {
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
let dic = json.data let dic = json.data
if code == NetWorkCode.success.rawValue { if json.code == 200 {
guard let result = YHUploadCertificateInfo.deserialize(dict: dic as? Dictionary ) else { guard let result = YHUploadCertificateInfo.deserialize(dict: dic as? Dictionary ) else {
callBack(nil, YHErrorModel(errorCode:Int32(json.code), errorMsg:"解析失败".local)) let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBack(nil, err)
return return
} }
callBack(result, nil) callBack(result, nil)
...@@ -187,20 +189,14 @@ class YHCertificateViewModel: YHBaseViewModel { ...@@ -187,20 +189,14 @@ class YHCertificateViewModel: YHBaseViewModel {
} }
// 上传/重命名/删除 证件 // 上传/重命名/删除 证件
func updateCertificates(params:[String : Any], isSilient:Bool = false, callBack:@escaping ((Bool, YHErrorModel?)->())) { func updateCertificates(params:[String : Any], callBack:@escaping ((Bool, YHErrorModel?)->())) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi
if !isSilient {
YHHUD.show(.progress(message: "数据加载中..."))
}
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
if !isSilient { if json.code == 200 {
YHHUD.hide()
}
if code == NetWorkCode.success.rawValue {
callBack(true, nil) callBack(true, nil)
} else { } else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg) let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
...@@ -208,23 +204,20 @@ class YHCertificateViewModel: YHBaseViewModel { ...@@ -208,23 +204,20 @@ class YHCertificateViewModel: YHBaseViewModel {
} }
} failBlock: { err in } failBlock: { err in
if !isSilient {
YHHUD.hide()
}
callBack(false, err) callBack(false, err)
} }
} }
// 更改证件 // 更改证件
// operation参数必填,必须是:add(上传)、del(删除)、rename(重命名) // operation参数必填,必须是:add(上传)、del(删除)、rename(重命名)
func updateCertificateItem(supplementId:Int, urlModel: YHContentUrl, operation:String, rename:String, callBack:((Bool)->())?) { func updateCertificateItem(supplementsId:Int, urlModel: YHContentUrl, operation:String, rename:String, callBack:((Bool, YHErrorModel?)->())?) {
var name = urlModel.name var name = urlModel.name
if operation == "rename" { if operation == "rename" {
name = rename name = rename
} }
let dic:[String : Any] = [ let dic:[String : Any] = [
"id" : supplementId, "id" : supplementsId,
"content_url": [ "content_url": [
"name": name, "name": name,
"url": urlModel.url, "url": urlModel.url,
...@@ -234,57 +227,10 @@ class YHCertificateViewModel: YHBaseViewModel { ...@@ -234,57 +227,10 @@ class YHCertificateViewModel: YHBaseViewModel {
"operation" : operation, "operation" : operation,
] ]
YHHUD.show(.progress(message: "数据加载中..."))
self.updateCertificates(params: params) { self.updateCertificates(params: params) {
[weak self] success, error in [weak self] success, error in
YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
callBack?(success, error)
if operation == "del" {
if success {
YHHUD.flash(message: "删除成功")
} else {
var msg = "删除失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
callBack?(success)
return
}
if operation == "rename" {
if success {
YHHUD.flash(message: "重命名成功")
} else {
var msg = "重命名失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
callBack?(success)
return
}
if operation == "add" {
if success {
YHHUD.flash(message: "上传成功")
} else {
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
YHCertificateUploadFailTipsView.tipsView().show()
}
callBack?(success)
return
}
} }
} }
} }
...@@ -16,7 +16,7 @@ class YHFilePreviewTool: NSObject { ...@@ -16,7 +16,7 @@ class YHFilePreviewTool: NSObject {
self.targetVC = targetVC self.targetVC = targetVC
} }
func openXLSXRemoteFile(urlString: String) { func openXLSXRemoteFile(urlString: String, fileName: String?) {
guard let url = URL(string: urlString) else { return } guard let url = URL(string: urlString) else { return }
let configuration = URLSessionConfiguration.default let configuration = URLSessionConfiguration.default
...@@ -36,7 +36,7 @@ class YHFilePreviewTool: NSObject { ...@@ -36,7 +36,7 @@ class YHFilePreviewTool: NSObject {
try? fileManager.moveItem(at: tempLocalUrl, to: destination) try? fileManager.moveItem(at: tempLocalUrl, to: destination)
// 打开文件 // 打开文件
self.openXLSXFile(at: destination) self.openXLSXFile(at: destination, fileName: fileName)
} else { } else {
print("Error downloading the file: \(error?.localizedDescription ?? "Unknown error")") print("Error downloading the file: \(error?.localizedDescription ?? "Unknown error")")
...@@ -49,8 +49,13 @@ class YHFilePreviewTool: NSObject { ...@@ -49,8 +49,13 @@ class YHFilePreviewTool: NSObject {
task.resume() task.resume()
} }
func openXLSXFile(at fileURL: URL) { func openXLSXFile(at fileURL: URL, fileName: String?) {
let controller = UIDocumentInteractionController(url: fileURL) let controller = UIDocumentInteractionController(url: fileURL)
// 设置标题显示
if let fileName = fileName, !fileName.isEmpty {
controller.name = fileName
}
controller.delegate = self controller.delegate = self
DispatchQueue.main.async { DispatchQueue.main.async {
controller.presentPreview(animated: true) controller.presentPreview(animated: true)
......
...@@ -57,7 +57,7 @@ class YHSchemeHeadTotalScoreView: UIView { ...@@ -57,7 +57,7 @@ class YHSchemeHeadTotalScoreView: UIView {
label.font = UIFont(name: "AlibabaPuHuiTi-Bold", size: 24) label.font = UIFont(name: "AlibabaPuHuiTi-Bold", size: 24)
label.textColor = UIColor(hex: 0xd48638) label.textColor = UIColor(hex: 0xd48638)
label.textAlignment = .right label.textAlignment = .right
label.text = "140" label.text = "-"
return label return label
}() }()
addSubview(scoreLabel) addSubview(scoreLabel)
......
...@@ -92,14 +92,15 @@ class YHSchemeTableHeadView: UIView { ...@@ -92,14 +92,15 @@ class YHSchemeTableHeadView: UIView {
label.font = UIFont.PFSC_B(ofSize: 24) label.font = UIFont.PFSC_B(ofSize: 24)
label.textColor = UIColor(hex: 0xffffff) label.textColor = UIColor(hex: 0xffffff)
label.textAlignment = .center label.textAlignment = .center
label.text = "尊敬的侯林先生" label.lineBreakMode = .byTruncatingMiddle
label.text = "尊敬的--"
return label return label
}() }()
addSubview(nameLabel) addSubview(nameLabel)
nameLabel.snp.makeConstraints { make in nameLabel.snp.makeConstraints { make in
make.right.equalTo(-35) make.right.equalTo(-75)
make.height.equalTo(33.5) make.height.equalTo(33.5)
make.left.equalTo(35) make.left.equalTo(75)
make.top.equalTo(26) make.top.equalTo(26)
} }
......
...@@ -166,12 +166,17 @@ class YHSchemeTableViewCell: UITableViewCell { ...@@ -166,12 +166,17 @@ class YHSchemeTableViewCell: UITableViewCell {
subMessageLabel.text = model.subMessage subMessageLabel.text = model.subMessage
} }
@objc func goNext() { @objc func goNext() {
if let title = titleButton.titleLabel?.text { if let title = titleButton.titleLabel?.text {
if title.contains("资料清单") { if title.contains("资料清单") {
UIViewController.current?.navigationController?.pushViewController(YHFileListViewController()) if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let vc = YHMineCertificateEntryViewController()
vc.orderId = orderID as? Int
UIViewController.current?.navigationController?.pushViewController(vc)
} else {
YHHUD.flash(message: "订单号为空")
}
} else if title.contains("文书写作") { } else if title.contains("文书写作") {
UIViewController.current?.navigationController?.pushViewController(YHMyDocumentsListViewController()) UIViewController.current?.navigationController?.pushViewController(YHMyDocumentsListViewController())
} }
......
...@@ -30,14 +30,20 @@ class YHEducationRequestViewModel { ...@@ -30,14 +30,20 @@ class YHEducationRequestViewModel {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data as? [AnyHashable : Any] let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHEducationListInfo.deserialize(dict: dic) else { guard let resultModel = YHEducationListInfo.deserialize(dict: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,nil) callBackBlock(false,error)
return return
} }
listInfo = resultModel listInfo = resultModel
callBackBlock(true,nil) callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in } failBlock: { err in
callBackBlock(false,err) callBackBlock(false,err)
...@@ -56,14 +62,22 @@ class YHEducationRequestViewModel { ...@@ -56,14 +62,22 @@ class YHEducationRequestViewModel {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data as? [AnyHashable : Any] let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHEducationDetailInfo.deserialize(dict: dic) else { guard let resultModel = YHEducationDetailInfo.deserialize(dict: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,nil) callBackBlock(false,error)
return return
} }
educationDetailInfo = resultModel educationDetailInfo = resultModel
callBackBlock(true,nil) callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in } failBlock: { err in
callBackBlock(false,err) callBackBlock(false,err)
...@@ -86,10 +100,12 @@ class YHEducationRequestViewModel { ...@@ -86,10 +100,12 @@ class YHEducationRequestViewModel {
} }
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, nil) let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
} }
} failBlock: { err in } failBlock: { err in
...@@ -109,10 +125,12 @@ class YHEducationRequestViewModel { ...@@ -109,10 +125,12 @@ class YHEducationRequestViewModel {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, nil) let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
} }
} failBlock: { err in } failBlock: { err in
...@@ -132,10 +150,12 @@ class YHEducationRequestViewModel { ...@@ -132,10 +150,12 @@ class YHEducationRequestViewModel {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, nil) let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
} }
} failBlock: { err in } failBlock: { err in
...@@ -155,10 +175,12 @@ class YHEducationRequestViewModel { ...@@ -155,10 +175,12 @@ class YHEducationRequestViewModel {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, nil) let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
} }
} failBlock: { err in } failBlock: { err in
...@@ -178,10 +200,14 @@ class YHEducationRequestViewModel { ...@@ -178,10 +200,14 @@ class YHEducationRequestViewModel {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 {
if let dic = json.data as? [AnyHashable : Any] { if let dic = json.data as? [AnyHashable : Any] {
guard let quaDict = dic["qua_data"] as? [AnyHashable : Any] , let resultModel = YHQualificationDetailInfo.deserialize(dict:quaDict as? [AnyHashable : Any]) else { guard let quaDict = dic["qua_data"] as? [AnyHashable : Any] , let resultModel = YHQualificationDetailInfo.deserialize(dict:quaDict as? [AnyHashable : Any]) else {
callBackBlock(false,nil) let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return return
} }
qualificationDetailInfo = resultModel qualificationDetailInfo = resultModel
...@@ -192,6 +218,11 @@ class YHEducationRequestViewModel { ...@@ -192,6 +218,11 @@ class YHEducationRequestViewModel {
callBackBlock(false,nil) callBackBlock(false,nil)
return return
} }
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in } failBlock: { err in
callBackBlock(false,err) callBackBlock(false,err)
...@@ -214,10 +245,12 @@ class YHEducationRequestViewModel { ...@@ -214,10 +245,12 @@ class YHEducationRequestViewModel {
} }
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, nil) let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
} }
} failBlock: { err in } failBlock: { err in
...@@ -239,14 +272,21 @@ class YHEducationRequestViewModel { ...@@ -239,14 +272,21 @@ class YHEducationRequestViewModel {
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
let dic = json.data as? [AnyHashable : Any] let dic = json.data as? [AnyHashable : Any]
if json.code == 200 {
guard let dic = dic, let list = dic["list"] as? [[String:Any]], let results = [YHCollegeInfo].deserialize(array: list) as? [YHCollegeInfo] else { guard let dic = dic, let list = dic["list"] as? [[String:Any]], let results = [YHCollegeInfo].deserialize(array: list) as? [YHCollegeInfo] else {
callBackBlock(false,nil) let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return return
} }
collegeList = results collegeList = results
callBackBlock(true,nil) callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in } failBlock: { err in
callBackBlock(false,err) callBackBlock(false,err)
......
...@@ -22,9 +22,10 @@ class YHFamilyRequestViewModel { ...@@ -22,9 +22,10 @@ class YHFamilyRequestViewModel {
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
let dic = json.data let dic = json.data
if code == NetWorkCode.success.rawValue { if json.code == 200 {
guard let resultModel = YHFamilyMemberGroupInfo.deserialize(dict: dic as? Dictionary ) else { guard let resultModel = YHFamilyMemberGroupInfo.deserialize(dict: dic as? Dictionary ) else {
callBackBlock(nil, YHErrorModel(errorCode:Int32(json.code), errorMsg:"解析失败".local)) let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(nil, error)
return return
} }
_ = resultModel.checkDefaultValue() _ = resultModel.checkDefaultValue()
...@@ -55,7 +56,7 @@ class YHFamilyRequestViewModel { ...@@ -55,7 +56,7 @@ class YHFamilyRequestViewModel {
YHHUD.hide() YHHUD.hide()
} }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg)) callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg))
...@@ -75,7 +76,7 @@ class YHFamilyRequestViewModel { ...@@ -75,7 +76,7 @@ class YHFamilyRequestViewModel {
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
YHHUD.hide() YHHUD.hide()
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg)) callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg))
...@@ -95,7 +96,7 @@ class YHFamilyRequestViewModel { ...@@ -95,7 +96,7 @@ class YHFamilyRequestViewModel {
let _ = YHNetRequest.postRequest(url: strUrl, params:["order_id":orderId]) { json, code in let _ = YHNetRequest.postRequest(url: strUrl, params:["order_id":orderId]) { json, code in
YHHUD.hide() YHHUD.hide()
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == 200 {
callBackBlock(true,nil) callBackBlock(true,nil)
} else { } else {
callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg)) callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg))
...@@ -119,9 +120,10 @@ class YHFamilyRequestViewModel { ...@@ -119,9 +120,10 @@ class YHFamilyRequestViewModel {
YHHUD.hide() YHHUD.hide()
let dic = json.data let dic = json.data
if code == NetWorkCode.success.rawValue { if json.code == 200 {
guard let resultModel = YHFamilyMember.deserialize(dict: dic as? Dictionary ) else { guard let resultModel = YHFamilyMember.deserialize(dict: dic as? Dictionary ) else {
callBackBlock(nil, YHErrorModel(errorCode:Int32(json.code), errorMsg:"解析失败".local)) let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(nil, error)
return return
} }
_ = resultModel.checkDefaultValue() _ = resultModel.checkDefaultValue()
......
...@@ -103,6 +103,7 @@ extension YHHUD{ ...@@ -103,6 +103,7 @@ extension YHHUD{
extension YHHUD{ extension YHHUD{
static let flashMessageTag = 61535 static let flashMessageTag = 61535
static func flash(message: String, static func flash(message: String,
textAligment:NSTextAlignment = .center,
dismissAfter: TimeInterval = 1.5, dismissAfter: TimeInterval = 1.5,
duration:TimeInterval = 0.5, duration:TimeInterval = 0.5,
isRemoveBefore: Bool = true, isRemoveBefore: Bool = true,
...@@ -123,6 +124,7 @@ extension YHHUD{ ...@@ -123,6 +124,7 @@ extension YHHUD{
containerView.tag = flashMessageTag containerView.tag = flashMessageTag
let label = UILabel() let label = UILabel()
label.text = message label.text = message
label.textAlignment = textAligment
label.numberOfLines = 5 label.numberOfLines = 5
label.textColor = UIColor.white label.textColor = UIColor.white
label.font = UIFont.systemFont(ofSize: 14) label.font = UIFont.systemFont(ofSize: 14)
......
...@@ -28,18 +28,20 @@ class YHBaseUrlManager { ...@@ -28,18 +28,20 @@ class YHBaseUrlManager {
// MARK: - 当前使用的url // MARK: - 当前使用的url
func curURL() -> String { func curURL() -> String {
return YHBaseUrlManager.baseUrlTest //for test hjl
#if DEBUG #if DEBUG
return YHBaseUrlManager.baseUrlTest return YHBaseUrlManager.baseUrlTest
#elseif TESTENV
return YHBaseUrlManager.baseUrlTest
#else #else
return YHBaseUrlManager.baseUrlRelease return YHBaseUrlManager.baseUrlRelease
#endif #endif
} }
func curOssURL() -> String { func curOssURL() -> String {
return YHBaseUrlManager.baseOSSUrlTest //for test hjl
#if DEBUG #if DEBUG
return YHBaseUrlManager.baseOSSUrlTest return YHBaseUrlManager.baseOSSUrlTest
#elseif TESTENV
return YHBaseUrlManager.baseOSSUrlTest
#else #else
return YHBaseUrlManager.baseOSSUrlRelease return YHBaseUrlManager.baseOSSUrlRelease
#endif #endif
...@@ -49,6 +51,8 @@ class YHBaseUrlManager { ...@@ -49,6 +51,8 @@ class YHBaseUrlManager {
func h5URL() -> String { func h5URL() -> String {
#if DEBUG #if DEBUG
return YHBaseUrlManager.h5UrlDev return YHBaseUrlManager.h5UrlDev
#elseif TESTENV
return YHBaseUrlManager.h5UrlDev
#else #else
return YHBaseUrlManager.h5UrlRelease return YHBaseUrlManager.h5UrlRelease
#endif #endif
......
...@@ -172,7 +172,7 @@ class YHNetRequest: NSObject { ...@@ -172,7 +172,7 @@ class YHNetRequest: NSObject {
} }
// guard let imageData = image.jpegData(compressionQuality: 1) else { return httpRequest } // guard let imageData = image.jpegData(compressionQuality: 1) else { return httpRequest }
guard let imageData = image.compressOriginalImage(4 * 1024 * 1024) else { return httpRequest } guard let imageData = image.compressOriginalImage(5 * 1024 * 1024) else { return httpRequest }
let tttt = Double(imageData.count)/1024.0/1024.0 let tttt = Double(imageData.count)/1024.0/1024.0
#if DEBUG #if DEBUG
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 3490@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 3490@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon-wenshuqingdan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon-wenshuqingdan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon-wenshuqingdan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon-wenshuqingdan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment