feat: 登录过期弹框->重新登录;优化任务日志查询

This commit is contained in:
taojinlong 2021-08-03 11:08:57 +08:00
parent 532cdf67b4
commit ed71f845de
6 changed files with 25 additions and 7 deletions

View File

@ -111,7 +111,7 @@ export function batchEdit(data) {
}) })
} }
export function post(url, data, showLoading = true, timeout = 10000) { export function post(url, data, showLoading = true, timeout = 20000) {
return request({ return request({
url: url, url: url,
method: 'post', method: 'post',

View File

@ -126,7 +126,8 @@ export default {
expires: 'Login token expired, please login again', expires: 'Login token expired, please login again',
tokenError: 'Token error, please login again', tokenError: 'Token error, please login again',
username_error: 'Please enter the correct ID', username_error: 'Please enter the correct ID',
password_error: 'The password can not be less than 8 digits' password_error: 'The password can not be less than 8 digits',
re_login: 'Login again'
}, },
commons: { commons: {
no_target_permission: 'No permission', no_target_permission: 'No permission',

View File

@ -126,7 +126,8 @@ export default {
expires: '登陸信息過期,請重新登陸', expires: '登陸信息過期,請重新登陸',
tokenError: '信息錯誤,請重新登陸', tokenError: '信息錯誤,請重新登陸',
username_error: '請輸入正確的 ID', username_error: '請輸入正確的 ID',
password_error: '密碼不小於 8 位' password_error: '密碼不小於 8 位',
re_login: '重新登陸'
}, },
commons: { commons: {
no_target_permission: '沒有權限', no_target_permission: '沒有權限',

View File

@ -126,7 +126,8 @@ export default {
expires: '登录信息过期,请重新登录', expires: '登录信息过期,请重新登录',
tokenError: '登陆信息错误,请重新登录', tokenError: '登陆信息错误,请重新登录',
username_error: '请输入正确的 ID', username_error: '请输入正确的 ID',
password_error: '密码不小于 8 位' password_error: '密码不小于 8 位',
re_login: '重新登录'
}, },
commons: { commons: {
no_target_permission: '没有权限', no_target_permission: '没有权限',

View File

@ -52,6 +52,10 @@ service.interceptors.request.use(
} }
) )
const defaultOptions = {
confirmButtonText: i18n.t('login.re_login')
}
const checkAuth = response => { const checkAuth = response => {
// 请根据实际需求修改 // 请根据实际需求修改
@ -62,7 +66,7 @@ const checkAuth = response => {
store.dispatch('user/logout').then(() => { store.dispatch('user/logout').then(() => {
location.reload() location.reload()
}) })
}) }, defaultOptions)
} }
if (response.headers['authentication-status'] === 'invalid') { if (response.headers['authentication-status'] === 'invalid') {

View File

@ -56,6 +56,7 @@ import ComplexTable from '@/components/business/complex-table'
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index' import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { post } from '@/api/dataset/dataset' import { post } from '@/api/dataset/dataset'
import {loadMenus} from "@/permission";
export default { export default {
name: 'TaskRecord', name: 'TaskRecord',
@ -116,7 +117,8 @@ export default {
last_condition: null, last_condition: null,
show_error_massage: false, show_error_massage: false,
error_massage: '', error_massage: '',
matchLogId: null matchLogId: null,
lastRequestComplete: true
} }
}, },
computed: { computed: {
@ -139,7 +141,7 @@ export default {
if (!this.timer) { if (!this.timer) {
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.search(this.last_condition, false) this.search(this.last_condition, false)
}, 10000) }, 1000)
} }
}, },
destroyTimer() { destroyTimer() {
@ -167,6 +169,12 @@ export default {
select(selection) { select(selection) {
}, },
search(condition, showLoading = true) { search(condition, showLoading = true) {
if(!this.lastRequestComplete){
return;
}else {
this.lastRequestComplete = false;
}
this.last_condition = condition this.last_condition = condition
condition = formatQuickCondition(condition, 'dataset_table_task.name') condition = formatQuickCondition(condition, 'dataset_table_task.name')
const temp = formatCondition(condition) const temp = formatCondition(condition)
@ -175,6 +183,9 @@ export default {
post('/dataset/taskLog/list/notexcel/' + this.paginationConfig.currentPage + '/' + this.paginationConfig.pageSize, param, showLoading).then(response => { post('/dataset/taskLog/list/notexcel/' + this.paginationConfig.currentPage + '/' + this.paginationConfig.pageSize, param, showLoading).then(response => {
this.data = response.data.listObject this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount this.paginationConfig.total = response.data.itemCount
this.lastRequestComplete = true;
}).catch(() => {
this.lastRequestComplete = true;
}) })
}, },
showErrorMassage(massage) { showErrorMassage(massage) {