inviteShop.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 { applyInviteGhsPoster } 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. applyInviteGhsPoster().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?hdShopAdminId='+this.loginInfo.shopAdminId)
  69. getWeixinId().then(res => {
  70. uni.navigateToMiniProgram({
  71. appId: res.data.ghs.miniAppId,
  72. path: 'pagesClient/official/index?hdShopAdminId='+this.loginInfo.shopAdminId,
  73. //develop 开发版 trial 体验版 release 正式版
  74. envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
  75. extraData: {},
  76. success(res) {
  77. // 打开成功
  78. }
  79. })
  80. })
  81. },
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .app-content{
  87. overflow: hidden;
  88. }
  89. .img_box{
  90. height: 450upx;
  91. box-sizing: border-box;
  92. &>.img_url{
  93. height: 450upx;
  94. width: 450upx;
  95. margin: 100upx auto;
  96. }
  97. }
  98. // 按钮
  99. .confirm-btn {
  100. width: calc(100% - 60px);
  101. margin: 100px 30px 20px;
  102. .admin-button-com {
  103. width: 100%;
  104. }
  105. }
  106. // 按钮
  107. .confirm-btn1 {
  108. width: calc(100% - 60px);
  109. margin: 50px 30px 20px;
  110. .admin-button-com {
  111. width: 100%;
  112. }
  113. }
  114. </style>