提交 3b600521 authored 作者: lihuihui's avatar lihuihui

修改时间

上级 cd1b6405
...@@ -111,13 +111,18 @@ export default { ...@@ -111,13 +111,18 @@ export default {
.getRecordsScore(param) .getRecordsScore(param)
.then(response => { .then(response => {
if (parseInt(response.code) === 0) { if (parseInt(response.code) === 0) {
const data1 = [] let data1 = []
const data2 = [] let data2 = []
if (!response.data.length) {
data1 = [0, 0, 0, 0, 0, 0, 0]
data2 = this.getDate7()
} else {
response.data.map((item, index) => { response.data.map((item, index) => {
data1.push(item.score) data1.push(item.score)
data2.push(this.getNowTime(item.date_index)) data2.push(this.getNowTime(item.date_index, 1))
}) })
if (data2.length > 1) { }
if (data1.length === 1) {
this.polar = { this.polar = {
dataZoom: [{ dataZoom: [{
type: 'inside', type: 'inside',
...@@ -189,7 +194,7 @@ export default { ...@@ -189,7 +194,7 @@ export default {
series: [{ series: [{
data: data1, data: data1,
type: 'line', type: 'line',
symbol: 'none', // symbol: 'none',
smooth: true, smooth: true,
itemStyle: { itemStyle: {
normal: { normal: {
...@@ -272,6 +277,7 @@ export default { ...@@ -272,6 +277,7 @@ export default {
series: [{ series: [{
data: data1, data: data1,
type: 'line', type: 'line',
symbol: 'none',
smooth: true, smooth: true,
itemStyle: { itemStyle: {
normal: { normal: {
...@@ -289,10 +295,24 @@ export default { ...@@ -289,10 +295,24 @@ export default {
.finally(() => { .finally(() => {
}) })
}, },
getDate7() {
const dateArray = []
const myDate = new Date()
myDate.setDate(myDate.getDate() - 7)
let dateTemp
const flag = 1
for (let i = 0; i < 7; i++) {
dateTemp = (myDate.getMonth() + 1) + '-' + myDate.getDate()
dateArray.push(dateTemp)
myDate.setDate(myDate.getDate() + flag)
}
return dateArray
},
getStyle(score) { getStyle(score) {
return `bottom: ${score.score / score.score_sum * 100}%` return `bottom: ${score.score / score.score_sum * 100}%`
}, },
getNowTime(n) { // s
getNowTime(n, n2) {
let dateTime = '' let dateTime = ''
const date = n === -7 ? new Date(new Date() - 7 * 24 * 3600 * 1000) : new Date() const date = n === -7 ? new Date(new Date() - 7 * 24 * 3600 * 1000) : new Date()
const yy = date.getFullYear() const yy = date.getFullYear()
...@@ -301,7 +321,11 @@ export default { ...@@ -301,7 +321,11 @@ export default {
const hh = date.getHours() const hh = date.getHours()
const mf = date.getMinutes() const mf = date.getMinutes()
const ss = date.getSeconds() const ss = date.getSeconds()
dateTime = n > 1 ? this.toDo(yy) + '-' + this.toDo(mm) + '-' + this.toDo(dd) : this.toDo(yy) + '-' + this.toDo(mm) + '-' + this.toDo(dd) + ' ' + this.toDo(hh) + ':' + this.toDo(mf) + ':' + this.toDo(ss) dateTime = n > 1
? n2
? this.toDo(mm) + '-' + this.toDo(dd)
: this.toDo(yy) + '-' + this.toDo(mm) + '-' + this.toDo(dd)
: this.toDo(yy) + '-' + this.toDo(mm) + '-' + this.toDo(dd) + ' ' + this.toDo(hh) + ':' + this.toDo(mf) + ':' + this.toDo(ss)
return dateTime return dateTime
}, },
toDo(n) { toDo(n) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论