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

修改时间

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