vue项目组件总结

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
Number.prototype.toFx = function(n){
var result = this.toString()
var ary = result.split(".")
if(ary.length < 2){
result += "."
for(var i=0;i<n;i++){
result += '0'
}
return result
}
var integer = ary[0];
var decimal = ary[1];
if(decimal.length == n){
return result
}
if(decimal.length < n){
for(var i=0; i<n-decimal.length;i++){
result += '0'
}
return result
}
return integer + "." + decimal.slice(0,n)
}

/**
* 自定义指令,方便项目在进行绑定的时候。
*/
Vue.config.silent = true;

Vue.directive('cblur',{
bind:function(el,binding){
document.body.addEventListener('click',function(e){
var parent = e.target;
while(parent && parent !== document.body){
// 首先弹出内容被点击,不应该隐藏
if($(parent).hasClass(binding.arg)){
e.preventDefault()
return
}
parent = parent.parentNode
}
if(e.target == el){ // 当然触发按钮也不应该触发隐藏事件
e.preventDefault()
return
}
$('.'+binding.arg).css('display','none');
})
}
})

Vue.component('b-calc',{
template:"#_calc",
delimiters: ['${', '}'],
props:[
"coininfo"
],
data:function(){
return {
calc_list:{},
calculator:{
show:false,
initial:false, //初始化与否
coin:'grin',
input_value:1,
pps_value:'',
pps_unit:'',
coin_result:'',
cny_result:'',
cny:'',
power: 0,
elec_fee: 0,
timer:''
},
}
},
watch:{
coininfo:function(val){
this.fetch_coin();
}
},
methods:{
fetch_coin(){
var that = this
if(this.coininfo != undefined || this.coininfo != null){
that.initCoinInfo(this.coininfo)
}else{
$.get('/pool_status').done(function(res){
var res = JSON.parse(res)
that.initCoinInfo(res)
})
}
},
initCoinInfo(res,calc_list){
var calc_list = {}
for(var i=0;i<res.data.data.length;i++){
var data = res.data.data[i]
var target = $('.b-tr-coin[data-coin="'+data.coin+'"]')
var coin_calc={
coin:data.coin.toUpperCase(),
pps_value:data.pps_value,
pps_unit:data.pps_unit,
cny:data.cny
}
calc_list[data.coin.toUpperCase()] = coin_calc
}
this.calc_list = calc_list

if(!this.calculator.initial){
this.calculator.initial = true
for(var key in calc_list){
this.setAndInitial(calc_list[key])
break
}
}
},
// 计算
_list_toggle_slide(select){
$(select).stop().slideToggle()
},
_list_hide_slide(list,curr,e){
if($(e.target).hasClass(curr)) return
$(list).stop().slideUp()
},
// 显示计算器
showCalculator(){
this.calculator.show = true
},
// 隐藏计算器
closeCalculator(){
this.calculator.show = false
this.calculator.power = 0
this.calculator.elec_fee = 0
for(var key in this.calc_list){
this.setAndInitial(this.calc_list[key])
break
}
},
// 设置计算器参数并计算
setAndInitial(target){
this.calculator.coin = target.coin
this.calculator.pps_value = target.pps_value
this.calculator.cny = target.cny
this.calculator.pps_unit = target.pps_unit.toUpperCase()
// 计算每日币数及价格
this.calculator.coin_result = this.calculator.pps_value
this.calculator.cny_result = Number(this.calculator.coin_result*target.cny).toFx(3)
},
// 切换计算币种
switchCalcCoin(e){
var coin = $(e.currentTarget).attr('data-coin')
// 重新定义币种单位
this.calculator.coin = coin
this.calculator.input_value = 1
this.calculator.power = 0
this.calculator.pps_value = this.calc_list[coin].pps_value
this.calculator.pps_unit = this.calc_list[coin].pps_unit.toUpperCase()
this.calculator.cny = this.calc_list[coin].cny
$('.coin_list').stop().slideUp()
this.shake_fixed()
},
shake_fixed(){
window.clearTimeout(this.calculator.timer)
this.calculator.timer = window.setTimeout(()=>{
if(!this.calculator.input_value){
this.calculator.input_value = 1
}
if(!this.calculator.power || this.calculator.power === 0){
this.calculator.power = 0
}
if(!this.calculator.elec_fee || this.calculator.elec_fee === 0){
this.calculator.elec_fee = 0
}
this.calculate()
},700)
},
// 计算当前结果
calculate(){
// 算力 this.calculator.input_value
// 电费 this.calculator.elec_fee
// 功率 this.calculator.power
// 当前币种单位 this.calculator.pps_unit
var coin = this.calculator.input_value*this.calculator.pps_value
var elec_fee = this.calculator.elec_fee*this.calculator.power*24
if(this.calculator.cny === 0){
this.calculator.coin_result = Number(coin).toFx(3)
this.calculator.cny_result = Number(-elec_fee).toFx(3)
}else{
var coin_fee = elec_fee / this.calculator.cny
this.calculator.coin_result = Number(coin-coin_fee).toFx(3)
this.calculator.cny_result = Number(this.calculator.coin_result*this.calculator.cny).toFx(3)
}
}
},
created:function(){
this.fetch_coin()
},
mounted:function(){
var that = this
$('body').on('click',(e)=>{
that._list_hide_slide('.coin_list','unit_selected',e);
})
}
})

