steward.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view>
  3. <view class="top-wrapper">
  4. <view>添加鲸致管家</view>
  5. </view>
  6. <view class="qrcode-wrapper">
  7. <image :src="shareImage" class="qr-code" mode="aspectFill" ontap="saveImage"></image>
  8. </view>
  9. <view class="img-tips">点击保存二维码</view>
  10. <view class="view-tips">查看引荐人信息、订单咨询</view>
  11. </view>
  12. </template>
  13. <script>
  14. const util = require('../../../../utils/util.js');
  15. const api = require('../../../../config/api.js');
  16. const app = getApp();
  17. export default {
  18. data() {
  19. return {
  20. shareImage: ''
  21. };
  22. }
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */,
  26. onLoad: function (options) {
  27. this.setData({
  28. shareImage: app.globalData.shareImage
  29. });
  30. },
  31. /**
  32. * 生命周期函数--监听页面初次渲染完成
  33. */
  34. onReady: function () {},
  35. /**
  36. * 生命周期函数--监听页面显示
  37. */
  38. onShow: function () {},
  39. /**
  40. * 生命周期函数--监听页面隐藏
  41. */
  42. onHide: function () {},
  43. /**
  44. * 生命周期函数--监听页面卸载
  45. */
  46. onUnload: function () {},
  47. /**
  48. * 页面相关事件处理函数--监听用户下拉动作
  49. */
  50. onPullDownRefresh: function () {},
  51. /**
  52. * 页面上拉触底事件的处理函数
  53. */
  54. onReachBottom: function () {},
  55. /**
  56. * 用户点击右上角分享
  57. */
  58. onShareAppMessage: function () {},
  59. methods: {
  60. saveImage() {
  61. uni.showLoading({
  62. title: '图片保存中'
  63. });
  64. uni.downloadFile({
  65. url: this.shareImage,
  66. timeout: 3000,
  67. success: function (res) {
  68. uni.hideLoading();
  69. uni.saveImageToPhotosAlbum({
  70. filePath: res.tempFilePath,
  71. success(res) {
  72. uni.showToast({
  73. title: '二维码图片已保存到您的相册',
  74. icon: 'none',
  75. duration: 2000
  76. });
  77. },
  78. fail(res) {
  79. uni.hideLoading();
  80. uni.showToast({
  81. title: '网络或授权问题 图片保存失败 请重试',
  82. icon: 'none',
  83. duration: 2000
  84. });
  85. }
  86. });
  87. },
  88. fail: function () {
  89. uni.hideLoading();
  90. }
  91. });
  92. }
  93. }
  94. };
  95. </script>
  96. <style>
  97. .top-wrapper {
  98. background: url('https://jzmall.lifejingzhi.com/file/jzmall/weixin/recommend-bd.jpg') no-repeat center;
  99. background-size: cover;
  100. width: 750rpx;
  101. height: 775rpx;
  102. padding: 46rpx 0 0;
  103. }
  104. .top-wrapper view {
  105. font-size: 48rpx;
  106. font-weight: bold;
  107. text-align: center;
  108. color: #fff;
  109. }
  110. .qrcode-wrapper {
  111. margin: -125rpx auto 0;
  112. width: 250rpx;
  113. height: 250rpx;
  114. }
  115. .qr-code {
  116. width: 250rpx;
  117. height: 250rpx;
  118. padding: 4rpx;
  119. border-radius: 4rpx;
  120. background: #fff;
  121. }
  122. .img-tips {
  123. text-align: center;
  124. font-size: 16rpx;
  125. margin: 18rpx 0 0;
  126. }
  127. .view-tips {
  128. color: #2a2a2a;
  129. margin-top: 76rpx;
  130. font-size: 32rpx;
  131. text-align: center;
  132. }
  133. </style>