提交 2d46131a 编写于 作者: Q qiang

Merge branch 'dev' into alpha

# Conflicts:
#	packages/uni-stacktracey/package.json
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var o=t[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(a,o,function(t){return e[t]}.bind(null,o));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports={}},function(e,t,n){"use strict";function a(e,t,n,a,o,r,i,s,c,u){var l,f="function"==typeof e?e.options:e;if(c){f.components||(f.components={});var d=Object.prototype.hasOwnProperty;for(var p in c)d.call(c,p)&&!d.call(f.components,p)&&(f.components[p]=c[p])}if(u&&((u.beforeCreate||(u.beforeCreate=[])).unshift((function(){this[u.__module]=this})),(f.mixins||(f.mixins=[])).push(u)),t&&(f.render=t,f.staticRenderFns=n,f._compiled=!0),a&&(f.functional=!0),r&&(f._scopeId="data-v-"+r),i?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},f._ssrRegister=l):o&&(l=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),l)if(f.functional){f._injectStyles=l;var g=f.render;f.render=function(e,t){return l.call(t),g(e,t)}}else{var h=f.beforeCreate;f.beforeCreate=h?[].concat(h,l):[l]}return{exports:e,options:f}}n.d(t,"a",(function(){return a}))},function(e,t,n){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.weexPlus=t.default=void 0,a="function"==typeof getUni?getUni:function(){var e=function(e){return"function"==typeof e},t=function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))},n=/^\$|^on|^create|Sync$|Manager$|^pause/,a=["os","getCurrentSubNVue","getSubNVueById","stopRecord","stopVoice","stopBackgroundAudio","stopPullDownRefresh","hideKeyboard","hideToast","hideLoading","showNavigationBarLoading","hideNavigationBarLoading","canIUse","navigateBack","closeSocket","pageScrollTo","drawCanvas"],r=function(e){return(!n.test(e)||"createBLEConnection"===e)&&!~a.indexOf(e)},i=function(n){return function(){for(var a=arguments.length,o=Array(a>1?a-1:0),r=1;r<a;r++)o[r-1]=arguments[r];var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e(i.success)||e(i.fail)||e(i.complete)?n.apply(void 0,[i].concat(o)):t(new Promise((function(e,t){n.apply(void 0,[Object.assign({},i,{success:e,fail:t})].concat(o)),Promise.prototype.finally=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){throw n}))}))}})))}},s=[],c=void 0;function u(e){s.forEach((function(t){return t({origin:c,data:e})}))}var l=o.webview.currentWebview().id,f=new BroadcastChannel("UNI-APP-SUBNVUE");function d(e){var t=o.webview.getWebviewById(e);return t&&!t.$processed&&function(e){e.$processed=!0;var t=o.webview.currentWebview().id===e.id,n="uniNView"===e.__uniapp_origin_type&&e.__uniapp_origin_id,a=e.id;if(e.postMessage=function(e){n?f.postMessage({data:e,to:t?n:a}):_({type:"UniAppSubNVue",data:e})},e.onMessage=function(e){s.push(e)},e.__uniapp_mask_id){c=e.__uniapp_host;var r=e.__uniapp_mask,i=o.webview.getWebviewById(e.__uniapp_mask_id);i=i.parent()||i;var u=e.show,l=e.hide,d=e.close,p=function(){i.setStyle({mask:r})},g=function(){i.setStyle({mask:"none"})};e.show=function(){p();for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];return u.apply(e,n)},e.hide=function(){g();for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];return l.apply(e,n)},e.close=function(){g();for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];return d.apply(e,n)}}}(t),t}f.onmessage=function(e){e.data.to===l&&u(e.data.data)};var p=weex.requireModule("plus"),g=weex.requireModule("globalEvent"),h=0,v={};g.addEventListener("plusMessage",(function(e){"UniAppJsApi"===e.data.type?y(e.data.id,e.data.data):"UniAppSubNVue"===e.data.type?u(e.data.data,e.data.options):"onNavigationBarButtonTap"===e.data.type?"function"==typeof b&&b(e.data.data):"onNavigationBarSearchInputChanged"===e.data.type?"function"==typeof S&&S(e.data.data):"onNavigationBarSearchInputConfirmed"===e.data.type?"function"==typeof C&&C(e.data.data):"onNavigationBarSearchInputClicked"===e.data.type&&"function"==typeof w&&w(e.data.data)}));var y=function(e,t){var n=v[e];n?(n(t),n.keepAlive||delete v[e]):console.error("callback["+e+"] is undefined")},m=function(t){var n,a,o=t.id,r=t.type,i=t.params;v[o]=(a=function(t){e(n)?n(t):n&&(~t.errMsg.indexOf(":ok")?e(n.success)&&n.success(t):~t.errMsg.indexOf(":fail")&&e(n.fail)&&n.fail(t),e(n.complete)&&n.complete(t))},(e(n=i)||n&&e(n.callback))&&(a.keepAlive=!0),a),p.postMessage({id:o,type:r,params:i},"__uniapp__service")};function _(e){p.postMessage(e,"__uniapp__service")}var A=function(e){return function(t){m({id:h++,type:e,params:t})}},b=void 0,S=void 0,C=void 0,w=void 0;function E(e){b=e}function M(e){S=e}function k(e){C=e}function O(e){w=e}function B(e){return weex.requireModule(e)}var I=weex.requireModule("dom"),P=weex.requireModule("globalEvent"),T=[];function D(e){"function"==typeof e&&(this.isUniAppReady?e():T.push(e))}P.addEventListener("plusMessage",(function(e){"UniAppReady"===e.data.type&&(D.isUniAppReady=!0,T.length&&(T.forEach((function(e){return e()})),T=[]))}));var N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x=weex.requireModule("stream"),U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/x-www-form-urlencoded";return"object"===(void 0===e?"undefined":N(e))?"POST"===t.toUpperCase()&&"application/json"===n.toLowerCase()?JSON.stringify(e):Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&"):e},R=weex.requireModule("plusstorage"),V=weex.requireModule("clipboard"),F=function(){if("function"==typeof getUniEmitter)return getUniEmitter;var e={$on:function(){console.warn("uni.$on failed")},$off:function(){console.warn("uni.$off failed")},$once:function(){console.warn("uni.$once failed")},$emit:function(){console.warn("uni.$emit failed")}};return function(){return e}}();function L(e,t,n){return e[t].apply(e,n)}var j=Object.freeze({loadFontFace:function(t){var n=t.family,a=t.source,o=(t.desc,t.success),r=(t.fail,t.complete);I.addRule("fontFace",{fontFamily:n,src:a.replace(/"/g,"'")});var i={errMsg:"loadFontFace:ok",status:"loaded"};e(o)&&o(i),e(r)&&r(i)},ready:D,request:function(t){var n=t.url,a=t.data,o=t.header,r=t.method,i=void 0===r?"GET":r,s=t.dataType,c=void 0===s?"json":s,u=(t.responseType,t.success),l=t.fail,f=t.complete,d=!1,p=!1,g={};if(o)for(var h in o)p||"content-type"!==h.toLowerCase()?g[h]=o[h]:(p=!0,g["Content-Type"]=o[h]);return"GET"===i&&a&&(n=n+(~n.indexOf("?")?"&"===n.substr(-1)||"?"===n.substr(-1)?"":"&":"?")+U(a)),x.fetch({url:n,method:i,headers:g,type:"json"===c?"json":"text",body:"GET"!==i?U(a,i,g["Content-Type"]):""},(function(t){var n=t.status,a=(t.ok,t.statusText,t.data),o=t.headers,r={};!n||-1===n||d?(r.errMsg="request:fail",e(l)&&l(r)):(r.data=a,r.statusCode=n,r.header=o,e(u)&&u(r)),e(f)&&f(r)})),{abort:function(){d=!0}}},getStorage:function(t){var n=t.key,a=(t.data,t.success),o=t.fail,r=t.complete;R.getItem(n+"__TYPE",(function(t){if("success"===t.result){var i=t.data;R.getItem(n,(function(t){if("success"===t.result){var n=t.data;i&&n?("String"!==i&&(n=JSON.parse(n)),e(a)&&a({errMsg:"getStorage:ok",data:n})):(t.errMsg="setStorage:fail",e(o)&&o(t))}else t.errMsg="setStorage:fail",e(o)&&o(t);e(r)&&r(t)}))}else t.errMsg="setStorage:fail",e(o)&&o(t),e(r)&&r(t)}))},setStorage:function(t){var n=t.key,a=t.data,o=t.success,r=t.fail,i=t.complete,s="String";"object"===(void 0===a?"undefined":N(a))&&(s="Object",a=JSON.stringify(a)),R.setItem(n,a,(function(t){"success"===t.result?R.setItem(n+"__TYPE",s,(function(t){"success"===t.result?e(o)&&o({errMsg:"setStorage:ok"}):(t.errMsg="setStorage:fail",e(r)&&r(t))})):(t.errMsg="setStorage:fail",e(r)&&r(t)),e(i)&&i(t)}))},removeStorage:function(t){var n=t.key,a=(t.data,t.success),o=t.fail,r=t.complete;R.removeItem(n,(function(t){"success"===t.result?e(a)&&a({errMsg:"removeStorage:ok"}):(t.errMsg="removeStorage:fail",e(o)&&o(t)),e(r)&&r(t)})),R.removeItem(n+"__TYPE")},clearStorage:function(e){e.key,e.data,e.success,e.fail,e.complete},getClipboardData:function(t){var n=t.success,a=(t.fail,t.complete);V.getString((function(t){var o={errMsg:"getClipboardData:ok",data:t.data};e(n)&&n(o),e(a)&&a(o)}))},setClipboardData:function(t){var n=t.data,a=t.success,o=(t.fail,t.complete),r={errMsg:"setClipboardData:ok"};V.setString(n),e(a)&&a(r),e(o)&&o(r)},onSubNVueMessage:u,getSubNVueById:d,getCurrentSubNVue:function(){return d(o.webview.currentWebview().id)},$on:function(){return L(F(),"$on",[].concat(Array.prototype.slice.call(arguments)))},$off:function(){return L(F(),"$off",[].concat(Array.prototype.slice.call(arguments)))},$once:function(){return L(F(),"$once",[].concat(Array.prototype.slice.call(arguments)))},$emit:function(){return L(F(),"$emit",[].concat(Array.prototype.slice.call(arguments)))}}),$={os:{nvue:!0}},J={};return"undefined"!=typeof Proxy?J=new Proxy({},{get:function(e,t){if("os"===t)return{nvue:!0};if("postMessage"===t)return _;if("requireNativePlugin"===t)return B;if("onNavigationBarButtonTap"===t)return E;if("onNavigationBarSearchInputChanged"===t)return M;if("onNavigationBarSearchInputConfirmed"===t)return k;if("onNavigationBarSearchInputClicked"===t)return O;var n=j[t];return n||(n=A(t)),r(t)?i(n):n}}):(Object.keys($).forEach((function(e){J[e]=$[e]})),J.postMessage=_,J.requireNativePlugin=B,J.onNavigationBarButtonTap=E,J.onNavigationBarSearchInputChanged=M,J.onNavigationBarSearchInputConfirmed=k,J.onNavigationBarSearchInputClicked=O,Object.keys({uploadFile:!0,downloadFile:!0,chooseImage:!0,previewImage:!0,getImageInfo:!0,saveImageToPhotosAlbum:!0,chooseVideo:!0,saveVideoToPhotosAlbum:!0,saveFile:!0,getSavedFileList:!0,getSavedFileInfo:!0,removeSavedFile:!0,openDocument:!0,setStorage:!0,getStorage:!0,getStorageInfo:!0,removeStorage:!0,clearStorage:!0,getLocation:!0,chooseLocation:!0,openLocation:!0,getSystemInfo:!0,getNetworkType:!0,makePhoneCall:!0,scanCode:!0,setScreenBrightness:!0,getScreenBrightness:!0,setKeepScreenOn:!0,vibrateLong:!0,vibrateShort:!0,addPhoneContact:!0,showToast:!0,showLoading:!0,hideToast:!0,hideLoading:!0,showModal:!0,showActionSheet:!0,setNavigationBarTitle:!0,setNavigationBarColor:!0,navigateTo:!0,redirectTo:!0,reLaunch:!0,switchTab:!0,navigateBack:!0,getProvider:!0,login:!0,getUserInfo:!0,share:!0,requestPayment:!0,subscribePush:!0,unsubscribePush:!0,onPush:!0,offPush:!0}).forEach((function(e){var t=j[e];t||(t=A(e)),r(e)?J[e]=i(t):J[e]=t}))),J};var o=new WeexPlus(weex);t.weexPlus=o;var r=a(weex,o,BroadcastChannel);t.default=r},function(e,t,n){Vue.prototype.__$appStyle__={},Vue.prototype.__merge_style&&Vue.prototype.__merge_style(n(4).default,Vue.prototype.__$appStyle__)},function(e,t,n){"use strict";n.r(t);var a=n(0),o=n.n(a);for(var r in a)"default"!==r&&function(e){n.d(t,e,(function(){return a[e]}))}(r);t.default=o.a},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n={onLoad:function(){this.initMessage()},methods:{initMessage:function(){var t=this,n=e.webview.currentWebview().extras||{},a=n.from,o=(n.callback,n.runtime),r=n.data,i=void 0===r?{}:r,s=n.useGlobalEvent;this.__from=a,this.__runtime=o,this.__page=e.webview.currentWebview().id,this.__useGlobalEvent=s,this.data=JSON.parse(JSON.stringify(i)),e.key.addEventListener("backbutton",(function(){"function"==typeof t.onClose?t.onClose():e.webview.currentWebview().close("auto")}));var c=this,u=function(e){var t=e.data&&e.data.__message;t&&c.__onMessageCallback&&c.__onMessageCallback(t.data)};this.__useGlobalEvent?weex.requireModule("globalEvent").addEventListener("plusMessage",u):new BroadcastChannel(this.__page).onmessage=u},postMessage:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=JSON.parse(JSON.stringify({__message:{__page:this.__page,data:t,keep:n}})),o=this.__from;if("v8"===this.__runtime)if(this.__useGlobalEvent)e.webview.postMessageToUniNView(a,o);else{var r=new BroadcastChannel(o);r.postMessage(a)}else{var i=e.webview.getWebviewById(o);i&&i.evalJS("__plusMessage&&__plusMessage(".concat(JSON.stringify({data:a}),")"))}},onMessage:function(e){this.__onMessageCallback=e}}};t.default=n}).call(this,n(2).weexPlus)},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n={data:function(){return{locale:"en",fallbackLocale:"en",localization:{en:{done:"OK",cancel:"Cancel"},zh:{done:"完成",cancel:"取消"},"zh-hans":{},"zh-hant":{},messages:{}}}},onLoad:function(){this.initLocale()},created:function(){this.initLocale()},methods:{initLocale:function(){if(!this.__initLocale){this.__initLocale=!0;var t=(e.webview.currentWebview().extras||{}).data||{};if(t.messages&&(this.localization.messages=t.messages),t.locale)this.locale=t.locale.toLowerCase();else{var n=e.os.language.toLowerCase().split("/")[0].replace("_","-").split("-"),a=n[1];a&&(n[1]={chs:"hans",cn:"hans",sg:"hans",cht:"hant",tw:"hant",hk:"hant",mo:"hant"}[a]||a),n.length=n.length>2?2:n.length,this.locale=n.join("-")}}},localize:function(e){var t=this.locale,n=t.split("-")[0],a=this.fallbackLocale,o=this.localization;function r(e){return o[e]||{}}return r("messages")[e]||r(t)[e]||r(n)[e]||r(a)[e]||e}}};t.default=n}).call(this,n(2).weexPlus)},,,function(e,t,n){"use strict";var a=n(33),o=n(18),r=n(1);var i=Object(r.a)(o.default,a.b,a.c,!1,null,null,"6af04a36",!1,a.a,void 0);(function(e){this.options.style||(this.options.style={}),Vue.prototype.__merge_style&&Vue.prototype.__$appStyle__&&Vue.prototype.__merge_style(Vue.prototype.__$appStyle__,this.options.style),Vue.prototype.__merge_style?Vue.prototype.__merge_style(n(38).default,this.options.style):Object.assign(this.options.style,n(38).default)}).call(i),t.default=i.exports},,,,,,,,,function(e,t,n){"use strict";var a=n(19),o=n.n(a);t.default=o.a},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,o=i(n(5)),r=i(n(6));function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=e.barcode,u={qrCode:[c.QR,c.AZTEC,c.MAXICODE],barCode:[c.EAN13,c.EAN8,c.UPCA,c.UPCE,c.CODABAR,c.CODE128,c.CODE39,c.CODE93,c.ITF,c.RSS14,c.RSSEXPANDED],datamatrix:[c.DATAMATRIX],pdf417:[c.PDF417]},l=(s(a={},c.QR,"QR_CODE"),s(a,c.EAN13,"EAN_13"),s(a,c.EAN8,"EAN_8"),s(a,c.DATAMATRIX,"DATA_MATRIX"),s(a,c.UPCA,"UPC_A"),s(a,c.UPCE,"UPC_E"),s(a,c.CODABAR,"CODABAR"),s(a,c.CODE39,"CODE_39"),s(a,c.CODE93,"CODE_93"),s(a,c.CODE128,"CODE_128"),s(a,c.ITF,"CODE_25"),s(a,c.PDF417,"PDF_417"),s(a,c.AZTEC,"AZTEC"),s(a,c.RSS14,"RSS_14"),s(a,c.RSSEXPANDED,"RSSEXPANDED"),a),f={mixins:[o.default,r.default],data:{filters:[0,2,1],backgroud:"#000000",frameColor:"#118ce9",scanbarColor:"#118ce9",enabledFlash:!1,flashImage0:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABjklEQVRoQ+1ZbVHEQAx9TwE4ABTcOQAknANQAKcAUAAOAAXgAHAACsDCKQiTmbYDzJZtNt2bFrJ/m6+Xl2yyU2LmhzOPH/8PgIjcADirxNyapNoffMwMiMgzgMPBHmyCLySPLCoBwJKtAbJbYaBmD1yRvBwAtBMxl5DF+DZkiwCIyBLAzsgBbki+Wm2WAlCaL6zOMvKnJO+sNksB7ALQbO1ZHfbIv5FUVs2nCIB6EZETALdmj2mFY5I6X8ynGEADQllYmL1+VzBfnV/VvQB0aj45ARyQ/Ci14QLQsOBZLe5JaikWnzEA7AN4L4hgA2Dpyb76dANwsOCq/TZhASAYKGie0a7R1lDPI0ebtF0NUi+4yfdAtxr3PEMnD6BbD0QkNfACQO05EAwMuaBqDrIVycdmTpwDuP4R0OR7QFftVRP0g+49cwOQq4DJMxAAchmofY3m/EcJBQOZbTRKKJeBKKEoIePvpFRJ1VzmciUccyCa+C81cerBkuuB7sGTE/zt+yhN7AnAqxsAvBn06n8CkyPwMZKwm+UAAAAASUVORK5CYII=",flashImage1:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUAAAA3kvI3lfY2k/VAl+43k/U3k/Q4k/M3kvI3k/M4k/Q4lPU2lPU2k/Vdq843k/WWSpNKAAAAD3RSTlMAwD+QINCAcPBgUDDgoBAE044kAAAAdklEQVQ4y2OgOrD/DwffUSTkERIfyZXAtOMbca7iVoKDDSgSbAijJqBI8J2HiX9FM2s+TOITmgQrTEIATYIJJuEA5mJ68S+Gg/0hEi0YEoxQK2gs0WyPQyKBGYeEAhPtJRaw45AIccXpwVEJekuwQyQWMFAfAACeDBJY9aXa3QAAAABJRU5ErkJggg==",autoDecodeCharSet:!1,localization:{en:{fail:"Recognition failure","flash.on":"Tap to turn light on","flash.off":"Tap to turn light off"},zh:{fail:"识别失败","flash.on":"轻触照亮","flash.off":"轻触关闭"}}},onLoad:function(){var e=this,t=this.data,n=t.scanType;this.autoDecodeCharSet=t.autoDecodeCharSet;var a=[];Array.isArray(n)&&n.length&&n.forEach((function(e){var t=u[e];t&&(a=a.concat(t))})),a.length||(a=a.concat(u.qrCode).concat(u.barCode).concat(u.datamatrix).concat(u.pdf417)),this.filters=a,this.onMessage((function(t){e.gallery()}))},onUnload:function(){this.cancel()},onReady:function(){var e=this;setTimeout((function(){e.cancel(),e.start()}),50)},methods:{start:function(){this.$refs.barcode.start({sound:this.data.sound})},scan:function(t){var n=this;c.scan(t,(function(e,t,a,o){n.scanSuccess(e,t,a,o)}),(function(){e.nativeUI.toast(n.localize("fail"))}),this.filters,this.autoDecodeCharSet)},cancel:function(){this.$refs.barcode.cancel()},gallery:function(){var t=this;e.gallery.pick((function(e){t.scan(e)}),(function(n){n.code!==("android"===weex.config.env.platform.toLowerCase()?12:-2)&&e.nativeUI.toast(t.localize("fail"))}),{multiple:!1,system:!1,filename:"_doc/uniapp_temp/gallery/",permissionAlert:!0})},onmarked:function(e){var t=e.detail;this.scanSuccess(t.code,t.message,t.file,t.charSet)},scanSuccess:function(e,t,n,a){this.postMessage({event:"marked",detail:{scanType:l[e],result:t,charSet:a||"utf8",path:n||""}})},onerror:function(e){this.postMessage({event:"fail",message:JSON.stringify(e)})},setFlash:function(){this.enabledFlash=!this.enabledFlash,this.$refs.barcode.setFlash(this.enabledFlash)}}};t.default=f}).call(this,n(2).weexPlus)},function(e,t){e.exports={content:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"#000000"},barcode:{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:1},"set-flash":{alignItems:"center",justifyContent:"center",transform:"translateY(80px)",zIndex:2},"image-flash":{width:"26",height:"26",marginBottom:"2"},"image-flash-text":{fontSize:"10",color:"#FFFFFF"}}},,,,,,,,,,,,,function(e,t,n){"use strict";var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("scroll-view",{staticStyle:{flexDirection:"column"},attrs:{scrollY:!0,enableBackToTop:!0,bubble:"true"}},[n("view",{staticClass:["content"]},[n("barcode",{ref:"barcode",staticClass:["barcode"],attrs:{autostart:"false",backgroud:e.backgroud,frameColor:e.frameColor,scanbarColor:e.scanbarColor,filters:e.filters,autoDecodeCharset:e.autoDecodeCharSet},on:{marked:e.onmarked,error:e.onerror}}),n("view",{staticClass:["set-flash"],on:{click:e.setFlash}},[n("u-image",{staticClass:["image-flash"],attrs:{src:e.enabledFlash?e.flashImage1:e.flashImage0,resize:"stretch"}}),n("u-text",{staticClass:["image-flash-text"]},[e._v(e._s(e.enabledFlash?e.localize("flash.off"):e.localize("flash.on")))])],1)],1)])},o=[];n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){}))},,,,,function(e,t,n){"use strict";n.r(t);var a=n(20),o=n.n(a);for(var r in a)"default"!==r&&function(e){n.d(t,e,(function(){return a[e]}))}(r);t.default=o.a},,,,,function(e,t,n){"use strict";n.r(t);n(3);var a=n(9);a.default.mpType="page",a.default.route="template/__uniappscan",a.default.el="#root",new Vue(a.default)}]);
\ No newline at end of file
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var o=t[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(a,o,function(t){return e[t]}.bind(null,o));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports={}},function(e,t,n){"use strict";function a(e,t,n,a,o,r,i,s,c,u){var l,f="function"==typeof e?e.options:e;if(c){f.components||(f.components={});var d=Object.prototype.hasOwnProperty;for(var p in c)d.call(c,p)&&!d.call(f.components,p)&&(f.components[p]=c[p])}if(u&&((u.beforeCreate||(u.beforeCreate=[])).unshift((function(){this[u.__module]=this})),(f.mixins||(f.mixins=[])).push(u)),t&&(f.render=t,f.staticRenderFns=n,f._compiled=!0),a&&(f.functional=!0),r&&(f._scopeId="data-v-"+r),i?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},f._ssrRegister=l):o&&(l=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),l)if(f.functional){f._injectStyles=l;var g=f.render;f.render=function(e,t){return l.call(t),g(e,t)}}else{var h=f.beforeCreate;f.beforeCreate=h?[].concat(h,l):[l]}return{exports:e,options:f}}n.d(t,"a",(function(){return a}))},function(e,t,n){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.weexPlus=t.default=void 0,a="function"==typeof getUni?getUni:function(){var e=function(e){return"function"==typeof e},t=function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))},n=/^\$|^on|^create|Sync$|Manager$|^pause/,a=["os","getCurrentSubNVue","getSubNVueById","stopRecord","stopVoice","stopBackgroundAudio","stopPullDownRefresh","hideKeyboard","hideToast","hideLoading","showNavigationBarLoading","hideNavigationBarLoading","canIUse","navigateBack","closeSocket","pageScrollTo","drawCanvas"],r=function(e){return(!n.test(e)||"createBLEConnection"===e)&&!~a.indexOf(e)},i=function(n){return function(){for(var a=arguments.length,o=Array(a>1?a-1:0),r=1;r<a;r++)o[r-1]=arguments[r];var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e(i.success)||e(i.fail)||e(i.complete)?n.apply(void 0,[i].concat(o)):t(new Promise((function(e,t){n.apply(void 0,[Object.assign({},i,{success:e,fail:t})].concat(o)),Promise.prototype.finally=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){throw n}))}))}})))}},s=[],c=void 0;function u(e){s.forEach((function(t){return t({origin:c,data:e})}))}var l=o.webview.currentWebview().id,f=new BroadcastChannel("UNI-APP-SUBNVUE");function d(e){var t=o.webview.getWebviewById(e);return t&&!t.$processed&&function(e){e.$processed=!0;var t=o.webview.currentWebview().id===e.id,n="uniNView"===e.__uniapp_origin_type&&e.__uniapp_origin_id,a=e.id;if(e.postMessage=function(e){n?f.postMessage({data:e,to:t?n:a}):_({type:"UniAppSubNVue",data:e})},e.onMessage=function(e){s.push(e)},e.__uniapp_mask_id){c=e.__uniapp_host;var r=e.__uniapp_mask,i=o.webview.getWebviewById(e.__uniapp_mask_id);i=i.parent()||i;var u=e.show,l=e.hide,d=e.close,p=function(){i.setStyle({mask:r})},g=function(){i.setStyle({mask:"none"})};e.show=function(){p();for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];return u.apply(e,n)},e.hide=function(){g();for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];return l.apply(e,n)},e.close=function(){g();for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];return d.apply(e,n)}}}(t),t}f.onmessage=function(e){e.data.to===l&&u(e.data.data)};var p=weex.requireModule("plus"),g=weex.requireModule("globalEvent"),h=0,v={};g.addEventListener("plusMessage",(function(e){"UniAppJsApi"===e.data.type?m(e.data.id,e.data.data):"UniAppSubNVue"===e.data.type?u(e.data.data,e.data.options):"onNavigationBarButtonTap"===e.data.type?"function"==typeof b&&b(e.data.data):"onNavigationBarSearchInputChanged"===e.data.type?"function"==typeof S&&S(e.data.data):"onNavigationBarSearchInputConfirmed"===e.data.type?"function"==typeof C&&C(e.data.data):"onNavigationBarSearchInputClicked"===e.data.type&&"function"==typeof w&&w(e.data.data)}));var m=function(e,t){var n=v[e];n?(n(t),n.keepAlive||delete v[e]):console.error("callback["+e+"] is undefined")},y=function(t){var n,a,o=t.id,r=t.type,i=t.params;v[o]=(a=function(t){e(n)?n(t):n&&(~t.errMsg.indexOf(":ok")?e(n.success)&&n.success(t):~t.errMsg.indexOf(":fail")&&e(n.fail)&&n.fail(t),e(n.complete)&&n.complete(t))},(e(n=i)||n&&e(n.callback))&&(a.keepAlive=!0),a),p.postMessage({id:o,type:r,params:i},"__uniapp__service")};function _(e){p.postMessage(e,"__uniapp__service")}var A=function(e){return function(t){y({id:h++,type:e,params:t})}},b=void 0,S=void 0,C=void 0,w=void 0;function E(e){b=e}function M(e){S=e}function k(e){C=e}function O(e){w=e}function B(e){return weex.requireModule(e)}var T=weex.requireModule("dom"),I=weex.requireModule("globalEvent"),P=[];function D(e){"function"==typeof e&&(this.isUniAppReady?e():P.push(e))}I.addEventListener("plusMessage",(function(e){"UniAppReady"===e.data.type&&(D.isUniAppReady=!0,P.length&&(P.forEach((function(e){return e()})),P=[]))}));var N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x=weex.requireModule("stream"),U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/x-www-form-urlencoded";return"object"===(void 0===e?"undefined":N(e))?"POST"===t.toUpperCase()&&"application/json"===n.toLowerCase()?JSON.stringify(e):Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&"):e},R=weex.requireModule("plusstorage"),V=weex.requireModule("clipboard"),F=function(){if("function"==typeof getUniEmitter)return getUniEmitter;var e={$on:function(){console.warn("uni.$on failed")},$off:function(){console.warn("uni.$off failed")},$once:function(){console.warn("uni.$once failed")},$emit:function(){console.warn("uni.$emit failed")}};return function(){return e}}();function L(e,t,n){return e[t].apply(e,n)}var j=Object.freeze({loadFontFace:function(t){var n=t.family,a=t.source,o=(t.desc,t.success),r=(t.fail,t.complete);T.addRule("fontFace",{fontFamily:n,src:a.replace(/"/g,"'")});var i={errMsg:"loadFontFace:ok",status:"loaded"};e(o)&&o(i),e(r)&&r(i)},ready:D,request:function(t){var n=t.url,a=t.data,o=t.header,r=t.method,i=void 0===r?"GET":r,s=t.dataType,c=void 0===s?"json":s,u=(t.responseType,t.success),l=t.fail,f=t.complete,d=!1,p=!1,g={};if(o)for(var h in o)p||"content-type"!==h.toLowerCase()?g[h]=o[h]:(p=!0,g["Content-Type"]=o[h]);return"GET"===i&&a&&(n=n+(~n.indexOf("?")?"&"===n.substr(-1)||"?"===n.substr(-1)?"":"&":"?")+U(a)),x.fetch({url:n,method:i,headers:g,type:"json"===c?"json":"text",body:"GET"!==i?U(a,i,g["Content-Type"]):""},(function(t){var n=t.status,a=(t.ok,t.statusText,t.data),o=t.headers,r={};!n||-1===n||d?(r.errMsg="request:fail",e(l)&&l(r)):(r.data=a,r.statusCode=n,r.header=o,e(u)&&u(r)),e(f)&&f(r)})),{abort:function(){d=!0}}},getStorage:function(t){var n=t.key,a=(t.data,t.success),o=t.fail,r=t.complete;R.getItem(n+"__TYPE",(function(t){if("success"===t.result){var i=t.data;R.getItem(n,(function(t){if("success"===t.result){var n=t.data;i&&n?("String"!==i&&(n=JSON.parse(n)),e(a)&&a({errMsg:"getStorage:ok",data:n})):(t.errMsg="setStorage:fail",e(o)&&o(t))}else t.errMsg="setStorage:fail",e(o)&&o(t);e(r)&&r(t)}))}else t.errMsg="setStorage:fail",e(o)&&o(t),e(r)&&r(t)}))},setStorage:function(t){var n=t.key,a=t.data,o=t.success,r=t.fail,i=t.complete,s="String";"object"===(void 0===a?"undefined":N(a))&&(s="Object",a=JSON.stringify(a)),R.setItem(n,a,(function(t){"success"===t.result?R.setItem(n+"__TYPE",s,(function(t){"success"===t.result?e(o)&&o({errMsg:"setStorage:ok"}):(t.errMsg="setStorage:fail",e(r)&&r(t))})):(t.errMsg="setStorage:fail",e(r)&&r(t)),e(i)&&i(t)}))},removeStorage:function(t){var n=t.key,a=(t.data,t.success),o=t.fail,r=t.complete;R.removeItem(n,(function(t){"success"===t.result?e(a)&&a({errMsg:"removeStorage:ok"}):(t.errMsg="removeStorage:fail",e(o)&&o(t)),e(r)&&r(t)})),R.removeItem(n+"__TYPE")},clearStorage:function(e){e.key,e.data,e.success,e.fail,e.complete},getClipboardData:function(t){var n=t.success,a=(t.fail,t.complete);V.getString((function(t){var o={errMsg:"getClipboardData:ok",data:t.data};e(n)&&n(o),e(a)&&a(o)}))},setClipboardData:function(t){var n=t.data,a=t.success,o=(t.fail,t.complete),r={errMsg:"setClipboardData:ok"};V.setString(n),e(a)&&a(r),e(o)&&o(r)},onSubNVueMessage:u,getSubNVueById:d,getCurrentSubNVue:function(){return d(o.webview.currentWebview().id)},$on:function(){return L(F(),"$on",[].concat(Array.prototype.slice.call(arguments)))},$off:function(){return L(F(),"$off",[].concat(Array.prototype.slice.call(arguments)))},$once:function(){return L(F(),"$once",[].concat(Array.prototype.slice.call(arguments)))},$emit:function(){return L(F(),"$emit",[].concat(Array.prototype.slice.call(arguments)))}}),$={os:{nvue:!0}},J={};return"undefined"!=typeof Proxy?J=new Proxy({},{get:function(e,t){if("os"===t)return{nvue:!0};if("postMessage"===t)return _;if("requireNativePlugin"===t)return B;if("onNavigationBarButtonTap"===t)return E;if("onNavigationBarSearchInputChanged"===t)return M;if("onNavigationBarSearchInputConfirmed"===t)return k;if("onNavigationBarSearchInputClicked"===t)return O;var n=j[t];return n||(n=A(t)),r(t)?i(n):n}}):(Object.keys($).forEach((function(e){J[e]=$[e]})),J.postMessage=_,J.requireNativePlugin=B,J.onNavigationBarButtonTap=E,J.onNavigationBarSearchInputChanged=M,J.onNavigationBarSearchInputConfirmed=k,J.onNavigationBarSearchInputClicked=O,Object.keys({uploadFile:!0,downloadFile:!0,chooseImage:!0,previewImage:!0,getImageInfo:!0,saveImageToPhotosAlbum:!0,chooseVideo:!0,saveVideoToPhotosAlbum:!0,saveFile:!0,getSavedFileList:!0,getSavedFileInfo:!0,removeSavedFile:!0,openDocument:!0,setStorage:!0,getStorage:!0,getStorageInfo:!0,removeStorage:!0,clearStorage:!0,getLocation:!0,chooseLocation:!0,openLocation:!0,getSystemInfo:!0,getNetworkType:!0,makePhoneCall:!0,scanCode:!0,setScreenBrightness:!0,getScreenBrightness:!0,setKeepScreenOn:!0,vibrateLong:!0,vibrateShort:!0,addPhoneContact:!0,showToast:!0,showLoading:!0,hideToast:!0,hideLoading:!0,showModal:!0,showActionSheet:!0,setNavigationBarTitle:!0,setNavigationBarColor:!0,navigateTo:!0,redirectTo:!0,reLaunch:!0,switchTab:!0,navigateBack:!0,getProvider:!0,login:!0,getUserInfo:!0,share:!0,requestPayment:!0,subscribePush:!0,unsubscribePush:!0,onPush:!0,offPush:!0}).forEach((function(e){var t=j[e];t||(t=A(e)),r(e)?J[e]=i(t):J[e]=t}))),J};var o=new WeexPlus(weex);t.weexPlus=o;var r=a(weex,o,BroadcastChannel);t.default=r},function(e,t,n){Vue.prototype.__$appStyle__={},Vue.prototype.__merge_style&&Vue.prototype.__merge_style(n(4).default,Vue.prototype.__$appStyle__)},function(e,t,n){"use strict";n.r(t);var a=n(0),o=n.n(a);for(var r in a)"default"!==r&&function(e){n.d(t,e,(function(){return a[e]}))}(r);t.default=o.a},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n={onLoad:function(){this.initMessage()},methods:{initMessage:function(){var t=this,n=e.webview.currentWebview().extras||{},a=n.from,o=(n.callback,n.runtime),r=n.data,i=void 0===r?{}:r,s=n.useGlobalEvent;this.__from=a,this.__runtime=o,this.__page=e.webview.currentWebview().id,this.__useGlobalEvent=s,this.data=JSON.parse(JSON.stringify(i)),e.key.addEventListener("backbutton",(function(){"function"==typeof t.onClose?t.onClose():e.webview.currentWebview().close("auto")}));var c=this,u=function(e){var t=e.data&&e.data.__message;t&&c.__onMessageCallback&&c.__onMessageCallback(t.data)};this.__useGlobalEvent?weex.requireModule("globalEvent").addEventListener("plusMessage",u):new BroadcastChannel(this.__page).onmessage=u},postMessage:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=JSON.parse(JSON.stringify({__message:{__page:this.__page,data:t,keep:n}})),o=this.__from;if("v8"===this.__runtime)if(this.__useGlobalEvent)e.webview.postMessageToUniNView(a,o);else{var r=new BroadcastChannel(o);r.postMessage(a)}else{var i=e.webview.getWebviewById(o);i&&i.evalJS("__plusMessage&&__plusMessage(".concat(JSON.stringify({data:a}),")"))}},onMessage:function(e){this.__onMessageCallback=e}}};t.default=n}).call(this,n(2).weexPlus)},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n={data:function(){return{locale:"en",fallbackLocale:"en",localization:{en:{done:"OK",cancel:"Cancel"},zh:{done:"完成",cancel:"取消"},"zh-hans":{},"zh-hant":{},messages:{}},localizationTemplate:{}}},onLoad:function(){this.initLocale()},created:function(){this.initLocale()},methods:{initLocale:function(){if(!this.__initLocale){this.__initLocale=!0;var t=(e.webview.currentWebview().extras||{}).data||{};if(t.messages&&(this.localization.messages=t.messages),t.locale)this.locale=t.locale.toLowerCase();else{var n=e.os.language.toLowerCase().split("/")[0].replace("_","-").split("-"),a=n[1];a&&(n[1]={chs:"hans",cn:"hans",sg:"hans",cht:"hant",tw:"hant",hk:"hant",mo:"hant"}[a]||a),n.length=n.length>2?2:n.length,this.locale=n.join("-")}}},localize:function(e){var t=this,n=this.locale,a=n.split("-")[0],o=this.fallbackLocale,r=function(e){return Object.assign({},t.localization[e],(t.localizationTemplate||{})[e])};return r("messages")[e]||r(n)[e]||r(a)[e]||r(o)[e]||e}}};t.default=n}).call(this,n(2).weexPlus)},,,function(e,t,n){"use strict";var a=n(33),o=n(18),r=n(1);var i=Object(r.a)(o.default,a.b,a.c,!1,null,null,"24f4db1e",!1,a.a,void 0);(function(e){this.options.style||(this.options.style={}),Vue.prototype.__merge_style&&Vue.prototype.__$appStyle__&&Vue.prototype.__merge_style(Vue.prototype.__$appStyle__,this.options.style),Vue.prototype.__merge_style?Vue.prototype.__merge_style(n(38).default,this.options.style):Object.assign(this.options.style,n(38).default)}).call(i),t.default=i.exports},,,,,,,,,function(e,t,n){"use strict";var a=n(19),o=n.n(a);t.default=o.a},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,o=i(n(5)),r=i(n(6));function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=e.barcode,u={qrCode:[c.QR,c.AZTEC,c.MAXICODE],barCode:[c.EAN13,c.EAN8,c.UPCA,c.UPCE,c.CODABAR,c.CODE128,c.CODE39,c.CODE93,c.ITF,c.RSS14,c.RSSEXPANDED],datamatrix:[c.DATAMATRIX],pdf417:[c.PDF417]},l=(s(a={},c.QR,"QR_CODE"),s(a,c.EAN13,"EAN_13"),s(a,c.EAN8,"EAN_8"),s(a,c.DATAMATRIX,"DATA_MATRIX"),s(a,c.UPCA,"UPC_A"),s(a,c.UPCE,"UPC_E"),s(a,c.CODABAR,"CODABAR"),s(a,c.CODE39,"CODE_39"),s(a,c.CODE93,"CODE_93"),s(a,c.CODE128,"CODE_128"),s(a,c.ITF,"CODE_25"),s(a,c.PDF417,"PDF_417"),s(a,c.AZTEC,"AZTEC"),s(a,c.RSS14,"RSS_14"),s(a,c.RSSEXPANDED,"RSSEXPANDED"),a),f={mixins:[o.default,r.default],data:{filters:[0,2,1],backgroud:"#000000",frameColor:"#118ce9",scanbarColor:"#118ce9",enabledFlash:!1,flashImage0:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABjklEQVRoQ+1ZbVHEQAx9TwE4ABTcOQAknANQAKcAUAAOAAXgAHAACsDCKQiTmbYDzJZtNt2bFrJ/m6+Xl2yyU2LmhzOPH/8PgIjcADirxNyapNoffMwMiMgzgMPBHmyCLySPLCoBwJKtAbJbYaBmD1yRvBwAtBMxl5DF+DZkiwCIyBLAzsgBbki+Wm2WAlCaL6zOMvKnJO+sNksB7ALQbO1ZHfbIv5FUVs2nCIB6EZETALdmj2mFY5I6X8ynGEADQllYmL1+VzBfnV/VvQB0aj45ARyQ/Ci14QLQsOBZLe5JaikWnzEA7AN4L4hgA2Dpyb76dANwsOCq/TZhASAYKGie0a7R1lDPI0ebtF0NUi+4yfdAtxr3PEMnD6BbD0QkNfACQO05EAwMuaBqDrIVycdmTpwDuP4R0OR7QFftVRP0g+49cwOQq4DJMxAAchmofY3m/EcJBQOZbTRKKJeBKKEoIePvpFRJ1VzmciUccyCa+C81cerBkuuB7sGTE/zt+yhN7AnAqxsAvBn06n8CkyPwMZKwm+UAAAAASUVORK5CYII=",flashImage1:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUAAAA3kvI3lfY2k/VAl+43k/U3k/Q4k/M3kvI3k/M4k/Q4lPU2lPU2k/Vdq843k/WWSpNKAAAAD3RSTlMAwD+QINCAcPBgUDDgoBAE044kAAAAdklEQVQ4y2OgOrD/DwffUSTkERIfyZXAtOMbca7iVoKDDSgSbAijJqBI8J2HiX9FM2s+TOITmgQrTEIATYIJJuEA5mJ68S+Gg/0hEi0YEoxQK2gs0WyPQyKBGYeEAhPtJRaw45AIccXpwVEJekuwQyQWMFAfAACeDBJY9aXa3QAAAABJRU5ErkJggg==",autoDecodeCharSet:!1,autoZoom:!0,localizationTemplate:{en:{fail:"Recognition failure","flash.on":"Tap to turn light on","flash.off":"Tap to turn light off"},zh:{fail:"识别失败","flash.on":"轻触照亮","flash.off":"轻触关闭"}}},onLoad:function(){var e=this,t=this.data,n=t.scanType;this.autoDecodeCharSet=t.autoDecodeCharSet,this.autoZoom=t.autoZoom;var a=[];Array.isArray(n)&&n.length&&n.forEach((function(e){var t=u[e];t&&(a=a.concat(t))})),a.length||(a=a.concat(u.qrCode).concat(u.barCode).concat(u.datamatrix).concat(u.pdf417)),this.filters=a,this.onMessage((function(t){e.gallery()}))},onUnload:function(){this.cancel()},onReady:function(){var e=this;setTimeout((function(){e.cancel(),e.start()}),50)},methods:{start:function(){this.$refs.barcode.start({sound:this.data.sound})},scan:function(t){var n=this;c.scan(t,(function(e,t,a,o){n.scanSuccess(e,t,a,o)}),(function(){e.nativeUI.toast(n.localize("fail"))}),this.filters,this.autoDecodeCharSet)},cancel:function(){this.$refs.barcode.cancel()},gallery:function(){var t=this;e.gallery.pick((function(e){t.scan(e)}),(function(n){n.code!==("android"===weex.config.env.platform.toLowerCase()?12:-2)&&e.nativeUI.toast(t.localize("fail"))}),{multiple:!1,system:!1,filename:"_doc/uniapp_temp/gallery/",permissionAlert:!0})},onmarked:function(e){var t=e.detail;this.scanSuccess(t.code,t.message,t.file,t.charSet)},scanSuccess:function(e,t,n,a){this.postMessage({event:"marked",detail:{scanType:l[e],result:t,charSet:a||"utf8",path:n||""}})},onerror:function(e){this.postMessage({event:"fail",message:JSON.stringify(e)})},setFlash:function(){this.enabledFlash=!this.enabledFlash,this.$refs.barcode.setFlash(this.enabledFlash)}}};t.default=f}).call(this,n(2).weexPlus)},function(e,t){e.exports={content:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"#000000"},barcode:{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:1},"set-flash":{alignItems:"center",justifyContent:"center",transform:"translateY(80px)",zIndex:2},"image-flash":{width:"26",height:"26",marginBottom:"2"},"image-flash-text":{fontSize:"10",color:"#FFFFFF"}}},,,,,,,,,,,,,function(e,t,n){"use strict";var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("scroll-view",{staticStyle:{flexDirection:"column"},attrs:{scrollY:!0,enableBackToTop:!0,bubble:"true"}},[n("view",{staticClass:["content"]},[n("barcode",{ref:"barcode",staticClass:["barcode"],attrs:{autostart:"false",backgroud:e.backgroud,frameColor:e.frameColor,scanbarColor:e.scanbarColor,filters:e.filters,autoDecodeCharset:e.autoDecodeCharSet,autoZoom:e.autoZoom},on:{marked:e.onmarked,error:e.onerror}}),n("view",{staticClass:["set-flash"],on:{click:e.setFlash}},[n("u-image",{staticClass:["image-flash"],attrs:{src:e.enabledFlash?e.flashImage1:e.flashImage0,resize:"stretch"}}),n("u-text",{staticClass:["image-flash-text"]},[e._v(e._s(e.enabledFlash?e.localize("flash.off"):e.localize("flash.on")))])],1)],1)])},o=[];n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){}))},,,,,function(e,t,n){"use strict";n.r(t);var a=n(20),o=n.n(a);for(var r in a)"default"!==r&&function(e){n.d(t,e,(function(){return a[e]}))}(r);t.default=o.a},,,,,function(e,t,n){"use strict";n.r(t);n(3);var a=n(9);a.default.mpType="page",a.default.route="template/__uniappscan",a.default.el="#root",new Vue(a.default)}]);
\ No newline at end of file
......@@ -14,6 +14,8 @@ const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
// 获取 manifest.json 中统计配置
const uniStatisticsConfig = process.env.UNI_STATISTICS_CONFIG;
let statConfig = {
appid: process.env.UNI_APP_ID,
};
......@@ -471,7 +473,8 @@ const is_debug = debug;
* 日志输出
* @param {*} data
*/
const log = (data) => {
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -494,11 +497,41 @@ const log = (data) => {
msg_type = 'PUSH';
break
}
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
if (type) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
return
}
if (msg_type) {
console.log(`=== 统计数据采集:${msg_type} ===`);
console.log(data);
console.log(`=== 采集结束 ===`);
}
};
/**
* 获取上报时间间隔
* @param {*} defaultTime 默认上报间隔时间 单位s
*/
const get_report_Interval = (defaultTime) => {
let time = uniStatisticsConfig.reportInterval;
// 如果上报时间配置为0 相当于立即上报
if (Number(time) === 0) return 0
time = time || defaultTime;
let reg = /(^[1-9]\d*$)/;
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -672,6 +705,7 @@ const get_residence_time = (type) => {
}
};
const eport_Interval = get_report_Interval(OPERATING_TIME);
// 统计数据默认值
let statData = {
uuid: get_uuid(), // 设备标识
......@@ -1131,7 +1165,7 @@ class Report {
log(data);
}
// 判断时候到达上报时间 ,默认 10 秒上报
if (page_residence_time < OPERATING_TIME && !type) return
if (page_residence_time < eport_Interval && !type) return
// 时间超过,重新获取时间戳
set_page_residence_time();
......@@ -1167,7 +1201,9 @@ class Report {
sendRequest(optionsData) {
{
if (!uni.__stat_uniCloud_space) {
console.error('应用未关联服务空间,统计上报失败,请在uniCloud目录右键关联服务空间.');
console.error(
'应用未关联服务空间,统计上报失败,请在uniCloud目录右键关联服务空间.'
);
return
}
......@@ -1181,9 +1217,7 @@ class Report {
.report(optionsData)
.then(() => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
log(optionsData, true);
}
})
.catch((err) => {
......@@ -1204,9 +1238,7 @@ class Report {
let options = get_sgin(get_encodeURIComponent_options(data)).options;
image.src = STAT_H5_URL + '?' + options;
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
log(data, true);
}
});
}
......@@ -1254,6 +1286,10 @@ class Stat extends Report {
// '=== 当前绑定的统计服务空间spaceId:' +
// uni.__stat_uniCloud_space.config.spaceId
// )
} else {
console.error(
'应用未关联服务空间,请在uniCloud目录右键关联服务空间'
);
}
}
}
......
......@@ -12,6 +12,8 @@ const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
// 获取 manifest.json 中统计配置
const uniStatisticsConfig = process.env.UNI_STATISTICS_CONFIG;
let statConfig = {
appid: process.env.UNI_APP_ID,
};
......@@ -469,7 +471,8 @@ const is_debug = debug;
* 日志输出
* @param {*} data
*/
const log = (data) => {
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -492,11 +495,41 @@ const log = (data) => {
msg_type = 'PUSH';
break
}
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
if (type) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
return
}
if (msg_type) {
console.log(`=== 统计数据采集:${msg_type} ===`);
console.log(data);
console.log(`=== 采集结束 ===`);
}
};
/**
* 获取上报时间间隔
* @param {*} defaultTime 默认上报间隔时间 单位s
*/
const get_report_Interval = (defaultTime) => {
let time = uniStatisticsConfig.reportInterval;
// 如果上报时间配置为0 相当于立即上报
if (Number(time) === 0) return 0
time = time || defaultTime;
let reg = /(^[1-9]\d*$)/;
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -670,6 +703,7 @@ const get_residence_time = (type) => {
}
};
const eport_Interval = get_report_Interval(OPERATING_TIME);
// 统计数据默认值
let statData = {
uuid: get_uuid(), // 设备标识
......@@ -1129,7 +1163,7 @@ class Report {
log(data);
}
// 判断时候到达上报时间 ,默认 10 秒上报
if (page_residence_time < OPERATING_TIME && !type) return
if (page_residence_time < eport_Interval && !type) return
// 时间超过,重新获取时间戳
set_page_residence_time();
......@@ -1165,7 +1199,9 @@ class Report {
sendRequest(optionsData) {
{
if (!uni.__stat_uniCloud_space) {
console.error('应用未关联服务空间,统计上报失败,请在uniCloud目录右键关联服务空间.');
console.error(
'应用未关联服务空间,统计上报失败,请在uniCloud目录右键关联服务空间.'
);
return
}
......@@ -1179,9 +1215,7 @@ class Report {
.report(optionsData)
.then(() => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
log(optionsData, true);
}
})
.catch((err) => {
......@@ -1202,9 +1236,7 @@ class Report {
let options = get_sgin(get_encodeURIComponent_options(data)).options;
image.src = STAT_H5_URL + '?' + options;
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
log(data, true);
}
});
}
......@@ -1252,6 +1284,10 @@ class Stat extends Report {
// '=== 当前绑定的统计服务空间spaceId:' +
// uni.__stat_uniCloud_space.config.spaceId
// )
} else {
console.error(
'应用未关联服务空间,请在uniCloud目录右键关联服务空间'
);
}
}
}
......
......@@ -14,6 +14,8 @@ const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
// 获取 manifest.json 中统计配置
const uniStatisticsConfig = process.env.UNI_STATISTICS_CONFIG;
let statConfig = {
appid: process.env.UNI_APP_ID,
};
......@@ -450,7 +452,8 @@ const is_debug = debug;
* 日志输出
* @param {*} data
*/
const log = (data) => {
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -473,11 +476,41 @@ const log = (data) => {
msg_type = 'PUSH';
break
}
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
if (type) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
return
}
if (msg_type) {
console.log(`=== 统计数据采集:${msg_type} ===`);
console.log(data);
console.log(`=== 采集结束 ===`);
}
};
/**
* 获取上报时间间隔
* @param {*} defaultTime 默认上报间隔时间 单位s
*/
const get_report_Interval = (defaultTime) => {
let time = uniStatisticsConfig.reportInterval;
// 如果上报时间配置为0 相当于立即上报
if (Number(time) === 0) return 0
time = time || defaultTime;
let reg = /(^[1-9]\d*$)/;
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -651,6 +684,7 @@ const get_residence_time = (type) => {
}
};
const eport_Interval = get_report_Interval(OPERATING_TIME);
// 统计数据默认值
let statData = {
uuid: get_uuid(), // 设备标识
......@@ -1117,7 +1151,7 @@ class Report {
log(data);
}
// 判断时候到达上报时间 ,默认 10 秒上报
if (page_residence_time < OPERATING_TIME && !type) return
if (page_residence_time < eport_Interval && !type) return
// 时间超过,重新获取时间戳
set_page_residence_time();
......@@ -1167,9 +1201,7 @@ class Report {
data: optionsData,
success: () => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
log(optionsData, true);
}
},
fail: (e) => {
......@@ -1197,9 +1229,7 @@ class Report {
let options = get_sgin(get_encodeURIComponent_options(data)).options;
image.src = STAT_H5_URL + '?' + options;
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
log(data, true);
}
});
}
......
......@@ -12,6 +12,8 @@ const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
// 获取 manifest.json 中统计配置
const uniStatisticsConfig = process.env.UNI_STATISTICS_CONFIG;
let statConfig = {
appid: process.env.UNI_APP_ID,
};
......@@ -448,7 +450,8 @@ const is_debug = debug;
* 日志输出
* @param {*} data
*/
const log = (data) => {
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -471,11 +474,41 @@ const log = (data) => {
msg_type = 'PUSH';
break
}
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
if (type) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
return
}
if (msg_type) {
console.log(`=== 统计数据采集:${msg_type} ===`);
console.log(data);
console.log(`=== 采集结束 ===`);
}
};
/**
* 获取上报时间间隔
* @param {*} defaultTime 默认上报间隔时间 单位s
*/
const get_report_Interval = (defaultTime) => {
let time = uniStatisticsConfig.reportInterval;
// 如果上报时间配置为0 相当于立即上报
if (Number(time) === 0) return 0
time = time || defaultTime;
let reg = /(^[1-9]\d*$)/;
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -649,6 +682,7 @@ const get_residence_time = (type) => {
}
};
const eport_Interval = get_report_Interval(OPERATING_TIME);
// 统计数据默认值
let statData = {
uuid: get_uuid(), // 设备标识
......@@ -1115,7 +1149,7 @@ class Report {
log(data);
}
// 判断时候到达上报时间 ,默认 10 秒上报
if (page_residence_time < OPERATING_TIME && !type) return
if (page_residence_time < eport_Interval && !type) return
// 时间超过,重新获取时间戳
set_page_residence_time();
......@@ -1165,9 +1199,7 @@ class Report {
data: optionsData,
success: () => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
log(optionsData, true);
}
},
fail: (e) => {
......@@ -1195,9 +1227,7 @@ class Report {
let options = get_sgin(get_encodeURIComponent_options(data)).options;
image.src = STAT_H5_URL + '?' + options;
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(data);
console.log(`=== 上报结束 ===`);
log(data, true);
}
});
}
......
......@@ -88,7 +88,9 @@ const plugins = [
RUN_BY_HBUILDERX: process.env.RUN_BY_HBUILDERX,
UNI_AUTOMATOR_WS_ENDPOINT: JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT),
UNI_STAT_UNI_CLOUD: process.env.UNI_STAT_UNI_CLOUD || '""',
UNI_STAT_DEBUG: process.env.UNI_STAT_DEBUG || '""'
UNI_STATISTICS_CONFIG: process.env.UNI_STATISTICS_CONFIG || '""',
UNI_STAT_DEBUG: process.env.UNI_STAT_DEBUG || '""',
UNI_COMPILER_VERSION: JSON.stringify(process.env.UNI_COMPILER_VERSION)
}
}),
new webpack.BannerPlugin({
......
......@@ -104,8 +104,9 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
'process.env.UNICLOUD_DEBUG': process.env.UNICLOUD_DEBUG,
'process.env.RUN_BY_HBUILDERX': process.env.RUN_BY_HBUILDERX,
'process.env.UNI_AUTOMATOR_WS_ENDPOINT': JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT),
'process.env.UNI_STAT_UNI_CLOUD': process.env.UNI_STAT_UNI_CLOUD || '""',
'process.env.UNI_STAT_DEBUG': process.env.UNI_STAT_DEBUG || '""',
'process.env.UNI_STATISTICS_CONFIG': process.env.UNI_STATISTICS_CONFIG,
'process.env.UNI_STAT_UNI_CLOUD': process.env.UNI_STAT_UNI_CLOUD,
'process.env.UNI_STAT_DEBUG': process.env.UNI_STAT_DEBUG,
'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION),
'process.env.UNI_APP_VERSION_NAME': JSON.stringify(process.env.UNI_APP_VERSION_NAME),
'process.env.UNI_APP_VERSION_CODE': JSON.stringify(process.env.UNI_APP_VERSION_CODE)
......
......@@ -324,8 +324,9 @@ if ((process.env.UNI_PLATFORM === 'mp-kuaishou' || process.env.UNI_PLATFORM ===
process.env.MERGE_VIRTUAL_HOST_ATTRIBUTES = (!!platformOptions.mergeVirtualHostAttributes).toString()
process.env.UNI_STAT_UNI_CLOUD = ''
process.env.UNI_STAT_DEBUG = ''
process.env.UNI_STATISTICS_CONFIG = '""'
process.env.UNI_STAT_UNI_CLOUD = '""'
process.env.UNI_STAT_DEBUG = '""'
if (
process.env.UNI_USING_COMPONENTS ||
process.env.UNI_PLATFORM === 'h5'
......@@ -336,9 +337,10 @@ if (
)
if (uniStatistics.enable === true) {
process.env.UNI_USING_STAT = uniStatistics.version === '2' ? '2' : '1'
process.env.UNI_USING_STAT = Number(uniStatistics.version) === 2 ? '2' : '1'
// 获取服务空间配置信息
const uniCloudConfig = uniStatistics.uniCloud || {}
process.env.UNI_STATISTICS_CONFIG = JSON.stringify(uniStatistics)
process.env.UNI_STAT_UNI_CLOUD = JSON.stringify(uniCloudConfig)
process.env.UNI_STAT_DEBUG = uniStatistics.debug === true ? 'true' : 'false'
......
......@@ -431,6 +431,11 @@ module.exports = function (pagesJson, manifestJson, loader) {
const qqMapKey = sdkConfigs.maps && sdkConfigs.maps.qqmap && sdkConfigs.maps.qqmap.key
const googleMapKey = sdkConfigs.maps && sdkConfigs.maps.google && sdkConfigs.maps.google.key
const aMapKey = sdkConfigs.maps && sdkConfigs.maps.amap && sdkConfigs.maps.amap.key
const aMapSecurityJsCode =
sdkConfigs.maps && sdkConfigs.maps.amap && sdkConfigs.maps.amap.securityJsCode
const aMapServiceHost =
sdkConfigs.maps && sdkConfigs.maps.amap && sdkConfigs.maps.amap.serviceHost
let locale = manifestJson.locale
locale = locale && locale.toUpperCase() !== 'AUTO' ? locale : ''
......@@ -456,6 +461,9 @@ global.__uniConfig.networkTimeout = ${JSON.stringify(networkTimeoutConfig)};
global.__uniConfig.sdkConfigs = ${JSON.stringify(sdkConfigs)};
global.__uniConfig.qqMapKey = ${JSON.stringify(qqMapKey)};
global.__uniConfig.googleMapKey = ${JSON.stringify(googleMapKey)};
global.__uniConfig.aMapKey = ${JSON.stringify(aMapKey)};
global.__uniConfig.aMapSecurityJsCode = ${JSON.stringify(aMapSecurityJsCode)};
global.__uniConfig.aMapServiceHost = ${JSON.stringify(aMapServiceHost)};
global.__uniConfig.locale = ${JSON.stringify(locale)};
global.__uniConfig.fallbackLocale = ${JSON.stringify(manifestJson.fallbackLocale)};
global.__uniConfig.locales = locales.keys().reduce((res,key)=>{const locale=key.replace(/\\.\\/(uni-app.)?(.*).json/,'$2');const messages = locales(key);Object.assign(res[locale]||(res[locale]={}),messages.common||messages);return res},{});
......
......@@ -11,5 +11,9 @@ export const scanCode = {
sound: {
type: String,
default: 'none'
},
autoZoom: {
type: Boolean,
default: true
}
}
......@@ -6,6 +6,8 @@ import {
showPage
} from '../../../helpers/page.js'
import { getLocale } from 'uni-core/helpers/i18n'
function getStatusBarStyle () {
let style = plus.navigator.getStatusBarStyle()
if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') {
......@@ -23,7 +25,9 @@ export function chooseLocation (options, callbackId) {
let result
const page = showPage({
url: '__uniappchooselocation',
data: options,
data: Object.assign({}, options, {
locale: getLocale()
}),
style: {
animationType: options.animationType || 'slide-in-bottom',
titleNView: false,
......
......@@ -6,10 +6,14 @@ import {
showPage
} from '../../../helpers/page.js'
import { getLocale } from 'uni-core/helpers/i18n'
export function openLocation (data, callbackId) {
showPage({
url: '__uniappopenlocation',
data,
data: Object.assign({}, data, {
locale: getLocale()
}),
style: {
titleNView: {
type: 'transparent'
......
......@@ -12,15 +12,21 @@ import { NAVBAR_HEIGHT } from 'uni-helpers/constants'
let webview = false
const insertHTMLWebView = ({
webviewStyles,
htmlId,
updateTitle
}) => {
const parentWebview = plus.webview.currentWebview()
// fixed by hxy web-view 组件所在的 webview 不注入 uni-app 框架
const styles = {
'uni-app': 'none',
isUniH5: true
}
const styles = Object.assign(
{
'uni-app': 'none',
isUniH5: true,
// ios 默认绘制到安全区外
contentAdjust: false
},
webviewStyles
)
const parentTitleNView = parentWebview.getTitleNView()
if (parentTitleNView) {
if (plus.navigator.isImmersedStatusbar()) {
......@@ -100,6 +106,7 @@ export default {
mounted () {
this.htmlId = WEBVIEW_ID_PREFIX + this.$page.id
insertHTMLWebView({
webviewStyles: this.webviewStyles,
htmlId: this.htmlId,
updateTitle: this.updateTitle
})
......
......@@ -198,7 +198,7 @@ export default {
this.list.push({
name: item.title,
address: item.address,
distance: item._distance,
distance: item._distance || item.distance,
latitude: item.location.lat,
longitude: item.location.lng
})
......@@ -265,6 +265,39 @@ export default {
}, () => {
this.loading = false
})
} else if (mapInfo.type === MapType.AMAP) {
const self = this
window.AMap.plugin('AMap.PlaceSearch', function () {
var autoOptions = {
city: '全国',
pageSize: 10,
pageIndex: self.pageIndex
}
var placeSearch = new window.AMap.PlaceSearch(autoOptions)
if (self.searching) {
placeSearch.searchNearBy(self.keyword, [self.longitude, self.latitude], 50000, function (status, result) {
if (status === 'error') {
console.error(result)
} else if (status === 'no_data') {
self.hasNextPage = false
} else {
self.pushData(result.poiList.pois)
}
})
} else {
placeSearch.searchNearBy('', [self.longitude, self.latitude], 5000, function (status, result) {
if (status === 'error') {
console.error(result)
} else if (status === 'no_data') {
self.hasNextPage = false
} else {
self.pushData(result.poiList.pois)
}
})
}
self.loading = false
})
}
},
loadMore () {
......
......@@ -7,29 +7,29 @@
:markers="[marker, location]"
@regionchange="onRegionChange"
>
<div
class="map-move"
@click="moveToLocation"
<div
class="map-move"
@click="moveToLocation"
>
<i>&#xec32;</i>
</div>
</v-uni-map>
<div class="info">
<div
class="name"
@click="setCenter(marker)"
<div
class="name"
@click="setCenter(marker)"
>
{{ name }}
</div>
<div
class="address"
@click="setCenter(marker)"
<div
class="address"
@click="setCenter(marker)"
>
{{ address }}
</div>
<div
class="nav"
@click="nav"
<div
class="nav"
@click="nav"
>
<svg
width="26"
......@@ -45,9 +45,9 @@
</svg>
</div>
</div>
<div
class="nav-btn-back"
@click="back"
<div
class="nav-btn-back"
@click="back"
>
<i class="uni-btn-icon">&#xe601;</i>
</div>
......@@ -147,6 +147,11 @@ export default {
}%2C${this.longitude}&from=${encodeURIComponent(
'我的位置'
)}&to=${encodeURIComponent(this.name || '目的地')}&ref=${mapInfo.key}`
} else if (mapInfo.type === MapType.AMAP) {
url = `https://m.amap.com/navi/?dest=${this.longitude},${this.latitude}&key=${mapInfo.key}`
if (this.name) {
url += `&destName=${this.name}`
}
}
window.open(url)
}
......
......@@ -6,21 +6,35 @@ export const ICON_PATH_TARGET =
export const MapType = {
QQ: 'qq',
GOOGLE: 'google',
AMAP: 'AMap',
UNKNOWN: ''
}
export function getMapInfo () {
let type = MapType.UNKNOWN
let key = ''
if (__uniConfig.qqMapKey) {
type = MapType.QQ
key = __uniConfig.qqMapKey
} else if (__uniConfig.googleMapKey) {
type = MapType.GOOGLE
key = __uniConfig.googleMapKey
return {
type: MapType.QQ,
key: __uniConfig.qqMapKey
}
}
if (__uniConfig.googleMapKey) {
return {
type: MapType.GOOGLE,
key: __uniConfig.googleMapKey
}
}
if (__uniConfig.aMapKey) {
return {
type: MapType.AMAP,
key: __uniConfig.aMapKey,
securityJsCode: __uniConfig.aMapSecurityJsCode,
serviceHost: __uniConfig.aMapServiceHost
}
}
return {
type,
key
type: MapType.UNKNOWN,
key: ''
}
}
export const IS_AMAP = getMapInfo().type === MapType.AMAP
......@@ -67,6 +67,21 @@ export function getLocation ({
reject(new Error('network error'))
}
})
} else if (mapInfo.type === MapType.AMAP) {
window.AMap.plugin('AMap.Geolocation', function () {
var geolocation = new window.AMap.Geolocation({})
geolocation.getCurrentPosition(function (status, res) {
if (status === 'complete') {
resolve({
latitude: res.position.lat,
longitude: res.position.lng,
accuracy: res.accuracy
})
} else {
reject(new Error((res.message) || JSON.stringify(res)))
}
})
})
} else {
reject(new Error('network error'))
}
......
<template>
<uni-map
:id="id"
ref="mapContainer"
v-on="$listeners"
@touchend="handleAMapClick"
>
<map-marker
v-for="item in markers"
......@@ -46,7 +48,17 @@ import {
import mapMarker from './map-marker'
import mapPolygon from './map-polygon'
import { ICON_PATH_ORIGIN } from '../../../helpers/location'
import { ICON_PATH_ORIGIN, IS_AMAP } from '../../../helpers/location'
function getAMapPosition (maps, latitude, longitude) {
return new maps.LngLat(longitude, latitude)
}
function getGoogleQQMapPosition (maps, latitude, longitude) {
return new maps.LatLng(latitude, longitude)
}
function getMapPosition (maps, latitude, longitude) {
return IS_AMAP ? getAMapPosition(maps, latitude, longitude) : getGoogleQQMapPosition(maps, latitude, longitude)
}
function getLat (latLng) {
if ('getLat' in latLng) {
......@@ -201,6 +213,9 @@ export default {
},
mounted () {
loadMaps(this.libraries, result => {
// 兼容高德地图
result.event = result.event || result.Event
result.Point = result.Point || result.BuryPoint
this._maps = result
this.init()
})
......@@ -212,6 +227,13 @@ export default {
this.removeLocation()
},
methods: {
handleAMapClick (e) {
if (IS_AMAP) {
const { pageX, pageY } = e.changedTouches[0]
this.$trigger('click', { x: pageX, y: pageY }, {})
this.$trigger('tap', { x: pageX, y: pageY }, {})
}
},
_handleSubscribe ({
type,
data = {}
......@@ -247,10 +269,14 @@ export default {
case 'moveToLocation':
{
const { latitude, longitude } = data
var locationPosition = (latitude && longitude) ? new maps.LatLng(latitude, longitude) : this._locationPosition
const locationPosition = (latitude && longitude) ? getMapPosition(maps, latitude, longitude) : this._locationPosition
if (locationPosition) {
this._map.setCenter(locationPosition)
callback({})
callback({
latitude,
longitude
})
}
}
break
......@@ -267,7 +293,7 @@ export default {
rotation = marker.getRotation()
}
var a = marker.getPosition()
var b = new maps.LatLng(destination.latitude, destination.longitude)
const b = getMapPosition(maps, destination.latitude, destination.longitude)
var distance = maps.geometry.spherical.computeDistanceBetween(a, b) / 1000
var time = ((typeof duration === 'number') ? duration : 1000) / (1000 * 60 * 60)
var speed = distance / time
......@@ -325,20 +351,26 @@ export default {
this.fitBounds(data.points)
break
case 'getRegion':
this.boundsReady(() => {
var latLngBounds = this._map.getBounds()
var southwest = latLngBounds.getSouthWest()
var northeast = latLngBounds.getNorthEast()
callback({
southwest: {
latitude: getLat(southwest),
longitude: getLng(southwest)
},
northeast: {
latitude: getLat(northeast),
longitude: getLng(northeast)
}
this.mapReady(() => {
this.boundsReady(() => {
const latLngBounds = this._map.getBounds()
const southwest = latLngBounds.getSouthWest()
const northeast = latLngBounds.getNorthEast()
callback({
southwest: {
latitude: getLat(southwest),
longitude: getLng(southwest)
},
northeast: {
latitude: getLat(northeast),
longitude: getLng(northeast)
}
})
})
if (IS_AMAP) {
this.isBoundsReady = true
this.$emit('boundsready')
}
})
break
case 'getScale':
......@@ -352,7 +384,7 @@ export default {
},
init () {
const maps = this._maps
var center = new maps.LatLng(this.center.latitude, this.center.longitude)
const center = getMapPosition(maps, this.center.latitude, this.center.longitude)
var map = this._map = new maps.Map(this.$refs.map, {
center,
zoom: Number(this.scale),
......@@ -442,7 +474,8 @@ export default {
this.center.longitude = longitude
if (this._map) {
this.mapReady(() => {
this._map.setCenter(new maps.LatLng(latitude, longitude))
const centerPosition = getMapPosition(maps, latitude, longitude)
this._map.setCenter(centerPosition)
})
}
}
......@@ -453,10 +486,13 @@ export default {
var polyline = this.polylineSync
this.removePolyline()
this.polyline.forEach(option => {
var path = []
const path = []
option.points.forEach(point => {
path.push(new maps.LatLng(point.latitude, point.longitude))
const pointPosition = IS_AMAP ? [point.longitude, point.latitude] : getGoogleQQMapPosition(maps, point.latitude, point.longitude)
path.push(pointPosition)
})
const borderWidth = Number(option.borderWidth) || 0
const { r: sr, g: sg, b: sb, a: sa } = hexToRgba(option.color)
const { r: br, g: bg, b: bb, a: ba } = hexToRgba(option.borderColor)
......@@ -464,14 +500,23 @@ export default {
map,
clickable: false,
path,
strokeWeight: option.width + borderWidth,
strokeWeight: ((Number(option.width) || 0) + borderWidth) || 6,
strokeDashStyle: option.dottedLine ? 'dash' : 'solid'
}
if (IS_AMAP) {
polylineOptions.strokeColor = option.strokeColor
polylineOptions.strokeStyle = option.dottedLine ? 'dashed' : 'solid'
polylineOptions.isOutline = !!option.borderWidth
polylineOptions.borderWeight = option.borderWidth
polylineOptions.outlineColor = option.borderColor
}
const polylineBorderOptions = {
map,
clickable: false,
path,
strokeWeight: option.width,
strokeWeight: option.width || 6,
strokeDashStyle: option.dottedLine ? 'dash' : 'solid'
}
if ('Color' in maps) {
......@@ -486,7 +531,11 @@ export default {
if (borderWidth) {
polyline.push(new maps.Polyline(polylineBorderOptions))
}
polyline.push(new maps.Polyline(polylineOptions))
const _polyline = new maps.Polyline(polylineOptions)
if (IS_AMAP) {
map.add(_polyline)
}
polyline.push(_polyline)
})
},
removePolyline () {
......@@ -498,12 +547,11 @@ export default {
},
createCircles () {
const maps = this._maps
var map = this._map
var circles = this.circlesSync
const map = this._map
const circles = this.circlesSync
this.removeCircles()
this.circles.forEach(option => {
var center = new maps.LatLng(option.latitude, option.longitude)
const center = IS_AMAP ? [option.longitude, option.latitude] : getGoogleQQMapPosition(maps, option.latitude, option.longitude)
const circleOptions = {
map,
center,
......@@ -512,18 +560,30 @@ export default {
strokeWeight: Number(option.strokeWidth) || 1,
strokeDashStyle: 'solid'
}
const { r: fr, g: fg, b: fb, a: fa } = hexToRgba(option.fillColor || '#00000000')
const { r: sr, g: sg, b: sb, a: sa } = hexToRgba(option.color || '#000000')
if ('Color' in maps) {
circleOptions.fillColor = new maps.Color(fr, fg, fb, fa)
circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa)
if (IS_AMAP) {
circleOptions.strokeColor = option.color
circleOptions.fillColor = option.fillColor || '#000'
} else {
circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`
circleOptions.fillOpacity = fa
circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`
circleOptions.strokeOpacity = sa
const { r: fr, g: fg, b: fb, a: fa } = hexToRgba(option.fillColor || '#00000000')
const { r: sr, g: sg, b: sb, a: sa } = hexToRgba(option.color || '#000000')
if ('Color' in maps) {
// 腾讯
circleOptions.fillColor = new maps.Color(fr, fg, fb, fa)
circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa)
} else {
// Google
circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`
circleOptions.fillOpacity = fa
circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`
circleOptions.strokeOpacity = sa
}
}
const circle = new maps.Circle(circleOptions)
if (IS_AMAP) {
map.add(circle)
}
var circle = new maps.Circle(circleOptions)
circles.push(circle)
})
},
......@@ -549,6 +609,8 @@ export default {
style.position = 'absolute'
style.width = 0
style.height = 0
style.top = 0
style.left = 0
img.onload = () => {
if (option.position.width) {
img.width = option.position.width
......@@ -569,8 +631,13 @@ export default {
controlId: option.id
})
}
$event.stopPropagation()
}
if (IS_AMAP) {
this.$refs.mapContainer.appendChild(control)
} else {
map.controls[maps.ControlPosition.TOP_LEFT].push(control)
}
map.controls[maps.ControlPosition.TOP_LEFT].push(control)
controls.push(control)
})
},
......@@ -583,8 +650,8 @@ export default {
},
createLocation () {
const maps = this._maps
var map = this._map
var location = this._location
const map = this._map
let location = this._location
if (location) {
this.removeLocation()
}
......@@ -594,14 +661,30 @@ export default {
if (location !== this._location) {
return
}
var position = new maps.LatLng(res.latitude, res.longitude)
location = new maps.Marker({
position,
map,
icon: new maps.MarkerImage(ICON_PATH_ORIGIN, null, null, new maps.Point(22, 22), new maps.Size(44, 44)),
flat: true,
rotation: 0
})
const position = getMapPosition(maps, res.latitude, res.longitude)
if (IS_AMAP) {
location = new maps.Marker({
position,
map,
flat: true,
rotation: 0
})
const icon = new maps.Icon({
size: new maps.Size(44, 44),
image: ICON_PATH_ORIGIN,
imageSize: new maps.Size(44, 44)
})
location.setIcon(icon)
map.add(location)
} else {
location = new maps.Marker({
position,
map,
icon: new maps.MarkerImage(ICON_PATH_ORIGIN, null, null, new maps.Point(22, 22), new maps.Size(44, 44)),
flat: true,
rotation: 0
})
}
this._location = location
refreshLocation()
this.__onCompassChange = function (res) {
......@@ -623,7 +706,7 @@ export default {
uni.getLocation({
type: 'gcj02',
success: (res) => {
var locationPosition = self._locationPosition = new maps.LatLng(res.latitude, res.longitude)
const locationPosition = self._locationPosition = getMapPosition(maps, res.latitude, res.longitude)
location.setPosition(locationPosition)
},
fail: e => {
......@@ -648,20 +731,35 @@ export default {
fitBounds (points, cb) {
const maps = this._maps
this.boundsReady(() => {
var map = this._map
var bounds = new maps.LatLngBounds()
const map = this._map
if (IS_AMAP) {
const _points = []
points.forEach(point => {
_points.push([point.longitude, point.latitude])
})
const bounds = new maps.Bounds(..._points)
map.setBounds(bounds)
} else {
const bounds = new maps.LatLngBounds()
points.forEach(point => {
const longitude = point.longitude
const latitude = point.latitude
const latLng = getGoogleQQMapPosition(maps, latitude, longitude)
bounds.extend(latLng)
})
map.fitBounds(bounds)
}
points.forEach(point => {
var longitude = point.longitude
var latitude = point.latitude
var latLng = new maps.LatLng(latitude, longitude)
bounds.extend(latLng)
})
map.fitBounds(bounds)
if (typeof cb === 'function') {
cb()
}
})
if (IS_AMAP) {
this.isBoundsReady = true
this.$emit('boundsready')
}
},
mapReady (cb) {
if (this.isMapReady) {
......@@ -703,4 +801,16 @@ export default {
uni-map[hidden] {
display: none;
}
/* 处理高德地图 marker label 默认样式 */
.amap-marker-label{
padding:0;
border:none;
background-color: transparent;
}
/* 处理高德地图 open-location icon 被遮挡问题 */
.amap-marker>.amap-icon>img{
left:0!important;
top:0!important;
}
</style>
import { mapInfo, MapType, IS_AMAP } from '../../../helpers/location'
import getRealPath from 'uni-platform/helpers/get-real-path'
export default {
......@@ -97,26 +98,34 @@ export default {
this.updateMarker(props)
maps.event.addListener(marker, 'click', (e) => {
const callout = marker.callout
if (callout) {
const div = callout.div
const parent = div.parentNode
if (!callout.alwaysVisible) {
if (callout && !callout.alwaysVisible) {
if (IS_AMAP) {
callout.visible = !callout.visible
if (callout.visible) {
marker.callout.createAMapText()
} else {
marker.callout.removeAMapText()
}
} else {
callout.set('visible', !callout.visible)
}
if (callout.visible) {
parent.removeChild(div)
parent.appendChild(div)
if (callout.visible) {
const div = callout.div
const parent = div.parentNode
parent.removeChild(div)
parent.appendChild(div)
}
}
}
if (this.idString) {
const { latitude, longitude } = this.getMarkerLatitudeLongitude(e)
this.$parent.$trigger('markertap', {}, {
markerId: Number(this.idString),
latitude: typeof e.latLng.lat === 'function' ? e.latLng.lat() : e.latLng.lat,
longitude: typeof e.latLng.lat === 'function' ? e.latLng.lng() : e.latLng.lng
latitude,
longitude
})
}
const event = e.event || e.domEvent
const event = e.event || e.domEvent || e.originEvent
event.stopPropagation()
})
},
......@@ -125,7 +134,7 @@ export default {
const maps = this._maps
const marker = this._marker
const title = option.title
const position = new maps.LatLng(option.latitude, option.longitude)
const position = IS_AMAP ? new maps.LngLat(option.longitude, option.latitude) : new maps.LatLng(option.latitude, option.longitude)
const img = new Image()
img.onload = () => {
const anchor = option.anchor || {}
......@@ -143,6 +152,7 @@ export default {
}
const top = h - (h - y * h)
if ('MarkerImage' in maps) {
// 腾讯 & google
icon = new maps.MarkerImage(
img.src,
null,
......@@ -150,6 +160,14 @@ export default {
new maps.Point(x * w, y * h),
new maps.Size(w, h)
)
} else if ('Icon' in maps) {
// 高德
icon = new maps.Icon({
image: img.src,
size: new maps.Size(w, h),
imageSize: new maps.Size(w, h),
imageOffset: new maps.Pixel(x * w, y * h)
})
} else {
icon = {
url: img.src,
......@@ -182,8 +200,9 @@ export default {
marginTop: (Number(labelOpt.anchorY || labelOpt.y) || 0) + 'px'
}
if ('Label' in maps) {
// 腾讯
label = new maps.Label({
position: position,
position,
map: map,
clickable: false,
content: labelOpt.content,
......@@ -191,13 +210,35 @@ export default {
})
marker.label = label
} else if ('setLabel' in marker) {
const className = this.updateMarkerLabelStyle(this.idString, labelStyle)
marker.setLabel({
text: labelOpt.content,
color: labelStyle.color,
fontSize: labelStyle.fontSize,
className
})
if (IS_AMAP) {
const content =
`<div style="
margin-left:${labelStyle.marginLeft};
margin-top:${labelStyle.marginTop};
padding:${labelStyle.padding};
background-color:${labelStyle.backgroundColor};
border-radius:${labelStyle.borderRadius};
line-height:${labelStyle.lineHeight};
color:${labelStyle.color};
font-size:${labelStyle.fontSize};
">
${labelOpt.content}
<div>`
marker.setLabel({
content,
direction: 'bottom-right'
})
} else {
// google
const className = this.updateMarkerLabelStyle(this.idString, labelStyle)
marker.setLabel({
text: labelOpt.content,
color: labelStyle.color,
fontSize: labelStyle.fontSize,
className
})
}
}
}
const calloutOpt = option.callout || {}
......@@ -210,6 +251,8 @@ export default {
position,
map,
top,
// handle AMap callout offset
offsetY: -option.height / 2,
content: calloutOpt.content,
color: calloutOpt.color,
fontSize: calloutOpt.fontSize,
......@@ -223,26 +266,38 @@ export default {
position,
map,
top,
offsetY: -option.height / 2,
content: title,
boxShadow: boxShadow
}
if (callout) {
callout.setOption(calloutStyle)
} else {
callout = marker.callout = new maps.Callout(calloutStyle)
callout.div.onclick = ($event) => {
if (this.idString) {
this.$parent.$trigger('callouttap', $event, {
markerId: Number(this.idString)
})
if (IS_AMAP) {
const callback = (self) => {
if (self.idString) {
self.$parent.$trigger('callouttap', {}, {
markerId: Number(self.idString)
})
}
}
callout = marker.callout = new maps.Callout(calloutStyle, callback, this)
} else {
callout = marker.callout = new maps.Callout(calloutStyle)
callout.div.onclick = ($event) => {
if (this.idString) {
this.$parent.$trigger('callouttap', $event, {
markerId: Number(this.idString)
})
}
$event.stopPropagation()
$event.preventDefault()
}
$event.stopPropagation()
$event.preventDefault()
}
}
} else {
if (callout) {
callout.setMap(null)
this.removeMarkerCallout(marker.callout)
delete marker.callout
}
}
......@@ -276,6 +331,22 @@ export default {
styleEl.innerText = `.${className}{${div.getAttribute('style')}}`
return className
},
getMarkerLatitudeLongitude (e) {
let latitude
let longitude
if (IS_AMAP) {
latitude = e.lnglat.lat
longitude = e.lnglat.lng
} else if (mapInfo.type === MapType.QQ) {
latitude = e.latLng.lat
longitude = e.latLng.lng
} else if (mapInfo.type === MapType.GOOGLE) {
latitude = e.latLng.lat()
longitude = e.latLng.lng()
}
return { latitude, longitude }
},
removeMarker () {
const marker = this._marker
if (marker) {
......@@ -283,12 +354,19 @@ export default {
marker.label.setMap(null)
}
if (marker.callout) {
marker.callout.setMap(null)
this.removeMarkerCallout(marker.callout)
}
marker.setMap(null)
}
delete this.$parent._markers[this.idString]
this._marker = null
},
removeMarkerCallout (callout) {
if (IS_AMAP) {
callout.removeAMapText()
} else {
callout.setMap(null)
}
}
},
render () {
......
import { hexToRgba } from 'uni-shared'
import { IS_AMAP } from '../../../helpers/location'
export default {
props: {
// 边框虚线,腾讯地图支持,google 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
// 边框虚线,腾讯地图支持,google 高德 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
dashArray: {
type: Array,
default: () => [0, 0]
......@@ -65,7 +66,7 @@ export default {
const path = points.map(item => {
const { latitude, longitude } = item
return new _maps.LatLng(latitude, longitude)
return IS_AMAP ? [longitude, latitude] : new _maps.LatLng(latitude, longitude)
})
const { r: fcR, g: fcG, b: fcB, a: fcA } = hexToRgba(fillColor)
......
import { IS_AMAP } from '../../../../helpers/location'
export function createCallout (maps) {
const overlay = new (maps.OverlayView || maps.Overlay)()
function onAdd () {
const div = this.div
const panes = this.getPanes()
......@@ -12,6 +13,40 @@ export function createCallout (maps) {
}
}
function createAMapText () {
const option = this.option
this.Text = new maps.Text({
text: option.content,
anchor: 'bottom-center', // 设置文本标记锚点
offset: new maps.Pixel(0, option.offsetY),
style: {
'margin-bottom': '1rem',
padding: (option.padding || 8) + 'px',
'line-height': (option.fontSize || 14) + 'px',
'border-radius': (option.borderRadius || 0) + 'px',
'border-color': `${option.bgColor || '#fff'} transparent transparent`,
'background-color': option.bgColor || '#fff',
'box-shadow': '0 2px 6px 0 rgba(114, 124, 245, .5)',
'text-align': 'center',
'font-size': (option.fontSize || 14) + 'px',
color: option.color || '#000'
},
position: option.position
})
maps.event.addListener(this.Text, 'click', () => {
this.callback(this.parent)
})
this.Text.setMap(option.map)
}
function removeAMapText () {
if (this.Text) {
this.option.map.remove(this.Text)
}
}
class Callout {
option
position
......@@ -20,6 +55,9 @@ export function createCallout (maps) {
alwaysVisible
div
triangle
callback
parent
Text
set onclick (callback) {
this.div.onclick = callback
......@@ -29,43 +67,60 @@ export function createCallout (maps) {
return this.div.onclick
}
constructor (option = {}) {
constructor (option = {}, callback, parent) {
this.option = option || {}
const map = option.map
this.position = option.position
this.index = 1
const visible = (this.visible = this.alwaysVisible = option.display === 'ALWAYS')
const div = (this.div = document.createElement('div'))
const divStyle = div.style
divStyle.position = 'absolute'
divStyle.whiteSpace = 'nowrap'
divStyle.transform = 'translateX(-50%) translateY(-100%)'
divStyle.zIndex = '1'
divStyle.boxShadow = option.boxShadow || 'none'
divStyle.display = visible ? 'block' : 'none'
const triangle = (this.triangle = document.createElement('div'))
triangle.setAttribute(
'style',
'position: absolute;white-space: nowrap;border-width: 4px;border-style: solid;border-color: #fff transparent transparent;border-image: initial;font-size: 12px;padding: 0px;background-color: transparent;width: 0px;height: 0px;transform: translate(-50%, 100%);left: 50%;bottom: 0;'
)
this.setStyle(option)
div.appendChild(triangle)
if (map) {
this.setMap(map)
this.visible = this.alwaysVisible = option.display === 'ALWAYS'
if (IS_AMAP) {
this.callback = callback
this.parent = parent
if (this.visible) {
this.createAMapText()
}
} else {
const map = option.map
this.position = option.position
this.index = 1
const div = (this.div = document.createElement('div'))
const divStyle = div.style
divStyle.position = 'absolute'
divStyle.whiteSpace = 'nowrap'
divStyle.transform = 'translateX(-50%) translateY(-100%)'
divStyle.zIndex = '1'
divStyle.boxShadow = option.boxShadow || 'none'
divStyle.display = this.visible ? 'block' : 'none'
const triangle = (this.triangle = document.createElement('div'))
triangle.setAttribute(
'style',
'position: absolute;white-space: nowrap;border-width: 4px;border-style: solid;border-color: #fff transparent transparent;border-image: initial;font-size: 12px;padding: 0px;background-color: transparent;width: 0px;height: 0px;transform: translate(-50%, 100%);left: 50%;bottom: 0;'
)
this.setStyle(option)
div.appendChild(triangle)
if (map) {
this.setMap(map)
}
}
}
createAMapText = createAMapText
removeAMapText = removeAMapText
onAdd = onAdd
construct = onAdd
setOption (option) {
this.option = option
this.setPosition(option.position)
if (option.display === 'ALWAYS') {
this.alwaysVisible = this.visible = true
} else {
this.alwaysVisible = false
}
this.setStyle(option)
if (IS_AMAP) {
if (this.visible) {
this.createAMapText()
}
} else {
this.setPosition(option.position)
this.setStyle(option)
}
}
setStyle (option) {
......@@ -107,11 +162,15 @@ export function createCallout (maps) {
destroy = onRemove
}
const prototype = Callout.prototype
for (const key in overlay) {
if (!(key in prototype)) {
prototype[key] = overlay[key]
if (!IS_AMAP) {
const prototype = Callout.prototype
const overlay = new (maps.OverlayView || maps.Overlay)()
for (const key in overlay) {
if (!(key in prototype)) {
prototype[key] = overlay[key]
}
}
}
return Callout
}
import {
MapType,
getMapInfo
getMapInfo,
IS_AMAP
} from '../../../../helpers/location'
import { createCallout } from './callout'
......@@ -21,7 +22,7 @@ export function loadMaps (libraries, callback) {
window[mapInfo.type] &&
window[mapInfo.type].maps
) {
maps = window[mapInfo.type].maps
maps = IS_AMAP ? window[mapInfo.type] : window[mapInfo.type].maps
maps.Callout = maps.Callout || createCallout(maps)
callback(maps)
} else if (callbacks.length) {
......@@ -32,20 +33,24 @@ export function loadMaps (libraries, callback) {
const callbackName = GOOGLE_MAP_CALLBACKNAME + mapInfo.type
globalExt[callbackName] = function () {
delete globalExt[callbackName]
maps = window[mapInfo.type].maps
maps = IS_AMAP ? window[mapInfo.type] : window[mapInfo.type].maps
maps.Callout = createCallout(maps)
callbacks.forEach((callback) => callback(maps))
callbacks.length = 0
}
const script = document.createElement('script')
let src =
mapInfo.type === MapType.GOOGLE ? 'https://maps.googleapis.com/maps/api/js?' : 'https://map.qq.com/api/js?v=2.exp&'
let src = getScriptBaseUrl(mapInfo.type)
if (mapInfo.type === MapType.QQ) {
libraries.push('geometry')
}
if (libraries.length) {
src += `libraries=${libraries.join('%2C')}&`
}
if (IS_AMAP) {
handleAMapSecurityPolicy(mapInfo)
}
script.src = `${src}key=${mapInfo.key}&callback=${callbackName}`
script.onerror = function () {
console.error('Map load failed.')
......@@ -53,3 +58,20 @@ export function loadMaps (libraries, callback) {
document.body.appendChild(script)
}
}
function getScriptBaseUrl (mapType) {
const urlMap = {
qq: 'https://map.qq.com/api/js?v=2.exp&',
google: 'https://maps.googleapis.com/maps/api/js?',
AMap: 'https://webapi.amap.com/maps?v=2.0&'
}
return urlMap[mapType]
}
function handleAMapSecurityPolicy (mapInfo) {
window._AMapSecurityConfig = {
securityJsCode: mapInfo.securityJsCode || '',
serviceHost: mapInfo.serviceHost || ''
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册