yf_zd пре 5 година
родитељ
комит
74d8eacb79
2 измењених фајлова са 41 додато и 2 уклоњено
  1. 2 2
      config/index.js
  2. 39 0
      src/components/UserManger.vue

+ 2 - 2
config/index.js

@@ -12,7 +12,7 @@ module.exports = {
     proxyTable: {
       '/': {
         // target: 'http://192.168.1.120:8001/',
-        target: 'http://192.168.1.4:8000/',
+        target: 'http://192.168.1.8:8000/',
         changeOrigin: true,
         pathRewrite: {
           '': ''   //重写接口
@@ -20,7 +20,7 @@ module.exports = {
       },
     },
     // Various Dev Server settings
-    host: '192.168.1.12', // can be overwritten by process.env.HOST
+    host: '192.168.1.11', // can be overwritten by process.env.HOST
     port: 8000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,

+ 39 - 0
src/components/UserManger.vue

@@ -78,6 +78,14 @@
               >用户编辑</el-button
             >
             <el-button
+              size='small'
+              v-if="item.user_have_type == '1'" 
+              type="success"
+              @click="delUser(item.id, item.username)"
+              plain
+              >删除用户</el-button
+            >
+            <el-button
               type="success"
               @click="resetPassword(item.id, item.username)"
               plain
@@ -383,6 +391,37 @@ export default {
         this.editUserForm.user_area = value[1];
       }
     },
+     // 删除普通用户
+    delUser(id,name){
+        this.$confirm('删除用户, 是否继续?', '警告', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.$axios({
+            method: "POST",
+            url: "/del_user",
+            data: this.qs.stringify({
+              userid: id,
+            }),
+          }).then((res) => {
+            if (res.data == 1) {
+              this.getList();
+            } else {
+              this.$message({
+                type: 'error',
+                message: res.data
+              }); 
+            }
+          });
+        }).catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消删除'
+          });          
+        });
+        
+    },
     //密码重置
     resetPassword(id, name) {
       this.resetPassForm.id = id;