shareCardPage.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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 v-if="shareUrl" class="shareCard" :src="shareUrl" mode="widthFix"></image>
  16. <view class="shareCard" v-else>
  17. <image style="width: 100%;height: 100%;" src="../../static/icons/share_img_zhanwei.png" mode="widthFix"></image>
  18. <view class="share_card_loading">
  19. <view class="loader">
  20. <svg class="circular" viewBox="25 25 50 50">
  21. <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" />
  22. </svg>
  23. </view>
  24. 正在为您加载分享图
  25. </view>
  26. </view>
  27. </view>
  28. <view class="share_copy_txt">
  29. 长按图片保存至本地
  30. </view>
  31. <view class="share_copy_notice">
  32. 友情提醒,认证业主并通过后再分享才会产生相应的收益
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. shareUrl:"",
  41. type:"",
  42. projectId:"",
  43. page:"",
  44. shareRemark:"",
  45. };
  46. },
  47. created() {
  48. },
  49. onLoad(param) {
  50. this.page = param.page;
  51. this.projectId =param.projectId;
  52. this.type=param.type;
  53. if(this.projectId){
  54. this.queryProjectByH5();
  55. this.getShareCard();
  56. }else {
  57. this.queryProtocolConfigView();
  58. }
  59. },
  60. methods:{
  61. async queryProtocolConfigView(){
  62. let res = await this.$myRequest({
  63. url: "/project/queryProtocolConfigView",
  64. data: {},
  65. })
  66. if(res.data.success){
  67. this.shareUrl = res.data.single.shareImage;
  68. this.shareRemark = res.data.single.shareRemark||''
  69. }
  70. },
  71. async getShareCard(){
  72. let ret = await this.$myRequest({
  73. url: "/share/shareCard",
  74. data: {
  75. "page": this.page,
  76. "projectId": this.projectId,
  77. "type":this.type
  78. }
  79. })
  80. if (ret.data.success) {
  81. this.shareUrl = ret.data.single;
  82. }
  83. },
  84. async queryProjectByH5(){
  85. let ret = await this.$myRequest({
  86. url: "/project/queryProjectByH5",
  87. data: {
  88. "projectId": this.projectId,
  89. }
  90. })
  91. if (ret.data.success) {
  92. this.shareRemark = ret.data.single.shareRemark||''
  93. }
  94. },
  95. back(){
  96. uni.navigateBack({
  97. delta:1
  98. })
  99. },
  100. copy(){
  101. let textarea = document.createElement("textarea")
  102. textarea.value = this.shareRemark
  103. textarea.readOnly = "readOnly"
  104. document.body.appendChild(textarea)
  105. textarea.select() // 选中文本内容
  106. textarea.setSelectionRange(0, this.shareRemark.length)
  107. let result = document.execCommand("copy")
  108. textarea.remove()
  109. uni.showToast({
  110. icon:"none",
  111. title:"复制成功"
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss">
  118. .share_body{
  119. display: flex;
  120. flex-direction: column;
  121. justify-content: center;
  122. align-items: center;
  123. width: 100%;
  124. background: #4e4e4e;
  125. height: 100vh;
  126. }
  127. .share_card_info{
  128. width: 550rpx;
  129. display: flex;
  130. flex-direction: column;
  131. align-items: center;
  132. background-color: #FFFFFF;
  133. border-radius: 10rpx;
  134. .share_title{
  135. width: 100%;
  136. display: flex;
  137. justify-content: center;
  138. align-items: center;
  139. margin-top: 30rpx;
  140. position: relative;
  141. .title{
  142. width: 292rpx;
  143. height: 34rpx;
  144. }
  145. .close{
  146. width: 24rpx;
  147. height: 24rpx;
  148. position: absolute;
  149. right: 20rpx;
  150. top: 5rpx;
  151. }
  152. }
  153. .share_desc{
  154. width: calc(100% - 60rpx);
  155. font-size: 24rpx;
  156. font-family: Verdana, Verdana-Regular;
  157. font-weight: 400;
  158. text-align: left;
  159. color: #7f7f7f;
  160. margin-top: 22rpx;
  161. box-sizing: border-box;
  162. text-overflow: -o-ellipsis-lastline;
  163. overflow: hidden;
  164. text-overflow: ellipsis;
  165. display: -webkit-box;
  166. -webkit-line-clamp: 2;
  167. line-clamp: 2;
  168. -webkit-box-orient: vertical;
  169. }
  170. .share_copy{
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. margin-top: 12rpx;
  175. .icon_share_copy{
  176. width: 24rpx;
  177. height: 24rpx;
  178. }
  179. .share_txt{
  180. font-size: 24rpx;
  181. font-family: Verdana, Verdana-Regular;
  182. font-weight: 400;
  183. text-align: left;
  184. color: #2c2c2c;
  185. margin-left: 6rpx;
  186. }
  187. }
  188. .shareCard{
  189. width: 490rpx;
  190. margin-top: 10rpx;
  191. margin-bottom: 30rpx;
  192. position: relative;
  193. .share_card_loading{
  194. position: absolute;
  195. left: 50%;
  196. top: 50%;
  197. transform: translate(-50%,-50%);
  198. font-size: 24rpx;
  199. font-family: Verdana, Verdana-Regular;
  200. font-weight: 400;
  201. text-align: center;
  202. color: #919191;
  203. }
  204. }
  205. }
  206. .share_copy_txt{
  207. font-size: 28rpx;
  208. font-family: Verdana, Verdana-Regular;
  209. font-weight: 400;
  210. text-align: center;
  211. color: #ffffff;
  212. margin-top: 40rpx;
  213. }
  214. .share_copy_notice{
  215. font-size: 22rpx;
  216. font-family: Verdana, Verdana-Regular;
  217. font-weight: 400;
  218. text-align: center;
  219. color: #919191;
  220. }
  221. .loader {
  222. position: relative;
  223. margin: 0 auto;
  224. width: 70rpx;
  225. height: 70rpx;
  226. top: 50%;
  227. transform: translateY(-50%);
  228. &:before {
  229. content: '';
  230. display: block;
  231. padding-top: 100%;
  232. }
  233. }
  234. .circular {
  235. animation: rotate 2s linear infinite;
  236. height: 100%;
  237. transform-origin: center center;
  238. width: 100%;
  239. position: absolute;
  240. top: 0;
  241. bottom: 0;
  242. left: 0;
  243. right: 0;
  244. margin: auto;
  245. }
  246. .path {
  247. stroke-dasharray: 1, 200;
  248. stroke-dashoffset: 0;
  249. animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
  250. stroke-linecap: round;
  251. }
  252. @keyframes rotate {
  253. 100% {
  254. transform: rotate(360deg);
  255. }
  256. }
  257. @keyframes dash {
  258. 0% {
  259. stroke-dasharray: 1, 200;
  260. stroke-dashoffset: 0;
  261. }
  262. 50% {
  263. stroke-dasharray: 89, 200;
  264. stroke-dashoffset: -35rpx;
  265. }
  266. 100% {
  267. stroke-dasharray: 89, 200;
  268. stroke-dashoffset: -124rpx;
  269. }
  270. }
  271. @keyframes color {
  272. 100%,
  273. 0% {
  274. stroke: #919191;
  275. }
  276. 40% {
  277. stroke: #919191;
  278. }
  279. 66% {
  280. stroke: #919191;
  281. }
  282. 80%,
  283. 90% {
  284. stroke: #919191;
  285. }
  286. }
  287. </style>