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.
 
 
 
 

143 lines
3.2 KiB

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