HZH-PC\HZH 3 years ago
parent
commit
7d0d95dd55

+ 5 - 1
src/components/ControlMainPage.vue

@@ -66,7 +66,11 @@
                 <i class="el-icon-setting"></i>
                 <span slot="title">试卷</span>
             </el-menu-item>
-            <el-menu-item index="3" @click="jumpState('/ctrlApp/ctrlMainPage/userList')">
+             <el-menu-item index="3" @click="jumpState('/ctrlApp/ctrlMainPage/issuePaperList')">
+                <i class="el-icon-setting"></i>
+                <span slot="title">组卷</span>
+            </el-menu-item>
+            <el-menu-item index="4" @click="jumpState('/ctrlApp/ctrlMainPage/userList')">
                 <i class="el-icon-setting"></i>
                 <span slot="title">用户</span>
             </el-menu-item>

+ 208 - 0
src/components/controlMainPage/IssuePaperList.vue

@@ -0,0 +1,208 @@
+<style lang="scss" scoped>
+table{
+  width: 100%;
+  thead{
+    color: #909399;
+    font-weight: 500;
+  }
+  tr{
+    background-color: #FFF;
+  }
+  th,td{
+    padding: 12px 0;
+    padding-left: 10px;
+    padding-right: 10px;
+    text-overflow: ellipsis;
+    vertical-align: middle;
+    border-bottom: 1px solid #EBEEF5;
+    a{
+      cursor: pointer;
+    }
+  }
+}
+.search-part{
+  padding: 5px 15px;
+  .add-user{
+    float: right;
+  }
+}
+.dialog-style{
+  div{
+    text-align: center;
+    margin: 5px;
+    /deep/ .el-input{
+      display: inline-block;
+      width: 200px;
+    }
+  }
+}
+.center-text{
+  text-align: center;
+}
+</style>
+<template>
+<div>
+  <div class="search-part">
+    <!-- <label>年级:</label>
+    <el-select v-model="search.grade" placeholder="请选择" @change="searchUser">
+      <el-option
+        v-for="item in gradeOptions"
+        :key="item.value"
+        :label="item.label"
+        :value="item.value">
+      </el-option>
+    </el-select> -->
+    <!-- <el-button icon="el-icon-search" circle @click="searchUser"></el-button> -->
+    <el-button type="primary" class="add-user" @click="visibleAdd = true">新增</el-button>
+  </div>
+  <table>
+    <thead>
+            <tr>
+                <th>序号</th>
+                <th>姓名</th>
+                <th>手机</th>
+                <!-- <th>email</th> -->
+                <th>学校</th>
+                <th>年级</th>
+                <th>操作</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr v-for="(item,index) in userList" :key="index">
+              <td>{{index + 1}}</td>
+              <td>{{item.name}}</td>
+              <td>{{item.username}}</td>
+              <!-- <td>{{item.email}}</td> -->
+              <td>{{item.region}}</td>
+              <td>{{gradeMap[item.grade]}}</td>
+              <td>
+                <a @click="visibleChange = true;changeUser.id = item.id">修改密码</a>
+                &nbsp;&nbsp;
+                <a @click="visibleDelete = true;deleteId = item.id">删除</a>
+              </td>
+            </tr>
+        </tbody>
+  </table>
+  <el-dialog
+        class="dialog-style"
+        title="编辑"
+        :visible.sync="visibleAdd"
+        width="500px">
+        <div>
+          <label>姓名:</label>
+          <el-input name="name" v-model="user.name" placeholder="请输入姓名" required="required"></el-input>
+        </div>
+        <div>
+          <label>年级:</label>
+          <el-select v-model="user.grade" placeholder="请选择">
+            <el-option
+              v-for="item in gradeOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </div>
+        <div>
+          <label>手机:</label>
+          <el-input v-model="user.username" placeholder="请输入手机" required="required"></el-input>
+        </div>
+        <div>
+          <label>密码:</label>
+          <el-input placeholder="请输入密码" v-model="user.password" show-password required="required"></el-input>
+        </div>
+        <span slot="footer" class="dialog-footer">
+            <el-button type="primary" @click="addUser">确 定</el-button>
+            <el-button type="primary" @click="visibleAdd = false">取消</el-button>
+        </span>
+    </el-dialog>
+    <el-dialog
+      title="提示"
+      :visible.sync="visibleDelete"
+      width="200px">
+      <p class="center-text">确认删除?</p>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="visibleDelete = false">取 消</el-button>
+        <el-button type="primary" @click="deleteUser">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      class="dialog-style"
+      title="修改密码"
+      :visible.sync="visibleChange"
+      width="500px">
+      <div>
+          <label>旧密码:</label>
+          <el-input placeholder="请输入旧密码" v-model="changeUser.oldPass" show-password required="required"></el-input>
+      </div>
+      <div>
+          <label>新密码:</label>
+          <el-input placeholder="请输入新密码" v-model="changeUser.newPass" show-password required="required"></el-input>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="visibleChange = false">取 消</el-button>
+        <el-button type="primary" @click="updateUser">确 定</el-button>
+      </span>
+    </el-dialog>
+</div>
+</template>
+
+<script>
+import { getUserList,addUser,updateUser,deleteUser } from '@/api/user';
+import { GRADE_OPTION, GRADE_MAP } from '@/services/constant';
+
+export default {
+  name: 'IssueList',
+  components: {
+  },
+  data () {
+      return {
+        userList:[],
+        user:{},
+        changeUser:{},
+        search:{
+          name:'',
+          grade:'',
+        },
+        deleteId: -1,
+        gradeOptions: GRADE_OPTION,
+        gradeMap: GRADE_MAP,
+
+        visibleAdd:false,
+        visibleDelete:false,
+        visibleChange:false,
+      }
+  },
+  created() {
+    this.searchUser();
+  },
+  methods: {
+    searchUser(){
+      getUserList(this.search.grade,this.search.name).then((result) => {
+        this.userList = result;
+      })
+    },
+    addUser(){
+      addUser(this.user).then((result) => {
+        alert(result.message);
+        this.visibleAdd = false
+        this.searchUser();
+      })
+    },
+    updateUser(){
+      updateUser(this.changeUser).then((result) => {
+        alert(result.message);
+        this.visibleChange = false
+        this.searchUser();
+      })
+    },
+    deleteUser(){
+      deleteUser(this.deleteId).then((result) => {
+        alert(result?'删除成功':'删除失败');
+        this.visibleDelete = false
+        this.searchUser();
+      })
+    }
+  }
+}
+</script>

+ 5 - 0
src/router/index.js

@@ -27,6 +27,7 @@ const PaperList = () => import(/* webpackChunkName: "group-controlApp"*/'@/compo
 const PaperListSimple = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/controlMainPage/PaperListSimple');
 const DocList = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/controlMainPage/DocList');
 const QuestionList = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/controlMainPage/docList/QuestionList');
+const IssuePaperList = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/controlMainPage/IssuePaperList');
 const UserList = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/controlMainPage/UserList');
 const FirstEdition = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/report/FirstEdition');
 const PDFTest = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/report/PDFTest');
@@ -155,6 +156,10 @@ export default new Router({
                 path: 'docList',
                 name: 'DocList',
                 component: DocList,
+            },{
+                path: 'issuePaperList',
+                name: 'IssuePaperList',
+                component: IssuePaperList,
             },{
                 path: 'questionList/:pid',
                 name: 'QuestionList',