index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <diyC ref="diy" v-if="isDiy"></diyC>
  3. </template>
  4. <script>
  5. import diyC from './diy/index_mall.vue'
  6. export default {
  7. data() {
  8. return {
  9. isDiy: uni.getStorageSync('is_diy'),
  10. shareInfo: {}
  11. }
  12. },
  13. components: {
  14. diyC
  15. },
  16. onShow() {
  17. uni.$on('is_diy', (data) => {
  18. this.isDiy = data
  19. })
  20. this.setOpenShare();
  21. },
  22. onHide() {
  23. // this.isDiy = -1
  24. },
  25. methods: {
  26. // 微信分享;
  27. setOpenShare: function() {
  28. let that = this;
  29. // getShare().then((res) => {
  30. // let data = res.data;
  31. // this.shareInfo = data;
  32. // // #ifdef H5
  33. // let url = location.href;
  34. // if (this.$store.state.app.uid) {
  35. // url =
  36. // url.indexOf("?") === -1 ?
  37. // url + "?spread=" + this.$store.state.app.uid :
  38. // url + "&spread=" + this.$store.state.app.uid;
  39. // }
  40. // if (that.$wechat.isWeixin()) {
  41. // let configAppMessage = {
  42. // desc: data.synopsis,
  43. // title: data.title,
  44. // link: url,
  45. // imgUrl: data.img,
  46. // };
  47. // that.$wechat.wechatEvevt(
  48. // ["updateAppMessageShareData", "updateTimelineShareData"],
  49. // configAppMessage
  50. // );
  51. // }
  52. // // #endif
  53. // });
  54. },
  55. },
  56. // onReachBottom: function() {
  57. // if (this.isDiy) {
  58. // this.$refs.diy.onsollBotton()
  59. // }
  60. // },
  61. // #ifdef MP
  62. //发送给朋友
  63. onShareAppMessage(res) {
  64. // 此处的distSource为分享者的部分信息,需要传递给其他人
  65. let that = this;
  66. return {
  67. title: this.shareInfo.title,
  68. path: "/pages/index/index",
  69. imageUrl: this.shareInfo.img,
  70. };
  71. },
  72. //分享到朋友圈
  73. onShareTimeline() {
  74. return {
  75. title: this.shareInfo.title,
  76. imageUrl: this.shareInfo.img,
  77. };
  78. },
  79. // #endif
  80. }
  81. </script>
  82. <style>
  83. </style>