Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | export default {
isApp() {
const userAgent = window.navigator.userAgent.toLowerCase();
if (userAgent.indexOf('umsopencore/1.0.0 51') > -1) {
return true;
}
return false;
},
isWechat() {
const userAgent = window.navigator.userAgent.toLowerCase();
if (userAgent.indexOf('micromessenger') === -1) {
return false;
}
return true;
},
isIOS() {
const ua = window.navigator.userAgent;
let result = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;
return result;
},
isAndroid() {
const ua = window.navigator.userAgent;
if (ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1) {
return true;
}
else {
return false;
}
},
downloadApp() {
window.location.href = 'http://info.snapp.chinaums.com/snapp/info/www/qmcs_download/index.html';
},
communicateToNative(jsBridgeParam = {}) {
if (this.isIOS()) {
window.webkit.messageHandlers.jsToNativeData.postMessage({
body: jsBridgeParam
});
}
else if (this.isAndroid()) {
let paramJsonStr = JSON.stringify(jsBridgeParam);
window.Android.jsToNativeMethod(paramJsonStr);
}
},
compareVersion(version) {
if (version) {
let appVersion = navigator.userAgent.match(/feifan;([\d\.]+)/i);
appVersion = appVersion ? appVersion[1] : '0.0.0.0';
let appArray = appVersion.split('.');
let tarArray = version.split('.');
for (let i = 0; i < appArray.length || i < tarArray.length; i++) {
let n1 = +appArray[i];
let n2 = +tarArray[i];
if (isNaN(n1))
n1 = 0;
if (isNaN(n2))
n2 = 0;
if (n1 < n2)
return -1;
if (n1 > n2)
return 1;
}
return 0;
}
else {
return false;
}
},
toSchema(url) {
return `wandaappfeifan://app/CommonWebView?url=${encodeURIComponent(url)}`;
}
};
|