/*720代表设计师给的设计稿的宽度,你的设计稿是多少,就写多少;100代表换算比例,这里写100是
|
为了以后好算,比如,你测量的一个宽度是100px,就可以写为1rem,以及1px=0.01rem等等*/
|
/* window.onload = function(){
|
getRem(720,100)
|
}; */
|
var callback;
|
login_data={
|
userId:"12345",
|
params: {}
|
}
|
|
function setLoginUser(ocValueOne) {
|
login_data = ocValueOne;
|
}
|
|
function setRouteParams(ocValueOne) {
|
if(ocValueOne instanceof String) {
|
ocValueOne = JSON.pause(ocValueOne);
|
}
|
login_data = ocValueOne;
|
console.info("JS INIT");
|
console.info(JSON.stringify(login_data));
|
}
|
|
window.onresize = function(){
|
getRem(720,100)
|
};
|
function getRem(pwidth,prem, callback){
|
var html = document.getElementsByTagName("html")[0];
|
var oWidth = document.body.clientWidth || document.documentElement.clientWidth;
|
html.style.fontSize = oWidth/pwidth*prem + "px";
|
if(callback) {
|
callback();
|
}
|
}
|
////以上是设置1rem = 100px的屏幕适配
|
|
//调用Android或ios的事件
|
function toIosOrAndroid(functionName, parameter, callback) {
|
var u = navigator.userAgent;
|
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
var systemType = null;
|
if (isiOS) {
|
systemType = ios;
|
}
|
else if (isAndroid) {
|
systemType = android;
|
}
|
if (systemType[functionName]) {
|
systemType[functionName](parameter);
|
if(callback) {
|
callback();
|
}
|
}
|
}
|
|
function showloading(itemid) {
|
document.getElementById(itemid).style.display = "display";
|
}
|
function hideloading(itemid) {
|
document.getElementById(itemid).style.display = "none";
|
}
|
|
function app_click(fun, pam, callback) {
|
// document.getElementById(itemid).style.display = "none";
|
window.webBridge.callAppRouter(fun, pam, function(err, resultObj) {
|
if (callback) {
|
callback(err, resultObj)
|
}
|
});
|
}
|
|
function click_row2(path) {
|
mui.openWindow({
|
url: path + '.html'
|
});
|
}
|
|
// app_click("route", pam, callback);
|