Commit 5d1001a1332328616d35b1ae9e38db6cd04a9f3d
1 parent
02fde78d
Exists in
master
and in
3 other branches
x
Showing
6 changed files
with
22 additions
and
14 deletions
Show diff stats
wxsdk/WXSDK.ts
| @@ -36,11 +36,10 @@ export default class WXSDK { | @@ -36,11 +36,10 @@ export default class WXSDK { | ||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | public static async init() { | 38 | public static async init() { |
| 39 | - // await platf | ||
| 40 | if (this.isWx) { | 39 | if (this.isWx) { |
| 41 | WxInit.I.init(); | 40 | WxInit.I.init(); |
| 42 | - //视频预加载 启动预加载视频会闪屏 | ||
| 43 | - if (cc.sys.platform === cc.sys.WECHAT_GAME) { | 41 | + // 视频预加载 启动预加载视频会闪屏 |
| 42 | + if (cc.sys.platform === cc.sys.WECHAT_GAME && typeof qq == 'undefined') { | ||
| 44 | setTimeout(() => { | 43 | setTimeout(() => { |
| 45 | WxInterstitial.initInterstitialAd();//插屏预加载 | 44 | WxInterstitial.initInterstitialAd();//插屏预加载 |
| 46 | ShareVideoService.I.preloadVideo(); | 45 | ShareVideoService.I.preloadVideo(); |
wxsdk/base/SDKConst.ts
| @@ -35,7 +35,7 @@ export const GAMEDATA = { | @@ -35,7 +35,7 @@ export const GAMEDATA = { | ||
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | // sdk版本 | 37 | // sdk版本 |
| 38 | -export const SDKVersion = 'v1.0.12'; | 38 | +export const SDKVersion = 'v1.0.13'; |
| 39 | // 是否打印 | 39 | // 是否打印 |
| 40 | export const __LOG__ = false; | 40 | export const __LOG__ = false; |
| 41 | // 是否mock | 41 | // 是否mock |
wxsdk/base/SDKDefault.ts
wxsdk/http/SDKHttp.ts
| @@ -43,9 +43,9 @@ export default class SDKHttp { | @@ -43,9 +43,9 @@ export default class SDKHttp { | ||
| 43 | responseText = JSON.parse(responseText); | 43 | responseText = JSON.parse(responseText); |
| 44 | // cc.log("responseText22", responseText) | 44 | // cc.log("responseText22", responseText) |
| 45 | if (url.indexOf('.json') > -1) { | 45 | if (url.indexOf('.json') > -1) { |
| 46 | - resolve({ code: 0, data: responseText, msg: responseText.msg }); | 46 | + resolve({ code: 0, data: responseText, msg: responseText.msg , servertime: responseText.servertime}); |
| 47 | } else { | 47 | } else { |
| 48 | - resolve({ code: +responseText.code, data: responseText.data, msg: responseText.msg }); | 48 | + resolve({ code: +responseText.code, data: responseText.data, msg: responseText.msg , servertime: responseText.servertime}); |
| 49 | } | 49 | } |
| 50 | return | 50 | return |
| 51 | } catch (ex) { | 51 | } catch (ex) { |
| @@ -119,7 +119,7 @@ export default class SDKHttp { | @@ -119,7 +119,7 @@ export default class SDKHttp { | ||
| 119 | 119 | ||
| 120 | url = baseUrl + url; | 120 | url = baseUrl + url; |
| 121 | let res = await this.httpRequest(url, "POST", data, dataType); | 121 | let res = await this.httpRequest(url, "POST", data, dataType); |
| 122 | - if (this.onErrorResponse && !res.code) { | 122 | + if (this.onErrorResponse && res.code) { |
| 123 | // | 123 | // |
| 124 | this.onErrorResponse(res); | 124 | this.onErrorResponse(res); |
| 125 | } | 125 | } |
wxsdk/service/ShareVideoService.ts
| @@ -27,19 +27,26 @@ export default class ShareVideoService { | @@ -27,19 +27,26 @@ export default class ShareVideoService { | ||
| 27 | this.forward(this.forwardKey); | 27 | this.forward(this.forwardKey); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | - async init() { | 30 | + private cnt: number = 1 |
| 31 | + async initList() { //初始化List | ||
| 31 | let data = await SDKApi.ShareList(); | 32 | let data = await SDKApi.ShareList(); |
| 33 | + if (data.code) { | ||
| 34 | + console.log('拉取ShareList失败!') | ||
| 35 | + setTimeout(this.initList.bind(this), 200 * this.cnt) | ||
| 36 | + this.cnt++; | ||
| 37 | + return | ||
| 38 | + } | ||
| 32 | this.setShareVideoData(data); | 39 | this.setShareVideoData(data); |
| 33 | - // console.log(JSON.stringify(data)) | 40 | + if (this.forwardKey) this.forward(this.forwardKey); |
| 41 | + } | ||
| 42 | + async init() { | ||
| 43 | + this.initList(); | ||
| 34 | SDKShare.I.updateShareMenu(true);//打开群分享 | 44 | SDKShare.I.updateShareMenu(true);//打开群分享 |
| 35 | - | ||
| 36 | if (cc.sys.platform === cc.sys.WECHAT_GAME) { | 45 | if (cc.sys.platform === cc.sys.WECHAT_GAME) { |
| 37 | if (GAMEDATA.shareMessageToFriend.scene > 0) { | 46 | if (GAMEDATA.shareMessageToFriend.scene > 0) { |
| 38 | wx.setMessageToFriendQuery({ shareMessageToFriendScene: GAMEDATA.shareMessageToFriend.scene }) | 47 | wx.setMessageToFriendQuery({ shareMessageToFriendScene: GAMEDATA.shareMessageToFriend.scene }) |
| 39 | } | 48 | } |
| 40 | } | 49 | } |
| 41 | - | ||
| 42 | - if (this.forwardKey) this.forward(this.forwardKey); | ||
| 43 | } | 50 | } |
| 44 | 51 | ||
| 45 | preload = true; | 52 | preload = true; |
wxsdk/share/SDKVideo.ts
| @@ -140,8 +140,8 @@ export default class SDKVideo { | @@ -140,8 +140,8 @@ export default class SDKVideo { | ||
| 140 | // __LOG__ && console.warn("handleLoaded2", that.videoAd, that.videoAd.isReady()); | 140 | // __LOG__ && console.warn("handleLoaded2", that.videoAd, that.videoAd.isReady()); |
| 141 | LogService.I.adStat(this.videoKey, this.adUnitId, DOT_AD_TYPE.video, DOT_AD_STATUS.show) | 141 | LogService.I.adStat(this.videoKey, this.adUnitId, DOT_AD_TYPE.video, DOT_AD_STATUS.show) |
| 142 | 142 | ||
| 143 | - if (cc.sys.platform === cc.sys.WECHAT_GAME) { | ||
| 144 | - if (that.videoAd.isReady()) {//抖音没有 isReady | 143 | + if (cc.sys.platform === cc.sys.WECHAT_GAME && typeof qq == 'undefined') { |
| 144 | + if (that.videoAd.isReady()) {//抖音、qq 没有 isReady | ||
| 145 | that.show_time = Date.now(); | 145 | that.show_time = Date.now(); |
| 146 | await that.videoAd.show(); | 146 | await that.videoAd.show(); |
| 147 | } else { | 147 | } else { |