/**
* [bee-select]
* @param Object options
* @example
* {
* id:'icon的类',
* options:{
* key1:'item',
* key2:'item'
* }
* }
*
*/

Vue.component('bee-select',{
template:
"<div class='selection' :ref='options.id'>"+
"<div class='selected' @click.stop='show_list'>"+
"<span class='iconwrap'><span class='default' :class='[options.id,currentCls]'></span></span>"+
"<span class='now'>{{selected}}</span>"+
"</div>"+
"<ul class='option-list'>"+
"<li class='option-item' v-for='(val,key,index) in options.options' :data-option='key' :key='index' @click.stop='select'>"+
"<span class='icon' v-if='options.show_icon' :class='key'></span>"+
"<span class='key' v-if='options.show_key'>{{key}}</span>"+
"<span class='val'> {{val}} </span>"+
"</li>"+
"</ul>"+
"</div>",
props:{
options: {
tyep:Object,
required:true
},
cb:{
type:Function,
required:true
},
init:{
type:Function,
required:false
}
},
watch:{
'options':{
handler: function (val, oldVal) {
this.selected = val.selected || val.options[Object.keys(this.options.options)[0]]
},
deep: true
}
},
data:function(){
return {
selected:'',
currentCls:''
}
},
methods:{
show_list:function(p){
$(this.$refs[this.options.id]).find('.selected').css('border-color','#00bc8d')
$(this.$refs[this.options.id]).find('.option-list').stop().slideToggle(200)
},
select:function(e){
this.selected = this.currentCls = e.currentTarget.dataset.option
$(this.$refs[this.options.id]).find('.option-list').stop().scrollTop(0).hide()
this.cb(e.currentTarget.dataset.option)
}
},
mounted:function(){
this.selected = this.options.selected || this.options.options[Object.keys(this.options.options)[0]]
if(!!this.init && typeof this.init === 'function'){
this.init(this.selected)
}
var that = this
var preventScroll = function(dom){
if(navigator.userAgent.indexOf('Firefox') >= 0){ //firefox
dom.addEventListener('DOMMouseScroll',function(e){
dom.scrollTop += e.detail > 0 ? 38 : -38;
e.preventDefault();
},false);
}else{
dom.onmousewheel = function(e){
e = e || window.event;
dom.scrollTop += e.wheelDelta > 0 ? -38 : 38;
return false
};
}
};
preventScroll($(that.$refs[that.options.id]).find('.option-list').get(0))
$('body').on('click',function(){
$(that.$refs[that.options.id]).find('.option-list').stop().slideUp(200).scrollTop(0)
$(that.$refs[that.options.id]).find('.selected').css('border-color','#e0e0e0')
})
}
})

/**
* [bee-count]
* @param count Number
* @param start String
* @param end String
* @param cb Function
*/

Vue.component('bee-count',{
template:"<span class='b-count' @click='notRun&&cb(run)' >${content}</span>",
props:['count','start','end','cb'],
delimiters:['${','}'],
data:function(){
return {
timer:'',
content:'',
notRun:true
}
},
methods:{
run:function(){
this.notRun = false
var time = Number(this.count)
this.content = time + '秒'
var that = this
function run_time(){
that.timer = window.setTimeout(function(){
that.content = --time + '秒'
if(time == 0){
that.content = that.end
window.clearTimeout(that.timer)
that.notRun = true
return
}
window.clearTimeout(that.timer)
run_time()
},1000)
}
run_time()
},
stop:function(){
window.clearTimeout(this.timer)
this.content = this.start
}
},
mounted:function(){
this.content = this.start
}
})

