DESKTOP-6NE3CFS\GAGABYTE 4 лет назад
Родитель
Сommit
a7848131bf

+ 1 - 1
.env.production

@@ -2,5 +2,5 @@
 ENV = 'production'
 
 # base api
-VUE_APP_BASE_API = '/prod-api'
+VUE_APP_BASE_API = '/'
 

BIN
public/favicon.ico


public/denglu.png → public/images/denglu.png


public/group-1.png → public/images/group-1.png


public/group-2.png → public/images/group-2.png


public/img-1.png → public/images/img-1.png


public/img-2.png → public/images/img-2.png


public/img-3.png → public/images/img-3.png


public/index-1.png → public/images/index-1.png


public/index-2.png → public/images/index-2.png


public/mima.png → public/images/mima.png


public/nav-1.png → public/images/nav-1.png


public/nav-2.png → public/images/nav-2.png


public/title.png → public/images/title.png


public/user-1.png → public/images/user-1.png


+ 16 - 19
src/api/getuser.js

@@ -18,28 +18,25 @@ export function createAdmin(data) {
 
 export function updateAdmin(data) {
   return request({
-    url: '/vue-element-admin/article/update',
+    url: '/ncjtEntranceGuard/updateUserAdmin',
     method: 'post',
     data
   })
 }
 
-// export function fetchAdmin(id) {
-//   return request({
-//     url: '/vue-element-admin/article/detail',
-//     method: 'get',
-//     params: {
-//       id
-//     }
-//   })
-// }
+export function deleteAdmin(data) {
+  return request({
+    url: '/ncjtEntranceGuard/deleteUserAdminById',
+    method: 'post',
+    data
+  })
+}
+
+export function searchList(query) {
+  return request({
+    url: '/ncjtEntranceGuard/searchUserAdminByName',
+    method: 'post',
+    params: query
+  })
+}
 
-// export function fetchPv(pv) {
-//   return request({
-//     url: '/vue-element-admin/article/pv',
-//     method: 'get',
-//     params: {
-//       pv
-//     }
-//   })
-// }

+ 4 - 4
src/api/user.js

@@ -2,8 +2,8 @@ import request from '@/utils/request'
 
 export function login(data) {
   return request({
-    // url: '/ncjtEntranceGuard/loginAdmin',
-    url: '/vue-element-admin/user/login',
+    url: '/ncjtEntranceGuard/loginAdmin',
+    // url: '/vue-element-admin/user/login',
     method: 'post',
     data
   })
@@ -11,8 +11,8 @@ export function login(data) {
 
 export function getInfo(token) {
   return request({
-    // url: '/ncjtEntranceGuard/getInfoAdmin',
-    url: '/vue-element-admin/user/info',
+    url: '/ncjtEntranceGuard/getInfoAdmin',
+    // url: '/vue-element-admin/user/info',
     method: 'get',
     params: { token }
   })

+ 0 - 167
src/layout/components/Navbar - 副本.vue

@@ -1,167 +0,0 @@
-<template>
-  <div class="navbar">
-    <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
-
-    <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
-
-    <div class="right-menu">
-      <template v-if="device!=='mobile'">
-        <search id="header-search" class="right-menu-item" />
-
-        <error-log class="errLog-container right-menu-item hover-effect" />
-
-        <screenfull id="screenfull" class="right-menu-item hover-effect" />
-
-        <el-tooltip content="Global Size" effect="dark" placement="bottom">
-          <size-select id="size-select" class="right-menu-item hover-effect" />
-        </el-tooltip>
-
-      </template>
-
-      <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
-        <div class="avatar-wrapper">
-          <img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
-          <i class="el-icon-caret-bottom" />
-        </div>
-        <el-dropdown-menu slot="dropdown">
-          <router-link to="/profile/index">
-            <el-dropdown-item>Profile</el-dropdown-item>
-          </router-link>
-          <router-link to="/">
-            <el-dropdown-item>首页</el-dropdown-item>
-          </router-link>
-          <a target="_blank" href="https://github.com/PanJiaChen/vue-element-admin/">
-            <el-dropdown-item>Github</el-dropdown-item>
-          </a>
-          <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
-            <el-dropdown-item>Docs</el-dropdown-item>
-          </a>
-          <el-dropdown-item divided @click.native="logout">
-            <span style="display:block;">登出</span>
-          </el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-    </div>
-  </div>
-</template>
-
-<script>
-import { mapGetters } from 'vuex'
-import Breadcrumb from '@/components/Breadcrumb'
-import Hamburger from '@/components/Hamburger'
-import ErrorLog from '@/components/ErrorLog'
-import Screenfull from '@/components/Screenfull'
-import SizeSelect from '@/components/SizeSelect'
-import Search from '@/components/HeaderSearch'
-
-export default {
-  components: {
-    Breadcrumb,
-    Hamburger,
-    ErrorLog,
-    Screenfull,
-    SizeSelect,
-    Search
-  },
-  computed: {
-    ...mapGetters([
-      'sidebar',
-      'avatar',
-      'device'
-    ])
-  },
-  methods: {
-    toggleSideBar() {
-      this.$store.dispatch('app/toggleSideBar')
-    },
-    async logout() {
-      await this.$store.dispatch('user/logout')
-      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-.navbar {
-  height: 50px;
-  overflow: hidden;
-  position: relative;
-  background: #fff;
-  box-shadow: 0 1px 4px rgba(0,21,41,.08);
-
-  .hamburger-container {
-    line-height: 46px;
-    height: 100%;
-    float: left;
-    cursor: pointer;
-    transition: background .3s;
-    -webkit-tap-highlight-color:transparent;
-
-    &:hover {
-      background: rgba(0, 0, 0, .025)
-    }
-  }
-
-  .breadcrumb-container {
-    float: left;
-  }
-
-  .errLog-container {
-    display: inline-block;
-    vertical-align: top;
-  }
-
-  .right-menu {
-    float: right;
-    height: 100%;
-    line-height: 50px;
-
-    &:focus {
-      outline: none;
-    }
-
-    .right-menu-item {
-      display: inline-block;
-      padding: 0 8px;
-      height: 100%;
-      font-size: 18px;
-      color: #5a5e66;
-      vertical-align: text-bottom;
-
-      &.hover-effect {
-        cursor: pointer;
-        transition: background .3s;
-
-        &:hover {
-          background: rgba(0, 0, 0, .025)
-        }
-      }
-    }
-
-    .avatar-container {
-      margin-right: 30px;
-
-      .avatar-wrapper {
-        margin-top: 5px;
-        position: relative;
-
-        .user-avatar {
-          cursor: pointer;
-          width: 40px;
-          height: 40px;
-          border-radius: 10px;
-        }
-
-        .el-icon-caret-bottom {
-          cursor: pointer;
-          position: absolute;
-          right: -20px;
-          top: 25px;
-          font-size: 12px;
-        }
-      }
-    }
-  }
-}
-</style>

+ 4 - 2
src/layout/components/Navbar.vue

@@ -3,7 +3,7 @@
 
     <div class="left-menu">
       <div class="navbar-img">
-        <img src="../../../public/title.png">
+        <img src="../../../public/images/title.png">
       </div>
       <div class="navbar-info">
         门禁设备管理平台
@@ -42,6 +42,7 @@
   import ErrorLog from '@/components/ErrorLog'
   import SizeSelect from '@/components/SizeSelect'
   import Search from '@/components/HeaderSearch'
+  import { removeToken } from '@/utils/auth' // gsk 添加
 
   export default {
     components: {
@@ -75,7 +76,8 @@
     },
     methods: {
       async logout() {
-        await this.$store.dispatch('user/logout')
+        //await this.$store.dispatch('user/logout')
+        removeToken()
         this.$router.push(`/login?redirect=${this.$route.fullPath}`)
       },
       dateFormat() {

+ 1 - 0
src/router/index.js

@@ -403,6 +403,7 @@ export const asyncRoutes = [
 
 const createRouter = () => new Router({
   // mode: 'history', // require service support
+  // mode: 'hash', // require service support
   scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes
 })

+ 2 - 1
src/utils/request.js

@@ -46,7 +46,7 @@ service.interceptors.response.use(
     const res = response.data
 
     // if the custom code is not 20000, it is judged as an error.
-    if (res.code !== 20000) {
+    if (res.code !== 200) {
       Message({
         message: res.error || 'Error',
         type: 'error',
@@ -78,6 +78,7 @@ service.interceptors.response.use(
       type: 'error',
       duration: 5 * 1000
     })
+    //return Promise.resolve()
     return Promise.reject(error)
   }
 )

+ 0 - 57
src/views/deviceManagement/index - 副本.vue

@@ -1,57 +0,0 @@
-<template>
-  <div class="app-container documentation-container">
-    <a class="document-btn" target="_blank" href="https://store.akveo.com/products/vue-java-admin-dashboard-spring?utm_campaign=akveo_store-Vue-Vue_demo%2Fgithub&utm_source=vue_admin&utm_medium=referral&utm_content=demo_English_button">Java backend integration</a>
-    <a class="document-btn" target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/">Documentation</a>
-    <a class="document-btn" target="_blank" href="https://github.com/PanJiaChen/vue-element-admin/">Github Repository</a>
-    <a class="document-btn" target="_blank" href="https://panjiachen.gitee.io/vue-element-admin-site/zh/">国内文档</a>
-    <dropdown-menu class="document-btn" :items="articleList" title="系列文章" />
-    <a class="document-btn" target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/zh/job/">内推招聘</a>
-  </div>
-</template>
-
-<script>
-import DropdownMenu from '@/components/Share/DropdownMenu'
-
-export default {
-  name: 'Documentation',
-  components: { DropdownMenu },
-  data() {
-    return {
-      articleList: [
-        { title: '基础篇', href: 'https://juejin.im/post/59097cd7a22b9d0065fb61d2' },
-        { title: '登录权限篇', href: 'https://juejin.im/post/591aa14f570c35006961acac' },
-        { title: '实战篇', href: 'https://juejin.im/post/593121aa0ce4630057f70d35' },
-        { title: 'vue-admin-template 篇', href: 'https://juejin.im/post/595b4d776fb9a06bbe7dba56' },
-        { title: 'v4.0 篇', href: 'https://juejin.im/post/5c92ff94f265da6128275a85' },
-        { title: '自行封装 component', href: 'https://segmentfault.com/a/1190000009090836' },
-        { title: '优雅的使用 icon', href: 'https://juejin.im/post/59bb864b5188257e7a427c09' },
-        { title: 'webpack4(上)', href: 'https://juejin.im/post/59bb864b5188257e7a427c09' },
-        { title: 'webpack4(下)', href: 'https://juejin.im/post/5b5d6d6f6fb9a04fea58aabc' }
-      ]
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-.documentation-container {
-  margin: 50px;
-  display: flex;
-  flex-wrap: wrap;
-  justify-content: flex-start;
-
-  .document-btn {
-    flex-shrink: 0;
-    display: block;
-    cursor: pointer;
-    background: black;
-    color: white;
-    height: 60px;
-    padding: 0 16px;
-    margin: 16px;
-    line-height: 60px;
-    font-size: 20px;
-    text-align: center;
-  }
-}
-</style>

+ 4 - 4
src/views/deviceManagement/index.vue

@@ -4,7 +4,7 @@
 
     <div class="head">
       <div class="head-img">
-        <img src="../../../public/img-1.png" />
+        <img src="../../../public/images/img-1.png" />
       </div>
       <div class="head-info">设备管理</div>
     </div>
@@ -22,7 +22,7 @@
 
       <div class="switch-button">
         <el-row>
-          <el-button type="primary" size="small" @click="handleCreate"><img src="../../../public/img-3.png" />添加
+          <el-button type="primary" size="small" @click="handleCreate"><img src="../../../public/images/img-3.png" />添加
           </el-button>
         </el-row>
 
@@ -105,7 +105,7 @@
               查看详情</el-button>
 
             <el-button @click="handleDelete(row, $index)" type="text" size="small" class="button"><img
-                src="../../../public/img-2.png" />删除</el-button>
+                src="../../../public/images/img-2.png" />删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -173,7 +173,7 @@
 
       <!-- <el-dialog title="提示" :visible.sync="dialogremove" width="30%" center>
         <div class="button-img" align="center">
-          <img src="../../../public/group-2.png" />
+          <img src="../../../public/images/group-2.png" />
         </div>
 
         <div class="button-info" align="center">

+ 80 - 27
src/views/groupManagement/index.vue

@@ -6,7 +6,7 @@
     <div class="nav">
       <div class="nav-head">
         <div class="head-img">
-          <img src="../../../public/group-1.png">
+          <img src="../../../public/images/group-1.png">
         </div>
         <div class="head-info">
           分组管理
@@ -22,8 +22,37 @@
         <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="40%" center>
           <el-form :model="form" ref="dataForm" :rules="rules">
 
-            <el-form-item label="分组名称" prop="name">
+            <el-form-item label="名称" prop="name" class="switch-button-item">
+              <el-col :span="12">
               <el-input v-model="form.name" autocomplete="off" placeholder="请输入分组名称"></el-input>
+              </el-col>
+            </el-form-item>
+
+            <!-- <el-form-item label="状态" prop="status">
+              <el-col :span="12">
+              <el-input v-model="form.status" autocomplete="off" disabled placeholder="请输入分组状态"></el-input>
+              </el-col>
+            </el-form-item> -->
+
+            <el-form-item label="地址" prop="address" class="switch-button-item">
+              <el-col :span="12">
+              <el-select v-model="form.address" placeholder="请选择分组地址" style="width: 100%">
+                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.label">
+                </el-option>
+              </el-select>
+              </el-col>
+            </el-form-item>
+
+            <el-form-item label="类型" prop="type" class="switch-button-item">
+              <el-col :span="12">
+              <el-input v-model="form.type" autocomplete="off" placeholder="请输入分组类型"></el-input>
+              </el-col>
+            </el-form-item>
+
+            <el-form-item label="描述" prop="comment" class="switch-button-item">
+              <el-col :span="12">
+              <el-input v-model="form.comment" autocomplete="off" placeholder="请输入分组描述"></el-input>
+              </el-col>
             </el-form-item>
 
           </el-form>
@@ -36,14 +65,14 @@
         <!-- 新建分组弹窗结束 -->
 
         <el-button type="text" size="small" class="remove" @click="handleGroupDelete"><img
-            src="../../../public/img-2.png">删除</el-button>
+            src="../../../public/images/img-2.png">删除</el-button>
 
         <!-- 删除弹窗区域开始 -->
 
         <!-- <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" center>
 
           <div class="button-img" align="center">
-            <img src="../../../public/group-2.png">
+            <img src="../../../public/images/group-2.png">
           </div>
 
           <div class="button-info" align="center">
@@ -66,8 +95,8 @@
       </div>
 
       <div class="nav-list">
-        <el-menu background-color="#fff" text-color="#333333" active-text-color="#3BAAFD" @select="handleSelect">
-          <el-menu-item v-for="item in list" :index=item.id>
+        <el-menu background-color="#fff" text-color="#333333" active-text-color="#3BAAFD" :default-active="active" @select="handleSelect">
+          <el-menu-item v-for="item in list" :index="item.id + '' " :key="item.id">
             <i class="el-icon-menu"></i>
             <span slot="title">{{item.name}}</span>
           </el-menu-item>
@@ -103,7 +132,7 @@
         性别:
         <span class="input-select">
           <el-select v-model="listQuery.sex" size="mini" placeholder="全部/男/女">
-            <el-option v-for="item in sexs" :key="item.value" :label="item.label" :value="item.value">
+            <el-option v-for="item in sexs" :key="item.value" :label="item.label" :value="item.label">
             </el-option>
           </el-select>
         </span>
@@ -161,14 +190,14 @@
             <template slot-scope="{ row, $index }">
               <el-button type="text" size="small" @click="dialogedit = true">编辑分组</el-button>
               <el-button @click="handleDelete(row, $index)" type="text" size="small" class="button"><img
-                  src="../../../public/img-2.png">删除</el-button>
+                  src="../../../public/images/img-2.png">删除</el-button>
 
               <!-- 编辑分组弹窗开始 -->
 
               <el-dialog title="编辑分组" :visible.sync="dialogedit" width="30%" center>
 
                 通行权限:
-                <el-select v-model="value" multiple filterable allow-create default-first-option placeholder="请选择分组"
+                <el-select v-model="value" multiple placeholder="请选择分组"
                   style="width:380px">
                   <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                   </el-option>
@@ -188,7 +217,7 @@
               <!-- <el-dialog title="提示" :visible.sync="dialogeremovefrom" width="30%" center>
 
                 <div class="button-img" align="center">
-                  <img src="../../../public/group-2.png">
+                  <img src="../../../public/images/group-2.png">
                 </div>
 
                 <div class="button-info" align="center">
@@ -259,14 +288,12 @@
           label: '科技园-3'
         }],
         form: {
+          id: undefined,
           name: '',
-          // region: '',
-          // date1: '',
-          // date2: '',
-          // delivery: false,
-          // type: [],
-          // resource: '',
-          // desc: ''
+          address: '',
+          type: '',
+          comment: '',
+          status: ''
         },
         listform: {
           id: '',
@@ -275,8 +302,8 @@
           identity: ''
         },
         textMap: {
-          update: "编辑",
-          create: "新建分组",
+          update: "编辑设备分组",
+          create: "新建设备分组",
         },
         rules: {
           name: [{
@@ -284,18 +311,34 @@
             message: "请输入分组名称",
             trigger: "change"
           }],
+          address: [{
+            required: true,
+            message: "请输入分组地址",
+            trigger: "change"
+          }],
+          type: [{
+            required: true,
+            message: "请输入分组类型",
+            trigger: "change"
+          }],
+          comment: [{
+            required: true,
+            message: "请输入分组描述",
+            trigger: "change"
+          }]
         },
         dialogStatus: "",
         list: [],
         dataList: [],
         total: 0,
+        active: '1',
         listQuery: {
           page: 1,
           limit: 8,
           name: '',
           sex: ''
         },
-        dataListQuery: 2,
+        dataListQuery: 1,
         show: false,
         dialogVisible: false,
         dialogedit: false,
@@ -362,13 +405,17 @@
       resetform() {
         this.form = {
           id: undefined,
-          name: ""
+          name: '',
+          address: '',
+          type: '',
+          comment: '',
+          status: '1'
         };
       },
       handleCreate() {
-        this.resetform();
         this.dialogFormVisible = true;
-        this.show = true
+        this.resetform();
+        this.show = true;
         this.dialogStatus = "create";
         this.$nextTick(() => {
           this.$refs["dataForm"].clearValidate();
@@ -394,11 +441,12 @@
         });
       },
       handleUpdate() {
-        this.form = Object.assign({}, name); // copy obj
-        // this.dataListQuery = id;
-        this.dialogStatus = "update";
+        // this.form = Object.assign({}, this.list);
+        this.form = Object.assign({}, this.list.default-active);  //获取当前光标所在的分组数据
+        // console.log(this.list.default-active)
         this.dialogFormVisible = true;
-        this.show = true
+        this.show = true;
+        this.dialogStatus = "update";
         this.$nextTick(() => {
           this.$refs["dataForm"].clearValidate();
         });
@@ -481,6 +529,11 @@
         }
       }
 
+      .switch-button-item {
+        margin-left: 170px;
+        margin-bottom: 50px;
+      }
+
       .nav-info {
         margin-left: 19px;
         margin-top: 46px;

+ 0 - 31
src/views/index/index - 副本.vue

@@ -1,31 +0,0 @@
-<template>
-  <div class="dashboard-container">
-    <component :is="currentRole" />
-  </div>
-</template>
-
-<script>
-import { mapGetters } from 'vuex'
-import adminDashboard from './admin'
-import editorDashboard from './editor'
-
-export default {
-  name: 'Dashboard',
-  components: { adminDashboard, editorDashboard },
-  data() {
-    return {
-      currentRole: 'adminDashboard'
-    }
-  },
-  computed: {
-    ...mapGetters([
-      'roles'
-    ])
-  },
-  created() {
-    if (!this.roles.includes('admin')) {
-      this.currentRole = 'editorDashboard'
-    }
-  }
-}
-</script>

+ 4 - 3
src/views/index/index.vue

@@ -3,7 +3,7 @@
 
     <div class="head">
       <div class="head-img">
-        <img src="../../../public/index-1.png">
+        <img src="../../../public/images/index-1.png">
       </div>
       <div class="head-info">
         首页
@@ -14,7 +14,7 @@
       条件:
       <div class="input">
         <el-select v-model="value" size="mini" placeholder="请选择楼栋">
-          <el-option v-for="item in list" :key="item.value" :label="item.name" :value="item.value">
+          <el-option v-for="item in list" :key="item.id" :label="item.name" :value="item.name">
           </el-option>
         </el-select>
       </div>
@@ -34,7 +34,7 @@
     <div class="add">
       <div class="add-title">累计通行(次)</div>
       <div class="add-img">
-        <img src="../../../public/index-2.png">
+        <img src="../../../public/images/index-2.png">
       </div>
       <div class="add-num">1458</div>
     </div>
@@ -81,6 +81,7 @@
         groupidlist: [],
         listQuery: [],
         groupidlistQuery: 1,
+        value: '一栋'
       }
     },
     created() {

+ 0 - 324
src/views/login/index-2.vue

@@ -1,324 +0,0 @@
-<template>
-  <div class="login-container">
-    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on" label-position="left">
-
-      <div class="title-container">
-        <h3 class="title">Login Form</h3>
-      </div>
-
-      <el-form-item prop="username">
-        <span class="svg-container">
-          <svg-icon icon-class="user" />
-        </span>
-        <el-input
-          ref="username"
-          v-model="loginForm.username"
-          placeholder="Username"
-          name="username"
-          type="text"
-          tabindex="1"
-          autocomplete="on"
-        />
-      </el-form-item>
-
-      <el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
-        <el-form-item prop="password">
-          <span class="svg-container">
-            <svg-icon icon-class="password" />
-          </span>
-          <el-input
-            :key="passwordType"
-            ref="password"
-            v-model="loginForm.password"
-            :type="passwordType"
-            placeholder="Password"
-            name="password"
-            tabindex="2"
-            autocomplete="on"
-            @keyup.native="checkCapslock"
-            @blur="capsTooltip = false"
-            @keyup.enter.native="handleLogin"
-          />
-          <span class="show-pwd" @click="showPwd">
-            <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
-          </span>
-        </el-form-item>
-      </el-tooltip>
-
-      <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
-
-      <div style="position:relative">
-        <div class="tips">
-          <span>Username : admin</span>
-          <span>Password : any</span>
-        </div>
-        <div class="tips">
-          <span style="margin-right:18px;">Username : editor</span>
-          <span>Password : any</span>
-        </div>
-
-        <el-button class="thirdparty-button" type="primary" @click="showDialog=true">
-          Or connect with
-        </el-button>
-      </div>
-    </el-form>
-
-    <el-dialog title="Or connect with" :visible.sync="showDialog">
-      Can not be simulated on local, so please combine you own business simulation! ! !
-      <br>
-      <br>
-      <br>
-      <social-sign />
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import { validUsername } from '@/utils/validate'
-import SocialSign from './components/SocialSignin'
-
-export default {
-  name: 'Login',
-  components: { SocialSign },
-  data() {
-    const validateUsername = (rule, value, callback) => {
-      if (!validUsername(value)) {
-        callback(new Error('Please enter the correct user name'))
-      } else {
-        callback()
-      }
-    }
-    const validatePassword = (rule, value, callback) => {
-      if (value.length < 6) {
-        callback(new Error('The password can not be less than 6 digits'))
-      } else {
-        callback()
-      }
-    }
-    return {
-      loginForm: {
-        username: 'admin',
-        password: '111111'
-      },
-      loginRules: {
-        username: [{ required: true, trigger: 'blur', validator: validateUsername }],
-        password: [{ required: true, trigger: 'blur', validator: validatePassword }]
-      },
-      passwordType: 'password',
-      capsTooltip: false,
-      loading: false,
-      showDialog: false,
-      redirect: undefined,
-      otherQuery: {}
-    }
-  },
-  watch: {
-    $route: {
-      handler: function(route) {
-        const query = route.query
-        if (query) {
-          this.redirect = query.redirect
-          this.otherQuery = this.getOtherQuery(query)
-        }
-      },
-      immediate: true
-    }
-  },
-  created() {
-    // window.addEventListener('storage', this.afterQRScan)
-  },
-  mounted() {
-    if (this.loginForm.username === '') {
-      this.$refs.username.focus()
-    } else if (this.loginForm.password === '') {
-      this.$refs.password.focus()
-    }
-  },
-  destroyed() {
-    // window.removeEventListener('storage', this.afterQRScan)
-  },
-  methods: {
-    checkCapslock(e) {
-      const { key } = e
-      this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
-    },
-    showPwd() {
-      if (this.passwordType === 'password') {
-        this.passwordType = ''
-      } else {
-        this.passwordType = 'password'
-      }
-      this.$nextTick(() => {
-        this.$refs.password.focus()
-      })
-    },
-    handleLogin() {
-      this.$refs.loginForm.validate(valid => {
-        if (valid) {
-          this.loading = true
-          this.$store.dispatch('user/login', this.loginForm)
-            .then(() => {
-              this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
-              this.loading = false
-            })
-            .catch(() => {
-              this.loading = false
-            })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    },
-    getOtherQuery(query) {
-      return Object.keys(query).reduce((acc, cur) => {
-        if (cur !== 'redirect') {
-          acc[cur] = query[cur]
-        }
-        return acc
-      }, {})
-    }
-    // afterQRScan() {
-    //   if (e.key === 'x-admin-oauth-code') {
-    //     const code = getQueryObject(e.newValue)
-    //     const codeMap = {
-    //       wechat: 'code',
-    //       tencent: 'code'
-    //     }
-    //     const type = codeMap[this.auth_type]
-    //     const codeName = code[type]
-    //     if (codeName) {
-    //       this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
-    //         this.$router.push({ path: this.redirect || '/' })
-    //       })
-    //     } else {
-    //       alert('第三方登录失败')
-    //     }
-    //   }
-    // }
-  }
-}
-</script>
-
-<style lang="scss">
-/* 修复input 背景不协调 和光标变色 */
-/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
-
-$bg:#283443;
-$light_gray:#fff;
-$cursor: #fff;
-
-@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
-  .login-container .el-input input {
-    color: $cursor;
-  }
-}
-
-/* reset element-ui css */
-.login-container {
-  .el-input {
-    display: inline-block;
-    height: 47px;
-    width: 85%;
-
-    input {
-      background: transparent;
-      border: 0px;
-      -webkit-appearance: none;
-      border-radius: 0px;
-      padding: 12px 5px 12px 15px;
-      color: $light_gray;
-      height: 47px;
-      caret-color: $cursor;
-
-      &:-webkit-autofill {
-        box-shadow: 0 0 0px 1000px $bg inset !important;
-        -webkit-text-fill-color: $cursor !important;
-      }
-    }
-  }
-
-  .el-form-item {
-    border: 1px solid rgba(255, 255, 255, 0.1);
-    background: rgba(0, 0, 0, 0.1);
-    border-radius: 5px;
-    color: #454545;
-  }
-}
-</style>
-
-<style lang="scss" scoped>
-$bg:#2d3a4b;
-$dark_gray:#889aa4;
-$light_gray:#eee;
-
-.login-container {
-  min-height: 100%;
-  width: 100%;
-  background-color: $bg;
-  overflow: hidden;
-
-  .login-form {
-    position: relative;
-    width: 520px;
-    max-width: 100%;
-    padding: 160px 35px 0;
-    margin: 0 auto;
-    overflow: hidden;
-  }
-
-  .tips {
-    font-size: 14px;
-    color: #fff;
-    margin-bottom: 10px;
-
-    span {
-      &:first-of-type {
-        margin-right: 16px;
-      }
-    }
-  }
-
-  .svg-container {
-    padding: 6px 5px 6px 15px;
-    color: $dark_gray;
-    vertical-align: middle;
-    width: 30px;
-    display: inline-block;
-  }
-
-  .title-container {
-    position: relative;
-
-    .title {
-      font-size: 26px;
-      color: $light_gray;
-      margin: 0px auto 40px auto;
-      text-align: center;
-      font-weight: bold;
-    }
-  }
-
-  .show-pwd {
-    position: absolute;
-    right: 10px;
-    top: 7px;
-    font-size: 16px;
-    color: $dark_gray;
-    cursor: pointer;
-    user-select: none;
-  }
-
-  .thirdparty-button {
-    position: absolute;
-    right: 0;
-    bottom: 6px;
-  }
-
-  @media only screen and (max-width: 470px) {
-    .thirdparty-button {
-      display: none;
-    }
-  }
-}
-</style>

+ 6 - 6
src/views/login/index.vue

@@ -2,7 +2,7 @@
   <div class="login-container">
     <div class="login-nav">
       <div class="login-nav-img">
-        <img src="../../../public/nav-2.png" />
+        <img src="../../../public/images/nav-2.png" />
       </div>
       <div class="login-nav-info">门禁设备管理平台</div>
 
@@ -21,7 +21,7 @@
           autocomplete="on"
         >
           <el-form-item class="login-form-item" prop="username">
-            <span><img src="../../../public/denglu.png" /></span>
+            <span><img src="../../../public/images/denglu.png" /></span>
             <el-input
               class="login-form-input"
               v-model="loginForm.username"
@@ -32,7 +32,7 @@
           </el-form-item>
 
           <el-form-item class="login-form-item" prop="password">
-            <span><img src="../../../public/mima.png" /></span>
+            <span><img src="../../../public/images/mima.png" /></span>
             <el-input
               class="login-form-input"
               type="password"
@@ -72,8 +72,8 @@ export default {
   components: { SocialSign },
   data() {
     const validateUsername = (rule, value, callback) => {
-      if (!validUsername(value)) {
-        callback(new Error("请输入您的账号"));
+      if (value.length < 5) {
+        callback(new Error("账号至少五位数"));
       } else {
         callback();
       }
@@ -172,7 +172,7 @@ export default {
   position: relative;
   width: 960px;
   height: 250px;
-  background: url(../../../public/nav-1.png) center center/100% 100%;
+  background: url(../../../public/images/nav-1.png) center center/100% 100%;
 }
 
 .login-nav-img {

+ 38 - 40
src/views/user/index.vue

@@ -4,7 +4,7 @@
 
     <div class="head">
       <div class="head-img">
-        <img src="../../../public/user-1.png" />
+        <img src="../../../public/images/user-1.png" />
       </div>
       <div class="head-info">账号管理</div>
     </div>
@@ -16,19 +16,19 @@
     <div class="user">
       条件:
       <div class="input">
-        <el-input v-model="listQuery.name" size="small" placeholder="请输入账号或昵称 " @keyup.enter.native="handleFilter">
+        <el-input v-model="listQuery.name" size="small" placeholder="请输入账号 " clearable @clear="getList" @keyup.enter.native="handleFilter">
         </el-input>
       </div>
 
       <div class="input-serch">
         <el-row>
-          <el-button size="small" type="primary" @click="handleFilter">搜索</el-button>
+          <el-button size="small" type="primary" v-model="listQuery.sort" @click="handleFilter">搜索</el-button>
         </el-row>
       </div>
 
       <div class="input-add">
         <el-row>
-          <el-button type="primary" size="small" @click="handleCreate"><img src="../../../public/img-3.png" />添加
+          <el-button type="primary" size="small" @click="handleCreate"><img src="../../../public/images/img-3.png" />添加
           </el-button>
 
           <!-- 添加弹窗区域开始 -->
@@ -51,7 +51,7 @@
 
               <el-form-item style="white-space: pre" label="密码:" class="switch-button-item" prop="password">
                 <el-col :span="12">
-                  <el-input v-model="temp.password" autocomplete="off" placeholder="请输入密码" style="width: 110%">
+                  <el-input v-model="temp.password" autocomplete="off" type="password" placeholder="请输入密码" style="width: 110%">
                   </el-input>
                 </el-col>
               </el-form-item>
@@ -86,41 +86,17 @@
           </template>
         </el-table-column>
 
-        <el-table-column label="密码" align="center">
+        <!-- <el-table-column label="密码" align="center">
           <template slot-scope="{ row }">
             <span>{{ row.password }}</span>
           </template>
-        </el-table-column>
+        </el-table-column> -->
 
         <el-table-column label="操作" align="center">
           <template slot-scope="{ row, $index }">
             <el-button type="text" size="small" @click="handleUpdate(row)">编辑</el-button>
             <el-button @click="handleDelete(row, $index)" type="text" size="small" class="button"><img
-                src="../../../public/img-2.png" />删除</el-button>
-
-            <!-- 删除区域开始 -->
-
-            <!-- <el-dialog
-              title="提示"
-              :visible.sync="dialogeremovefrom"
-              width="30%"
-              center
-            >
-              <div class="button-img" align="center">
-                <img src="../../../public/group-2.png" />
-              </div>
-
-              <div class="button-info" align="center">确定删除该账号吗?</div>
-
-              <span slot="footer">
-                <el-button type="primary" @click="handleDelete(row, $index)"
-                  >确 定</el-button
-                >
-                <el-button @click="dialogeremovefrom = false">取 消</el-button>
-              </span>
-            </el-dialog> -->
-
-            <!-- 删除区域结束 -->
+                src="../../../public/images/img-2.png" />删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -146,7 +122,9 @@
   import {
     createAdmin,
     updateAdmin,
+    deleteAdmin,
     fetchList,
+    searchList
     // fetchPv,
     // fetchAdmin
   } from "@/api/getuser";
@@ -156,6 +134,20 @@
       Pagination,
     },
     data() {
+      const validateUsername = (rule, value, callback) => {
+        if (value.length < 5) {
+          callback(new Error("账号至少五位数"));
+        } else {
+          callback();
+        }
+      };
+      const validatePassword = (rule, value, callback) => {
+        if (value.length < 6) {
+          callback(new Error("密码至少六位数"));
+        } else {
+          callback();
+        }
+      };
       return {
         list: [],
         total: 0,
@@ -186,18 +178,20 @@
         rules: {
           name: [{
             required: true,
-            message: "请输入昵称",
-            trigger: "change"
+            message: "账号至少五位数",
+            trigger: "change",
+            validator: validateUsername
           }],
           nickname: [{
             required: true,
-            message: "请输入账号",
+            message: "请输入昵称",
             trigger: "change"
           }, ],
           password: [{
             required: true,
-            message: "请输入密码",
-            trigger: "change"
+            message: "密码至少六位数",
+            trigger: "change",
+            validator: validatePassword
           }, ],
         },
       };
@@ -227,7 +221,7 @@
     methods: {
       handleDelete(row, index) {
         if (confirm('是否删除?')) {
-          createAdmin(this.list).then(() => {
+          deleteAdmin({id:row.id}).then(() => {
             this.$notify({
               title: "删除成功",
               type: "success",
@@ -267,6 +261,7 @@
                 type: "success",
                 duration: 2000,
               });
+              // this.getList();
             });
           }
         });
@@ -291,6 +286,7 @@
       },
       handleUpdate(row) {
         this.temp = Object.assign({}, row); // copy obj
+        this.temp.password = "";
         this.dialogStatus = "update";
         this.dialogFormVisible = true;
         this.$nextTick(() => {
@@ -298,8 +294,10 @@
         });
       },
       handleFilter() {
-        this.listQuery.page = 1;
-        this.getList();
+        searchList({name:this.listQuery.name}).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
       },
       getList() {
         fetchList(this.listQuery).then((response) => {

+ 11 - 11
vue.config.js

@@ -24,7 +24,7 @@ module.exports = {
    * In most cases please use '/' !!!
    * Detail: https://cli.vuejs.org/config/#publicpath
    */
-  publicPath: '/',
+  publicPath: './',
   outputDir: 'dist',
   assetsDir: 'static',
   lintOnSave: process.env.NODE_ENV === 'development',
@@ -36,16 +36,16 @@ module.exports = {
       warnings: false,
       errors: true
     },
-    before: require('./mock/mock-server.js')
-    // proxy:{
-    //   [process.env.VUE_APP_BASE_API]:{
-    //     target: 'http://192.168.31.162:8280',
-    //     changeOrigin:true,
-    //     pathRewrite:{
-    //       ['^'+ process.env.VUE_APP_BASE_API]: ''
-    //     }
-    //   }
-    // }
+    // before: require('./mock/mock-server.js')
+    proxy:{
+      [process.env.VUE_APP_BASE_API]:{
+        target: 'http://192.168.31.162:8280',
+        changeOrigin:true,
+        pathRewrite:{
+          ['^'+ process.env.VUE_APP_BASE_API]: ''
+        }
+      }
+    }
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that