Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
wildfirecode13
xiaoxiaole
Commits
bb353daf
Commit
bb353daf
authored
Aug 28, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
44fff0cc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
3 deletions
+38
-3
shareCtrl.ts
egret/src/shareCtrl.ts
+28
-3
config.js
mock/config.js
+3
-0
imgUrl.json
mock/json/imgUrl.json
+7
-0
No files found.
egret/src/shareCtrl.ts
View file @
bb353daf
...
...
@@ -13,21 +13,22 @@ class Share2 extends ComponentBase {
const
data
=
getHomeData
();
this
[
'lvTxt'
].
text
=
data
.
levels
.
length
;
this
[
'btn1'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
.
getFunc
(
'
btn1'
);
this
.
getFunc
(
'
2'
);
//朋友圈
hideShare
();
},
this
);
this
[
'btn2'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
.
getFunc
(
'
btn2'
);
this
.
getFunc
(
'
1'
);
//好友微信
hideShare
();
},
this
);
}
//channel 1 好友 2 朋友圈
getFunc
(
type
:
string
)
{
const
base64
=
getPrintScreenData
(
this
[
'pic'
],
0
,
0
,
579
,
866
);
NetManager
.
ins
.
imgUrl
((
success
)
=>
{
const
data
=
DataManager
.
ins
.
getData
(
'imgURL'
);
img
.
src
=
data
.
data
;
callShareApi
(
data
.
data
,
type
);
},
base64
);
}
...
...
@@ -54,3 +55,27 @@ export const showShare = () => {
export
const
hideShare
=
()
=>
{
layers
.
shareLayer
.
visible
=
false
;
}
const
isIphone
=
()
=>
{
const
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
();
if
(
ua
.
match
(
/iphone|ipad/
))
{
return
true
;
}
else
if
(
ua
.
match
(
/android/
))
{
return
false
;
}
}
//channel 1 好友 2 朋友圈
export
const
callShareApi
=
(
shareImgUrl
,
channel
)
=>
{
if
(
isIphone
())
{
console
.
log
(
"IOS"
);
console
.
log
(
window
[
'SNNativeClient'
]);
//分享图片方法
window
[
'SNNativeClient'
].
callMediaShare
(
shareImgUrl
,
channel
,
(
message
)
=>
{
});
}
else
{
console
.
log
(
"安卓"
);
console
.
log
(
window
[
'shareApi'
]);
//分享图片用下列方法
window
[
'shareApi'
].
callMediaShare
(
shareImgUrl
,
channel
,
(
message
)
=>
{
});
}
}
\ No newline at end of file
mock/config.js
View file @
bb353daf
const
path
=
require
(
'path'
);
const
config
=
{
'/customActivity/duiba/imgUrl'
:
{
data
:
'./json/imgUrl.json'
},
'/wechatShare/getShareInfo/v2'
:
{
data
:
'./happyclear/openTreasureBox.json'
},
...
...
mock/json/imgUrl.json
0 → 100644
View file @
bb353daf
{
"code"
:
null
,
"data"
:
"http://yun.duiba.com.cn/duibaimage/1566979679985100400129.png"
,
"success"
:
true
,
"desc"
:
null
,
"timestamp"
:
1566979680025
}
\ No newline at end of file
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