inviteShop.vue 2.7 KB

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