Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

V2.0.1 #78

Merged
merged 2 commits into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.github.stellarcn.firefly" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.github.stellarcn.firefly" version="2.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>firefly</name>
<description>
stellar wallet
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firefly",
"version": "2.0.0",
"version": "2.0.1",
"description": "stellar mobile wallet",
"repository": {
"type": "git",
Expand Down
21 changes: 16 additions & 5 deletions src/components/FullK.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@

<div class="kgraph" :id="id" v-bind:style="{height: height+'px', width: width+'px'}"></div>
<div class="flex-row textcenter chgresolution">
<div :class="'flex1 ' + (resolution_key === 'week' ? 'active' : '')" @click="chgResolution('week')">{{$t('week')}}</div>
<div :class="'flex1 ' + (resolution_key === 'day' ? 'active' : '')" @click="chgResolution('day')">{{$t('day')}}</div>
<div :class="'flex1 ' + (resolution_key === 'hour' ? 'active' : '')" @click="chgResolution('hour')">{{$t('hour')}}</div>
<div :class="'flex1 ' + (resolution_key === '15min' ? 'active' : '')" @click="chgResolution('15min')">15{{$t('minute')}}</div>
<div :class="'flex1 ' + (resolution_key === '1min' ? 'active' : '')" @click="chgResolution('1min')">1{{$t('minute')}}</div>
<div :class="'flex1 ' + (resolution_key === 'week' ? 'active' : '')" @click="chgResolutionKey('week')">{{$t('week')}}</div>
<div :class="'flex1 ' + (resolution_key === 'day' ? 'active' : '')" @click="chgResolutionKey('day')">{{$t('day')}}</div>
<div :class="'flex1 ' + (resolution_key === 'hour' ? 'active' : '')" @click="chgResolutionKey('hour')">{{$t('hour')}}</div>
<div :class="'flex1 ' + (resolution_key === '15min' ? 'active' : '')" @click="chgResolutionKey('15min')">15{{$t('minute')}}</div>
<div :class="'flex1 ' + (resolution_key === '1min' ? 'active' : '')" @click="chgResolutionKey('1min')">1{{$t('minute')}}</div>
</div>
</div>
</card>
Expand Down Expand Up @@ -443,6 +443,17 @@ export default {
]
}
}, // end of koption
chgResolutionKey(key){
this.chgResolution(key)
this.reloadAll()
},
reloadAll(){
this.cleanData()
this.initView();
this.fetch();
this.fetchLastTradeAggregation()
this.fetchLastTrade()
}

},
components: {
Expand Down
21 changes: 18 additions & 3 deletions src/components/K.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author: mazhaoyong@gmail.com
* @Date: 2018-01-25 11:53:34
* @Last Modified by: mazhaoyong@gmail.com
* @Last Modified time: 2018-04-20 16:24:46
* @Last Modified time: 2018-04-28 16:50:33
* @License: MIT
*/
<template>
Expand Down Expand Up @@ -85,6 +85,14 @@ const RESOLUTIONS = {
"1min": RESOLUTION_1MIN
}

const RESOLUTION_HOURS = {
"week": 5880,
"day": 840,
"hour": 48,
"15min": 24,
"1min": 24
}

export default {
data(){
return {
Expand Down Expand Up @@ -229,6 +237,13 @@ export default {
init() {
this.initView()
},
getStartTime(){
let defHour = RESOLUTION_HOURS[this.resolution_key]
if(!defHour){
defHour = 24
}
return Number(moment().subtract(defHour,"hours").format('x'))
},
//请求api,获取数据
fetch(){
let start_time = null, end_time=null;
Expand All @@ -237,8 +252,8 @@ export default {
end_time = new Date().getTime()
}else{//初次请求,判断start是否存在
if(this.start < 0){
//前48小时
start_time = Number(moment().subtract(48,"hours").format('x'))

start_time = this.getStartTime()
}else{
start_time = this.start;
}
Expand Down
17 changes: 16 additions & 1 deletion src/mixins/k-mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export default {
"15min": RESOLUTION_15MIN,
"1min": RESOLUTION_1MIN
},
RESOLUTION_HOURS: {
"week": 5880,
"day": 840,
"hour": 48,
"15min": 24,
"1min": 24
},
id: null,//元素主键
ele: null,//echarts对象
opt: null,
Expand Down Expand Up @@ -128,6 +135,7 @@ export default {
this.cleanData()
this.fetch();
this.fetchLastTrade()

},
cleanData(){
this.ele = null
Expand All @@ -138,14 +146,21 @@ export default {
this.tinterval = null
this.lasttime = null
},
getStartTime(){
let defHour = this.RESOLUTION_HOURS[this.resolution_key]
if(!defHour){
defHour = 24
}
return Number(moment().subtract(defHour,"hours").format('x'))
},
//请求api,获取数据
fetch(){
let start_time = null, end_time=null;
if(this.lasttime){
start_time = this.lasttime;
end_time = new Date().getTime()
}else{//初次请求,判断start是否存在
start_time = this.start < 0 ? Number(moment().subtract(48,"hours").format('x')) : this.start;
start_time = this.start < 0 ? this.getStartTime() : this.start;
end_time = this.end < 0 ? new Date().getTime() : this.end
}
getTradeAggregation(getAsset(this.base), getAsset(this.counter),
Expand Down