diff --git a/src/App.vue b/src/App.vue index 94cae2c..07dd6dc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,3 +4,18 @@ + \ No newline at end of file diff --git a/src/api/coo.js b/src/api/coo.js new file mode 100644 index 0000000..aa4815e --- /dev/null +++ b/src/api/coo.js @@ -0,0 +1,24 @@ +//获取cookie、 +export function getCookie(name) { + var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); + if (arr = document.cookie.match(reg)) + return (arr[2]); + else + return null; +} + +//设置cookie,增加到vue实例方便全局调用 +export function setCookie(c_name, value, expiredays) { + var exdate = new Date(); + exdate.setDate(exdate.getDate() + expiredays); + document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); +}; + +//删除cookie +export function delCookie(name) { + var exp = new Date(); + exp.setTime(exp.getTime() - 1); + var cval = getCookie(name); + if (cval != null) + document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString(); +}; \ No newline at end of file diff --git a/src/assets/background.jpg b/src/assets/background.jpg new file mode 100644 index 0000000..14d8ff1 Binary files /dev/null and b/src/assets/background.jpg differ diff --git a/src/views/Login.vue b/src/views/Login.vue index 8a8dd2c..4dc004a 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -1,10 +1,13 @@ + + diff --git a/src/views/OuterAppDetail.vue b/src/views/OuterAppDetail.vue index ae2baa0..785d589 100644 --- a/src/views/OuterAppDetail.vue +++ b/src/views/OuterAppDetail.vue @@ -118,6 +118,18 @@ export default { created() { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) let school_id = $_GET('school_id', window.location.href); console.log(school_id); axios.get('http://localhost:8181/leaveDetail/findFromSIDTimeLimit/' + school_id + '/1/20').then(function (resp) { diff --git a/src/views/OuterAppForm.vue b/src/views/OuterAppForm.vue index f393cb5..e49da55 100644 --- a/src/views/OuterAppForm.vue +++ b/src/views/OuterAppForm.vue @@ -41,6 +41,18 @@ export default { submitInForm(formName) { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) let school_id = this.ruleForm.school_id; console.log(school_id); axios.get('http://localhost:8181/outDetail/findBySIDAndSetReturnTime/' + school_id).then(function (resp) { diff --git a/src/views/OuterHistory.vue b/src/views/OuterHistory.vue index d16547b..a13aa80 100644 --- a/src/views/OuterHistory.vue +++ b/src/views/OuterHistory.vue @@ -102,6 +102,18 @@ export default { created() { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/outDetail/findAndReturnOLDs/1/20').then(function (resp) { _this.tableData = resp.data _this.pageSize = 20 diff --git a/src/views/OuterUserIndex.vue b/src/views/OuterUserIndex.vue index 1211b59..3691e6f 100644 --- a/src/views/OuterUserIndex.vue +++ b/src/views/OuterUserIndex.vue @@ -43,6 +43,18 @@ export default { let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/userDetail/findById/' + id).then(function (resp) { _this.information = resp.data }) diff --git a/src/views/StudentAppForm.vue b/src/views/StudentAppForm.vue index 55889fb..fcf7db6 100644 --- a/src/views/StudentAppForm.vue +++ b/src/views/StudentAppForm.vue @@ -21,7 +21,7 @@ placeholder="选择日期时间"> - +

- + @@ -158,6 +158,22 @@ export default { }, mounted() { this.places = this.loadAll(); + }, + created() { + const _this = this + let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) } } diff --git a/src/views/StudentApplication.vue b/src/views/StudentApplication.vue index a7384d0..12f86bc 100644 --- a/src/views/StudentApplication.vue +++ b/src/views/StudentApplication.vue @@ -118,6 +118,18 @@ export default { created() { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/leaveDetail/findByNotType/已过期/' + id + '/1/20').then(function (resp) { console.log(axios.get('http://localhost:8181/leaveDetail/findByNotTypeNum/已过期/' + id + '/1/20')) _this.tableData = resp.data diff --git a/src/views/StudentHistory.vue b/src/views/StudentHistory.vue index 34579b9..95fe639 100644 --- a/src/views/StudentHistory.vue +++ b/src/views/StudentHistory.vue @@ -125,6 +125,18 @@ export default { created() { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/leaveDetail/findByType/已过期/' + id + '/1/20').then(function (resp) { console.log(resp.data) _this.tableData = resp.data diff --git a/src/views/StudentUserIndex.vue b/src/views/StudentUserIndex.vue index c909821..b923439 100644 --- a/src/views/StudentUserIndex.vue +++ b/src/views/StudentUserIndex.vue @@ -42,6 +42,18 @@ export default { let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/userDetail/findById/' + id).then(function (resp) { _this.information = resp.data }) diff --git a/src/views/TeacherApplication.vue b/src/views/TeacherApplication.vue index e553bbd..e7171a4 100644 --- a/src/views/TeacherApplication.vue +++ b/src/views/TeacherApplication.vue @@ -143,6 +143,18 @@ export default { created() { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/leaveDetail/findByTypeNoID/审核中/1/20').then(function (resp) { _this.tableData = resp.data _this.pageSize = 20 diff --git a/src/views/TeacherHistory.vue b/src/views/TeacherHistory.vue index d6a02e4..1948650 100644 --- a/src/views/TeacherHistory.vue +++ b/src/views/TeacherHistory.vue @@ -88,6 +88,18 @@ export default { created() { const _this = this let id = window.location.pathname.split('/')[3]; + let type = window.location.pathname.split('/')[2]; + axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { + if (resp.data != 'success') { + _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } + } + }) axios.get('http://localhost:8181/leaveDetail/findByNotTypeNoID/审核中/1/20').then(function (resp) { _this.tableData = resp.data _this.pageSize = 20 diff --git a/src/views/TeacherUserIndex.vue b/src/views/TeacherUserIndex.vue index 399e38c..7c4e34d 100644 --- a/src/views/TeacherUserIndex.vue +++ b/src/views/TeacherUserIndex.vue @@ -47,7 +47,14 @@ export default { axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) { if (resp.data != 'success') { _this.$router.push("/NoAuthority") + } else { + let login_id = _this.$cookieStore.getCookie("login_id") + console.log(login_id) + if (login_id != id) { + _this.$router.push("/NoAuthority") + } } + }) axios.get('http://localhost:8181/userDetail/findById/' + id).then(function (resp) { _this.information = resp.data