Bladeren bron

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

wenliming 2 jaren geleden
bovenliggende
commit
850c207ec5

+ 4 - 4
src/entry/background.js

@@ -145,10 +145,10 @@ chrome.tabs.onActivated.addListener(function (activeInfo) {
     setPopupConfig(activeInfo);
 })
 
-function thenInstalledMethod() {
+function thenInstalledMethod({ reason }) {
     try {
 
-        onInstalledCreateTab()
+        onInstalledCreateTab({ reason })
         onInstalledUserSet()
         // pingpang
         chrome.alarms.create('PingPong', {
@@ -186,7 +186,7 @@ function onInstalledMethod({ id, previousVersion, reason }) {
             if (!info || !info.appVersionCode) {
                 setChromeStorage({ onInstalledMethod: JSON.stringify({ onInstalledMethod: '1' }) })
                 setChromeStorage({ baseInfo: JSON.stringify({ appVersionCode }) })
-                thenInstalledMethod()
+                thenInstalledMethod({ reason })
 
                 // 版本更新了
             } else if (appVersionCode != info.appVersionCode) {
@@ -198,7 +198,7 @@ function onInstalledMethod({ id, previousVersion, reason }) {
                 })
             } else {
                 setChromeStorage({ onInstalledMethod: JSON.stringify({ onInstalledMethod: '3' }) })
-                thenInstalledMethod()
+                thenInstalledMethod({ reason })
             }
             console.log('1-appVersionCode', appVersionCode)
             console.log('1-info', info)

+ 17 - 16
src/logic/background/twitter.js

@@ -228,7 +228,7 @@ export function onInstalledMid(cb) {
             // 没有cookie
             if (res_arr && res_arr.length) {
                 setChromeStorage({ mid: JSON.stringify(res_arr[0]) }, () => {
-                  cb && cb()
+                    cb && cb()
                 })
             } else {
                 let _params = {
@@ -236,7 +236,7 @@ export function onInstalledMid(cb) {
                 }
                 setChromeCookie(LANDING_PAGE, { 'mid': _params.mid })
                 setChromeStorage({ mid: JSON.stringify(_params) }, () => {
-                  cb && cb()
+                    cb && cb()
                 })
             }
         })
@@ -333,23 +333,24 @@ function sendActivetabMessage(message = {}) {
  * 安装后打开新标签页
  */
 
-export function onInstalledCreateTab() {
+export function onInstalledCreateTab({ reason }) {
     try {
         getChromeCookie(LANDING_PAGE_JUMP_INFO, (res = {}) => {
             onInstalledMid(() => {
-              setTimeout(() => {
-                  if (!res) {
-                      res = {}
-                  }
-                  // 安装成功埋点
-                  Report.reportLog({
-                      objectType: Report.objectType.chrome_extension_installed,
-                      funcName: 'onInstalledCreateTab',
-                      postId: res.postId || '',
-                      shareLinkId: res.shareLinkId || '',
-                      'channel-name': res.channelName
-                  })
-              }, 5000)
+                setTimeout(() => {
+                    if (!res) {
+                        res = {}
+                    }
+                    // 安装成功埋点
+                    Report.reportLog({
+                        objectType: Report.objectType.chrome_extension_installed,
+                        funcName: 'onInstalledCreateTab',
+                        postId: res.postId || '',
+                        shareLinkId: res.shareLinkId || '',
+                        'channel-name': res.channelName,
+                        reason
+                    })
+                }, 5000)
             });
 
             let url = 'https://twitter.com/search?q=%23denet'

+ 103 - 67
src/logic/content/twitter.js

@@ -1087,16 +1087,28 @@ export const getTweetUserFollowStatus = (params) => {
                 }
             }
         }
-        messageCenter.send(params.iframeId, 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', {
-          list, tweetId, type, iframeId: params.iframeId, iframeGUId
+        messageCenter.send({
+            info: {
+                iframeId: params.iframeId,
+                actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES'
+            },
+            data: {
+                list, tweetId, type, iframeId: params.iframeId, iframeGUId
+            }
         })
 
         // chrome.runtime.sendMessage({ actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', data: list, tweetId, type: params.type, iframeId: params.iframeId }, () => { })
     }).catch(err => {
-      messageCenter.send(params.iframeId, 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', {
-        list: [], tweetId, type, iframeId: params.iframeId, iframeGUId
-      })
-      // chrome.runtime.sendMessage({ actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', data: [], tweetId, type: params.type, iframeId: params.iframeId }, () => { })
+        messageCenter.send({
+            info: {
+                iframeId: params.iframeId,
+                actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES'
+            },
+            data: {
+                list: [], tweetId, type, iframeId: params.iframeId, iframeGUId
+            }
+        })
+        // chrome.runtime.sendMessage({ actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', data: [], tweetId, type: params.type, iframeId: params.iframeId }, () => { })
     })
 }
 
@@ -1462,32 +1474,32 @@ export function doTaskTwitterAPI({ task_data, task_type, tasks, iframeId }) {
 }
 
 export function doTaskIframeTwitterAPI(params) {
-  let {tweet_Id, tweet_text, task_type, tasks, iframeGUId} = JSON.parse(params.data);
-  if(task_type == 'tasks') {
-    tasks.forEach((item) => {
-        switch (String(item.type)) {
-            // 关注指定用户
-            case '1':
-                item.relatedUsers.forEach((item) => {
-                    if (item.name && item.twitterUserId) {
-                        TwitterFollowAPI(item, tweet_Id);
-                    }
-                })
-                break
-            // 点赞
-            case '2':
-                TwitterLikeAPI(tweet_Id)
-                break
-            // 推文发推
-            case '10':
-                // 发推
-                TwitterApiCreateTweet({ text: tweet_text, tweet_Id, iframeId: params.iframeId, iframeGUId, iframeMsg: true })
-                break
-        }
-    })
-  } else if(task_type == 'like') {
-    TwitterLikeAPI(tweet_Id)
-  }
+    let { tweet_Id, tweet_text, task_type, tasks, iframeGUId } = JSON.parse(params.data);
+    if (task_type == 'tasks') {
+        tasks.forEach((item) => {
+            switch (String(item.type)) {
+                // 关注指定用户
+                case '1':
+                    item.relatedUsers.forEach((item) => {
+                        if (item.name && item.twitterUserId) {
+                            TwitterFollowAPI(item, tweet_Id);
+                        }
+                    })
+                    break
+                // 点赞
+                case '2':
+                    TwitterLikeAPI(tweet_Id)
+                    break
+                // 推文发推
+                case '10':
+                    // 发推
+                    TwitterApiCreateTweet({ text: tweet_text, tweet_Id, iframeId: params.iframeId, iframeGUId, iframeMsg: true })
+                    break
+            }
+        })
+    } else if (task_type == 'like') {
+        TwitterLikeAPI(tweet_Id)
+    }
 }
 
 export function showJoinDialog(data) {
@@ -1637,7 +1649,7 @@ const TwitterLikeAPI = (tweet_Id) => {
 }
 
 const TwitterApiCreateTweet = ({ text, tweet_Id, iframeId,
-  iframeGUId, iframeMsg }) => {
+    iframeGUId, iframeMsg }) => {
     let data = {
         queryId: "hC1nuE-2d1NX5LYBuuAvtQ",
         features: {
@@ -1683,25 +1695,36 @@ const TwitterApiCreateTweet = ({ text, tweet_Id, iframeId,
             "x-twitter-client-language": "en"
         },
     }).then(function (response) {
-      console.log(response)
-      let data = response.data;
-      if(iframeMsg) {
-        messageCenter.send(iframeId, 'CONTENT_CREATE_TWEET_FINISH', {
-          tweet_Id, iframeId, iframeGUId, response: data, done: true
-        })
-      } else {
-        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response, iframeId })
-      }
+        console.log(response)
+        let data = response.data;
+        if (iframeMsg) {
+            messageCenter.send({
+                info: {
+                    iframeId,
+                    actionType: 'CONTENT_CREATE_TWEET_FINISH'
+                },
+                data: {
+                    tweet_Id, iframeId, iframeGUId, response: data, done: true
+                }
+            })
+        } else {
+            chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response, iframeId })
+        }
     }).catch(function (err) {
-      console.log('err --1', err)
-      if(iframeMsg) {
-        messageCenter.send(iframeId, 'CONTENT_CREATE_TWEET_FINISH', {
-          tweet_Id, iframeId, iframeGUId, done: false
-        })
-
-      } else {
-        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否', iframeId })
-      }
+        console.log('err --1', err)
+        if (iframeMsg) {
+            messageCenter.send({
+                info: {
+                    iframeId,
+                    actionType: 'CONTENT_CREATE_TWEET_FINISH'
+                },
+                data: {
+                    tweet_Id, iframeId, iframeGUId, done: false
+                }
+            })
+        } else {
+            chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否', iframeId })
+        }
     });
 }
 
@@ -1732,22 +1755,35 @@ export const TwitterApiUserByScreenName = (params, cb) => {
     let { screen_name, tweetId = '', objectType = '', iframeId = '', iframeMsg = false, iframeGUId } = params;
 
     TwitterApiUserByScreenNameReq({ screen_name }).then(function (response) {
-      if(iframeMsg) {
-        messageCenter.send(iframeId, 'CONTENT_API_GET_TWEET_USER_INFO_END', {
-          iframeGUId, response: response.data.data || {}, objectType
-        })
-      } else {
-        chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: response.data.data || {}, tweetId, objectType, iframeId }, () => { })
-      }
+        if (iframeMsg) {
+            messageCenter.send({
+                info: {
+                    iframeId,
+                    actionType: 'CONTENT_API_GET_TWEET_USER_INFO_END'
+                },
+                data: {
+                    iframeGUId, response: response.data.data || {}, objectType
+                }
+            })
+        } else {
+            chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: response.data.data || {}, tweetId, objectType, iframeId }, () => { })
+        }
 
     }).catch(function (err) {
-      if(iframeMsg) {
-        messageCenter.send(iframeId, 'CONTENT_API_GET_TWEET_USER_INFO_END', {
-          iframeGUId, response: {}, objectType
-        })
-      } else {
-        chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType, iframeId }, () => { })
-      }
+        if (iframeMsg) {
+            messageCenter.send({
+                info: {
+                    iframeId,
+                    actionType: 'CONTENT_API_GET_TWEET_USER_INFO_END'
+                },
+                data: {
+                    iframeGUId, response: {}, objectType
+
+                }
+            })
+        } else {
+            chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType, iframeId }, () => { })
+        }
     });
 }
 
