Commit 67d4551b by agan

添加

parent 7cbd893a
Showing with 245 additions and 0 deletions
// 2:跳转到WebViewFragment
// 3:分享
// 4:客服
// 5:跳轉到外部瀏覽器
// 6:打开兑换宝石页面
// 7:绑定手机
// 8:跳转微信绑定页面
// 9:是否分享或帮助
// 10:判断某个app是否存在
// 11:网页标题 (棄用)
// 13:半屏网页声音开启关闭:
// 12:跳转逻辑
// 14:关闭网页
// 15:通用viepager標題
// 16:成功转让黄金萤火虫
// 17:关闭半屏网页,打开自己的礼物面板
// 18: 打開購買VIP
// 19:打開購買守護彈窗
// 20:播放座驾预览
// 23:自動添加直播間聊天消息
// 24:获取网页图片下标
// 25:点击web
// 26:是否显示客服入口
// 27:直接唤起 苹果支付 和 google支付:(萤火虫6000版本新增)
// 28:判断是否在外部可以关闭webview
// 29:webview上面的图标 (旧)
// 30:注销账号后退出
// 31:弹出WEB弹窗
// 32:webview上面的图标 (新)
// 33:打开更多功能面板
function webAppComm() {
this.data = null;
}
//分享
webAppComm.prototype.goShare = function (picImg, shareCode) {
let obj = {
"cid": 3,
"reqCode": new Date().getTime(),
"data": {
"shareContent": {
"pic": cdn + picImg,
"title": langList[langType].share1,
"text": langList[langType].share2,
"webpage": "http://www.yabolive.tv/Nesting/invite/share.html?agentCode=" + sessionStorage.bbb + "&bindType=3",
"shareCode": shareCode
},
"shareType": {
"wechat": 1,
"wechat_moment": 1,
"facebook": 1,
"line": 3,
"link": 3,
"whatsApp": 3,
"twitter": 3
}
}
}
let obj2 = JSON.stringify(obj);
appCollaboration(obj2)
}
//客服
webAppComm.prototype.goCustomerService = function () {
let obj = {
"cid": 4,
"reqCode": new Date().getTime(),
"data": {
"msg": langList[langType].upright7,
"customerLayer": 1,
"uid": 1000,
"face": 'https://app.ixiulive.com/static/images/yhx.png',
"nickname": "客服",
"title": "客服",
}
}
let obj2 = JSON.stringify(obj);
appCollaboration(obj2)
}
//跳转外部浏览器
webAppComm.prototype.goExternalWeb = function (h5Url) {
let obj = {
"cid": 5,
"reqCode": new Date().getTime(),
"data": {
"url": h5Url,
}
}
let obj2 = JSON.stringify(obj);
window.yazhai.appCollaboration(obj2);
}
//打开兑换宝石页面
webAppComm.prototype.goExchangeGem = function () {
let obj = {
"cid": 6,
"reqCode": new Date().getTime(),
"data": {
"msg": '打开兑换寶石'
}
}
let obj2 = JSON.stringify(obj);
appCollaboration(obj2);
}
//绑定手机
webAppComm.prototype.goBindPhone = function () {
let obj2 = {
"cid": 7,
"reqCode": new Date().getTime(),
"data": {
msg: '点击跳转绑定手机页面',
}
}
let obj = JSON.stringify(obj2);
appCollaboration(obj);
}
//绑定微信
webAppComm.prototype.goBindWechat = function () {
let obj2 = {
"cid": 8,
"reqCode": new Date().getTime(),
"data": {
msg: '跳转微信绑定页面'
}
}
let obj = JSON.stringify(obj2);
appCollaboration(obj)
}
//弹出帮助
webAppComm.prototype.goBindWechat = function () {
let obj = {
"cid": 9,
"reqCode": new Date().getTime(),
"data": {
msg: '是否分享或帮助',
shareType: 1,
helpType: 0,
}
}
let obj2 = JSON.stringify(obj)
appCollaboration(obj2)
}
//确认是否有该APP
webAppComm.prototype.ifHasApp = function () {
let obj2 = {
"cid": 10,
"reqCode": new Date().getTime(),
"data": {
msg: '點擊確認有沒有這個APP',
type: 1
}
}
let obj = JSON.stringify(obj2);
appCollaboration(obj)
}
//跳转
webAppComm.prototype.goOthers = function (jumptype, url) {
let arr = { 16: '去儲值', 18: '跳轉到座駕', 3: '跳轉集合功能' };
let obj = {
"cid": 12,
"reqCode": new Date().getTime(),
"data": {
"msg": arr[jumptype],
"jumptype": jumptype, //16: 去储值 18: 跳转到座驾 3:跳转集合功能
"url": url
}
}
let obj2 = JSON.stringify(obj);
appCollaboration(obj2);
}
//关闭网页
webAppComm.prototype.closeWebView = function (callback) {
callback && callback();
let obj = {
"cid": 14,
"reqCode": new Date().getTime(),
}
let obj2 = JSON.stringify(obj);
appCollaboration(obj2);
}
//webview右上角的icon
webAppComm.prototype.showIcons = function (infos) {
let obj = {
"cid": 32, //新的右上角展示
"data": {
"msg": "h5网页右上角显示图标",
"info": infos,
}
}
let obj2 = JSON.stringify(obj);
appCollaboration(obj2);
}
//打开更多功能面板
webAppComm.prototype.openExtra = function (infos) {
var obj = {
"cid": 33, //打开额外功能面板
"data": {
"msg": '打开额外功能面板',
"info": infos
}
}
var obj2 = JSON.stringify(obj);
appCollaboration(obj2);
}
//刷新网页
webAppComm.prototype.refreshWeb = function (callback) {
callback && callback();
location.reload();
}
function appCollaboration(msg) {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
}
else if (bIsAndroid) {
window.yazhai.appCollaboration(msg);
} else if (bIsIphoneOs || bIsIpad) {
window.webkit.messageHandlers.appCollaboration.postMessage(msg);
}
}
window.$firefly = new webAppComm();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment