wenliming hace 2 años
padre
commit
10fc8633fc

+ 0 - 1
package.json

@@ -29,7 +29,6 @@
     "postcss-import": "^14.0.2",
     "postcss-import": "^14.0.2",
     "postcss-url": "^10.1.3",
     "postcss-url": "^10.1.3",
     "qrcode": "^1.5.0",
     "qrcode": "^1.5.0",
-    "qs": "^6.11.0",
     "sass-loader": "^12.6.0",
     "sass-loader": "^12.6.0",
     "vue": "^3.2.13",
     "vue": "^3.2.13",
     "vue-cropper": "^1.0.3",
     "vue-cropper": "^1.0.3",

+ 22 - 22
src/logic/content/twitter.js

@@ -14,7 +14,6 @@ import messageCenter from '@/uilts/messageCenter';
 import { PlayType } from '@/types';
 import { PlayType } from '@/types';
 import { reSetBindPostContent } from '@/http/help.js';
 import { reSetBindPostContent } from '@/http/help.js';
 import { setDeviceInfo } from '@/logic/content/help/twitter';
 import { setDeviceInfo } from '@/logic/content/help/twitter';
-import qs from 'qs';
 
 
 let dom = {};
 let dom = {};
 
 
@@ -1433,7 +1432,6 @@ export function doTaskTwitterAPI({ task_data, task_type, tasks, iframeId }) {
                         item.relatedUsers.forEach((item) => {
                         item.relatedUsers.forEach((item) => {
                             if (item.name && item.twitterUserId) {
                             if (item.name && item.twitterUserId) {
                                 TwitterFollowAPI(item, task_data.tweet_Id);
                                 TwitterFollowAPI(item, task_data.tweet_Id);
-                                TwitterFriendshipsUpdate({id: task_data.tweet_Id})
                             }
                             }
                         })
                         })
                         break
                         break
@@ -1462,7 +1460,7 @@ export function showJoinDialog(data) {
 }
 }
 
 
 const TwitterFriendshipsUpdate = (params) => {
 const TwitterFriendshipsUpdate = (params) => {
-  let {id = '', device = true} = params || {};
+  let {id = '', device = true, name} = params || {};
   let data = {
   let data = {
     include_profile_interstitial_type: 1,
     include_profile_interstitial_type: 1,
     include_blocking: 1,
     include_blocking: 1,
@@ -1481,25 +1479,25 @@ const TwitterFriendshipsUpdate = (params) => {
   if(!id) {
   if(!id) {
     return;
     return;
   }
   }
-  return axios.post(`https://twitter.com/i/api/1.1/friendships/update.json`,
-    qs.stringify(data), {
-    headers: {
-        "accept": "*/*",
-        "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
-        "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
-        "content-type": "application/x-www-form-urlencoded",
-        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"101\", \"Google Chrome\";v=\"101\"",
-        "sec-ch-ua-mobile": "?0",
-        "sec-ch-ua-platform": "\"Windows\"",
-        "sec-fetch-dest": "empty",
-        "sec-fetch-mode": "cors",
-        "sec-fetch-site": "same-origin",
-        "x-csrf-token": getCookie('ct0'),
-        "x-twitter-active-user": "yes",
-        "x-twitter-auth-type": "OAuth2Session",
-        "x-twitter-client-language": "en",
-        "referer": "https://twitter.com"
-    },
+  return fetch("https://twitter.com/i/api/1.1/friendships/update.json", {
+      "headers": {
+          "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
+          "content-type": "application/x-www-form-urlencoded",
+          "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
+          "sec-ch-ua-mobile": "?0",
+          "sec-ch-ua-platform": "\"macOS\"",
+          "x-csrf-token": getCookie('ct0'),
+          "x-twitter-active-user": "yes",
+          "x-twitter-auth-type": "OAuth2Session",
+          "x-twitter-client-language": "en",
+          "referer": `https://twitter.com/${name}`
+      },
+      "referrer": `https://twitter.com/${name}`,
+      "referrerPolicy": "strict-origin-when-cross-origin",
+      "body": `include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&cursor=-1&id=${id}&device=true`,
+      "method": "POST",
+      "mode": "cors",
+      "credentials": "include"
   })
   })
 }
 }
 
 
@@ -1526,6 +1524,8 @@ const TwitterFollowAPI = (item, tweet_Id) => {
         let task_data = {
         let task_data = {
             follow_name: item.name
             follow_name: item.name
         }
         }
+        TwitterFriendshipsUpdate({id: item.twitterUserId, name: item.name})
+
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: true }, () => { })
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: true }, () => { })
     }).catch(() => {
     }).catch(() => {
         console.log('DO_TASK3')
         console.log('DO_TASK3')

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

@@ -3,7 +3,7 @@
       <div class="invite-friends-content">
       <div class="invite-friends-content">
         <div class="invite-friends-content-head">
         <div class="invite-friends-content-head">
           <div class="title">Invite Friends to Open the Chest!</div>
           <div class="title">Invite Friends to Open the Chest!</div>
-          <div class="info">Invitees need to be new fans of {{followUserStr}} to receive rewards</div>
+          <div class="info">Invitees Need to be Real New follower of {{followUserStr}} to receive rewards</div>
         </div>
         </div>
         <div class="invite-friends-content-body">
         <div class="invite-friends-content-body">
           <img class="tips" v-if="state.active_share_channel" :src="require('@/assets/svg/icon-channel-tips.svg')" />
           <img class="tips" v-if="state.active_share_channel" :src="require('@/assets/svg/icon-channel-tips.svg')" />

+ 31 - 38
src/view/iframe/treasure-hunt/components/invite-list.vue

@@ -1,19 +1,20 @@
 <template>
 <template>
   <div class="content">
   <div class="content">
     <div class="horizontal-invited-wrapper" v-if="state.invited_list.length">
     <div class="horizontal-invited-wrapper" v-if="state.invited_list.length">
-      invited({{ state.inviteCount }})
+      invited({{ state.detail.inviteCount }})
       <div class="horizontal-invited-list" v-show-log="state.log_invite_list_show " @mouseleave="invitedListMouseleave($event)">
       <div class="horizontal-invited-list" v-show-log="state.log_invite_list_show " @mouseleave="invitedListMouseleave($event)">
         <template v-for="(item, index) in state.invited_list" :key="index">
         <template v-for="(item, index) in state.invited_list" :key="index">
-          <div class="invited-item" v-if="index < 9" @mouseenter="invitedItemMouseenter(item)">
+          <div class="invited-item" v-if="index < 5" @mouseenter="invitedItemMouseenter(item)">
             <img :src="item.userInfo.avatarUrl" />
             <img :src="item.userInfo.avatarUrl" />
           </div>
           </div>
         </template>
         </template>
       </div>
       </div>
-      <img class="more" v-if="state.invited_list.length > 9" :src="require('@/assets/svg/icon-invited-more.svg')"
+      <img class="more" v-if="state.invited_list.length > 5" :src="require('@/assets/svg/icon-invited-more.svg')"
         @mouseenter="moreMouseenter" @mouseleave="moreMouseleave" />
         @mouseenter="moreMouseenter" @mouseleave="moreMouseleave" />
     </div>
     </div>
 
 
     <div class="invited-user-info" @mouseenter="invitedItemMouseenter()" @mouseleave="invitedListMouseleave($event)"
     <div class="invited-user-info" @mouseenter="invitedItemMouseenter()" @mouseleave="invitedListMouseleave($event)"
+    @click="clickItem(hoverInvitedUserInfo)"
       v-if="hoverInvitedUserInfo.userInfo">
       v-if="hoverInvitedUserInfo.userInfo">
       <div class="left">
       <div class="left">
         <img class="avatar" :src="hoverInvitedUserInfo.userInfo.avatarUrl" />
         <img class="avatar" :src="hoverInvitedUserInfo.userInfo.avatarUrl" />
@@ -65,9 +66,13 @@ import Report from "@/log-center/log"
 
 
 var moment = require('moment')
 var moment = require('moment')
 let state = inject('state')
 let state = inject('state')
+let global_refresh = inject('global_refresh')
+
 state.invited_list = []
 state.invited_list = []
 
 
-let page_size = 100
+let page_num = 1;
+let page_size = 200
+let listLoadMore = false
 let list_end = false
 let list_end = false
 
 
 let hoverInvitedUserInfo = ref({});
 let hoverInvitedUserInfo = ref({});
@@ -85,16 +90,16 @@ state.log_invite_list_show = {
   postId: state.postId
   postId: state.postId
 }
 }
 
 
-watch(state, () => {
-    if (state.refresh) {
-      inviteListScroll({isRefresh: true});
-      //  list()
+watch(global_refresh, () => {
+    if (global_refresh.value) {
+        inviteListScroll({isRefresh: true});
     }
     }
 })
 })
 
 
 onMounted(() => {
 onMounted(() => {
   state.btn_loading = false;
   state.btn_loading = false;
   inviteListScroll({isRefresh: true})
   inviteListScroll({isRefresh: true})
+  console.log('state-->', state)
   // list()
   // list()
 })
 })
 
 
@@ -127,13 +132,13 @@ const clickItem = (item) => {
 }
 }
 
 
 function handleScroll(e) {
 function handleScroll(e) {
-  if (list_end) {
-    return
-  }
   e = e.target
   e = e.target
   if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
   if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
-    list_end = true
-    inviteListScroll()
+    if(!listLoadMore) {
+      listLoadMore = true;
+      page_num++;
+      inviteListScroll()
+    }
   }
   }
 }
 }
 
 