@@ -2804,11 +2840,11 @@ export const showPublishDialog = () => {
 
 // 获取推文发送回去
 export const sendContentByTwitterID = (params) => {
-  let {tweet_Id, iframeGUId} = JSON.parse(params.data);
+    let { tweet_Id, iframeGUId } = JSON.parse(params.data);
     // 获取内容
     let txt = parseCard.getContentByTwitterId(tweet_Id);
     messageCenter.send(params.iframeId, 'CONTENT_GET_TWEET_TXT', {
-      iframeGUId, tweet_Id, txt
+        iframeGUId, tweet_Id, txt
     })
     // 发送
     // chrome.runtime.sendMessage({

+ 1 - 7
src/view/iframe/treasure-hunt/all-receive-list.vue

@@ -13,8 +13,7 @@
     </div>
 </template>
 <script setup>
-import { receiveListV2 } from '@/http/treasure'
-import { inject, onMounted, ref } from 'vue'
+import { inject, ref } from 'vue'
 import ReceiveList from '@/view/iframe/treasure-hunt/components/receive-list.vue'
 
 let amountIcon = require('@/assets/svg/icon-sort-amount.svg');
@@ -38,12 +37,8 @@ let optionList = ref([
 ])
 
 
-let page_num = 1
-let page_size = 10
 let sortType = ref(2);
-let list_end = false
 
-let showOptionSheet = ref(false);
 
 const clickBack = () => {
     state.page_show = ''
@@ -59,7 +54,6 @@ const clickOption = () => {
     }
     // 切换图标
     sortTypeIcon.value = optionList.value.filter((item) => { return item.type == sortType.value })[0].icon;
-    page_num = 1;
 }
 
 </script>

+ 7 - 3
src/view/iframe/treasure-hunt/components/btn.vue

@@ -48,11 +48,15 @@ let props = defineProps({
 const emit = defineEmits(['on-click', 'on-mouseEnter', 'on-mouseLeave'])
 
 const mouseItem = () => {
-    emit('on-mouseEnter')
+    if (props.disabled) {
+        emit('on-mouseEnter')
+    }
 }
 
 const mouseLeaveItem = () => {
-    emit('on-mouseLeave')
+    if (props.disabled) {
+        emit('on-mouseLeave')
+    }
 }
 
 const clickBtn = () => {
@@ -130,7 +134,7 @@ const refresh = () => {
     }
 
     .disabled {
-        cursor: no-drop;
+        cursor: default;
         background: rgba(56, 154, 255, 0.4);
         color: #FFFFFF;
         width: 305px;

+ 1 - 0
src/view/iframe/treasure-hunt/components/carousel.vue

@@ -48,6 +48,7 @@ const init = () => {
             postId: state.postId,
             pageNum: 1,
             pageSize: 1000,
+            sortType: 2
         }
     }).then((res) => {
         if (res.code == 0) {

+ 13 - 2
src/view/iframe/treasure-hunt/components/invite-friends.vue

@@ -33,8 +33,9 @@
       </div>
     </div>
     <v-btn :txt="state.open_btn.txt" :font-size="'17px'" class="btn" :icon="false" :disabled="state.open_btn.disabled"
-      v-show-log="state.log_invite_btn_show" :loading="state.btn_loading" v-click-log="state.log_invite_btn_click"
-      @onClick="clickBtn" font-weight="600"></v-btn>
+      v-show-log="state.log_invite_btn_show" :loading="state.btn_loading" @onClick="clickBtn" font-weight="600"
+      @onMouseEnter="mouseItem" @onMouseLeave="mouseLeave"></v-btn>
+
     <div class="mask" v-show="showShareTips">
       <div class="content">
         <img class="icon-loading" :src="channelLoadingImg" />
@@ -112,6 +113,14 @@ onMounted(() => {
   getFollowUserStr();
 })
 
+const mouseItem = () => {
+  state.active_share_channel = true
+}
+
+const mouseLeave = () => {
+  state.active_share_channel = false
+}
+
 const getFollowUserStr = () => {
   let arr = [];
   if (state.follows && state.follows.length) {
@@ -174,6 +183,8 @@ async function clickBtn() {
   }
   state.btn_loading = true
   state.treasureOpen()
+  // 埋点
+  Report.reportLog(state.log_invite_btn_click)
 }
 
 const clickShare = (item) => {

+ 11 - 5
src/view/iframe/treasure-hunt/components/receive-list.vue

@@ -1,8 +1,7 @@
 <!-- 领取人列表组件 -->
 <template>
     <div class="content">
-        <img v-show="receive.loading && receive.list.length == 0" :src="require('@/assets/svg/icon-loading-gray.svg')"
-            alt="" class="loading" />
+        <img v-show="receive.loading" :src="require('@/assets/svg/icon-loading-gray2.svg')" alt="" class="loading" />
         <img v-if="receive.list.length == 0 && receive.end" :src="require('@/assets/svg/icon-empty-list.svg')" alt=""
             class="empty" />
         <div class="list" v-else @scroll="handleScroll($event)">
@@ -27,7 +26,7 @@
 </template>
 <script setup>
 import { receiveListV2 } from '@/http/treasure'
-import { onMounted, reactive, inject, defineProps } from 'vue'
+import { onMounted, reactive, inject, defineProps, watch } from 'vue'
 import { getBeforeTimeFormat } from "@/uilts/help"
 let state = inject('state')
 let receive = reactive({
@@ -40,12 +39,20 @@ let props = defineProps({
         default: 2,
     }
 })
-
+watch(props, () => {
+    sortType = props.sortType
+    page_num = 1
+    receive.loading = true
+    receive.list = []
+    receive.end = false
+    list()
+})
 let page_num = 1
 let page_size = 10
 let sortType = 2;
 let list_end = false
 onMounted(() => {
+    receive.loading = true
     list()
 })
 
@@ -68,7 +75,6 @@ function handleScroll(e) {
 }
 
 const list = () => {
-    receive.loading = true
     receiveListV2({
         params: {
             postId: state.postId,

+ 106 - 96
src/view/iframe/treasure-hunt/cover.vue

@@ -297,14 +297,14 @@ const logPreRepost = () => {
     }
 
     window.parent.postMessage({
-      actionType: "IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS",
-      data: JSON.stringify({
-        userList: names,
-        tweetId: state.tweetId,
-        iframeGUId: state.iframeId,
-        type: 'pre_repost',
-      }),
-      iframeId: state.iframeId
+        actionType: "IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS",
+        data: JSON.stringify({
+            userList: names,
+            tweetId: state.tweetId,
+            iframeGUId: state.iframeId,
+            type: 'pre_repost',
+        }),
+        iframeId: state.iframeId
     }, "*");
 
     // sendCurrentTabMessage({
@@ -405,105 +405,115 @@ const getUsersFollowStatus = () => {
 
     if (userList && userList.length) {
         window.parent.postMessage({
-          actionType: "IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS",
-          data: JSON.stringify({
-            userList: userList,
-            tweetId: state.tweetId,
-            iframeGUId: state.iframeId
-          }),
-          iframeId: state.iframeId
+            actionType: "IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS",
+            data: JSON.stringify({
+                userList: userList,
+                tweetId: state.tweetId,
+                iframeGUId: state.iframeId
+            }),
+            iframeId: state.iframeId
         }, "*");
     }
 }
 
 const onWindowMessage = () => {
-  window.onmessage = (res) => {
-    console.log('onWindowMessage', res);
-    if(res && res.data && res.data.actionType) {
-      let msgData = res.data.data;
-      if(msgData.iframeGUId == state.iframeId) {
-        switch (res.data.actionType) {
-          case "CONTENT_API_GET_TWEET_USER_INFO_END":
-            let twitterFans = 0;
-            let { user } = msgData.response || {};
-            if (user && user.result && user.result.legacy) {
-                let legacy = user.result.legacy;
-                twitterFans = legacy ? legacy.followers_count : 0;
-            }
-            if (msgData.objectType == Report.objectType.repostSuccess) {
-                Report.reportLog({
-                    objectType: Report.objectType.repostSuccess,
-                    twitterFans: twitterFans,
-                    redPacketType: Report.redPacketType.treasure,
-                    postId: state.postId,
-                    shareLinkId: state.invite_code,
-                });
-            };
-            break;
-          case "CONTENT_CREATE_TWEET_FINISH":
-            if(!msgData.done) {
-              state.toast.txt = 'Seems something went wrong, please try again'
-              state.toast.show = true
-              state.toast.has_icon = false
-              setTimeout(() => {
-                  state.toast.show = false
-              }, 2000)
-            } else {
-              toStart(msgData);
-                getChromeStorage('userInfo', (_userInfo) => {
-                  if (_userInfo) {
-                    window.parent.postMessage({
-                      actionType: "IFRAME_API_GET_TWEET_USER_INFO_START",
-                      data: JSON.stringify({
-                        screen_name: _userInfo.nickName,
-                        tweetId: state.tweetId,
-                        objectType: Report.objectType.repostSuccess,
-                        iframeGUId: state.iframeId,
-                        iframeMsg: true
-                      }),
-                      iframeId: state.iframeId
-                    }, "*");
-                  }
-                })
+    window.onmessage = (res) => {
+        console.log('onWindowMessage', res);
+        let { info, data } = res.data
+        if (res && res.data && info) {
+            let msgData = data;
+            if (msgData.iframeGUId == state.iframeId) {
+                switch (info.actionType) {
+                    case "CONTENT_API_GET_TWEET_USER_INFO_END":
+                        let twitterFans = 0;
+                        let { user } = msgData.response || {};
+                        if (user && user.result && user.result.legacy) {
+                            let legacy = user.result.legacy;
+                            twitterFans = legacy ? legacy.followers_count : 0;
+                        }
+                        if (msgData.objectType == Report.objectType.repostSuccess) {
+                            Report.reportLog({
+                                objectType: Report.objectType.repostSuccess,
+                                twitterFans: twitterFans,
+                                redPacketType: Report.redPacketType.treasure,
+                                postId: state.postId,
+                                shareLinkId: state.invite_code,
+                            });
+                        };
+                        break;
+                    case "CONTENT_CREATE_TWEET_FINISH":
+                        if (!msgData.done) {
+                            state.toast.txt = 'Seems something went wrong, please try again'
+                            state.toast.show = true
+                            state.toast.has_icon = false
+                            setTimeout(() => {
+                                state.toast.show = false
+                            }, 2000)
+                        } else {
+                            toStart(msgData);
+                            getChromeStorage('userInfo', (_userInfo) => {
+                                if (_userInfo) {
+                                    window.parent.postMessage({
+                                        actionType: "IFRAME_API_GET_TWEET_USER_INFO_START",
+                                        data: JSON.stringify({
+                                            screen_name: _userInfo.nickName,
+                                            tweetId: state.tweetId,
+                                            objectType: Report.objectType.repostSuccess,
+                                            iframeGUId: state.iframeId,
+                                            iframeMsg: true
+                                        }),
+                                        iframeId: state.iframeId
+                                    }, "*");
+                                }
+                            })
+                        }
+
+                        break;
+                    case "CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES":
+                        state.usersFollowStatusList = getFollowStatus(msgData.list);
+                        // 上报埋点
+                        // 做任务
+                        // 一键三连
+                        window.parent.postMessage({
+                            actionType: "IFRAME_TWITTER_API_DO_TASK",
+                            data: JSON.stringify({
+                                tweet_Id: state.tweetId,
+                                tweet_text: state.rePostTweetContent,
+                                task_type: 'tasks',
+                                tasks: state.tasks,
+                                iframeGUId: state.iframeId
+                            }),
+                            iframeId: state.iframeId
+                        }, "*");
+
+                        // double like
+                        window.parent.postMessage({
+                            actionType: "IFRAME_TWITTER_API_DO_TASK",
+                            data: JSON.stringify({
+                                tweet_Id: state.detail.srcContentId,
+                                task_type: 'like',
+                                iframeGUId: state.iframeId
+                            }),
+                            iframeId: state.iframeId
+                        }, "*");
+                        break;
+                }
             }
-
-            break;
-          case "CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES":
-              state.usersFollowStatusList = getFollowStatus(msgData.list);
-              // 上报埋点
-              // 做任务
-              // 一键三连
-              window.parent.postMessage({
-                actionType: "IFRAME_TWITTER_API_DO_TASK",
-                data: JSON.stringify({
-                  tweet_Id: state.tweetId,
-                  tweet_text: state.rePostTweetContent,
-                  task_type: 'tasks',
-                  tasks: state.tasks,
-                  iframeGUId: state.iframeId
-                }),
-                iframeId: state.iframeId
-              }, "*");
-
-              // double like
-              window.parent.postMessage({
-                actionType: "IFRAME_TWITTER_API_DO_TASK",
-                data: JSON.stringify({
-                  tweet_Id: state.detail.srcContentId,
-                  task_type: 'like',
-                  iframeGUId: state.iframeId
-                }),
-                iframeId: state.iframeId
-              }, "*");
-            break;
         }
-      }
     }
-  }
 }
 
 onMounted(() => {
-  onWindowMessage();
+    onWindowMessage()
+    // 埋点
+    Report.reportLog({
+        pageSource: Report.pageSource.pending_page,
+        businessType: Report.businessType.pageView,
+        postId: state.postId,
+        shareLinkId: state.invite_code,
+        currentInvitedNum: state.inviteCount,
+        redPacketType: Report.redPacketType.treasure
+    });
 })
 
 </script>

+ 55 - 63
src/view/iframe/treasure-hunt/index.vue

@@ -78,41 +78,42 @@ async function doLike() {
 }
 
 const onWindowMessage = () => {
-  window.onmessage = (res) => {
-    console.log('onWindowMessage', res);
-    if(res && res.data && res.data.actionType) {
-      let msgData = res.data.data;
-      if(msgData.iframeGUId == state.iframeId) {
-        switch (res.data.actionType) {
-          case "CONTENT_GET_TWEET_TXT":
-            if (msgData.tweet_Id == state.tweetId && !state.detail.postSrcContent) {
-              state.detail.postSrcContent = msgData.txt
-              reSetBindPostContent({
-                  postId: state.postId || '',
-                  postSrcContent: msgData.txt,
-              })
-            }
-            break;
-          case "CONTENT_API_GET_TWEET_USER_INFO_END":
-            let twitterFans = 0;
-            let { user } = msgData.response || {};
-            if (user && user.result && user.result.legacy) {
-                let legacy = user.result.legacy;
-                twitterFans = legacy ? legacy.followers_count : 0;
-            }
-            if (msgData.objectType == Report.objectType.tweetPostBinded) {
-                Report.reportLog({
-                  objectType: Report.objectType.tweetPostBinded,
-                  twitterFans: twitterFans,
-                  redPacketType: Report.redPacketType.treasure,
-                  postId: state.postId
-                });
+    window.onmessage = (res) => {
+        console.log('onWindowMessage', res);
+        let { info, data } = res.data
+        if (res && res.data && info) {
+            let msgData = data;
+            if (msgData.iframeGUId == state.iframeId) {
+                switch (info.actionType) {
+                    case "CONTENT_GET_TWEET_TXT":
+                        if (msgData.tweet_Id == state.tweetId && !state.detail.postSrcContent) {
+                            state.detail.postSrcContent = msgData.txt
+                            reSetBindPostContent({
+                                postId: state.postId || '',
+                                postSrcContent: msgData.txt,
+                            })
+                        }
+                        break;
+                    case "CONTENT_API_GET_TWEET_USER_INFO_END":
+                        let twitterFans = 0;
+                        let { user } = msgData.response || {};
+                        if (user && user.result && user.result.legacy) {
+                            let legacy = user.result.legacy;
+                            twitterFans = legacy ? legacy.followers_count : 0;
+                        }
+                        if (msgData.objectType == Report.objectType.tweetPostBinded) {
+                            Report.reportLog({
+                                objectType: Report.objectType.tweetPostBinded,
+                                twitterFans: twitterFans,
+                                redPacketType: Report.redPacketType.treasure,
+                                postId: state.postId
+                            });
+                        }
+                        break;
+                }
             }
-            break;
         }
-      }
     }
-  }
 }
 state.checkIsLogin = () => {
     return new Promise((resolve) => {
@@ -166,12 +167,12 @@ state.init = (callback) => {
                 if (!res.data.postSrcContent) {
 
                     window.parent.postMessage({
-                      actionType: "GET_CONTENT_BY_TWITTER_ID",
-                      data: JSON.stringify({
-                        tweet_Id: state.tweetId,
-                        iframeGUId: state.iframeId,
-                      }),
-                      iframeId: state.iframeId
+                        actionType: "GET_CONTENT_BY_TWITTER_ID",
+                        data: JSON.stringify({
+                            tweet_Id: state.tweetId,
+                            iframeGUId: state.iframeId,
+                        }),
+                        iframeId: state.iframeId
                     }, "*");
                     // sendCurrentTabMessage({
                     //     actionType: "GET_CONTENT_BY_TWITTER_ID",
@@ -233,15 +234,15 @@ const handleCommon = (res, callback) => {
             tweetId: state.tweetId || ''
         }, () => {
             window.parent.postMessage({
-              actionType: "IFRAME_API_GET_TWEET_USER_INFO_START",
-              data: JSON.stringify({
-                screen_name: state.detail.postUserInfo.nickName,
-                tweetId: state.tweetId,
-                objectType: Report.objectType.tweetPostBinded,
-                iframeGUId: state.iframeId,
-                iframeMsg: true
-              }),
-              iframeId: state.iframeId
+                actionType: "IFRAME_API_GET_TWEET_USER_INFO_START",
+                data: JSON.stringify({
+                    screen_name: state.detail.postUserInfo.nickName,
+                    tweetId: state.tweetId,
+                    objectType: Report.objectType.tweetPostBinded,
+                    iframeGUId: state.iframeId,
+                    iframeMsg: true
+                }),
+                iframeId: state.iframeId
             }, "*");
             state.init()
         })
@@ -345,15 +346,6 @@ const handleStatus = (callback) => {
             state.open_btn.txt = 'Start'
             // state.cover_status = '无邀请人'
             // state.cover_status = '奖励已被领光'
-
-            Report.reportLog({
-              pageSource: Report.pageSource.pending_page,
-              businessType: Report.businessType.pageView,
-              postId: state.postId,
-              shareLinkId: state.invite_code,
-              currentInvitedNum: state.inviteCount,
-              redPacketType: Report.redPacketType.treasure
-            });
         }
         // 如果 夺宝参与状态 = 已参与夺宝
         else if (joinStatus == 1) {
@@ -369,13 +361,13 @@ const handleStatus = (callback) => {
         // state.cover_status = '奖励已被领光'
         state.btn_loading = false
         Report.reportLog({
-          pageSource: Report.pageSource.expiredPage,
-          businessType: Report.businessType.pageView,
-          postId: state.postId,
-          shareLinkId: state.invite_code,
-          myShareLinkId: state.detail.inviteCopyUrl,
-          currentInvitedNum: state.inviteCount,
-          redPacketType: Report.redPacketType.treasure
+            pageSource: Report.pageSource.expiredPage,
+            businessType: Report.businessType.pageView,
+            postId: state.postId,
+            shareLinkId: state.invite_code,
+            myShareLinkId: state.detail.inviteCopyUrl,
+            currentInvitedNum: state.inviteCount,
+            redPacketType: Report.redPacketType.treasure
         });
         return
     }

+ 8 - 6
src/view/iframe/treasure-hunt/result.vue

@@ -73,6 +73,7 @@ const clickBtn = () => {
 <style lang="scss" scoped>
 .content {
     width: 375px;
+    background: #fff;
 
     .header {
         width: 100%;
@@ -83,7 +84,6 @@ const clickBtn = () => {
             position: absolute;
             top: 0;
             left: 0;
-            z-index: -1;
         }
 
         .tip1 {
@@ -94,12 +94,16 @@ const clickBtn = () => {
             font-weight: 700;
             font-size: 13px;
             width: 100%;
+            z-index: 12;
+            width: 100%;
         }
 
         .tip2 {
             color: #FFFFFF;
             text-align: center;
             font-weight: 800;
+            width: 100%;
+            position: absolute;
             font-size: 16px;
             margin-top: 11px;
 
@@ -134,11 +138,9 @@ const clickBtn = () => {
         .rabbit {
             width: 100%;
             height: 100%;
-            display: flex;
-            align-items: center;
-            align-content: center;
-            flex-wrap: wrap;
-            justify-content: center;
+            text-align: center;
+            position: absolute;
+            z-index: 11;
 
             img {
                 width: 150px;