Browse Source

✨ feat: 完善重工乐跑

Pchen. 5 months ago
parent
commit
2dfe278013

+ 25 - 14
src/pages/admin/lepaoRecords/lepaoRecords.vue

@@ -95,42 +95,53 @@
             slotName: 'name-filter',
             slotName: 'name-filter',
             icon: () => h(IconSearch)
             icon: () => h(IconSearch)
           }"></a-table-column>
           }"></a-table-column>
-          <a-table-column title="状态" ellipsis tooltip :width="230">
+          <a-table-column title="状态" ellipsis tooltip :width="130">
             <template #cell="{ record }">
             <template #cell="{ record }">
               <div class="state">
               <div class="state">
-                <div class="circle one" v-if="record.result.record_failed_reason === '自动确认有效'"></div>
-                <div class="circle else" v-else></div>
-                {{ record.result.record_failed_reason }}
+                <div class="state" v-if="record.state === 0">
+                  <div class="circle zero"></div>乐跑进行中
+                </div>
+                <div class="state" v-else-if="record.state === 1">
+                  <div class="circle one"></div>乐跑成功
+                </div>
+                <div class="state" v-else>
+                  <div class="circle else"></div>乐跑失败
+                </div>
               </div>
               </div>
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="跑区" :filterable="{
           <a-table-column title="跑区" :filterable="{
-            filter: (value, record) => (record.result.pass_tit ?? '').includes(value),
+            filter: (value, record) => (record.area ?? '').includes(value),
             slotName: 'name-filter',
             slotName: 'name-filter',
             icon: () => h(IconSearch)
             icon: () => h(IconSearch)
-          }" :width="220">
+          }" :width="150">
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ record.result.pass_tit }}
+              {{ record.area }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="乐跑距离" :width="120" ellipsis tooltip>
           <a-table-column title="乐跑距离" :width="120" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ record.result.distance }} Km
+              {{ record.distance ? `${Number(record.distance).toFixed(2)} Km` : '' }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="跑步时长" :width="120" ellipsis tooltip>
           <a-table-column title="跑步时长" :width="120" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ formatSecondsToMinSec(record.result.time) }}
+              {{ record.distance ? formatSecondsToMinSec(record.time) : `预估10~20分钟` }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
-          <a-table-column title="平均配速" :width="120" ellipsis tooltip>
+          <a-table-column title="平均配速" :width="80" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ calculatePace(record.result.time, record.result.distance) }}
+              {{ record.distance ? calculatePace(record.time, record.distance) : '' }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
-          <a-table-column title="乐跑时间" :width="170" ellipsis tooltip>
+          <a-table-column title="开始时间" :width="145" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ stramptoTime(record.time) }}
+              {{ stramptoTime(record.startTime) }}
+            </template>
+          </a-table-column>
+          <a-table-column title="结束时间" :width="145" ellipsis tooltip>
+            <template #cell="{ record }">
+              {{ record.endTime ? stramptoTime(record.endTime) : '' }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="" :width="100" fixed="right">
           <a-table-column title="" :width="100" fixed="right">
@@ -264,7 +275,7 @@ getRecords()
     }
     }
 
 
     .zero {
     .zero {
-      background-color: rgb(var(--orange-6));
+      background-color: rgb(var(--blue-6));
     }
     }
 
 
     .one {
     .one {

+ 16 - 11
src/pages/admin/lepaoRecords/recordDetail.vue

@@ -9,7 +9,7 @@
                 </a-space>
                 </a-space>
             </a-skeleton>
             </a-skeleton>
             <a-descriptions :data="info" :column="2" />
             <a-descriptions :data="info" :column="2" />
-            <MapContainer v-if="showMap" :point_list="data.result.point_list" :log_list="data.point_data" :pathData="data.data" threeD
+            <MapContainer v-if="showMap" :pathData="data.path_data" threeD
                 style="margin-top: 10px;" />
                 style="margin-top: 10px;" />
         </a-card>
         </a-card>
     </div>
     </div>
@@ -41,21 +41,26 @@ const GetRecordDetail = async (id) => {
             })
             })
 
 
         data.value = res.data
         data.value = res.data
-        showMap.value = true
+        if (res.data.path_data && res.data.path_data.length > 0) {
+            showMap.value = true
+        }
 
 
         info.value = [
         info.value = [
             { label: '账号名称', value: res.data.name },
             { label: '账号名称', value: res.data.name },
-            { label: '乐跑账号', value: res.data.lepao_account },
-            { label: '跑区名称', value: res.data.result.pass_tit },
             { label: '路线ID', value: res.data.path_id },
             { label: '路线ID', value: res.data.path_id },
-            { label: '记录时间', value: stramptoTime(res.data.time) },
-            { label: '开始时间', value: stramptoTime(res.data.result.start_time * 1000) },
-            { label: '乐跑状态', value: res.data.result.record_failed_reason },
-            { label: '打卡点数量', value: res.data.result.point_list.length },
-            { label: '跑步距离', value: res.data.result.distance + ' Km' },
-            { label: '跑步时长', value: formatSecondsToMinSec(res.data.result.time) },
-            { label: '平均配速', value: calculatePace(res.data.result.time, res.data.result.distance) }
+            { label: '任务ID', value: res.data.task_id },
+            { label: '乐跑账号', value: res.data.lepao_account },
+            { label: '跑区名称', value: res.data.area },
+            { label: '开始时间', value: stramptoTime(res.data.startTime) },
+            { label: '乐跑状态', value: res.data.state === 0 ? '进行中' : res.data.state === 1 ? '乐跑成功' : '乐跑失败' }
         ]
         ]
