Browse Source

✨ feat: 更换随机乐跑时段

Pchen. 8 months ago
parent
commit
3f975beeed

+ 1 - 1
.env

@@ -1,4 +1,4 @@
 NODE_ENV=production
 VITE_APP_API_BASE_URL=https://lepao-api.xxoo365.top
 VITE_RSA_PUBLIC_KEY=LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF6Z1lGYzVRMGVqbTh4akZsSjdMSQpBZDJGeC9TalM0OWQ5emwyZHlaNzNDMGZLU3Fuc1pJQUZkREpWZWV6bUp6T1hOWFdoYVZHaHFwM0dCUWVvcDBKClIxekZ3bUs1em9ReElTTDc5WVF3SmxoSjdaellhL0xNcGtGZDRDVFQ4UzUwTGFzN1FpcUtqRE1BQjFLZEpaTnIKNE5HcjNUWVV4MVVpTzlUTW9YV3lBdFZRQVN2a3lFSVFIb3B4T2Vod0ZuNGRhVE8vLzF5TXRyNnZoclE4enJRMwpxUG01YWJmY0lRM3B1WDVJd1MrekRmSkI5Rm9rc0paa3RWNHI2KzM2U1E3WGp2MDFBQjJvK20yejZqNzNuWjQ1Ci95TEx5NmZHTG5lTWpTaUxHMDhNUWFCUjV1dTNITTRnMkpnanA4eU10Rkg1Tkc5Zys1dXRhTDNzd3JGQjhxd1UKdFFJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==
-VITE_APP_VERSION=1.4
+VITE_APP_VERSION=1.6

+ 19 - 16
src/pages/admin/lepaoAccount/accountList.vue

@@ -46,8 +46,8 @@
                             </a-col>
                             <a-col :span="8">
                                 <a-form-item field="auto_time" label="乐跑时段">
-                                    <a-select v-model="queryData.auto_time" placeholder="请选择自动乐跑时段" :default-value="-1">
-                                        <a-option :value="-1">所有时段</a-option>
+                                    <a-select v-model="queryData.auto_time" placeholder="请选择自动乐跑时段" :default-value="0">
+                                        <a-option :value="0">所有时段</a-option>
                                         <a-option v-for="(item, index) in auto_time" :key="index" :value="item.value">
                                             {{ item.label }}
                                         </a-option>
@@ -134,7 +134,7 @@
                     </div>
                 </template>
                 <template #auto_time="{ record }">
-                    {{ autoTimeLabel(record.auto_time) }}
+                    {{ autoTimeLabel(record) }}
                 </template>
                 <template #create_time="{ record }">
                     {{ stramptoTime(record.create_time) }}
