|
40 | 40 | </Col> |
41 | 41 | </Row> |
42 | 42 | </div> |
| 43 | + <i-circle :percent="percent" :stroke-color="color"> |
| 44 | + <Icon v-if="percent == 100" type="ios-checkmark-empty" size="60" style="color:#5cb85c"></Icon> |
| 45 | + <span v-else style="font-size:24px">{{ percent }}%</span> |
| 46 | + </i-circle> |
| 47 | + <Button @click="send">123</Button> |
43 | 48 | <div class="summary"> |
44 | 49 | <Tabs style="margin-top: 10px" v-model="selectTab" :animated="false"> |
45 | 50 | <TabPane label="访问量" name="accessChars"> |
|
60 | 65 | return { |
61 | 66 | selectTab:"", |
62 | 67 | accessChars:{}, |
63 | | - dataChars:{} |
| 68 | + dataChars:{}, |
| 69 | + percent: 0 |
64 | 70 | } |
65 | 71 | }, |
| 72 | + methods:{ |
| 73 | + send(){ |
| 74 | + this.$socket.emit('message',"123") |
| 75 | + } |
| 76 | + }, |
66 | 77 | mounted(){ |
67 | 78 | // 基于准备好的dom,初始化echarts实例 |
68 | 79 | this.accessChars = echarts.init(document.getElementById('accessChar')); |
69 | 80 | this.dataChars = echarts.init(document.getElementById('dataChar')); |
70 | 81 | }, |
| 82 | + computed: { |
| 83 | + color () { |
| 84 | + let color = '#2db7f5'; |
| 85 | + if (this.percent == 100) { |
| 86 | + color = '#5cb85c'; |
| 87 | + } |
| 88 | + return color; |
| 89 | + } |
| 90 | + }, |
| 91 | + mounted(){ |
| 92 | + this.$socket.emit('bind', window.sessionStorage.getItem("username")) |
| 93 | + }, |
| 94 | + sockets:{ |
| 95 | + message: function(val){ |
| 96 | + console.log("[websocket] "+val) |
| 97 | + this.percent = val |
| 98 | + } |
| 99 | + }, |
71 | 100 | created(){ |
72 | 101 | let option = { |
73 | 102 | // Make gradient line here |
|
104 | 133 | if(this.HOST=="static"){ |
105 | 134 | url+=".json" |
106 | 135 | } |
107 | | - this.$http.get(url).then((response) => { |
108 | | - if(response.status == 200){ |
109 | | - let accessList = response.body.data.accessList |
110 | | - option.xAxis.data = accessList.map(function (item) {return item[0]}) |
111 | | - option.series.data = accessList.map(function (item) {return item[1]}) |
112 | | - option.title.text = "系统访问量统计" |
113 | | - this.accessChars.setOption(option) |
114 | | - let dataList = response.body.data.dataList |
115 | | - option.xAxis.data = dataList.map(function (item) {return item[0]}) |
116 | | - option.series.data = dataList.map(function (item) {return item[1]}) |
117 | | - option.title.text = "系统总数据量统计" |
118 | | - this.dataChars.setOption(option) |
119 | | - } |
120 | | - }) |
| 136 | +// this.$http.get(url).then((response) => { |
| 137 | +// if(response.status == 200){ |
| 138 | +// let accessList = response.body.data.accessList |
| 139 | +// option.xAxis.data = accessList.map(function (item) {return item[0]}) |
| 140 | +// option.series.data = accessList.map(function (item) {return item[1]}) |
| 141 | +// option.title.text = "系统访问量统计" |
| 142 | +// this.accessChars.setOption(option) |
| 143 | +// let dataList = response.body.data.dataList |
| 144 | +// option.xAxis.data = dataList.map(function (item) {return item[0]}) |
| 145 | +// option.series.data = dataList.map(function (item) {return item[1]}) |
| 146 | +// option.title.text = "系统总数据量统计" |
| 147 | +// this.dataChars.setOption(option) |
| 148 | +// } |
| 149 | +// }) |
121 | 150 | } |
122 | 151 | } |
123 | 152 | </script> |
0 commit comments