|
@@ -1,214 +0,0 @@
|
|
-<!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>
|
|
|