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
4ffced05
Commit
4ffced05
authored
Dec 03, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
5772f8c9
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
519 additions
and
68 deletions
+519
-68
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+8
-0
YHAIChatConfiguration.swift
...odules/AI/AI-Dialogue(AI对话)/C/YHAIChatConfiguration.swift
+2
-46
YHAIMainChatViewController.swift
...s/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
+65
-8
YHAIRobotChatViewController.swift
.../AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
+64
-8
YHAIMessageModel.swift
...ses/Modules/AI/AI-Dialogue(AI对话)/M/YHAIMessageModel.swift
+44
-2
YHAIEvaluationAlertWebView.swift
...s/AI/AI-Dialogue(AI对话)/V/YHAIEvaluationAlertWebView.swift
+134
-0
YHAIPictureMessageCell.swift
...dules/AI/AI-Dialogue(AI对话)/V/YHAIPictureMessageCell.swift
+127
-0
YHAITextMessageCell.swift
.../Modules/AI/AI-Dialogue(AI对话)/V/YHAITextMessageCell.swift
+3
-1
YHCardMessageCell.swift
...es/Modules/AI/AI-Dialogue(AI对话)/V/YHCardMessageCell.swift
+14
-2
YHProductItemView.swift
...es/Modules/AI/AI-Dialogue(AI对话)/V/YHProductItemView.swift
+8
-1
YHH5WebViewVC.swift
.../Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
+22
-0
YHJsApi.swift
...galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
+28
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
4ffced05
...
@@ -689,6 +689,8 @@
...
@@ -689,6 +689,8 @@
04BE39522CFDA19000BD31DB
/* YHAIChatDataBaseModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39512CFDA19000BD31DB
/* YHAIChatDataBaseModel.swift */
;
};
04BE39522CFDA19000BD31DB
/* YHAIChatDataBaseModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39512CFDA19000BD31DB
/* YHAIChatDataBaseModel.swift */
;
};
04BE39542CFEA62000BD31DB
/* YHAICardItemView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39532CFEA62000BD31DB
/* YHAICardItemView.swift */
;
};
04BE39542CFEA62000BD31DB
/* YHAICardItemView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39532CFEA62000BD31DB
/* YHAICardItemView.swift */
;
};
04BE39582CFED3F700BD31DB
/* YHAIHistoryMessage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39572CFED3F700BD31DB
/* YHAIHistoryMessage.swift */
;
};
04BE39582CFED3F700BD31DB
/* YHAIHistoryMessage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39572CFED3F700BD31DB
/* YHAIHistoryMessage.swift */
;
};
04BE395A2CFEECFA00BD31DB
/* YHAIEvaluationAlertWebView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE39592CFEECFA00BD31DB
/* YHAIEvaluationAlertWebView.swift */
;
};
04BE395C2CFF058200BD31DB
/* YHAIPictureMessageCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BE395B2CFF058200BD31DB
/* YHAIPictureMessageCell.swift */
;
};
04C693622B723AB8004C1758
/* YHMySettingViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C693612B723AB8004C1758
/* YHMySettingViewController.swift */
;
};
04C693622B723AB8004C1758
/* YHMySettingViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C693612B723AB8004C1758
/* YHMySettingViewController.swift */
;
};
04C693642B723B56004C1758
/* YHMySettingCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C693632B723B56004C1758
/* YHMySettingCell.swift */
;
};
04C693642B723B56004C1758
/* YHMySettingCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C693632B723B56004C1758
/* YHMySettingCell.swift */
;
};
04C85DDF2C364FE9008B20D6
/* YHAboutUsCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C85DDE2C364FE9008B20D6
/* YHAboutUsCell.swift */
;
};
04C85DDF2C364FE9008B20D6
/* YHAboutUsCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04C85DDE2C364FE9008B20D6
/* YHAboutUsCell.swift */
;
};
...
@@ -1760,6 +1762,8 @@
...
@@ -1760,6 +1762,8 @@
04BE39512CFDA19000BD31DB
/* YHAIChatDataBaseModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAIChatDataBaseModel.swift
;
sourceTree
=
"<group>"
;
};
04BE39512CFDA19000BD31DB
/* YHAIChatDataBaseModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAIChatDataBaseModel.swift
;
sourceTree
=
"<group>"
;
};
04BE39532CFEA62000BD31DB
/* YHAICardItemView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAICardItemView.swift
;
sourceTree
=
"<group>"
;
};
04BE39532CFEA62000BD31DB
/* YHAICardItemView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAICardItemView.swift
;
sourceTree
=
"<group>"
;
};
04BE39572CFED3F700BD31DB
/* YHAIHistoryMessage.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAIHistoryMessage.swift
;
sourceTree
=
"<group>"
;
};
04BE39572CFED3F700BD31DB
/* YHAIHistoryMessage.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAIHistoryMessage.swift
;
sourceTree
=
"<group>"
;
};
04BE39592CFEECFA00BD31DB
/* YHAIEvaluationAlertWebView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAIEvaluationAlertWebView.swift
;
sourceTree
=
"<group>"
;
};
04BE395B2CFF058200BD31DB
/* YHAIPictureMessageCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAIPictureMessageCell.swift
;
sourceTree
=
"<group>"
;
};
04C693612B723AB8004C1758
/* YHMySettingViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMySettingViewController.swift
;
sourceTree
=
"<group>"
;
};
04C693612B723AB8004C1758
/* YHMySettingViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMySettingViewController.swift
;
sourceTree
=
"<group>"
;
};
04C693632B723B56004C1758
/* YHMySettingCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMySettingCell.swift
;
sourceTree
=
"<group>"
;
};
04C693632B723B56004C1758
/* YHMySettingCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMySettingCell.swift
;
sourceTree
=
"<group>"
;
};
04C85DDE2C364FE9008B20D6
/* YHAboutUsCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsCell.swift
;
sourceTree
=
"<group>"
;
};
04C85DDE2C364FE9008B20D6
/* YHAboutUsCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsCell.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -4011,6 +4015,7 @@
...
@@ -4011,6 +4015,7 @@
04943BF32CF4954800BF2255
/* YHAITextMessageCell.swift */
,
04943BF32CF4954800BF2255
/* YHAITextMessageCell.swift */
,
04BE392B2CF8917100BD31DB
/* YHAIThinkingMessageCell.swift */
,
04BE392B2CF8917100BD31DB
/* YHAIThinkingMessageCell.swift */
,
04BE392D2CF964A200BD31DB
/* YHProductListMessageCell.swift */
,
04BE392D2CF964A200BD31DB
/* YHProductListMessageCell.swift */
,
04BE395B2CFF058200BD31DB
/* YHAIPictureMessageCell.swift */
,
04BE39332CF9AFAE00BD31DB
/* YHFixProductMessageCell.swift */
,
04BE39332CF9AFAE00BD31DB
/* YHFixProductMessageCell.swift */
,
04BE39312CF9AB0900BD31DB
/* YHCardMessageCell.swift */
,
04BE39312CF9AB0900BD31DB
/* YHCardMessageCell.swift */
,
045F28452CF6C47800520F19
/* YHAIProductCell.swift */
,
045F28452CF6C47800520F19
/* YHAIProductCell.swift */
,
...
@@ -4026,6 +4031,7 @@
...
@@ -4026,6 +4031,7 @@
04BE39492CFABC5E00BD31DB
/* YHAIChatShadowView.swift */
,
04BE39492CFABC5E00BD31DB
/* YHAIChatShadowView.swift */
,
04BE394D2CFD92C100BD31DB
/* YHAIChatInputShadowView.swift */
,
04BE394D2CFD92C100BD31DB
/* YHAIChatInputShadowView.swift */
,
04BE394B2CFAC16600BD31DB
/* YHAIChatCustomFlowLayout.swift */
,
04BE394B2CFAC16600BD31DB
/* YHAIChatCustomFlowLayout.swift */
,
04BE39592CFEECFA00BD31DB
/* YHAIEvaluationAlertWebView.swift */
,
);
);
path
=
V
;
path
=
V
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -6020,6 +6026,7 @@
...
@@ -6020,6 +6026,7 @@
04943BEA2CF1B44100BF2255
/* YHAIMainChatViewController.swift in Sources */
,
04943BEA2CF1B44100BF2255
/* YHAIMainChatViewController.swift in Sources */
,
04C85DDF2C364FE9008B20D6
/* YHAboutUsCell.swift in Sources */
,
04C85DDF2C364FE9008B20D6
/* YHAboutUsCell.swift in Sources */
,
045EEEB02B9F171A0022A143
/* YHWorkItemView.swift in Sources */
,
045EEEB02B9F171A0022A143
/* YHWorkItemView.swift in Sources */
,
04BE395A2CFEECFA00BD31DB
/* YHAIEvaluationAlertWebView.swift in Sources */
,
0468D4222B493A5E00CFB916
/* YHPhoneMessageView.swift in Sources */
,
0468D4222B493A5E00CFB916
/* YHPhoneMessageView.swift in Sources */
,
049D62C72C6F2F4F00E811A1
/* YHApproverInfoVerifyCell.swift in Sources */
,
049D62C72C6F2F4F00E811A1
/* YHApproverInfoVerifyCell.swift in Sources */
,
048787D12BCE61B20036E221
/* YHServiceNoOrderView.swift in Sources */
,
048787D12BCE61B20036E221
/* YHServiceNoOrderView.swift in Sources */
,
...
@@ -6304,6 +6311,7 @@
...
@@ -6304,6 +6311,7 @@
0414708B2C88627B00B7B688
/* YHButlerServiceManager.swift in Sources */
,
0414708B2C88627B00B7B688
/* YHButlerServiceManager.swift in Sources */
,
0430E66A2C7493A5000511E2
/* YHAdopterExampleTableViewCell.swift in Sources */
,
0430E66A2C7493A5000511E2
/* YHAdopterExampleTableViewCell.swift in Sources */
,
04912F962CB924DA00CC3105
/* YHResignAppointTimeModifyViewController.swift in Sources */
,
04912F962CB924DA00CC3105
/* YHResignAppointTimeModifyViewController.swift in Sources */
,
04BE395C2CFF058200BD31DB
/* YHAIPictureMessageCell.swift in Sources */
,
045F28482CF6EF9800520F19
/* YHAIGreetCollectionReusableView.swift in Sources */
,
045F28482CF6EF9800520F19
/* YHAIGreetCollectionReusableView.swift in Sources */
,
045EEF102B9F171A0022A143
/* YHMainApplicantInformationViewModel.swift in Sources */
,
045EEF102B9F171A0022A143
/* YHMainApplicantInformationViewModel.swift in Sources */
,
0493B3DC2BA7EFE600AF9393
/* YHCertificateSearchViewController.swift in Sources */
,
0493B3DC2BA7EFE600AF9393
/* YHCertificateSearchViewController.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIChatConfiguration.swift
View file @
4ffced05
...
@@ -13,9 +13,6 @@ class YHAIChatConfiguration {
...
@@ -13,9 +13,6 @@ class YHAIChatConfiguration {
static
let
defaultConfig
=
YHAIChatConfiguration
()
static
let
defaultConfig
=
YHAIChatConfiguration
()
var
disableHandleMessage
:
Bool
=
false
var
disableHandleMessage
:
Bool
=
false
var
recommentMsgClick
:((
String
)
->
())?
func
registerMessageGroupCells
(
_
tableView
:
UITableView
)
{
func
registerMessageGroupCells
(
_
tableView
:
UITableView
)
{
tableView
.
register
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"UITableViewCell"
)
tableView
.
register
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"UITableViewCell"
)
...
@@ -24,52 +21,11 @@ class YHAIChatConfiguration {
...
@@ -24,52 +21,11 @@ class YHAIChatConfiguration {
tableView
.
register
(
YHProductListMessageCell
.
self
,
forCellReuseIdentifier
:
YHProductListMessageCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHProductListMessageCell
.
self
,
forCellReuseIdentifier
:
YHProductListMessageCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHFixProductListMessageCell
.
self
,
forCellReuseIdentifier
:
YHFixProductListMessageCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHFixProductListMessageCell
.
self
,
forCellReuseIdentifier
:
YHFixProductListMessageCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHCardMessageCell
.
self
,
forCellReuseIdentifier
:
YHCardMessageCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHCardMessageCell
.
self
,
forCellReuseIdentifier
:
YHCardMessageCell
.
cellReuseIdentifier
)
}
tableView
.
register
(
YHAIPictureMessageCell
.
self
,
forCellReuseIdentifier
:
YHAIPictureMessageCell
.
cellReuseIdentifier
)
func
getMessageCell
(
_
msg
:
YHAIChatMessage
,
_
tableView
:
UITableView
,
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
msgType
=
msg
.
getType
()
if
msg
.
isTextMessage
()
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAITextMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAITextMessageCell
cell
.
message
=
msg
cell
.
messageClick
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
self
.
recommentMsgClick
?(
text
)
}
return
cell
}
else
if
msgType
==
.
thinking
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAIThinkingMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAIThinkingMessageCell
return
cell
}
else
if
msgType
==
.
productList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHProductListMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHProductListMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
listModel
=
listModel
}
return
cell
}
else
if
msgType
==
.
fixProductList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHFixProductListMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHFixProductListMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
listModel
=
listModel
}
return
cell
}
else
if
msgType
==
.
cardList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHCardMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHCardMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
cardListModel
=
listModel
}
return
cell
}
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
return
defaultCell
}
}
func
handleReceiveMessage
(
_
res
:
YHAIChatMessage
?,
_
done
:
Bool
,
_
messages
:
inout
[
YHAIChatMessage
])
{
func
handleReceiveMessage
(
_
res
:
YHAIChatMessage
?,
_
done
:
Bool
,
_
messages
:
inout
[
YHAIChatMessage
])
{
if
disableHandleMessage
{
if
disableHandleMessage
{
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
View file @
4ffced05
...
@@ -89,11 +89,7 @@ class YHAIMainChatViewController: YHBaseViewController {
...
@@ -89,11 +89,7 @@ class YHAIMainChatViewController: YHBaseViewController {
gk_navTitle
=
"AI对话"
gk_navTitle
=
"AI对话"
self
.
view
.
addSubview
(
self
.
tableView
)
self
.
view
.
addSubview
(
self
.
tableView
)
self
.
view
.
addSubview
(
self
.
bottomInputView
)
self
.
view
.
addSubview
(
self
.
bottomInputView
)
YHAIChatConfiguration
.
defaultConfig
.
recommentMsgClick
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
}
tableView
.
snp
.
makeConstraints
{
make
in
tableView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalTo
(
0
)
make
.
left
.
right
.
equalTo
(
0
)
make
.
top
.
equalTo
(
0
)
make
.
top
.
equalTo
(
0
)
...
@@ -179,10 +175,71 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -179,10 +175,71 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
messages
.
count
{
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
messages
.
count
{
let
msg
=
messages
[
indexPath
.
row
]
let
msg
=
messages
[
indexPath
.
row
]
let
cell
=
YHAIChatConfiguration
.
defaultConfig
.
getMessageCell
(
msg
,
tableView
,
indexPath
:
indexPath
)
let
msgType
=
msg
.
getType
()
return
cell
if
msg
.
isTextMessage
()
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAITextMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAITextMessageCell
cell
.
message
=
msg
cell
.
messageClick
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
}
return
cell
}
else
if
msgType
==
.
thinking
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAIThinkingMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAIThinkingMessageCell
return
cell
}
else
if
msgType
==
.
productList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHProductListMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHProductListMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
listModel
=
listModel
}
return
cell
}
else
if
msgType
==
.
fixProductList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHFixProductListMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHFixProductListMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
listModel
=
listModel
}
return
cell
}
else
if
msgType
==
.
cardList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHCardMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHCardMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
cardListModel
=
listModel
cell
.
evaluationResultCallback
=
{
[
weak
self
]
dict
in
guard
let
self
=
self
else
{
return
}
var
arr
=
[
YHAIChatMessage
]()
if
let
satisfy_count
=
dict
[
"meet_number"
]
as?
Int
{
let
text
=
"测评成功!优才新政策要求满足12项评核准则中的任意6项即可申请(即12分制满足6分),您当前满足
\(
satisfy_count
)
项,联系专属顾问咨询详细方案!"
let
textMsg
=
YHAIChatMessage
.
createTextMesssage
(
text
:
text
)
arr
.
append
(
textMsg
)
}
if
let
img1
=
dict
[
"consultant_qr_code_with_text"
]
as?
String
{
let
picMsg
=
YHAIChatMessage
.
createPictureMessage
(
url
:
img1
,
imgType
:
1
)
arr
.
append
(
picMsg
)
}
if
arr
.
count
>
0
{
messages
.
append
(
contentsOf
:
arr
)
tableView
.
reloadData
()
}
}
}
return
cell
}
else
if
msgType
==
.
picture
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAIPictureMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAIPictureMessageCell
if
let
imgInfo
=
msg
.
body
.
imageInfo
{
cell
.
imgInfo
=
imgInfo
}
return
cell
}
}
}
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
return
defaultCell
return
defaultCell
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
View file @
4ffced05
...
@@ -94,11 +94,6 @@ class YHAIRobotChatViewController: YHBaseViewController {
...
@@ -94,11 +94,6 @@ class YHAIRobotChatViewController: YHBaseViewController {
self
.
view
.
addSubview
(
self
.
bottomInputView
)
self
.
view
.
addSubview
(
self
.
bottomInputView
)
self
.
view
.
addSubview
(
self
.
bgImgView
)
self
.
view
.
addSubview
(
self
.
bgImgView
)
self
.
view
.
insertSubview
(
bgImgView
,
belowSubview
:
gk_navigationBar
)
self
.
view
.
insertSubview
(
bgImgView
,
belowSubview
:
gk_navigationBar
)
YHAIChatConfiguration
.
defaultConfig
.
recommentMsgClick
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
}
bgImgView
.
snp
.
makeConstraints
{
make
in
bgImgView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
make
.
edges
.
equalToSuperview
()
...
@@ -178,10 +173,71 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
...
@@ -178,10 +173,71 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
messages
.
count
{
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
messages
.
count
{
let
msg
=
messages
[
indexPath
.
row
]
let
msg
=
messages
[
indexPath
.
row
]
let
cell
=
YHAIChatConfiguration
.
defaultConfig
.
getMessageCell
(
msg
,
tableView
,
indexPath
:
indexPath
)
let
msgType
=
msg
.
getType
()
return
cell
if
msg
.
isTextMessage
()
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAITextMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAITextMessageCell
cell
.
message
=
msg
cell
.
messageClick
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
self
.
sendMessage
(
text
)
}
return
cell
}
else
if
msgType
==
.
thinking
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAIThinkingMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAIThinkingMessageCell
return
cell
}
else
if
msgType
==
.
productList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHProductListMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHProductListMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
listModel
=
listModel
}
return
cell
}
else
if
msgType
==
.
fixProductList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHFixProductListMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHFixProductListMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
listModel
=
listModel
}
return
cell
}
else
if
msgType
==
.
cardList
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHCardMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHCardMessageCell
if
let
listModel
=
msg
.
body
.
cardsInfo
{
cell
.
cardListModel
=
listModel
cell
.
evaluationResultCallback
=
{
[
weak
self
]
dict
in
guard
let
self
=
self
else
{
return
}
var
arr
=
[
YHAIChatMessage
]()
if
let
satisfy_count
=
dict
[
"meet_number"
]
as?
Int
{
let
text
=
"测评成功!优才新政策要求满足12项评核准则中的任意6项即可申请(即12分制满足6分),您当前满足
\(
satisfy_count
)
项,联系专属顾问咨询详细方案!"
let
textMsg
=
YHAIChatMessage
.
createTextMesssage
(
text
:
text
)
arr
.
append
(
textMsg
)
}
if
let
img1
=
dict
[
"consultant_qr_code_with_text"
]
as?
String
{
let
picMsg
=
YHAIChatMessage
.
createPictureMessage
(
url
:
img1
,
imgType
:
1
)
arr
.
append
(
picMsg
)
}
if
arr
.
count
>
0
{
messages
.
append
(
contentsOf
:
arr
)
tableView
.
reloadData
()
}
}
}
return
cell
}
else
if
msgType
==
.
picture
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHAIPictureMessageCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAIPictureMessageCell
if
let
imgInfo
=
msg
.
body
.
imageInfo
{
cell
.
imgInfo
=
imgInfo
}
return
cell
}
}
}
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
return
defaultCell
return
defaultCell
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/M/YHAIMessageModel.swift
View file @
4ffced05
...
@@ -19,6 +19,7 @@ enum YHAIMessageType: Int {
...
@@ -19,6 +19,7 @@ enum YHAIMessageType: Int {
case
text
=
1
// 文字消息
case
text
=
1
// 文字消息
case
cardList
=
2
// 卡片列表消息
case
cardList
=
2
// 卡片列表消息
case
productList
=
3
// 商品列表消息
case
productList
=
3
// 商品列表消息
case
picture
=
4
// 图片消息
case
fixProductList
=
5
// 文章列表消息
case
fixProductList
=
5
// 文章列表消息
// 自定义case
// 自定义case
...
@@ -90,6 +91,35 @@ class YHAIChatMessage: CustomStringConvertible {
...
@@ -90,6 +91,35 @@ class YHAIChatMessage: CustomStringConvertible {
return
message
return
message
}
}
static
func
createTextMesssage
(
text
:
String
)
->
YHAIChatMessage
{
let
message
=
YHAIChatMessage
()
message
.
uuid
=
UUID
()
.
uuidString
+
NSDate
()
.
timeIntervalSince1970
.
description
message
.
isSelf
=
false
let
body
=
YHAIMessageBody
()
body
.
contentType
=
YHAIMessageType
.
text
.
rawValue
body
.
contentText
=
text
message
.
setFinished
()
message
.
body
=
body
message
.
updateBodyToData
()
return
message
}
static
func
createPictureMessage
(
url
:
String
,
imgType
:
Int
)
->
YHAIChatMessage
{
let
message
=
YHAIChatMessage
()
message
.
uuid
=
UUID
()
.
uuidString
+
NSDate
()
.
timeIntervalSince1970
.
description
message
.
isSelf
=
false
let
body
=
YHAIMessageBody
()
message
.
setFinished
()
body
.
contentType
=
YHAIMessageType
.
picture
.
rawValue
let
imgInfo
=
YHAIImageInfo
()
imgInfo
.
imageUrl
=
url
imgInfo
.
imageType
=
imgType
body
.
imageInfo
=
imgInfo
message
.
body
=
body
message
.
updateBodyToData
()
return
message
}
func
updateBodyToData
()
{
func
updateBodyToData
()
{
dataDict
=
body
.
toDictionary
()
??
[:]
dataDict
=
body
.
toDictionary
()
??
[:]
data
=
self
.
dicToJSONString
(
dict
:
dataDict
)
data
=
self
.
dicToJSONString
(
dict
:
dataDict
)
...
@@ -126,11 +156,12 @@ class YHAIChatMessage: CustomStringConvertible {
...
@@ -126,11 +156,12 @@ class YHAIChatMessage: CustomStringConvertible {
if
contentType
==
YHAIMessageType
.
fixProductList
.
rawValue
{
if
contentType
==
YHAIMessageType
.
fixProductList
.
rawValue
{
return
.
fixProductList
return
.
fixProductList
}
}
if
contentType
==
YHAIMessageType
.
picture
.
rawValue
{
return
.
picture
}
if
contentType
==
YHAIMessageType
.
productList
.
rawValue
{
if
contentType
==
YHAIMessageType
.
productList
.
rawValue
{
return
.
productList
return
.
productList
}
}
}
}
return
.
unknown
return
.
unknown
}
}
...
@@ -160,6 +191,7 @@ class YHAIMessageBody: SmartCodable {
...
@@ -160,6 +191,7 @@ class YHAIMessageBody: SmartCodable {
var
status
:
String
=
""
var
status
:
String
=
""
var
type
:
String
=
""
var
type
:
String
=
""
var
cardsInfo
:
YHAIListinfoModel
?
var
cardsInfo
:
YHAIListinfoModel
?
var
imageInfo
:
YHAIImageInfo
?
func
isStart
()
->
Bool
{
func
isStart
()
->
Bool
{
if
status
==
"start"
{
if
status
==
"start"
{
...
@@ -231,6 +263,16 @@ class YHProductTag: SmartCodable {
...
@@ -231,6 +263,16 @@ class YHProductTag: SmartCodable {
}
}
}
}
class
YHAIImageInfo
:
SmartCodable
{
var
imageType
:
Int
=
0
var
imageUrl
:
String
=
""
required
init
()
{
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAIEvaluationAlertWebView.swift
0 → 100644
View file @
4ffced05
//
// YHAIEvaluationAlertWebView.swift
// galaxy
//
// Created by Dufet on 2024/12/3.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHAIEvaluationAlertWebView
:
UIView
{
var
url
:
String
=
""
static
func
alertView
(
url
:
String
)
->
YHAIEvaluationAlertWebView
{
let
v
=
YHAIEvaluationAlertWebView
()
return
v
}
lazy
var
blackMaskView
:
UIView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
UIColor
(
hex
:
0x0F1214
,
alpha
:
0.5
)
let
tap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
dismiss
)
)
view
.
addGestureRecognizer
(
tap
)
return
view
}()
lazy
var
bottomView
:
UIView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
.
white
view
.
addSubview
(
leftBtn
)
view
.
addSubview
(
rightBtn
)
leftBtn
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
8
)
make
.
left
.
equalTo
(
16
)
make
.
width
.
equalTo
(
rightBtn
)
make
.
right
.
equalTo
(
rightBtn
.
snp
.
left
)
.
offset
(
-
10
)
make
.
height
.
equalTo
(
46
)
}
rightBtn
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
8
)
make
.
right
.
equalTo
(
-
16
)
make
.
height
.
equalTo
(
46
)
}
return
view
}()
lazy
var
rightBtn
:
UIButton
=
{
let
btn
=
UIButton
()
btn
.
backgroundColor
=
.
brandMainColor
btn
.
setTitle
(
"重新选择提升目标"
,
for
:
.
normal
)
btn
.
setTitleColor
(
.
white
,
for
:
.
normal
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
16
)
btn
.
addTarget
(
self
,
action
:
#selector(
didRightBtnClicked
)
,
for
:
.
touchUpInside
)
btn
.
layer
.
cornerRadius
=
kCornerRadius3
return
btn
}()
lazy
var
leftBtn
:
UIButton
=
{
let
btn
=
UIButton
()
btn
.
backgroundColor
=
.
init
(
hex
:
0xF5F6F8
)
btn
.
setTitle
(
"返回"
,
for
:
.
normal
)
btn
.
setTitleColor
(
.
mainTextColor
,
for
:
.
normal
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
16
)
btn
.
addTarget
(
self
,
action
:
#selector(
didLeftBtnClicked
)
,
for
:
.
touchUpInside
)
btn
.
layer
.
cornerRadius
=
kCornerRadius3
return
btn
}()
lazy
var
webVC
:
YHH5WebViewVC
=
{
let
vc
=
YHH5WebViewVC
()
vc
.
url
=
""
vc
.
isNeedRefreshDataFlag
=
true
vc
.
isFullScreenFlag
=
false
return
vc
}()
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
createUI
()
}
static
func
alertView
()
->
YHAppVersionForceUpdateView
{
let
alertView
=
YHAppVersionForceUpdateView
(
frame
:
UIScreen
.
main
.
bounds
)
return
alertView
}
func
createUI
()
{
self
.
addSubview
(
blackMaskView
)
self
.
addSubview
(
bottomView
)
webVC
.
url
=
self
.
url
webVC
.
view
.
frame
=
CGRectMake
(
0
,
100
,
KScreenWidth
,
KScreenHeight
-
100
-
98
)
self
.
addSubview
(
webVC
.
view
)
blackMaskView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
bottomView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
height
.
equalTo
(
98
)
}
webVC
.
view
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
top
.
equalTo
(
100
)
}
}
@objc
func
show
()
{
UIApplication
.
shared
.
yhKeyWindow
()?
.
addSubview
(
self
)
}
@objc
func
dismiss
()
{
DispatchQueue
.
main
.
async
{
self
.
removeFromSuperview
()
}
}
@objc
func
didLeftBtnClicked
()
{
dismiss
()
}
@objc
func
didRightBtnClicked
()
{
dismiss
()
YHMyNewSchemeViewController
.
shared
.
goToSchemePage
()
}
}
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAIPictureMessageCell.swift
0 → 100644
View file @
4ffced05
//
// YHAIPictureMessageCell.swift
// galaxy
//
// Created by Dufet on 2024/12/3.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHAIPictureMessageCell
:
UITableViewCell
{
static
let
cellReuseIdentifier
=
"YHAIPictureMessageCell"
var
imgInfo
=
YHAIImageInfo
()
{
didSet
{
imgView
.
sd_setImage
(
with
:
URL
(
string
:
imgInfo
.
imageUrl
),
placeholderImage
:
UIImage
(
named
:
"global_default_image"
),
options
:
[],
completed
:
{
(
image
,
error
,
cacheType
,
url
)
in
let
size
=
self
.
getShowSize
(
image
:
image
!
)
self
.
imgView
.
snp
.
updateConstraints
{
make
in
make
.
width
.
equalTo
(
size
.
width
)
make
.
height
.
equalTo
(
size
.
height
)
}
self
.
setNeedsLayout
()
})
}
}
func
getShowSize
(
image
:
UIImage
)
->
CGSize
{
var
imgW
=
220.0
var
imgH
=
220.0
var
imgScale
=
1.0
if
image
.
size
.
width
>
0
,
image
.
size
.
height
>
0
{
if
UIScreen
.
main
.
scale
>
0
{
imgScale
=
UIScreen
.
main
.
scale
}
imgW
=
image
.
size
.
width
/
imgScale
imgH
=
image
.
size
.
height
/
imgScale
printLog
(
"AI_MSG_PICTURE_REAL_SIZE: (
\(
imgW
)
,
\(
imgH
)
,
\(
imgScale
)
"
)
let
ratio
=
imgW
/
imgH
if
imgH
>
476
{
imgH
=
476
imgW
=
imgH
*
ratio
}
else
{
imgW
=
220
imgH
=
imgW
/
ratio
}
}
return
CGSizeMake
(
imgW
,
imgH
)
}
lazy
var
imgView
:
UIImageView
=
{
let
v
=
UIImageView
(
image
:
UIImage
(
named
:
"global_default_image"
))
return
v
}()
lazy
var
whiteContentView
:
UIView
=
{
let
v
=
UIView
()
v
.
layer
.
cornerRadius
=
12.0
v
.
clipsToBounds
=
true
let
tap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
didMessageClicked
)
)
v
.
addGestureRecognizer
(
tap
)
return
v
}()
lazy
var
shadowView
:
YHAIChatShadowView
=
{
let
v
=
YHAIChatShadowView
()
return
v
}()
lazy
var
rightAngleView
:
UIView
=
{
let
v
=
UIView
()
v
.
backgroundColor
=
.
white
v
.
isHidden
=
true
return
v
}()
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
setupUI
()
}
func
setupUI
()
{
selectionStyle
=
.
none
contentView
.
backgroundColor
=
.
clear
backgroundColor
=
.
clear
contentView
.
addSubview
(
shadowView
)
contentView
.
addSubview
(
rightAngleView
)
contentView
.
addSubview
(
whiteContentView
)
whiteContentView
.
addSubview
(
imgView
)
whiteContentView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
top
.
equalTo
(
20
)
make
.
bottom
.
equalTo
(
0
)
}
imgView
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
220
)
make
.
height
.
equalTo
(
220
)
make
.
edges
.
equalToSuperview
()
}
shadowView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalTo
(
whiteContentView
)
}
rightAngleView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
left
.
equalTo
(
whiteContentView
)
make
.
width
.
height
.
equalTo
(
15
)
}
}
@objc
func
didMessageClicked
()
{
self
.
endEditing
(
true
)
}
}
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextMessageCell.swift
View file @
4ffced05
...
@@ -193,7 +193,7 @@ class YHAITextMessageCell: UITableViewCell {
...
@@ -193,7 +193,7 @@ class YHAITextMessageCell: UITableViewCell {
}
}
rightAngleView
.
snp
.
makeConstraints
{
make
in
rightAngleView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
righ
t
.
equalTo
(
whiteContentView
)
make
.
top
.
lef
t
.
equalTo
(
whiteContentView
)
make
.
width
.
height
.
equalTo
(
15
)
make
.
width
.
height
.
equalTo
(
15
)
}
}
...
@@ -219,6 +219,8 @@ class YHAITextMessageCell: UITableViewCell {
...
@@ -219,6 +219,8 @@ class YHAITextMessageCell: UITableViewCell {
}
}
@objc
func
didMessageClicked
()
{
@objc
func
didMessageClicked
()
{
self
.
endEditing
(
true
)
if
message
.
getType
()
==
.
recommendText
{
if
message
.
getType
()
==
.
recommendText
{
let
text
=
message
.
getText
()
let
text
=
message
.
getText
()
messageClick
?(
text
)
messageClick
?(
text
)
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHCardMessageCell.swift
View file @
4ffced05
...
@@ -12,6 +12,8 @@ class YHCardMessageCell: UITableViewCell {
...
@@ -12,6 +12,8 @@ class YHCardMessageCell: UITableViewCell {
static
let
cellReuseIdentifier
=
"YHCardMessageCell"
static
let
cellReuseIdentifier
=
"YHCardMessageCell"
var
evaluationResultCallback
:
((
Dictionary
<
String
,
Any
>
)
->
())
=
{
dic
in
}
var
cardListModel
=
YHAIListinfoModel
()
{
var
cardListModel
=
YHAIListinfoModel
()
{
didSet
{
didSet
{
iconImgView
.
sd_setImage
(
with
:
URL
(
string
:
cardListModel
.
icon
))
iconImgView
.
sd_setImage
(
with
:
URL
(
string
:
cardListModel
.
icon
))
...
@@ -95,10 +97,20 @@ class YHCardMessageCell: UITableViewCell {
...
@@ -95,10 +97,20 @@ class YHCardMessageCell: UITableViewCell {
let
v
=
YHAIChatShadowView
()
let
v
=
YHAIChatShadowView
()
return
v
return
v
}()
}()
@objc
func
didBottomButtonClicked
()
{
@objc
func
didBottomButtonClicked
()
{
if
!
cardListModel
.
redirectPath
.
isEmpty
{
let
vc
=
YHH5WebViewVC
()
vc
.
isFullScreenFlag
=
true
vc
.
isHideNavigationBar
=
true
vc
.
url
=
cardListModel
.
redirectPath
vc
.
evaluationResultCallback
=
{
[
weak
self
]
dict
in
guard
let
self
=
self
else
{
return
}
self
.
evaluationResultCallback
(
dict
)
}
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
}
}
required
init
?(
coder
:
NSCoder
)
{
required
init
?(
coder
:
NSCoder
)
{
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHProductItemView.swift
View file @
4ffced05
...
@@ -148,6 +148,13 @@ class YHProductTagView: UIView {
...
@@ -148,6 +148,13 @@ class YHProductTagView: UIView {
var
tagModel
:
YHProductTag
=
YHProductTag
()
{
var
tagModel
:
YHProductTag
=
YHProductTag
()
{
didSet
{
didSet
{
tagLabel
.
text
=
tagModel
.
text
tagLabel
.
text
=
tagModel
.
text
if
!
tagModel
.
color
.
isEmpty
{
tagLabel
.
layer
.
borderColor
=
UIColor
(
hexString
:
tagModel
.
color
,
transparency
:
0.3
)?
.
cgColor
tagLabel
.
textColor
=
UIColor
(
hexString
:
tagModel
.
color
)
}
else
{
tagLabel
.
layer
.
borderColor
=
UIColor
.
mainTextColor
(
alpha
:
0.3
)
.
cgColor
tagLabel
.
textColor
=
UIColor
.
mainTextColor
}
self
.
setNeedsLayout
()
self
.
setNeedsLayout
()
self
.
layoutIfNeeded
()
self
.
layoutIfNeeded
()
}
}
...
@@ -158,7 +165,7 @@ class YHProductTagView: UIView {
...
@@ -158,7 +165,7 @@ class YHProductTagView: UIView {
lable
.
textColor
=
UIColor
.
mainTextColor
lable
.
textColor
=
UIColor
.
mainTextColor
lable
.
textAlignment
=
.
center
lable
.
textAlignment
=
.
center
lable
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
10
)
lable
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
10
)
lable
.
text
=
"新品"
lable
.
layer
.
borderWidth
=
0.5
return
lable
return
lable
}()
}()
...
...
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
View file @
4ffced05
...
@@ -15,6 +15,11 @@ import Photos
...
@@ -15,6 +15,11 @@ import Photos
快速测评 及 其他与H5交互的界面
快速测评 及 其他与H5交互的界面
*/
*/
class
YHH5WebViewVC
:
YHBaseViewController
,
WKUIDelegate
,
WKNavigationDelegate
{
class
YHH5WebViewVC
:
YHBaseViewController
,
WKUIDelegate
,
WKNavigationDelegate
{
// 测评结果回调
var
evaluationResultCallback
:((
Dictionary
<
String
,
Any
>
)
->
())?
lazy
var
webview
:
DWKWebView
=
{
lazy
var
webview
:
DWKWebView
=
{
let
config
=
WKWebViewConfiguration
()
let
config
=
WKWebViewConfiguration
()
config
.
applicationNameForUserAgent
=
"YinHeApp"
config
.
applicationNameForUserAgent
=
"YinHeApp"
...
@@ -504,6 +509,23 @@ extension YHH5WebViewVC {
...
@@ -504,6 +509,23 @@ extension YHH5WebViewVC {
// MARK: - h5实现的接口
// MARK: - h5实现的接口
extension
YHH5WebViewVC
{
extension
YHH5WebViewVC
{
//25 关闭AI聊天的测评弹窗并获取测评结果
// type 1 直接关闭。 2 测评出结果关闭
// result 测评结果json 待定
func
closeEvaluationGetResult
(
type
:
Int
,
dic
:[
String
:
Any
])
{
if
type
==
2
{
printLog
(
"web evaluation:
\n
"
)
printLog
(
"
\(
dic
)
"
)
self
.
evaluationResultCallback
?(
dic
)
self
.
dismiss
(
animated
:
true
)
}
else
{
self
.
dismiss
(
animated
:
true
)
}
}
//22、禁用全局手势返回
//22、禁用全局手势返回
func
disableFullScreenGestureSyn
(
_
tag
:
String
)
{
func
disableFullScreenGestureSyn
(
_
tag
:
String
)
{
if
tag
.
contains
(
"0"
)
{
if
tag
.
contains
(
"0"
)
{
...
...
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
View file @
4ffced05
...
@@ -35,6 +35,34 @@ extension YHJsApi {
...
@@ -35,6 +35,34 @@ extension YHJsApi {
}
}
}
}
@objc
func
closeEvaluationGetResult
(
_
dicData
:
String
)
{
DispatchQueue
.
main
.
async
{
if
let
data
=
dicData
.
data
(
using
:
.
utf8
)
{
do
{
if
let
result_dict
=
try
JSONSerialization
.
jsonObject
(
with
:
data
,
options
:
[])
as?
[
String
:
Any
]
{
var
myType
=
1
var
results
:[
String
:
Any
]
=
[:]
if
let
type
=
result_dict
[
"type"
]
as?
Int
{
myType
=
type
}
if
let
result
=
result_dict
[
"result"
]
as?
[
String
:
Any
]
{
results
=
result
}
if
let
delegate
=
self
.
delegate
as?
YHH5WebViewVC
{
delegate
.
closeEvaluationGetResult
(
type
:
myType
,
dic
:
results
)
}
}
else
{
printLog
(
"JSON字符串不是有效的字典格式"
)
}
}
catch
{
printLog
(
"JSON解析错误:
\(
error
)
"
)
}
}
}
}
//21、使用safari WebView打开Url
//21、使用safari WebView打开Url
@objc
func
openUrlWithSafariSyn
(
_
payUrl
:
String
)
{
@objc
func
openUrlWithSafariSyn
(
_
payUrl
:
String
)
{
...
...
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