share.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="isshareShow" v-show="isshareShow">
  3. <!-- <u-mask :show="true" class="flex-items-plus flex-row"> -->
  4. <view class="share-box">
  5. <view class="inactive-box flex-items-plus flex-column-plus">
  6. <view class="flex-row-plus">
  7. <view class="fs36 mar-left-60">邀请好友</view>
  8. <view @click="cancel" class="close-btn">
  9. <image class="close-icon" src="../static/images/close.png"></image>
  10. </view>
  11. </view>
  12. <view class="mar-top-50 flex-row-plus">
  13. <!-- <view class="flex-column-plus flex-items-plus">
  14. <view class="weixin-box flex-items-plus">
  15. <image src="../static/img/weixin2x.png"></image>
  16. </view>
  17. <label class="fs24 mar-top-20">微信</label>
  18. </view>
  19. <view class="flex-column-plus flex-items-plus mar-left-50">
  20. <view class="weixin-box flex-items-plus">
  21. <image src="../static/images/qq2x.png"></image>
  22. </view>
  23. <label class="fs24 mar-top-20">QQ</label>
  24. </view>
  25. <view class="flex-column-plus flex-items-plus mar-left-50">
  26. <view class="weixin-box flex-items-plus">
  27. <image src="../static/images/weibo2x.png"></image>
  28. </view>
  29. <label class="fs24 mar-top-20">微博</label>
  30. </view> -->
  31. <view class="copy-color " :data-clipboard-text="url" @click="copy">
  32. <view class="weixin-box flex-items-plus">
  33. </view>
  34. <label class="fs24 mar-top-20">链接</label>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- </u-mask> -->
  40. </view>
  41. </template>
  42. <script>
  43. import ClipboardJS from "clipboard"
  44. import UImage from "../uview-ui/components/u-image/u-image";
  45. export default {
  46. components: {UImage},
  47. props:{
  48. isshareShow:{
  49. type:Boolean,
  50. dafault:false
  51. },
  52. url:{
  53. type:String,
  54. dafault:''
  55. }
  56. },
  57. name:"share",
  58. data() {
  59. return {
  60. };
  61. },
  62. methods:{
  63. cancel(){
  64. this.$emit('shareCancel')
  65. },
  66. copy() {
  67. // #ifndef H5
  68. uni.setClipboardData({
  69. data: this.url,
  70. success: function () {
  71. uni.showToast({
  72. title:'复制成功',
  73. icon:'success'
  74. })
  75. }
  76. });
  77. // #endif
  78. // #ifdef H5
  79. let clipboard = new ClipboardJS('.copy-color');
  80. clipboard.on('success', function (e) {
  81. uni.showToast({
  82. title:'复制成功',
  83. icon:'success'
  84. })
  85. clipboard.destroy();
  86. })
  87. clipboard.on('error', function (e) {
  88. uni.showToast({
  89. title:'复制失败',
  90. icon:'success'
  91. })
  92. clipboard.destroy();
  93. })
  94. // #endif
  95. },
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .isshareShow{
  101. width: 100%;
  102. height: 100%;
  103. position: absolute;
  104. top: 0;
  105. left: 0;
  106. background-color: #636363;
  107. display: flex;
  108. justify-content: center;
  109. align-items: center;
  110. z-index: 999;
  111. }
  112. .close-btn{
  113. position: relative;
  114. left: 120rpx;
  115. }
  116. .close-icon{
  117. width: 46rpx;
  118. height: 46rpx;
  119. }
  120. .copy-color{
  121. display: flex;
  122. justify-content: center;
  123. align-items:center;
  124. flex-direction: column;
  125. }
  126. .share-box{
  127. background-color: #FFFFFF;
  128. width: 550rpx;
  129. height: 380rpx;
  130. border-radius: 20rpx;
  131. }
  132. .inactive-box{
  133. padding: 40rpx 40rpx;
  134. .weixin-box{
  135. width: 100rpx;
  136. height: 100rpx;
  137. border-radius: 50%;
  138. background: url("../static/img/lianjie.png") no-repeat center center;
  139. background-size: contain;
  140. image{
  141. width: 55rpx;
  142. height: 55rpx;
  143. }
  144. }
  145. }
  146. </style>