123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover">
- <title>功道云</title>
- <script src="html5plus://ready"></script>
- <script src="static/js/polyfill.min.js"></script>
- <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
- <script type="text/javascript" src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.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.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",
- })
- }
- 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) {
- 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
- });
- }
- 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'||document.activeElement.type == 'tel'))) {
- 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>
- </head>
- <body style="opacity: 0">
- <div id="app"></div>
- <!-- built files will be auto injected -->
- </body>
- <!-- <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=a3b5fef4a3a2984284387ae5e2c340ed&plugin=AMap.Geocoder"></script>
- <script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script> -->
- </html>
|