Merge branch 'feature/0430' into 'release/6.9.2'
fix share See merge request !69
Showing
4 changed files
with
26 additions
and
14 deletions
@@ -93,10 +93,21 @@ export default { | @@ -93,10 +93,21 @@ export default { | ||
93 | this.title = `@${first.authorName} 在有货逛上发了一篇笔记,快点开看看!`; | 93 | this.title = `@${first.authorName} 在有货逛上发了一篇笔记,快点开看看!`; |
94 | 94 | ||
95 | if (!this.$yoho.isApp) { | 95 | if (!this.$yoho.isApp) { |
96 | + let shareImage = ''; | ||
97 | + let shareIntro = ''; | ||
98 | + | ||
99 | + get(first, 'blockList', []).forEach(block => { | ||
100 | + if (block.templateKey === 'image') { | ||
101 | + !shareImage && (shareImage = (block.contentData || '').split('?')[0]); | ||
102 | + } else if (block.templateKey === 'text') { | ||
103 | + !shareIntro && (shareIntro = block.contentData); | ||
104 | + } | ||
105 | + }); | ||
106 | + | ||
96 | Share.setShareInfo({ | 107 | Share.setShareInfo({ |
97 | title: this.title, | 108 | title: this.title, |
98 | - imgUrl: first.shareImage, | ||
99 | - desc: first.intro | 109 | + imgUrl: shareImage, |
110 | + desc: shareIntro | ||
100 | }); | 111 | }); |
101 | } | 112 | } |
102 | } | 113 | } |
@@ -82,7 +82,7 @@ export default { | @@ -82,7 +82,7 @@ export default { | ||
82 | this.$yoho.share({ | 82 | this.$yoho.share({ |
83 | title: this.data.topicName, | 83 | title: this.data.topicName, |
84 | imgUrl: this.data.topicImageUrl, | 84 | imgUrl: this.data.topicImageUrl, |
85 | - link: `${location.origin}/grass/topic/share/${this.data.topicId}/${this.data.topicName}`, | 85 | + link: `${location.origin}/grass/topic/share/${this.data.topicId}`, |
86 | desc: '我在有货的社区发现一个热门话题。' + this.data.topicDesc, | 86 | desc: '我在有货的社区发现一个热门话题。' + this.data.topicDesc, |
87 | hideType: ['7', '8', '9'] | 87 | hideType: ['7', '8', '9'] |
88 | }); | 88 | }); |
@@ -31,6 +31,14 @@ export default [{ | @@ -31,6 +31,14 @@ export default [{ | ||
31 | keepAlive: true | 31 | keepAlive: true |
32 | } | 32 | } |
33 | }, { | 33 | }, { |
34 | + path: '/topic/share/:topicId', | ||
35 | + alias: '/topic/share/:topicId', | ||
36 | + name: 'topic.share', | ||
37 | + component: () => import(/* webpackChunkName: "article" */ './topic'), | ||
38 | + meta: { | ||
39 | + keepAlive: true | ||
40 | + } | ||
41 | +}, { | ||
34 | path: '/topic/:topicId/:topicName', | 42 | path: '/topic/:topicId/:topicName', |
35 | alias: '/topic/:topicId/:topicName', | 43 | alias: '/topic/:topicId/:topicName', |
36 | name: 'topic', | 44 | name: 'topic', |
@@ -40,14 +48,6 @@ export default [{ | @@ -40,14 +48,6 @@ export default [{ | ||
40 | statusBarColor: 'white' | 48 | statusBarColor: 'white' |
41 | } | 49 | } |
42 | }, { | 50 | }, { |
43 | - path: '/topic/share/:topicId/:topicName', | ||
44 | - alias: '/topic/share/:topicId/:topicName', | ||
45 | - name: 'topic.share', | ||
46 | - component: () => import(/* webpackChunkName: "article" */ './topic'), | ||
47 | - meta: { | ||
48 | - keepAlive: true | ||
49 | - } | ||
50 | -}, { | ||
51 | path: '/article/:articleId/comment', | 51 | path: '/article/:articleId/comment', |
52 | alias: '/article/:articleId/comment', | 52 | alias: '/article/:articleId/comment', |
53 | name: 'article.comment', | 53 | name: 'article.comment', |
@@ -113,9 +113,10 @@ function init(qs) { | @@ -113,9 +113,10 @@ function init(qs) { | ||
113 | export default { | 113 | export default { |
114 | init, | 114 | init, |
115 | setShareInfo(data) { | 115 | setShareInfo(data) { |
116 | - Object.assign(shareData, data); | ||
117 | - | ||
118 | - shareData.link = shareData.link || location.href; | 116 | + shareData.title = data.title; |
117 | + shareData.desc = data.desc || '逛'; | ||
118 | + shareData.link = data.link || location.href; | ||
119 | + shareData.imgUrl = data.imgUrl || shareData.imgUrl; | ||
119 | 120 | ||
120 | if (window.wx) { | 121 | if (window.wx) { |
121 | setWxShareData(); | 122 | setWxShareData(); |
-
Please register or login to post a comment