+
+        if (res.data.distance) {
+            info.value.push({ label: '跑步时长', value: formatSecondsToMinSec(res.data.time) })
+            info.value.push({ label: '结束时间', value: stramptoTime(res.data.endTime) },)
+            info.value.push({ label: '跑步距离', value: res.data.distance + ' Km' })
+            info.value.push({ label: '平均配速', value: calculatePace(res.data.time, res.data.distance) })
+        }
     } catch (error) {
     } catch (error) {
         Notification.error({
         Notification.error({
             title: '获取路径数据失败!',
             title: '获取路径数据失败!',

+ 7 - 7
src/pages/lepao/accountList/index.vue

@@ -120,19 +120,19 @@
               {{ record.name ?? '请使用乐跑登录器更新账号信息' }}
               {{ record.name ?? '请使用乐跑登录器更新账号信息' }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
-          <!-- <a-table-column title="性别" :width="80" ellipsis tooltip :filterable="{
+          <a-table-column title="性别" :width="80" ellipsis tooltip :filterable="{
             filters: [
             filters: [
-              { text: '男', value: 1 },
-              { text: '女', value: 2 }
+              { text: '男', value: 0 },
+              { text: '女', value: 1 }
             ],
             ],
             filter: (value, record) => record.sex == value
             filter: (value, record) => record.sex == value
           }">
           }">
             <template #cell="{ record }">
             <template #cell="{ record }">
-              <icon-man v-if="record.sex === 1" />
-              <icon-woman v-else-if="record.sex === 2" />
-              {{ record.sex === 1 ? '男' : (record.sex === 2 ? '女' : '') }}
+              <icon-man v-if="record.sex === 0" />
+              <icon-woman v-else-if="record.sex === 1" />
+              {{ record.sex === 0 ? '男' : (record.sex === 1 ? '女' : '') }}
             </template>
             </template>
-          </a-table-column> -->
+          </a-table-column>
           <a-table-column title="年级" :width="80" data-index="grade_id" tooltip></a-table-column>
           <a-table-column title="年级" :width="80" data-index="grade_id" tooltip></a-table-column>
           <a-table-column title="跑区" :width="170">
           <a-table-column title="跑区" :width="170">
             <template #cell="{ record }">
             <template #cell="{ record }">

+ 19 - 14
src/pages/lepao/lepaoRecords/index.vue

@@ -78,7 +78,7 @@
               </div>
               </div>
             </template>
             </template>
           </a-table-column>
           </a-table-column>
-          <a-table-column title="学号" :width="120" data-index="lepao_account" ellipsis tooltip :filterable="{
+          <a-table-column title="学号" :width="80" data-index="lepao_account" ellipsis tooltip :filterable="{
             filter: (value, record) => (record.lepao_account ?? '').includes(value),
             filter: (value, record) => (record.lepao_account ?? '').includes(value),
             slotName: 'name-filter',
             slotName: 'name-filter',
             icon: () => h(IconSearch)
             icon: () => h(IconSearch)
@@ -97,42 +97,47 @@
             </template>
             </template>
 
 
           </a-table-column>
           </a-table-column>
-          <a-table-column title="状态" ellipsis tooltip :width="230">
+          <a-table-column title="状态" ellipsis tooltip :width="130">
             <template #cell="{ record }">
             <template #cell="{ record }">
               <div class="state">
               <div class="state">
-                <div class="circle one" v-if="record.result.record_failed_reason === '自动确认有效'"></div>
-                <div class="circle else" v-else></div>
-                {{ record.result.record_failed_reason }}
+                <div class="state" v-if="record.state === 0"><div class="circle zero"></div>乐跑进行中</div>
+                <div class="state" v-else-if="record.state === 1"><div class="circle one" ></div>乐跑成功</div>
+                <div class="state" v-else><div class="circle else" ></div>乐跑失败</div>
               </div>
               </div>
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="跑区" :filterable="{
           <a-table-column title="跑区" :filterable="{
-            filter: (value, record) => (record.result.pass_tit ?? '').includes(value),
+            filter: (value, record) => (record.area ?? '').includes(value),
             slotName: 'name-filter',
             slotName: 'name-filter',
             icon: () => h(IconSearch)
             icon: () => h(IconSearch)
-          }" :width="220">
+          }" :width="150">
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ record.result.pass_tit }}
+              {{ record.area }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="乐跑距离" :width="100" ellipsis tooltip>
           <a-table-column title="乐跑距离" :width="100" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ record.result.distance }} Km
