Commit 8e8d0f37 by kaisa

feat:修改半屏网页cid 补充透明底

parent 0bae3e34
Showing with 572 additions and 545 deletions
......@@ -64,125 +64,125 @@ function webAppComm() {
this.langList = [
// 简中
{
'lang1': '活动规则',
'lang2': '刷新',
'lang3': '客服咨询',
'lang4': '推荐朋友',
'lang5': '活动专区',
'lang6': '关闭页面',
'lang7': '露水',
'lang8': '宝石'
lang1: "活动规则",
lang2: "刷新",
lang3: "客服咨询",
lang4: "推荐朋友",
lang5: "活动专区",
lang6: "关闭页面",
lang7: "露水",
lang8: "宝石",
},
//1英文
{
'lang1': 'Events Rule',
'lang2': 'Refresh',
'lang3': 'Customer Service',
'lang4': 'Compartir',
'lang5': 'Event Zone',
'lang6': 'Close Page',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "Events Rule",
lang2: "Refresh",
lang3: "Customer Service",
lang4: "Compartir",
lang5: "Event Zone",
lang6: "Close Page",
lang7: "DEWs",
lang8: "GEMs",
},
//2繁体
{
'lang1': '活動規則',
'lang2': '刷新',
'lang3': '客服咨詢',
'lang4': '推薦朋友',
'lang5': '活動專區',
'lang6': '關閉頁面',
'lang7': '露水',
'lang8': '寶石'
lang1: "活動規則",
lang2: "刷新",
lang3: "客服咨詢",
lang4: "推薦朋友",
lang5: "活動專區",
lang6: "關閉頁面",
lang7: "露水",
lang8: "寶石",
},
//3泰语
{
'lang1': 'กฎกติกากิจกรรม',
'lang2': 'รีเฟรช',
'lang3': 'บริการลูกค้า',
'lang4': 'แชร์',
'lang5': 'โซนกิจกรรม',
'lang6': 'ปิดหน้านี้',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "กฎกติกากิจกรรม",
lang2: "รีเฟรช",
lang3: "บริการลูกค้า",
lang4: "แชร์",
lang5: "โซนกิจกรรม",
lang6: "ปิดหน้านี้",
lang7: "DEWs",
lang8: "GEMs",
},
//4日语
{
'lang1': 'イベントルール',
'lang2': '更新する',
'lang3': 'カスタマーサービス',
'lang4': '共有',
'lang5': 'イベントゾーン',
'lang6': 'ページを閉じる',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "イベントルール",
lang2: "更新する",
lang3: "カスタマーサービス",
lang4: "共有",
lang5: "イベントゾーン",
lang6: "ページを閉じる",
lang7: "DEWs",
lang8: "GEMs",
},
//5印尼
{
'lang1': 'Aturan acara',
'lang2': 'Segarkan',
'lang3': 'Layanan Pelanggan',
'lang4': 'Bagikan',
'lang5': 'Zona Acara',
'lang6': 'Tutup halaman',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "Aturan acara",
lang2: "Segarkan",
lang3: "Layanan Pelanggan",
lang4: "Bagikan",
lang5: "Zona Acara",
lang6: "Tutup halaman",
lang7: "DEWs",
lang8: "GEMs",
},
//6
{
'lang1': 'Events Rule',
'lang2': 'Refresh',
'lang3': 'Customer Service',
'lang4': 'Compartir',
'lang5': 'Event Zone',
'lang6': 'Close Page',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "Events Rule",
lang2: "Refresh",
lang3: "Customer Service",
lang4: "Compartir",
lang5: "Event Zone",
lang6: "Close Page",
lang7: "DEWs",
lang8: "GEMs",
},
//7阿拉伯
{
'lang1': 'قواعد الحدث',
'lang2': 'تحديث',
'lang3': 'خدمة العملاء',
'lang4': 'مشاركة',
'lang5': 'منطقة الفعاليات',
'lang6': 'إغلاق الصفحة',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "قواعد الحدث",
lang2: "تحديث",
lang3: "خدمة العملاء",
lang4: "مشاركة",
lang5: "منطقة الفعاليات",
lang6: "إغلاق الصفحة",
lang7: "DEWs",
lang8: "GEMs",
},
//8越南
{
'lang1': 'Quy tắc sự kiện',
'lang2': 'Làm mới',
'lang3': 'Dịch vụ khách hàng',
'lang4': 'Chia sẻ',
'lang5': 'Khu vực sự kiện',
'lang6': 'Đóng trang',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "Quy tắc sự kiện",
lang2: "Làm mới",
lang3: "Dịch vụ khách hàng",
lang4: "Chia sẻ",
lang5: "Khu vực sự kiện",
lang6: "Đóng trang",
lang7: "DEWs",
lang8: "GEMs",
},
//9韩文
{
'lang1': 'Events Rule',
'lang2': 'Refresh',
'lang3': 'Customer Service',
'lang4': 'Compartir',
'lang5': 'Event Zone',
'lang6': 'Close Page',
'lang7': 'DEWs',
'lang8': 'GEMs'
lang1: "Events Rule",
lang2: "Refresh",
lang3: "Customer Service",
lang4: "Compartir",
lang5: "Event Zone",
lang6: "Close Page",
lang7: "DEWs",
lang8: "GEMs",
},
//10西班牙
{
'lang1': 'Reglas del evento',
'lang2': 'Actualizar',
'lang3': 'Servicio al Cliente',
'lang4': 'Share',
'lang5': 'Zona de Eventos',
'lang6': 'Cerrar página',
'lang7': 'DEWs',
'lang8': 'GEMs'
}
lang1: "Reglas del evento",
lang2: "Actualizar",
lang3: "Servicio al Cliente",
lang4: "Share",
lang5: "Zona de Eventos",
lang6: "Cerrar página",
lang7: "DEWs",
lang8: "GEMs",
},
];
this.urlData = this.url_get_params(location.href);
this.langType = this.urlData.lang;
......@@ -191,136 +191,150 @@ function webAppComm() {
//3:分享
webAppComm.prototype.goShare = function (shareContent, shareType) {
let mShare = shareType || { //1图片 2文字 3网页
"wechat": 3,
"wechat_moment": 3,
"facebook": 3,
"line": 3,
"link": 3,
"whatsApp": 3,
"twitter": 3
}
let mShare = shareType || {
//1图片 2文字 3网页
wechat: 3,
wechat_moment: 3,
facebook: 3,
line: 3,
link: 3,
whatsApp: 3,
twitter: 3,
};
let obj = {
"cid": 3,
"reqCode": new Date().getTime(),
"data": {
"shareContent": shareContent,
"shareType": mShare
}
}
cid: 3,
reqCode: new Date().getTime(),
data: {
shareContent: shareContent,
shareType: mShare,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2)
}
webAppCollaboration(obj2);
};
//4:客服
webAppComm.prototype.goCustomerService = function () {
let obj = {
"cid": 4,
"reqCode": new Date().getTime(),
"data": {
"msg": "Hi,請問有什麼可以幫到您?",
"customerLayer": 1,
"uid": 1000,
"face": 'https://app.ixiulive.com/static/images/yhx.png',
"nickname": "客服",
"title": "客服",
}
}
cid: 4,
reqCode: new Date().getTime(),
data: {
msg: "Hi,請問有什麼可以幫到您?",
customerLayer: 1,
uid: 1000,
face: "https://app.ixiulive.com/static/images/yhx.png",
nickname: "客服",
title: "客服",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2)
}
webAppCollaboration(obj2);
};
//5:跳转外部浏览器
webAppComm.prototype.goExternalWeb = function (h5Url) {
let obj = {
"cid": 5,
"reqCode": new Date().getTime(),
"data": {
"url": h5Url,
}
}
cid: 5,
reqCode: new Date().getTime(),
data: {
url: h5Url,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//6:打开兑换宝石页面
webAppComm.prototype.goExchangeGem = function () {
let obj = {
"cid": 6,
"reqCode": new Date().getTime(),
"data": {
"msg": '打开兑换寶石'
}
}
cid: 6,
reqCode: new Date().getTime(),
data: {
msg: "打开兑换寶石",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//7:绑定手机
webAppComm.prototype.goBindPhone = function () {
let obj2 = {
"cid": 7,
"reqCode": new Date().getTime(),
"data": {
msg: '点击跳转绑定手机页面',
}
}
cid: 7,
reqCode: new Date().getTime(),
data: {
msg: "点击跳转绑定手机页面",
},
};
let obj = JSON.stringify(obj2);
webAppCollaboration(obj);
}
};
//8:绑定微信
webAppComm.prototype.goBindWechat = function () {
let obj2 = {
"cid": 8,
"reqCode": new Date().getTime(),
"data": {
msg: '跳转微信绑定页面'
}
}
cid: 8,
reqCode: new Date().getTime(),
data: {
msg: "跳转微信绑定页面",
},
};
let obj = JSON.stringify(obj2);
webAppCollaboration(obj)
}
webAppCollaboration(obj);
};
//弹出帮助
webAppComm.prototype.needHelp = function () {
let obj = {
"cid": 9,
"reqCode": new Date().getTime(),
"data": {
msg: '是否分享或帮助',
cid: 9,
reqCode: new Date().getTime(),
data: {
msg: "是否分享或帮助",
shareType: 1,
helpType: 0,
}
}
let obj2 = JSON.stringify(obj)
webAppCollaboration(obj2)
}
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
};
//10:确认是否有该APP
webAppComm.prototype.ifHasApp = function (type) { //1微信 2line 3facebook 4Twitter 5WhatsApp 6微博 7QQ
webAppComm.prototype.ifHasApp = function (type) {
//1微信 2line 3facebook 4Twitter 5WhatsApp 6微博 7QQ
let obj2 = {
"cid": 10,
"reqCode": new Date().getTime(),
"data": {
msg: '點擊確認有沒有這個APP',
type: type
}
}
cid: 10,
reqCode: new Date().getTime(),
data: {
msg: "點擊確認有沒有這個APP",
type: type,
},
};
let obj = JSON.stringify(obj2);
webAppCollaboration(obj)
}
webAppCollaboration(obj);
};
//12:跳转
webAppComm.prototype.goOthers = function (jumptype, url = '', isHide, gid, topicId = '', uid) {
let arr = { 16: '去儲值', 18: '跳轉到座駕', 3: '跳轉集合功能', 13: 'VIP中心', 26: '设置' };
webAppComm.prototype.goOthers = function (
jumptype,
url = "",
isHide,
gid,
topicId = "",
uid,
) {
let arr = {
16: "去儲值",
18: "跳轉到座駕",
3: "跳轉集合功能",
13: "VIP中心",
26: "设置",
};
let obj = {
"cid": 12,
"reqCode": new Date().getTime(),
"data": {
"msg": arr[jumptype],
"jumptype": jumptype,
cid: 12,
reqCode: new Date().getTime(),
data: {
msg: arr[jumptype],
jumptype: jumptype,
/*
jumptype:
2:跳转到另一个网页
......@@ -340,182 +354,179 @@ webAppComm.prototype.goOthers = function (jumptype, url = '', isHide, gid, topic
72:半屏资料卡
"jumptype": jumptype,
*/
"url": url, //41 42时传入礼物id。
"topicId": topicId, // 贴文id
"hideTitle": isHide, // 1隐藏头部,0 不隐藏, 默认为0
"gid": gid, // 礼物列表类别
"uid": uid // 用户ID
}
}
url: url, //41 42时传入礼物id。
topicId: topicId, // 贴文id
hideTitle: isHide, // 1隐藏头部,0 不隐藏, 默认为0
gid: gid, // 礼物列表类别
uid: uid, // 用户ID
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//14:关闭网页
webAppComm.prototype.closeWebView = function (callback) {
callback && callback();
let obj = {
"cid": 14,
"reqCode": new Date().getTime(),
}
cid: 14,
reqCode: new Date().getTime(),
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//15:打开多网页面板
webAppComm.prototype.openRecords = function (urls, type) {
let obj = {
"cid": 15,
"reqCode": new Date().getTime(),
"data": {
"urls": [
cid: 15,
reqCode: new Date().getTime(),
data: {
urls: [
{
"url": $url + '/Nesting/recording/gem.html' + window.location.search,
"title": langList[langType].dew18,
"rightBtnImageURL": '',
"rightBtnClickURL": ''
url: $url + "/Nesting/recording/gem.html" + window.location.search,
title: langList[langType].dew18,
rightBtnImageURL: "",
rightBtnClickURL: "",
},
{
"url": $url + '/Nesting/recording/dew.html' + window.location.search,
"title": langList[langType].dewExchangeTitle3,
"rightBtnImageURL": '',
"rightBtnClickURL": ''
}
url: $url + "/Nesting/recording/dew.html" + window.location.search,
title: langList[langType].dewExchangeTitle3,
rightBtnImageURL: "",
rightBtnClickURL: "",
},
],
"select": type,
"titleColor": "",
"titleSelectedColor": "",
"titleBackground": '',
}
}
select: type,
titleColor: "",
titleSelectedColor: "",
titleBackground: "",
},
};
let obj2 = JSON.stringify(obj);
appCollaboration(obj2);
}
};
//18: 关闭當前网页并弹出VIP购买页面(tips:这个cid不能直接通过window.$firefly.showVip()调用,得通过直接的"cid": 18的方式调用,不然会失效)
webAppComm.prototype.showVip = function (orderId) {
let obj = {
"cid": 18,
"reqCode": new Date().getTime(),
"data": {
"msg": "关闭当前网页并弹出VIP购买页面",
"orderId": orderId,
}
}
cid: 18,
reqCode: new Date().getTime(),
data: {
msg: "关闭当前网页并弹出VIP购买页面",
orderId: orderId,
},
};
let obj2 = JSON.stringify(obj);
}
};
//19: 打开开通守护
webAppComm.prototype.buyGuard = function (roomid) {
let obj = {
"cid": 19,
"reqCode": new Date().getTime(),
"data": {
"msg": "打开开通守护",
"roomid": roomid,
}
}
cid: 19,
reqCode: new Date().getTime(),
data: {
msg: "打开开通守护",
roomid: roomid,
},
};
let obj2 = JSON.stringify(obj);
}
};
//21:隐藏客户端顶部
webAppComm.prototype.hideTopBar = function () {
let obj = {
"cid": 21,
"reqCode": new Date().getTime(),
"data": {
"msg": "web关闭网页方法加载完成向客户端通知",
}
}
cid: 21,
reqCode: new Date().getTime(),
data: {
msg: "web关闭网页方法加载完成向客户端通知",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//23:自動添加直播間聊天消息
webAppComm.prototype.addLiveMsg = function (content) {
let obj = {
"cid": 23,
"reqCode": new Date().getTime(),
"data": {
"msg": "H5调起消息输入框",
"closeType": 1,
"content": content,
}
}
cid: 23,
reqCode: new Date().getTime(),
data: {
msg: "H5调起消息输入框",
closeType: 1,
content: content,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//26:左上角添加联系客服
webAppComm.prototype.addTopLeftService = function (data) {
let obj = {
"cid": 26,
"reqCode": new Date().getTime(),
"data": {
"msg": "左上角上角添加 联系客服",
"type": 1,
}
}
cid: 26,
reqCode: new Date().getTime(),
data: {
msg: "左上角上角添加 联系客服",
type: 1,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//27:唤起谷歌、苹果支付
webAppComm.prototype.oriCharge = function (data) {
let obj = {
"cid": 27,
"reqCode": new Date().getTime(),
"data": {
"msg": "直接唤起 苹果支付 和 google支付",
"pid": data.pid,
"packageid": data.packageid,
"chargeInfo": data.info,
"succeedAlert": data.alert
}
}
cid: 27,
reqCode: new Date().getTime(),
data: {
msg: "直接唤起 苹果支付 和 google支付",
pid: data.pid,
packageid: data.packageid,
chargeInfo: data.info,
succeedAlert: data.alert,
},
};
let obj2 = JSON.stringify(obj);
console.log(obj2)
console.log(obj2);
webAppCollaboration(obj2);
}
};
// 28:判断是否可以在外部关闭webview
// closeType 0:点击区域外关闭 1:点击区域外不关闭
webAppComm.prototype.closeOutSideWebView = function (closeType) {
let obj = {
"cid": 28,
"reqCode": new Date().getTime(),
"data": {
"msg": "判断是否外部关闭webview",
cid: 28,
reqCode: new Date().getTime(),
data: {
msg: "判断是否外部关闭webview",
"closeType ": closeType,
}
}
},
};
let obj2 = JSON.stringify(obj);
console.log(obj2)
console.log(obj2);
webAppCollaboration(obj2);
}
};
// 30:注销账号后退出
webAppComm.prototype.logOff = function (data) {
let obj = {
"cid": 30,
"reqCode": new Date().getTime(),
"data": {
"msg": "注销账号后退出",
}
}
cid: 30,
reqCode: new Date().getTime(),
data: {
msg: "注销账号后退出",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 31: 打开半屏网页
webAppComm.prototype.openHalfWeb = function (param) {
let obj = {
"cid": 31,
"data": {
cid: 31,
data: {
popupType: param.type, //popupType 1全屏2半屏3浮动屏(默认居中)
heightR: param.height, //heightR 弹窗高度 单位vw 安卓不允许 传小数;
widthR: param.width, //widthR 弹窗宽度vw
......@@ -529,8 +540,9 @@ webAppComm.prototype.openHalfWeb = function (param) {
afterReady: param.afterReady, // afterReady 是否加载完成后再显示。 0否 1是。 默认为0,
needMounted: param.needMounted, //ios专用 0不独立 1独立。 默认是0.
allowScroll: param.allowScroll, //是否允许直播间滑动 0不允许 1允许 默认为1.
}
}
transparency: 1, //是否透明 0不透明 1透明 默认为0.
},
};
if (param.top || param.top === 0) {
obj.data.top = param.top;
}
......@@ -545,115 +557,114 @@ webAppComm.prototype.openHalfWeb = function (param) {
}
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//32:webview右上角的icon
webAppComm.prototype.showIcons = function (infos) {
let obj = {
"cid": 32, //新的右上角展示
"data": {
"msg": "h5网页右上角显示图标",
"info": infos,
}
}
cid: 32, //新的右上角展示
data: {
msg: "h5网页右上角显示图标",
info: infos,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//33:打开更多功能面板
webAppComm.prototype.openExtra = function (infos) {
let obj = {
"cid": 33, //打开额外功能面板
"data": {
"msg": '打开额外功能面板',
"info": infos
}
}
cid: 33, //打开额外功能面板
data: {
msg: "打开额外功能面板",
info: infos,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//修改网页标题
webAppComm.prototype.changeTitle = function (param) {
let obj = {
"cid": 34, //修改网页title 居中显示。
"data": {
"type": param.type, //1 图片 2文本。
"imgTxt": param.text,
"imgUrl": param.url, //1
"style": {
cid: 34, //修改网页title 居中显示。
data: {
type: param.type, //1 图片 2文本。
imgTxt: param.text,
imgUrl: param.url, //1
style: {
//图片
"width": param.w, //1
"height": param.h, //1
}
}
}
width: param.w, //1
height: param.h, //1
},
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//修改网页标题(中间默认Firefly Icon)
webAppComm.prototype.changeTitle1 = function () {
let obj = {
"cid": 34, //修改网页title 居中显示。
"data": {
"type": 1, //1 图片 2文本。
"imgUrl": 'https://app.ixiulive.com/static/app/img/title.png?v=20230425', //1
"style": {
cid: 34, //修改网页title 居中显示。
data: {
type: 1, //1 图片 2文本。
imgUrl: "https://app.ixiulive.com/static/app/img/title.png?v=20230425", //1
style: {
//图片
"width": '300', //1
"height": '120', //1
}
}
}
width: "300", //1
height: "120", //1
},
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//修改网页标题(中间只显示文本标题-默认取网页的title标题的值)
webAppComm.prototype.changeTitle2 = function () {
let obj = {
"cid": 34, //修改网页title 居中显示。
"data": {
"type": 2, //1 图片 2文本。
"imgTxt": $("title").text(),//2
}
}
cid: 34, //修改网页title 居中显示。
data: {
type: 2, //1 图片 2文本。
imgTxt: $("title").text(), //2
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//修改网页标题(根据传入的图片设定标题中间Icon)
webAppComm.prototype.changeTitle3 = function (imgUrl, param) {
let obj = {
"cid": 34, //修改网页title 居中显示。
"data": {
"type": 1, //1 图片 2文本。
"imgUrl": imgUrl,
"style": {
cid: 34, //修改网页title 居中显示。
data: {
type: 1, //1 图片 2文本。
imgUrl: imgUrl,
style: {
//图片
"width": param.width, //1
"height": param.height, //1
}
}
}
width: param.width, //1
height: param.height, //1
},
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 修改网页标题(中间只显示文本标题-根据传入的值来定义)
webAppComm.prototype.changeTitle4 = function (title) {
let obj = {
"cid": 34, //修改网页title 居中显示。
"data": {
"type": 2, //1 图片 2文本。
"imgTxt": title,
}
}
cid: 34, //修改网页title 居中显示。
data: {
type: 2, //1 图片 2文本。
imgTxt: title,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//刷新网页
webAppComm.prototype.refreshWeb = function (callback) {
......@@ -661,95 +672,95 @@ webAppComm.prototype.refreshWeb = function (callback) {
if (this.needRefresh) {
location.reload();
}
}
};
// 35:打开游戏
webAppComm.prototype.goGame = function (mData) {
let obj = {
"cid": 35,
"data": mData
}
cid: 35,
data: mData,
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 36:播放動畫
webAppComm.prototype.playAnimate = function (mData) {
let obj = {
"cid": 36,
"data": mData
}
cid: 36,
data: mData,
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 37:web加载完毕
webAppComm.prototype.domReady = function (mData) {
let obj = {
"cid": 37,
"data": mData
}
cid: 37,
data: mData,
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 38:web打开/关闭签到提醒
webAppComm.prototype.openSignRemind = function () {
let obj = {
"cid": 38,
"data": {
"msg": '打开签到提醒'
}
}
cid: 38,
data: {
msg: "打开签到提醒",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 39: 告知客户端渠道信息和uid
webAppComm.prototype.sendBindInfos = function (cid, uid, lang, type, origin) {
let obj = {
"cid": 39,
"data": {
"channelId": cid,
"agentUid": uid,
"lang": lang,
"bindType": type,
"origin": origin
}
}
cid: 39,
data: {
channelId: cid,
agentUid: uid,
lang: lang,
bindType: type,
origin: origin,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 40: 跳转任务界面
webAppComm.prototype.jumpToTask = function (type) {
let obj = {
"cid": 40,
"data": {
"taskType": type // 1:新手任务 2:每日任务 3:主播任务 4:奖励领取
}
}
cid: 40,
data: {
taskType: type, // 1:新手任务 2:每日任务 3:主播任务 4:奖励领取
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//41: 修改webview的背景底色
webAppComm.prototype.setBackground = function (color, color2) {
let obj = {
"cid": 41,
"data": {
"background": color, // # color值为HEX色值 例:#FFFFFF,
"AHEX": color2 // # color2值为AHEX色值 例:#FFFFFFFF,
}
}
cid: 41,
data: {
background: color, // # color值为HEX色值 例:#FFFFFF,
AHEX: color2, // # color2值为AHEX色值 例:#FFFFFFFF,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//42: 手机振动
webAppComm.prototype.toVibrate = function (duration) {
......@@ -757,274 +768,282 @@ webAppComm.prototype.toVibrate = function (duration) {
let numDuration = Number(duration);
let obj = {
"cid": 42,
"data": {
"duration": numDuration // 此时保证是 Number 类型
}
}
cid: 42,
data: {
duration: numDuration, // 此时保证是 Number 类型
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//43: 修改webview宽高
webAppComm.prototype.setRatio = function (type, wr, hr, position, unit) {
let obj = {
"cid": 43,
"data": {
"type": type, //1活动框架 2游戏框架。
"width": wr, // #单位为vw 默认值为-1 未传或传-1时,则不修改宽度
"height": hr, //单位为vw 默认值为-1 未传或传-1时,则不修改高度
"position": position, // 1右贴边 2左贴边 默认右贴边。
"unit": unit, //单位 默认1 vw 2 pt
}
}
cid: 43,
data: {
type: type, //1活动框架 2游戏框架。
width: wr, // #单位为vw 默认值为-1 未传或传-1时,则不修改宽度
height: hr, //单位为vw 默认值为-1 未传或传-1时,则不修改高度
position: position, // 1右贴边 2左贴边 默认右贴边。
unit: unit, //单位 默认1 vw 2 pt
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//44: 调起第三方并获取OpenId(7570版本以上
webAppComm.prototype.vertify = function (type, callBackName) {
let obj = {
"cid": 44,
"data": {
"type": type, //1:QQ 2:微信 3:微博 4:Google 5:Twitter 6:FaceBook 8:line 9:appleId
"callBackName": callBackName,
}
}
cid: 44,
data: {
type: type, //1:QQ 2:微信 3:微博 4:Google 5:Twitter 6:FaceBook 8:line 9:appleId
callBackName: callBackName,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//45: 与客户端同步H5客服聊天消息
webAppComm.prototype.syncChatHis = function (type, content, timeStr) {
let obj = {
"cid": 45, //客服聊天用,与客户端同步本地发送信息
"data": {
"type": type, //1文字 2图片
"content": content,
"time": timeStr //发送聊天时间戳
}
}
cid: 45, //客服聊天用,与客户端同步本地发送信息
data: {
type: type, //1文字 2图片
content: content,
time: timeStr, //发送聊天时间戳
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//46: 将图片存入相册
webAppComm.prototype.savePhoto = function (imgUrl) {
let obj = {
"cid": 46, //将图片存入相册
"data": {
'imgUrl': imgUrl //照片地址
}
}
cid: 46, //将图片存入相册
data: {
imgUrl: imgUrl, //照片地址
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
//47: 通知客户端直播奖励小窗抖动
webAppComm.prototype.liveShakes = function () {
let obj = {
"cid": 47,
"data": {
"msg": '窗口抖动'
}
}
cid: 47,
data: {
msg: "窗口抖动",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 48:弹出用户行为规范弹窗
webAppComm.prototype.userBehaviorSpecification = function (type) {
let obj = {
"cid": 48,
"reqCode": new Date().getTime(),
"data": {
'type': type
}
}
cid: 48,
reqCode: new Date().getTime(),
data: {
type: type,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 49: base64格式图片保存到相册
webAppComm.prototype.saveImgToAlbum = function (imgUrl) {
let obj = {
"cid": 49,
"data": {
'base64Url': imgUrl //照片地址
}
}
cid: 49,
data: {
base64Url: imgUrl, //照片地址
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 50: 网页在直播间唤起输入框并且粘贴文本到输入框
webAppComm.prototype.evokeIptPasteText = function (text, closeType) {
let obj = {
"cid": 50,
"data": {
'content': text, //文本内容
'closeType': closeType //0:关闭输入框 1:不关闭输入框
}
}
cid: 50,
data: {
content: text, //文本内容
closeType: closeType, //0:关闭输入框 1:不关闭输入框
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 51: 通知安卓客户端活动窗口宽高
webAppComm.prototype.setWidthHeigth = function (type, wr, hr, position, unit) {
let obj = {
"cid": 51,
"data": {
"type": type, //1活动框架 2游戏框架。
"width": wr, // #单位为vw 默认值为-1 未传或传-1时,则不修改宽度
"height": hr, //单位为vw 默认值为-1 未传或传-1时,则不修改高度
"position": position, // 1右贴边 2左贴边 默认右贴边。
"unit": unit, //单位 默认1 vw 2 pt
}
}
cid: 51,
data: {
type: type, //1活动框架 2游戏框架。
width: wr, // #单位为vw 默认值为-1 未传或传-1时,则不修改宽度
height: hr, //单位为vw 默认值为-1 未传或传-1时,则不修改高度
position: position, // 1右贴边 2左贴边 默认右贴边。
unit: unit, //单位 默认1 vw 2 pt
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 52:通知ios客户端返回home键高度
webAppComm.prototype.setHomeHeight = function () {
let obj = {
"cid": 52,
"data": {
"msg": '返回home键高度'
}
}
cid: 52,
data: {
msg: "返回home键高度",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 53:直播间跳转全屏任务中心页面
webAppComm.prototype.jumpToTaskCenter = function (type) {
let obj = {
"cid": 53,
"data": {
"taskType": type // 1:新手任务 2:每日任务 3:主播任务 4:奖励领取
}
}
cid: 53,
data: {
taskType: type, // 1:新手任务 2:每日任务 3:主播任务 4:奖励领取
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 54:添加系统日历提醒
webAppComm.prototype.calendarReminders = function (title, content, time, tipContent) {
webAppComm.prototype.calendarReminders = function (
title,
content,
time,
tipContent,
) {
let obj = {
"cid": 54,
"data": {
"title": title,
"content": content,
"time": time, //时间戳
"type": 1, // 1:只提醒一次 2:每周都提醒一次
"durationTime": 10,//持续时间
"reminderTime": 5,//提前多久提醒
"tipContent": tipContent // 添加日历提示内容
}
}
cid: 54,
data: {
title: title,
content: content,
time: time, //时间戳
type: 1, // 1:只提醒一次 2:每周都提醒一次
durationTime: 10, //持续时间
reminderTime: 5, //提前多久提醒
tipContent: tipContent, // 添加日历提示内容
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 55: 打开外部对应APP并链接到对应的账号
webAppComm.prototype.openChatApp = function (appType, officialId) {
let obj = {
"cid": 55,
"data": {
"appType": appType, // whatsapp、line、wechat
"officialId": officialId
}
}
cid: 55,
data: {
appType: appType, // whatsapp、line、wechat
officialId: officialId,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 56: 返回原生上一层(flutter使用)
webAppComm.prototype.backOriginApp = function () {
let obj = {
"cid": 56,
"data": {
"msg": '返回原生上一层'
}
}
cid: 56,
data: {
msg: "返回原生上一层",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 57:开启/加入游戏房间
webAppComm.prototype.joinGameRoom = function (isOpenGameRoom, roomId, gameType) {
webAppComm.prototype.joinGameRoom = function (
isOpenGameRoom,
roomId,
gameType,
) {
let obj = {
"cid": 57,
"data": {
"msg": '开启/加入游戏房间',
"isOpenGameRoom": isOpenGameRoom, //0 开启房间 1 加入房间
"roomId": roomId,
"gameType": gameType, //游戏类型 1001:LUDO (后续增加)
}
}
cid: 57,
data: {
msg: "开启/加入游戏房间",
isOpenGameRoom: isOpenGameRoom, //0 开启房间 1 加入房间
roomId: roomId,
gameType: gameType, //游戏类型 1001:LUDO (后续增加)
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 58: 告知客户端是否打开原生侧滑返回手势(flutter使用)
webAppComm.prototype.setNativeSwipeBackEnabled = function (enabled) {
let obj = {
"cid": 58,
"data": {
"msg": '是否打开原生侧滑返回手势',
"enabled": enabled,
}
}
cid: 58,
data: {
msg: "是否打开原生侧滑返回手势",
enabled: enabled,
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 59:上麦/下麦
webAppComm.prototype.micOnOff = function (type) {
let obj = {
"cid": 59,
"data": {
"micType": type, // 0:上麦 1:下麦
}
}
cid: 59,
data: {
micType: type, // 0:上麦 1:下麦
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 60:隐藏客户端标题头部
webAppComm.prototype.hideClientTitle = function (type) {
let obj = {
"cid": 60,
"data": {
"isHide": type, // 1隐藏头部,0 不隐藏, 默认为0
"msg": '隐藏客户端标题头部'
}
}
cid: 60,
data: {
isHide: type, // 1隐藏头部,0 不隐藏, 默认为0
msg: "隐藏客户端标题头部",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 61:通知客户端弹起购买VIP特权弹窗
webAppComm.prototype.showVIPPurchasePopup = function ( ) {
webAppComm.prototype.showVIPPurchasePopup = function () {
let obj = {
"cid": 61,
"data": {
"orderId": orderId,
"msg": '弹起购买VIP特权弹窗'
}
}
cid: 61,
data: {
orderId: orderId,
msg: "弹起购买VIP特权弹窗",
},
};
let obj2 = JSON.stringify(obj);
webAppCollaboration(obj2);
}
};
// 接收客戶端的消息
webAppComm.prototype.reMsgFromApp = function (callback) {
callback && callback();
}
};
webAppComm.prototype.url_get_params = function (url_path) {
let url = url_path;
......@@ -1037,7 +1056,7 @@ webAppComm.prototype.url_get_params = function (url_path) {
}
}
return theRequest;
}
};
function webAppCollaboration(msg) {
let sUserAgent = navigator.userAgent.toLowerCase();
let bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
......@@ -1048,15 +1067,23 @@ function webAppCollaboration(msg) {
let bIsAndroid = sUserAgent.match(/android/i) == "android";
let bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
let bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
}
else if (bIsAndroid) {
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