1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4d9e0cd2"],{"0863":function(t,e,n){"use strict";var a=n("2425"),s=n.n(a);s.a},2425:function(t,e,n){},"456d":function(t,e,n){var a=n("4bf8"),s=n("0d58");n("5eda")("keys",function(){return function(t){return s(a(t))}})},"5eda":function(t,e,n){var a=n("5ca1"),s=n("8378"),i=n("79e5");t.exports=function(t,e){var n=(s.Object||{})[t]||Object[t],c={};c[t]=e(n),a(a.S+a.F*i(function(){n(1)}),"Object",c)}},"859c":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"game-nav-newwork",on:{mouseenter:t.testMainNet}},[n("i",{staticClass:"wifi-icon",class:t.wifiColor}),n("div",{staticClass:"newwork-list"},t._l(t.newWorkData,function(e,a){return n("p",{key:a,staticClass:"newwork-item",class:t.getCurClass(e.host),on:{click:function(n){t.changeMainnet(e.host,e.delay)}}},[n("span",{staticClass:"name"},[t._v(t._s(e.mainnet))]),n("span",{staticClass:"time",class:t.stateMap[e.state]},[t._v(t._s(e.delay))])])}))])},s=[],i=(n("a481"),n("ac6a"),n("456d"),n("1a22")),c=n("d3b7"),r=n.n(c),o={name:"gameNetWork",data:function(){return{newWorkData:[],stateMap:["test","green","yellow","red"],currentDelay:0}},computed:{mainnet:function(){return this.$store.state.mainnet},scatter:function(){return this.$store.state.scatter},wifiColor:function(){var t=this.currentDelay,e="green";return t>=1e3?e="red":t>500&&t<1e3?e="yellow":t<=500&&(e="green"),e}},methods:{testMainNet:function(){var t=this,e=function(e){var n=Object.keys(i["c"]).indexOf(e),a=i["c"][e],s=(new Date).getTime();fetch("https://".concat(a,"/v1/chain/get_info")).then(function(e){if(!e.ok)return Promise.reject("".concat(a," request fail"));var i=(new Date).getTime()-s,c=0;i>=1e3?c=3:i>500&&i<1e3?c=2:i<=500&&(c=1),t.newWorkData[n].state=c,t.newWorkData[n].delay=i+"ms"}).catch(function(t){})};for(var n in i["c"])e(n)},getCurClass:function(t){if(this.mainnet==t)return"current"},changeMainnet:function(t,e){8080==window.location.port||/^test-|\.webdev2\./.test(window.location.host)||(this.$store.dispatch("setEos",this.scatter.eos(Object(i["a"])(t),r.a,{})),this.$store.commit("setMainnet",t),this.currentDelay=e.replace(/ms/,""))}},created:function(){for(var t in i["c"])this.newWorkData.push({mainnet:t,delay:"connecting",state:0,host:i["c"][t]})}},u=o,l=(n("0863"),n("2877")),f=Object(l["a"])(u,a,s,!1,null,null,null);f.options.__file="newWork.vue";e["default"]=f.exports}}]);
|