+              {{ record.distance ? `${Number(record.distance).toFixed(2)} Km` : '' }} 
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="跑步时长" :width="100" ellipsis tooltip>
           <a-table-column title="跑步时长" :width="100" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ formatSecondsToMinSec(record.result.time) }}
+              {{ record.distance ? formatSecondsToMinSec(record.time) : `预估10~20分钟` }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="平均配速" :width="90" ellipsis tooltip>
           <a-table-column title="平均配速" :width="90" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ calculatePace(record.result.time, record.result.distance) }}
+              {{ record.distance ? calculatePace(record.time, record.distance): ''}}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
-          <a-table-column title="乐跑时间" :width="145" ellipsis tooltip>
+          <a-table-column title="开始时间" :width="145" ellipsis tooltip>
             <template #cell="{ record }">
             <template #cell="{ record }">
-              {{ stramptoTime(record.time) }}
+              {{ stramptoTime(record.startTime) }}
+            </template>
+          </a-table-column>
+           <a-table-column title="结束时间" :width="145" ellipsis tooltip>
+            <template #cell="{ record }">
+              {{ record.endTime ? stramptoTime(record.endTime) : '' }}
             </template>
             </template>
           </a-table-column>
           </a-table-column>
           <a-table-column title="" :width="100" fixed="right">
           <a-table-column title="" :width="100" fixed="right">
@@ -286,7 +291,7 @@ GetNotice()
     }
     }
 
 
     .zero {
     .zero {
-      background-color: rgb(var(--orange-6));
+      background-color: rgb(var(--blue-6));
     }
     }
 
 
     .one {
     .one {

+ 17 - 13
src/pages/lepao/lepaoRecords/recordDetail.vue

@@ -9,8 +9,7 @@
                 </a-space>
                 </a-space>
             </a-skeleton>
             </a-skeleton>
             <a-descriptions :data="info" :column="2" />
             <a-descriptions :data="info" :column="2" />
-            <MapContainer v-if="showMap" :point_list="data.result.point_list" :log_list="data.point_data" :pathData="data.data" threeD
-                style="margin-top: 10px;" />
+            <MapContainer v-if="showMap" :pathData="data.path_data" threeD style="margin-top: 10px;" />
         </a-card>
         </a-card>
     </div>
     </div>
 </template>
 </template>
@@ -36,28 +35,33 @@ const getRecordDetail = async (id) => {
         const res = await GetRecordDetail({ id })
         const res = await GetRecordDetail({ id })
         if (!res || res.code !== 0)
         if (!res || res.code !== 0)
             return Notification.error({
             return Notification.error({
-                title: '获取路径数据失败!',
+                title: '获取乐跑记录数据失败!',
                 content: res?.msg ?? '请稍后再试'
                 content: res?.msg ?? '请稍后再试'
             })
             })
 
 
         data.value = res.data
         data.value = res.data
-        showMap.value = true
+
+        if (res.data.path_data && res.data.path_data.length > 0) {
+            showMap.value = true
+        }
 
 
         info.value = [
         info.value = [
             { label: '账号名称', value: res.data.name },
             { label: '账号名称', value: res.data.name },
             { label: '乐跑账号', value: res.data.lepao_account },
             { label: '乐跑账号', value: res.data.lepao_account },
-            { label: '跑区名称', value: res.data.result.pass_tit },
-            { label: '记录时间', value: stramptoTime(res.data.time) },
-            { label: '开始时间', value: stramptoTime(res.data.result.start_time * 1000) },
-            { label: '乐跑状态', value: res.data.result.record_failed_reason },
-            { label: '打卡点数量', value: res.data.result.point_list.length },
-            { label: '跑步距离', value: res.data.result.distance + ' Km' },
-            { label: '跑步时长', value: formatSecondsToMinSec(res.data.result.time) },
-            { label: '平均配速', value: calculatePace(res.data.result.time, res.data.result.distance) }
+            { label: '跑区名称', value: res.data.area },
+            { label: '开始时间', value: stramptoTime(res.data.startTime) },
+            { label: '乐跑状态', value: res.data.state === 0 ? '进行中' : res.data.state === 1 ? '乐跑成功' : '乐跑失败' }
         ]
         ]
+
+        if (res.data.distance) {
+            info.value.push({ label: '跑步时长', value: formatSecondsToMinSec(res.data.time) })
+            info.value.push({ label: '结束时间', value: stramptoTime(res.data.endTime) },)
+            info.value.push({ label: '跑步距离', value: res.data.distance + ' Km' })
+            info.value.push({ label: '平均配速', value: calculatePace(res.data.time, res.data.distance) })
+        }
     } catch (error) {
     } catch (error) {
         Notification.error({
         Notification.error({
-            title: '获取路径数据失败!',
+            title: '获取乐跑记录数据失败!',
             content: error.message || '请稍后再试'
             content: error.message || '请稍后再试'
         })
         })
     } finally {
     } finally {