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

Merge commit '90aaf9f4' into xiezhaolin

parents 1e1945ae 90aaf9f4
......@@ -630,6 +630,7 @@
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>"; };
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>"; };
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>"; };
......@@ -1553,6 +1554,7 @@
children = (
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */,
B6BB01E4C5DB87B66F0ECE84 /* Pods-galaxy.release.xcconfig */,
19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
......@@ -2602,6 +2604,143 @@
/* End PBXTargetDependency 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 */ = {
isa = XCBuildConfiguration;
buildSettings = {
......@@ -2731,7 +2870,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2773,7 +2912,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2889,6 +3028,7 @@
buildConfigurations = (
A5573EF62B317C0100D98EC0 /* Debug */,
A5573EF72B317C0100D98EC0 /* Release */,
A53B61132BB19B840010B573 /* TestEnv */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......@@ -2898,6 +3038,7 @@
buildConfigurations = (
A5573EF92B317C0100D98EC0 /* Debug */,
A5573EFA2B317C0100D98EC0 /* Release */,
A53B61142BB19B840010B573 /* TestEnv */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......@@ -2907,6 +3048,7 @@
buildConfigurations = (
A5573EFC2B317C0100D98EC0 /* Debug */,
A5573EFD2B317C0100D98EC0 /* Release */,
A53B61152BB19B840010B573 /* TestEnv */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......@@ -2916,6 +3058,7 @@
buildConfigurations = (
A5573EFF2B317C0100D98EC0 /* Debug */,
A5573F002B317C0100D98EC0 /* Release */,
A53B61162BB19B840010B573 /* TestEnv */,
);
defaultConfigurationIsVisible = 0;
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 {
iconName = "service_center_sfsq_wdpf_icon"
itemName = "我的评分"
} else if type == 4 {
iconName = "service_center_sfsq_wdpf_icon"
iconName = "service_center_sfsq_wdws_icon"
itemName = "我的文书"
} else if type == 5 {
iconName = "service_center_sfsq_wdpf_icon"
iconName = "service_center_sfsq_wdqz_icon"
itemName = "我的签字"
} else if type == 6 {
iconName = "service_center_sfsq_wdpf_icon"
......
......@@ -115,7 +115,7 @@ extension YHCertificateListVC: UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
if let url = path?.url, !url.isEmpty {
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName:"预览")
}
}
view.show()
......@@ -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
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg"
let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty {
......@@ -247,24 +244,18 @@ extension YHCertificateListVC {
// 再调用业务接口
let model = YHContentUrl()
model.name = imgName
model.name = imageName
model.url = url
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)
if success {
successBlock?()
}
callBack?(success)
}
return
}
//
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
callBack?(false)
}
}
......@@ -274,10 +265,13 @@ extension YHCertificateListVC {
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)")
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent
......@@ -286,9 +280,20 @@ extension YHCertificateListVC {
model.name = fileName
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
YHHUD.hide()
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 {
successBlock?()
}
......@@ -310,13 +315,14 @@ extension YHCertificateListVC {
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
if let url = path?.url, !url.isEmpty {
guard let self = self else { return }
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
}
}
sheetView.uploadFilesBlock = {
......@@ -324,7 +330,7 @@ extension YHCertificateListVC {
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl, supplementInfo: supplementInfo) {
// 待上传的进入详情
// 待上传的进入详情
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
......@@ -335,11 +341,40 @@ extension YHCertificateListVC {
}
}
sheetView.uploadImageBlock = {
[weak self] image in
[weak self] imgArr in
guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo) {
// 非待上传的进入详情
DispatchQueue.main.async {
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) {
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()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
......
......@@ -153,7 +153,7 @@ extension YHCertificateSearchViewController: UITableViewDelegate, UITableViewDat
guard let self = self else { return }
if let url = path?.url, !url.isEmpty {
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
}
}
view.show()
......@@ -245,16 +245,13 @@ extension YHCertificateSearchViewController {
}
}
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo) {
func uploadImage(_ img: UIImage, imageName:String, supplementInfo:YHSupplementInfo, callBack:((Bool)->())?) {
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg"
let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty {
......@@ -263,34 +260,32 @@ extension YHCertificateSearchViewController {
// 再调用业务接口
let model = YHContentUrl()
model.name = imgName
model.name = imageName
model.url = url
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(keyWord: self.searchBar.textField.text)
callBack?(success)
}
return
}
//
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
callBack?(false)
}
}
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo) {
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo, successBlock:(()->())?) {
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)")
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent
......@@ -299,9 +294,23 @@ extension YHCertificateSearchViewController {
model.name = fileName
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
YHHUD.show(.progress(message: "上传中..."))
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)
if success {
successBlock?()
}
}
return
}
......@@ -317,30 +326,78 @@ extension YHCertificateSearchViewController {
}
}
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) {
guard let supplementInfo = supplementInfo else { return }
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
if let url = path?.url, !url.isEmpty {
guard let self = self else { return }
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
}
}
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
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 = {
[weak self] image in
[weak self] imgArr in
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()
}
......
......@@ -250,6 +250,8 @@ class YHTemplateInfo: SmartCodable {
class YHMaterialPath: SmartCodable {
var name: String = ""
var url: String = ""
// 自定义类型 0:模版 1:指引
var type: Int = 0
enum CodingKeys: String, CodingKey {
case name = "name"
......@@ -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.url = url
}
......
......@@ -46,7 +46,7 @@ class YHCertificateInfoCell: UITableViewCell {
titleColor = .failColor
title = "已驳回".local
case .review:
titleColor = .labelTextColor2
titleColor = .warnColor
title = "审核中".local
case .finish:
titleColor = .labelTextColor2
......@@ -63,8 +63,8 @@ class YHCertificateInfoCell: UITableViewCell {
if !model.typeName.isEmpty {
typeStr = model.typeName
}
if !model.nameExtra.userName.isEmpty {
ownerStr = model.nameExtra.userName
if !model.nameExtra.applicant.isEmpty {
ownerStr = model.nameExtra.applicant
}
infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)"
......@@ -124,6 +124,7 @@ class YHCertificateInfoCell: UITableViewCell {
templateButton.clipsToBounds = true
templateButton.backgroundColor = .brandMainColor8
templateButton.addTarget(self, action: #selector(didTemplateBtnClicked), for: .touchUpInside)
templateButton.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
nameTextView.attributed.text = """
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateButton, .original(.center))))
......
......@@ -37,7 +37,7 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.text = model.name
timeLabel.text = "上传于\(model.updatedAt)"
var suffix = model.getFileSuffixName()
let suffix = model.getFileSuffixName()
var iconImgName = ""
if suffix == "jpeg" {
......@@ -77,7 +77,7 @@ class YHCertificateNameCell: UITableViewCell {
whiteView = UIView()
contentView.addSubview(whiteView)
iconImgV = UIImageView(image:UIImage(named:"my_cer_type_pdf"))
iconImgV = UIImageView(image:UIImage(named:"my_cer_type_jpg"))
whiteView.addSubview(iconImgV)
nameLabel = UILabel()
......@@ -85,14 +85,12 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.textAlignment = .left
nameLabel.numberOfLines = 0
nameLabel.font = UIFont.PFSC_M(ofSize:14)
nameLabel.text = "文档名称.doc"
whiteView.addSubview(nameLabel)
timeLabel = UILabel()
timeLabel.textColor = UIColor.labelTextColor2
timeLabel.textAlignment = .left
timeLabel.font = UIFont.PFSC_R(ofSize:11)
timeLabel.text = "上传于2024.01.01"
whiteView.addSubview(timeLabel)
editBtn = UIButton()
......@@ -100,10 +98,10 @@ class YHCertificateNameCell: UITableViewCell {
editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30)
editBtn.addTarget(self, action: #selector(didEditBtnClicked), for: .touchUpInside)
whiteView.addSubview(editBtn)
whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.right.equalToSuperview()
make.top.equalToSuperview().offset(15)
make.bottom.equalToSuperview()
}
......@@ -130,7 +128,7 @@ class YHCertificateNameCell: UITableViewCell {
editBtn.snp.makeConstraints { make in
make.width.height.equalTo(16)
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-6)
make.right.equalToSuperview().offset(-20-6)
}
}
}
......@@ -12,6 +12,7 @@ class YHCertificateSearchBar: UIView {
static let height = 40.0
static let cancelBtnHeight = height-8.0
static let maxWordsCount = 50
var textChange:((String?)->Void)?
var searchBlock:((String?)->Void)?
......@@ -33,12 +34,13 @@ class YHCertificateSearchBar: UIView {
lazy var textField:UITextField = {
let textField = UITextField()
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.tintColor = UIColor(hexString: "#3D88F8")
textField.textColor = UIColor.mainTextColor
textField.clearButtonMode = .whileEditing
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.delegate = self
return textField
}()
......@@ -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 {
class YHCertificateTemplateCell: UITableViewCell {
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 = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero)
......
......@@ -140,12 +140,16 @@ class YHCertificateTemplateSheetView: UIView {
}
templateArr.removeAll()
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 {
templateArr.append(model.guideFilePath[0])
let guide = model.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
}
self.tableView.reloadData()
......@@ -263,7 +267,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = desc
label.text = "注意事项:\n\(desc)"
view.addSubview(label)
label.snp.makeConstraints { make in
......
......@@ -18,6 +18,7 @@ import UIKit
class YHFileRenameInputView: UIView {
static let height = 217.0
static let maxWordsCount = 30
var editBlock:((String?)->Void)?
lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds)
......@@ -72,6 +73,8 @@ class YHFileRenameInputView: UIView {
textField.font = UIFont.PFSC_M(ofSize: 16)
textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor
textField.delegate = self
textField.clearButtonMode = .whileEditing
return textField
}()
......@@ -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 {
printLog("model 是 ==> \(json)")
let dic = json.data
if code == NetWorkCode.success.rawValue {
if json.code == 200 {
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
}
callBack(result, nil)
......@@ -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
if !isSilient {
YHHUD.show(.progress(message: "数据加载中..."))
}
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
if !isSilient {
YHHUD.hide()
}
if code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
......@@ -208,23 +204,20 @@ class YHCertificateViewModel: YHBaseViewModel {
}
} failBlock: { err in
if !isSilient {
YHHUD.hide()
}
callBack(false, err)
}
}
// 更改证件
// 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
if operation == "rename" {
name = rename
}
let dic:[String : Any] = [
"id" : supplementId,
"id" : supplementsId,
"content_url": [
"name": name,
"url": urlModel.url,
......@@ -234,57 +227,10 @@ class YHCertificateViewModel: YHBaseViewModel {
"operation" : operation,
]
YHHUD.show(.progress(message: "数据加载中..."))
self.updateCertificates(params: params) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
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
}
callBack?(success, error)
}
}
}
......@@ -16,7 +16,7 @@ class YHFilePreviewTool: NSObject {
self.targetVC = targetVC
}
func openXLSXRemoteFile(urlString: String) {
func openXLSXRemoteFile(urlString: String, fileName: String?) {
guard let url = URL(string: urlString) else { return }
let configuration = URLSessionConfiguration.default
......@@ -36,7 +36,7 @@ class YHFilePreviewTool: NSObject {
try? fileManager.moveItem(at: tempLocalUrl, to: destination)
// 打开文件
self.openXLSXFile(at: destination)
self.openXLSXFile(at: destination, fileName: fileName)
} else {
print("Error downloading the file: \(error?.localizedDescription ?? "Unknown error")")
......@@ -49,8 +49,13 @@ class YHFilePreviewTool: NSObject {
task.resume()
}
func openXLSXFile(at fileURL: URL) {
func openXLSXFile(at fileURL: URL, fileName: String?) {
let controller = UIDocumentInteractionController(url: fileURL)
// 设置标题显示
if let fileName = fileName, !fileName.isEmpty {
controller.name = fileName
}
controller.delegate = self
DispatchQueue.main.async {
controller.presentPreview(animated: true)
......
......@@ -57,7 +57,7 @@ class YHSchemeHeadTotalScoreView: UIView {
label.font = UIFont(name: "AlibabaPuHuiTi-Bold", size: 24)
label.textColor = UIColor(hex: 0xd48638)
label.textAlignment = .right
label.text = "140"
label.text = "-"
return label
}()
addSubview(scoreLabel)
......
......@@ -92,14 +92,15 @@ class YHSchemeTableHeadView: UIView {
label.font = UIFont.PFSC_B(ofSize: 24)
label.textColor = UIColor(hex: 0xffffff)
label.textAlignment = .center
label.text = "尊敬的侯林先生"
label.lineBreakMode = .byTruncatingMiddle
label.text = "尊敬的--"
return label
}()
addSubview(nameLabel)
nameLabel.snp.makeConstraints { make in
make.right.equalTo(-35)
make.right.equalTo(-75)
make.height.equalTo(33.5)
make.left.equalTo(35)
make.left.equalTo(75)
make.top.equalTo(26)
}
......
......@@ -29,13 +29,13 @@ class YHSchemeTableViewCell: UITableViewCell {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
......@@ -166,12 +166,17 @@ class YHSchemeTableViewCell: UITableViewCell {
subMessageLabel.text = model.subMessage
}
@objc func goNext() {
if let title = titleButton.titleLabel?.text {
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("文书写作") {
UIViewController.current?.navigationController?.pushViewController(YHMyDocumentsListViewController())
}
......
......@@ -30,14 +30,20 @@ class YHEducationRequestViewModel {
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHEducationListInfo.deserialize(dict: dic) else {
callBackBlock(false,nil)
return
if json.code == 200 {
let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHEducationListInfo.deserialize(dict: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
listInfo = resultModel
callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
listInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
......@@ -56,14 +62,22 @@ class YHEducationRequestViewModel {
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHEducationDetailInfo.deserialize(dict: dic) else {
if json.code == 200 {
let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHEducationDetailInfo.deserialize(dict: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
educationDetailInfo = resultModel
callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false,nil)
return
}
educationDetailInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
......@@ -86,10 +100,12 @@ class YHEducationRequestViewModel {
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
}
} failBlock: { err in
......@@ -109,10 +125,12 @@ class YHEducationRequestViewModel {
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
}
} failBlock: { err in
......@@ -132,10 +150,12 @@ class YHEducationRequestViewModel {
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
}
} failBlock: { err in
......@@ -155,10 +175,12 @@ class YHEducationRequestViewModel {
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false, error)
}
} failBlock: { err in
......@@ -178,19 +200,28 @@ class YHEducationRequestViewModel {
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
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 {
if json.code == 200 {
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 {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
qualificationDetailInfo = resultModel
callBackBlock(true,nil)
return
} else {
callBackBlock(false,nil)
return
}
qualificationDetailInfo = resultModel
callBackBlock(true,nil)
return
} else {
callBackBlock(false,nil)
return
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in
......@@ -214,10 +245,12 @@ class YHEducationRequestViewModel {
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in
......@@ -239,14 +272,21 @@ class YHEducationRequestViewModel {
printLog("model 是 ==> \(json)")
let dic = json.data as? [AnyHashable : Any]
guard let dic = dic, let list = dic["list"] as? [[String:Any]], let results = [YHCollegeInfo].deserialize(array: list) as? [YHCollegeInfo] else {
if json.code == 200 {
guard let dic = dic, let list = dic["list"] as? [[String:Any]], let results = [YHCollegeInfo].deserialize(array: list) as? [YHCollegeInfo] else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
collegeList = results
callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
callBackBlock(false,nil)
return
}
collegeList = results
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
......
......@@ -22,9 +22,10 @@ class YHFamilyRequestViewModel {
printLog("model 是 ==> \(json)")
let dic = json.data
if code == NetWorkCode.success.rawValue {
if json.code == 200 {
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
}
_ = resultModel.checkDefaultValue()
......@@ -55,7 +56,7 @@ class YHFamilyRequestViewModel {
YHHUD.hide()
}
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg))
......@@ -75,7 +76,7 @@ class YHFamilyRequestViewModel {
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
YHHUD.hide()
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg))
......@@ -95,7 +96,7 @@ class YHFamilyRequestViewModel {
let _ = YHNetRequest.postRequest(url: strUrl, params:["order_id":orderId]) { json, code in
YHHUD.hide()
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBackBlock(true,nil)
} else {
callBackBlock(false, YHErrorModel(errorCode:json.code, errorMsg:json.msg))
......@@ -119,9 +120,10 @@ class YHFamilyRequestViewModel {
YHHUD.hide()
let dic = json.data
if code == NetWorkCode.success.rawValue {
if json.code == 200 {
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
}
_ = resultModel.checkDefaultValue()
......
......@@ -103,6 +103,7 @@ extension YHHUD{
extension YHHUD{
static let flashMessageTag = 61535
static func flash(message: String,
textAligment:NSTextAlignment = .center,
dismissAfter: TimeInterval = 1.5,
duration:TimeInterval = 0.5,
isRemoveBefore: Bool = true,
......@@ -123,6 +124,7 @@ extension YHHUD{
containerView.tag = flashMessageTag
let label = UILabel()
label.text = message
label.textAlignment = textAligment
label.numberOfLines = 5
label.textColor = UIColor.white
label.font = UIFont.systemFont(ofSize: 14)
......
......@@ -28,18 +28,20 @@ class YHBaseUrlManager {
// MARK: - 当前使用的url
func curURL() -> String {
return YHBaseUrlManager.baseUrlTest //for test hjl
#if DEBUG
return YHBaseUrlManager.baseUrlTest
#elseif TESTENV
return YHBaseUrlManager.baseUrlTest
#else
return YHBaseUrlManager.baseUrlRelease
#endif
}
func curOssURL() -> String {
return YHBaseUrlManager.baseOSSUrlTest //for test hjl
#if DEBUG
return YHBaseUrlManager.baseOSSUrlTest
#elseif TESTENV
return YHBaseUrlManager.baseOSSUrlTest
#else
return YHBaseUrlManager.baseOSSUrlRelease
#endif
......@@ -49,6 +51,8 @@ class YHBaseUrlManager {
func h5URL() -> String {
#if DEBUG
return YHBaseUrlManager.h5UrlDev
#elseif TESTENV
return YHBaseUrlManager.h5UrlDev
#else
return YHBaseUrlManager.h5UrlRelease
#endif
......
......@@ -172,7 +172,7 @@ class YHNetRequest: NSObject {
}
// 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
#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