@@ -209,7 +209,7 @@ const queryData = reactive({
     email: '',
     username: '',
     state: -1,
-    auto_time: -1
+    auto_time: 0
 })
 
 const pagination = reactive({
@@ -227,7 +227,7 @@ const form = reactive({
     distance: [2.00, 4.00],
     area: '',
     auto_run: 1,
-    auto_time: 8,
+    auto_time: -1,
     notes: ''
 })
 
@@ -240,7 +240,6 @@ const state = [
 const area = ["兰花湖校区跑区", "主校区北跑区", "主校区南跑区", "重庆工商大学茶园校区"]
 
 const columns = [
-
     {
         title: 'ID',
         dataIndex: 'id',
@@ -330,7 +329,7 @@ const reset = () => {
     queryData.email = ''
     queryData.username = ''
     queryData.state = -1
-    queryData.auto_time = -1
+    queryData.auto_time = 0
     getAccounts()
 }
 
@@ -517,16 +516,19 @@ const stramptoTime = (time) => {
     return new Date(time).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })
 }
 
-const auto_time = Array.from({ length: 17 }, (_, i) => {
-    const hour = i + 7
-    return {
-        label: `${hour} ~ ${hour + 1}时`,
-        value: hour
-    }
-})
+const auto_time = [
+    { label: '随机时段', value: -1 },
+    ...Array.from({ length: 17 }, (_, i) => {
+        const hour = i + 7
+        return { label: `${hour} ~ ${hour + 1}时`, value: hour }
+    })
+]
 
-const autoTimeLabel = (val) => {
-    const match = auto_time.find(item => item.value === val)
+const autoTimeLabel = (record) => {
+    if (record.auto_time === -1 && record.today_auto_time) {
+        return `随机-今日${record.today_auto_time}时`
+    }
+    const match = auto_time.find(item => item.value === record.auto_time)
     return match ? match.label : '-'
 }
 </script>
@@ -537,6 +539,7 @@ const autoTimeLabel = (val) => {
 }
 
 .table {
+    font-family: -apple-system, BlinkMacSystemFont;
     margin-top: 15px;
 
     .state {

+ 1 - 0
src/pages/admin/lepaoRecords/lepaoRecords.vue

@@ -247,6 +247,7 @@ getRecords()
 }
 
 .table {
+  font-family: -apple-system, BlinkMacSystemFont;
   margin-top: 15px;
 
   .state {

+ 21 - 17
src/pages/lepao/accountList/index.vue

@@ -66,7 +66,7 @@
               <a-col :span="8">
                 <a-form-item field="auto_time" label="乐跑时段">
                   <a-select v-model="queryDataForm.auto_time" placeholder="请选择自动乐跑时段" :default-value="-1">
-                    <a-option :value="-1">所有时段</a-option>
+                    <a-option :value="0">所有时段</a-option>
                     <a-option v-for="(item, index) in auto_time" :key="index" :value="item.value">
                       {{ item.label }}
                     </a-option>
@@ -191,9 +191,9 @@
               <a-tag color="red" v-else>关闭</a-tag>
             </template>
           </a-table-column>
-          <a-table-column title="自动乐跑时段" :width="120" ellipsis tooltip>
+          <a-table-column title="自动乐跑时段" :width="130" ellipsis tooltip>
             <template #cell="{ record }">
-              {{ autoTimeLabel(record.auto_time) }}
+              {{ autoTimeLabel(record) }}
             </template>
           </a-table-column>
           <a-table-column title="累计次数" :width="88" ellipsis tooltip>
@@ -297,7 +297,7 @@ const queryDataForm = reactive({
   email: '',
   username: '',
   state: -1,
-  auto_time: -1
+  auto_time: 0
 })
 const queryData = reactive({
   area: '',
@@ -305,7 +305,7 @@ const queryData = reactive({
   email: '',
   username: '',
   state: -1,
-  auto_time: -1
+  auto_time: 0
 })
 
 const pagination = reactive({
@@ -366,14 +366,14 @@ const reset = () => {
   queryDataForm.email = ''
   queryDataForm.username = ''
   queryDataForm.state = -1
-  queryDataForm.auto_time = -1
+  queryDataForm.auto_time = 0
 
   queryData.area = ''
   queryData.student_num = ''
   queryData.email = ''
   queryData.username = ''
   queryData.state = -1
-  queryData.auto_time = -1
+  queryData.auto_time = 0
 
   getAccountsAsync()
 }
@@ -391,15 +391,19 @@ const handlePageSizeChange = (size) => {
   getAccountsAsync()
 }
 
-const auto_time = Array.from({ length: 17 }, (_, i) => {
-  const hour = i + 7
-  return {
-    label: `${hour} ~ ${hour + 1}时`,
-    value: hour
+const auto_time = [
+  { label: '随机时段', value: -1 },
+  ...Array.from({ length: 17 }, (_, i) => {
+    const hour = i + 7
+    return { label: `${hour} ~ ${hour + 1}时`, value: hour }
+  })
+]
+
+const autoTimeLabel = (record) => {
+  if (record.auto_time === -1 && record.today_auto_time) {
+    return `随机-今日${record.today_auto_time}时`
   }
-})
-const autoTimeLabel = (val) => {
-  const match = auto_time.find(item => item.value === val)
+  const match = auto_time.find(item => item.value === record.auto_time)
   return match ? match.label : '-'
 }
 
@@ -414,7 +418,7 @@ const form = reactive({
   email: '',
   distance: [2.00, 4.00],
   area: '',
-  auto_time: 8,
+  auto_time: -1,
   auto_run: 1,
   notes: ''
 })
@@ -443,7 +447,7 @@ const editAccount = (item) => {
     form.student_num = ''
     form.email = ''
     form.auto_run = 1
-    form.auto_time = 8
+    form.auto_time = -1
     form.area = ''
     form.notes = ''
   }

+ 1 - 1
src/utils/request.js

@@ -12,7 +12,7 @@ const electron = isElectron()
 
 const request = axios.create({
   baseURL: import.meta.env.VITE_APP_API_BASE_URL,
-  timeout: 10000
+  timeout: 20000
 })
 
 const aesKeyCache = new LRUCache({