-
+
@@ -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 => {})
+ }
}
}