Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
358f08bd
Commit
358f08bd
authored
Oct 14, 2025
by
Alex朱枝文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扫码增加
parent
633eaf09
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
372 additions
and
51 deletions
+372
-51
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+39
-38
YHScanViewController.swift
...axy/Classes/Modules/Mine(我的)/C/YHScanViewController.swift
+230
-13
YHScanModel.swift
...y/galaxy/Classes/Modules/Mine(我的)/Model/YHScanModel.swift
+103
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
358f08bd
...
...
@@ -3,7 +3,7 @@
archiveVersion
=
1
;
classes
=
{
};
objectVersion
=
6
0
;
objectVersion
=
7
0
;
objects
=
{
/* Begin PBXBuildFile section */
...
...
@@ -1269,6 +1269,11 @@
04B00FC72D9A420F00F640C5
/* YHMakePlanPriceAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B00FB82D9A420F00F640C5
/* YHMakePlanPriceAlertView.swift */
;
};
04B00FC82D9A420F00F640C5
/* YHMakePlanCusttomHeadView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B00FB62D9A420F00F640C5
/* YHMakePlanCusttomHeadView.swift */
;
};
04B00FCA2D9AAD6100F640C5
/* YHMakePlanTopView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B00FC92D9AAD6100F640C5
/* YHMakePlanTopView.swift */
;
};
04B30B7B2E86307C004E4B12
/* YHNameCardHomePageViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B7A2E86307C004E4B12
/* YHNameCardHomePageViewController.swift */
;
};
04B30B8C2E869717004E4B12
/* YHGrayCommonAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B8B2E869717004E4B12
/* YHGrayCommonAlertView.swift */
;
};
04B30B8E2E88C837004E4B12
/* YHNameCardDynamicViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B8D2E88C837004E4B12
/* YHNameCardDynamicViewController.swift */
;
};
04B30B902E88CA0B004E4B12
/* YHNameCardDynamicCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B8F2E88CA0B004E4B12
/* YHNameCardDynamicCell.swift */
;
};
04B30B982E891CF3004E4B12
/* YHContactViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B972E891CF3004E4B12
/* YHContactViewModel.swift */
;
};
04C0ED6A2E7BAC2D00B0D182
/* LBXScanView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C0ED652E7BAC2D00B0D182
/* LBXScanView.swift */
;
};
04C0ED6B2E7BAC2D00B0D182
/* LBXScanViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C0ED662E7BAC2D00B0D182
/* LBXScanViewController.swift */
;
};
04C0ED6C2E7BAC2D00B0D182
/* LBXScanWrapper.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C0ED682E7BAC2D00B0D182
/* LBXScanWrapper.swift */
;
};
...
...
@@ -1277,11 +1282,6 @@
04C0ED6F2E7BAC2D00B0D182
/* LBXScanNetAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C0ED642E7BAC2D00B0D182
/* LBXScanNetAnimation.swift */
;
};
04C0ED702E7BAC2D00B0D182
/* LBXScanLineAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C0ED632E7BAC2D00B0D182
/* LBXScanLineAnimation.swift */
;
};
04C0ED7C2E7BEF7800B0D182
/* YHScanViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C0ED7B2E7BEF7800B0D182
/* YHScanViewController.swift */
;
};
04B30B7B2E86307C004E4B12
/* YHNameCardHomePageViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B7A2E86307C004E4B12
/* YHNameCardHomePageViewController.swift */
;
};
04B30B8C2E869717004E4B12
/* YHGrayCommonAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B8B2E869717004E4B12
/* YHGrayCommonAlertView.swift */
;
};
04B30B8E2E88C837004E4B12
/* YHNameCardDynamicViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B8D2E88C837004E4B12
/* YHNameCardDynamicViewController.swift */
;
};
04B30B902E88CA0B004E4B12
/* YHNameCardDynamicCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B8F2E88CA0B004E4B12
/* YHNameCardDynamicCell.swift */
;
};
04B30B982E891CF3004E4B12
/* YHContactViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04B30B972E891CF3004E4B12
/* YHContactViewModel.swift */
;
};
04D4EC312E839C1000B0329B
/* YHCircleViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D4EC302E839C1000B0329B
/* YHCircleViewController.swift */
;
};
04D4EC332E839C2B00B0329B
/* YHResourceViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D4EC322E839C2B00B0329B
/* YHResourceViewController.swift */
;
};
04D4EC462E83D11500B0329B
/* YHCircleCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D4EC452E83D11500B0329B
/* YHCircleCollectionViewCell.swift */
;
};
...
...
@@ -1289,6 +1289,7 @@
04D4EC4E2E84F22500B0329B
/* YHCircleHeaderReusableView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D4EC4D2E84F22500B0329B
/* YHCircleHeaderReusableView.swift */
;
};
04D6405A2E84DF07000162AF
/* YHConnectListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D640592E84DF07000162AF
/* YHConnectListViewController.swift */
;
};
04D6405E2E84E3B4000162AF
/* YHConnectListCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D6405D2E84E3B4000162AF
/* YHConnectListCell.swift */
;
};
04D7E0862E9E42B30019B641
/* YHScanModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D7E0852E9E42B30019B641
/* YHScanModel.swift */
;
};
04D8FF552D9258AA00703C75
/* YHPlanScoreView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF542D9258AA00703C75
/* YHPlanScoreView.swift */
;
};
04D8FF572D925A0800703C75
/* YHPlanScoreChart.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF562D925A0800703C75
/* YHPlanScoreChart.swift */
;
};
04D8FF592D925E6700703C75
/* YHPlanModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF582D925E6700703C75
/* YHPlanModel.swift */
;
};
...
...
@@ -2658,6 +2659,11 @@
04B00FBA2D9A420F00F640C5
/* YHMakePlanShareAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMakePlanShareAlertView.swift
;
sourceTree
=
"<group>"
;
};
04B00FBB2D9A420F00F640C5
/* YHMakePlanStateHeadView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMakePlanStateHeadView.swift
;
sourceTree
=
"<group>"
;
};
04B00FC92D9AAD6100F640C5
/* YHMakePlanTopView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMakePlanTopView.swift
;
sourceTree
=
"<group>"
;
};
04B30B7A2E86307C004E4B12
/* YHNameCardHomePageViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNameCardHomePageViewController.swift
;
sourceTree
=
"<group>"
;
};
04B30B8B2E869717004E4B12
/* YHGrayCommonAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGrayCommonAlertView.swift
;
sourceTree
=
"<group>"
;
};
04B30B8D2E88C837004E4B12
/* YHNameCardDynamicViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNameCardDynamicViewController.swift
;
sourceTree
=
"<group>"
;
};
04B30B8F2E88CA0B004E4B12
/* YHNameCardDynamicCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNameCardDynamicCell.swift
;
sourceTree
=
"<group>"
;
};
04B30B972E891CF3004E4B12
/* YHContactViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHContactViewModel.swift
;
sourceTree
=
"<group>"
;
};
04C0ED622E7BAC2D00B0D182
/* LBXPermissions.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LBXPermissions.swift
;
sourceTree
=
"<group>"
;
};
04C0ED632E7BAC2D00B0D182
/* LBXScanLineAnimation.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LBXScanLineAnimation.swift
;
sourceTree
=
"<group>"
;
};
04C0ED642E7BAC2D00B0D182
/* LBXScanNetAnimation.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LBXScanNetAnimation.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2666,11 +2672,6 @@
04C0ED672E7BAC2D00B0D182
/* LBXScanViewStyle.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LBXScanViewStyle.swift
;
sourceTree
=
"<group>"
;
};
04C0ED682E7BAC2D00B0D182
/* LBXScanWrapper.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LBXScanWrapper.swift
;
sourceTree
=
"<group>"
;
};
04C0ED7B2E7BEF7800B0D182
/* YHScanViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHScanViewController.swift
;
sourceTree
=
"<group>"
;
};
04B30B7A2E86307C004E4B12
/* YHNameCardHomePageViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNameCardHomePageViewController.swift
;
sourceTree
=
"<group>"
;
};
04B30B8B2E869717004E4B12
/* YHGrayCommonAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGrayCommonAlertView.swift
;
sourceTree
=
"<group>"
;
};
04B30B8D2E88C837004E4B12
/* YHNameCardDynamicViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNameCardDynamicViewController.swift
;
sourceTree
=
"<group>"
;
};
04B30B8F2E88CA0B004E4B12
/* YHNameCardDynamicCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNameCardDynamicCell.swift
;
sourceTree
=
"<group>"
;
};
04B30B972E891CF3004E4B12
/* YHContactViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHContactViewModel.swift
;
sourceTree
=
"<group>"
;
};
04D4EC302E839C1000B0329B
/* YHCircleViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCircleViewController.swift
;
sourceTree
=
"<group>"
;
};
04D4EC322E839C2B00B0329B
/* YHResourceViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHResourceViewController.swift
;
sourceTree
=
"<group>"
;
};
04D4EC452E83D11500B0329B
/* YHCircleCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCircleCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2678,6 +2679,7 @@
04D4EC4D2E84F22500B0329B
/* YHCircleHeaderReusableView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCircleHeaderReusableView.swift
;
sourceTree
=
"<group>"
;
};
04D640592E84DF07000162AF
/* YHConnectListViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHConnectListViewController.swift
;
sourceTree
=
"<group>"
;
};
04D6405D2E84E3B4000162AF
/* YHConnectListCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHConnectListCell.swift
;
sourceTree
=
"<group>"
;
};
04D7E0852E9E42B30019B641
/* YHScanModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHScanModel.swift
;
sourceTree
=
"<group>"
;
};
04D8FF542D9258AA00703C75
/* YHPlanScoreView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanScoreView.swift
;
sourceTree
=
"<group>"
;
};
04D8FF562D925A0800703C75
/* YHPlanScoreChart.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanScoreChart.swift
;
sourceTree
=
"<group>"
;
};
04D8FF582D925E6700703C75
/* YHPlanModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanModel.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2743,7 +2745,7 @@
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
043F0ED92E02A60C003354EB
/*
Exceptions for "yinheReplayExt" folder in "yinheReplayExt" targ
et */
=
{
043F0ED92E02A60C003354EB
/*
PBXFileSystemSynchronizedBuildFileExceptionS
et */
=
{
isa
=
PBXFileSystemSynchronizedBuildFileExceptionSet
;
membershipExceptions
=
(
Info.plist
,
...
...
@@ -2753,18 +2755,7 @@
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
043F0ECD2E02A60C003354EB
/* yinheReplayExt */
=
{
isa
=
PBXFileSystemSynchronizedRootGroup
;
exceptions
=
(
043F0ED92E02A60C003354EB
/* Exceptions for "yinheReplayExt" folder in "yinheReplayExt" target */
,
);
explicitFileTypes
=
{
};
explicitFolders
=
(
);
path
=
yinheReplayExt
;
sourceTree
=
"<group>"
;
};
043F0ECD2E02A60C003354EB
/* yinheReplayExt */
=
{
isa
=
PBXFileSystemSynchronizedRootGroup
;
exceptions
=
(
043F0ED92E02A60C003354EB
/* PBXFileSystemSynchronizedBuildFileExceptionSet */
,
);
explicitFileTypes
=
{};
explicitFolders
=
();
path
=
yinheReplayExt
;
sourceTree
=
"<group>"
;
};
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -6084,6 +6075,7 @@
043671402D64935200E8D9BA
/* YHMemberCenterCellContent.swift */
,
043671422D66DDB500E8D9BA
/* YHMemberCenterInfo.swift */
,
04AFEF522D6C62210007A011
/* YHVipLevelRightInfoModel.swift */
,
04D7E0852E9E42B30019B641
/* YHScanModel.swift */
,
);
path
=
Model
;
sourceTree
=
"<group>"
;
...
...
@@ -6985,20 +6977,6 @@
);
path
=
MakePlan
;
sourceTree
=
"<group>"
;
};
04C0ED692E7BAC2D00B0D182
/* SwiftScan */
=
{
isa
=
PBXGroup
;
children
=
(
04C0ED622E7BAC2D00B0D182
/* LBXPermissions.swift */
,
04C0ED632E7BAC2D00B0D182
/* LBXScanLineAnimation.swift */
,
04C0ED642E7BAC2D00B0D182
/* LBXScanNetAnimation.swift */
,
04C0ED652E7BAC2D00B0D182
/* LBXScanView.swift */
,
04C0ED662E7BAC2D00B0D182
/* LBXScanViewController.swift */
,
04C0ED672E7BAC2D00B0D182
/* LBXScanViewStyle.swift */
,
04C0ED682E7BAC2D00B0D182
/* LBXScanWrapper.swift */
,
);
path
=
SwiftScan
;
sourceTree
=
"<group>"
;
};
04B30B7C2E86371E004E4B12
/* NameCard(名片) */
=
{
isa
=
PBXGroup
;
...
...
@@ -7038,6 +7016,20 @@
path
=
VM
;
sourceTree
=
"<group>"
;
};
04C0ED692E7BAC2D00B0D182
/* SwiftScan */
=
{
isa
=
PBXGroup
;
children
=
(
04C0ED622E7BAC2D00B0D182
/* LBXPermissions.swift */
,
04C0ED632E7BAC2D00B0D182
/* LBXScanLineAnimation.swift */
,
04C0ED642E7BAC2D00B0D182
/* LBXScanNetAnimation.swift */
,
04C0ED652E7BAC2D00B0D182
/* LBXScanView.swift */
,
04C0ED662E7BAC2D00B0D182
/* LBXScanViewController.swift */
,
04C0ED672E7BAC2D00B0D182
/* LBXScanViewStyle.swift */
,
04C0ED682E7BAC2D00B0D182
/* LBXScanWrapper.swift */
,
);
path
=
SwiftScan
;
sourceTree
=
"<group>"
;
};
04D4EC262E839A0300B0329B
/* Circle(下属社区) */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -7563,10 +7555,14 @@
inputFileListPaths
=
(
"${PODS_ROOT}/Target Support Files/Pods-galaxy/Pods-galaxy-frameworks-${CONFIGURATION}-input-files.xcfilelist"
,
);
inputPaths
=
(
);
name
=
"[CP] Embed Pods Frameworks"
;
outputFileListPaths
=
(
"${PODS_ROOT}/Target Support Files/Pods-galaxy/Pods-galaxy-frameworks-${CONFIGURATION}-output-files.xcfilelist"
,
);
outputPaths
=
(
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
shellScript
=
"\"${PODS_ROOT}/Target Support Files/Pods-galaxy/Pods-galaxy-frameworks.sh\"\n"
;
...
...
@@ -7580,10 +7576,14 @@
inputFileListPaths
=
(
"${PODS_ROOT}/Target Support Files/Pods-galaxy/Pods-galaxy-resources-${CONFIGURATION}-input-files.xcfilelist"
,
);
inputPaths
=
(
);
name
=
"[CP] Copy Pods Resources"
;
outputFileListPaths
=
(
"${PODS_ROOT}/Target Support Files/Pods-galaxy/Pods-galaxy-resources-${CONFIGURATION}-output-files.xcfilelist"
,
);
outputPaths
=
(
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
shellScript
=
"\"${PODS_ROOT}/Target Support Files/Pods-galaxy/Pods-galaxy-resources.sh\"\n"
;
...
...
@@ -8326,6 +8326,7 @@
045C11D22D12CA5F00BD2DC0
/* YHPrincipleWaitResultViewController.swift in Sources */
,
045C11D32D12CA5F00BD2DC0
/* YHInvitationWithGiftsShareBottomView.swift in Sources */
,
045C11D42D12CA5F00BD2DC0
/* YHPreviewInfoSingleLineTitleView.swift in Sources */
,
04D7E0862E9E42B30019B641
/* YHScanModel.swift in Sources */
,
045C11D52D12CA5F00BD2DC0
/* YHOtherResidenceFillView.swift in Sources */
,
045C11D62D12CA5F00BD2DC0
/* YHPreviewForOtherInfoModel.swift in Sources */
,
045C11D72D12CA5F00BD2DC0
/* YHButlerServiceViewModel.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHScanViewController.swift
View file @
358f08bd
...
...
@@ -8,22 +8,44 @@
import
UIKit
// MARK: - 扫码控制器
class
YHScanViewController
:
LBXScanViewController
{
// MARK: - Properties
private
let
topOffset
=
44.0
private
let
leftOffset
=
48.0
/// 扫码支持的类型(可以是单个或多个类型的组合)
var
scanTypes
:
YHScanType
?
{
didSet
{
updateUIForScanType
()
}
}
/// 扫码成功回调
var
scanCompletion
:
YHScanCompletion
?
/// 提示文字标签
private
lazy
var
instructionLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
(
hexString
:
"#EBF0F9"
)
label
.
font
=
.
PFSC_M
(
ofSize
:
18
)
label
.
textAlignment
=
.
center
label
.
numberOfLines
=
0
return
label
}()
// MARK: - Lifecycle
override
var
preferredStatusBarStyle
:
UIStatusBarStyle
{
return
.
lightContent
}
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
gk_navTitleColor
=
.
white
gk_navTitle
=
"扫码"
gk_navBarAlpha
=
0.0
gk_navBackgroundColor
=
.
clear
gk_backImage
=
UIImage
(
named
:
"back_icon_white"
)
setupNavigationBar
()
setupScanStyle
()
setupInstructionLabel
()
updateUIForScanType
()
}
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
...
...
@@ -32,20 +54,73 @@ class YHScanViewController: LBXScanViewController {
if
view
.
subviews
.
contains
(
navBar
)
{
view
.
bringSubviewToFront
(
navBar
)
}
if
view
.
subviews
.
contains
(
instructionLabel
)
{
view
.
bringSubviewToFront
(
instructionLabel
)
}
}
// override func handleCodeResult(arrayResult: [LBXScanResult]) {
// //
// }
override
func
handleCodeResult
(
arrayResult
:
[
LBXScanResult
])
{
guard
let
firstResult
=
arrayResult
.
first
,
let
code
=
firstResult
.
strScanned
else
{
return
}
guard
let
scanTypes
=
scanTypes
else
{
super
.
handleCodeResult
(
arrayResult
:
arrayResult
)
return
}
// 停止扫描
stopScan
()
deinit
{
//
// 识别二维码类型
let
recognizedType
=
scanTypes
.
recognizeType
(
from
:
code
)
// 验证类型
if
recognizedType
==
nil
&&
scanTypes
!=
.
all
&&
scanTypes
.
rawValue
!=
0
{
// 类型不匹配,显示错误提示
showError
(
message
:
"二维码类型不匹配,请扫描正确的二维码"
)
// 延迟后重新开始扫描
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
1.5
)
{
[
weak
self
]
in
self
?
.
startScan
()
}
return
}
// 震动反馈
let
generator
=
UINotificationFeedbackGenerator
()
generator
.
notificationOccurred
(
.
success
)
// 创建结果
let
result
=
YHScanResult
(
code
:
code
,
recognizedType
:
recognizedType
,
supportedTypes
:
scanTypes
)
// 回调处理
if
let
completion
=
scanCompletion
{
completion
(
result
)
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
// 如果没有设置回调,使用默认处理
handleDefaultResult
(
result
)
}
}
deinit
{
print
(
"YHScanViewController deinit"
)
}
}
// MARK: - Setup
extension
YHScanViewController
{
private
func
setupNavigationBar
()
{
gk_navTitleColor
=
.
white
gk_navBarAlpha
=
0.0
gk_navBackgroundColor
=
.
clear
gk_backImage
=
UIImage
(
named
:
"back_icon_white"
)
}
private
func
setupScanStyle
()
{
var
style
=
LBXScanViewStyle
()
style
.
centerUpOffset
=
topOffset
...
...
@@ -56,13 +131,155 @@ extension YHScanViewController {
style
.
photoframeAngleH
=
18
style
.
isNeedShowRetangle
=
false
style
.
anmiationStyle
=
LBXScanViewAnimationStyle
.
LineMove
// 扫描横线图片
style
.
animationImage
=
UIImage
(
named
:
"scan_move_line"
)
// 4个角的颜色
style
.
colorAngle
=
UIColor
.
white
// 非矩形框区域颜色
style
.
color_NotRecoginitonArea
=
UIColor
.
black
.
withAlphaComponent
(
0.3
)
scanStyle
=
style
}
private
func
setupInstructionLabel
()
{
view
.
addSubview
(
instructionLabel
)
instructionLabel
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
view
.
safeAreaLayoutGuide
.
snp
.
bottom
)
.
offset
(
-
45
)
make
.
left
.
equalToSuperview
()
.
offset
(
20
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
20
)
}
}
private
func
updateUIForScanType
()
{
guard
let
scanTypes
=
scanTypes
else
{
gk_navTitle
=
YHScanType
.
all
.
title
instructionLabel
.
text
=
YHScanType
.
all
.
instructionText
return
}
gk_navTitle
=
scanTypes
.
title
instructionLabel
.
text
=
scanTypes
.
instructionText
}
}
// MARK: - Result Handling
extension
YHScanViewController
{
/// 默认结果处理(当没有设置回调时)
private
func
handleDefaultResult
(
_
result
:
YHScanResult
)
{
guard
let
type
=
result
.
recognizedType
else
{
showSuccessAndPop
(
message
:
"扫码成功"
)
return
}
if
type
==
.
checkIn
{
handleCheckIn
(
code
:
result
.
code
)
}
else
if
type
==
.
smartCabinet
{
handleSmartCabinet
(
code
:
result
.
code
)
}
}
// MARK: - 业务处理方法
private
func
handleCheckIn
(
code
:
String
)
{
printLog
(
"签到扫码:
\(
code
)
"
)
// TODO: 调用签到 API
showSuccessAndPop
(
message
:
"签到成功"
)
}
private
func
handleSmartCabinet
(
code
:
String
)
{
printLog
(
"智能柜扫码:
\(
code
)
"
)
// TODO: 调用智能柜开柜 API
showSuccessAndPop
(
message
:
"开柜成功"
)
}
// MARK: - Helper
private
func
showError
(
message
:
String
)
{
YHCommonAlertView
.
show
(
"提示"
,
message
,
""
,
"确定"
,
fullGuestureEnable
:
false
)
{
}
callBack
:
{
}
}
private
func
showSuccessAndPop
(
message
:
String
)
{
YHCommonAlertView
.
show
(
"成功"
,
message
,
""
,
"确定"
,
fullGuestureEnable
:
false
)
{
}
callBack
:
{
[
weak
self
]
in
self
?
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
}
// MARK: - 便捷初始化
extension
YHScanViewController
{
/// 便捷初始化方法
/// - Parameters:
/// - types: 扫码支持的类型(可以是单个或多个的组合)
/// - completion: 扫码成功回调
/// - Returns: 扫码控制器实例
static
func
create
(
types
:
YHScanType
,
completion
:
YHScanCompletion
?
=
nil
)
->
YHScanViewController
{
let
vc
=
YHScanViewController
()
vc
.
scanTypes
=
types
vc
.
scanCompletion
=
completion
return
vc
}
}
// MARK: - 使用示例
/*
// 示例1: 单一类型 - 仅签到
let checkInVC = YHScanViewController.create(types: .checkIn) { result in
print("签到码: \(result.code)")
print("识别类型: \(result.recognizedType)")
}
navigationController?.pushViewController(checkInVC, animated: true)
// 示例2: 单一类型 - 仅智能柜
let cabinetVC = YHScanViewController.create(types: .smartCabinet) { result in
print("智能柜码: \(result.code)")
}
navigationController?.pushViewController(cabinetVC, animated: true)
// 示例3: 复合类型 - 同时支持签到和智能柜 ⭐
let multiVC = YHScanViewController.create(types: [.checkIn, .smartCabinet]) { result in
print("扫码内容: \(result.code)")
// 根据识别出的类型进行不同处理
if let type = result.recognizedType {
if type == .checkIn {
print("这是签到码")
APIManager.checkIn(code: result.code)
} else if type == .smartCabinet {
print("这是智能柜码")
APIManager.openCabinet(code: result.code)
}
}
}
navigationController?.pushViewController(multiVC, animated: true)
// 示例4: 所有类型
let allTypesVC = YHScanViewController.create(types: .all) { result in
// 自动识别并处理
}
navigationController?.pushViewController(allTypesVC, animated: true)
// 示例5: 二维码格式示例
// 签到码格式: "CHECKIN_xxxxx"
// 智能柜码格式: "CABINET_xxxxx"
// 或 JSON 格式: {"type": "checkin", "data": "xxxxx"}
// 示例6: 后续扩展新类型
/*
struct YHScanType: OptionSet {
let rawValue: Int
static let checkIn = YHScanType(rawValue: 1 << 0)
static let smartCabinet = YHScanType(rawValue: 1 << 1)
static let document = YHScanType(rawValue: 1 << 2) // ← 新增
static let payment = YHScanType(rawValue: 1 << 3) // ← 新增
}
// 使用组合
let vc = YHScanViewController.create(types: [.checkIn, .document]) { result in
// 同时支持签到和文档扫码
}
*/
*/
galaxy/galaxy/Classes/Modules/Mine(我的)/Model/YHScanModel.swift
0 → 100644
View file @
358f08bd
//
// YHScanModel.swift
// galaxy
//
// Created by alexzzw on 2025/10/14.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
// MARK: - 扫码场景类型(支持复合类型)
struct
YHScanType
:
OptionSet
{
let
rawValue
:
Int
static
let
checkIn
=
YHScanType
(
rawValue
:
1
<<
0
)
// 签到
static
let
smartCabinet
=
YHScanType
(
rawValue
:
1
<<
1
)
// 智能柜
// 预留扩展位
// static let document = YHScanType(rawValue: 1 << 2) // 文档
// static let payment = YHScanType(rawValue: 1 << 3) // 支付
/// 所有类型
static
let
all
:
YHScanType
=
[
.
checkIn
,
.
smartCabinet
]
var
title
:
String
{
if
self
==
.
checkIn
{
return
"扫码签到"
}
else
if
self
==
.
smartCabinet
{
return
"智能柜扫码"
}
else
if
self
==
.
all
{
return
"扫码"
}
else
{
return
"多功能扫码"
}
}
var
instructionText
:
String
?
{
if
self
==
.
checkIn
{
return
"将二维码放到框内"
}
else
if
self
==
.
smartCabinet
{
return
"将二维码放到框内"
}
else
if
contains
(
.
checkIn
)
&&
contains
(
.
smartCabinet
)
{
return
"将二维码放到框内"
}
else
{
return
"将二维码放到框内"
}
}
/// 从二维码内容识别类型
func
recognizeType
(
from
code
:
String
)
->
YHScanType
?
{
// 根据二维码内容规则识别类型
if
contains
(
.
checkIn
)
&&
code
.
hasPrefix
(
"CHECKIN_"
)
{
return
.
checkIn
}
if
contains
(
.
smartCabinet
)
&&
code
.
hasPrefix
(
"CABINET_"
)
{
return
.
smartCabinet
}
// 可以添加更多识别规则
// 示例: JSON 格式识别
if
let
data
=
code
.
data
(
using
:
.
utf8
),
let
json
=
try
?
JSONSerialization
.
jsonObject
(
with
:
data
)
as?
[
String
:
Any
],
let
type
=
json
[
"type"
]
as?
String
{
switch
type
{
case
"checkin"
:
return
contains
(
.
checkIn
)
?
.
checkIn
:
nil
case
"cabinet"
:
return
contains
(
.
smartCabinet
)
?
.
smartCabinet
:
nil
default
:
break
}
}
// 如果只有一个类型,直接返回
if
self
==
.
checkIn
{
return
.
checkIn
}
else
if
self
==
.
smartCabinet
{
return
.
smartCabinet
}
return
nil
}
}
// MARK: - 扫码结果回调
typealias
YHScanCompletion
=
(
YHScanResult
)
->
Void
struct
YHScanResult
{
let
code
:
String
let
recognizedType
:
YHScanType
?
// 识别出的具体类型
let
supportedTypes
:
YHScanType
// 支持的类型集合
let
timestamp
:
Date
init
(
code
:
String
,
recognizedType
:
YHScanType
?,
supportedTypes
:
YHScanType
)
{
self
.
code
=
code
self
.
recognizedType
=
recognizedType
self
.
supportedTypes
=
supportedTypes
timestamp
=
Date
()
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment