From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test
---
pages/task/log-list.vue | 43 ++++++++++++++++++++++++++-----------------
1 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/pages/task/log-list.vue b/pages/task/log-list.vue
index b1c6003..b222595 100644
--- a/pages/task/log-list.vue
+++ b/pages/task/log-list.vue
@@ -3,17 +3,17 @@
<view class="list-content" v-if="list.length > 0">
<view class="header">
<view class="item">
- <view class="title">{{totalDuration}}<text class="text">min</text></view>
- <view class="text">绱鏃堕暱</view>
+ <view class="title">{{totalDuration}}<text class="text">{{translate("minute")}}</text></view>
+ <view class="text">{{translate("cumulative_duration")}}</view>
</view>
<view class="item">
<view class="title">{{totalCount}}</view>
- <view class="text">绱娆℃暟</view>
+ <view class="text">{{translate("cumulative_count")}}</view>
</view>
</view>
<view class="list">
- <!-- <view class="task-header" v-if="fixedList.length > 0">鍥哄畾浠诲姟</view> -->
+ <!-- <view class="task-header" v-if="fixedList.length > 0">{{translate("fixed_task")}</view> -->
<template v-for="(group) in taskList" :key="group.date">
<view class="task-header">{{group.date}}</view>
<view class="task-list-view">
@@ -22,7 +22,7 @@
</TaskLogItemView>
</view>
</template>
- <!-- <view class="task-header" v-if="tempList.length > 0">涓存椂浠诲姟</view>
+ <!-- <view class="task-header" v-if="tempList.length > 0">{{translate("temporary_task")}</view>
<template v-for="(group) in tempList" :key="group.date">
<view class="task-header">{{group.date}}</view>
<view class="task-list-view">
@@ -37,7 +37,7 @@
<view class="list-no-content" v-else>
<!-- <image class="img" src="/images/icon-park-outline_attention.svg" alt=" 鍥剧墖" mode="aspectFit" />-->
<uni-icons color="#ccc" type="info" size="128"></uni-icons>
- <view class="space">娌℃湁鎵惧埌绗﹀悎鏉′欢鐨勪换鍔¤褰�/view>
+ <view class="space">{{translate("no_task_history_found")}}</view>
</view>
</view>
</template>
@@ -69,8 +69,9 @@
taskList() {
const listRes = []
this.list.forEach((ele) => {
- const dateStart = new Date(Number(ele.start_time))
- const date = `${dateStart.getMonth()}-${dateStart.getDay()}`;
+ const dateStart = new Date(parseInt(ele.start_time))
+
+ const date = `${dateStart.getMonth() +1}-${dateStart.getDate()}`;
const curIndex = listRes.findIndex((a) => a.date == date)
if (curIndex < 0) {
let group = {
@@ -121,13 +122,14 @@
// this.list.forEach((item) => {
// d += item.duration || 0
// })
+
this.list.forEach((item) => {
- d +=( item.end_time - item.start_time)
+ d += Math.ceil((item.end_time- item.start_time) / (60* 1000)) //(item.end_time - item.start_time)
})
- return Math.ceil(d / (60 * 1000))
+ return d//Math.ceil(d / (60 * 1000))
},
totalCount() {
- let cnt =this.list.length
+ let cnt = this.list.length
// this.list.forEach((item) => {
// cnt += item.list.length
// })
@@ -165,12 +167,15 @@
try {
this.list = await this.loadTaskLog()
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async loadTaskLog() {
try {
-
+
+ uni.showLoading({
+ title: this.translate("loading")
+ })
const now = new Date();
const oneWeekAgo = new Date();
const endTimeStamp = `${now.getTime()}`
@@ -182,13 +187,13 @@
list.sort((a, b) => {
return a.end_time < b.end_time ? 1 : -1
});
-
- showToast(`瑁呰浇浜�{list.length}璁板綍`)
return list
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
return []
- }
+ } finally {
+ uni.hideLoading()
+ }
},
clickTask(item) {
@@ -196,6 +201,10 @@
// url: "/pages/task/index"
// })
},
+ translate(t) {
+ if (typeof this.$t == "function") return this.$t(`page.${t}`)
+ else return t;
+ },
}
}
--
Gitblit v1.9.1