shareCardPage.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. page{
  119. width: 100%;
  120. height: 100%;
  121. background: #4e4e4e;
  122. }
  123. .share_body{
  124. display: flex;
  125. flex-direction: column;
  126. justify-content: center;
  127. align-items: center;
  128. width: 100%;
  129. background: #4e4e4e;
  130. }
  131. .share_card_info{
  132. width: 550rpx;
  133. display: flex;
  134. flex-direction: column;
  135. align-items: center;
  136. background-color: #FFFFFF;
  137. border-radius: 10rpx;
  138. margin-top: 60rpx;
  139. .share_title{
  140. width: 100%;
  141. display: flex;
  142. justify-content: center;
  143. align-items: center;
  144. margin-top: 30rpx;
  145. position: relative;
  146. .title{
  147. width: 292rpx;
  148. height: 34rpx;
  149. }
  150. .close{
  151. width: 24rpx;
  152. height: 24rpx;
  153. position: absolute;
  154. right: 20rpx;
  155. top: 5rpx;
  156. }
  157. }
  158. .share_desc{
  159. width: calc(100% - 60rpx);
  160. font-size: 24rpx;
  161. font-family: Verdana, Verdana-Regular;
  162. font-weight: 400;
  163. text-align: left;
  164. color: #7f7f7f;
  165. margin-top: 22rpx;
  166. box-sizing: border-box;
  167. text-overflow: -o-ellipsis-lastline;
  168. overflow: hidden;
  169. text-overflow: ellipsis;
  170. display: -webkit-box;
  171. -webkit-line-clamp: 2;
  172. line-clamp: 2;
  173. -webkit-box-orient: vertical;
  174. }
  175. .share_copy{
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. margin-top: 12rpx;
  180. .icon_share_copy{
  181. width: 24rpx !important;
  182. height: 24rpx !important;
  183. }
  184. .share_txt{
  185. font-size: 24rpx;
  186. font-family: Verdana, Verdana-Regular;
  187. font-weight: 400;
  188. text-align: left;
  189. color: #2c2c2c;
  190. margin-left: 6rpx;
  191. }
  192. }
  193. .shareCard{
  194. width: 490rpx;
  195. margin-top: 10rpx;
  196. margin-bottom: 30rpx;
  197. position: relative;
  198. .share_card_loading{
  199. position: absolute;
  200. left: 50%;
  201. top: 50%;
  202. transform: translate(-50%,-50%);
  203. font-size: 24rpx;
  204. font-family: Verdana, Verdana-Regular;
  205. font-weight: 400;
  206. text-align: center;
  207. color: #919191;
  208. }
  209. }
  210. }
  211. .share_copy_txt{
  212. font-size: 28rpx;
  213. font-family: Verdana, Verdana-Regular;
  214. font-weight: 400;
  215. text-align: center;
  216. color: #ffffff;
  217. margin-top: 40rpx;
  218. }
  219. .share_copy_notice{
  220. font-size: 22rpx;
  221. font-family: Verdana, Verdana-Regular;
  222. font-weight: 400;
  223. text-align: center;
  224. color: #919191;
  225. margin-bottom: 40rpx;
  226. }
  227. .loader {
  228. position: relative;
  229. margin: 0 auto;
  230. width: 70rpx;
  231. height: 70rpx;
  232. top: 50%;
  233. transform: translateY(-50%);
  234. &:before {
  235. content: '';
  236. display: block;
  237. padding-top: 100%;
  238. }
  239. }
  240. .circular {
  241. animation: rotate 2s linear infinite;
  242. height: 100%;
  243. transform-origin: center center;
  244. width: 100%;
  245. position: absolute;
  246. top: 0;
  247. bottom: 0;
  248. left: 0;
  249. right: 0;
  250. margin: auto;
  251. }
  252. .path {
  253. stroke-dasharray: 1, 200;
  254. stroke-dashoffset: 0;
  255. animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
  256. stroke-linecap: round;
  257. }
  258. @keyframes rotate {
  259. 100% {
  260. transform: rotate(360deg);
  261. }
  262. }
  263. @keyframes dash {
  264. 0% {
  265. stroke-dasharray: 1, 200;
  266. stroke-dashoffset: 0;
  267. }
  268. 50% {
  269. stroke-dasharray: 89, 200;
  270. stroke-dashoffset: -35rpx;
  271. }
  272. 100% {
  273. stroke-dasharray: 89, 200;
  274. stroke-dashoffset: -124rpx;
  275. }
  276. }
  277. @keyframes color {
  278. 100%,
  279. 0% {
  280. stroke: #919191;
  281. }
  282. 40% {
  283. stroke: #919191;
  284. }
  285. 66% {
  286. stroke: #919191;
  287. }
  288. 80%,
  289. 90% {
  290. stroke: #919191;
  291. }
  292. }
  293. </style>