Vue.component('bee-switch',{
template:
'<button class="b-switch" :class="[b_switch?\'b-switch-on\':\'\',size]" :data-switch="[b_switch?\'1\':\'2\']" @click="swicth_change">'+
'</button>',
props:{
size:{
type: String,
required: true
},
status:{
type:Boolean,
required:true
},
cb:{
type:Function,
required: true
}
},
watch:{
status:function(val){
this.b_switch = val
}
},
data:function(){
return {
b_switch:false
}
},
methods:{
swicth_change:function(e){
this.$emit('change')
}
},
mounted:function(){
this.b_switch = this.status
}
})

Vue.component('bee-alert',{
template:'<transition name="tips"><div class="tip_wraper" v-show="isshow"><span id="tip-content">'+
'<span v-if=" type == \'error\'" class="icon icon-m_del"><span class="path1"></span><span class="path2"></span><span class="path3"></span></span>'+
'<span v-if="type == \'correct\'" class="icon icon-tip_confirm"></span>'+
'<span class="text">${msg}</span>&nbsp!'+
'</span></div></transition>',
props:["type","msg","duration"],
delimiters:['${','}'],
data(){
return {
isshow:false
}
},
methods:{
show(){
this.isshow = true
setTimeout(this.hide,this.duration)
},
hide(){
this.isshow = false
setTimeout(this.remove,700)
}
}
})

$.fn.extend({
/**
* 执行强制重绘
*/
reflow: function () {
return this.each(function () {
return this.clientLeft;
});
},

/**
* 设置 transition 时间
* @param duration
*/
transition: function (duration) {
if (typeof duration !== 'string') {
duration = duration + 'ms';
}

return this.each(function () {
this.style.webkitTransitionDuration = duration;
this.style.transitionDuration = duration;
});
},

/**
* transition 动画结束回调
* @param callback
* @returns {transitionEnd}
*/
transitionEnd: function (callback) {
var events = [
'webkitTransitionEnd',
'transitionend',
];
var i;
var _this = this;

function fireCallBack(e) {
if (e.target !== this) {
return;
}

callback.call(this, e);

for (i = 0; i < events.length; i++) {
_this.off(events[i], fireCallBack);
}
}

if (callback) {
for (i = 0; i < events.length; i++) {
_this.on(events[i], fireCallBack);
}
}

return this;
},
transformOrigin: function (transformOrigin) {
return this.each(function () {
this.style.webkitTransformOrigin = transformOrigin;
this.style.transformOrigin = transformOrigin;
});
},
transform: function (transform) {
return this.each(function () {
this.style.webkitTransform = transform;
this.style.transform = transform;
});
},
});

var TouchHandler = {
touches: 0,
isAllow: function (e) {
var allow = true;

if (
TouchHandler.touches &&
[
'mousedown',
'mouseup',
'mousemove',
'click',
'mouseover',
'mouseout',
'mouseenter',
'mouseleave',
].indexOf(e.type) > -1
) {
// 触发了 touch 事件后阻止鼠标事件
allow = false;
}

return allow;
},
register: function (e) {
if (e.type === 'touchstart') {
// 触发了 touch 事件
TouchHandler.touches += 1;
} else if (['touchmove', 'touchend', 'touchcancel'].indexOf(e.type) > -1) {
// touch 事件结束 500ms 后解除对鼠标事件的阻止
setTimeout(function () {
if (TouchHandler.touches) {
TouchHandler.touches -= 1;
}
}, 500);
}
},

start: 'touchstart mousedown',
move: 'touchmove mousemove',
end: 'touchend mouseup',
cancel: 'touchcancel mouseleave',
unlock: 'touchend touchmove touchcancel',
};

