|
|
@@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<div class="pageContent taskWearing"> |
|
|
|
<NavBar title="佩戴任务" @on-click-left="$router.back()"></NavBar> |
|
|
|
<NavBar :title="title" @on-click-left="$router.back()"></NavBar> |
|
|
|
<div class="day"> |
|
|
|
<span>第</span> |
|
|
|
<span class="number">{{ activeIndex + 1 }}</span> |
|
|
@@ -11,16 +11,13 @@ |
|
|
|
class="timeBarItem" |
|
|
|
v-for="(item, index) in days" |
|
|
|
:key="index" |
|
|
|
:class="{ active: item.time >= standard, select: index === activeIndex }" |
|
|
|
:class="{ active: item.progress >= 1, select: index === activeIndex }" |
|
|
|
@click="activeIndex = index" |
|
|
|
></div> |
|
|
|
</div> |
|
|
|
<div class="wearingTime">{{ days[activeIndex] ? formateSeconds(days[activeIndex].time) : formateSeconds(0) }}</div> |
|
|
|
<div class="wearingTime">{{ days[activeIndex] ? days[activeIndex].value : '' }}</div> |
|
|
|
<div class="progress"> |
|
|
|
<div |
|
|
|
class="progressPoint" |
|
|
|
:style="`left: ${((days[activeIndex] ? days[activeIndex].time : 0) / standard) * 100}%`" |
|
|
|
></div> |
|
|
|
<div class="progressPoint" :style="`left: ${(days[activeIndex] ? days[activeIndex].progress : 0) * 100}%`"></div> |
|
|
|
<div class="progressBar"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@@ -28,57 +25,52 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import NavBar from '@/components/NavBar'; |
|
|
|
import develeopMent from '@/api/development'; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
NavBar |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
title: '任务', |
|
|
|
id: 1, |
|
|
|
rankId: 1, |
|
|
|
activeIndex: 0, |
|
|
|
standard: 0, |
|
|
|
days: [] |
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
let id = this.$route.params.id; |
|
|
|
let rankId = this.$route.params.rankId; |
|
|
|
if (id && rankId) { |
|
|
|
this.id = id; |
|
|
|
this.rankId = rankId; |
|
|
|
} else { |
|
|
|
this.$toast('参数错误'); |
|
|
|
setTimeout(() => { |
|
|
|
this.$router.back(); |
|
|
|
}, 2000); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.initData(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initData() { |
|
|
|
this.standard = 60 * 60 * 5; |
|
|
|
this.days = [ |
|
|
|
{ |
|
|
|
time: 60 * 60 * 5 |
|
|
|
}, |
|
|
|
{ |
|
|
|
time: 60 * 60 * 5 |
|
|
|
}, |
|
|
|
{ |
|
|
|
time: 60 * 60 * 5 |
|
|
|
}, |
|
|
|
{ |
|
|
|
time: 60 * 60 * 2 |
|
|
|
}, |
|
|
|
{ |
|
|
|
time: 60 * 60 * 5 |
|
|
|
}, |
|
|
|
{ |
|
|
|
time: 60 * 60 * 4 |
|
|
|
async initData() { |
|
|
|
let re = await develeopMent.TaskDetail({ |
|
|
|
id: this.id, |
|
|
|
rankId: this.rankId |
|
|
|
}); |
|
|
|
if (re) { |
|
|
|
if (re.succeed) { |
|
|
|
console.log(re.data); |
|
|
|
this.title = re.data.title; |
|
|
|
this.days = re.data.processDatas; |
|
|
|
this.activeIndex = this.days.length - 1; |
|
|
|
} else { |
|
|
|
this.$message.error(re.message); |
|
|
|
} |
|
|
|
]; |
|
|
|
|
|
|
|
this.activeIndex = this.days.length - 1; |
|
|
|
}, |
|
|
|
onSelect(type) { |
|
|
|
console.log(type); |
|
|
|
this.$refs[type + 'file'].click(); |
|
|
|
}, |
|
|
|
onChange(type) { |
|
|
|
const file = this.$refs[type + 'file'].files[0]; |
|
|
|
console.log(file); |
|
|
|
const formData = new FormData(); |
|
|
|
formData.append('file', file); |
|
|
|
formData.append('type', type); |
|
|
|
console.log(formData); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 秒转时分秒 |
|
|
|
formateSeconds(time) { |
|
|
@@ -158,7 +150,7 @@ export default { |
|
|
|
|
|
|
|
.wearingTime { |
|
|
|
color: #000; |
|
|
|
font-size: 90px; |
|
|
|
font-size: 65px; |
|
|
|
} |
|
|
|
|
|
|
|
.progress { |
|
|
|