|
@@ -142,7 +142,7 @@
|
|
|
</a-table-column>
|
|
</a-table-column>
|
|
|
<a-table-column title="" :width="100" fixed="right">
|
|
<a-table-column title="" :width="100" fixed="right">
|
|
|
<template #cell="{ record }">
|
|
<template #cell="{ record }">
|
|
|
- <a-button @click="$router.push(`/lepao/recordDetail/${record.id}`)">查看详情</a-button>
|
|
|
|
|
|
|
+ <a-button @click="$router.push(`/lepao/recordDetail/${record.id}`)" v-if="record.state === 1">查看详情</a-button>
|
|
|
</template>
|
|
</template>
|
|
|
</a-table-column>
|
|
</a-table-column>
|
|
|
</template>
|
|
</template>
|
|
@@ -153,7 +153,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref, reactive, h } from 'vue'
|
|
|
|
|
|
|
+import { ref, reactive, onUnmounted, onMounted, h } from 'vue'
|
|
|
import { lepaoRecords } from '@/api/lepao'
|
|
import { lepaoRecords } from '@/api/lepao'
|
|
|
import { Notification } from '@arco-design/web-vue'
|
|
import { Notification } from '@arco-design/web-vue'
|
|
|
import { IconSearch } from '@arco-design/web-vue/es/icon'
|
|
import { IconSearch } from '@arco-design/web-vue/es/icon'
|
|
@@ -206,9 +206,14 @@ const reset = () => {
|
|
|
getRecords()
|
|
getRecords()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const getRecordsAsync = async () => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ await getRecords()
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const getRecords = async () => {
|
|
const getRecords = async () => {
|
|
|
try {
|
|
try {
|
|
|
- loading.value = true
|
|
|
|
|
const reqData = {
|
|
const reqData = {
|
|
|
...queryData,
|
|
...queryData,
|
|
|
pagesize: pagination.pagesize,
|
|
pagesize: pagination.pagesize,
|
|
@@ -227,8 +232,6 @@ const getRecords = async () => {
|
|
|
title: '获取乐跑记录失败!',
|
|
title: '获取乐跑记录失败!',
|
|
|
content: error.message || '请稍后再试'
|
|
content: error.message || '请稍后再试'
|
|
|
})
|
|
})
|
|
|
- } finally {
|
|
|
|
|
- loading.value = false
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -246,7 +249,7 @@ const handlePageSizeChange = (size) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const stramptoTime = (time) => {
|
|
const stramptoTime = (time) => {
|
|
|
- return new Date(time).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })
|
|
|
|
|
|
|
+ return new Date(time).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit' })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function calculatePace(seconds, kilometers) {
|
|
function calculatePace(seconds, kilometers) {
|
|
@@ -264,8 +267,36 @@ function formatSecondsToMinSec(totalSeconds) {
|
|
|
return `${minutes}分${seconds.toString().padStart(2, '0')}秒`;
|
|
return `${minutes}分${seconds.toString().padStart(2, '0')}秒`;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-getRecords()
|
|
|
|
|
-GetNotice()
|
|
|
|
|
|
|
+let timer = null
|
|
|
|
|
+
|
|
|
|
|
+// 轮询
|
|
|
|
|
+const startPolling = () => {
|
|
|
|
|
+ if (!timer) {
|
|
|
|
|
+ timer = setInterval(async () => {
|
|
|
|
|
+ await getRecords()
|
|
|
|
|
+ }, 5000)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 停止轮询
|
|
|
|
|
+const stopPolling = () => {
|
|
|
|
|
+ if (timer) {
|
|
|
|
|
+ clearInterval(timer)
|
|
|
|
|
+ timer = null
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ getRecordsAsync()
|
|
|
|
|
+ GetNotice()
|
|
|
|
|
+ startPolling()
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// 组件销毁时停止轮询
|
|
|
|
|
+onUnmounted(() => {
|
|
|
|
|
+ stopPolling()
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
<style scoped lang="less">
|