app-service.js 3.5 KB

1
  1. if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...n){uni.__log__?uni.__log__(e,t,...n):console[e].apply(console,[...n,t])}var n;__definePage("pages/index/index",((e,t)=>{const n=e.__vccOpts||e;for(const[i,s]of t)n[i]=s;return n})({data:()=>({title:"sanfan",url:"http://175.178.26.5:20011/#/",src:"",wv:null,canBack:!1,top:0,height:0,kbHeight:0}),onBackPress(){return!(!n||!this.canBack)&&(n.back(),!0)},onReady(){var e=this,t=this.$scope.$getAppWebview();setTimeout((function(){(n=t.children()[0]).addEventListener("progressChanged",(function(t){n.canBack((function(t){e.canBack=t.canBack}))}),!1)}),500)},onLoad(){uni.getSystemInfo({success:e=>{this.height=e.windowHeight},complete:()=>{}});let e=uni.getSystemInfoSync();this.top=e.statusBarHeight;var n=this.$scope.$getAppWebview();setTimeout((()=>{this.wv=n.children()[0],this.wv.setStyle({top:this.top,height:this.height-this.top,scalable:!1})}),1e3),uni.onKeyboardHeightChange((e=>{let t=uni.getSystemInfoSync(),n=t.screenHeight-t.windowHeight,i=e.height-n;this.kbHeight=(i>0?i:0)-2,this.wv.setStyle({top:this.top,height:this.height-this.kbHeight,scalable:!1})})),uni.onWindowResize((e=>{e.size.windowHeight<this.height?setTimeout((()=>{this.wv.setStyle({top:this.top,height:this.height-this.kbHeight,scalable:!1})}),50):setTimeout((()=>{this.wv.setStyle({top:this.top,height:this.height-this.top,bottom:0})}),50)})),uni.$on("connectStatusChange",(e=>{e&&jpushModule.getRegistrationID((e=>{t("log","at pages/index/index.vue:138",e,"注册ID....."),this.wv.evalJS(`getVueMessage(${JSON.stringify(e.registerID)})`)}))}))},onUnload(){uni.$off("connectStatusChange")},methods:{messageData(e){const t=e.detail.data;if("file"==t[0].type){let e=t[0].url;uni.downloadFile({url:e,success:function(e){200===e.statusCode&&uni.openDocument({filePath:e.tempFilePath,success:function(e){},fail:function(e){}})},fail:function(e){}})}else"scanCode"==t[0].type?uni.scanCode({success:e=>{this.wv.evalJS(`getVueMessage(${JSON.stringify(e.result)} , ${t[0].scanType})`)}}):"push"==t[0].type?uni.createPushMessage({title:"通知",content:t[0].content}):"message"==t[0].type&&plus.runtime.setBadgeNumber(t[0].count)}}},[["render",function(t,n,i,s,o,a){return e.openBlock(),e.createElementBlock("view",{class:"content"},[e.createElementVNode("view",{class:"status_bar"}),e.createElementVNode("web-view",{src:o.url,fullscreen:!1,onMessage:n[0]||(n[0]=(...e)=>a.messageData&&a.messageData(...e))},null,40,["src"])])}]]));const i={onLaunch:function(){t("log","at App.vue:4","onLaunch")},onShow:function(){t("log","at App.vue:7","App Show")},onHide:function(){t("log","at App.vue:10","App Hide")}};const{app:s,Vuex:o,Pinia:a}={app:e.createVueApp(i)};uni.Vuex=o,uni.Pinia=a,s.provide("__globalStyles",__uniConfig.styles),s._component.mpType="app",s._component.render=()=>{},s.mount("#app")}(Vue);