first
parent
81966f25fe
commit
2750c1d2ef
Binary file not shown.
@ -1,5 +1,2 @@
|
|||||||
Promise.resolve("./pages/index/index.js").then((res) => {
|
|
||||||
res.length;
|
|
||||||
});
|
|
||||||
Promise.resolve("./app.css.js").then(() => {
|
Promise.resolve("./app.css.js").then(() => {
|
||||||
});
|
});
|
||||||
|
@ -1,128 +0,0 @@
|
|||||||
import { isInSSRComponentSetup, injectHook, getCurrentInstance, ref, openBlock, createElementBlock, createElementVNode, unref } from "vue";
|
|
||||||
const ON_SHOW = "onShow";
|
|
||||||
const ON_HIDE = "onHide";
|
|
||||||
function formatAppLog(type, filename, ...args) {
|
|
||||||
if (uni.__log__) {
|
|
||||||
uni.__log__(type, filename, ...args);
|
|
||||||
} else {
|
|
||||||
console[type].apply(console, [...args, filename]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
|
|
||||||
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
|
|
||||||
};
|
|
||||||
const onShow = /* @__PURE__ */ createHook(ON_SHOW);
|
|
||||||
const onHide = /* @__PURE__ */ createHook(ON_HIDE);
|
|
||||||
const env = "dev";
|
|
||||||
const configs = {
|
|
||||||
dev: {
|
|
||||||
apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
|
|
||||||
h5Url: "http://192.168.0.191:8080/#/"
|
|
||||||
},
|
|
||||||
test: {
|
|
||||||
apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
|
|
||||||
h5Url: "http://114.218.158.24:9051/#/"
|
|
||||||
},
|
|
||||||
prod: {
|
|
||||||
apiBaseUrl: "https://oa- a.szjixun.cn/#/",
|
|
||||||
h5Url: "https://oa-a.szjixun.cn/#/"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const config = configs[env];
|
|
||||||
const sendWebWiew = (refValue, paramValue, callName = "onReceive") => {
|
|
||||||
if (!refValue) {
|
|
||||||
formatAppLog("error", "at utils/communicate/index.js:3", "evalJs: The reference to the webview is not provided or is null.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof refValue.evalJs !== "function") {
|
|
||||||
formatAppLog("error", "at utils/communicate/index.js:8", "evalJs: The evalJs method is not available on the provided reference.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const jsonString = JSON.stringify(paramValue);
|
|
||||||
const jsCode = `window.${callName}(${jsonString})`;
|
|
||||||
refValue.evalJs(jsCode);
|
|
||||||
} catch (error) {
|
|
||||||
formatAppLog("error", "at utils/communicate/index.js:18", "evalJs: An error occurred while trying to stringify the parameter value or while invoking evalJs.", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const receiveWebView = (e) => {
|
|
||||||
return e.detail.data[0];
|
|
||||||
};
|
|
||||||
uni;
|
|
||||||
const _sfc_main = {
|
|
||||||
__name: "index",
|
|
||||||
setup(__props) {
|
|
||||||
const webViewRef = ref(null);
|
|
||||||
uni.getSystemInfoSync();
|
|
||||||
const networkStatusChange = (res) => {
|
|
||||||
if (res.isConnected) {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: "/pages/index/index"
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: "网络无连接",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleBackButton = () => {
|
|
||||||
sendWebWiew(webViewRef.value, { turnBack: 1 });
|
|
||||||
};
|
|
||||||
onShow(() => {
|
|
||||||
plus.key.addEventListener("backbutton", handleBackButton, false);
|
|
||||||
uni.onNetworkStatusChange(networkStatusChange);
|
|
||||||
});
|
|
||||||
onHide(() => {
|
|
||||||
plus.key.removeEventListener("backbutton", handleBackButton, false);
|
|
||||||
uni.offNetworkStatusChange(networkStatusChange);
|
|
||||||
});
|
|
||||||
const webLoad = (e) => {
|
|
||||||
const m = receiveWebView(e);
|
|
||||||
switch (m.action) {
|
|
||||||
case "load-complete": {
|
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
|
||||||
uni.getLocation({
|
|
||||||
type: "gcj02",
|
|
||||||
geocode: false,
|
|
||||||
isHighAccuracy: false,
|
|
||||||
success: async (res) => {
|
|
||||||
sendWebWiew(webViewRef.value, {
|
|
||||||
...res,
|
|
||||||
systemInfo,
|
|
||||||
webViewRef: webViewRef.value,
|
|
||||||
"latitude": 31.386561,
|
|
||||||
"longitude": 120.660274
|
|
||||||
});
|
|
||||||
},
|
|
||||||
fail: (e2) => {
|
|
||||||
formatAppLog("log", "at pages/index/index.nvue:89", e2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (_ctx, _cache) => {
|
|
||||||
return openBlock(), createElementBlock("scroll-view", {
|
|
||||||
scrollY: true,
|
|
||||||
showScrollbar: true,
|
|
||||||
enableBackToTop: true,
|
|
||||||
bubble: "true",
|
|
||||||
style: { flexDirection: "column" }
|
|
||||||
}, [
|
|
||||||
createElementVNode("u-web-view", {
|
|
||||||
class: "webview",
|
|
||||||
"on:onPostMessage": webLoad,
|
|
||||||
style: { "flex": "1" },
|
|
||||||
ref_key: "webViewRef",
|
|
||||||
ref: webViewRef,
|
|
||||||
src: unref(config).h5Url
|
|
||||||
}, null, 40, ["src"])
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
_sfc_main as default
|
|
||||||
};
|
|
File diff suppressed because one or more lines are too long
@ -1,32 +0,0 @@
|
|||||||
"use weex:vue";
|
|
||||||
|
|
||||||
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
|
|
||||||
Promise.prototype.finally = function(callback) {
|
|
||||||
const promise = this.constructor
|
|
||||||
return this.then(
|
|
||||||
value => promise.resolve(callback()).then(() => value),
|
|
||||||
reason => promise.resolve(callback()).then(() => {
|
|
||||||
throw reason
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
|
|
||||||
const global = uni.requireGlobal()
|
|
||||||
ArrayBuffer = global.ArrayBuffer
|
|
||||||
Int8Array = global.Int8Array
|
|
||||||
Uint8Array = global.Uint8Array
|
|
||||||
Uint8ClampedArray = global.Uint8ClampedArray
|
|
||||||
Int16Array = global.Int16Array
|
|
||||||
Uint16Array = global.Uint16Array
|
|
||||||
Int32Array = global.Int32Array
|
|
||||||
Uint32Array = global.Uint32Array
|
|
||||||
Float32Array = global.Float32Array
|
|
||||||
Float64Array = global.Float64Array
|
|
||||||
BigInt64Array = global.BigInt64Array
|
|
||||||
BigUint64Array = global.BigUint64Array
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
(()=>{var j=Object.create;var f=Object.defineProperty,B=Object.defineProperties,C=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,H=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(t,e,n)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||(e={}))g.call(e,n)&&h(t,n,e[n]);if(_)for(var n of _(e))N.call(e,n)&&h(t,n,e[n]);return t},m=(t,e)=>B(t,J(e));var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var U=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of I(e))!g.call(t,r)&&r!==n&&f(t,r,{get:()=>e[r],enumerable:!(s=C(e,r))||s.enumerable});return t};var A=(t,e,n)=>(n=t!=null?j(H(t)):{},U(e||!t||!t.__esModule?f(n,"default",{value:t,enumerable:!0}):n,t));var y=(t,e,n)=>new Promise((s,r)=>{var a=i=>{try{c(n.next(i))}catch(d){r(d)}},p=i=>{try{c(n.throw(i))}catch(d){r(d)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(a,p);c((n=n.apply(t,e)).next())});var x=T((P,b)=>{b.exports=Vue});var o=A(x());var V="onShow",E="onHide";function l(t,e,...n){uni.__log__?uni.__log__(t,e,...n):console[t].apply(console,[...n,e])}var k=t=>(e,n=(0,o.getCurrentInstance)())=>{!o.isInSSRComponentSetup&&(0,o.injectHook)(t,e,n)},L=k(V),O=k(E),R="dev",W={dev:{apiBaseUrl:"https://warehouse.szjixun.cn/oa_backend",h5Url:"http://192.168.0.191:8080/#/"},test:{apiBaseUrl:"https://warehouse.szjixun.cn/oa_backend",h5Url:"http://114.218.158.24:9051/#/"},prod:{apiBaseUrl:"https://oa- a.szjixun.cn/#/",h5Url:"https://oa-a.szjixun.cn/#/"}},z=W[R],S=(t,e,n="onReceive")=>{if(!t){l("error","at utils/communicate/index.js:3","evalJs: The reference to the webview is not provided or is null.");return}if(typeof t.evalJs!="function"){l("error","at utils/communicate/index.js:8","evalJs: The evalJs method is not available on the provided reference.");return}try{let s=JSON.stringify(e),r=`window.${n}(${s})`;t.evalJs(r)}catch(s){l("error","at utils/communicate/index.js:18","evalJs: An error occurred while trying to stringify the parameter value or while invoking evalJs.",s)}},$=t=>t.detail.data[0];uni;var u={__name:"index",setup(t){let e=(0,o.ref)(null);uni.getSystemInfoSync();let n=a=>{a.isConnected?uni.redirectTo({url:"/pages/index/index"}):uni.showToast({title:"\u7F51\u7EDC\u65E0\u8FDE\u63A5",icon:"none"})},s=()=>{S(e.value,{turnBack:1})};L(()=>{plus.key.addEventListener("backbutton",s,!1),uni.onNetworkStatusChange(n)}),O(()=>{plus.key.removeEventListener("backbutton",s,!1),uni.offNetworkStatusChange(n)});let r=a=>{switch($(a).action){case"load-complete":{let c=uni.getSystemInfoSync();uni.getLocation({type:"gcj02",geocode:!1,isHighAccuracy:!1,success:i=>y(this,null,function*(){S(e.value,m(v({},i),{systemInfo:c,webViewRef:e.value,latitude:31.386561,longitude:120.660274}))}),fail:i=>{l("log","at pages/index/index.nvue:89",i)}})}}};return(a,p)=>((0,o.openBlock)(),(0,o.createElementBlock)("scroll-view",{scrollY:!0,showScrollbar:!0,enableBackToTop:!0,bubble:"true",style:{flexDirection:"column"}},[(0,o.createElementVNode)("u-web-view",{class:"webview","on:onPostMessage":r,style:{flex:"1"},ref_key:"webViewRef",ref:e,src:(0,o.unref)(z).h5Url},null,40,["src"])]))}};var w=plus.webview.currentWebview();if(w){let t=parseInt(w.id),e="pages/index/index",n={};try{n=JSON.parse(w.__query__)}catch(r){}u.mpType="page";let s=Vue.createPageApp(u,{$store:getApp({allowDefault:!0}).$store,__pageId:t,__pagePath:e,__pageQuery:n});s.provide("__globalStyles",Vue.useCssStyles([...__uniConfig.styles,...u.styles||[]])),s.mount("#root")}})();
|
|
Loading…
Reference in New Issue