AI营销辅助 普强使用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

156 line
3.4 KiB

  1. <template>
  2. <view class="registerCode">
  3. <view class="registerImg">
  4. <image :src="qrCodeUrl+'/customer/getQrCode?page=pages/mine/registerForm&scene='+projectId" mode=""></image>
  5. </view>
  6. <view class="registerBtn" @click="down">
  7. 保存图片到手机
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. let domain = require("@/utils/domain")
  13. export default {
  14. data() {
  15. return {
  16. qrCodeUrl: "",
  17. projectId:""
  18. };
  19. },
  20. onShow() {
  21. this.projectId = uni.getStorageSync('buildingID').id;
  22. },
  23. methods: {
  24. down() {
  25. let url = this.qrCodeUrl+'/customer/getQrCode?page=pages/mine/registerForm&scene='+this.projectId
  26. console.log(url)
  27. uni.getImageInfo({
  28. src:url,
  29. success: (res) => {
  30. console.log(res)
  31. uni.saveImageToPhotosAlbum({
  32. filePath:res.path,
  33. success: () => {
  34. uni.showToast({
  35. title: "保存成功",
  36. icon: "none"
  37. })
  38. },
  39. fail: () => {
  40. uni.showToast({
  41. title: "保存失败",
  42. icon: "none"
  43. })
  44. }
  45. })
  46. }
  47. })
  48. // uni.getSetting({
  49. // success:(res)=> {
  50. // if(Object.keys(res.authSetting).length>0){
  51. // if(res.authSetting['scope.writePhotosAlbum']==undefined){
  52. // uni.openSetting({
  53. // success: (res) => {
  54. // console.log("设置权限1",res.authSetting)
  55. // }
  56. // })
  57. // }else{
  58. // if(!res.authSetting['scope.writePhotosAlbum']){
  59. // uni.openSetting({
  60. // success: (res) => {
  61. // console.log("设置权限1",res.authSetting)
  62. // }
  63. // })
  64. // }
  65. // }
  66. // }else{
  67. // return
  68. // }
  69. // }
  70. // })
  71. // uni.downloadFile({
  72. // url,
  73. // success: (res) => {
  74. // console.log(res)
  75. // uni.downloadFile({
  76. // url, //图片地址
  77. // success: (res) => {
  78. // console.log('downloadFile success', res)
  79. // if (res.statusCode === 200) {
  80. // console.log('downloadFile res.statusCode === 200', res)
  81. // uni.saveImageToPhotosAlbum({
  82. // filePath: res.tempFilePath,
  83. // success: function() {
  84. // uni.showToast({
  85. // title: "保存成功",
  86. // icon: "none"
  87. // })
  88. // },
  89. // fail: function() {
  90. // uni.showToast({
  91. // title: "保存失败",
  92. // icon: "none"
  93. // })
  94. // }
  95. // })
  96. // } else {
  97. // console.log('downloadFile res.statusCode !== 200', res)
  98. // }
  99. // }
  100. // })
  101. // }
  102. // });
  103. }
  104. },
  105. onLoad() {
  106. this.qrCodeUrl = domain.baseUrl
  107. // let urlData = {
  108. // page:'pages/mine/registerForm',
  109. // scene:'556',
  110. // width:300
  111. // }
  112. // uni.request({
  113. // url:this.qrCodeUrl + '/customer/getQrCode',
  114. // method:"POST",
  115. // data:urlData,
  116. // success(res) {
  117. // console.log(res)
  118. // }
  119. // })
  120. }
  121. }
  122. </script>
  123. <style lang="scss">
  124. .registerCode {
  125. .registerImg {
  126. width: 300rpx;
  127. height: 300rpx;
  128. margin: 130rpx auto;
  129. image {
  130. width: 100%;
  131. height: 100%;
  132. }
  133. }
  134. .registerBtn {
  135. width: 80%;
  136. height: 80rpx;
  137. background: #3384fd;
  138. color: #FFFFFF;
  139. border-radius: 10rpx;
  140. line-height: 80rpx;
  141. text-align: center;
  142. font-size: 30rpx;
  143. margin: 50rpx auto;
  144. }
  145. }
  146. </style>