diff --git a/src/router/router.js b/src/router/router.js index 1a6952e..b2aacc6 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -27,7 +27,7 @@ const routes = [ { path: '/systemAdmin', name: '系统管理员', - component: SystemAdmin, + component: SystemAdmin , redirect: '/dormitoryAdminAdd', children:[ { @@ -35,11 +35,16 @@ const routes = [ name: '宿管管理', component: DormitoryAdminManager }, + { + path:'/', + redirect:'/login', + hidden:true + }, { path: '/dormitoryAdminAdd', name: '添加宿舍', component: DormitoryAdminAdd - }/* , + } , { path: '/dormitoryAdminUpdate', name: '修改宿舍', @@ -59,7 +64,7 @@ const routes = [ path: '/studentUpdate', name: '修改学生', component: StudentUpdate - }, + }/* , { path: '/buildingAdd', name: '添加楼宇', diff --git a/src/views/DormitoryAdminAdd.vue b/src/views/DormitoryAdminAdd.vue index a8a0a4d..663ccd5 100644 --- a/src/views/DormitoryAdminAdd.vue +++ b/src/views/DormitoryAdminAdd.vue @@ -12,10 +12,8 @@
-
@@ -64,8 +62,9 @@ const _this = this this.$refs[formName].validate((valid) => { if (valid) { - axios.post('http://localhost:8080/dormitoryAdmin/save',_this.ruleForm).then(function (resp) { - if(resp.data.code == 0){ + axios.post('http://localhost:8080/system/dormitoryAdmin/add',_this.ruleForm).then(function (resp) { + console.log(resp) + if(resp.data.code == 200){ _this.$alert(_this.ruleForm.username+'添加成功', '', { confirmButtonText: '确定', callback: action => { diff --git a/src/views/DormitoryAdminManager.vue b/src/views/DormitoryAdminManager.vue index eb1e080..acd99d0 100644 --- a/src/views/DormitoryAdminManager.vue +++ b/src/views/DormitoryAdminManager.vue @@ -1,6 +1,6 @@ @@ -109,9 +138,9 @@ if (valid) { const _this = this _this.ruleForm.page = _this.currentPage - axios.get('http://localhost:8080/dormitoryAdmin/search',{params:_this.ruleForm}).then(function (resp) { - _this.tableData = resp.data.data.data - _this.total = resp.data.data.total + axios.get('http://localhost:8080/system/dormitoryAdmin/search',{params:_this.ruleForm}).then(function (resp) { + _this.tableData = resp.data.content + _this.total = resp.data.totalElements }) } }); @@ -119,15 +148,16 @@ page(currentPage){ const _this = this if(_this.ruleForm.value == ''){ - axios.get('http://localhost:8080/dormitoryAdmin/list/'+currentPage+'/'+_this.pageSize).then(function (resp) { - _this.tableData = resp.data.data.data - _this.total = resp.data.data.total + axios.get('http://localhost:8080/system/dormitoryAdmin/list/'+currentPage+'/'+_this.pageSize).then(function (resp) { + _this.tableData = resp.data.content + _this.total = resp.data.totalElements }) } else { _this.ruleForm.page = _this.currentPage - axios.get('http://localhost:8080/dormitoryAdmin/search',{params:_this.ruleForm}).then(function (resp) { - _this.tableData = resp.data.data.data - _this.total = resp.data.data.total + axios.get('http://localhost:8080/system/dormitoryAdmin/search',{params:_this.ruleForm}).then(function (resp) { + _this.tableData = resp.data.content + _this.total = resp.data.totalElements + console.log(resp.data) }) } }, @@ -141,8 +171,8 @@ cancelButtonText: '取消', type: 'warning' }).then(() => { - axios.delete('http://localhost:8080/dormitoryAdmin/deleteById/'+row.id).then(function (resp) { - if(resp.data.code==0){ + axios.delete('http://localhost:8080/system/dormitoryAdmin/'+row.id).then(function (resp) { + if(resp.data.code==200){ _this.$alert('【'+row.username+'】已删除', '', { confirmButtonText: '确定', callback: action => { @@ -153,12 +183,13 @@ }); }); } - }, + }, created() { const _this = this - axios.get('http://localhost:8080/dormitoryAdmin/list/1/'+_this.pageSize).then(function (resp) { - _this.tableData = resp.data.data.data - _this.total = resp.data.data.total + axios.get('http://127.0.0.1:8080/system/dormitoryAdmin/list/1/'+_this.pageSize).then(function (resp) { + _this.tableData = resp.data.content + _this.total = resp.data.totalElements + console.log(resp.data) }) } } diff --git a/src/views/DormitoryAdminUpdate.vue b/src/views/DormitoryAdminUpdate.vue index 6ad49e8..5455b13 100644 --- a/src/views/DormitoryAdminUpdate.vue +++ b/src/views/DormitoryAdminUpdate.vue @@ -15,10 +15,10 @@
- +
@@ -67,8 +67,9 @@ const _this = this this.$refs[formName].validate((valid) => { if (valid) { - axios.put('http://localhost:8080/dormitoryAdmin/update',_this.ruleForm).then(function (resp) { - if(resp.data.code == 0){ + axios.put('http://localhost:8080/system/dormitoryAdmin/update',_this.ruleForm).then(function (resp) { + console.log(resp.data); + if(resp.data.code == 200){ _this.$alert(_this.ruleForm.username+'修改成功', '', { confirmButtonText: '确定', callback: action => { @@ -86,8 +87,9 @@ }, created() { const _this = this - axios.get('http://localhost:8080/dormitoryAdmin/findById/'+_this.$route.query.id).then(function (resp) { - _this.ruleForm = resp.data.data + axios.get('http://localhost:8080/system/dormitoryAdmin/findById/'+_this.$route.query.id).then(function (resp) { + _this.ruleForm = resp.data.data + console.log(resp.data.data) }) } } diff --git a/src/views/Login.vue b/src/views/Login.vue index a745f71..db4a781 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -25,10 +25,10 @@ this.logining = true let _this = this if(_this.type == 'dormitoryAdmin'){ - axios.get('http://localhost:8080/dormitoryAdmin/login', {params:_this.ruleForm}).then(function (resp) { + axios.get('http://localhost:8080/system/dormitoryAdmin/login', {params:_this.ruleForm}).then(function (resp) { console.log(resp) - _this.logining = false + _this.logining = false if(resp.data.code == -1){ _this.$alert('用户名不存在', '提示', { confirmButtonText: '确定' @@ -45,13 +45,13 @@ _this.$alert('宿舍管理员登录成功!','提示',{ confirmButtonText:'确定' }) - localStorage.setItem('dormitoryAdmin', JSON.stringify(resp.data.data)); - _this.$router.replace({path: '/dormitoryAdmin'}) + /* localStorage.setItem('dormitoryAdmin', JSON.stringify(resp.data.data)); + _this.$router.replace({path: '/dormitoryAdmin'}) */ } }) } if(_this.type == 'systemAdmin'){ - axios.get('http://localhost:8080/systemAdmin/login', {params:_this.ruleForm}).then(function (resp) { + axios.get('http://localhost:8080/system/systemAdmin/login', {params:_this.ruleForm}).then(function (resp) { _this.logining = false if(resp.data.code == -1){ _this.$alert('用户名不存在', '提示', { @@ -73,7 +73,7 @@ _this.$router.replace({path: '/systemAdmin'}) } }) - } + } } }) } diff --git a/src/views/StudentAdd.vue b/src/views/StudentAdd.vue index c63a12c..b09920e 100644 --- a/src/views/StudentAdd.vue +++ b/src/views/StudentAdd.vue @@ -9,10 +9,10 @@
- +
@@ -63,8 +63,8 @@ const _this = this this.$refs[formName].validate((valid) => { if (valid) { - axios.post('http://localhost:8080/student/save',_this.ruleForm).then(function (resp) { - if(resp.data.code == 0){ + axios.post('http://localhost:8080/system/student/save',_this.ruleForm).then(function (resp) { + if(resp.data.code == 200){ _this.$alert(_this.ruleForm.name+'添加成功', '', { confirmButtonText: '确定', callback: action => { @@ -82,7 +82,7 @@ }, created() { const _this = this - axios.get('http://localhost:8080/dormitory/availableList').then(function (resp) { + axios.get('http://localhost:8080/system/dormitory/available').then(function (resp) { _this.dormitoryList = resp.data.data }) } diff --git a/src/views/StudentManager.vue b/src/views/StudentManager.vue index 90e57ea..d597759 100644 --- a/src/views/StudentManager.vue +++ b/src/views/StudentManager.vue @@ -1,6 +1,6 @@ @@ -147,8 +166,8 @@ cancelButtonText: '取消', type: 'warning' }).then(() => { - axios.delete('http://localhost:8080/student/deleteById/'+row.id).then(function (resp) { - if(resp.data.code==0){ + axios.delete('http://127.0.0.1:8080/system/student/'+row.id).then(function (resp) { + if(resp.data.code==200){ _this.$alert('【'+row.name+'】已删除', '', { confirmButtonText: '确定', callback: action => { @@ -161,10 +180,10 @@ } }, created() { - const _this = this - axios.get('http://localhost:8080/student/list/1/'+_this.pageSize).then(function (resp) { - _this.tableData = resp.data.data.data - _this.total = resp.data.data.total + const _this = this + axios.get('http://localhost:8080/system/student/list/1/'+_this.pageSize).then(function (resp) { + _this.tableData = resp.data.content + _this.total = resp.data.totalElements }) } } diff --git a/src/views/SystemAdmin.vue b/src/views/SystemAdmin.vue index 6232ad6..32918b2 100644 --- a/src/views/SystemAdmin.vue +++ b/src/views/SystemAdmin.vue @@ -1,7 +1,7 @@