From 7e9353412f0c99c6b2d88556b8ee079ad5c4711c Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 21 May 2021 10:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=B5=8B=E8=AF=95=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E7=8E=AF=E5=A2=83=E5=AD=90=E7=B3=BB=E7=BB=9F=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Footer.vue | 2 +- src/components/page/AddProject.vue | 10 ++++------ src/components/page/Login.vue | 4 ++-- src/components/page/Role.vue | 23 ++++------------------- src/components/page/Staff.vue | 4 ++-- src/components/page/dashboard.vue | 20 ++++++++++---------- src/components/page/evaluation.vue | 10 +++++++--- src/components/page/project.vue | 17 ++++++++++------- src/components/page/student.vue | 6 +++++- src/utils/http.js | 29 +++++++++++++++++------------ 10 files changed, 62 insertions(+), 63 deletions(-) diff --git a/src/components/common/Footer.vue b/src/components/common/Footer.vue index d3217f0..4245605 100644 --- a/src/components/common/Footer.vue +++ b/src/components/common/Footer.vue @@ -1,7 +1,7 @@ diff --git a/src/components/page/AddProject.vue b/src/components/page/AddProject.vue index 002043b..83f1a7d 100644 --- a/src/components/page/AddProject.vue +++ b/src/components/page/AddProject.vue @@ -469,12 +469,10 @@ },500) }, projectPermission(val){ - if(!this.id){ - if(val){ - this.flag02 = false - }else{ - this.flag02 = true - } + if(val){ + this.flag02 = false + }else{ + this.flag02 = true } } }, diff --git a/src/components/page/Login.vue b/src/components/page/Login.vue index 26160c8..1eacf90 100644 --- a/src/components/page/Login.vue +++ b/src/components/page/Login.vue @@ -67,8 +67,8 @@ export default { data: function() { return { param: { - username: 'admin', - password: 'admin' + username: '', + password: '' }, rules: { username: [{ required: true, message: '请输入用户名', trigger: 'blur' }], diff --git a/src/components/page/Role.vue b/src/components/page/Role.vue index a328cee..2fe43b2 100644 --- a/src/components/page/Role.vue +++ b/src/components/page/Role.vue @@ -1,21 +1,5 @@ @@ -389,7 +389,7 @@ export default { keyword: function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.getData() + this.initData() },500) } }, @@ -409,6 +409,10 @@ export default { }) .catch(err => {}) }, + initData(){ + this.pageNo = 1 + this.getData() + }, resetForm() { this.topicForm = { answer: '', diff --git a/src/components/page/project.vue b/src/components/page/project.vue index 9b0f3a5..b47e001 100644 --- a/src/components/page/project.vue +++ b/src/components/page/project.vue @@ -20,21 +20,21 @@
- +
- +
- +
- + @@ -220,7 +219,7 @@ export default { keyword: function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.getData() + this.initData() },500) } }, @@ -257,6 +256,10 @@ export default { this.totals = res.pageInfo.total }).catch(res => {}); }, + initData(){ + this.pageNo = 1 + this.getData() + }, handlePage(){ let list = this.projectDataAll let result = list.slice((this.pageNo - 1) * this.pageSize,this.pageNo * this.pageSize) diff --git a/src/components/page/student.vue b/src/components/page/student.vue index f2b0b9c..7b889e2 100644 --- a/src/components/page/student.vue +++ b/src/components/page/student.vue @@ -257,7 +257,7 @@ export default { keyword: function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.getData() + this.initData() },500) } }, @@ -274,6 +274,10 @@ export default { this.totals = res.data.totalCount }).catch(res => {}); }, + initData(){ + this.pageNo = 1 + this.getData() + }, saveData() { this.$refs.form.validate((valid) => { if (valid) { diff --git a/src/utils/http.js b/src/utils/http.js index c309adb..03f61d3 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -101,21 +101,26 @@ axios.interceptors.request.use(config => { // } // ); +function logouts(){ + store.replaceState({}) + sessionStorage.removeItem('sta_server_username') + location.reload() +} + let logout = false export function getToken(){ - // console.log(store.state.dataTime,logout) if(process.env.NODE_ENV == 'production'){ - // if(store.state.dataTime && !logout){ - // axios.get(`${api.queryToken}?token=${store.state.token}`).then(res => { - // if(store.state.dataTime && (res.data.message != store.state.dataTime)){ - // logout || Message.error('您已在另一台设备登录,本次登录已下线!') - // logout = true - // setTimeout(() => { - // core.logout() - // },1500) - // } - // }).catch(err => {}) - // } + if(store.state.dataTime && !logout){ + axios.get(`${api.queryToken}?token=${store.state.token}`).then(res => { + if(store.state.dataTime && (res.data.message != store.state.dataTime)){ + logout || Message.error('您已在另一台设备登录,本次登录已下线!') + logout = true + setTimeout(() => { + logouts() + },1500) + } + }).catch(err => {}) + } } }