Browse Source

✨ feat: 增加更新乐跑账号信息接口

Pchen. 2 months ago
parent
commit
e70c647407

+ 9 - 0
src/api/lepao.js

@@ -2,6 +2,7 @@ import request from '../utils/request'
 
 const api = {
   Account: '/Lepao/Account',
+  UpdateSelfAccount: '/Lepao/Account/UpdateSelfAccount',
   AdminAccount: '/Admin/Lepao/Account',
   Records: '/Lepao/Records',
   ChangeAutoRun: '/Lepao/ChangeAutoRun',
@@ -28,6 +29,14 @@ export function accountList (parameter) {
   })
 }
 
+export function updateSelfAccount (parameter) {
+  return request({
+    url: api.UpdateSelfAccount,
+    method: 'post',
+    data: parameter
+  })
+}
+
 export function adminAccountList (parameter) {
   return request({
     url: api.AdminAccount,

+ 6 - 6
src/pages/admin/lepaoAccount/accountList.vue

@@ -127,7 +127,7 @@
                 <template #notice_type="{ record }">
                     <span v-if="record.notice_type === 'email'"><icon-email /> {{ record.email ?? '未绑定' }}</span>
                     <span v-else-if="record.notice_type === 'bot'"><icon-robot /> {{ record.bot_account ?? '未绑定'
-                    }}</span>
+                        }}</span>
                     <span v-else><icon-notification-close /> 无通知</span>
                 </template>
                 <template #auto_day="{ record }">
@@ -261,7 +261,7 @@ const queryData = reactive({
     user_uuid: '',
     email: '',
     username: '',
-    bind_code:'',
+    bind_code: '',
     bot_account: '',
     state: -1,
     auto_time: 0,
@@ -346,6 +346,10 @@ const columns = [
         title: '乐跑跑区',
         dataIndex: 'area',
         width: 150
+    }, {
+        title: '帐号状态',
+        slotName: 'state',
+        width: 100
     }, {
         title: '自动乐跑',
         slotName: 'auto_run',
@@ -362,10 +366,6 @@ const columns = [
         title: '学期目标',
         slotName: 'num',
         width: 90
-    }, {
-        title: '帐号状态',
-        slotName: 'state',
-        width: 100
     }, {
         title: '手机型号',
         dataIndex: 'deviceModel',

+ 24 - 2
src/pages/lepao/accountList/index.vue

@@ -270,6 +270,7 @@
                   <a-doption @click="SingleRun(record)"><icon-play-circle /> 开始单次乐跑</a-doption>
                   <a-doption @click="ChangeAutoRun(record)"><icon-translate /> {{ record.auto_run ? '关闭' :
                     '开启' }}自动乐跑</a-doption>
+                  <a-doption @click="UpdateSelfAccount(record)"><icon-refresh /> 更新账号信息</a-doption>
                   <a-doption @click="DeleteAccount(record)"><icon-minus-circle /> 解绑账号</a-doption>
                 </template>
               </a-dropdown>
@@ -290,7 +291,7 @@
       <a-form-item field="notice_type" label="通知方式">
         <a-radio-group v-model="form.notice_type">
           <a-radio value="email"><icon-email /> 邮件</a-radio>
-          <a-radio value="bot"><icon-robot /> 智能机器人</a-radio>
+          <!-- <a-radio value="bot"><icon-robot /> 智能机器人</a-radio> -->
           <a-radio value="none"><icon-notification-close /> 无通知</a-radio>
         </a-radio-group>
       </a-form-item>
@@ -337,7 +338,7 @@
 
 <script setup>
 import { ref, reactive, onUnmounted, onMounted, h } from 'vue'
-import { accountList, deleteAccount, addAccount, changeAutoRun, singleRun } from '@/api/lepao'
+import { accountList, deleteAccount, addAccount, changeAutoRun, singleRun, updateSelfAccount } from '@/api/lepao'
 import { Modal, Notification, Message } from '@arco-design/web-vue'
 import { IconSearch } from '@arco-design/web-vue/es/icon'
 import userCard from '@/components/userCard/userCard.vue'
@@ -711,6 +712,27 @@ const ChangeAutoRun = async (record) => {
   }
 }
 
+const UpdateSelfAccount = async (record) => {
+  try {
+    const res = await updateSelfAccount({
+      student_num: record.student_num
+    })
+    if (!res || res.code !== 0) {
+      return Notification.error({
+        title: '更新账号信息失败!',
+        content: res?.msg ?? '请稍后再试'
+      })
+    }
+    Message.success('更新账号信息成功!')
+    getAccounts()
+  } catch (error) {
+    Notification.error({
+      title: '更新账号信息失败!',
+      content: error.message || '请稍后再试'
+    })
+  }
+}
+
 const stramptoTime = (time) => {
   return new Date(time).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })
 }