inviteHdShop.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="app-content">
  3. <view class="img_box">
  4. <image :src="imgUrl" class="img_url"></image>
  5. </view>
  6. <div class="confirm-btn">
  7. <button class="admin-button-com big blue" @click="downloadImg">保存图片分享</button>
  8. </div>
  9. <!-- #ifdef MP-WEIXIN -->
  10. <div class="confirm-btn1">
  11. <button class="admin-button-com big blue" @click="goToMallPt()">直接打开分享</button>
  12. </div>
  13. <!-- #endif -->
  14. </view>
  15. </template>
  16. <script>
  17. import { applyInviteHdPoster } from '@/api/apply/index'
  18. import { getWeixinId } from "@/api/invite/index";
  19. import { mapGetters } from "vuex";
  20. export default {
  21. data() {
  22. return {
  23. imgUrl: '',
  24. getappIdList: {}
  25. }
  26. },
  27. computed: {
  28. ...mapGetters({ loginInfo: "getLoginInfo" })
  29. },
  30. methods: {
  31. init() {
  32. this.getImg()
  33. getWeixinId().then(res => {
  34. this.getappIdList = res.data
  35. });
  36. },
  37. downloadImg() {
  38. uni.downloadFile({
  39. url: this.imgUrl,
  40. success: (res) => {
  41. console.log(res)
  42. uni.saveImageToPhotosAlbum({
  43. filePath: res.tempFilePath,
  44. success: function() {
  45. uni.showToast({ title: '保存成功', icon: 'none' })
  46. },
  47. fail: (res) => {
  48. uni.showToast({ title: '保存失败', icon: 'none' })
  49. }
  50. })
  51. },
  52. })
  53. },
  54. getImg() {
  55. applyInviteHdPoster().then(res => {
  56. console.log(res)
  57. this.imgUrl = res.data.imgUrl
  58. }).catch(err => {})
  59. },
  60. goToMallPt () {
  61. //查看分享的路径,不要删除 shish 20210517
  62. console.log('pagesClient/official/index','hdShopAdminId='+ this.loginInfo.shopAdminId)
  63. this.pageTo({url: `/pagesClient/official/index?hdShopAdminId=${this.loginInfo.shopAdminId}`})
  64. },
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .app-content{
  70. overflow: hidden;
  71. }
  72. .img_box{
  73. height: 450upx;
  74. box-sizing: border-box;
  75. &>.img_url{
  76. height: 450upx;
  77. width: 450upx;
  78. margin: 100upx auto;
  79. }
  80. }
  81. // 按钮
  82. .confirm-btn {
  83. width: calc(100% - 60upx);
  84. margin: 100upx 30upx 20upx;
  85. .admin-button-com {
  86. width: 100%;
  87. }
  88. }
  89. // 按钮
  90. .confirm-btn1 {
  91. width: calc(100% - 60upx);
  92. margin: 50upx 30upx 20upx;
  93. .admin-button-com {
  94. width: 100%;
  95. }
  96. }
  97. </style>