Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
colorfulSchoolReconsitution
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
刘卓鑫
colorfulSchoolReconsitution
Commits
ffbd672e
Commit
ffbd672e
authored
Jan 09, 2020
by
刘卓鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
长按识别二维码 跳转逻辑敲定。
parent
b1790d27
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
172 additions
and
35 deletions
+172
-35
UserInterfaceState.xcuserstate
...ata/liuzhuoxin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Breakpoints_v2.xcbkptlist
...uzhuoxin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+18
-0
AppDelegate.m
ColorfulSchool/ColorfulSchool/AppDelegate.m
+1
-1
ZXAdTool.m
ColorfulSchool/ColorfulSchool/Classes/AD(广告)/ZXAdTool.m
+1
-2
ZXLongPressWebView.m
...orfulSchool/Classes/CustomViews(自定义)/ZXLongPressWebView.m
+12
-15
ZXHomePageWebViewController.m
...首页)/0801HomePage/Controller/ZXHomePageWebViewController.m
+5
-2
ZXLongPressTableViewCell.m
...ge(首页)/0801HomePage/View/Cells/ZXLongPressTableViewCell.m
+2
-12
ZXHomePageAnnounceView.m
...页)/0801HomePage/View/customViews/ZXHomePageAnnounceView.m
+2
-1
ZXTool.h
ColorfulSchool/ColorfulSchool/Classes/Tool(工具)/ZXTool.h
+4
-1
ZXTool.m
ColorfulSchool/ColorfulSchool/Classes/Tool(工具)/ZXTool.m
+127
-1
No files found.
ColorfulSchool/ColorfulSchool.xcworkspace/xcuserdata/liuzhuoxin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
ffbd672e
No preview for this file type
ColorfulSchool/ColorfulSchool.xcworkspace/xcuserdata/liuzhuoxin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
ffbd672e
...
...
@@ -3,4 +3,22 @@
uuid =
"0B73904D-2C2A-44A2-88D3-64B4C86B59B2"
type =
"0"
version =
"2.0"
>
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"CC8FF129-01A5-452D-A8CD-2E8213FEB701"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"ColorfulSchool/Classes/CustomViews(自定义)/ZXLongPressWebView.m"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"65"
endingLineNumber =
"65"
landmarkName =
"-handleLongPress:"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
ColorfulSchool/ColorfulSchool/AppDelegate.m
View file @
ffbd672e
...
...
@@ -73,7 +73,7 @@
_isPlaying
=
NO
;
//启动环境
[
APIManager
sharedAPIManager
].
lauchEnvironment
=
ZXColorfulSchoolEnvironment
Produc
t
;
[
APIManager
sharedAPIManager
].
lauchEnvironment
=
ZXColorfulSchoolEnvironment
Tes
t
;
//极光推送
[
self
initPushWithOptions
:
launchOptions
isProduct
:
YES
];
...
...
ColorfulSchool/ColorfulSchool/Classes/AD(广告)/ZXAdTool.m
View file @
ffbd672e
//
//
...
...
@@ -68,7 +68,6 @@
// if (lauch.whether == NO) {
// return ;
// }
dispatch_async
(
dispatch_get_main_queue
(),
^
{
if
(
lauch
.
isButt
)
{
...
...
ColorfulSchool/ColorfulSchool/Classes/CustomViews(自定义)/ZXLongPressWebView.m
View file @
ffbd672e
//
//
...
...
@@ -10,7 +10,6 @@
#import "UIImage+InsetEdge.h"
#import "FSActionSheet.h"
@interface
ZXLongPressWebView
()
<
FSActionSheetDelegate
,
UIGestureRecognizerDelegate
>
/** */
@property
(
nonatomic
,
copy
)
NSString
*
qrCodeString
;
...
...
@@ -22,6 +21,9 @@
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
self
.
autoresizingMask
=
UIViewAutoresizingFlexibleHeight
|
UIViewAutoresizingFlexibleWidth
;
self
.
contentMode
=
UIViewContentModeRedraw
;
self
.
opaque
=
YES
;
UILongPressGestureRecognizer
*
longPress
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
handleLongPress
:
)];
longPress
.
minimumPressDuration
=
1
;
longPress
.
delegate
=
self
;
...
...
@@ -30,6 +32,12 @@
}
return
self
;
}
-
(
BOOL
)
gestureRecognizer
:
(
UIGestureRecognizer
*
)
gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer
:
(
UIGestureRecognizer
*
)
otherGestureRecognizer
{
return
YES
;
}
#pragma mark - 长按相关============
-
(
BOOL
)
isAvailableQRcodeIn
:
(
UIImage
*
)
img
{
UIImage
*
image
=
[
img
imageByInsetEdge
:
UIEdgeInsetsMake
(
-
20
,
-
20
,
-
20
,
-
20
)
withColor
:[
UIColor
lightGrayColor
]];
...
...
@@ -61,7 +69,7 @@
NSLog
(
@"读取图片失败"
);
return
;
}
FSActionSheet
*
actionSheet
=
nil
;
if
([
self
isAvailableQRcodeIn
:
image
])
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
nil
message
:
nil
preferredStyle
:
UIAlertControllerStyleActionSheet
];
UIAlertAction
*
ac1
=
[
UIAlertAction
actionWithTitle
:
@"取消"
style
:
UIAlertActionStyleCancel
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
...
...
@@ -74,17 +82,7 @@
}];
UIAlertAction
*
ac3
=
[
UIAlertAction
actionWithTitle
:
@"打开二维码"
style
:
UIAlertActionStyleDestructive
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
@strongify
(
self
);
NSArray
*
arr
=
[
self
.
qrCodeString
componentsSeparatedByString
:
@";"
];
if
(
arr
&&
arr
.
count
==
2
)
{
NSString
*
appid
=
arr
.
firstObject
;
NSString
*
path
=
arr
.
lastObject
;
[
WXApi
registerApp
:
appid
];
WXLaunchMiniProgramReq
*
req
=
[[
WXLaunchMiniProgramReq
alloc
]
init
];
req
.
userName
=
@"gh_c6510fd44b5f"
;
req
.
path
=
path
;
req
.
miniProgramType
=
WXMiniProgramTypePreview
;
[
WXApi
sendReq
:
req
];
}
[
ZXTool
longPresessQrcode
:
self
.
qrCodeString
];
}];
[
alertController
addAction
:
ac2
];
...
...
@@ -95,7 +93,6 @@
}];
}
}
}];
}
...
...
ColorfulSchool/ColorfulSchool/Classes/HomePage(首页)/0801HomePage/Controller/ZXHomePageWebViewController.m
View file @
ffbd672e
//
//
...
...
@@ -61,7 +61,10 @@
}
[
ZXTool
hideLoadingAnimation
];
// 不执行前段界面弹出列表的JS代码
[
self
.
webView
evaluateJavaScript
:
@"document.documentElement.style.webkitTouchCallout='none';"
completionHandler
:
nil
];
[
self
.
webView
evaluateJavaScript
:
@"document.documentElement.style.webkitTouchCallout='none';"
completionHandler
:
^
(
id
_Nullable
res
,
NSError
*
_Nullable
error
)
{
}];
[
self
.
webView
evaluateJavaScript
:
@"document.documentElement.style.webkitUserSelect='none';"
completionHandler
:
nil
];
}
#pragma mark - ========== 加载失败 ==========
-
(
void
)
webView
:
(
WKWebView
*
)
webView
didFailProvisionalNavigation
:
(
WKNavigation
*
)
navigation
withError
:
(
NSError
*
)
error
{
...
...
ColorfulSchool/ColorfulSchool/Classes/HomePage(首页)/0801HomePage/View/Cells/ZXLongPressTableViewCell.m
View file @
ffbd672e
//
//
...
...
@@ -74,17 +74,7 @@
}];
UIAlertAction
*
ac3
=
[
UIAlertAction
actionWithTitle
:
@"打开二维码"
style
:
UIAlertActionStyleDestructive
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
@strongify
(
self
);
NSArray
*
arr
=
[
self
.
qrCodeString
componentsSeparatedByString
:
@";"
];
if
(
arr
&&
arr
.
count
==
2
)
{
NSString
*
appid
=
arr
.
firstObject
;
NSString
*
path
=
arr
.
lastObject
;
[
WXApi
registerApp
:
appid
];
WXLaunchMiniProgramReq
*
req
=
[[
WXLaunchMiniProgramReq
alloc
]
init
];
req
.
userName
=
@"gh_c6510fd44b5f"
;
req
.
path
=
path
;
req
.
miniProgramType
=
WXMiniProgramTypePreview
;
[
WXApi
sendReq
:
req
];
}
[
ZXTool
longPresessQrcode
:
self
.
qrCodeString
];
}];
[
alertController
addAction
:
ac2
];
...
...
ColorfulSchool/ColorfulSchool/Classes/HomePage(首页)/0801HomePage/View/customViews/ZXHomePageAnnounceView.m
View file @
ffbd672e
...
...
@@ -113,6 +113,7 @@
[
ZXTool
hideLoadingAnimation
];
// 不执行前段界面弹出列表的JS代码
[
self
.
webView
evaluateJavaScript
:
@"document.documentElement.style.webkitTouchCallout='none';"
completionHandler
:
nil
];
[
self
.
webView
evaluateJavaScript
:
@"document.documentElement.style.webkitUserSelect='none';"
completionHandler
:
nil
];
}
#pragma mark - ==========确定事件==========
-
(
void
)
okAction
:
(
UIButton
*
)
sender
{
...
...
ColorfulSchool/ColorfulSchool/Classes/Tool(工具)/ZXTool.h
View file @
ffbd672e
//
//
...
...
@@ -175,4 +175,7 @@ typedef void(^checkIsOldCustomer)(BOOL isOld);
//ip
+
(
NSString
*
)
getCurentLocalIP
;
+
(
void
)
longPresessQrcode
:(
NSString
*
)
qrCodeStr
;
@end
ColorfulSchool/ColorfulSchool/Classes/Tool(工具)/ZXTool.m
View file @
ffbd672e
//
//
...
...
@@ -43,6 +43,10 @@
#import "enlargeClickRegionBtn.h"
#import "oneWangTong.h"
#import "ZXNotPay.h"
#import "ZXHomePageWebViewController.h"
#import "ZXBannerJumpViewController.h"
#import <JDSDK/KeplerApiManager.h>
#import "ZXAdViewService.h"
#define kUserDefaults [NSUserDefaults standardUserDefaults]
...
...
@@ -1784,4 +1788,126 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
}
#pragma mark - 长按二维码事件
+
(
void
)
longPresessQrcode
:
(
NSString
*
)
qrCodeStr
{
NSDictionary
*
dic
=
[
ZXTool
dictionaryWithJsonString
:
qrCodeStr
];
if
(
dic
&&
dic
[
@"jType"
])
{
NSString
*
type
=
dic
[
@"jType"
];
NSString
*
url
=
dic
[
@"url"
];
if
([
type
isEqualToString
:
@"3"
]
&&
url
&&
!
[
url
isEqualToString
:
@""
])
{
//内部跳转
ZXHomePageWebViewController
*
bannerVc
=
[[
ZXHomePageWebViewController
alloc
]
init
];
bannerVc
.
jumpUrl
=
url
;
bannerVc
.
hidesBottomBarWhenPushed
=
YES
;
[[
ZXTool
getCurrentVC
].
navigationController
pushViewController
:
bannerVc
animated
:
YES
];
}
else
if
([
type
isEqualToString
:
@"4"
]
&&
url
&&
!
[
url
isEqualToString
:
@""
])
{
//外部部跳转
if
([[
UIApplication
sharedApplication
]
canOpenURL
:[
NSURL
URLWithString
:
url
]])
{
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
url
]];
}
}
else
if
([
type
isEqualToString
:
@"5"
])
{
//呼第三方
NSString
*
sType
=
dic
[
@"sType"
];
if
([
sType
isEqualToString
:
@"jd"
])
{
if
([
url
containsString
:
@"?"
])
{
url
=
[
url
stringByAppendingString
:
@"isopen=1&ad_od=1&allowJDApp=1"
];
}
else
{
url
=
[
url
stringByAppendingString
:
@"?isopen=1&ad_od=1&allowJDApp=1"
];
}
[[
KeplerApiManager
sharedKPService
]
openKeplerPageWithURL
:
url
userInfo
:
nil
failedCallback
:^
(
NSInteger
code
,
NSString
*
url
)
{
if
(
code
==
422
)
{
//跳转webview打开
ZXHomePageWebViewController
*
bannerVc
=
[[
ZXHomePageWebViewController
alloc
]
init
];
bannerVc
.
jumpUrl
=
url
;
bannerVc
.
hidesBottomBarWhenPushed
=
YES
;
[[
ZXTool
getCurrentVC
].
navigationController
pushViewController
:
bannerVc
animated
:
YES
];
}
}];
}
else
if
([
sType
isEqualToString
:
@"taobaoke"
])
{
[
self
taobaoWxMiniJumpWithDic
:
dic
];
}
else
if
([
sType
isEqualToString
:
@"wxmini"
])
{
[
self
taobaoWxMiniJumpWithDic
:
dic
];
}
else
{
[
ZXTool
showText
:[
NSString
stringWithFormat
:
@"二维码内容:%@"
,
dic
]];
}
}
}
}
#pragma mark - 淘宝/小程序等跳转 - - - - -
+
(
void
)
taobaoWxMiniJumpWithDic
:
(
NSDictionary
*
)
dic
{
if
([
dic
[
@"sType"
]
isEqualToString
:
@"taobaoke"
])
{
NSString
*
item_id
=
dic
[
@"item_id"
];
NSInteger
hasCoupon
=
0
;
if
(
dic
[
@"hasCoupon"
]
&&
([
dic
[
@"hasCoupon"
]
integerValue
]
==
1
))
{
hasCoupon
=
1
;
}
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@/alimama/tbk/dg/material/optional/forItemId?pageNo=1&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot&itemId=%@&hasCoupon=%ld"
,
[
kUserDefaults
objectForKey
:
@"HomePage"
],
dic
[
@"title"
],
item_id
,
(
long
)
hasCoupon
];
[[
ZXAdViewService
sharedManager
]
GET
:[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
]
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{
id
res
=
responseObject
[
@"data"
];
if
(
res
)
{
if
(
res
[
@"couponShareUrl"
]
&&
!
[
res
[
@"couponShareUrl"
]
isKindOfClass
:[
NSNull
class
]]
&&
!
[
res
[
@"couponShareUrl"
]
isEqualToString
:
@""
])
{
[
self
jumpTaobaoWithItem
:
res
[
@"couponShareUrl"
]];
}
else
{
if
(
res
[
@"url"
]
&&
!
[
res
[
@"url"
]
isKindOfClass
:[
NSNull
class
]]
&&
!
[
res
[
@"url"
]
isEqualToString
:
@""
])
{
[
self
jumpTaobaoWithItem
:
res
[
@"url"
]];
}
else
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
ZXTool
showText
:
@"活动已下架,请关注后续活动!"
];
});
}
}
}
else
{
if
([
responseObject
[
@"code"
]
integerValue
]
==
-
2
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
ZXTool
hideLoadingAnimation
];
[
ZXTool
showText
:
responseObject
[
@"msg"
]];
[
ZXTool
backToLogin
];
});
}
else
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
ZXTool
showText
:
@"活动已下架,请关注后续活动!"
];
});
}
}
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
ZXTool
showText
:
error
.
description
];
});
}];
}
else
if
([
dic
[
@"sType"
]
isEqualToString
:
@"wxmini"
])
{
//跳转微信小程序
NSString
*
appID
=
dic
[
@"appId"
];
[
WXApi
registerApp
:
appID
?
appID
:
@"wx41cd01f1eb664e21"
];
WXLaunchMiniProgramReq
*
req
=
[[
WXLaunchMiniProgramReq
alloc
]
init
];
req
.
userName
=
dic
[
@"orgId"
];
req
.
path
=
dic
[
@"url"
];
req
.
miniProgramType
=
WXMiniProgramTypePreview
;
[
WXApi
sendReq
:
req
];
}
}
+
(
void
)
jumpTaobaoWithItem
:
(
NSString
*
)
couponShareUrl
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
url
=
[
@"taobao:"
stringByAppendingString
:
couponShareUrl
];
NSURL
*
URL
=
[
NSURL
URLWithString
:
url
];
if
([[
UIApplication
sharedApplication
]
canOpenURL
:
URL
])
{
[[
UIApplication
sharedApplication
]
openURL
:
URL
];
}
else
{
ZXBannerJumpViewController
*
jumpVc
=
[[
ZXBannerJumpViewController
alloc
]
init
];
jumpVc
.
jumpUrl
=
[
@"https:"
stringByAppendingString
:
couponShareUrl
];
jumpVc
.
hidesBottomBarWhenPushed
=
YES
;
[
ZXTool
.
getCurrentVC
.
navigationController
pushViewController
:
jumpVc
animated
:
YES
];
}
});
}
@end
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