Browse Source

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

nieyuge 2 years ago
parent
commit
a0523413bc

+ 2 - 3
src/logic/background/twitter.js

@@ -267,9 +267,8 @@ export function onInstalledCreateTab() {
 export function popupRePublish(req) {
     setChromeStorage({
         popupShowPublishDialog: JSON.stringify({
-            show: true,
-            srcContent: req.data.srcContent,
-            postId: req.data.postId
+            ...req.data,
+            show: true
         }),
     });
     chrome.tabs.create({

+ 27 - 4
src/logic/content/twitter.js

@@ -85,7 +85,7 @@ export function showTwitterPublishDialogHandler(publishRes) {
     setChromeStorage({ publishData: JSON.stringify(publishRes) })
 
     addPublishTipsIframe({
-        srcContent: publishRes.srcContent
+        srcContent: publishRes.copyContent
     })
     _setPublishContent(publishRes.srcContent);
     _publishTweetEvent(publishRes, bindTwitterArtMethod);
@@ -163,6 +163,7 @@ function _publishTweetEvent(params, cb) {
         let dialog = document.querySelector('div[role="dialog"]');
         if (dialog) {
             publishTweetBtn = dialog.querySelector('div[data-testid="tweetButton"]');
+            onClosePublishDialogHandle(dialog, params)
         } else {
             let domMain = document.querySelector('main[role="main"]');
             publishTweetBtn = domMain && domMain.querySelector('div[data-testid="tweetButton"]');
@@ -171,15 +172,33 @@ function _publishTweetEvent(params, cb) {
         publishTweetBtn && publishTweetBtn.addEventListener('click', function () {
             bindTwitterArt.needBind = true;
             bindTwitterArt.postId = params.postId;
-            checkIsShowReSend(dialog, params);
+            // checkIsShowReSend(dialog, params);
             cb && cb()
         });
     }, 800)
 }
 
+function onClosePublishDialogHandle(dom, params) {
+    dom.querySelector('div[role="group"]').addEventListener('click', function () {
+        setTimeout(() => {
+            let parent = document.querySelector('div[data-testid="confirmationSheetDialog"]');
+             if(parent) {
+                 let btnArr = parent.querySelectorAll('div[role=button]')
+                 for(let i = 0; i < btnArr.length; i++) {
+                     let btn = btnArr[i];
+                     btn.addEventListener('click', function() {
+                        let taskLuckdropId = JSON.parse(params.postBizData).taskLuckdropId;
+                        noticeBindTweet({ postId: params.postId, taskLuckdropId});
+                     })
+                 }
+             }
+        }, 1000)
+     })
+}
+
 function checkIsShowReSend(dom, params) {
     let str = dom.querySelector('div[data-contents="true"]').innerHTML;
-    if (str.indexOf('#DeNet') < 0 || str.indexOf(params.postId) < 0) {
+    if (str.indexOf(params.postId) < 0) {
         let taskLuckdropId = JSON.parse(params.postBizData).taskLuckdropId;
         noticeBindTweet({ postId: params.postId, taskLuckdropId});
     }
@@ -710,7 +729,8 @@ export function init() {
             setTimeout(() => {
                 showTwitterPublishDialogHandler({
                     srcContent: res.srcContent,
-                    postId: res.postId
+                    postId: res.postId,
+                    copyContent: res.copyContent || ''
                 });
             }, 1500);
             chrome.storage.local.remove("popupShowPublishDialog");
@@ -931,6 +951,9 @@ export function checkTwitterTaskState() {
 
 export function getTweetAuthorByDom(params) {
     let iframe = document.getElementById(params.postId);
+    if(!iframe) {
+        return;
+    }
     let fullNameDom;
     let pathNameArr = window.location.pathname.split('/');
     if (pathNameArr.length >= 2 && pathNameArr[pathNameArr.length - 2] == 'status') {

+ 1 - 4
src/view/iframe/bind-tweet/bind-tweet.vue

@@ -35,10 +35,7 @@ const seSend = async () => {
     let publishData = await getChromeStorage('publishData');
     callEventPageMethod(
         "POPUP_PUBLISH_TWITTER_RED_PACK",
-        { 
-            srcContent: publishData.srcContent, 
-            postId: publishData.postId 
-        },
+        {...publishData},
         function (response) {
             console.log("res", response);
         }

+ 7 - 3
src/view/iframe/publish-tips/publish-tips.vue

@@ -28,9 +28,7 @@ let ClipboardJS = require('clipboard');
 
 let strContent = ref('');
 
-const copyToken = async () => {
-    let publishData = await getChromeStorage('publishData');
-    strContent.value = publishData.copyContent;
+const copyToken = () => {
     var clipboard = new ClipboardJS('.copy-btn');
     clipboard.on('success', function (e) {
         message.success('copy success');
@@ -47,8 +45,14 @@ const copyToken = async () => {
     });
 }
 
+const setSrcContent = async () => {
+    let publishData = await getChromeStorage('publishData');
+    strContent.value = publishData.copyContent;
+}
+
 
 onMounted(() => {
+    setSrcContent();
 }) 
 
 </script>

+ 1 - 1
src/view/iframe/publish/give-dialog.vue

@@ -604,7 +604,7 @@ let formList = reactive([
         show: false
     },
     {
-        label: "Comment and tag 3 friends",
+        label: "Comment and Tag 3 friends",
         icon: require("@/assets/svg/icon-task-twitter.svg"),
         nodeType: "div",
         type: 9,

+ 0 - 12
src/view/iframe/red-packet/red-packet.vue

@@ -1017,18 +1017,6 @@ function init(initParams) {
       // 判断推特id,绑定逻辑
       state.srcContentId = res.data.srcContentId
 
-      if (!res.data.srcContentId) {
-        if (type == 'reSetBindTwtterId') {
-          // 显示提示
-          window.parent.postMessage({
-            actionType: "IFRAME_RED_PACKET_SHOW_BIND_TWEET_NOTICE", data: {
-              postId: state.postId,
-              taskLuckdropId: JSON.parse(res.data.postBizData).taskLuckdropId
-            }
-          }, "*");
-        }
-      }
-
       if (!state.srcContentId) {
         reSetBindTwtterId(res.data)
         return

+ 25 - 5
src/view/popup/popup.vue

@@ -84,7 +84,9 @@
                                 </div>
                                 <div class="right">
                                     <div class="msg">
-                                        <div class="bold">
+                                        <div class="bold" 
+                                            :class="{'align-content': (item.type == 2 || (item.type == 1 && item.status == 1)) && 
+                                                                        item.amount.length + item.currencySymbol.length > 12 }">
                                             <!-- 收到的 -->
                                             <template v-if="item.type == 1">
                                                 <!-- 进行中-->
@@ -97,8 +99,10 @@
                                                         <a-tooltip :title="item.amount">
                                                             {{ getBit(item.amount) }}</a-tooltip>
                                                     </span>
-                                                    <span class="coin-type">{{ item.currencySymbol || '' }}</span>
-                                                    <img :src="item.currencyIconPath" alt="">
+                                                    <div class="coin-type-wrapper">
+                                                        <span class="coin-type">{{ item.currencySymbol || '' }}</span>
+                                                        <img :src="item.currencyIconPath" alt="">
+                                                    </div>
                                                 </template>
                                                 <!-- 已过期 -->
                                                 <template v-else-if="item.status == 2">
@@ -112,8 +116,10 @@
                                                         -{{ getBit(item.amount) }}
                                                     </a-tooltip>
                                                 </span>
-                                                <span class="coin-type">{{ item.currencySymbol || '' }}</span>
-                                                <img :src="item.currencyIconPath" alt="">
+                                                <div class="coin-type-wrapper">
+                                                    <span class="coin-type">{{ item.currencySymbol || '' }}</span>
+                                                    <img :src="item.currencyIconPath" alt="">   
+                                                </div>
                                             </template>
                                         </div>
                                         <!-- 发出的红包显示 -->
@@ -876,6 +882,11 @@ body {
                                     color: #E29A2E;
                                 }
 
+                                .coin-type-wrapper {
+                                    display: flex;
+                                    align-items: center;
+                                }
+
                                 .coin-type {
                                     margin-left: 3px;
                                 }
@@ -887,6 +898,15 @@ body {
                                 }
                             }
 
+                            .align-content {
+                                flex-direction: column;
+                                align-items: flex-end;
+
+                                .blance {
+                                    max-width: 130px;
+                                }
+                            }
+
                             .desc {
                                 font-size: 12px;
                                 color: #b6b6b6;