master
markma 3 years ago
parent 2fd19fe149
commit b9606c77c0

@ -4,3 +4,18 @@
<router-view></router-view>
</div>
</template>
<script>
import Vue from 'vue'
import {delCookie, getCookie, setCookie} from './api/coo.js';
//
export default {
name: 'App',
beforeMount() {
Vue.prototype.$cookieStore = {
setCookie,
getCookie,
delCookie
}
}
}
</script>

@ -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();
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

@ -1,10 +1,13 @@
<template>
<el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="账号" prop="username">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm" label-width="100px" status-icon>
<h4 align="center">欢迎来到国防科大请销假系统</h4>
<el-form-item label="账号" maxlength="255" prop="username">
<el-input v-model="ruleForm.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input type="password" v-model="ruleForm.password" autocomplete="off"></el-input>
<el-form-item label="密码" maxlength="255" prop="password">
<el-input v-model="ruleForm.password" autocomplete="off" type="password"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')"></el-button>
@ -12,6 +15,11 @@
</el-form-item>
</el-form>
</template>
<style scoped>
.inputStyle {
text-align: center;
}
</style>
<script>
export default {
@ -32,7 +40,9 @@ export default {
};
},
methods: {
submitForm(formName) {
const _this = this
this.$refs[formName].validate((valid) => {
if (valid) {
@ -44,6 +54,7 @@ export default {
} else {
const id = resp.data.split(' ')[0];
const type = resp.data.split(' ')[1];
_this.$cookieStore.setCookie("login_id", id, 1);
_this.$alert('登录成功!', '登录消息', {
confirmButtonText: '确定',
callback: action => {
@ -61,7 +72,8 @@ export default {
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
}
}
</script>

@ -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) {

@ -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) {

@ -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

@ -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
})

@ -21,7 +21,7 @@
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="外出地点" prop="place">
<el-form-item label="外出地点" maxlength="255" prop="place">
<el-autocomplete
v-model="ruleForm.place"
:fetch-suggestions="querySearch"
@ -30,7 +30,7 @@
></el-autocomplete>
</el-form-item>
<p></p>
<el-form-item label="外出理由" prop="reason">
<el-form-item label="外出理由" maxlength="255" prop="reason">
<el-input v-model="ruleForm.reason"></el-input>
</el-form-item>
<el-form-item>
@ -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")
}
}
})
}
}
</script>

@ -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

@ -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

@ -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
})

@ -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

@ -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

@ -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

Loading…
Cancel
Save