Browse Source

feat: user check

lejianwen 8 months ago
parent
commit
269bd0fd87
2 changed files with 27 additions and 0 deletions
  1. 1 0
      src/views/login/login.vue
  2. 26 0
      src/views/user/index.vue

+ 1 - 0
src/views/login/login.vue

@@ -87,6 +87,7 @@
87 87
     if (!res.code) {
88 88
       ElMessage.success(T('LoginSuccess'))
89 89
       router.push({ path: redirect || '/', replace: true })
90
+      return
90 91
     }
91 92
     if (res.code === 110) {
92 93
       // need captcha

+ 26 - 0
src/views/user/index.vue

@@ -23,6 +23,15 @@
23 23
             <span v-else> - </span>
24 24
           </template>
25 25
         </el-table-column>
26
+        <el-table-column :label="T('Status')" align="center">
27
+          <template #default="{row}">
28
+            <el-switch v-model="row.status"
29
+                       :active-value="ENABLE_STATUS"
30
+                       :inactive-value="DISABLE_STATUS"
31
+                       @change="changeStatus(row)"
32
+            ></el-switch>
33
+          </template>
34
+        </el-table-column>
26 35
         <el-table-column prop="created_at" :label="T('CreatedAt')" align="center"/>
27 36
         <el-table-column prop="updated_at" :label="T('UpdatedAt')" align="center"/>
28 37
         <el-table-column :label="T('Actions')" align="center" width="650">
@@ -51,6 +60,9 @@
51 60
 <script setup>
52 61
   import { useRepositories, useDel, useToEditOrAdd, useChangePwd } from '@/views/user/composables'
53 62
   import { T } from '@/utils/i18n'
63
+  import { DISABLE_STATUS, ENABLE_STATUS } from '@/utils/common_options'
64
+  import { update } from '@/api/user'
65
+  import { ElMessageBox, ElMessage } from 'element-plus'
54 66
   //列表
55 67
   const {
56 68
     listRes,
@@ -72,6 +84,20 @@
72 84
     }
73 85
   }
74 86
 
87
+  const changeStatus = async (row) => {
88
+    /*const confirm = await ElMessageBox.confirm(T('Confirm?', { param: T('Update') }), {
89
+      confirmButtonText: T('Confirm'),
90
+      cancelButtonText: T('Cancel'),
91
+    }).catch(_ => false)
92
+    if (!confirm) {
93
+      return false
94
+    }*/
95
+    const res = await update(row).catch(_ => false)
96
+    if (res) {
97
+      ElMessage.success(T('OperationSuccess'))
98
+      getList(listQuery)
99
+    }
100
+  }
75 101
 
76 102
 </script>
77 103