添加疯狂游乐场和爱微游平台
This commit is contained in:
parent
40884f4e75
commit
9b98cd4092
32
README.md
Normal file
32
README.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# 精简版本的jcfw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
各平台分别打包, 打包命令如下:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 第一次需要运行如下命令
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# 生成开发包, plat可选参数: h5,oppp, qqmini, tt, wechat, vivo, xiaomi, huawei
|
||||||
|
gulp dev --plat wechat
|
||||||
|
|
||||||
|
# 生成dist包
|
||||||
|
gulp --plat wechat
|
||||||
|
```
|
||||||
|
|
||||||
|
使用方法:
|
||||||
|
|
||||||
|
打包对应平台的包, 比如 jcfw.wechat.min.js
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
require('jcfw.wechat.min.js');
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
httpPost(url, postdata, cbRes, cbErr, contentType) {
|
httpPost(url, postdata, cbRes, cbErr, contentType) {
|
||||||
contentType = contentType || 'application/json';
|
contentType = contentType || 'text/plain;charset=UTF-8';
|
||||||
return this.httpsend(url, postdata, cbRes, cbErr, 'POST', contentType);
|
return this.httpsend(url, postdata, cbRes, cbErr, 'POST', contentType);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -86,7 +86,9 @@ var JCFW = {
|
|||||||
QQ_MINI: 6007,
|
QQ_MINI: 6007,
|
||||||
TEST: 6000,
|
TEST: 6000,
|
||||||
HUAWEI: 6008,
|
HUAWEI: 6008,
|
||||||
XIAOMI: 6009
|
XIAOMI: 6009,
|
||||||
|
CRAZY_GAME: 7003,
|
||||||
|
IWEI: 7004,
|
||||||
},
|
},
|
||||||
|
|
||||||
__getUrl(isoffical, key, env) {
|
__getUrl(isoffical, key, env) {
|
||||||
@ -120,7 +122,7 @@ var JCFW = {
|
|||||||
* @param {object} cfgsuccesscb: 后台配置成功回调
|
* @param {object} cfgsuccesscb: 后台配置成功回调
|
||||||
* @param {object} cfgfailcb: 后台配置失败回调
|
* @param {object} cfgfailcb: 后台配置失败回调
|
||||||
* @param {any} jcdev: 是否是开发环境
|
* @param {any} jcdev: 是否是开发环境
|
||||||
* @param {string} appid: 游戏的appid
|
* @param {string} appid: 游戏的appid, 华为快游戏须传此字段, 疯狂游乐场须将他们定义的游戏id通过此字段传进来
|
||||||
*/
|
*/
|
||||||
init({channelid, gameid, isoffical, response, env, adparam, cfgsuccesscb, cfgfailcb, jcdev, appid}) {
|
init({channelid, gameid, isoffical, response, env, adparam, cfgsuccesscb, cfgfailcb, jcdev, appid}) {
|
||||||
this.channelID = parseInt(channelid);
|
this.channelID = parseInt(channelid);
|
||||||
|
@ -1,58 +1,28 @@
|
|||||||
var PLAT_XM = {
|
var PLAT_HUAWEI = {
|
||||||
SHARE_FAIL: 25,
|
SHARE_FAIL: 25,
|
||||||
SHARE_TIME: 3000,
|
SHARE_TIME: 3000,
|
||||||
|
appid: '',
|
||||||
shareCount: {},
|
shareCount: {},
|
||||||
|
|
||||||
getLaunchInfo() {
|
getSystemInfoAsync(successcb, failcb) {
|
||||||
return null;
|
hbs.getSystemInfo({
|
||||||
|
success : function (res) {
|
||||||
|
console.log("getSystemInfo success res = " + res.brand);
|
||||||
|
successcb && successcb(res);
|
||||||
|
},
|
||||||
|
fail:function(){
|
||||||
|
console.log("getSystemInfo fail");
|
||||||
|
failcb && failcb();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getSystemInfo() {
|
|
||||||
return qg.getSystemInfoSync();
|
|
||||||
},
|
|
||||||
|
|
||||||
/** example:
|
|
||||||
*
|
|
||||||
* @param {object} btninfo :
|
|
||||||
* {
|
|
||||||
* width: 100,
|
|
||||||
* height: 100,
|
|
||||||
* name: logo.png
|
|
||||||
* }
|
|
||||||
* @param {function} cb
|
|
||||||
*/
|
|
||||||
getUserInfo(btninfo, cb) {
|
getUserInfo(btninfo, cb) {
|
||||||
this._usercb = cb;
|
cb && cb(null, -1000);
|
||||||
|
|
||||||
let _flag = 0;
|
|
||||||
|
|
||||||
if (btninfo && btninfo.flag) {
|
|
||||||
_flag = btninfo.flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
let self = this;
|
|
||||||
let getInfo = function () {
|
|
||||||
console.log('[xm.getUserInfo]');
|
|
||||||
qg.getUserInfo({
|
|
||||||
success: function (res) {
|
|
||||||
res.flag = _flag;
|
|
||||||
self._usercb && self._usercb(res, 1);
|
|
||||||
},
|
|
||||||
fail: function (res) {
|
|
||||||
res.flag = _flag;
|
|
||||||
console.log(res);
|
|
||||||
self._usercb && self._usercb(res, -1, null, _flag);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
getInfo();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
destoryAuth() {
|
destoryAuth() {
|
||||||
if (this.btnAuthorize) {
|
|
||||||
this.btnAuthorize.destroy && this.btnAuthorize.destroy();
|
|
||||||
this.btnAuthorize = null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setUserInfo(dstinfo, ptinfo) {
|
setUserInfo(dstinfo, ptinfo) {
|
||||||
@ -65,17 +35,13 @@ var PLAT_XM = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setTokenInfo(dstinfo, tokeninfo) {
|
setTokenInfo(dstinfo, tokeninfo) {
|
||||||
if (tokeninfo && tokeninfo.rawData) {
|
|
||||||
dstinfo.rawData = tokeninfo.rawData;
|
|
||||||
dstinfo.signature = tokeninfo.signature;
|
|
||||||
dstinfo.encryptedData = tokeninfo.encryptedData;
|
|
||||||
dstinfo.iv = tokeninfo.iv;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
init(owner, channelid) {
|
init(owner, channelid, appid) {
|
||||||
this._owner = owner;
|
this._owner = owner;
|
||||||
this._ptid = channelid;
|
this._ptid = channelid;
|
||||||
|
this.appid = appid;
|
||||||
},
|
},
|
||||||
|
|
||||||
bindController(ctrl) {
|
bindController(ctrl) {
|
||||||
@ -83,9 +49,7 @@ var PLAT_XM = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
commonShare(aimg, atitle, stype, param, successcb, failcb, exinfo) {
|
commonShare(aimg, atitle, stype, param, successcb, failcb, exinfo) {
|
||||||
var st = (new Date()).getTime();
|
|
||||||
let sp = this._owner.makeShareParam(stype, param, exinfo);
|
let sp = this._owner.makeShareParam(stype, param, exinfo);
|
||||||
let uuid = this._owner.currUUID();
|
|
||||||
let img = aimg;
|
let img = aimg;
|
||||||
if (!img && this._exshareinfo) {
|
if (!img && this._exshareinfo) {
|
||||||
img = this._exshareinfo.imgurl;
|
img = this._exshareinfo.imgurl;
|
||||||
@ -94,8 +58,7 @@ var PLAT_XM = {
|
|||||||
if (!title && this._exshareinfo) {
|
if (!title && this._exshareinfo) {
|
||||||
title = this._exshareinfo.title;
|
title = this._exshareinfo.title;
|
||||||
}
|
}
|
||||||
this.PTShare(title, img, sp);
|
this.PTShare(title, img, sp, successcb, failcb);
|
||||||
this._checkShareRes(st, stype, sp, uuid, successcb, failcb);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
captureShare(rc, title, stype, param, successcb, failcb, exinfo) {
|
captureShare(rc, title, stype, param, successcb, failcb, exinfo) {
|
||||||
@ -104,49 +67,6 @@ var PLAT_XM = {
|
|||||||
let uuid = this._owner.currUUID();
|
let uuid = this._owner.currUUID();
|
||||||
|
|
||||||
this.PTShareCapture(title, rc, sp);
|
this.PTShareCapture(title, rc, sp);
|
||||||
this._checkShareRes(st, stype, sp, uuid, successcb, failcb);
|
|
||||||
},
|
|
||||||
|
|
||||||
_checkShareRes(starttime, sharetype, param, tokenid, successcb, failcb) {
|
|
||||||
if (!this._man) {
|
|
||||||
try {
|
|
||||||
failcb && failcb(-100, param, tokenid);
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._man.scheduleOnce(() => {
|
|
||||||
let dt = (new Date()).getTime() - starttime;
|
|
||||||
console.log(dt);
|
|
||||||
|
|
||||||
if (this.shareCount[sharetype] == undefined) {
|
|
||||||
this.shareCount[sharetype] = false;
|
|
||||||
}
|
|
||||||
if (this.shareCount[sharetype] == false && Math.random() * 100 > this.SHARE_FAIL) {
|
|
||||||
this.shareCount[sharetype] = true;
|
|
||||||
try {
|
|
||||||
failcb && failcb(-1, param, tokenid, dt);
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dt > this.SHARE_TIME) {
|
|
||||||
try {
|
|
||||||
successcb && successcb(param, tokenid, dt);
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
failcb && failcb(-2, param, tokenid, dt);
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 0.5);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
PTInitShare(normalinfo) {
|
PTInitShare(normalinfo) {
|
||||||
@ -154,7 +74,23 @@ var PLAT_XM = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PTShare(content, imgurl, param, successcb, failcb) {
|
PTShare(content, imgurl, param, successcb, failcb) {
|
||||||
successcb && successcb();
|
hbs.systemShare({
|
||||||
|
type: 'text/html',
|
||||||
|
data: content,
|
||||||
|
success:function(){
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
fail:function(erromsg, errorcode){
|
||||||
|
console.log('share fail --- ' + errorcode + ':' + erromsg)
|
||||||
|
failcb && failcb(-3, param);
|
||||||
|
},
|
||||||
|
cancel:function(data){
|
||||||
|
console.log("share cancel:" + data)
|
||||||
|
failcb && failcb(-3, param);
|
||||||
|
},
|
||||||
|
complete:function(){console.log('share complete')}
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
PTShareCapture(content, rc, param, successcb, failcb) {
|
PTShareCapture(content, rc, param, successcb, failcb) {
|
||||||
@ -162,12 +98,10 @@ var PLAT_XM = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PTOpenKF(cb, info) {
|
PTOpenKF(cb, info) {
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
PTCreateGameClubButton(nleft, ntop, nwidth) {
|
PTCreateGameClubButton(nleft, ntop, nwidth) {
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @param {string} str 显示的文字
|
* @param {string} str 显示的文字
|
||||||
@ -177,44 +111,32 @@ var PLAT_XM = {
|
|||||||
* none: 不显示图标,此时 title 文本最多可显示两行
|
* none: 不显示图标,此时 title 文本最多可显示两行
|
||||||
* */
|
* */
|
||||||
PTShowToast(str, icon) {
|
PTShowToast(str, icon) {
|
||||||
|
hbs.showToast({
|
||||||
|
title: str,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
PTGotoApp(appid, apppath, exobj, cb, qdid, env, acontent) {
|
PTGotoApp(appid, apppath, exobj, cb, qdid, env, acontent) {
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
PTLogin(info, successcb, failcb) {
|
PTLogin(info, successcb, failcb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
qg.login({
|
hbs.gameLogin({
|
||||||
|
forceLogin: 1,
|
||||||
|
appid: this.appid,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
self._owner.login.login({
|
console.log('[hbs]hbs login success');
|
||||||
token: res.data.appAccountId,
|
self._owner.login.login({token: res.playerId, successcb, failcb});
|
||||||
successcb: function (obj) {
|
|
||||||
obj.clientSession = res.data.session;
|
|
||||||
successcb && successcb(obj);
|
|
||||||
}, failcb
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
fail: function (res) {
|
fail: function (res) {
|
||||||
console.log('[xm]login fail!');
|
console.log('[hbs]login fail!', res);
|
||||||
failcb && failcb(0, res ? res.errcode : -1, res ? res.errMsg : '');
|
failcb && failcb(0, res ? res.errcode : -1, res ? res.data : '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
PTSetClipboardData: function (content, successcb, failcb) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
PTGetClipboardData: function (successcb, failcb) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
PTPreviewImage(imgurl, successcb, failcb) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
//广告相关
|
//广告相关
|
||||||
PTInitADService() {
|
PTInitADService() {
|
||||||
|
|
||||||
@ -225,48 +147,37 @@ var PLAT_XM = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PTCreateVideoAD(adid) {
|
PTCreateVideoAD(adid) {
|
||||||
if (qg.createRewardedVideoAd) {
|
|
||||||
let data = {
|
|
||||||
adUnitId: adid
|
|
||||||
};
|
|
||||||
return qg.createRewardedVideoAd(data);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
PTCreateInsertAD(adid) {
|
PTCreateInsertAD(adid) {
|
||||||
if (qg.createInterstitialAd) {
|
|
||||||
let data = {
|
|
||||||
adUnitId: adid
|
|
||||||
};
|
|
||||||
return qg.createInterstitialAd(data);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
PTSetVideoADCallback(adobj, adowner, cb) {
|
PTSetVideoADCallback(adobj, adowner, cb) {
|
||||||
let closeCb = function (res) {
|
|
||||||
console.log('[ad]onClose:' + JSON.stringify(res));
|
|
||||||
// 用户点击了【关闭广告】按钮
|
|
||||||
// 小于 2.1.0 的基础库版本,res 是一个 undefined
|
|
||||||
if (res && res.isEnded || res === undefined) {
|
|
||||||
// 正常播放结束,可以下发游戏奖励
|
|
||||||
cb && cb(res.isEnded, adowner, res);
|
|
||||||
} else {
|
|
||||||
// 播放中途退出,不下发游戏奖励
|
|
||||||
cb && cb(false, adowner, res);
|
|
||||||
}
|
|
||||||
// ad.offClose && ad.offClose(closeCb);
|
|
||||||
};
|
|
||||||
adobj.onClose && adobj.onClose(closeCb);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
PTVibrateShort(successcb, failcb) {
|
PTVibrateShort(successcb, failcb) {
|
||||||
|
hbs.vibrateShort({
|
||||||
|
success: () => {
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
failcb && failcb();
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
PTVibrateLong(successcb, failcb) {
|
PTVibrateLong(successcb, failcb) {
|
||||||
|
hbs.vibrateLong({
|
||||||
|
success: () => {
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
failcb && failcb();
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -277,59 +188,53 @@ var PLAT_XM = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PTPostOpenMsg(msg) {
|
PTPostOpenMsg(msg) {
|
||||||
|
const openDataContext = this.PTOpenDataContext();
|
||||||
|
openDataContext && openDataContext.postMessage(msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 排行榜相关
|
// 排行榜相关
|
||||||
saveRankData(nscore, nmoney, stitle) {
|
saveRankData(nscore, nmoney, stitle) {
|
||||||
|
const openDataContext = this.PTOpenDataContext();
|
||||||
|
openDataContext && openDataContext.postMessage({
|
||||||
|
type: 'save_data',
|
||||||
|
score: nscore,
|
||||||
|
money: nmoney,
|
||||||
|
title: stitle
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
showRankData() {
|
showRankData() {
|
||||||
|
const openDataContext = this.PTOpenDataContext();
|
||||||
|
openDataContext && openDataContext.postMessage({
|
||||||
|
type: 'friends_all'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
hideRankData() {
|
hideRankData() {
|
||||||
|
const openDataContext = this.PTOpenDataContext();
|
||||||
|
openDataContext && openDataContext.postMessage({
|
||||||
|
type: 'friends_all_hide'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
prevRankPage() {
|
prevRankPage() {
|
||||||
|
const openDataContext = this.PTOpenDataContext();
|
||||||
|
openDataContext && openDataContext.postMessage({
|
||||||
|
type: 'pagechange',
|
||||||
|
prev: 1
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
nextRankPage() {
|
nextRankPage() {
|
||||||
|
const openDataContext = this.PTOpenDataContext();
|
||||||
|
openDataContext && openDataContext.postMessage({
|
||||||
|
type: 'pagechange',
|
||||||
|
next: 1
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
PTADWatch(adid, successcb, failcb) {
|
PTADWatch(adid, successcb, failcb) {
|
||||||
let videoAd = qg.createRewardedVideoAd({
|
failcb && failcb(adid, {}, true, adid);
|
||||||
adUnitId: adid
|
|
||||||
});
|
|
||||||
|
|
||||||
videoAd.onLoad = function () {
|
|
||||||
videoAd.offLoad(this);
|
|
||||||
videoAd.show();
|
|
||||||
}
|
|
||||||
var errorCb = function (res) {
|
|
||||||
console.log('[videoad]onerror:' + JSON.stringify(res));
|
|
||||||
failcb && failcb(adid, res, true, adid);
|
|
||||||
videoAd.offError(this);
|
|
||||||
}
|
|
||||||
videoAd.onError(errorCb);
|
|
||||||
|
|
||||||
var getFun = function (res) {
|
|
||||||
if (res.isEnded) {
|
|
||||||
try {
|
|
||||||
successcb && successcb(adid, res, adid);
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
cb = null;
|
|
||||||
}
|
|
||||||
videoAd.offClose(this);
|
|
||||||
}
|
|
||||||
videoAd.onClose(getFun);
|
|
||||||
videoAd.load();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setLocalStorage(key, value) {
|
setLocalStorage(key, value) {
|
||||||
@ -353,4 +258,4 @@ var PLAT_XM = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = PLAT_XM;
|
module.exports = PLAT_HUAWEI;
|
||||||
|
320
jcfw/platform/plat_crazygame.js
Normal file
320
jcfw/platform/plat_crazygame.js
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
var getParameter = function(t) {
|
||||||
|
var e = window.location.search,
|
||||||
|
i = new RegExp(t + "=([^&?]*)", "ig");
|
||||||
|
return e.match(i) ? e.match(i)[0].substr(t.length + 1) : null
|
||||||
|
}
|
||||||
|
var PLAT_CRAZY = {
|
||||||
|
SHARE_FAIL: 25,
|
||||||
|
SHARE_TIME: 3000,
|
||||||
|
shareCount: {},
|
||||||
|
|
||||||
|
getLaunchInfo() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getSystemInfo() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
/** example:
|
||||||
|
*
|
||||||
|
* @param {object} btninfo :
|
||||||
|
* {
|
||||||
|
* width: 100,
|
||||||
|
* height: 100,
|
||||||
|
* name: logo.png
|
||||||
|
* }
|
||||||
|
* @param {function} cb
|
||||||
|
*/
|
||||||
|
getUserInfo(btninfo, cb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
destoryAuth() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
setUserInfo(dstinfo, ptinfo) {
|
||||||
|
dstinfo.nickname = ptinfo.nickName;
|
||||||
|
dstinfo.country = ptinfo.country;
|
||||||
|
dstinfo.province = ptinfo.province;
|
||||||
|
dstinfo.city = ptinfo.city;
|
||||||
|
dstinfo.avatar_url = ptinfo.avatarUrl;
|
||||||
|
dstinfo.sex = ptinfo.gender;
|
||||||
|
},
|
||||||
|
|
||||||
|
setTokenInfo(dstinfo, tokeninfo) {
|
||||||
|
if (tokeninfo && tokeninfo.rawData) {
|
||||||
|
dstinfo.rawData = tokeninfo.rawData;
|
||||||
|
dstinfo.signature = tokeninfo.signature;
|
||||||
|
dstinfo.encryptedData = tokeninfo.encryptedData;
|
||||||
|
dstinfo.iv = tokeninfo.iv;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
init(owner, channelid, appId) {
|
||||||
|
this._owner = owner;
|
||||||
|
this._ptid = channelid;
|
||||||
|
this._platGameId = appId;
|
||||||
|
this.sdk = window.HORTOR_AGENT;
|
||||||
|
this.sdk.init(function (status) {
|
||||||
|
console.log('crazy game init with status: ' + status);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
bindController(ctrl) {
|
||||||
|
this._man = ctrl;
|
||||||
|
},
|
||||||
|
|
||||||
|
commonShare(aimg, atitle, stype, param, successcb, failcb, exinfo) {
|
||||||
|
var st = (new Date()).getTime();
|
||||||
|
let sp = this._owner.makeShareParam(stype, param, exinfo);
|
||||||
|
let uuid = this._owner.currUUID();
|
||||||
|
let img = aimg;
|
||||||
|
if (!img && this._exshareinfo) {
|
||||||
|
img = this._exshareinfo.imgurl;
|
||||||
|
}
|
||||||
|
let title = atitle;
|
||||||
|
if (!title && this._exshareinfo) {
|
||||||
|
title = this._exshareinfo.title;
|
||||||
|
}
|
||||||
|
this.PTShare(title, img, sp);
|
||||||
|
this._checkShareRes(st, stype, sp, uuid, successcb, failcb);
|
||||||
|
},
|
||||||
|
|
||||||
|
captureShare(rc, title, stype, param, successcb, failcb, exinfo) {
|
||||||
|
var st = (new Date()).getTime();
|
||||||
|
let sp = this._owner.makeShareParam(stype, param, exinfo);
|
||||||
|
let uuid = this._owner.currUUID();
|
||||||
|
|
||||||
|
this.PTShareCapture(title, rc, sp);
|
||||||
|
this._checkShareRes(st, stype, sp, uuid, successcb, failcb);
|
||||||
|
},
|
||||||
|
|
||||||
|
_checkShareRes(starttime, sharetype, param, tokenid, successcb, failcb) {
|
||||||
|
if (!this._man) {
|
||||||
|
try {
|
||||||
|
failcb && failcb(-100, param, tokenid);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._man.scheduleOnce(() => {
|
||||||
|
let dt = (new Date()).getTime() - starttime;
|
||||||
|
console.log(dt);
|
||||||
|
|
||||||
|
if (this.shareCount[sharetype] == undefined) {
|
||||||
|
this.shareCount[sharetype] = false;
|
||||||
|
}
|
||||||
|
if (this.shareCount[sharetype] == false && Math.random() * 100 > this.SHARE_FAIL) {
|
||||||
|
this.shareCount[sharetype] = true;
|
||||||
|
try {
|
||||||
|
failcb && failcb(-1, param, tokenid, dt);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dt > this.SHARE_TIME) {
|
||||||
|
try {
|
||||||
|
successcb && successcb(param, tokenid, dt);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
failcb && failcb(-2, param, tokenid, dt);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0.5);
|
||||||
|
},
|
||||||
|
|
||||||
|
PTInitShare(normalinfo) {
|
||||||
|
if (!normalinfo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this._exshareinfo) {
|
||||||
|
this._exshareinfo = normalinfo;
|
||||||
|
} else {
|
||||||
|
if (normalinfo.title && this._exshareinfo.title != normalinfo.title) {
|
||||||
|
this._exshareinfo.title = normalinfo.title;
|
||||||
|
}
|
||||||
|
if (normalinfo.imgurl && this._exshareinfo.imgurl != normalinfo.imgurl) {
|
||||||
|
this._exshareinfo.imgurl = normalinfo.imgurl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sdk.config({
|
||||||
|
gameId: this._platGameId,
|
||||||
|
share: {
|
||||||
|
timeline: {
|
||||||
|
title: this._exshareinfo.title,
|
||||||
|
imgUrl: this._exshareinfo.imgurl,
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
},
|
||||||
|
cancel: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
friend: {
|
||||||
|
title: this._exshareinfo.title,
|
||||||
|
desc: this._exshareinfo.title,
|
||||||
|
imgUrl: this._exshareinfo.imgurl,
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
},
|
||||||
|
cancel: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
shareCustomParam:{//配置⾃自定义参数
|
||||||
|
// cp_fromid: this._owner.accountID,//⾃自定义参数key必须以cp_开始
|
||||||
|
// cp_fromname: this._owner.nickName,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
PTShare(content, imgurl, param, successcb, failcb) {
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
|
||||||
|
PTShareCapture(content, rc, param, successcb, failcb) {
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
|
||||||
|
PTOpenKF(cb, info) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateGameClubButton(nleft, ntop, nwidth) {
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @param {string} str 显示的文字
|
||||||
|
* @param {icon} icon 图标类型 默认'none';
|
||||||
|
* success: 显示成功图标
|
||||||
|
* loading: 显示加载图标
|
||||||
|
* none: 不显示图标,此时 title 文本最多可显示两行
|
||||||
|
* */
|
||||||
|
PTShowToast(str, icon) {
|
||||||
|
},
|
||||||
|
|
||||||
|
PTGotoApp(appid, apppath, exobj, cb, qdid, env, acontent) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTLogin(info, successcb, failcb) {
|
||||||
|
var self = this;
|
||||||
|
var token = getParameter('token');
|
||||||
|
if (!token) {
|
||||||
|
return failcb && failcb(0, -1, '未找到有效的token');
|
||||||
|
}
|
||||||
|
self._owner.login.login({
|
||||||
|
token: token,
|
||||||
|
successcb, failcb
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
PTSetClipboardData: function (content, successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTGetClipboardData: function (successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTPreviewImage(imgurl, successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
//广告相关
|
||||||
|
PTInitADService() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateBannerAD(adid, st) {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateVideoAD(adid) {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateInsertAD(adid) {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTSetVideoADCallback(adobj, adowner, cb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTVibrateShort(successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTVibrateLong(successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {null}
|
||||||
|
*/
|
||||||
|
PTOpenDataContext() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTPostOpenMsg(msg) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 排行榜相关
|
||||||
|
saveRankData(nscore, nmoney, stitle) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
showRankData() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
hideRankData() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
prevRankPage() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
nextRankPage() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTADWatch(adid, successcb, failcb) {
|
||||||
|
},
|
||||||
|
|
||||||
|
setLocalStorage(key, value) {
|
||||||
|
if (window.localStorage) {
|
||||||
|
localStorage.setItem(key, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalStorage(key) {
|
||||||
|
if (window.localStorage) {
|
||||||
|
return localStorage.getItem(key);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeStorage(key) {
|
||||||
|
if (window.localStorage) {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = PLAT_CRAZY;
|
@ -113,7 +113,7 @@ var PLAT_HUAWEI = {
|
|||||||
PTShowToast(str, icon) {
|
PTShowToast(str, icon) {
|
||||||
hbs.showToast({
|
hbs.showToast({
|
||||||
title: str,
|
title: str,
|
||||||
icon: icon
|
icon: 'none'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
356
jcfw/platform/plat_iwei.js
Normal file
356
jcfw/platform/plat_iwei.js
Normal file
@ -0,0 +1,356 @@
|
|||||||
|
var PLAT_IWEI = {
|
||||||
|
SHARE_FAIL: 25,
|
||||||
|
SHARE_TIME: 3000,
|
||||||
|
shareCount: {},
|
||||||
|
|
||||||
|
getLaunchInfo() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getSystemInfo() {
|
||||||
|
return qg.getSystemInfoSync();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** example:
|
||||||
|
*
|
||||||
|
* @param {object} btninfo :
|
||||||
|
* {
|
||||||
|
* width: 100,
|
||||||
|
* height: 100,
|
||||||
|
* name: logo.png
|
||||||
|
* }
|
||||||
|
* @param {function} cb
|
||||||
|
*/
|
||||||
|
getUserInfo(btninfo, cb) {
|
||||||
|
this._usercb = cb;
|
||||||
|
|
||||||
|
let _flag = 0;
|
||||||
|
|
||||||
|
if (btninfo && btninfo.flag) {
|
||||||
|
_flag = btninfo.flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let getInfo = function () {
|
||||||
|
console.log('[xm.getUserInfo]');
|
||||||
|
qg.getUserInfo({
|
||||||
|
success: function (res) {
|
||||||
|
res.flag = _flag;
|
||||||
|
self._usercb && self._usercb(res, 1);
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
res.flag = _flag;
|
||||||
|
console.log(res);
|
||||||
|
self._usercb && self._usercb(res, -1, null, _flag);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getInfo();
|
||||||
|
},
|
||||||
|
|
||||||
|
destoryAuth() {
|
||||||
|
if (this.btnAuthorize) {
|
||||||
|
this.btnAuthorize.destroy && this.btnAuthorize.destroy();
|
||||||
|
this.btnAuthorize = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setUserInfo(dstinfo, ptinfo) {
|
||||||
|
dstinfo.nickname = ptinfo.nickName;
|
||||||
|
dstinfo.country = ptinfo.country;
|
||||||
|
dstinfo.province = ptinfo.province;
|
||||||
|
dstinfo.city = ptinfo.city;
|
||||||
|
dstinfo.avatar_url = ptinfo.avatarUrl;
|
||||||
|
dstinfo.sex = ptinfo.gender;
|
||||||
|
},
|
||||||
|
|
||||||
|
setTokenInfo(dstinfo, tokeninfo) {
|
||||||
|
if (tokeninfo && tokeninfo.rawData) {
|
||||||
|
dstinfo.rawData = tokeninfo.rawData;
|
||||||
|
dstinfo.signature = tokeninfo.signature;
|
||||||
|
dstinfo.encryptedData = tokeninfo.encryptedData;
|
||||||
|
dstinfo.iv = tokeninfo.iv;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
init(owner, channelid) {
|
||||||
|
this._owner = owner;
|
||||||
|
this._ptid = channelid;
|
||||||
|
},
|
||||||
|
|
||||||
|
bindController(ctrl) {
|
||||||
|
this._man = ctrl;
|
||||||
|
},
|
||||||
|
|
||||||
|
commonShare(aimg, atitle, stype, param, successcb, failcb, exinfo) {
|
||||||
|
var st = (new Date()).getTime();
|
||||||
|
let sp = this._owner.makeShareParam(stype, param, exinfo);
|
||||||
|
let uuid = this._owner.currUUID();
|
||||||
|
let img = aimg;
|
||||||
|
if (!img && this._exshareinfo) {
|
||||||
|
img = this._exshareinfo.imgurl;
|
||||||
|
}
|
||||||
|
let title = atitle;
|
||||||
|
if (!title && this._exshareinfo) {
|
||||||
|
title = this._exshareinfo.title;
|
||||||
|
}
|
||||||
|
this.PTShare(title, img, sp);
|
||||||
|
this._checkShareRes(st, stype, sp, uuid, successcb, failcb);
|
||||||
|
},
|
||||||
|
|
||||||
|
captureShare(rc, title, stype, param, successcb, failcb, exinfo) {
|
||||||
|
var st = (new Date()).getTime();
|
||||||
|
let sp = this._owner.makeShareParam(stype, param, exinfo);
|
||||||
|
let uuid = this._owner.currUUID();
|
||||||
|
|
||||||
|
this.PTShareCapture(title, rc, sp);
|
||||||
|
this._checkShareRes(st, stype, sp, uuid, successcb, failcb);
|
||||||
|
},
|
||||||
|
|
||||||
|
_checkShareRes(starttime, sharetype, param, tokenid, successcb, failcb) {
|
||||||
|
if (!this._man) {
|
||||||
|
try {
|
||||||
|
failcb && failcb(-100, param, tokenid);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._man.scheduleOnce(() => {
|
||||||
|
let dt = (new Date()).getTime() - starttime;
|
||||||
|
console.log(dt);
|
||||||
|
|
||||||
|
if (this.shareCount[sharetype] == undefined) {
|
||||||
|
this.shareCount[sharetype] = false;
|
||||||
|
}
|
||||||
|
if (this.shareCount[sharetype] == false && Math.random() * 100 > this.SHARE_FAIL) {
|
||||||
|
this.shareCount[sharetype] = true;
|
||||||
|
try {
|
||||||
|
failcb && failcb(-1, param, tokenid, dt);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dt > this.SHARE_TIME) {
|
||||||
|
try {
|
||||||
|
successcb && successcb(param, tokenid, dt);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
failcb && failcb(-2, param, tokenid, dt);
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0.5);
|
||||||
|
},
|
||||||
|
|
||||||
|
PTInitShare(normalinfo) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTShare(content, imgurl, param, successcb, failcb) {
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
|
||||||
|
PTShareCapture(content, rc, param, successcb, failcb) {
|
||||||
|
successcb && successcb();
|
||||||
|
},
|
||||||
|
|
||||||
|
PTOpenKF(cb, info) {
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateGameClubButton(nleft, ntop, nwidth) {
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @param {string} str 显示的文字
|
||||||
|
* @param {icon} icon 图标类型 默认'none';
|
||||||
|
* success: 显示成功图标
|
||||||
|
* loading: 显示加载图标
|
||||||
|
* none: 不显示图标,此时 title 文本最多可显示两行
|
||||||
|
* */
|
||||||
|
PTShowToast(str, icon) {
|
||||||
|
},
|
||||||
|
|
||||||
|
PTGotoApp(appid, apppath, exobj, cb, qdid, env, acontent) {
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTLogin(info, successcb, failcb) {
|
||||||
|
var self = this;
|
||||||
|
qg.login({
|
||||||
|
success: function (res) {
|
||||||
|
self._owner.login.login({
|
||||||
|
token: res.data.appAccountId,
|
||||||
|
successcb: function (obj) {
|
||||||
|
obj.clientSession = res.data.session;
|
||||||
|
successcb && successcb(obj);
|
||||||
|
}, failcb
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log('[xm]login fail!');
|
||||||
|
failcb && failcb(0, res ? res.errcode : -1, res ? res.errMsg : '');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
PTSetClipboardData: function (content, successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTGetClipboardData: function (successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTPreviewImage(imgurl, successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
//广告相关
|
||||||
|
PTInitADService() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateBannerAD(adid, st) {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateVideoAD(adid) {
|
||||||
|
if (qg.createRewardedVideoAd) {
|
||||||
|
let data = {
|
||||||
|
adUnitId: adid
|
||||||
|
};
|
||||||
|
return qg.createRewardedVideoAd(data);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTCreateInsertAD(adid) {
|
||||||
|
if (qg.createInterstitialAd) {
|
||||||
|
let data = {
|
||||||
|
adUnitId: adid
|
||||||
|
};
|
||||||
|
return qg.createInterstitialAd(data);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTSetVideoADCallback(adobj, adowner, cb) {
|
||||||
|
let closeCb = function (res) {
|
||||||
|
console.log('[ad]onClose:' + JSON.stringify(res));
|
||||||
|
// 用户点击了【关闭广告】按钮
|
||||||
|
// 小于 2.1.0 的基础库版本,res 是一个 undefined
|
||||||
|
if (res && res.isEnded || res === undefined) {
|
||||||
|
// 正常播放结束,可以下发游戏奖励
|
||||||
|
cb && cb(res.isEnded, adowner, res);
|
||||||
|
} else {
|
||||||
|
// 播放中途退出,不下发游戏奖励
|
||||||
|
cb && cb(false, adowner, res);
|
||||||
|
}
|
||||||
|
// ad.offClose && ad.offClose(closeCb);
|
||||||
|
};
|
||||||
|
adobj.onClose && adobj.onClose(closeCb);
|
||||||
|
},
|
||||||
|
|
||||||
|
PTVibrateShort(successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTVibrateLong(successcb, failcb) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {null}
|
||||||
|
*/
|
||||||
|
PTOpenDataContext() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
PTPostOpenMsg(msg) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 排行榜相关
|
||||||
|
saveRankData(nscore, nmoney, stitle) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
showRankData() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
hideRankData() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
prevRankPage() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
nextRankPage() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
PTADWatch(adid, successcb, failcb) {
|
||||||
|
let videoAd = qg.createRewardedVideoAd({
|
||||||
|
adUnitId: adid
|
||||||
|
});
|
||||||
|
|
||||||
|
videoAd.onLoad = function () {
|
||||||
|
videoAd.offLoad(this);
|
||||||
|
videoAd.show();
|
||||||
|
}
|
||||||
|
var errorCb = function (res) {
|
||||||
|
console.log('[videoad]onerror:' + JSON.stringify(res));
|
||||||
|
failcb && failcb(adid, res, true, adid);
|
||||||
|
videoAd.offError(this);
|
||||||
|
}
|
||||||
|
videoAd.onError(errorCb);
|
||||||
|
|
||||||
|
var getFun = function (res) {
|
||||||
|
if (res.isEnded) {
|
||||||
|
try {
|
||||||
|
successcb && successcb(adid, res, adid);
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
cb = null;
|
||||||
|
}
|
||||||
|
videoAd.offClose(this);
|
||||||
|
}
|
||||||
|
videoAd.onClose(getFun);
|
||||||
|
videoAd.load();
|
||||||
|
},
|
||||||
|
|
||||||
|
setLocalStorage(key, value) {
|
||||||
|
if (window.localStorage) {
|
||||||
|
localStorage.setItem(key, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalStorage(key) {
|
||||||
|
if (window.localStorage) {
|
||||||
|
return localStorage.getItem(key);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeStorage(key) {
|
||||||
|
if (window.localStorage) {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = PLAT_IWEI;
|
@ -96,9 +96,10 @@ var PLAT_OPPO = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PTShowToast(str) {
|
PTShowToast(str) {
|
||||||
if (this.isThisPT()) {
|
qg.showToast({
|
||||||
|
title: str,
|
||||||
}
|
icon: 'none'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
PTGotoApp(appid, apppath, exobj, cb, qdid) {
|
PTGotoApp(appid, apppath, exobj, cb, qdid) {
|
||||||
|
@ -177,6 +177,10 @@ var PLAT_XM = {
|
|||||||
* none: 不显示图标,此时 title 文本最多可显示两行
|
* none: 不显示图标,此时 title 文本最多可显示两行
|
||||||
* */
|
* */
|
||||||
PTShowToast(str, icon) {
|
PTShowToast(str, icon) {
|
||||||
|
qg.showToast({
|
||||||
|
title: str,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
PTGotoApp(appid, apppath, exobj, cb, qdid, env, acontent) {
|
PTGotoApp(appid, apppath, exobj, cb, qdid, env, acontent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user