소스 검색

[add][切换group]

zhangwei 2 년 전
부모
커밋
d01f117b33
3개의 변경된 파일32개의 추가작업 그리고 6개의 파일을 삭제
  1. 7 3
      src/logic/content/twitter.js
  2. 20 3
      src/view/iframe/group-card/card.vue
  3. 5 0
      src/view/iframe/publish-tips/publish-tips.vue

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

@@ -367,7 +367,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) {
@@ -1269,6 +1274,7 @@ export const showTwitterPost = (data) => {
     content_get_nft_post_pre({
         groupId: data.groupId
     })
+    // addPublishTipsIframe({ type: 'nft' })
 }
 
 function publishNFTTweetEvent({ groupId, postId, srcContent }) {
@@ -1378,8 +1384,6 @@ const addGroupTip = (twitterAccount) => {
     }
 }
 
-
-
 export const hideBuyNFT = () => {
     let iframe = document.querySelector('#nftProjectId')
     iframe.style.display = 'none'

+ 20 - 3
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,9 +82,11 @@ 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()
@@ -89,15 +94,27 @@ const init = (callback) => {
         }
     })
 }
+
 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 clickArrow = () => {
+    chrome.runtime.sendMessage({ actionType: "SWITCH_GROUP_STATUS" }, () => { })
+}
+
 async function clickPost() {
     // getTwitterNftPostPre({
     //     params:{

+ 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>