123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"><title>功道云</title><script src=html5plus://ready></script><script src=static/js/polyfill.min.js></script><script>//某些情况下安卓没有提前注入plus对象,导致异常,有这种情况出现直接reload,直到plus存在
- if (window.navigator.userAgent.toLowerCase().match(/html5plus/i) == 'html5plus') {
- if (!window.plus) {
- window.location.reload()
- }
- }
- if (window.plus) {
- function set_item(key, val){
- if(window.plus){
- return plus.storage.setItem(key, val)
- }else{
- return localStorage.setItem(key, val)
- }
- }
- function get_item(key){
- if(window.plus){
- return plus.storage.getItem(key)
- }else{
- return localStorage.getItem(key)
- }
- }
- //plus.storage.removeItem('first_init')
- if(!get_item('first_init') && plus.webview.currentWebview().id == plus.runtime.appid){
- set_item('first_init', '1');
- plus.io.requestFileSystem( plus.io.PRIVATE_WWW, function( fs ) {
- var full_url = 'file://'+fs.root.fullPath+'init.html'
- var init_w = plus.webview.create(full_url,full_url);
- init_w.show()
- }, function ( e ) {
- console.log(e)
- } );
- }
- plus.navigator.setStatusBarStyle('light');
- document.documentElement.style.backgroundColor = '#26A2FF';
- plus.navigator.setStatusBarBackground('#26A2FF');
- function setBadgeNumber(newNum) {
- plus.runtime.setBadgeNumber(newNum);
- if (plus.os.name != 'Android') {
- var GeTuiSdk = plus.ios.importClass('GeTuiSdk');
- GeTuiSdk.setBadge(newNum);
- }
- }
- if (plus.webview.currentWebview().id == plus.runtime.appid) {
- plus.push.addEventListener('receive', function(msg){
- console.log(msg)
- }, false);
- }
- if (plus.navigator.isImmersedStatusbar()) {
- var bar_height = plus.navigator.getStatusbarHeight();
- document.documentElement.style.marginTop = bar_height + 'px';
- document.documentElement.style.height = 'calc(100vh - ' + bar_height + 'px)'
- document.documentElement.classList.add('app_view_html')
- var myEvent = new Event('resize');
- window.dispatchEvent(myEvent);
- plus.webview.currentWebview().setStyle({
- softinputMode: "adjustResize",
- //softinputNavBar: 'none'
- })
- }
- var first = null
- //解决在hbuilder中ios打包后,获取焦点失效的bug
- //setInterval(function () {
- var wv_current = plus.webview.currentWebview().nativeInstanceObject()
- if (plus.os.name != 'Android') {
- wv_current.plusCallMethod({
- 'setKeyboardDisplayRequiresUserAction': false
- })
- }
- var webview = plus.webview.all();
- webview = webview[webview.length - 1]
- //}, 1000)
- plus.key.addEventListener('backbutton', function (e) {
- //console.log(webview)
- if (plus.storage.getItem('qr_scaning')) {
- return false;
- }
- webview.canBack(function (e) {
- if (e.canBack) {
- webview.back()
- } else {
- if (webview.id == plus.runtime.appid) {
- //首次按键,提示‘再按一次退出应用’
- if (!first) {
- first = new Date().getTime()
- plus.nativeUI.toast("再按一次退出应用");
- setTimeout(function () {
- first = null
- }, 1000)
- } else {
- if (new Date().getTime() - first < 1500) {
- plus.runtime.quit()
- }
- }
- } else {
- webview.close();
- }
- }
- })
- })
- var wgtVer = null;
- plus.runtime.getProperty(plus.runtime.appid, function (inf) {
- wgtVer = inf.version
- //checkUpdate()
- });
- function downWgt(wgtUrl) {
- plus.nativeUI.showWaiting("正在下载更新");
- plus.downloader.createDownload(wgtUrl, {
- filename: "_doc/update/"
- }, function (d, status) {
- if (status == 200) {
- installWgt(d.filename);
- } else {
- plus.nativeUI.alert("下载wgt失败!");
- }
- plus.nativeUI.closeWaiting();
- }).start();
- }
- function installWgt(path) {
- plus.nativeUI.showWaiting("安装更新...")
- plus.runtime.install(path, {
- force: true
- }, function () {
- plus.nativeUI.closeWaiting();
- plus.nativeUI.alert("更新完成!", function () {
- plus.runtime.restart();
- });
- }, function (e) {
- plus.nativeUI.closeWaiting();
- plus.nativeUI.alert("安装失败[" + e.code + "]");
- });
- }
- }
- window.onload = function () {
- if(window.plus){
- document.body.classList.add('on_app')
- }
- (function (window) {
- window.addEventListener('focusout', function () {
- //软键盘收起的事件处理
- window.setTimeout(function () {
- if (!(document.activeElement && (document.activeElement.type == 'textarea' || document.activeElement.type == 'text' || document.activeElement.type == 'password' || document.activeElement.type == 'search'))) {
- let ua = window.navigator.userAgent.toLowerCase();
- if (ua.match(/MicroMessenger/i) == 'micromessenger') {
- window.scroll(0, 0)
- }
- }
- }, 300)
- });
- var winW = document.documentElement.clientWidth || window.innerWidth
- if (winW > 750) {
- winW = 750
- }
- var fontSize = Math.round(winW / 7.5)
- if (fontSize % 2 > 0) {
- fontSize += 1
- }
- setInterval(function () {
- document.body.style.height = '100%'
- }, 100)
- document.documentElement.style.fontSize = fontSize + 'px'
- window.onresize = function () {
- if (window.plus) {
- setTimeout(function () {
- var bar_height = plus.navigator.getStatusbarHeight();
- document.documentElement.style.marginTop = bar_height + 'px';
- document.documentElement.style.backgroundColor = '#26A2FF';
- document.documentElement.style.height = 'calc(100vh - ' + bar_height + 'px)'
- }, 100)
- }
- var winW = document.documentElement.clientWidth || window.innerWidth
- document.body.clientWidth
- if (winW > 750) {
- winW = 750
- }
- fontSize = Math.round(winW / 7.5)
- if (fontSize % 2 > 0) {
- fontSize += 1
- }
- document.documentElement.style.fontSize = fontSize + 'px'
- }
- setTimeout(function () {
- document.body.style.opacity = 1;
- document.documentElement.style.opacity = 1;
- if (window.plus && plus.webview.currentWebview().id == plus.runtime.appid) {
- localStorage.setItem('window_height', plus.screen.resolutionHeight + 1)
- }
- }, 100)
- }(window))
- }</script><link href=static/css/app.8076158f4f1dffbae5004bef1de19482.css rel=stylesheet></head><body style="opacity: 0"><div id=app style=""></div><script type=text/javascript src=static/js/manifest.2dd8328ce82475e5cdf5.js></script><script type=text/javascript src=static/js/vendor.509cc4e0c2feb192cb2f.js></script><script type=text/javascript src=static/js/app.4d8c62dbd54814c4426f.js></script></body></html>
|