Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-community-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
6 years ago
Commit
16d70a4320ac3c59ff89e1dd9f955fe169f19bd9
1 parent
6d7cf87b
fix
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
7 deletions
apps/pages/article/components/topic/header.vue
apps/pages/article/topic.vue
apps/plugins/share.js
apps/pages/article/components/topic/header.vue
View file @
16d70a4
...
...
@@ -70,10 +70,10 @@ export default {
},
onShare() {
this.$yoho.share({
title:
'#' +
this.data.topicName,
title: this.data.topicName,
imgUrl: this.data.topicImageUrl,
link: `${location.origin}/grass/topic/share/${this.data.topicId}/${this.data.topicName}`,
desc: this.data.topicDesc,
desc:
'我在有货的社区发现一个热门话题。' +
this.data.topicDesc,
hideType: ['7', '8', '9']
});
}
...
...
apps/pages/article/topic.vue
View file @
16d70a4
...
...
@@ -235,12 +235,20 @@ export default {
}
},
init() {
let reload = this.page > 1;
this.page = 1;
this.fetchTopicSimpleInfo({topicId: this.topicId});
if (this.$refs.scroll) {
this.$refs.scroll.$el.scrollTop = 0;
this.$refs.scroll.init();
}
this.fetchTopicSimpleInfo({topicId: this.topicId}).then(res => {
if (this.$refs.scroll) {
this.$refs.scroll.$el.scrollTop = 0;
if (reload) {
setTimeout(() => {
this.$refs.scroll.init();
}, 200);
}
}
});
},
async onFetch() {
const topicId = parseInt(this.topicId, 10);
...
...
apps/plugins/share.js
0 → 100644
View file @
16d70a4
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/7/29
* Time: 16:55
*/
let
qs
=
require
(
'yoho-qs'
);
let
jsApiList
=
[
'checkJsApi'
,
'onMenuShareTimeline'
,
'onMenuShareAppMessage'
,
'onMenuShareQQ'
,
'onMenuShareWeibo'
,
'onMenuShareQZone'
];
let
shareData
=
{
title
:
document
.
title
,
link
:
location
.
href
,
desc
:
'YOHO!BUY'
,
imgUrl
:
'http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png'
};
const
getShareData
=
function
(
shareType
)
{
let
data
=
{
success
:
function
()
{
window
.
_yas
&&
window
.
_yas
.
sendCustomInfo
&&
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_SHARE_SUCCESS_L'
,
param
:
JSON
.
stringify
({
SHARE_TYPE
:
shareType
,
SHARE_URL
:
location
.
href
})
},
true
);
}
};
return
Object
.
assign
(
data
,
shareData
);
};
const
setShareData
=
function
()
{
window
.
wx
.
onMenuShareTimeline
(
getShareData
(
'2'
));
window
.
wx
.
onMenuShareAppMessage
(
getShareData
(
'3'
));
window
.
wx
.
onMenuShareQQ
(
getShareData
(
'5'
));
window
.
wx
.
onMenuShareQZone
(
getShareData
(
'6'
));
window
.
wx
.
onMenuShareWeibo
(
getShareData
(
'7'
));
};
if
(
/QQ/i
.
test
(
navigator
.
userAgent
))
{
$
.
ajax
({
url
:
'//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js'
,
dataType
:
'script'
,
cache
:
true
,
success
:
function
()
{
window
.
setShareInfo
&&
window
.
setShareInfo
({
title
:
shareData
.
title
,
summary
:
shareData
.
desc
,
pic
:
shareData
.
imgUrl
,
url
:
shareData
.
link
});
}
});
}
if
(
/MicroMessenger/i
.
test
(
navigator
.
userAgent
))
{
$
.
ajax
({
url
:
'//res.wx.qq.com/open/js/jweixin-1.3.2.js'
,
dataType
:
'script'
,
cache
:
true
,
success
:
function
()
{
$
.
ajax
({
url
:
location
.
protocol
+
'//m.yohobuy.com/activity/wechat/share'
,
data
:
{
url
:
location
.
href
},
dataType
:
'jsonp'
,
success
:
function
(
res
)
{
if
(
window
.
wx
)
{
window
.
wx
.
config
({
debug
:
false
,
appId
:
res
.
appId
,
timestamp
:
res
.
timestamp
,
nonceStr
:
res
.
nonceStr
,
signature
:
res
.
signature
,
jsApiList
:
jsApiList
});
window
.
wx
.
ready
(
function
()
{
setShareData
();
});
}
}
});
}
});
}
if
(
qs
&&
qs
.
share_id
)
{
$
.
ajax
({
method
:
'GET'
,
url
:
location
.
protocol
+
'//m.yohobuy.com/activity/share'
,
data
:
{
shareId
:
qs
.
share_id
},
dataType
:
'jsonp'
,
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
===
200
&&
res
.
data
)
{
shareData
.
desc
=
res
.
data
.
content
||
res
.
data
.
title
;
shareData
.
imgUrl
=
res
.
data
.
pic
;
shareData
.
title
=
res
.
data
.
title
;
}
}
});
}
export
default
(
data
)
=>
{
shareData
=
data
;
if
(
window
.
wx
)
{
setShareData
();
}
window
.
setShareInfo
&&
window
.
setShareInfo
({
title
:
shareData
.
title
,
summary
:
shareData
.
desc
,
pic
:
shareData
.
imgUrl
,
url
:
shareData
.
link
});
};
...
...
Please
register
or
login
to post a comment