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
54875a1f
Commit
54875a1f
authored
Jul 08, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 二维码联调接口
parent
68f8f37f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
YHHomeWebViewController.swift
.../Classes/Modules/Home(首页)/C/YHHomeWebViewController.swift
+2
-1
YHWebModel.swift
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHWebModel.swift
+1
-0
YHConsultantQRCodeView.swift
...y/Classes/Modules/Home(首页)/V/YHConsultantQRCodeView.swift
+51
-3
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeWebViewController.swift
View file @
54875a1f
...
@@ -452,7 +452,8 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
...
@@ -452,7 +452,8 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
}
}
@objc
func
didConsultViewTapped
()
{
@objc
func
didConsultViewTapped
()
{
YHConsultantQRCodeView
.
codeView
()
.
show
()
let
codeUrl
=
self
.
viewModel
.
mainModel
?
.
clue_classify_img_url
??
""
YHConsultantQRCodeView
.
codeView
(
codeUrl
)
.
show
()
}
}
@objc
func
loginSuccess
()
{
@objc
func
loginSuccess
()
{
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHWebModel.swift
View file @
54875a1f
...
@@ -18,4 +18,5 @@ class YHWebModel: YHBaseModel {
...
@@ -18,4 +18,5 @@ class YHWebModel: YHBaseModel {
var
media_url
:
String
=
""
var
media_url
:
String
=
""
var
title
:
String
=
""
var
title
:
String
=
""
var
img_url
:
String
=
""
var
img_url
:
String
=
""
var
clue_classify_img_url
=
""
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHConsultantQRCodeView.swift
View file @
54875a1f
...
@@ -7,9 +7,30 @@
...
@@ -7,9 +7,30 @@
//
//
import
UIKit
import
UIKit
import
Photos
class
YHConsultantQRCodeView
:
UIView
{
class
YHConsultantQRCodeView
:
UIView
{
var
codeUrl
:
String
=
""
{
didSet
{
if
!
codeUrl
.
isEmpty
{
self
.
qrCodeImgView
.
kf
.
setImage
(
with
:
URL
(
string
:
codeUrl
),
placeholder
:
UIImage
(
named
:
"global_default_image"
))
{
result
in
switch
result
{
case
.
success
(
let
value
):
self
.
codeImage
=
value
.
image
self
.
saveBtn
.
alpha
=
1.0
self
.
saveBtn
.
isUserInteractionEnabled
=
true
case
.
failure
(
let
value
):
self
.
saveBtn
.
alpha
=
0.3
self
.
saveBtn
.
isUserInteractionEnabled
=
false
}
}
}
}
}
var
codeImage
:
UIImage
?
=
nil
// 底层蒙版
// 底层蒙版
lazy
var
blackMaskView
:
UIView
=
{
lazy
var
blackMaskView
:
UIView
=
{
let
view
=
UIView
()
let
view
=
UIView
()
...
@@ -42,7 +63,7 @@ class YHConsultantQRCodeView: UIView {
...
@@ -42,7 +63,7 @@ class YHConsultantQRCodeView: UIView {
}()
}()
lazy
var
qrCodeImgView
:
UIImageView
=
{
lazy
var
qrCodeImgView
:
UIImageView
=
{
let
view
=
UIImageView
(
image
:
UIImage
(
named
:
""
))
let
view
=
UIImageView
(
image
:
UIImage
(
named
:
"
global_default_image
"
))
view
.
backgroundColor
=
.
red
view
.
backgroundColor
=
.
red
return
view
return
view
}()
}()
...
@@ -55,6 +76,8 @@ class YHConsultantQRCodeView: UIView {
...
@@ -55,6 +76,8 @@ class YHConsultantQRCodeView: UIView {
button
.
backgroundColor
=
UIColor
.
brandMainColor
button
.
backgroundColor
=
UIColor
.
brandMainColor
button
.
addTarget
(
self
,
action
:
#selector(
didSaveQRCodeBtnClicked
)
,
for
:
.
touchUpInside
)
button
.
addTarget
(
self
,
action
:
#selector(
didSaveQRCodeBtnClicked
)
,
for
:
.
touchUpInside
)
button
.
layer
.
cornerRadius
=
3
button
.
layer
.
cornerRadius
=
3
button
.
alpha
=
0.3
button
.
isUserInteractionEnabled
=
false
return
button
return
button
}()
}()
...
@@ -74,8 +97,9 @@ class YHConsultantQRCodeView: UIView {
...
@@ -74,8 +97,9 @@ class YHConsultantQRCodeView: UIView {
createUI
()
createUI
()
}
}
static
func
codeView
()
->
YHConsultantQRCodeView
{
static
func
codeView
(
_
url
:
String
)
->
YHConsultantQRCodeView
{
let
alertView
=
YHConsultantQRCodeView
(
frame
:
UIScreen
.
main
.
bounds
)
let
alertView
=
YHConsultantQRCodeView
(
frame
:
UIScreen
.
main
.
bounds
)
alertView
.
codeUrl
=
url
return
alertView
return
alertView
}
}
...
@@ -140,10 +164,34 @@ class YHConsultantQRCodeView: UIView {
...
@@ -140,10 +164,34 @@ class YHConsultantQRCodeView: UIView {
}
}
@objc
func
didSaveQRCodeBtnClicked
()
{
@objc
func
didSaveQRCodeBtnClicked
()
{
if
let
img
=
self
.
codeImage
{
self
.
saveImage
(
img
)
}
}
}
@objc
func
didCloseBtnClicked
()
{
@objc
func
didCloseBtnClicked
()
{
self
.
dismiss
()
self
.
dismiss
()
}
}
func
saveImage
(
_
image
:
UIImage
)
{
// 确保应用有权访问相册
PHPhotoLibrary
.
requestAuthorization
{
status
in
if
status
==
.
authorized
{
// 保存图片到相册
DispatchQueue
.
main
.
sync
{
UIImageWriteToSavedPhotosAlbum
(
image
,
self
,
#selector(
self.image(image:didFinishSavingWithError:contextInfo:)
)
,
nil
)
}
}
else
{
YHHUD
.
flash
(
message
:
"没有访问图库权限"
)
}
}
}
@objc
func
image
(
image
:
UIImage
,
didFinishSavingWithError
:
NSError
?,
contextInfo
:
AnyObject
)
{
if
didFinishSavingWithError
!=
nil
{
YHHUD
.
flash
(
message
:
"保存失败"
)
return
}
YHHUD
.
flash
(
message
:
"保存成功"
)
}
}
}
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