index.vue 1.9 KB

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