(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/locationDisplay/index"],{"5b06":function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i={name:"LocationDisplay",props:{text:{type:String,default:"定位中..."},maxWidth:{type:String,default:"118rpx"},maxHeight:{type:String,default:"42rpx"},isScrolled:{type:Boolean,default:!1},enableScroll:{type:Boolean,default:!0},positioningType:{type:Boolean,default:!1}},data:function(){return{textOffset:0,scrollTimer:null,isScrolling:!1,animationClass:"",maxDistance:0,currentLocationName:"",storageTimer:null,isDestroyed:!1}},computed:{displayText:function(){return this.text&&"定位中..."!==this.text?this.text:this.currentLocationName?this.currentLocationName:this.positioningType?"选择圈层":"选择位置"}},mounted:function(){this.text&&"定位中..."!==this.text||(this.initLocationData(),this.setupStorageListener()),this.resetAndStartScroll()},created:function(){},watch:{text:function(){this.resetAndStartScroll()},displayText:function(){this.resetAndStartScroll()},enableScroll:function(){this.enableScroll?this.resetAndStartScroll():(this.stopScroll(),this.textOffset=0)}},beforeDestroy:function(){this.isDestroyed=!0,this.stopScroll(),this.stopLocationListener()},methods:{resetAndStartScroll:function(){this.stopScroll(),this.textOffset=0,this.isScrolling=!1},startSimpleScroll:function(){var t=this;this.isScrolling||this.$nextTick((function(){t.calculateScrollDistance()}))},calculateScrollDistance:function(){var e=this,i=t.createSelectorQuery().in(this);i.select(".text-content").boundingClientRect(),i.select(".location-text").boundingClientRect(),i.exec((function(t){if(t[0]&&t[1]){var i=t[0].width,n=t[1].width,o=i-n;o=Math.max(0,o-10),o>0&&e.startTwoWayScroll(o)}}))},startTwoWayScroll:function(t){var e=this;setTimeout((function(){!e.isDestroyed&&e.enableScroll&&(e.isScrolling=!0,e.textOffset=0,e.scrollToEnd(t))}),1e3)},scrollToEnd:function(t){var e=this;this.scrollTimer=setInterval((function(){var i=e.textOffset-1;if(i<-t)return e.textOffset=-t,clearInterval(e.scrollTimer),void setTimeout((function(){e.scrollToStart()}),2e3);e.textOffset=i}),30)},scrollToStart:function(){var t=this;this.scrollTimer=setInterval((function(){var e=t.textOffset+1;if(e>0)return t.textOffset=0,void t.stopScroll();t.textOffset=e}),30)},stopScroll:function(){this.scrollTimer&&(clearInterval(this.scrollTimer),this.scrollTimer=null),this.isScrolling=!1},handleLocationClick:function(){this.$emit("click")},initLocationData:function(){if(!this.isDestroyed)try{var e=t.getStorageSync("location_info");if(e&&(e.name||e.address)&&!this.positioningType)return void(this.currentLocationName=e.name||e.address);var i=t.getStorageSync("areas_info");if(i&&Array.isArray(i)&&i.length>0&&this.positioningType){var n=i[0];return void(this.currentLocationName=n.name||n.address||"选择圈层")}this.currentLocationName=this.positioningType?"选择圈层":"选择位置"}catch(o){this.currentLocationName=this.positioningType?"选择圈层":"选择位置"}},setupStorageListener:function(){var t=this;this.isDestroyed||(this.storageTimer=setInterval((function(){t.isDestroyed||t.checkLocationUpdate()}),1e3))},checkLocationUpdate:function(){if(!this.isDestroyed)try{var e=this.positioningType?"选择圈层":"选择位置",i=t.getStorageSync("location_info");if(i&&(i.name||i.address)&&!this.positioningType)e=i.name||i.address;else{var n=t.getStorageSync("areas_info");if(n&&Array.isArray(n)&&n.length>0&&this.positioningType){var o=n[0];e=o.name||o.address||"选择圈层"}}e!==this.currentLocationName&&(this.currentLocationName=e)}catch(r){}},stopLocationListener:function(){this.storageTimer&&(clearInterval(this.storageTimer),this.storageTimer=null)}}};e.default=i}).call(this,i("df3c")["default"])},b3f5:function(t,e,i){"use strict";i.r(e);var n=i("5b06"),o=i.n(n);for(var r in n)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(r);e["default"]=o.a},d6fa:function(t,e,i){"use strict";i.r(e);var n=i("de03"),o=i("b3f5");for(var r in o)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return o[t]}))}(r);i("e241");var s=i("828b"),a=Object(s["a"])(o["default"],n["b"],n["c"],!1,null,"00ef2bed",null,!1,n["a"],void 0);e["default"]=a.exports},de03:function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){}));var n=function(){var t=this.$createElement;this._self._c},o=[]},e241:function(t,e,i){"use strict";var n=i("ec12"),o=i.n(n);o.a},ec12:function(t,e,i){}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    'components/locationDisplay/index-create-component',
    {
        'components/locationDisplay/index-create-component':(function(module, exports, __webpack_require__){
            __webpack_require__('df3c')['createComponent'](__webpack_require__("d6fa"))
        })
    },
    [['components/locationDisplay/index-create-component']]
]);
