feat: 校园旧版,东区缴费初始化
This commit is contained in:
@@ -0,0 +1,968 @@
|
||||
//需要引入jquery
|
||||
var JKEventHandler = {
|
||||
callNativeFunction: function (nativeMethodName, params, callBackID, callBack) {
|
||||
var message;
|
||||
if (!callBack) {
|
||||
message = {'methodName': nativeMethodName, 'params': params};
|
||||
window.webkit.messageHandlers.JKEventHandler.postMessage(message);
|
||||
|
||||
} else {
|
||||
message = {'methodName': nativeMethodName, 'params': params, 'callBackID': callBackID};
|
||||
if (!JKBridgeEvent._listeners[callBackID]) {
|
||||
JKBridgeEvent.addEvent(callBackID, function (data) {
|
||||
callBack(data);
|
||||
});
|
||||
}
|
||||
window.webkit.messageHandlers.JKEventHandler.postMessage(message);
|
||||
}
|
||||
},
|
||||
newCallNativeFunction: function (nativeMethodName, params, callBackID, successCallBack, failureCallBack) {
|
||||
var message;
|
||||
if (successCallBack && failureCallBack) {
|
||||
var successCallBackID = callBackID;
|
||||
successCallBackID += 'successCallBack';
|
||||
|
||||
var failureCallBackID = callBackID;
|
||||
failureCallBackID += 'failureCallBack';
|
||||
message = {
|
||||
'type': 'NewJSFunction',
|
||||
'methodName': nativeMethodName,
|
||||
'params': params,
|
||||
'successCallBackID': successCallBackID,
|
||||
'failureCallBackID': failureCallBackID
|
||||
};
|
||||
if (!JKBridgeEvent._listeners[successCallBackID]) {
|
||||
JKBridgeEvent.addEvent(successCallBackID, function (data) {
|
||||
|
||||
successCallBack(data);
|
||||
|
||||
});
|
||||
}
|
||||
if (!JKBridgeEvent._listeners[failureCallBackID]) {
|
||||
JKBridgeEvent.addEvent(failureCallBackID, function (data) {
|
||||
|
||||
failureCallBack(data);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
window.webkit.messageHandlers.JKEventHandler.postMessage(message);
|
||||
|
||||
} else if (successCallBack && !failureCallBack) {
|
||||
var successCallBackID = callBackID;
|
||||
successCallBackID += 'successCallBack';
|
||||
message = {
|
||||
'type': 'NewJSFunction',
|
||||
'methodName': nativeMethodName,
|
||||
'params': params,
|
||||
'successCallBackID': successCallBackID
|
||||
};
|
||||
if (!JKBridgeEvent._listeners[successCallBackID]) {
|
||||
JKBridgeEvent.addEvent(successCallBackID, function (data) {
|
||||
successCallBack(data);
|
||||
});
|
||||
}
|
||||
window.webkit.messageHandlers.JKEventHandler.postMessage(message);
|
||||
} else if (failureCallBack && !successCallBack) {
|
||||
var failureCallBackID = callBackID;
|
||||
failureCallBackID += 'failureCallBack';
|
||||
message = {
|
||||
'type': 'NewJSFunction',
|
||||
'methodName': nativeMethodName,
|
||||
'params': params,
|
||||
'failureCallBackID': failureCallBackID
|
||||
};
|
||||
if (!JKBridgeEvent._listeners[failureCallBackID]) {
|
||||
JKBridgeEvent.addEvent(failureCallBackID, function (data) {
|
||||
failureCallBack(data);
|
||||
});
|
||||
}
|
||||
window.webkit.messageHandlers.JKEventHandler.postMessage(message);
|
||||
} else {
|
||||
message = {'type': 'NewJSFunction', 'methodName': nativeMethodName, 'params': params};
|
||||
window.webkit.messageHandlers.JKEventHandler.postMessage(message);
|
||||
}
|
||||
},
|
||||
callBack: function (callBackID, data) {
|
||||
JKBridgeEvent.fireEvent(callBackID, data);
|
||||
},
|
||||
removeAllCallBacks: function (data) {
|
||||
JKBridgeEvent._listeners = {};
|
||||
}
|
||||
};
|
||||
var JKBridgeEvent = {
|
||||
_listeners: {},
|
||||
addEvent: function (type, fn) {
|
||||
if (typeof this._listeners[type] === "undefined") {
|
||||
this._listeners[type] = [];
|
||||
}
|
||||
if (typeof fn === "function") {
|
||||
this._listeners[type].push(fn);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
fireEvent: function (type, param) {
|
||||
var arrayEvent = this._listeners[type];
|
||||
if (arrayEvent instanceof Array) {
|
||||
for (var i = 0, length = arrayEvent.length; i < length; i += 1) {
|
||||
if (typeof arrayEvent[i] === "function") {
|
||||
arrayEvent[i](param);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
removeEvent: function (type, fn) {
|
||||
var arrayEvent = this._listeners[type];
|
||||
if (typeof type === "string" && arrayEvent instanceof Array) {
|
||||
if (typeof fn === "function") {
|
||||
for (var i = 0, length = arrayEvent.length; i < length; i += 1) {
|
||||
if (arrayEvent[i] === fn) {
|
||||
this._listeners[type].splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
delete this._listeners[type];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
$.extend({
|
||||
// app公共方法
|
||||
//获取basicinfo,需传入回调方法
|
||||
initGetAppBasicInfo: function (fun) {
|
||||
var sys = $.initGetAppSys();
|
||||
var basicInfo;
|
||||
try {
|
||||
if (sys == 1) {
|
||||
basicInfo = androidIntent.getBasicInfo();
|
||||
basicInfo = JSON.parse(basicInfo)
|
||||
fun(basicInfo)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
basicInfo = getBasicInfo();
|
||||
basicInfo = JSON.parse(basicInfo)
|
||||
fun(basicInfo)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('getBasicInfo', null, 'getBasicInfoCallback', function (data) {
|
||||
basicInfo = data;
|
||||
basicInfo = JSON.parse(basicInfo)
|
||||
basicInfo.centerId = basicInfo.centerid;
|
||||
fun(basicInfo)
|
||||
JKEventHandler.removeAllCallBacks()
|
||||
});
|
||||
}
|
||||
} else {
|
||||
fun(basicInfo)
|
||||
}
|
||||
} catch (e) {
|
||||
fun(basicInfo)
|
||||
}
|
||||
// basicInfo = {
|
||||
// userId:'',
|
||||
// nickname:'',
|
||||
// getIsLogin:1,1表示登录
|
||||
// longitude:'',
|
||||
// imei:'',
|
||||
// latitude:'',
|
||||
// version:'版本4.2.5',
|
||||
// loginToken:'',
|
||||
// userType:3,
|
||||
// loginType:3,1、手机,2、微信,3、qq
|
||||
// }
|
||||
},
|
||||
//判断系统类型
|
||||
initGetAppSys: function () {
|
||||
var u = navigator.userAgent, app = navigator.appVersion;
|
||||
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
|
||||
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
||||
if (isAndroid) {
|
||||
return 1;
|
||||
}
|
||||
if (isIOS) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
},
|
||||
//调起登录页面
|
||||
initToAppLogin: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentlogin()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentlogin()
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentlogin', {}, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
initAppendRefresh(bgColor, infoBgColor, btnBgColor, btnColor, imgUrl, btnText) {
|
||||
// bgColor-整个背景,infoBgColor-中间框背景色,btnBgColor-按钮背景色,btnColor-按钮字体颜色,imgUrl-图片路径 btnText-按钮文字
|
||||
$('body').prepend('<div style="position:fixed;left:0;bottom:0;width:100vw;height:100vh;z-index:999;background: ' + (bgColor || "transparent") +
|
||||
'"><div style="position:absolute;width:80%;left:50%;top: 50%;padding:20px 10px;border-radius:8px;background:' + (infoBgColor || '#fff') +
|
||||
';transform: translate(-50%,-50%)">\n' +
|
||||
' <img src="' + imgUrl +
|
||||
'" alt="" style="display:block;width:100px;margin:0 auto 20px;">\n' +
|
||||
' <a href="javascript:location.reload();" style="width:120px;text-align:center;display:block;margin:0 auto;padding: 0 6px;border-radius:4px;line-height:30px;font-size: 14px;background:' + (btnBgColor || 'red') +
|
||||
';color:' + (btnColor || '#fff') +
|
||||
'">' + (btnText || '登录成功') +
|
||||
'</a></div></div>')
|
||||
},
|
||||
//调绑定手机号页面
|
||||
initToBindPhone: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentBindMobilePhone()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentBindMobilePhone()
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentBindMobilePhone', {}, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//是否登录app
|
||||
initIsLoginApp: function (basicInfo) {
|
||||
if (basicInfo.getIsLogin && basicInfo.getIsLogin == 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
//是否在app内
|
||||
initIsInApp: function (basicInfo) {
|
||||
if (basicInfo) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
//更新app的token
|
||||
initUploadAppToken: function (token) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.getRefreshLoginTokenFromH5(token)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
getRefreshLoginTokenFromH5(token)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('getRefreshLoginTokenFromH5', token, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//新开APP窗口
|
||||
initOpenNewWebview: function (url, title) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentWebViewActivity(url, (title || ''))
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentWebViewActivity(url, title)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentWebViewActivity', {title: title, url: url}, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
location.href = url
|
||||
}
|
||||
},
|
||||
//重定义app title
|
||||
initTitleModify: function (title) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentSetTitle(title);
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
updateTitle(title);
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('updateTitle', title, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
$('title').text(title)
|
||||
}
|
||||
},
|
||||
//判断版本
|
||||
initJudgeVersion: function (basc) {
|
||||
var sys = $.initGetAppSys();
|
||||
if (basc) {
|
||||
var version = basc.version;
|
||||
if (sys == 1) {
|
||||
if (parseInt(version.replace(/\./g, '')) < 425) {
|
||||
$.initAppendVersionMask('4.2.5')
|
||||
}
|
||||
} else if (sys == 2) {
|
||||
if (parseInt(version.replace(/\./g, '')) < 435) {
|
||||
$.initAppendVersionMask('4.35')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
initAppendVersionMask: function (ver) {
|
||||
// $('body').append('<div id="initVersionMask" style="position: fixed;background-color:rgba(0,0,0,.6);left: 0;top: 0;z-index: 99;width: 100%;height: 100%;"><div style="background-color: #ffffff;width: 4.6rem;padding: .3rem;font-size: .3rem;line-height: .62rem;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);border-radius: .2rem"><img style="display: block;width: 2rem;margin: 0 auto" src="http://h5.scrstv.com/html/commonJs/thank.jpg" alt=""><p style="text-align: center">您的APP版本过低,需要您升级到版本' + ver + '以上,请您升级成功后重新登录,感谢您的理解!</p><div style="text-align: center;font-size: 0;margin: .2rem 0;"><span style="display: inline-block;line-height: .6rem;width: 1.8rem;margin: 0 .1rem;font-size: .28rem;color: #333;border: 1px solid #333;" onclick="$.initCloseVerisionMask()">以后再说</span><span style="display: inline-block;line-height: .6rem;width: 1.8rem;margin: 0 .1rem;font-size: .28rem;color: #fff;border: 1px solid #e44c4c;background-color: #e44c4c">立即升级</span></div></div></div>')
|
||||
$('body').append('<div id="initVersionMask" style="position: fixed;background-color:rgba(0,0,0,.6);left: 0;top: 0;z-index: 99;width: 100%;height: 100%;"><div style="background-color: #ffffff;width: 4.6rem;padding: .3rem;font-size: .3rem;line-height: .62rem;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);border-radius: .2rem"><img style="display: block;width: 2rem;margin: 0 auto" src="http://h5.scrstv.com/html/commonJs/thank.jpg" alt=""><p style="text-align: center">您的APP版本过低,需要您升级到版本' + ver + '以上,请您升级成功后重新登录,感谢您的理解!</p></div></div>')
|
||||
},
|
||||
//关闭更新提示
|
||||
initCloseVerisionMask: function () {
|
||||
$('#initVersionMask').remove();
|
||||
return false
|
||||
},
|
||||
//跳转到升级页面
|
||||
initToUpgradePage: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentSystenSetting("1");
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentSystenSetting("1")
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentSystenSetting', '1', null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
//唤起群组聊天界面
|
||||
initJoinGroupWithChat: function (title, groupId) {
|
||||
// 0表示招聘者,1表示求职者
|
||||
var sys = $.initGetAppSys();
|
||||
var obj = {
|
||||
title: title,
|
||||
groupId: groupId
|
||||
};
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentJoinGroupWithChat(groupId)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentJoinGroupWithChat(obj)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentJoinGroupWithChat', groupId, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
initOpenAppActivity: function (json) {
|
||||
//json {"appInterfaceType":"activity:\/\/newsListPage","mannerId":"3","columnId":"13"} h5需要调用方法openAppActivity()将json作为参数传入
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.openAppActivity(json)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
openAppActivity(json)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('openAppActivity', json, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//关闭当前页面
|
||||
initBackToRoot: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.closeActivity()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
backToTop()
|
||||
} catch (e) {
|
||||
try {
|
||||
JKEventHandler.callNativeFunction('backToTop', {}, null, null);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//关闭下拉刷新功能
|
||||
initCloseUpdate: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidShare.closeHeaderUpdate()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
closeHeaderUpdate()
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('closeHeaderUpdate', {}, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//开启下拉刷新功能
|
||||
initOpenUpdate: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidShare.openHeaderUpdate()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
openHeaderUpdate()
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('openHeaderUpdate', {}, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//唤起APP聊天界面
|
||||
initSingleChat: function (userId, title) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentChat(title || '', userId)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentSingleChat(userId)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentSingleChat', userId, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//唤起APP聊天界面
|
||||
initEvokeChat: function (interviewerId, joberType, positionId) {
|
||||
// 0表示招聘者,1表示求职者
|
||||
var sys = $.initGetAppSys();
|
||||
var obj = {
|
||||
interviewerId: interviewerId,
|
||||
joberType: joberType,
|
||||
positionId: positionId
|
||||
};
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentJobMessage(JSON.stringify(obj))
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentJobMessage(JSON.stringify(obj))
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentJobMessage', JSON.stringify(obj), null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//唤起求职列表
|
||||
initGetChatList: function (joberType) {
|
||||
// 0表示招聘者,1表示求职者
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
// alert(sys)
|
||||
if (sys == 1) {
|
||||
androidIntent.intentJobMessageList(joberType)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentJobMessageList(joberType)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentJobMessageList', joberType, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//发起群聊
|
||||
intentGroupChat: function (groupId) {
|
||||
// groupId 两微一端的群id 字符串
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentJoinGroupWithChat(groupId)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentJoinGroupWithChat(groupId)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentJoinGroupWithChat', groupId, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//调起扫一扫
|
||||
initToScan: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentScan()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentScan()
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentScan', {}, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
// 进入腾讯云课堂
|
||||
initIntoCloudClassRoom(obj) {
|
||||
// 房间号 serial
|
||||
// 密码 password
|
||||
// 用户昵称 nickname
|
||||
// 地址 host
|
||||
// 主机 server
|
||||
// 端口号 port
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentCloudClassRoom(obj)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentCloudClassRoom(obj)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentCloudClassRoom', obj, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
// 关闭侧滑返回
|
||||
initCloseSlideBack: function () {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidShare.swipeBackEnable()
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
notAllowRightSlideTurnBack()
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('notAllowRightSlideTurnBack', {}, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
downloadImageWithUrl: function (urlStr) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.downloadImageWithUrl(urlStr);
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
downloadImageWithUrl(urlStr);
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('downloadImageWithUrl', urlStr, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
initHideTopRightTool: function (type) {
|
||||
//0 不显示右上角功能(会开启原生左上角的返回按钮)
|
||||
// 1 不显示分享按钮
|
||||
//2 不显示关闭按钮 (会开启原生左上角的返回按钮)
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidShare.rightViewChange(type + '')
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
rightViewChange(type + '')
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('rightViewChange', type + '', null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//拨打电话
|
||||
initAppCallPhone: function (number) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentCallPhone(number);
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentCallPhone(number);
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentCallPhone', number, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//跳详情页面
|
||||
initIntoDetailsView: function (id) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.intentNewsDetail(id);
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
intentNewsDetail(id);
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('intentNewsDetail', id, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//分享
|
||||
initOpenAppShare: function (title, icon, des, url) {
|
||||
var sys = $.initGetAppSys();
|
||||
if (sys == 1) {
|
||||
try {
|
||||
androidShare.shareWebView(JSON.stringify({
|
||||
title: title,
|
||||
icon: icon,
|
||||
descript: des,
|
||||
shareUrl: url
|
||||
}));
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
littleShare({
|
||||
title: title,
|
||||
icon: icon,
|
||||
descript: des,
|
||||
shareUrl: url
|
||||
});
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('littleShare', {
|
||||
title: title,
|
||||
icon: icon,
|
||||
descript: des,
|
||||
shareUrl: url
|
||||
}, 'littleShareCallback', function (data) {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
//实时获取定位
|
||||
initGetLocation: function (fun) {
|
||||
// ios:5.0.3 安卓:5.1.0及以后有这个方法 需在全局定义一个方法jsAppLocationCallback接收参数
|
||||
// 安卓返回对象 IOS为字符串 {longitude:'',latitude:''}
|
||||
var sys = $.initGetAppSys();
|
||||
var coordinate;
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.getAppLocation();
|
||||
// JKEventHandler.callNativeFunction('getAppLocation', null, 'jsAppLocationCallback', function (data) {
|
||||
// coordinate = data;
|
||||
// fun(coordinate)
|
||||
// });
|
||||
} else if (sys == 2) {
|
||||
JKEventHandler.callNativeFunction('getAppLocation', null, 'jsAppLocationCallback', function (data) {
|
||||
coordinate = data;
|
||||
fun(coordinate)
|
||||
});
|
||||
} else {
|
||||
fun(coordinate)
|
||||
}
|
||||
} catch (e) {
|
||||
fun(coordinate)
|
||||
}
|
||||
},
|
||||
//禁止返回上一页
|
||||
initReturnToPreviousPage: function (type) {
|
||||
// 禁止返回上一页,参数传1为禁止,0为允许
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidIntent.noReturnToPreviousPage(type);
|
||||
} else if (sys == 2) {
|
||||
JKEventHandler.callNativeFunction('noReturnToPreviousPage', type, 'noReturnToPreviousPageCallback', function (data) {
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
// IOS允许视频非全屏播放
|
||||
initIosVideoPlayInline: function (str) {
|
||||
// str 值为true或者false字符串
|
||||
var sys = $.initGetAppSys();
|
||||
if (sys == 2) {
|
||||
try {
|
||||
JKEventHandler.callNativeFunction('allowsInlineMediaPlayback', str, 'allowsInlineMediaPlaybackCallback', function (data) {
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
//采编APP 自定义右上角按钮 点击回调方法名称:publishMessage
|
||||
initOpinionsToolbar: function (title) {
|
||||
var sys = $.initGetAppSys();
|
||||
try {
|
||||
if (sys == 1) {
|
||||
androidShare.settingTitleBar(title)
|
||||
} else if (sys == 2) {
|
||||
try {
|
||||
settingTitleBar(title)
|
||||
} catch (e) {
|
||||
JKEventHandler.callNativeFunction('settingTitleBar', title, null, null);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
//获取两微一端用户信息
|
||||
initGetUserInfo: function (root, id, async) {
|
||||
var obj;
|
||||
$.ajax({
|
||||
url: root + '/a/userRelation/getStatisticsByUserId',
|
||||
data: {
|
||||
userId: id,
|
||||
},
|
||||
async: async || false,
|
||||
success: function (res) {
|
||||
try {
|
||||
res = JSON.parse(res)
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
obj = res;
|
||||
}
|
||||
})
|
||||
return obj;
|
||||
},
|
||||
initGetUrl: function (etcenter) {
|
||||
// etcenter 1富顺 2宣汉 3仁寿 4古蔺 6荣县 7高坪 8雷波 9南充 12东坡 14南溪 88公司sass环境
|
||||
var initMedia,//媒资地址
|
||||
initCdn,//媒资加速地址
|
||||
initMicro,//两微一端
|
||||
initDown,//下载APP地址
|
||||
initLogo;//logo
|
||||
etcenter = parseInt(etcenter);
|
||||
switch (etcenter) {
|
||||
case 1:
|
||||
initMedia = 'http://fsunifiedrelease-api.yd-data.com:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://fsmpfc.yd-data.com:8360';
|
||||
initDown = 'http://fsmpfc.yd-data.com:8090/html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/fushun.png';
|
||||
break;
|
||||
case 2:
|
||||
initMedia = 'http://222.215.99.149:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://cityreception.yd-data.com:8074';
|
||||
initDown = 'http://country.yd-data.com/xh_html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/xuanhan.png';
|
||||
break;
|
||||
case 3:
|
||||
// initMedia = 'http://rscmjrp.yd-data.com:8064';
|
||||
initMedia = 'https://meizi.scrstv.com';
|
||||
initCdn = 'http://svod.scrstv.com';
|
||||
initMicro = 'https://lwyd.scrstv.com';
|
||||
initDown = 'https://h5.scrstv.com/html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/renshou.jpg';
|
||||
break;
|
||||
case 4:
|
||||
initMedia = 'https://glmmp.gulinrongmei.com';
|
||||
initCdn = '';
|
||||
initMicro = 'https://lwyd8073.gulinrongmei.com';
|
||||
initDown = 'https://h5.gulinrongmei.com/gl_html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/gulin.jpg';
|
||||
break;
|
||||
case 6:
|
||||
initMedia = 'http://rxmmp.rongxianwang.net:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://www.rongxianwang.net:8073';
|
||||
initDown = 'http://110.189.172.134:8082/html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/rongxian.png';
|
||||
break;
|
||||
case 7:
|
||||
initMedia = 'https://mz.scgpnews.com.cn';
|
||||
initCdn = '';
|
||||
initMicro = 'https://lwyd.scgpnews.com.cn';
|
||||
initDown = 'http://h5.scgpnews.com.cn/html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/gaoping.jpg';
|
||||
break;
|
||||
case 8:
|
||||
initMedia = 'http://lbiomp.lbxww.gov.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://lbiomp.lbxww.gov.cn:8073';
|
||||
initDown = '';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/leibo.png';
|
||||
break;
|
||||
case 9:
|
||||
initMedia = 'http://ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://nciomp.cnncw.cn:8073';
|
||||
initDown = 'http://h5.cnncw.cn/html/app/download.html?areaId=9¢erId=9';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/nanchong.png';
|
||||
break;
|
||||
case 29:
|
||||
initMedia = 'https://mz.baqrm.com';
|
||||
initCdn = '';
|
||||
initMicro = 'https://lwyd.baqrm.com';
|
||||
initDown = 'https://cdnbah5.baqrm.com/html/app/download.html';
|
||||
initLogo = 'https://cdnbah5.baqrm.com/html/hotnews/code/images/barm.png';
|
||||
break;
|
||||
case 9901:
|
||||
initMedia = 'http://ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://nciomp.cnncw.cn:8073';
|
||||
initDown = 'http://h5.cnncw.cn/html/app/download.html?centerId=9&areaId=901';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/nc-shunqing.png';
|
||||
break;
|
||||
case 9903:
|
||||
initMedia = 'http://ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://nciomp.cnncw.cn:8073';
|
||||
initDown = 'http://h5.cnncw.cn/html/app/download.html?centerId=9&areaId=903';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/nc-jialing.png';
|
||||
break;
|
||||
case 9904:
|
||||
initMedia = 'http://ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://nciomp.cnncw.cn:8073';
|
||||
initDown = 'http://h5.cnncw.cn/html/app/download.html?centerId=9&areaId=904';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/langzhong.png';
|
||||
break;
|
||||
case 9905:
|
||||
initMedia = 'http://ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = '//nciomp.cnncw.cn:8073';
|
||||
initDown = '//h5.cnncw.cn/html/app/download.html?centerId=9&areaId=905';
|
||||
initLogo = '//h5.scrstv.com/html/commonJs/images/mc-yingshan.png';
|
||||
break;
|
||||
case 9906:
|
||||
initMedia = '//ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = '//nciomp.cnncw.cn:8073';
|
||||
initDown = '//h5.cnncw.cn/html/app/download.html?centerId=9&areaId=906';
|
||||
initLogo = '//h5.scrstv.com/html/commonJs/images/nc-nanbu.png';
|
||||
break;
|
||||
case 9907:
|
||||
initMedia = '//ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = '//nciomp.cnncw.cn:8073';
|
||||
initDown = '//h5.cnncw.cn/html/app/download.html?centerId=9&areaId=907';
|
||||
initLogo = '//h5.scrstv.com/html/commonJs/images/nc-xichong.png';
|
||||
break;
|
||||
case 9908:
|
||||
initMedia = '//ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = '//nciomp.cnncw.cn:8073';
|
||||
initDown = '//h5.cnncw.cn/html/app/download.html?centerId=9&areaId=908';
|
||||
initLogo = '//h5.scrstv.com/html/commonJs/images/nc-yilong.png';
|
||||
break;
|
||||
case 9909:
|
||||
initMedia = '//ncmmp.cnncw.cn:8064';
|
||||
initCdn = '';
|
||||
initMicro = '//47.108.86.0:8073';
|
||||
initDown = '//h5.cnncw.cn/html/app/download.html?centerId=9&areaId=909';
|
||||
initLogo = '//h5.scrstv.com/html/commonJs/images/nc-pengzhou.png';
|
||||
break;
|
||||
case 12:
|
||||
initMedia = 'http://dprm.info:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://lwyd.dprm.info:8073';
|
||||
initDown = 'http://vms.dprm.info/html/app/download.html';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/dongpo.png';
|
||||
break;
|
||||
case 14:
|
||||
initMedia = 'http://125.64.247.157:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://125.64.247.157:8073';
|
||||
initDown = '';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/nanxi.png';
|
||||
break;
|
||||
case 888802:
|
||||
initMedia = 'http://182.139.182.174:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://182.139.182.174:8073';
|
||||
initDown = '';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/';
|
||||
break;
|
||||
case 888803:
|
||||
initMedia = 'http://182.139.182.174:8064';
|
||||
initCdn = '';
|
||||
initMicro = 'http://182.139.182.174:8073';
|
||||
initDown = '';
|
||||
initLogo = 'http://h5.scrstv.com/html/commonJs/images/';
|
||||
break;
|
||||
default:
|
||||
break
|
||||
}
|
||||
return {
|
||||
mediaUrl: initMedia,
|
||||
cdnUrl: initCdn,
|
||||
microUrl: initMicro,
|
||||
downloadUrl: initDown,
|
||||
logoUrl: initLogo
|
||||
}
|
||||
},
|
||||
initAddLog: function (userId, loginToken, areaId, mobile) {
|
||||
$.ajax({
|
||||
url: 'https://h5.yd-data.com:8098/log',
|
||||
data: {
|
||||
url: decodeURIComponent(location.href),
|
||||
userId: userId,
|
||||
loginToken: loginToken,
|
||||
areaId: areaId,
|
||||
mobile: mobile
|
||||
},
|
||||
success: function (data) {
|
||||
}
|
||||
})
|
||||
},
|
||||
// 设置支付域名
|
||||
setReferer: function (url) {
|
||||
var sys = $.initGetAppSys();
|
||||
console.log("000")
|
||||
try {
|
||||
if (sys == 1) {
|
||||
console.log(111)
|
||||
androidShare.intentSetReferer(url)
|
||||
console.log(222)
|
||||
} else if (sys == 2) {
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
Vendored
+2
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user