Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
h5-base
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
new-sing
h5-base
Commits
9fea7da3
Commit
9fea7da3
authored
Jan 08, 2019
by
wangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打包
parent
2ec5b435
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
1 deletion
+54
-1
share.vue
src/components/newLesson/share.vue
+54
-1
No files found.
src/components/newLesson/share.vue
View file @
9fea7da3
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
import
shareBtn
from
'../../assets/newLesson/share_button.png'
import
shareBtn
from
'../../assets/newLesson/share_button.png'
import
QRCode
from
'qrcodejs2'
import
QRCode
from
'qrcodejs2'
import
html2canvas
from
'html2canvas'
import
html2canvas
from
'html2canvas'
import
{
getUserDetailApi
,
getUserWatchApi
,
getShortApi
}
from
"../../service/api"
;
import
{
getUserDetailApi
,
get
wechatParam
,
get
UserWatchApi
,
getShortApi
}
from
"../../service/api"
;
import
share_code_bg
from
'../../assets/newLesson/share-code-bg.png'
import
share_code_bg
from
'../../assets/newLesson/share-code-bg.png'
export
default
{
export
default
{
...
@@ -80,6 +80,58 @@
...
@@ -80,6 +80,58 @@
});
});
})
})
},
},
enableShare
:
function
(
option
)
{
let
that
=
this
;
getwechatParam
({
api_list
:
'onMenuShareAppMessage,onMenuShareTimeline'
,
url
:
window
.
location
.
href
.
split
(
'#'
)[
0
]
}).
then
(
wechatRes
=>
{
console
.
log
(
'enableShare'
,
wechatRes
)
wx
.
config
({
debug
:
false
,
appId
:
wechatRes
.
appId
,
timestamp
:
parseInt
(
wechatRes
.
timestamp
),
nonceStr
:
wechatRes
.
nonceStr
,
signature
:
wechatRes
.
signature
,
jsApiList
:
wechatRes
.
jsApiList
});
wx
.
ready
(
function
()
{
wx
.
onMenuShareTimeline
({
title
:
option
.
product_title
,
// 分享标题
desc
:
option
.
desc
,
// 分享描述
link
:
option
.
shareUrl
,
// 分享链接
imgUrl
:
option
.
shareIcon
||
'https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png'
,
// 分享图标
success
:
function
()
{
console
.
log
(
'分享成功'
);
window
.
_hmt
.
push
([
'_trackEvent'
,
'分享'
,
"商品页好友分享"
,
`id
${
that
.
shopId
}
`
,
that
.
invite_code
]);
//百度统计
},
cancel
:
function
()
{
// alert("失败")
console
.
log
(
'分享失败'
)
}
});
wx
.
onMenuShareAppMessage
({
title
:
option
.
product_title
,
// 分享标题
desc
:
option
.
desc
,
// 分享描述
link
:
option
.
shareUrl
,
// 分享链接
imgUrl
:
option
.
shareIcon
||
'https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png'
,
// 分享图标
success
:
function
()
{
window
.
_hmt
.
push
([
'_trackEvent'
,
'分享'
,
"商品页朋友圈分享"
,
`id
${
that
.
shopId
}
`
,
that
.
invite_code
]);
//百度统计
},
cancel
:
function
()
{
}
});
})
})
},
onShare
(
URL
)
{
this
.
enableShare
({
product_title
:
`每天10分钟,英语开口唱【SingsingEnglish】`
,
// 分享标题
desc
:
`我家宝宝正在【唱唱启蒙英语】学唱童谣,已累计学习
${
this
.
watchDetail
.
total_day
}
天`
,
//
shareIcon
:
'https://cdn.singsingenglish.com/logo/logo.jpg'
,
shareUrl
:
URL
})
},
toDataURLBase64
(
src
,
callback
)
{
toDataURLBase64
(
src
,
callback
)
{
let
xhttp
=
new
XMLHttpRequest
();
let
xhttp
=
new
XMLHttpRequest
();
xhttp
.
onload
=
function
()
{
xhttp
.
onload
=
function
()
{
...
@@ -95,6 +147,7 @@
...
@@ -95,6 +147,7 @@
},
},
refshow
(){
refshow
(){
let
URL
=
process
.
env
.
API_URL
+
'#/shareGoods?userID='
+
this
.
userDetail
.
user_id
;
let
URL
=
process
.
env
.
API_URL
+
'#/shareGoods?userID='
+
this
.
userDetail
.
user_id
;
this
.
onShare
(
URL
);
getShortApi
({
url
:
URL
}).
then
(
res
=>
{
getShortApi
({
url
:
URL
}).
then
(
res
=>
{
this
.
qrcode
(
res
.
url
);
this
.
qrcode
(
res
.
url
);
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
...
...
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