share_img.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="page">
  3. <view class="topBody">
  4. <view class="header">
  5. </view>
  6. <view class="myinfo">
  7. <image :src="myinfo.share_img" mode="widthFix"></image>
  8. <view style="margin-top: 24rpx;" class="numlist">
  9. <view class="num" @click="saveImg">
  10. <image src="../../static/w3/save.png" mode="widthFix"></image>
  11. <view class="name">保存</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="blankHeight"></view>
  16. </view>
  17. <!-- 提示框 -->
  18. <DialogBox ref="DialogBox"></DialogBox>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. components: {},
  24. data() {
  25. return {
  26. title: '',
  27. sel: 1,
  28. nodata: true,
  29. myinfo: {},
  30. list: [],
  31. }
  32. },
  33. onLoad() {
  34. // setTimeout(function() {
  35. // uni.setNavigationBarColor({
  36. // frontColor: '#ffffff',
  37. // backgroundColor: '#00000000',
  38. // animation: {
  39. // duration: 400,
  40. // timingFunc: 'easeIn'
  41. // }
  42. // })
  43. // }, 200);
  44. this.loadInfo();
  45. },
  46. onShow() {},
  47. methods: {
  48. onBack() {},
  49. chkSel() {
  50. if (this.sel == 1) {
  51. this.sel = 0;
  52. } else {
  53. this.sel = 1;
  54. }
  55. },
  56. loadInfo() {
  57. console.log({
  58. uuid: getApp().globalData.uuid,
  59. skey: getApp().globalData.skey
  60. });
  61. uni.request({
  62. url: this.$apiHost + '/Web/getinfo',
  63. data: {
  64. uuid: getApp().globalData.uuid,
  65. type: 'tuan'
  66. },
  67. header: {
  68. "content-type": "application/json", //自定义请求头信息
  69. },
  70. success: (res) => {
  71. console.log("----:", res.data);
  72. this.myinfo = res.data;
  73. },
  74. complete: (com) => {
  75. // uni.hideLoading();
  76. },
  77. fail: (e) => {
  78. console.log("----e:", e);
  79. }
  80. });
  81. },
  82. saveImg() {
  83. // #ifdef APP-PLUS
  84. let that = this;
  85. uni.showLoading()
  86. uni.downloadFile({
  87. url: that.myinfo.share_img,
  88. success: (res) => {
  89. if (res.statusCode === 200) {
  90. uni.saveImageToPhotosAlbum({
  91. filePath: res.tempFilePath,
  92. success: function() {
  93. uni.showToast({
  94. title: '已保存到相册'
  95. });
  96. },
  97. fail: function(e) {
  98. uni.showToast({
  99. icon: 'none',
  100. title: '保存失败'
  101. });
  102. },
  103. complete: function() {
  104. uni.hideLoading()
  105. }
  106. });
  107. } else {
  108. uni.hideLoading()
  109. uni.showToast({
  110. icon: 'none',
  111. title: '保存失败'
  112. })
  113. }
  114. },
  115. fail: function() {
  116. uni.hideLoading()
  117. uni.showToast({
  118. icon: 'none',
  119. title: '保存失败'
  120. })
  121. }
  122. })
  123. // #endif
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. @import 'share_img.scss';
  130. </style>