shareCardPage.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="share_body">
  3. <view class="share_card_info">
  4. <view class="share_title">
  5. <image class="title" src="../../static/icons/icon_share_title.png" mode=""></image>
  6. <image @click="back" class="close" src="../../static/icons/icon_close_share.png" mode=""></image>
  7. </view>
  8. <view class="share_desc">
  9. {{shareRemark}}
  10. </view>
  11. <view class="share_copy" @click="copy" v-if="shareRemark">
  12. <image class="icon_share_copy" src="../../static/icons/icon_copy.png" mode=""></image>
  13. <text class="share_txt">复制发圈</text>
  14. </view>
  15. <image class="shareCard" :src="shareUrl" mode="widthFix"></image>
  16. </view>
  17. <view class="share_copy_txt">
  18. 长按图片保存至本地
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. shareUrl:"",
  27. type:"",
  28. projectId:"",
  29. page:"",
  30. shareRemark:"",
  31. };
  32. },
  33. created() {
  34. },
  35. onLoad(param) {
  36. this.page = param.page;
  37. this.projectId =param.projectId;
  38. this.type=param.type;
  39. this.getShareCard();
  40. this.queryProjectByH5();
  41. },
  42. methods:{
  43. async getShareCard(){
  44. uni.showLoading({
  45. title:"分享图片生成中"
  46. })
  47. let ret = await this.$myRequest({
  48. url: "/share/shareCard",
  49. data: {
  50. "page": this.page,
  51. "projectId": this.projectId,
  52. "type":this.type
  53. }
  54. })
  55. if (ret.data.success) {
  56. this.shareUrl = ret.data.single;
  57. uni.hideLoading()
  58. }else{
  59. uni.hideLoading()
  60. }
  61. },
  62. async queryProjectByH5(){
  63. let ret = await this.$myRequest({
  64. url: "/project/queryProjectByH5",
  65. data: {
  66. "projectId": this.projectId,
  67. }
  68. })
  69. if (ret.data.success) {
  70. this.shareRemark = ret.data.single.shareRemark||''
  71. }
  72. },
  73. back(){
  74. uni.navigateBack({
  75. delta:1
  76. })
  77. },
  78. copy(){
  79. uni.setClipboardData({
  80. data:this.shareRemark,
  81. success() {
  82. uni.showToast({
  83. icon:"none",
  84. title:"复制成功"
  85. })
  86. }
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. .share_body{
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: center;
  97. align-items: center;
  98. width: 100%;
  99. background: #4e4e4e;
  100. height: 100vh;
  101. }
  102. .share_card_info{
  103. width: 550rpx;
  104. display: flex;
  105. flex-direction: column;
  106. align-items: center;
  107. background-color: #FFFFFF;
  108. border-radius: 10rpx;
  109. .share_title{
  110. width: 100%;
  111. display: flex;
  112. justify-content: center;
  113. align-items: center;
  114. margin-top: 30rpx;
  115. position: relative;
  116. .title{
  117. width: 292rpx;
  118. height: 34rpx;
  119. }
  120. .close{
  121. width: 24rpx;
  122. height: 24rpx;
  123. position: absolute;
  124. right: 20rpx;
  125. top: 5rpx;
  126. }
  127. }
  128. .share_desc{
  129. width: calc(100% - 60rpx);
  130. font-size: 24rpx;
  131. font-family: Verdana, Verdana-Regular;
  132. font-weight: 400;
  133. text-align: left;
  134. color: #7f7f7f;
  135. margin-top: 22rpx;
  136. box-sizing: border-box;
  137. text-overflow: -o-ellipsis-lastline;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. display: -webkit-box;
  141. -webkit-line-clamp: 2;
  142. line-clamp: 2;
  143. -webkit-box-orient: vertical;
  144. }
  145. .share_copy{
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. margin-top: 12rpx;
  150. .icon_share_copy{
  151. width: 24rpx;
  152. height: 24rpx;
  153. }
  154. .share_txt{
  155. font-size: 24rpx;
  156. font-family: Verdana, Verdana-Regular;
  157. font-weight: 400;
  158. text-align: left;
  159. color: #2c2c2c;
  160. margin-left: 6rpx;
  161. }
  162. }
  163. .shareCard{
  164. width: 490rpx;
  165. margin-top: 10rpx;
  166. margin-bottom: 30rpx;
  167. }
  168. }
  169. .share_copy_txt{
  170. font-size: 28rpx;
  171. font-family: Verdana, Verdana-Regular;
  172. font-weight: 400;
  173. text-align: center;
  174. color: #ffffff;
  175. margin-top: 40rpx;
  176. }
  177. </style>