(function () {
var Ripple = {
delay: 200,
show: function (e, $ripple) {
// 鼠标右键不产生涟漪
if (e.button === 2) {
return;
}
// 点击位置坐标
var tmp;
if ('touches' in e && e.touches.length) {
tmp = e.touches[0];
} else {
tmp = e;
}
var touchStartX = tmp.pageX;
var touchStartY = tmp.pageY;
// 涟漪位置
var offset = $ripple.offset();
var center = {
x: touchStartX - offset.left,
y: touchStartY - offset.top,
};
var height = $ripple.innerHeight();
var width = $ripple.innerWidth();
var diameter = Math.max(
Math.pow((Math.pow(height, 2) + Math.pow(width, 2)), 0.5), 48
);
// 涟漪扩散动画
var translate =
'translate3d(' + (-center.x + width / 2) + 'px, ' + (-center.y + height / 2) + 'px, 0) ' +
'scale(1)';
// 涟漪的 DOM 结构
$('<div class="b-ripple-wave" style="' +
'width: ' + diameter + 'px; ' +
'height: ' + diameter + 'px; ' +
'margin-top:-' + diameter / 2 + 'px; ' +
'margin-left:-' + diameter / 2 + 'px; ' +
'left:' + center.x + 'px; ' +
'top:' + center.y + 'px;">' +
'</div>')
// 缓存动画效果
.data('translate', translate)
.prependTo($ripple)
.reflow()
.transform(translate);
},
hide: function (e, element) {
var $ripple = $(element || this);
$ripple.children('.b-ripple-wave').each(function () {
removeRipple($(this));
});
$ripple.off('touchmove touchend touchcancel mousemove mouseup mouseleave', Ripple.hide);
},
};

function removeRipple($wave) {
if (!$wave.length || $wave.data('isRemoved')) {
return;
}
$wave.data('isRemoved', true);

var removeTimeout = setTimeout(function () {
$wave.remove();
}, 400);

var translate = $wave.data('translate');

$wave
.addClass('b-ripple-wave-fill')
.transform(translate.replace('scale(1)', 'scale(1.01)'))
.transitionEnd(function () {
clearTimeout(removeTimeout);

$wave
.addClass('b-ripple-wave-out')
.transform(translate.replace('scale(1)', 'scale(1.01)'));

removeTimeout = setTimeout(function () {
$wave.remove();
}, 700);

setTimeout(function () {
$wave.transitionEnd(function () {
clearTimeout(removeTimeout);
$wave.remove();
});
}, 0);
});
}

function showRipple(e) {
if (!TouchHandler.isAllow(e)) {
return;
}
TouchHandler.register(e);
// Chrome 59 点击滚动条时,会在 document 上触发事件
if (e.target === document) {
return;
}
var $ripple;
var $target = $(e.target);
// 获取含 .b-ripple 类的元素
if ($target.hasClass('b-ripple')) {
$ripple = $target;
} else {
$ripple = $target.parents('.b-ripple').eq(0);
}
if ($ripple.length) {
if (e.type === 'touchstart') {
var hidden = false;

// toucstart 触发指定时间后开始涟漪动画
var timer = setTimeout(function () {
timer = null;
Ripple.show(e, $ripple);
}, Ripple.delay);

var hideRipple = function (hideEvent) {
// 如果手指没有移动,且涟漪动画还没有开始,则开始涟漪动画
if (timer) {
clearTimeout(timer);
timer = null;
Ripple.show(e, $ripple);
}

if (!hidden) {
hidden = true;
Ripple.hide(hideEvent, $ripple);
}
};

// 手指移动后,移除涟漪动画
var touchMove = function (moveEvent) {
if (timer) {
clearTimeout(timer);
timer = null;
}
hideRipple(moveEvent);
};
$ripple
.on('touchmove', touchMove)
.on('touchend touchcancel', hideRipple);
} else {
Ripple.show(e, $ripple);
$ripple.on('touchmove touchend touchcancel mousemove mouseup mouseleave', Ripple.hide);
}
}
}
// 初始化绑定的事件
$(document)
.on(TouchHandler.start, showRipple)
.on(TouchHandler.unlock, TouchHandler.register);
})();

function tips(status,msg,delay=1000){
var props = {
type:status,
msg:msg,
duration:delay
}

var vm = new Vue({
render:function(h){
return h("bee-alert",{props})
}
}).$mount()

$('#tip-box').append(vm.$el)

var comp = vm.$children[0]
comp.remove = function(){
$('#tip-box').get(0).removeChild(vm.$el)
comp.$destroy()
}
comp.show()
}

// function tips(status,msg,delay=1000){
// $("#tip-content .text").text(msg)
// $("#tip-content .icon").removeClass('show')
// if(status=='correct'){
// $("#tip-content .icon-tip_confirm").addClass('show')
// }else if(status=='error'){
// $("#tip-content .icon-m_del").addClass('show')
// }
// $("#tip-content").stop(true).addClass(function(){
// $('#tip-box').addClass('hi')
// return 'shift'
// }).fadeIn(300).delay(delay).removeClass('shift').fadeOut(200,function(){
// $('#tip-box').removeClass('hi')
// })
// }

