Prechádzať zdrojové kódy

Merge branch 'dev_1.1.5-1' of https://git.yishihui.com/DeNet/de-net into dev_1.1.5-1

zhangwei 2 rokov pred
rodič
commit
270680fb38

+ 13 - 12
src/logic/content/twitter.js

@@ -111,9 +111,7 @@ export function showTwitterPublishDialogHandler(publishRes) {
 
     setChromeStorage({ publishData: JSON.stringify(publishRes) })
 
-    addPublishTipsIframe({
-        srcContent: publishRes.copyContent
-    })
+    addPublishTipsIframe()
     // _setPublishContent(publishRes.srcContent);
     setDialogPublishContent(publishRes.srcContent);
     _publishTweetEvent(publishRes, bindTwitterArtMethod);
@@ -288,7 +286,8 @@ function _addDeNetEditBtn(params = {}) {
             });
             let innerDeIcon = document.getElementById('de-btn1');
             if (!innerDeIcon) {
-                toolElem.firstChild.appendChild(createTweetToolbarDenet())
+                toolElem.firstChild.appendChild(createTweetToolbarDenet());
+                popupShowGiveawayDialog();
             }
 
             let innerToolBoxIcon = document.getElementById('de-tool-box-btn-01');
@@ -306,7 +305,8 @@ function _addDeNetEditBtn(params = {}) {
                     });
                     let innerDeIcon = document.getElementById('de-btn1');
                     if (!innerDeIcon) {
-                        toolElem.firstChild.appendChild(createTweetToolbarDenet())
+                        toolElem.firstChild.appendChild(createTweetToolbarDenet());
+                        popupShowGiveawayDialog();
                     }
 
                     let innerToolBoxIcon = document.getElementById('de-tool-box-btn-01');
@@ -319,6 +319,13 @@ function _addDeNetEditBtn(params = {}) {
     })
 }
 
+const popupShowGiveawayDialog = async () => {
+    let { show = false } = await getChromeStorage('showGiveawayData') || {};
+    if (show) {
+        chrome.storage.local.remove("showGiveawayData");
+        showPublishDialog()
+    }
+}
 
 /**
  * 获取左侧twitter按钮
@@ -612,7 +619,7 @@ function createTweetToolbarToolBox() {
 
     return deToolBoxBtn;
 }
-async function addSliderNavDeBtn(isSmall = false) {
+function addSliderNavDeBtn(isSmall = false) {
     try {
         if (!isSmall) {
             let bigDom = document.querySelector('a[href="/compose/tweet"]').parentNode.parentNode;
@@ -640,12 +647,6 @@ async function addSliderNavDeBtn(isSmall = false) {
     } catch (e) {
         console.log(e)
     }
-
-    let { show = false } = await getChromeStorage('showGiveawayData') || {};
-    if (show) {
-        chrome.storage.local.remove("showGiveawayData");
-        showPublishDialog()
-    }
 }
 
 function onWindowResize() {

+ 8 - 1
src/types/global.js

@@ -34,5 +34,12 @@ export const TaskType = {
   twitterCommentAndTag: 9,
 };
 
+/**
+ * 帖子类型
+ */
 
-
+export const PostType = {
+  giveaway: 1,
+  nftGroup: 2,
+  postEditor: 3
+}

+ 20 - 6
src/view/iframe/publish-tips/publish-tips.vue

@@ -7,8 +7,20 @@
                     Do not delete the
                 </div>
                 <div>
-                    <span>#DeNet </span>and<span> Giveaway link</span>
-                    otherwise the giveaway will not be available
+                    <span>#DeNet </span>and<span> 
+                    <template v-if="publishData.postType == PostType.giveaway">
+                        Giveaway
+                    </template>
+                    <template v-else-if="publishData.postType == PostType.postEditor">
+                        Tool Box
+                    </template> link</span>
+                    otherwise the 
+                    <template v-if="publishData.postType == PostType.giveaway">
+                        giveaway
+                    </template>
+                    <template v-else-if="publishData.postType == PostType.postEditor">
+                        Tool Box
+                    </template> will not be available
                 </div>
             </div>
             <div class="text-wrapper" v-show="type == 'NFT'">
@@ -26,16 +38,17 @@
 </template>
 
 <script setup>
-/* eslint-disable */
 import { onMounted, ref } from "vue";
 import { message } from 'ant-design-vue';
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
 import { getQueryString } from '@/uilts/help.js';
+import { PostType } from '@/types';
 
 let ClipboardJS = require('clipboard');
 
 let strContent = ref('');
-let type = ref('Giveaway')
+let publishData = ref({});
+let type = ref('Giveaway');
 
 const copyToken = () => {
     var clipboard = new ClipboardJS('.copy-btn');
@@ -55,8 +68,9 @@ const copyToken = () => {
 }
 
 const setSrcContent = async () => {
-    let publishData = await getChromeStorage('publishData');
-    strContent.value = publishData.copyContent;
+    let data = await getChromeStorage('publishData');
+    strContent.value = data.copyContent;
+    publishData.value = data;
 }