inviteImg.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="box">
  3. <image class="inviteImg" :src="image" ></image>
  4. <view class="lyy-b-but">长按图片下载</view>
  5. <!-- <view class="lyy-b-but" @click="domImg">点击下载图片</view> -->
  6. </view>
  7. </template>
  8. <script>
  9. import { getCombinationPoster } from '@/api/groupBooking.js';
  10. import { mapState } from 'vuex';
  11. export default {
  12. data() {
  13. return {
  14. image:'',//海报
  15. ptId:'',//拼团id
  16. }
  17. },
  18. computed: {
  19. ...mapState(['baseURL','urlFile'])
  20. },
  21. onLoad(option) {
  22. // 保存拼团id
  23. this.ptId = option.id;
  24. // 保存团长id
  25. this.spread = option.spread;
  26. // 加载分享图
  27. this.getCombinationPoster();
  28. },
  29. methods: {
  30. // 加载海报
  31. getCombinationPoster() {
  32. let obj = this;
  33. getCombinationPoster({
  34. id:obj.ptId,
  35. // #ifdef H5|APP-PLUS
  36. url:obj.baseURL+obj.urlFile+'/#/pages/groupBooking/detail?id='+obj.ptId+'&spread='+obj.spread,
  37. from:'wechat',//来源wechat公众号
  38. // #endif
  39. // #ifdef MP
  40. from:'routine',//来源routine小程序
  41. url:'/pages/groupBooking/detail?id='+obj.ptId
  42. // #endif
  43. }).then((e) => {
  44. obj.image = e.data.url;
  45. }).catch((e) => {
  46. console.log(e);
  47. })
  48. }
  49. },
  50. }
  51. </script>
  52. <style lang="scss">
  53. page{
  54. background-color: #FFFFFF;
  55. height: 100%;
  56. }
  57. .box{
  58. .inviteImg{
  59. width: 750rpx;
  60. height: 1200rpx;
  61. }
  62. }
  63. .lyy-b-but {
  64. height: 80rpx;
  65. background: #fc5b62;
  66. border-radius: 100rpx;
  67. text-align: center;
  68. color: white;
  69. line-height: 80rpx;
  70. font-size: 32rpx;
  71. margin: 0 100rpx;
  72. }
  73. </style>