Sfoglia il codice sorgente

Merge branch 'add-GroupTip-6.15' into dev_1.1.1

zhangwei 2 anni fa
parent
commit
e6af61339d

+ 7 - 3
src/logic/content/twitter.js

@@ -375,7 +375,12 @@ function addPublishTipsIframe(params = {}) {
 
             let iframe = document.createElement('iframe');
             iframe.id = 'de-publish-tips'
-            iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html');
+            if (params.type == 'nft') {
+                iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html?type="nft"');
+            } else {
+                iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html');
+            }
+
             iframe.style.cssText = `border: medium none; width:270px;height:500px;position: fixed; right: ${right}px; top: 5%;z-index: -1`
             let iframeContent = document.getElementById('de-publish-tips');
             if (!iframeContent) {
@@ -1288,6 +1293,7 @@ export const showTwitterPost = (data) => {
     content_get_nft_post_pre({
         groupId: data.groupId
     })
+    // addPublishTipsIframe({ type: 'nft' })
 }
 
 function publishNFTTweetEvent({ groupId, postId, srcContent }) {
@@ -1397,8 +1403,6 @@ const addGroupTip = (twitterAccount) => {
     }
 }
 
-
-
 export const hideBuyNFT = () => {
     let iframe = document.querySelector('#nftProjectId')
     iframe.style.display = 'none'

+ 23 - 9
src/view/iframe/group-card/card.vue

@@ -37,8 +37,9 @@
                 <span style="margin-left: 7px; font-size: 15px;font-weight: 700; color: #fff; ">Join Now</span>
             </div>
 
-            <svg v-show="state.show == 'arrow'" id="denet_tip_group_arrow" style="position: absolute; right: 20px;"
-                width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+            <svg @click="clickArrow" v-show="state.show == 'arrow'" id="denet_tip_group_arrow"
+                style="position: absolute; right: 20px;" width="40" height="40" viewBox="0 0 40 40" fill="none"
+                xmlns="http://www.w3.org/2000/svg">
                 <path d="M15 10L26 19.6875L15 29.375" stroke="white" stroke-width="2" />
             </svg>
         </div>
@@ -49,10 +50,11 @@
 import { reactive, onMounted } from 'vue'
 import { getTwitterNftGroupInfo, getTwitterNftPostPre } from "@/http/group";
 import { getQueryString } from '@/uilts/help.js';
-import { sendChromeTabMessage ,checkIsLogin} from '@/uilts/chromeExtension.js';
+import { sendChromeTabMessage, checkIsLogin } from '@/uilts/chromeExtension.js';
 
 let state = reactive({
     show: 'post', //join
+    show2: '',
     data: {},
     twitterAccount: ''
 })
@@ -68,6 +70,7 @@ const clickJoin = () => {
         }
     })
 }
+
 const init = (callback) => {
     getTwitterNftGroupInfo({
         params: {
@@ -79,39 +82,52 @@ const init = (callback) => {
             if (state.data) {
                 // 未加入
                 if (res.data.joinStatus == 0) {
+                    state.show2 = 'join'
                     state.show = 'join'
                     // 已加入
                 } else if (res.data.joinStatus == 1) {
+                    state.show2 = 'post'
                     state.show = 'post'
                 }
                 callback()
             }
-        } 
+        }
         sendMessageToContent({
             actionType: 'IFRAME_GROUP_BANNER_GROUP_INFO',
             data: res.data || {}
         })
     })
 }
+
 chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
     sendResponse('')
     switch (req.actionType) {
         case 'FINISH_GROUP_BANNNER':
             init()
             break
+        case 'SWITCH_GROUP_BANNER_STATUS':
+            if (req.data.type == 'arrow') {
+                state.show = 'arrow'
+            } else {
+                state.show = state.show2
+            }
+            break
     }
 })
 
 
 const sendMessageToContent = (params) => {
-    let {actionType, data} = params || {};
+    let { actionType, data } = params || {};
     chrome.tabs.getCurrent((tab) => {
         chrome.tabs.sendMessage(tab.id, {
-        actionType,
-        data,
+            actionType,
+            data,
         }, (res) => { console.log(res) });
     })
 }
+const clickArrow = () => {
+    chrome.runtime.sendMessage({ actionType: "SWITCH_GROUP_STATUS" }, () => { })
+}
 
 async function clickPost() {
     // getTwitterNftPostPre({
@@ -153,8 +169,6 @@ async function clickPost() {
 }
 
 
-
-
 onMounted(() => {
     state.twitterAccount = getQueryString('twitterAccount') || ''
     init(() => {

+ 5 - 0
src/view/iframe/publish-tips/publish-tips.vue

@@ -30,6 +30,7 @@
 import { onMounted, ref } from "vue";
 import { message } from 'ant-design-vue';
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
+import { getQueryString } from '@/uilts/help.js';
 
 let ClipboardJS = require('clipboard');
 
@@ -61,6 +62,10 @@ const setSrcContent = async () => {
 
 onMounted(() => {
     setSrcContent();
+    let type = getQueryString('type') || ''
+    if (type == 'nft') {
+        type.value = 'nft'
+    }
 })
 
 </script>