浏览代码

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

wenliming 2 年之前
父节点
当前提交
e31bc4ce8a
共有 3 个文件被更改,包括 34 次插入5 次删除
  1. 21 2
      src/logic/content/nft.js
  2. 3 2
      src/logic/content/twitter.js
  3. 10 1
      src/view/iframe/red-packet/luck-draw.vue

+ 21 - 2
src/logic/content/nft.js

@@ -6,6 +6,8 @@ import { jumpTwitterDetailByAlert } from '@/logic/content/help/twitter.js'
 
 var ifShowNftGroup = false;
 var tempNftGroupPost = null;
+var groupImgNoSelect = require("@/assets/img/icon-nft-group-entry.png");
+var groupImgSelect = require("@/assets/img/icon-nft-group-select.png");
 
 export const showNFTGroupIcon = () => {
     let urlInfo = new URL(window.location.href)
@@ -17,7 +19,7 @@ export const showNFTGroupIcon = () => {
         let oDiv = document.createElement(`div`);
             oDiv.id = 'de-nft-group-enter';
         let oImg = document.createElement('img');
-            oImg.src = require("@/assets/img/icon-nft-group-entry.png");
+            oImg.src = groupImgNoSelect;
             oImg.className = 'addGroup';
             oDiv.innerHTML = `
                 ${oImg.outerHTML}
@@ -112,6 +114,7 @@ export const setPostContent = (res) => {
         if (inputEle) {
             inputEle.focus();
         }
+        setGroupIconStatus();
     }, 100).then(() => {
         _setPublishContent(res.srcContent + ' ');
     })
@@ -168,6 +171,7 @@ export const setNFTGroupContent = (res) => {
 
 export const elemAddEventListener = (elem, action, fn) => {
     if (elem) {
+        elem.removeEventListener(action, fn)
         elem.addEventListener(action, fn)
     }
 }
@@ -210,7 +214,22 @@ export const setJoinedGroupIframeStyle = (params) => {
     }
 }
 
-
+export function setGroupIconStatus() {
+    let editElem = document.querySelector('div[contenteditable="true"]');
+    let main_observer = new MutationObserver(() => {
+        let groupImg = document.querySelector('#de-nft-group-enter');
+        let innerText = editElem.innerText || '';
+        if (groupImg && innerText) {
+            let where = innerText.indexOf('#DNFT') !== -1 && innerText.indexOf('nft_group') !== -1;
+            if (where) {
+                groupImg.querySelector('.addGroup').src = groupImgSelect;
+            } else {
+                groupImg.querySelector('.addGroup').src = groupImgNoSelect;
+            }
+        }
+    });
+    main_observer.observe(editElem, { attributes: false, childList: true, subtree: true })
+}
 function _addTweetButtonListen() {
     let btn = document.querySelector('div[data-testid="tweetButton"]');
 

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

@@ -7,7 +7,7 @@ import { fetchAddFinishEvent } from '@/logic/background/fetch/facebook';
 import { showNFTGroupIcon, hideNFTGroupList, checkUserJoinGroup, elemAddEventListener, addJoinedGroupList } from '@/logic/content/nft';
 import { getTwitterNftGroupInfo } from '@/http/nft'
 import { jumpTwitterDetailByAlert, showEditTweet } from '@/logic/content/help/twitter.js'
-import { clearPostContent } from '@/logic/content/nft.js'
+import { clearPostContent, setGroupIconStatus } from '@/logic/content/nft.js'
 import axios from 'axios';
 
 let dom = {};
@@ -1459,9 +1459,10 @@ export const setTwitterTextarea = (params, num = 5) => {
     let inputEle = document.querySelector('div[contenteditable="true"]');
     if (inputEle) {
         inputEle.focus();
+        setGroupIconStatus();
         document.execCommand("insertText", false, '');
         setTimeout(() => {
-            document.execCommand("insertText", false, params.srcContent);
+            document.execCommand("insertText", false, params.srcContent + ' ');
             // 光标定位到起始位置
             setTimeout(() => {
                 inputEle.focus();

+ 10 - 1
src/view/iframe/red-packet/luck-draw.vue

@@ -1146,6 +1146,8 @@ const handleStatusPage = () => {
     // 如果 红包状态 = 未开始
     //    显示未打开页面 return
 
+    // 如果 红包状态 =  已终止 | 终止退款进行中
+    //      显示过期页面
     // 如果 我领取过了
     //    如果 任务完成状态 = 未完成 & 红包状态 = 进行中
     //         显示任务未完成页面
@@ -1180,8 +1182,14 @@ const handleStatusPage = () => {
         showNotOpenPage()
         return
     }
+    // 如果 红包状态 =  已终止 | 终止退款进行中
+    if (state.detail.status == 3 || 4) {
+        //      显示过期页面
+        showCloseEndTimePage()
+        showCloseEndTimePageReport()
+    }
     // 如果 我领取过了
-    if (state.detail.myReceived) {
+    else if (state.detail.myReceived) {
         state.receiveAmount = state.detail.myReceived.amountValue || 0
         state.detail.taskCondition = JSON.parse(state.detail.taskCondition)
         // 如果 任务完成状态 = 未完成 & 红包状态 = 进行中
@@ -1195,6 +1203,7 @@ const handleStatusPage = () => {
             else if (state.detail.myReceived.taskFinishStatus == 0 && state.detail.status == 2) {
                 // 显示已经过期页面
                 showCloseEndTimePage()
+                showCloseEndTimePageReport()
             }
             //如果 任务完成状态 = 已经完成
         } else if (state.detail.myReceived.taskFinishStatus == 1) {