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
03d04ea9
Commit
03d04ea9
authored
Aug 28, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
bb353daf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
13 deletions
+31
-13
iswx.ts
egret/src/iswx.ts
+3
-0
shareCtrl.ts
egret/src/shareCtrl.ts
+28
-13
No files found.
egret/src/iswx.ts
0 → 100644
View file @
03d04ea9
export
const
iswx
=
()
=>
{
return
navigator
.
userAgent
.
toLowerCase
().
indexOf
(
'micromessenger'
)
!==
-
1
}
\ No newline at end of file
egret/src/shareCtrl.ts
View file @
03d04ea9
...
@@ -4,6 +4,7 @@ import { getPrintScreenData } from "./getShowOffPic";
...
@@ -4,6 +4,7 @@ import { getPrintScreenData } from "./getShowOffPic";
import
{
NetManager
}
from
"../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../libs/tw/manager/NetManager"
;
import
{
DataManager
}
from
"../libs/tw/manager/DataManager"
;
import
{
DataManager
}
from
"../libs/tw/manager/DataManager"
;
import
getHomeData
from
"./getHomeData"
;
import
getHomeData
from
"./getHomeData"
;
import
{
iswx
}
from
"./iswx"
;
const
img
:
any
=
document
.
getElementById
(
'pic'
);
const
img
:
any
=
document
.
getElementById
(
'pic'
);
img
.
style
.
display
=
'none'
;
img
.
style
.
display
=
'none'
;
...
@@ -13,12 +14,21 @@ class Share2 extends ComponentBase {
...
@@ -13,12 +14,21 @@ class Share2 extends ComponentBase {
const
data
=
getHomeData
();
const
data
=
getHomeData
();
this
[
'lvTxt'
].
text
=
data
.
levels
.
length
;
this
[
'lvTxt'
].
text
=
data
.
levels
.
length
;
this
[
'btn1'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
[
'btn1'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
.
getFunc
(
'2'
);
//朋友圈
if
(
iswx
())
{
//微信端
}
else
{
//端内
this
.
getFunc
(
'2'
);
//朋友圈
}
hideShare
();
hideShare
();
},
this
);
},
this
);
this
[
'btn2'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
[
'btn2'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
.
getFunc
(
'1'
);
//好友微信
if
(
iswx
())
{
//微信端
}
else
{
//端内
this
.
getFunc
(
'1'
);
//好友微信
}
hideShare
();
hideShare
();
},
this
);
},
this
);
}
}
...
@@ -28,7 +38,7 @@ class Share2 extends ComponentBase {
...
@@ -28,7 +38,7 @@ class Share2 extends ComponentBase {
NetManager
.
ins
.
imgUrl
((
success
)
=>
{
NetManager
.
ins
.
imgUrl
((
success
)
=>
{
const
data
=
DataManager
.
ins
.
getData
(
'imgURL'
);
const
data
=
DataManager
.
ins
.
getData
(
'imgURL'
);
img
.
src
=
data
.
data
;
img
.
src
=
data
.
data
;
callShareApi
(
data
.
data
,
type
);
callShareApi
(
data
.
data
,
type
);
},
base64
);
},
base64
);
}
}
...
@@ -67,15 +77,20 @@ const isIphone = () => {
...
@@ -67,15 +77,20 @@ const isIphone = () => {
}
}
//channel 1 好友 2 朋友圈
//channel 1 好友 2 朋友圈
export
const
callShareApi
=
(
shareImgUrl
,
channel
)
=>
{
export
const
callShareApi
=
(
shareImgUrl
,
channel
)
=>
{
if
(
isIphone
())
{
try
{
console
.
log
(
"IOS"
);
if
(
isIphone
())
{
console
.
log
(
window
[
'SNNativeClient'
]);
console
.
log
(
"IOS"
);
//分享图片方法
console
.
log
(
window
[
'SNNativeClient'
]);
window
[
'SNNativeClient'
].
callMediaShare
(
shareImgUrl
,
channel
,
(
message
)
=>
{
});
//分享图片方法
}
else
{
window
[
'SNNativeClient'
].
callMediaShare
(
shareImgUrl
,
channel
,
(
message
)
=>
{
});
console
.
log
(
"安卓"
);
}
else
{
console
.
log
(
window
[
'shareApi'
]);
console
.
log
(
"安卓"
);
//分享图片用下列方法
console
.
log
(
window
[
'shareApi'
]);
window
[
'shareApi'
].
callMediaShare
(
shareImgUrl
,
channel
,
(
message
)
=>
{
});
//分享图片用下列方法
window
[
'shareApi'
].
callMediaShare
(
shareImgUrl
,
channel
,
(
message
)
=>
{
});
}
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
}
\ 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