|
@@ -9,11 +9,12 @@
|
|
<van-row>3.将截图发送至<span style="color: #F4A460"> 深大换换 </span>公众号后台,才可获得本次活动的【匹配资格】和【抽奖机会】</van-row>
|
|
<van-row>3.将截图发送至<span style="color: #F4A460"> 深大换换 </span>公众号后台,才可获得本次活动的【匹配资格】和【抽奖机会】</van-row>
|
|
</div>
|
|
</div>
|
|
<div style="position: relative;">
|
|
<div style="position: relative;">
|
|
- <img :src="share" style="max-width: 80%; position: relative;"/>
|
|
|
|
|
|
+ <img :src="share[i]" style="max-width: 80%; position: relative;"/>
|
|
</div>
|
|
</div>
|
|
- <van-button size="large" type="primary" @click="Toshare"></van-button>
|
|
|
|
|
|
+ <a :href="share[i]" download="post">
|
|
|
|
+ <van-button size="large" type="primary">保存</van-button>
|
|
|
|
+ </a>
|
|
<van-button size="large" type="primary" @click="Toindex">返回首页</van-button>
|
|
<van-button size="large" type="primary" @click="Toindex">返回首页</van-button>
|
|
- <a href="assets/post.png"> 保存 </a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -23,29 +24,29 @@
|
|
// import wx from 'weixin-js-sdk';
|
|
// import wx from 'weixin-js-sdk';
|
|
import {
|
|
import {
|
|
Row, Col,
|
|
Row, Col,
|
|
- Button
|
|
|
|
|
|
+ Button, Toast
|
|
} from 'vant';
|
|
} from 'vant';
|
|
import 'whatwg-fetch';
|
|
import 'whatwg-fetch';
|
|
- import { BasicFunction } from '../connector/basic-service';
|
|
|
|
|
|
+ // import { BasicFunction } from '../connector/basic-service';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "share",
|
|
name: "share",
|
|
components: {
|
|
components: {
|
|
[Button.name]: Button,
|
|
[Button.name]: Button,
|
|
[Row.name]: Row, [Col.name]: Col,
|
|
[Row.name]: Row, [Col.name]: Col,
|
|
- 'wx': {
|
|
|
|
- render(createElement) {
|
|
|
|
- return createElement(
|
|
|
|
- 'script',
|
|
|
|
- {
|
|
|
|
- attrs: {
|
|
|
|
- type: 'text/javascript',
|
|
|
|
- src: 'http://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
|
|
+ // 'wx': {
|
|
|
|
+ // render(createElement) {
|
|
|
|
+ // return createElement(
|
|
|
|
+ // 'script',
|
|
|
|
+ // {
|
|
|
|
+ // attrs: {
|
|
|
|
+ // type: 'text/javascript',
|
|
|
|
+ // src: 'http://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ // );
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
},
|
|
},
|
|
mounted: {},
|
|
mounted: {},
|
|
data() {
|
|
data() {
|
|
@@ -57,71 +58,90 @@
|
|
backgroundColor: "rgba(50,50,50,0.7)",
|
|
backgroundColor: "rgba(50,50,50,0.7)",
|
|
},
|
|
},
|
|
active: 0,
|
|
active: 0,
|
|
- share: require('../assets/post.png'),
|
|
|
|
|
|
+ share: [
|
|
|
|
+ require('../assets/posts/1.png'),
|
|
|
|
+ require('../assets/posts/2.png'),
|
|
|
|
+ require('../assets/posts/3.png'),
|
|
|
|
+ require('../assets/posts/4.png'),
|
|
|
|
+ ],
|
|
|
|
+ i: 0
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
Toindex() {
|
|
Toindex() {
|
|
this.$router.push('index');
|
|
this.$router.push('index');
|
|
},
|
|
},
|
|
- Toshare() {
|
|
|
|
- alert("请点击右上角,即可分享");
|
|
|
|
- Toast({
|
|
|
|
- message: "请点击右上角,即可分享"
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ // Toshare() {
|
|
|
|
+ // alert("请点击右上角,即可分享");
|
|
|
|
+ // Toast({
|
|
|
|
+ // message: "请点击右上角,即可分享"
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
created: function () {
|
|
created: function () {
|
|
if (!localStorage.getItem('frontend-userid')) {
|
|
if (!localStorage.getItem('frontend-userid')) {
|
|
this.$router.push('login');
|
|
this.$router.push('login');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ this.i = Math.ceil(Math.random() * 4) - 1;
|
|
|
|
+ console.log(this.i);
|
|
|
|
|
|
- BasicFunction.getSigned(['onMenuShareTimeline', 'onMenuShareAppMessage',], function () {
|
|
|
|
- wx.ready(function () { //需在用户可能点击分享按钮前就先调用
|
|
|
|
- wx.onMenuShareTimeline({
|
|
|
|
- title: '用一份礼物,邂逅一段故事', // 分享标题
|
|
|
|
- link: 'https://gift.fogice.com/?res=timeline', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
|
- imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
|
|
|
|
- success: function () {
|
|
|
|
- // 设置成功
|
|
|
|
- Toast({
|
|
|
|
- message: "成功分享到朋友圈"
|
|
|
|
- });
|
|
|
|
- this.$router.push('index');
|
|
|
|
- },
|
|
|
|
- cancel: function () {
|
|
|
|
- Toast({
|
|
|
|
- message: "分享失败,您取消了分享!"
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- wx.onMenuShareAppMessage({
|
|
|
|
- title: '用一份礼物,邂逅一段故事', // 分享标题
|
|
|
|
- desc: '嘿~我送出了一份圣诞礼物 要和我来交换吗', // 分享描述
|
|
|
|
- link: 'https://gift.fogice.com/?res=appmessage', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
|
- imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
|
|
|
|
- type: '', // 分享类型,music、video或link,不填默认为link
|
|
|
|
- dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
|
- success: function () {
|
|
|
|
-// 用户点击了分享后执行的回调函数
|
|
|
|
- Toast({
|
|
|
|
- message: "成功分享给朋友"
|
|
|
|
- });
|
|
|
|
- this.$router.push('index');
|
|
|
|
- },
|
|
|
|
- cancel: function () {
|
|
|
|
- Toast({
|
|
|
|
- message: "分享失败,您取消了分享!"
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- });
|
|
|
|
- },{});
|
|
|
|
|
|
+// BasicFunction.getSigned(['onMenuShareTimeline', 'onMenuShareAppMessage',], function () {
|
|
|
|
+// wx.ready(function () { //需在用户可能点击分享按钮前就先调用
|
|
|
|
+// wx.onMenuShareTimeline({
|
|
|
|
+// title: '用一份礼物,邂逅一段故事', // 分享标题
|
|
|
|
+// link: 'https://gift.fogice.com/?res=timeline', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
|
+// imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
|
|
|
|
+// success: function () {
|
|
|
|
+// // 设置成功
|
|
|
|
+// Toast({
|
|
|
|
+// message: "成功分享到朋友圈"
|
|
|
|
+// });
|
|
|
|
+// this.$router.push('index');
|
|
|
|
+// },
|
|
|
|
+// cancel: function () {
|
|
|
|
+// Toast({
|
|
|
|
+// message: "分享失败,您取消了分享!"
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// wx.onMenuShareAppMessage({
|
|
|
|
+// title: '用一份礼物,邂逅一段故事', // 分享标题
|
|
|
|
+// desc: '嘿~我送出了一份圣诞礼物 要和我来交换吗', // 分享描述
|
|
|
|
+// link: 'https://gift.fogice.com/?res=appmessage', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
|
+// imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
|
|
|
|
+// type: '', // 分享类型,music、video或link,不填默认为link
|
|
|
|
+// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
|
+// success: function () {
|
|
|
|
+// // 用户点击了分享后执行的回调函数
|
|
|
|
+// Toast({
|
|
|
|
+// message: "成功分享给朋友"
|
|
|
|
+// });
|
|
|
|
+// this.$router.push('index');
|
|
|
|
+// },
|
|
|
|
+// cancel: function () {
|
|
|
|
+// Toast({
|
|
|
|
+// message: "分享失败,您取消了分享!"
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// });
|
|
|
|
+// },{});
|
|
}
|
|
}
|
|
- };
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function down(selector, name) {
|
|
|
|
+ // 生成一个a元素
|
|
|
|
+ let a = document.createElement('a');
|
|
|
|
+ // 将a的download属性设置为我们想要下载的图片名称
|
|
|
|
+ a.download = name || 'pic';
|
|
|
|
+ // 将生成的URL设置为a.href属性
|
|
|
|
+ a.href = './boy.png';
|
|
|
|
+ // 触发a的单击事件
|
|
|
|
+ a.click();
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|