Browse Source

✨ feat: 增加账号时支持设置自动乐跑

Pchen. 9 months ago
parent
commit
4a5c080e1b

+ 8 - 2
src/pages/admin/lepaoAccount/accountList.vue

@@ -157,6 +157,9 @@
                     </a-option>
                 </a-select>
             </a-form-item>
+            <a-form-item field="auto_run" label="自动乐跑开关">
+                <a-switch v-model="form.auto_run" :checked-value="1" :unchecked-value="0" />
+            </a-form-item>
             <a-form-item field="area" label="自动乐跑时段">
                 <a-select v-model="form.auto_time" placeholder="请选择每天自动乐跑的时段" :options="auto_time" />
             </a-form-item>
@@ -196,11 +199,11 @@ const form = reactive({
     email: '',
     distance: [2.00, 4.00],
     area: '',
+    auto_run: 1,
     auto_time: 8,
     notes: ''
 })
 
-
 const loading = ref(false)
 const data = ref([])
 
@@ -335,11 +338,14 @@ const editAccount = (item) => {
         form.student_num = item.student_num
         form.email = item.email
         form.area = item.area
+        form.auto_run = item.auto_run
         form.auto_time = item.auto_time
         form.notes = item.notes
     } else {
         form.id = null
         form.student_num = ''
+        form.auto_run = 1
+        form.auto_time = 7
         form.email = email.value
         form.notes = ''
     }
@@ -397,7 +403,7 @@ const handleBeforeOk = async (done) => {
 }
 
 const handleCancel = () => {
-  visible.value = false;
+    visible.value = false;
 }
 
 // 分页 - 页码变化

+ 8 - 1
src/pages/lepao/accountList/index.vue

@@ -5,7 +5,7 @@
     <userCard />
 
     <a-card title="账号列表" style="margin-top: 15px;">
-      <a-button type="primary" size="large" @click="editAccount">
+      <a-button type="primary" size="large" @click="editAccount()">
         <template #icon>
           <icon-plus />
         </template>
@@ -203,6 +203,9 @@
           </a-option>
         </a-select>
       </a-form-item>
+      <a-form-item field="auto_run" label="自动乐跑开关">
+        <a-switch v-model="form.auto_run" :checked-value="1" :unchecked-value="0"/>
+      </a-form-item>
       <a-form-item field="area" label="自动乐跑时段">
         <a-select v-model="form.auto_time" placeholder="请选择每天自动乐跑的时段" :options="auto_time" />
       </a-form-item>
@@ -291,6 +294,7 @@ const form = reactive({
   distance: [2.00, 4.00],
   area: '',
   auto_time: 8,
+  auto_run: 1,
   notes: ''
 })
 
@@ -311,11 +315,14 @@ const editAccount = (item) => {
     form.email = item.email
     form.area = item.area
     form.auto_time = item.auto_time
+    form.auto_run = item.auto_run
     form.notes = item.notes
   } else {
     form.id = null
     form.student_num = ''
     form.email = email.value
+    form.auto_run = 1
+    form.auto_time = 7
     form.notes = ''
   }
   visible.value = true