auth.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view >
  3. <view style="margin-top: 50rpx;" class="center flex-direction">
  4. <image
  5. @error="error"
  6. style="width: 600rpx;height: 600rpx;"
  7. :src="src"
  8. mode="widthFix"></image>
  9. <view class="center margin-top-50">
  10. <text class="text-base">*请保存二维码,然后到微信中扫码关注该公众号</text>
  11. </view>
  12. </view>
  13. <view class="" style="position: fixed;bottom: 150rpx;width: 100%;">
  14. <view class="center">
  15. <view @click="saveImg" class="cu-btn flex radius text-lg"
  16. style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 90%;">
  17. <u-icon name="download"></u-icon>
  18. <text class="margin-left-20">保存到相册</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name: '',
  27. data() {
  28. return {
  29. src:''
  30. };
  31. },
  32. onLoad(options) {
  33. this.src=options.src
  34. if (this.$isEmpty(this.src)) {
  35. this.$dialog.showModalAndBack('二维码获取失败')
  36. return
  37. }
  38. if (this.$isNotEmpty(this.src) && this.src.indexOf('https')<0) {
  39. this.src=this.src.replace('http','https')
  40. }
  41. },
  42. methods:{
  43. error(){
  44. this.$dialog.showModalAndBack('二维码加载失败')
  45. },
  46. async saveImg(){
  47. let res=await this.$mpi.downloadFile(this.src)
  48. this.$mpi.saveImg(res)
  49. }
  50. }
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. </style>