|
@@ -10,7 +10,13 @@ import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: weixin } = createNamespacedHelpers('weixin');
|
|
|
export default {
|
|
|
name: 'share',
|
|
|
- props: {},
|
|
|
+ props: {
|
|
|
+ title: { type: String, default: '分享' },
|
|
|
+ desc: { type: String, default: '内容' },
|
|
|
+ img: { type: String, default: '' },
|
|
|
+ route: { type: String, default: '/' },
|
|
|
+ type: { type: String, default: 'py' },
|
|
|
+ },
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
return {
|
|
@@ -60,14 +66,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
toShare() {
|
|
|
- this.wx.updateAppMessageShareData({
|
|
|
- title: '测试分享',
|
|
|
- desc: '测试',
|
|
|
- // imgUrl:''
|
|
|
- link: `${this.host}/articlemobile/login`,
|
|
|
+ const url = 'http://broadcast.waityou24.cn/api/article/auth?redirect_uri=http://broadcast.waityou24.cn/articlemobile' + this.route;
|
|
|
+ let method = 'updateAppMessageShareData';
|
|
|
+ if (type !== 'py') method = 'updateTimelineShareData';
|
|
|
+ this.wx[method]({
|
|
|
+ title: this.title,
|
|
|
+ desc: this.desc,
|
|
|
+ imgUrl: this.img,
|
|
|
+ link: url,
|
|
|
success: res => {
|
|
|
console.log('in function:share success');
|
|
|
- console.log(res);
|
|
|
},
|
|
|
error: err => {
|
|
|
alert('share is fail');
|