test.vue 1.3 KB

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