|
@@ -19,16 +19,12 @@ export default {
|
|
|
},
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
- return {
|
|
|
- wx: {},
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.init();
|
|
|
+ return {};
|
|
|
},
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
...weixin(['jsAuth']),
|
|
|
- async init() {
|
|
|
+ async toShare() {
|
|
|
// 处理参数
|
|
|
const { path, query } = this.$route;
|
|
|
const { openid, ...others } = query;
|
|
@@ -38,7 +34,6 @@ export default {
|
|
|
const arr = keys.map(key => `${key}=${query[key]}`);
|
|
|
uri = `${uri}?${arr.join('&')}`;
|
|
|
}
|
|
|
- // const url = encodeURIComponent(`${this.host}${process.env.VUE_APP_ROUTER}${uri}`);
|
|
|
const url = encodeURIComponent(location.href.split('#')[0]);
|
|
|
const res = await this.jsAuth({ url });
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -55,32 +50,28 @@ export default {
|
|
|
],
|
|
|
});
|
|
|
wx.ready(() => {
|
|
|
- console.log('in ready');
|
|
|
- this.$set(this, 'wx', wx);
|
|
|
+ const url = 'http://broadcast.waityou24.cn/api/article/auth?redirect_uri=http://broadcast.waityou24.cn/articlemobile' + this.route;
|
|
|
+ let method = 'updateAppMessageShareData';
|
|
|
+ if (this.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');
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ alert('share is fail');
|
|
|
+ alert(JSON.stringify(err));
|
|
|
+ },
|
|
|
+ });
|
|
|
});
|
|
|
wx.error(res => {
|
|
|
console.log(res);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- toShare() {
|
|
|
- const url = 'http://broadcast.waityou24.cn/api/article/auth?redirect_uri=http://broadcast.waityou24.cn/articlemobile' + this.route;
|
|
|
- let method = 'updateAppMessageShareData';
|
|
|
- if (this.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');
|
|
|
- },
|
|
|
- error: err => {
|
|
|
- alert('share is fail');
|
|
|
- alert(JSON.stringify(err));
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user', 'menuParams']),
|