index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <diyC ref="diy" v-if="isDiy" @pullResh="pullResh"></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. onPullDownRefresh() {
  26. this.$refs.diy.pullResh();
  27. // uni.stopPullDownRefresh()
  28. },
  29. methods: {
  30. // 微信分享;
  31. setOpenShare: function() {
  32. let that = this;
  33. // getShare().then((res) => {
  34. // let data = res.data;
  35. // this.shareInfo = data;
  36. // // #ifdef H5
  37. // let url = location.href;
  38. // if (this.$store.state.app.uid) {
  39. // url =
  40. // url.indexOf("?") === -1 ?
  41. // url + "?spread=" + this.$store.state.app.uid :
  42. // url + "&spread=" + this.$store.state.app.uid;
  43. // }
  44. // if (that.$wechat.isWeixin()) {
  45. // let configAppMessage = {
  46. // desc: data.synopsis,
  47. // title: data.title,
  48. // link: url,
  49. // imgUrl: data.img,
  50. // };
  51. // that.$wechat.wechatEvevt(
  52. // ["updateAppMessageShareData", "updateTimelineShareData"],
  53. // configAppMessage
  54. // );
  55. // }
  56. // // #endif
  57. // });
  58. },
  59. },
  60. // onReachBottom: function() {
  61. // if (this.isDiy) {
  62. // this.$refs.diy.onsollBotton()
  63. // }
  64. // },
  65. // #ifdef MP
  66. //发送给朋友
  67. onShareAppMessage(res) {
  68. // 此处的distSource为分享者的部分信息,需要传递给其他人
  69. let that = this;
  70. return {
  71. title: this.shareInfo.title,
  72. path: "/pages/index/index",
  73. imageUrl: this.shareInfo.img,
  74. };
  75. },
  76. //分享到朋友圈
  77. onShareTimeline() {
  78. return {
  79. title: this.shareInfo.title,
  80. imageUrl: this.shareInfo.img,
  81. };
  82. },
  83. // #endif
  84. }
  85. </script>
  86. <style>
  87. </style>