publish-tips.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="publish-tips-wrapper">
  3. <div class="top">
  4. <img src="@/assets/svg/icon-bells.svg" class="icon-bells">
  5. <div class="text-wrapper" v-show="type == 'Giveaway'">
  6. <div>
  7. Do not delete the
  8. </div>
  9. <div>
  10. <span>#DeNet </span>and<span>
  11. <template v-if="publishData.postType == PostType.giveaway">
  12. Giveaway
  13. </template>
  14. <template v-else-if="publishData.postType == PostType.postEditor">
  15. Tool Box
  16. </template> link</span>
  17. otherwise the
  18. <template v-if="publishData.postType == PostType.giveaway">
  19. giveaway
  20. </template>
  21. <template v-else-if="publishData.postType == PostType.postEditor">
  22. Tool Box
  23. </template> will not be available
  24. </div>
  25. </div>
  26. <div class="text-wrapper" v-show="type == 'NFT'">
  27. <div>
  28. Do not delete the
  29. </div>
  30. <div>
  31. <span>#DNFT </span>and<span> NFT Group Link</span>
  32. otherwise the NFT Post will not be aviilble
  33. </div>
  34. </div>
  35. </div>
  36. <div class="copy-btn" :data-clipboard-text="strContent" @click="copyToken">Copy giveaways link</div>
  37. </div>
  38. </template>
  39. <script setup>
  40. import { onMounted, ref } from "vue";
  41. import { message } from 'ant-design-vue';
  42. import { getChromeStorage } from '@/uilts/chromeExtension.js'
  43. import { getQueryString } from '@/uilts/help.js';
  44. import { PostType } from '@/types';
  45. let ClipboardJS = require('clipboard');
  46. let strContent = ref('');
  47. let publishData = ref({});
  48. let type = ref('Giveaway');
  49. const copyToken = () => {
  50. var clipboard = new ClipboardJS('.copy-btn');
  51. clipboard.on('success', function (e) {
  52. message.success('copy success');
  53. console.info('Action:', e.action);
  54. console.info('Text:', e.text);
  55. console.info('Trigger:', e.trigger);
  56. e.clearSelection();
  57. });
  58. clipboard.on('error', function (e) {
  59. console.error('Action:', e.action);
  60. console.error('Trigger:', e.trigger);
  61. });
  62. }
  63. const setSrcContent = async () => {
  64. let data = await getChromeStorage('publishData');
  65. strContent.value = data.copyContent;
  66. publishData.value = data;
  67. }
  68. onMounted(() => {
  69. setSrcContent();
  70. let type = getQueryString('type') || ''
  71. if (type == 'nft') {
  72. type.value = 'nft'
  73. }
  74. })
  75. </script>
  76. <style lang="scss">
  77. body {
  78. overflow-y: hidden;
  79. }
  80. .publish-tips-wrapper {
  81. width: 100%;
  82. box-sizing: border-box;
  83. background: #FFFFFF;
  84. border-radius: 12px;
  85. padding: 15px;
  86. margin-top: 88px;
  87. .top {
  88. display: flex;
  89. .icon-bells {
  90. width: 30px;
  91. height: 30px;
  92. margin-right: 8px;
  93. }
  94. .text-wrapper {
  95. font-weight: 500;
  96. font-size: 14px;
  97. line-height: 17px;
  98. span {
  99. color: red;
  100. }
  101. }
  102. }
  103. .copy-btn {
  104. margin-top: 20px;
  105. background: rgba(56, 154, 255, 0.01);
  106. border: 1px solid #000000;
  107. border-radius: 100px;
  108. font-weight: 500;
  109. font-size: 14px;
  110. display: flex;
  111. align-items: center;
  112. justify-content: center;
  113. height: 33px;
  114. cursor: pointer;
  115. }
  116. }
  117. </style>