506 lines
16 KiB
JavaScript
506 lines
16 KiB
JavaScript
function i(e, o) {
|
||
if (!(e instanceof o)) {
|
||
throw new TypeError("Cannot call a class as a function");
|
||
}
|
||
}
|
||
function n(e, o) {
|
||
for (var t = 0; t < o.length; t++) {
|
||
var i = o[t];
|
||
i.enumerable = i.enumerable || false;
|
||
i.configurable = true;
|
||
"value" in i && (i.writable = true);
|
||
Object.defineProperty(e, i.key, i);
|
||
}
|
||
}
|
||
function a(e, o, t) {
|
||
o && n(e.prototype, o);
|
||
t && n(e, t);
|
||
return e;
|
||
}
|
||
window.qqisios = false;
|
||
var c = function () {
|
||
function e() {
|
||
i(this, e);
|
||
this.SystemInformation = null;
|
||
this.BannerCode = "7b12b048fb5958a6d9c838ff883e625e";
|
||
this.VideoCode = "6e76df81c7a19d92007bf22a78d8bf52";
|
||
this.InterstitialCode = "aeea9282bd75328ab4516be81c4612c2";
|
||
this.GameBoxCode = "8f93aafc1f65528de0c87eed993d4853";
|
||
this.BlockCode = "88a6eb89dde3a33cbce1c5fe2d65d2ab";
|
||
this.BlockIndex = 0;
|
||
this.BannerInstance = null;
|
||
this.ShuaxinTime = null;
|
||
this.VideoInstance = null;
|
||
this.VideoSuccessCallBack = null;
|
||
this.VideoFailureCallBack = null;
|
||
this.InterstitialInstance = null;
|
||
this.BlockInstance = null;
|
||
this.wincount = 0;
|
||
this.fangxiang = null;
|
||
this.shareImgUrl = "logo.png";
|
||
}
|
||
a(e, [{
|
||
key: "doInitialize",
|
||
value: function () {
|
||
this.kaiping = true;
|
||
window.ServerConfigBd = window.GameConfig;
|
||
console.log("实例化头条组件 qq");
|
||
var e = this;
|
||
e.SystemInformation = window.qq.getSystemInfoSync();
|
||
if ("ios" === e.SystemInformation.platform) {
|
||
window.qqisios = true;
|
||
console.log("是ios系统" + window.qqisios);
|
||
}
|
||
console.log("不是ios系统" + window.qqisios);
|
||
if (window.qq.createRewardedVideoAd) {
|
||
e.VideoInstance = window.qq.createRewardedVideoAd({
|
||
adUnitId: e.VideoCode
|
||
});
|
||
e.VideoInstance.load();
|
||
e.VideoInstance.onClose(function (o) {
|
||
if (1 == o.isEnded) {
|
||
e.videoDisplaySuccessCallBack();
|
||
} else if (window.ServerConfigBd.showModal) {
|
||
window.qq.showModal({
|
||
title: "未观看完视频",
|
||
content: "观看完视频才能获得奖励哦",
|
||
success: function (o) {
|
||
if (o.confirm) {
|
||
e.VideoInstance.show().then(function () {
|
||
return console.log("激励视频 广告显示");
|
||
}).catch(function () {
|
||
e.VideoInstance.load().then(function () {
|
||
return e.VideoInstance.show();
|
||
}).catch(function (e) {
|
||
console.log("激励视频 广告显示失败");
|
||
window.qq.showToast({
|
||
title: "广告加载失败,请稍后重试!",
|
||
icon: "none",
|
||
duration: 1e3,
|
||
success: function (e) {
|
||
console.log(e);
|
||
},
|
||
fail: function (e) {
|
||
console.log("showToast 调用失败");
|
||
}
|
||
});
|
||
});
|
||
});
|
||
} else if (o.cancel) {
|
||
console.log("取消1111");
|
||
e.videoDisplayFailureCallBack();
|
||
window.qq.showToast({
|
||
title: "未观看完整视频!",
|
||
icon: "none",
|
||
duration: 1e3,
|
||
success: function (e) {
|
||
console.log("".concat(e));
|
||
},
|
||
fail: function (e) {
|
||
console.log("showToast调用失败");
|
||
}
|
||
});
|
||
} else {
|
||
e.videoDisplayFailureCallBack();
|
||
window.qq.showToast({
|
||
title: "未观看完整视频!",
|
||
icon: "none",
|
||
duration: 1e3,
|
||
success: function (e) {
|
||
console.log("".concat(e));
|
||
},
|
||
fail: function (e) {
|
||
console.log("showToast调用失败");
|
||
}
|
||
});
|
||
}
|
||
},
|
||
fail: function (o) {
|
||
console.log("showModal调用失败");
|
||
e.videoDisplayFailureCallBack();
|
||
window.qq.showToast({
|
||
title: "未观看完整视频!",
|
||
icon: "none",
|
||
duration: 1e3,
|
||
success: function (e) {
|
||
console.log("".concat(e));
|
||
},
|
||
fail: function (e) {
|
||
console.log("showToast调用失败");
|
||
}
|
||
});
|
||
}
|
||
});
|
||
} else {
|
||
e.videoDisplayFailureCallBack();
|
||
window.qq.showToast({
|
||
title: "未观看完整视频!",
|
||
icon: "none",
|
||
duration: 1e3,
|
||
success: function (e) {
|
||
console.log("".concat(e));
|
||
},
|
||
fail: function (e) {
|
||
console.log("showToast调用失败");
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
e.BannerInstance = window.qq.createBannerAd({
|
||
adUnitId: e.BannerCode,
|
||
style: {
|
||
left: (qq.getSystemInfoSync().screenWidth - .4 * qq.getSystemInfoSync().screenWidth) / 2,
|
||
top: qq.getSystemInfoSync().screenHeight - 100,
|
||
width: .4 * qq.getSystemInfoSync().screenWidth,
|
||
height: .4 * qq.getSystemInfoSync().screenWidth * .24
|
||
},
|
||
adIntervals: 30
|
||
});
|
||
e.BannerInstance.onResize(function (o) {
|
||
if (0 != o.width && 0 != o.height) {
|
||
e.BannerInstance.style.top = e.SystemInformation.windowHeight - o.height;
|
||
e.BannerInstance.style.left = (e.SystemInformation.windowWidth - o.width) / 2;
|
||
}
|
||
});
|
||
e.BannerInstance.onError(function (e) {
|
||
console.log("banner sdk bannerAd错误日志" + e.errMsg + e.errCode);
|
||
});
|
||
this.executeBlockAdShow();
|
||
}
|
||
}, {
|
||
key: "sceneTrue",
|
||
value: function () {
|
||
var e = qq.getLaunchOptionsSync().scene;
|
||
console.log("场景值:" + e);
|
||
if (window.ServerConfigBd.sceneID == []) {
|
||
return false;
|
||
}
|
||
var o = window.ServerConfigBd.sceneID;
|
||
for (var t = 0; t < o.length; t++) {
|
||
if (e == o[t]) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
}, {
|
||
key: "winVideo",
|
||
value: function () {
|
||
this.wincount++;
|
||
0 !== window.ServerConfigBd.winVideo && this.wincount % window.ServerConfigBd.winVideo == 0 && this.executeShowAwardVideo(null, null);
|
||
}
|
||
}, {
|
||
key: "showAddZhuomian",
|
||
value: function (e, o) {
|
||
console.log("执行3:" + window.ServerConfigBd.randomSendDesk + "isJieSuan::" + o);
|
||
console.log("执行2:" + this.GaiLv(window.ServerConfigBd.randomSendDesk));
|
||
if (o) {
|
||
this.GaiLv(window.ServerConfigBd.randomSendDesk) && this.sendDesktopShortcut(null, false, function () {});
|
||
} else {
|
||
this.sendDesktopShortcut(e, o, function () {});
|
||
}
|
||
}
|
||
}, {
|
||
key: "showMainCaiqian",
|
||
value: function () {
|
||
if (arguments.length > 0 && undefined !== arguments[0] && arguments[0]) {
|
||
this.GaiLv(window.GameConfig.randomLoadCaiQian) && 0 == qq.isColorSignExistSync() && this.executeAddColorSign();
|
||
} else {
|
||
0 == qq.isColorSignExistSync() && this.executeAddColorSign();
|
||
}
|
||
}
|
||
}, {
|
||
key: "executeShowBanner",
|
||
value: function () {
|
||
if (0 != window.ServerConfigBd.showbanner) {
|
||
if (null == this.BannerInstance) {
|
||
var e = this;
|
||
e.BannerInstance = window.qq.createBannerAd({
|
||
adUnitId: e.BannerCode,
|
||
style: {
|
||
left: (qq.getSystemInfoSync().screenWidth - .4 * qq.getSystemInfoSync().screenWidth) / 2,
|
||
top: qq.getSystemInfoSync().screenHeight - 100,
|
||
width: .4 * qq.getSystemInfoSync().screenWidth,
|
||
height: .4 * qq.getSystemInfoSync().screenWidth * .24
|
||
},
|
||
adIntervals: 30
|
||
});
|
||
e.BannerInstance.onResize(function (o) {
|
||
if (0 != o.width && 0 != o.height) {
|
||
e.BannerInstance.style.top = e.SystemInformation.windowHeight - o.height;
|
||
e.BannerInstance.style.left = (e.SystemInformation.windowWidth - o.width) / 2;
|
||
}
|
||
});
|
||
e.BannerInstance.onError(function (e) {
|
||
console.log("banner sdk bannerAd错误日志" + e.errMsg + e.errCode);
|
||
});
|
||
}
|
||
console.log("qq显示banner");
|
||
null != this.BannerInstance && this.BannerInstance.show();
|
||
this.showChaPingMoreGame();
|
||
}
|
||
}
|
||
}, {
|
||
key: "executeHideBanner",
|
||
value: function () {
|
||
console.log("隐藏Banner");
|
||
if (null != this.BannerInstance) {
|
||
this.BannerInstance.offResize();
|
||
this.BannerInstance.offError();
|
||
this.BannerInstance.destroy();
|
||
this.BannerInstance = null;
|
||
}
|
||
}
|
||
}, {
|
||
key: "Suijivideo",
|
||
value: function () {
|
||
console.log("qq随机视频");
|
||
this.GaiLv(window.ServerConfigBd.randomShowvideo) && this.executeShowAwardVideo(null, null);
|
||
}
|
||
}, {
|
||
key: "kaipingVideo",
|
||
value: function () {
|
||
console.log("是否第一次:" + this.kaiping);
|
||
if (this.GaiLv(window.ServerConfigBd.randomkaiping) && this.sceneTrue() && this.kaiping) {
|
||
this.executeShowAwardVideo();
|
||
this.kaiping = false;
|
||
}
|
||
}
|
||
}, {
|
||
key: "executeShowInterstitials",
|
||
value: function () {
|
||
console.log("qq运行显示插屏");
|
||
var e = qq.createInterstitialAd({
|
||
adUnitId: this.InterstitialCode
|
||
});
|
||
e.load().then(function () {
|
||
e.show().catch(function (n) {
|
||
console.error("show", n);
|
||
e.offLoad(o);
|
||
e.offError(t);
|
||
e.offClose(i);
|
||
});
|
||
}).catch(function (n) {
|
||
console.error("load", n);
|
||
e.offLoad(o);
|
||
e.offError(t);
|
||
e.offClose(i);
|
||
});
|
||
var o = function () {
|
||
console.log("onLoad event emit");
|
||
};
|
||
var t = function t(n) {
|
||
console.log("error", n);
|
||
e.offLoad(o);
|
||
e.offError(t);
|
||
e.offClose(i);
|
||
};
|
||
var i = function i() {
|
||
console.log("close event emit");
|
||
e.offLoad(o);
|
||
e.offError(t);
|
||
e.offClose(i);
|
||
};
|
||
e.onLoad(o);
|
||
e.onClose(i);
|
||
e.onError(t);
|
||
}
|
||
}, {
|
||
key: "executeShowAwardVideo",
|
||
value: function (e, o) {
|
||
var t = this;
|
||
console.log("qq显示激励视频");
|
||
this.VideoSuccessCallBack = e;
|
||
this.VideoFailureCallBack = o;
|
||
this.VideoInstance.show().then(function () {
|
||
return console.log("激励视频 广告显示");
|
||
}).catch(function () {
|
||
t.VideoInstance.load().then(function () {
|
||
return t.VideoInstance.show();
|
||
}).catch(function (e) {
|
||
console.log("激励视频 广告显示失败");
|
||
window.qq.showToast({
|
||
title: "广告加载失败,请稍后重试!",
|
||
icon: "none",
|
||
duration: 1e3,
|
||
success: function (e) {
|
||
console.log("".concat(e));
|
||
},
|
||
fail: function (e) {
|
||
console.log("showToast 调用失败");
|
||
}
|
||
});
|
||
});
|
||
});
|
||
this.VideoInstance.onError(function (e) {
|
||
console.log(e);
|
||
});
|
||
}
|
||
}, {
|
||
key: "videoDisplaySuccessCallBack",
|
||
value: function () {
|
||
if (null != this.VideoSuccessCallBack) {
|
||
this.VideoSuccessCallBack();
|
||
this.VideoSuccessCallBack = null;
|
||
}
|
||
}
|
||
}, {
|
||
key: "videoDisplayFailureCallBack",
|
||
value: function () {
|
||
if (null != this.VideoFailureCallBack) {
|
||
this.VideoFailureCallBack();
|
||
this.VideoFailureCallBack = null;
|
||
}
|
||
}
|
||
}, {
|
||
key: "executeShowPushBox",
|
||
value: function () {
|
||
console.log("qq执行显示");
|
||
var e = window.qq.createAppBox({
|
||
adUnitId: this.GameBoxCode
|
||
});
|
||
e.onClose(function () {
|
||
e.destroy().then(function () {}).catch(function (e) {});
|
||
}.bind(this));
|
||
e.load().then(function () {
|
||
e.show().then(function () {}).catch(function (e) {});
|
||
}).catch(function (e) {});
|
||
}
|
||
}, {
|
||
key: "sendDesktopShortcut",
|
||
value: function (e, o) {
|
||
var t = arguments.length > 2 && undefined !== arguments[2] ? arguments[2] : null;
|
||
qq.saveAppToDesktop({
|
||
success: function (e) {
|
||
console.log("添加桌面成功");
|
||
},
|
||
fail: function (e) {
|
||
console.log("添加桌面失败" + JSON.stringify(e));
|
||
if (t) {
|
||
t();
|
||
t = null;
|
||
}
|
||
},
|
||
complete: function () {
|
||
e && (e.active = false);
|
||
window.qq.showToast({
|
||
title: "添加桌面成功",
|
||
icon: "none",
|
||
duration: 1e3
|
||
});
|
||
}
|
||
});
|
||
}
|
||
}, {
|
||
key: "executeBlockAdShow",
|
||
value: function () {
|
||
var e = this;
|
||
console.log("积木=====");
|
||
if (window.ServerConfigBd.showBlock) {
|
||
this.destorBlockAd();
|
||
this.ShuaxinTime = setInterval(function () {
|
||
e.closeBlockAd();
|
||
window.qq.getSystemInfoSync();
|
||
e.BlockInstance = window.qq.createBlockAd({
|
||
adUnitId: e.BlockCode,
|
||
style: {
|
||
left: 50,
|
||
top: e.SystemInformation.windowHeight / 4.7
|
||
},
|
||
size: 1,
|
||
orientation: "vertical"
|
||
});
|
||
e.BlockInstance.onLoad(function (o) {
|
||
e.BlockInstance.show();
|
||
});
|
||
e.BlockInstance.onError(function (e) {
|
||
console.log("积木广告失败::" + e.errMsg + " code " + e.errCode);
|
||
});
|
||
e.BlockInstance.onResize(function (e) {});
|
||
}, 5e3);
|
||
}
|
||
}
|
||
}, {
|
||
key: "closeBlockAd",
|
||
value: function () {
|
||
if (null != this.BlockInstance) {
|
||
this.BlockInstance.destroy();
|
||
this.BlockInstance.hide();
|
||
this.BlockInstance = null;
|
||
}
|
||
}
|
||
}, {
|
||
key: "destorBlockAd",
|
||
value: function () {
|
||
null != this.ShuaxinTime && clearInterval(this.ShuaxinTime);
|
||
this.closeBlockAd();
|
||
}
|
||
}, {
|
||
key: "executeAddColorSign",
|
||
value: function () {
|
||
if (0 == qq.isColorSignExistSync()) {
|
||
console.log("qq.isColorSignExistSync" + qq.isColorSignExistSync());
|
||
qq.addColorSign({
|
||
success: function (e) {
|
||
console.log("添加彩签成功");
|
||
},
|
||
fail: function (e) {
|
||
console.log("添加彩签失败" + JSON.stringify(e));
|
||
},
|
||
complete: function () {}
|
||
});
|
||
}
|
||
}
|
||
}, {
|
||
key: "showChaPingMoreGame",
|
||
value: function () {
|
||
if (0 != window.ServerConfigBd.randomChaping) {
|
||
if (this.GaiLv(window.ServerConfigBd.randomChaping)) {
|
||
this.executeShowInterstitials();
|
||
} else {
|
||
this.executeShowPushBox();
|
||
}
|
||
}
|
||
}
|
||
}, {
|
||
key: "executeRecorder",
|
||
value: function () {}
|
||
}, {
|
||
key: "stopRecorder",
|
||
value: function () {}
|
||
}, {
|
||
key: "isInstalledShortcut",
|
||
value: function () {}
|
||
}, {
|
||
key: "executeShareRecorder",
|
||
value: function (e, o) {
|
||
this.shareSuccessHandle = e;
|
||
this.shareFailureHandle = o;
|
||
this.isOpenShare = true;
|
||
window.qq.shareAppMessage({
|
||
title: this.shareText,
|
||
imageUrl: this.shareImgUrl,
|
||
success: function () {
|
||
console.log("分享视频成功111");
|
||
e && e();
|
||
},
|
||
fail: function (e) {
|
||
console.log("分享视频失败");
|
||
o && o();
|
||
}
|
||
});
|
||
console.log("分享---");
|
||
}
|
||
}, {
|
||
key: "GaiLv",
|
||
value: function (e) {
|
||
var o = 1 + Math.floor(100 * Math.random());
|
||
console.log("随机数为:" + o);
|
||
console.log("服务器值为:" + e);
|
||
return o <= e;
|
||
}
|
||
}]);
|
||
return e;
|
||
}();
|
||
module.exports = new c(); |