var bee_header = new Vue({
el:'#b_navtop',
delimiters: ['${', '}'],
data:function(){
return {
header:{
showSide:false,
logined:'',
},
language:{
id:'language',
show_key:false,
options:{
cn:'简体中文',
en:'English'
},
selected:''
},
miner_part:'',
mine:{
name:'',
score:'',
grade:''
},
observe:false,
navbarWhite:false //导航栏颜色是否已经是白色
}
},
watch:{
'header.logined':function(val,old){
try {
if( bee !== null){
bee.logined = val
}
} catch (err) {}

try {
if( b_account !== null){
b_account.mine = this.mine
}
} catch (err) {}

try {
if( b_miner !== null){
b_miner.mine = this.mine
}
} catch (err) {}
}
},
methods:{
/* <导航栏方法> */
showOrHide:function(){
if(!this.header.showSide){
$('.b-side-bar').css({'marginLeft':'0'})
$('.b-side-back').fadeIn(200)
this.header.showSide = true
}else{
$('.b-side-back').fadeOut(200)
this.header.showSide = false
$('.b-side-bar').css({'marginLeft':'100%'})
}
},
showTime:function(status,ele){
if(status=='in'){
$(ele).stop().slideDown()
}else{
$(ele).stop().slideUp()
}
},
show_personal:function(p){
if(p=='in'){
$('.action_list').stop().slideDown()
}else{
$('.action_list').stop().slideUp()
}
},
switch_language(l){
if(l == 'cn'){
$.cookie('language','zh',{ path: '/',expires:30})
}else if(l == 'en'){
$.cookie('language','en',{ path: '/',expires:30})
}
location.reload();
},
sideSlide:function(ele){
$(ele).slideToggle()
$('.b-mobile-item').removeClass('checked')
$(ele).parent().addClass('checked')
},
showNav:function(){
if($(window).scrollTop() > 460 ){
$('#goTop').stop().fadeIn()
}else if($(window).scrollTop() <= 460 ){
$('#goTop').stop().fadeOut()
}
},
goTop:function(duration){
var journey = $(window).scrollTop()
var speed = 5
var step = (journey/duration)*5
topTurn(null,step,speed)
function topTurn(timer,step,speed){
window.clearTimeout(timer)
if($(window).scrollTop() <= step){
$(window).scrollTop(0)
return
}
var timer = window.setTimeout(function(){
$(window).scrollTop($(window).scrollTop()-step)
topTurn(timer,step,speed)
},speed)
}
},
fetch_login_info(){
$.ajax({
url:'/getLoginInfo',
type:'get',
success:(res)=>{
res = JSON.parse(res)
if(res.code == 0){
this.mine.name = res.data.name
this.mine.score = res.data.score || 0
this.mine.grade = res.data.grade || 0
this.mine.phone = res.data.phone
this.mine.email = res.data.email
this.mine.update = 9
this.mine.ready = true
this.header.logined = true
}else{
this.header.logined = false
}
}
})
},
IEVersion() {
//取得浏览器的userAgent字符串
var userAgent = navigator.userAgent;
//判断是否IE浏览器
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
if (isIE) {
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
if (fIEVersion < 10 || !isSupportPlaceholder()) {
return true;
}
} else {
return false;
}
},
/* </导航栏方法> */
init:function(){
var that = this
var scrollTimer = 0
$(window).on('scroll',function(e){
window.clearTimeout(scrollTimer)
scrollTimer = setTimeout(that.showNav,150)
})
var index = window.location.href.lastIndexOf('/')
var _href = window.location.href.slice(index+1)
var homeReg = /^home[.]*/i
var observeReg = /^observe[.]*/i
if(observeReg.test(_href) || homeReg.test(_href)){
$('.minerCenter .miner_list').show()
$(window).on('hashchange',function(){
that.miner_part = window.location.hash.slice(1)
})
}
if(observeReg.test(_href)){
that.observe = true
}
}
},
created(){
if(this.IEVersion()){
alert('浏览器版本过低,蜜蜂矿池敬请您使用Chrome、Firefox浏览器进行访问!')
}
if($.cookie('language')=='en'){
this.language.selected = 'English'
}else{
this.language.selected = '简体中文'
}
this.init()
this.fetch_login_info()
}
})