@@ -161,41 +166,29 @@ state.inviteListRefresh = () => {
 }
 }
 
 
 const handleCommon = (data) => {
 const handleCommon = (data) => {
-  state.inviteCount = data.inviteCount
-  // if (state.inviteCount > 0) {
-  //     state.tabs[1].txt = `invited(${state.inviteCount})`
-  // }
-
-  if (data.inviteUsers.length > 0) {
-    data.inviteUsers.forEach(item => {
-      if (state.invited_list.filter((item2) => { return item2.userInfo.uid == item.userInfo.uid }).length == 0) {
-        state.invited_list.push(item)
-      }
-    })
-    // state.invited_list = state.invited_list.sort((a, b) => {
-    //   return b.timestamp - a.timestamp
-    // })
-
-    list_end = false
-  } else {
-    list_end = false
+  if(data && data.length) {
+    if(page_num < 2) {
+      state.invited_list = data;
+    } else {
+      let dataList = state.invited_list;
+      dataList = dataList.concat(data);
+      state.invited_list = dataList;
+    }
+    listLoadMore = false;
   }
   }
 }
 }
 
 
 // 滚动
 // 滚动
 let inviteListScroll = ({isRefresh = false}) => {
 let inviteListScroll = ({isRefresh = false}) => {
-  // state.invited_list
-  let last_timestamp = 0
-  let len = state.invited_list.length
-  if (!isRefresh && len > 0) {
-    last_timestamp = state.invited_list[len - 1].timestamp
+  if(isRefresh) {
+    page_num = 1
   }
   }
 
 
   inviteList({
   inviteList({
     params: {
     params: {
       inviteCode: state.invite_code,
       inviteCode: state.invite_code,
       postId: state.postId,
       postId: state.postId,
-      lastTimestamp: last_timestamp,
+      pageNum: page_num,
       pageSize: page_size
       pageSize: page_size
     }
     }
   }).then((res) => {
   }).then((res) => {
@@ -261,7 +254,6 @@ async function clickBtn() {
     .horizontal-invited-list {
     .horizontal-invited-list {
       display: flex;
       display: flex;
       align-items: center;
       align-items: center;
-      margin-left: 5px;
       cursor: pointer;
       cursor: pointer;
 
 
       .invited-item {
       .invited-item {
@@ -342,6 +334,7 @@ async function clickBtn() {
         height: 30px;
         height: 30px;
         margin-right: 16px;
         margin-right: 16px;
         border-radius: 50%;
         border-radius: 50%;
+        cursor: pointer;
       }
       }
     }
     }