潜逃路由
This commit is contained in:
		
							parent
							
								
									fa7f15c180
								
							
						
					
					
						commit
						8019dd0949
					
				
							
								
								
									
										
											BIN
										
									
								
								src/assets/1.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/assets/1.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 328 KiB  | 
@ -23,8 +23,22 @@ const routes = [
 | 
			
		||||
    component: ()=> import("@/views/Login.vue")
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path:"/list",
 | 
			
		||||
    path:"/nav",
 | 
			
		||||
    component: ()=>import("@/views/DaoHang.vue"),
 | 
			
		||||
    children:[
 | 
			
		||||
      {
 | 
			
		||||
        path:"list",
 | 
			
		||||
        component: ()=> import("@/views/List.vue")
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        path:"addstu",
 | 
			
		||||
        component:()=>import("@/views/AddSTu.vue")
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        path:"stulist",
 | 
			
		||||
        component:()=>import("@/views/StuList.vue")
 | 
			
		||||
      },
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										89
									
								
								src/views/AddSTu.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								src/views/AddSTu.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,89 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="back">
 | 
			
		||||
        <!-- {{ $store.state.userinfo }} -->
 | 
			
		||||
        <div class="box">
 | 
			
		||||
            <div>
 | 
			
		||||
                <p>学生名:</p>
 | 
			
		||||
                <el-input v-model="user" placeholder="请输入用户名"></el-input>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div>
 | 
			
		||||
                <p>密码:</p>
 | 
			
		||||
                <el-input
 | 
			
		||||
                    v-model="pwd"
 | 
			
		||||
                    show-password
 | 
			
		||||
                    placeholder="请输入密码"
 | 
			
		||||
                ></el-input>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="button">
 | 
			
		||||
                <el-button @click="register" type="primary">添加</el-button>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.back {
 | 
			
		||||
    background-image: url("../assets/1.jpg");
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
    justify-content: center;
 | 
			
		||||
    background-size: cover;
 | 
			
		||||
}
 | 
			
		||||
.box {
 | 
			
		||||
    width: 400px;
 | 
			
		||||
    height: 200px;
 | 
			
		||||
    background-color: #fff;
 | 
			
		||||
    box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    flex-direction: column;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
    justify-content: space-around;
 | 
			
		||||
}
 | 
			
		||||
.box > div {
 | 
			
		||||
    width: 80%;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
}
 | 
			
		||||
.box > div > p {
 | 
			
		||||
    flex-shrink: 0;
 | 
			
		||||
    width: 80px;
 | 
			
		||||
}
 | 
			
		||||
.button {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    justify-content: flex-end;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
    data() {
 | 
			
		||||
        return {
 | 
			
		||||
            user: "",
 | 
			
		||||
            pwd: "",
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        register() {
 | 
			
		||||
            this.axios
 | 
			
		||||
                .get("/addstu", {
 | 
			
		||||
                    params: {
 | 
			
		||||
                        pwd: this.pwd,
 | 
			
		||||
                        user: this.user,
 | 
			
		||||
                    },
 | 
			
		||||
                })
 | 
			
		||||
                .then((res) => {
 | 
			
		||||
                    console.log(res.data);
 | 
			
		||||
                    if (res.data.code == 1) {
 | 
			
		||||
                        this.$message.error("添加失败");
 | 
			
		||||
                    } else {
 | 
			
		||||
                        this.$message({
 | 
			
		||||
                            message: "添加成功",
 | 
			
		||||
                            type: "success",
 | 
			
		||||
                        });
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										55
									
								
								src/views/DaoHang.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/views/DaoHang.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,55 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="box">
 | 
			
		||||
        <div>
 | 
			
		||||
            <el-menu
 | 
			
		||||
                default-active="2"
 | 
			
		||||
                class="el-menu-vertical-demo"
 | 
			
		||||
                @select="nav"
 | 
			
		||||
            >
 | 
			
		||||
                <el-menu-item index="list">
 | 
			
		||||
                    <i class="el-icon-menu"></i>
 | 
			
		||||
                    <span slot="title">用户列表</span>
 | 
			
		||||
                </el-menu-item>
 | 
			
		||||
                <el-submenu index="1">
 | 
			
		||||
                    <template slot="title">
 | 
			
		||||
                        <i class="el-icon-location"></i>
 | 
			
		||||
                        <span>学生管理</span>
 | 
			
		||||
                    </template>
 | 
			
		||||
                  
 | 
			
		||||
                    <el-menu-item index="stulist">学生列表</el-menu-item>
 | 
			
		||||
                    <el-menu-item index="addstu">添加学生</el-menu-item>
 | 
			
		||||
                    
 | 
			
		||||
                </el-submenu>
 | 
			
		||||
                
 | 
			
		||||
            </el-menu>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div>
 | 
			
		||||
            <router-view></router-view>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.box {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    width: 100vw;
 | 
			
		||||
    height: 100vh;
 | 
			
		||||
}
 | 
			
		||||
.box > div:first-child {
 | 
			
		||||
    width: 200px;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    flex-shrink: 0;
 | 
			
		||||
}
 | 
			
		||||
.box > div:last-child{
 | 
			
		||||
    width: 100%;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
    methods:{
 | 
			
		||||
        nav(index){
 | 
			
		||||
            console.log(index)
 | 
			
		||||
            this.$router.push("/nav/" + index)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div>
 | 
			
		||||
    <div class="box">
 | 
			
		||||
        <el-table :data="tableData" style="width: 100%">
 | 
			
		||||
            <el-table-column prop="num_key" label="ID" width="180">
 | 
			
		||||
            </el-table-column>
 | 
			
		||||
@ -22,7 +22,6 @@
 | 
			
		||||
            title="提示"
 | 
			
		||||
            :visible.sync="dialogVisible"
 | 
			
		||||
            width="30%"
 | 
			
		||||
            :before-close="handleClose"
 | 
			
		||||
        >
 | 
			
		||||
        
 | 
			
		||||
            <div>
 | 
			
		||||
@ -47,6 +46,9 @@
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.box{
 | 
			
		||||
    width: 100%;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										104
									
								
								src/views/StuList.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								src/views/StuList.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,104 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div>
 | 
			
		||||
        <el-table :data="tableData" style="width: 100%">
 | 
			
		||||
            <el-table-column prop="num_key" label="ID" width="180">
 | 
			
		||||
            </el-table-column>
 | 
			
		||||
            <el-table-column prop="user" label="用户名" width="180">
 | 
			
		||||
            </el-table-column>
 | 
			
		||||
            <el-table-column width="180" prop="pwd" label="密码">
 | 
			
		||||
            </el-table-column>
 | 
			
		||||
            <el-table-column label="操作">
 | 
			
		||||
                <template slot-scope="scope">
 | 
			
		||||
                    <el-button size="mini" @click="del(scope.row.num_key)"
 | 
			
		||||
                        >删除</el-button
 | 
			
		||||
                    >
 | 
			
		||||
                    <el-button size="mini" @click="up(scope.row.num_key,scope.$index)"
 | 
			
		||||
                        >修改</el-button
 | 
			
		||||
                    >
 | 
			
		||||
                </template>
 | 
			
		||||
            </el-table-column>
 | 
			
		||||
        </el-table>
 | 
			
		||||
        <el-dialog
 | 
			
		||||
            title="提示"
 | 
			
		||||
            :visible.sync="dialogVisible"
 | 
			
		||||
            width="30%"
 | 
			
		||||
        >
 | 
			
		||||
        
 | 
			
		||||
            <div>
 | 
			
		||||
                <p>用户名:</p>
 | 
			
		||||
                <el-input v-model="user" placeholder="请输入用户名"></el-input>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div>
 | 
			
		||||
                <p>密码:</p>
 | 
			
		||||
                <el-input
 | 
			
		||||
                    v-model="pwd"
 | 
			
		||||
                    show-password
 | 
			
		||||
                    placeholder="请输入密码"
 | 
			
		||||
                ></el-input>
 | 
			
		||||
            </div>
 | 
			
		||||
            <span slot="footer" class="dialog-footer">
 | 
			
		||||
                <el-button @click="dialogVisible = false">取 消</el-button>
 | 
			
		||||
                <el-button type="primary" @click="set"
 | 
			
		||||
                    >确 定</el-button
 | 
			
		||||
                >
 | 
			
		||||
            </span>
 | 
			
		||||
        </el-dialog>
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
</style>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
    data() {
 | 
			
		||||
        return {
 | 
			
		||||
            tableData: [],
 | 
			
		||||
            dialogVisible: false,
 | 
			
		||||
            user:"",
 | 
			
		||||
            pwd:"",
 | 
			
		||||
            id:""
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
        this.getlist();
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        del(id) {
 | 
			
		||||
            this.axios
 | 
			
		||||
                .get("/delstu", {
 | 
			
		||||
                    params: {
 | 
			
		||||
                        id,
 | 
			
		||||
                    },
 | 
			
		||||
                })
 | 
			
		||||
                .then((res) => {
 | 
			
		||||
                    console.log(res.data);
 | 
			
		||||
                    this.getlist();
 | 
			
		||||
                });
 | 
			
		||||
        },
 | 
			
		||||
        getlist() {
 | 
			
		||||
            this.axios.get("/getstulist").then((res) => {
 | 
			
		||||
                console.log(res.data);
 | 
			
		||||
                this.tableData = res.data.data;
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        up(id,index){
 | 
			
		||||
            this.dialogVisible = true
 | 
			
		||||
            this.id = id
 | 
			
		||||
            this.pwd = this.tableData[index].pwd
 | 
			
		||||
            this.user = this.tableData[index].user
 | 
			
		||||
 | 
			
		||||
        },
 | 
			
		||||
        set(){
 | 
			
		||||
            this.axios.post("/upstu",{
 | 
			
		||||
                user: this.user,
 | 
			
		||||
                pwd: this.pwd,
 | 
			
		||||
                id: this.id
 | 
			
		||||
            }).then((res)=>{
 | 
			
		||||
                console.log(res.data)
 | 
			
		||||
                this.getlist()
 | 
			
		||||
            this.dialogVisible = false
 | 
			
		||||
                
 | 
			
		||||
            })
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user