Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
icbcrpgshare
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
icbcrpgshare
Commits
69a59d13
Commit
69a59d13
authored
Dec 28, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
eebaf73d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
17 deletions
+108
-17
package.json
project/package.json
+0
-1
index.html
project/public/index.html
+96
-4
app.jsx
project/src/app.jsx
+12
-12
No files found.
project/package.json
View file @
69a59d13
...
...
@@ -11,7 +11,6 @@
"dependencies"
:
{
"@spark/api-base"
:
"^1.0.11"
,
"@spark/projectx"
:
"^1.0.3"
,
"@spark/share"
:
"^1.0.29"
,
"axios"
:
"^0.19.2"
,
"css-loader"
:
"^3.6.0"
,
"duiba-utils"
:
"^1.0.2"
,
...
...
project/public/index.html
View file @
69a59d13
...
...
@@ -11,7 +11,8 @@
<script
src=
"//yun.duiba.com.cn/js-libs/rem/1.1.0/rem.min.js"
></script>
<script
src=
"//yun.duiba.com.cn/h5/lib/zepto.min.js"
></script>
<script
src=
"https://res.wx.qq.com/open/js/jweixin-1.3.2.js"
></script>
<script
type=
"text/javascript"
src=
"https://res.wx.qq.com/open/js/jweixin-1.3.2.js"
></script>
<script>
window
.
url
=
'https://baidu.com'
;
...
...
@@ -21,6 +22,7 @@
window
.
sharedesc
=
'养鸡养牛还能兑换更多好礼'
;
function
getApp
()
{
return
{
cloud
:
{},
...
...
@@ -44,6 +46,96 @@
// alert("【警告】检测到活动url中没有appID参数\n缺少该参数会导致埋点、分享、app信息获取错误。")
}
</script>
<script>
var
sharetit
=
"欢趣专区全新升级,快来看看吧"
;
var
sharecont
=
"养鸡养牛还能兑换更多好礼"
;
var
shareimg
=
"https://yun.duiba.com.cn/spark/assets/e7bec756134eaca143ea54e9f6856b6a6e10d33f.png"
;
var
shareurl
=
window
.
location
.
href
;
console
.
log
(
"分享调整233===》"
,
shareurl
);
//初始化微信分享
function
invokeWX
(
stit
,
scont
,
surl
,
simg
)
{
var
share
=
{
title
:
stit
,
desc
:
scont
,
url
:
surl
,
imgUrl
:
simg
,
};
wx
.
onMenuShareTimeline
({
title
:
share
.
title
,
desc
:
share
.
desc
,
link
:
share
.
url
,
imgUrl
:
share
.
imgUrl
,
success
:
function
()
{
window
[
"sharecallback"
]
&&
window
[
"sharecallback"
]();
},
cancel
:
function
()
{
}
});
wx
.
onMenuShareAppMessage
({
title
:
share
.
title
,
desc
:
share
.
desc
,
link
:
share
.
url
,
imgUrl
:
share
.
imgUrl
,
success
:
function
()
{
window
[
"sharecallback"
]
&&
window
[
"sharecallback"
]();
},
cancel
:
function
()
{
}
});
}
function
initWx
(
url
,
stit
,
scont
,
surl
,
simg
)
{
$
.
ajax
({
type
:
'get'
,
url
:
'/wechatShare/getShareInfo/v2'
,
data
:
{
wxdebug
:
false
,
url
:
encodeURIComponent
(
url
)
},
cache
:
false
,
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
!
res
.
success
)
{
return
;
}
wx
.
config
({
debug
:
false
,
appId
:
res
.
wxappid
,
timestamp
:
res
.
wxtimestamp
,
nonceStr
:
res
.
wxnonceStr
,
signature
:
res
.
wxsignature
,
jsApiList
:
[
'checkJsApi'
,
'onMenuShareTimeline'
,
'onMenuShareAppMessage'
]
});
wx
.
error
(
function
(
res
)
{
console
.
error
(
"wx error"
,
res
);
});
wx
.
ready
(
function
()
{
console
.
error
(
"wx ready"
,
stit
,
scont
,
surl
,
simg
);
invokeWX
(
stit
,
scont
,
surl
,
simg
);
});
},
error
:
function
(
err
)
{
console
.
log
(
"err====>"
,
err
);
}
});
}
initWx
(
shareurl
,
sharetit
,
sharecont
,
shareurl
,
shareimg
);
</script>
</head>
<body>
...
...
project/src/app.jsx
View file @
69a59d13
...
...
@@ -9,20 +9,20 @@ MD();
import
Share
from
"./pages/share/share.jsx"
;
import
{
Weixin
,
start
,
updateShare
}
from
'@spark/share'
Weixin
.
debugMode
=
true
;
start
([
Weixin
],
(
success
)
=>
{
//分享结果回调, success为是否成功
});
//更新分享内容,多用于被动式分享,比如微信
updateShare
({
title
:
window
.
sharetitle
,
//分享标题
content
:
window
.
sharedesc
,
//分享内容
url
:
location
.
href
,
//分享链接
thumbnail
:
window
.
shareimg
,
//分享缩略图
});
//
import {Weixin,start,updateShare} from '@spark/share'
//
Weixin.debugMode = true;
//
start([Weixin], (success)=>{
//
//分享结果回调, success为是否成功
//
});
//
//
更新分享内容,多用于被动式分享,比如微信
//
updateShare({
//
title: window.sharetitle, //分享标题
//
content: window.sharedesc, //分享内容
//
url: location.href, //分享链接
//
thumbnail: window.shareimg, //分享缩略图
//
});
class
App
extends
Component
{
...
...
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