Browse Source

commit apptype

jihuaqiang 2 năm trước cách đây
mục cha
commit
0146fa3920
5 tập tin đã thay đổi với 32 bổ sung10 xóa
  1. 5 2
      src/http/configAPI.js
  2. 2 2
      src/http/fetch.js
  3. 3 3
      src/http/request.js
  4. 12 3
      src/pages/red-packet/luck-draw.vue
  5. 10 0
      src/types/global.js

+ 5 - 2
src/http/configAPI.js

@@ -1,4 +1,5 @@
-import { appVersionCode } from '@/uilts/help';
+import { appVersionCode, isInApp } from '@/uilts/help';
+import { AppType } from '@/types'
 
 export { appVersionCode }
 
@@ -30,4 +31,6 @@ export const discordAuthRedirectUri = `${pageUrl}/auth/discordCallback`;
 
 export const faceShareRedirectUrl = `${pageUrl}/facebook/shareCallback`;
 
-export const payAchNoticeUrl = `${pageUrl}/ach_pay/pay_notice`;
+export const payAchNoticeUrl = `${pageUrl}/ach_pay/pay_notice`;
+
+export const appType = isInApp ? AppType.app : AppType.extension;

+ 2 - 2
src/http/fetch.js

@@ -1,4 +1,4 @@
-import { appVersionCode, baseAPIUrl } from '@/http/configAPI.js'
+import { appVersionCode, baseAPIUrl, appType } from '@/http/configAPI.js'
 import { getChromeStorageFromExtension } from '@/uilts/chromeExtension.js'
 
 export async function commonFetch({ url = '', method = 'POST' , params = {}, baseInfo = {}}) {
@@ -13,7 +13,7 @@ export async function commonFetch({ url = '', method = 'POST' , params = {}, bas
     baseInfo.mid = mid
     baseInfo.appVersionCode = appVersionCode
     baseInfo.machineCode = mid
-    baseInfo.appType = 1
+    baseInfo.appType = appType
     baseInfo.loginUid = baseInfo.uid
 
     return new Promise(function (resolve, reject) {

+ 3 - 3
src/http/request.js

@@ -1,6 +1,6 @@
 import axios from 'axios'
 import { getChromeStorageFromExtension } from '@/uilts/chromeExtension.js'
-import { baseAPIUrl, appVersionCode } from '@/http/configAPI.js'
+import { baseAPIUrl, appVersionCode, appType } from '@/http/configAPI.js'
 import { getQueryString } from '@/uilts/help.js';
 let userInfo = '';
 let storage_mid = ''
@@ -39,7 +39,7 @@ function checkParams(config) {
         appVersionCode: denetVersionCode,
         loginUid: uid,
         uid,
-        appType: 1,
+        appType,
         machineCode: mid,
         pageSource: pageSource || ''
       }
@@ -64,7 +64,7 @@ function checkParams(config) {
         appVersionCode: denetVersionCode,
         loginUid: uid,
         uid,
-        appType: 1,
+        appType,
         machineCode: mid,
         pageSource: pageSource || ''
       }

+ 12 - 3
src/pages/red-packet/luck-draw.vue

@@ -581,8 +581,15 @@ async function clickLikeBtn() {
             break
         case '3':
             state.loading_show = true
-            let likeRes = await denet.content.doTask.like({ tweetId: state.tweetId });
-            likeRes && doTaskReport({...likeRes, task_type: 'like', do_type: 'api'}, {tab: {}});
+            let likeRes = await denet.content.doTask.like({ tweetId: state.tweetId }).catch((e) => { 
+                console.log('error in doTask.like', e)
+            });
+            console.log('likeRes', likeRes)
+            if (likeRes) {
+                doTaskReport({ ...likeRes, task_type: 'like', do_type: 'api' }, { tab: {} });
+            } else { 
+                state.loading_show = false
+            }
             break
         default:
             window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
@@ -756,7 +763,8 @@ async function clickReply(params) {
         postId: state.postId,
         iframeId,
         type: params.type,
-        taskLuckdropId: state.detail.taskLuckdropId
+        taskLuckdropId: state.detail.taskLuckdropId,
+        tweetId: state.tweetId,
     }
     if (state.window_origin.indexOf('facebook.com') > -1) {
         let url = `https://twitter.com/${state.tweet_author}/status/${state.tweetId}?actionType=denetFacebookToTwitterReply&deReplyParams=${JSON.stringify(replyData)}`
@@ -985,6 +993,7 @@ async function clickFollowAll(item, is_all) {
     if (state.window_origin.indexOf('facebook.com') >= 0) {
         state.detail.finishTaskTypeV2 = '2'
     }
+    console.log('state.detail.finishTaskTypeV2', state.detail.finishTaskTypeV2)
     switch (state.detail.finishTaskTypeV2) {
         case '1':
             // openapi

+ 10 - 0
src/types/global.js

@@ -48,3 +48,13 @@ export const PostType = {
   postEditor: 3,
   treasure: 4
 }
+
+/**
+ * appType 
+ */
+
+ export const AppType = {
+  extension: 1, //插件内
+  landpage: 2, // 落地页
+  app: 3, // denet app内
+}